Skip to content

Refine PubChem search parameter passing to align with generic_request patterns#74

Draft
Copilot wants to merge 5 commits intointegrationfrom
copilot/add-pubchem-search-functionality
Draft

Refine PubChem search parameter passing to align with generic_request patterns#74
Copilot wants to merge 5 commits intointegrationfrom
copilot/add-pubchem-search-functionality

Conversation

Copy link
Contributor

Copilot AI commented Feb 2, 2026

The PubChem search functions were passing query parameters through an options list wrapper instead of directly via the ellipsis, creating unnecessary nesting.

Changes

  • Parameter passing: Changed from generic_request(..., options = options) to do.call(generic_request, c(list(...), query_params)) pattern
  • Query parameters: Built dynamically in query_params list, merged directly into function call
  • Consistency: Now matches the parameter passing pattern used by cc_search and aligns with how generic_request processes ellipsis arguments (lines 120-127)

Implementation

# Before
options <- list()
if (use_post && input_type == "smiles") {
  options[[input_type]] <- query
}
result <- generic_request(..., options = options)

# After  
query_params <- list()
if (use_post && input_type == "smiles") {
  query_params[[input_type]] <- query
}
result <- do.call(generic_request, c(list(...), query_params))

The functions still use generic_request() with batch_limit = 0 (static endpoint pattern) and leverage httr2 through the abstraction layer as required.

Original prompt

Create a new branch called feat-pubchem-search. I want a new function that will search the PubChem database through the API (https://pubchem.ncbi.nlm.nih.gov/docs/pug-rest#section=Input) and resolved searches for me. There should be a single search request and bulk search request.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 2, 2026 19:29
Co-authored-by: seanthimons <141747936+seanthimons@users.noreply.github.com>
Co-authored-by: seanthimons <141747936+seanthimons@users.noreply.github.com>
…nt rate limit

Co-authored-by: seanthimons <141747936+seanthimons@users.noreply.github.com>
Copilot AI changed the title [WIP] Add PubChem search functionality through API Add PubChem PUG REST API search functions Feb 2, 2026
Copilot AI requested a review from seanthimons February 2, 2026 19:34
…sely

Co-authored-by: seanthimons <141747936+seanthimons@users.noreply.github.com>
Copilot AI changed the title Add PubChem PUG REST API search functions Refine PubChem search parameter passing to align with generic_request patterns Feb 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants