TessituraService: TessituraService

Description Details Public fields Methods Examples

Description

TessituraService

TessituraService

Details

A TessituraService class

This is a more useable Tessitura Service class that can be implemented by further objects to create requests.

Public fields

tessituraUrl

Base Tessitura REST API url

credentials

Base64 encoded credentials - can be created with createCredentials()

defaultHeaders

Default headers for all requests

timeout

The maximum timeout for a request

maxRetryAttempts

The maximum number of times to retry a request before failing

Methods

Public methods


Method new()

Constructor

Usage
TessituraService$new(
  tessituraUrl,
  credentials,
  defaultHeaders = NULL,
  timeout = 5000,
  maxRetryAttempts = 3
)
Arguments
tessituraUrl

Base Tessitura REST API url

credentials

Base64 encoded credentials

defaultHeaders

Default headers for all requests

timeout

The maximum timeout for a request. Defaults to 5000.

maxRetryAttempts

The maximum number of times to retry a request before failing. Defaults to 3.


Method CallTessi()

Call a Tessitura endpoint with retries

Usage
TessituraService$CallTessi(url, method, queryParams, headerParams, body, ...)
Arguments
url

The endpoint to request relative to the tessituraUrl

method

The HTTP method

queryParams

The query parameters for the request

headerParams

Any additional headers to attach to the request

body

The request body for POST and PUT methods

...

Any other parameters for the httr methods


Method Execute()

Execute a request

Usage
TessituraService$Execute(url, method, queryParams, headerParams, body, ...)
Arguments
url

The endpoint to request relative to the tessituraUrl

method

The HTTP method

queryParams

The query parameters for the request

headerParams

Any additional headers to attach to the request

body

The request body for POST and PUT methods

...

Any other parameters for the httr methods


Method deserialize()

Deserialize the content of api response to the given type.

Usage
TessituraService$deserialize(resp, returnType, pkgEnv)
Arguments
resp

The response object

returnType

The type of object to return

pkgEnv

The environment to find the type in


Method deserializeObj()

Deserialize the response from jsonlite object based on the given type by handling complex and nested types by iterating recursively Example returnTypes will be like "array[integer]", "map(Performance)", "array[map(Performance)]", etc.,

Usage
TessituraService$deserializeObj(obj, returnType, pkgEnv)
Arguments
obj

The object to deserialize

returnType

The type of object to return

pkgEnv

The environment to find the type in


Method clone()

The objects of this class are cloneable with this method.

Usage
TessituraService$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

1
2
3
4
TessituraService$new(
tessituraUrl = "https://mytessi.tessituranetwork.com",
credentials = createCredentials(username="creif", usergroup="admin", location="MET95", password="impresario")
)

gdgkirkley/tessituraR documentation built on Feb. 3, 2022, 6:21 p.m.