Service {AnVIL}R Documentation

RESTful service constructor

Description

RESTful service constructor

Usage

Service(
  service,
  host,
  config = httr::config(),
  authenticate = TRUE,
  api_url = character(),
  package = "AnVIL",
  schemes = "https"
)

Arguments

service

character(1) The 'Service' class name, e.g., '"terra"'.

host

character(1) host name that provides the API resource, e.g., '"api.firecloud.org"'.

config

httr::config() curl options

authenticate

logical(1) use credentials from authentication service file 'auth.json' in the specified package?

api_url

optional character(1) url location of OpenAPI '.json' or '.yaml' service definition.

package

character(1) (default 'AnVIL') The package where 'api.json' yaml and (optionally) 'auth.json' files are located

schemes

character(1) (default 'https') Specifies the transfer protocol supported by the API service

Details

This function creates a RESTful interface to a service provided by a host, e.g., "api.firecloud.org". The function requires an OpenAPI '.json' or '.yaml' specifcation as well as an (optional) '.json' authentication token. These files are located in the source directory of a pacakge, at '<package>/inst/service/<service>/api.json' and '<package>/inst/service/<service>/auth.json', or at 'api_url'.

The service is usually a singleton, created at the package level during '.onLoad()'.

Value

An object of class Service.

Examples

.MyService <- setClass("MyService", contains = "Service")

MyService <- function() {
    .MyService(Service("my_service", host="my.api.org"))
}


[Package AnVIL version 1.0.3 Index]