Skip to content

Commit

Permalink
Patch/schematic api (#156)
Browse files Browse the repository at this point in the history
* Fix docs typo

* Handle access token updates in schematic API service

* Bump version
  • Loading branch information
anngvu authored Nov 17, 2023
1 parent 8b9e160 commit 93a65d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: nfportalutils
Title: NF Portal Utilities
Version: 0.0.0.945
Version: 0.0.0.946
Authors@R: c(
person(given = "Robert", family = "Allaway", role = c("aut", "cre"),
email = "robert.allaway@sagebionetworks.org",
Expand Down
9 changes: 4 additions & 5 deletions R/annotation_qc.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Generate manifest via schematic service
#'
#' See [schematic manifest generation](https://schematic.api.sagebionetworks.org/v1/ui/#/Manifest%20Operations/schematic_api.api.routes.get_manifest_route).
#' Note that this uses the access token of user that should already by logged in with `syn_login`.
#' Note that this uses the access token of user that should already be logged in with `syn_login`.
#'
#' @param data_type Data type of the manifest to generate (aka Component).
#' @param dataset_id Optional, if given this fills out manifest for existing dataset instead of generating a blank manifest.
Expand All @@ -22,7 +22,7 @@ manifest_generate <- function(data_type,
use_annotations = TRUE,
service = "https://schematic.api.sagebionetworks.org/v1/manifest/generate") {

# yes, param has been re-encoded like this for 'dataframe'
# yes, param needs to be re-encoded like this for 'dataframe'
output_format_param <- if (output_format == "dataframe") "dataframe (only if getting existing manifests)" else output_format
access_token <- .syn$credentials$secret
use_annotations <- tolower(as.character(use_annotations))
Expand All @@ -35,9 +35,8 @@ manifest_generate <- function(data_type,
use_annotations = use_annotations,
dataset_id = dataset_id,
asset_view = asset_view,
output_format = output_format_param,
access_token = access_token
))
output_format = output_format_param),
httr::add_headers(Authorization = paste("Bearer", access_token)))

status <- httr::status_code(req)
if(status != 200L) stop("Unsuccessful request, received status code: ", status)
Expand Down
2 changes: 1 addition & 1 deletion man/manifest_generate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 93a65d6

Please sign in to comment.