Skip to content

Commit

Permalink
Make minor refactorings to search_pv body
Browse files Browse the repository at this point in the history
  • Loading branch information
crew102 committed Sep 18, 2022
1 parent 16f3685 commit 052e560
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions R/search-pv.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,20 +251,17 @@ search_pv <- function(query,
# check_query(query, endpoint)
query <- jsonlite::toJSON(query, auto_unbox = TRUE)
}

arg_list <- to_arglist(fields, page, per_page, sort)
base_url <- get_base(endpoint)
res <- one_request(method, query, base_url, arg_list, api_key, ...)

# TODO(cbaker): better naming here
res <- process_resp(res)

if (!all_pages) return(res)
result <- one_request(method, query, base_url, arg_list, api_key, ...)
result <- process_resp(result)
if (!all_pages) return(result)

full_data <- request_apply(res, method, query, base_url, arg_list, api_key, ...)
res$data[[1]] <- full_data
full_data <- request_apply(result, method, query, base_url, arg_list, api_key, ...)
result$data[[1]] <- full_data

res
result
}

#' Get Linked Data
Expand Down

0 comments on commit 052e560

Please sign in to comment.