Skip to content

Commit

Permalink
Align Google APIs URLs with Discovery docs per #541 (#542)
Browse files Browse the repository at this point in the history
Fixes #542
  • Loading branch information
husseyd authored Oct 25, 2023
1 parent 9bd1425 commit 1b72565
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# bigrquery (development version)

* Align Google APIs URLs to Google Cloud Discovery docs. This enables support for Private and Restricted Google APIs configurations.
(@husseyd, #541)
- `R/bq-request.R`
- Substitute `https://bigquery.googleapis.com` for `https://www.googleapis.com`
- `R/gs-object.R`
- Substitute `https://storage.googleapis.com` for `https://www.googleapis.com`

# bigrquery 1.4.2

* Sync up with the current release of gargle (1.4.0). Recently gargle
Expand Down
4 changes: 2 additions & 2 deletions R/bq-request.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
base_url <- "https://www.googleapis.com/bigquery/v2/"
upload_url <- "https://www.googleapis.com/upload/bigquery/v2/"
base_url <- "https://bigquery.googleapis.com/bigquery/v2/"
upload_url <- "https://bigquery.googleapis.com/upload/bigquery/v2/"

prepare_bq_query <- function(query) {
api_key <- Sys.getenv("BIGRQUERY_API_KEY")
Expand Down
4 changes: 2 additions & 2 deletions R/gs-object.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ print.gs_object <- function(x, ...) {
}

gs_object_delete <- function(x, token = bq_token()) {
url <- glue_data(x, "https://www.googleapis.com/storage/v1/b/{bucket}/o/{object}")
url <- glue_data(x, "https://storage.googleapis.com/storage/v1/b/{bucket}/o/{object}")
req <- httr::DELETE(url, token, httr::user_agent(bq_ua()))
process_request(req)
}

gs_object_exists <- function(x, token = bq_token()) {
url <- glue_data(x, "https://www.googleapis.com/storage/v1/b/{bucket}/o/{object}")
url <- glue_data(x, "https://storage.googleapis.com/storage/v1/b/{bucket}/o/{object}")
req <- httr::GET(url, token, httr::user_agent(bq_ua()))
req$status_code != 404
}

0 comments on commit 1b72565

Please sign in to comment.