-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use split version of nectar::call_api (#53)
Also standardize some filenames, etc.
- Loading branch information
1 parent
eb4f4de
commit f4db307
Showing
13 changed files
with
90 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
# Set up the basic call once at package build. | ||
guru_req_base <- nectar::req_setup( | ||
"https://api.apis.guru/v2", | ||
user_agent = "TESTPKG (https://example.com)" | ||
) | ||
|
||
#' Call the APIs.guru API | ||
#' | ||
#' Generate a request to an APIs.guru endpoint. | ||
#' | ||
#' @inheritParams nectar::call_api | ||
#' @inheritParams nectar::req_modify | ||
#' | ||
#' @return The response from the endpoint. | ||
#' @export | ||
guru_call_api <- function(path, | ||
query = NULL, | ||
body = NULL, | ||
method = NULL) { | ||
nectar::call_api( | ||
base_url = "https://api.apis.guru/v2", | ||
req <- nectar::req_modify( | ||
guru_req_base, | ||
path = path, | ||
query = query, | ||
body = body, | ||
method = method, | ||
user_agent = "TESTPKG (https://example.com)" | ||
method = method | ||
) | ||
|
||
resp <- nectar::req_perform_opinionated(req) | ||
nectar::resp_parse(resp, response_parser = .guru_response_parser) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters