R/entities_api.R

# FireCloud
#
# FireCloud API 
#
# The version of the OpenAPI document: 0.1
# 
# Generated by: https://openapi-generator.tech

#' @docType class
#' @title Entities operations
#' @description openapi.Entities
#' @format An \code{R6Class} generator object
#' @field apiClient Handles the client-server communication.
#'
#' @section Methods:
#' \describe{
#' \strong{ BrowserDownloadEntitiesTSV } \emph{ TSV file containing workspace entities of the specified type  }
#' swagger-ui seems to not handle file downloads, so this endpoint won't function through the ui. It is here for documentation purposes only. 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @param } f.ctoken character
#' \item \emph{ @param } attribute.names character
#' \item \emph{ @param } model character
#'
#'
#' \item status code : 200 | Workspace entities of specified type in TSV format
#'
#' \item return type : data.frame 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or entity type does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ BrowserDownloadEntitiesTSVGet } \emph{ TSV file containing workspace entities of the specified type  }
#' swagger-ui seems to not handle file downloads, so this endpoint won't function through the ui. It is here for documentation purposes only. 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @param } attribute.names character
#' \item \emph{ @param } model character
#'
#'
#' \item status code : 200 | Workspace entities of specified type in TSV format
#'
#' \item return type : data.frame 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or entity type does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 414 | URI length exceeds the configured limit of 2048 characters. Please use the POST endpoint when it's necessary to supply a large number of attribute names. 
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ CopyEntities } \emph{ Copy entities from one workspace to another  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } body \link{CopyEntity}
#' \item \emph{ @param } link.existing.entities character
#' \item \emph{ @returnType } \link{EntityCopyResponse} \cr
#'
#'
#' \item status code : 201 | Successful Request
#'
#' \item return type : EntityCopyResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Source Workspace or source entities does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 409 | There are conflicts in your copy operation. Retry with the paramater linkExistingEntities=true to link all soft conflicts to the entities that already exist in your workspace.
#'
#' \item return type : EntityCopyResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 422 | Destination workspace must match source's authorization domain, if the source has one
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ DeleteEntities } \emph{ Bulk delete entities from a workspace }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } body list( \link{EntityID} )
#'
#'
#' \item status code : 204 | Successful Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Not all Entities exist
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 409 | Cannot create dangling references when deleting Entities - must specify whole set
#'
#' \item return type : array[EntityID] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ DownloadEntitiesTSV } \emph{ TSV file containing workspace entities of the specified type  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @param } attribute.names character
#' \item \emph{ @param } model character
#'
#'
#' \item status code : 200 | Workspace entities of specified type in TSV format
#'
#' \item return type : data.frame 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or entity type does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 414 | URI length exceeds the configured limit of 2048 characters. Please use the POST endpoint when it's necessary to supply a large number of attribute names. 
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ EntityQuery } \emph{ Paginated query for entities in a workspace }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @param } page integer
#' \item \emph{ @param } page.size integer
#' \item \emph{ @param } sort.field character
#' \item \emph{ @param } sort.direction Enum < [asc, desc] > 
#' \item \emph{ @param } filter.terms character
#' \item \emph{ @returnType } \link{EntityQueryResponse} \cr
#'
#'
#' \item status code : 200 | List of entities in workspace
#'
#' \item return type : EntityQueryResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or entity type does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ EvaluateEntityExpression } \emph{ Evaluate entity expression }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @param } entity.name character
#' \item \emph{ @param } expression character
#'
#'
#' \item status code : 200 | Success
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Invalid entity expression
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or Entity does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ FlexibleImportEntities } \emph{ Import entities from a tsv file }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entities data.frame
#'
#'
#' \item status code : 200 | Successful Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Source Workspace not found
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetEntities } \emph{ List of entities in a workspace  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @returnType } list( \link{Entity} ) \cr
#'
#'
#' \item status code : 200 | List of entities in workspace
#'
#' \item return type : array[Entity] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or entity type does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetEntitiesWithType } \emph{ List of entities in a workspace with type and attribute information  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#'
#'
#' \item status code : 200 | List of entities
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or entities not found.
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetEntity } \emph{ Get entity in a workspace }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @param } entity.name character
#'
#'
#' \item status code : 200 | Success
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or Entity does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ GetEntityTypes } \emph{ List of entity types in a workspace  }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#'
#'
#' \item status code : 200 | List of entity types in workspace
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace does not exist
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Server Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ImportBagit } \emph{ Import entity TSVs from a zipped [BagIt](https://tools.ietf.org/html/draft-kunze-bagit-14) directory, whose payload contains two files - participants.tsv and samples.tsv }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } bagit.import.request \link{BagitRequest}
#'
#'
#' \item status code : 200 | Successful Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Source Workspace not found
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ImportEntities } \emph{ Import entities from a tsv file }
#' 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entities data.frame
#'
#'
#' \item status code : 200 | Successful Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Source Workspace not found
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ImportPFB } \emph{ Import PFB data from an [Avro](https://avro.apache.org/) file }
#' This API will return a jobID representing the import operation. The import itself will continue asynchronously in the background. 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } pfb.import.request \link{PFBRequest}
#' \item \emph{ @returnType } \link{PFBResponse} \cr
#'
#'
#' \item status code : 202 | Successful Request
#'
#' \item return type : PFBResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 401 | Unauthorized access to Workspace
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | Forbidden access to Workspace
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace not found
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ImportPFBStatus } \emph{ Report status on a PFB import job }
#' This API will return status of an import jobID. The jobID was returned from a previous import request. 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } job.id character
#' \item \emph{ @returnType } \link{PFBStatusResponse} \cr
#'
#'
#' \item status code : 200 | Successful Request
#'
#' \item return type : PFBStatusResponse 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | workspace or job ID not found
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ ListImportPFBJobs } \emph{ List PFB import jobs in this workspace }
#' Lists all imports for this workspace, optionally filtered to only those imports currently in progress 
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } running.only character
#' \item \emph{ @returnType } list( \link{PFBStatusResponse} ) \cr
#'
#'
#' \item status code : 200 | Successful Request
#'
#' \item return type : array[PFBStatusResponse] 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Bad Request
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace not found
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Internal Error
#'
#'
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' \strong{ UpdateEntity } \emph{ Update entity in a workspace }
#' Update an entity
#'
#' \itemize{
#' \item \emph{ @param } workspace.namespace character
#' \item \emph{ @param } workspace.name character
#' \item \emph{ @param } entity.type character
#' \item \emph{ @param } entity.name character
#' \item \emph{ @param } attribute.update.json list( \link{AttributeUpdateOperation} )
#' \item \emph{ @returnType } \link{Entity} \cr
#'
#'
#' \item status code : 200 | Entity updated
#'
#' \item return type : Entity 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 400 | Attribute does not exist
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 403 | User does not have permission to update attributes in the namespace
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 404 | Workspace or Entity not found
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' \item status code : 500 | Rawls Internal Error
#'
#' \item return type : ErrorReport 
#' \item response headers :
#'
#' \tabular{ll}{
#' }
#' }
#'
#' }
#'
#'
#' @examples
#' \dontrun{
#' ####################  BrowserDownloadEntitiesTSV  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#' var.f.ctoken <- 'f.ctoken_example' # character | valid access token to use for authentication
#' var.attribute.names <- 'attribute.names_example' # character | comma separated list of ordered attribute names to be in downloaded tsv
#' var.model <- 'model_example' # character | flexible or firecloud (firecloud model will be used by default)
#'
#' #TSV file containing workspace entities of the specified type 
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$BrowserDownloadEntitiesTSV(var.workspace.namespace, var.workspace.name, var.entity.type, var.f.ctoken, attribute.names=var.attribute.names, model=var.model)
#'
#'
#' ####################  BrowserDownloadEntitiesTSVGet  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#' var.attribute.names <- 'attribute.names_example' # character | comma separated list of ordered attribute names to be in downloaded tsv
#' var.model <- 'model_example' # character | flexible or firecloud (firecloud model will be used by default)
#'
#' #TSV file containing workspace entities of the specified type 
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$BrowserDownloadEntitiesTSVGet(var.workspace.namespace, var.workspace.name, var.entity.type, attribute.names=var.attribute.names, model=var.model)
#'
#'
#' ####################  CopyEntities  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Destination Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Destination Workspace Name
#' var.body <- CopyEntity$new() # CopyEntity | Entities to Copy
#' var.link.existing.entities <- FALSE # character | true to link new entities to existing entities, false to fail instead of link
#'
#' #Copy entities from one workspace to another 
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$CopyEntities(var.workspace.namespace, var.workspace.name, var.body, link.existing.entities=var.link.existing.entities)
#'
#'
#' ####################  DeleteEntities  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.body <- [EntityID$new()] # array[EntityID] | Entities to delete
#'
#' #Bulk delete entities from a workspace
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$DeleteEntities(var.workspace.namespace, var.workspace.name, var.body)
#'
#'
#' ####################  DownloadEntitiesTSV  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#' var.attribute.names <- 'attribute.names_example' # character | comma separated list of ordered attribute names to be in downloaded tsv
#' var.model <- 'model_example' # character | firecloud (default) or flexible
#'
#' #TSV file containing workspace entities of the specified type 
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$DownloadEntitiesTSV(var.workspace.namespace, var.workspace.name, var.entity.type, attribute.names=var.attribute.names, model=var.model)
#'
#'
#' ####################  EntityQuery  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#' var.page <- 1 # integer | Page number, 1-indexed (default 1)
#' var.page.size <- 10 # integer | Page size (default 10)
#' var.sort.field <- 'name' # character | Sort field (default \"name\")
#' var.sort.direction <- 'asc' # character | Sort direction (asc or desc, default asc)
#' var.filter.terms <- 'filter.terms_example' # character | Filter terms
#'
#' #Paginated query for entities in a workspace
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$EntityQuery(var.workspace.namespace, var.workspace.name, var.entity.type, page=var.page, page.size=var.page.size, sort.field=var.sort.field, sort.direction=var.sort.direction, filter.terms=var.filter.terms)
#'
#'
#' ####################  EvaluateEntityExpression  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#' var.entity.name <- 'entity.name_example' # character | Entity Name
#' var.expression <- 'expression_example' # character | Expression
#'
#' #Evaluate entity expression
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$EvaluateEntityExpression(var.workspace.namespace, var.workspace.name, var.entity.type, var.entity.name, var.expression)
#'
#'
#' ####################  FlexibleImportEntities  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Destination Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Destination Workspace Name
#' var.entities <- File.new('/path/to/file') # data.frame | A valid TSV import file
#'
#' #Import entities from a tsv file
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$FlexibleImportEntities(var.workspace.namespace, var.workspace.name, var.entities)
#'
#'
#' ####################  GetEntities  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#'
#' #List of entities in a workspace 
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$GetEntities(var.workspace.namespace, var.workspace.name, var.entity.type)
#'
#'
#' ####################  GetEntitiesWithType  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#'
#' #List of entities in a workspace with type and attribute information 
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$GetEntitiesWithType(var.workspace.namespace, var.workspace.name)
#'
#'
#' ####################  GetEntity  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#' var.entity.name <- 'entity.name_example' # character | Entity Name
#'
#' #Get entity in a workspace
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$GetEntity(var.workspace.namespace, var.workspace.name, var.entity.type, var.entity.name)
#'
#'
#' ####################  GetEntityTypes  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#'
#' #List of entity types in a workspace 
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$GetEntityTypes(var.workspace.namespace, var.workspace.name)
#'
#'
#' ####################  ImportBagit  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.bagit.import.request <- BagitRequest$new() # BagitRequest | JSON object containing bagit URL
#'
#' #Import entity TSVs from a zipped [BagIt](https://tools.ietf.org/html/draft-kunze-bagit-14) directory, whose payload contains two files - participants.tsv and samples.tsv
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ImportBagit(var.workspace.namespace, var.workspace.name, var.bagit.import.request)
#'
#'
#' ####################  ImportEntities  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Destination Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Destination Workspace Name
#' var.entities <- File.new('/path/to/file') # data.frame | A valid TSV import file
#'
#' #Import entities from a tsv file
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ImportEntities(var.workspace.namespace, var.workspace.name, var.entities)
#'
#'
#' ####################  ImportPFB  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.pfb.import.request <- PFBRequest$new() # PFBRequest | JSON object containing PFB URL
#'
#' #Import PFB data from an [Avro](https://avro.apache.org/) file
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ImportPFB(var.workspace.namespace, var.workspace.name, var.pfb.import.request)
#'
#'
#' ####################  ImportPFBStatus  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.job.id <- 'job.id_example' # character | job ID of the import to check
#'
#' #Report status on a PFB import job
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ImportPFBStatus(var.workspace.namespace, var.workspace.name, var.job.id)
#'
#'
#' ####################  ListImportPFBJobs  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.running.only <- FALSE # character | When true, filters to only those imports currently in progress
#'
#' #List PFB import jobs in this workspace
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$ListImportPFBJobs(var.workspace.namespace, var.workspace.name, running.only=var.running.only)
#'
#'
#' ####################  UpdateEntity  ####################
#'
#' library(openapi)
#' var.workspace.namespace <- 'workspace.namespace_example' # character | Workspace Namespace
#' var.workspace.name <- 'workspace.name_example' # character | Workspace Name
#' var.entity.type <- 'entity.type_example' # character | Entity Type
#' var.entity.name <- 'entity.name_example' # character | Entity Name
#' var.attribute.update.json <- [AttributeUpdateOperation$new()] # array[AttributeUpdateOperation] | Update operations for attributes
#'
#' #Update entity in a workspace
#' api.instance <- EntitiesApi$new()
#'
#' # Configure OAuth2 access token for authorization: googleoauth
#' api.instance$apiClient$accessToken <- 'TODO_YOUR_ACCESS_TOKEN';
#'
#' result <- api.instance$UpdateEntity(var.workspace.namespace, var.workspace.name, var.entity.type, var.entity.name, attribute.update.json=var.attribute.update.json)
#'
#'
#' }
#' @importFrom R6 R6Class
#' @importFrom base64enc base64encode
#' @export
EntitiesApi <- R6::R6Class(
  'EntitiesApi',
  public = list(
    apiClient = NULL,
    initialize = function(apiClient){
      if (!missing(apiClient)) {
        self$apiClient <- apiClient
      }
      else {
        self$apiClient <- ApiClient$new()
      }
    },
    BrowserDownloadEntitiesTSV = function(workspace.namespace, workspace.name, entity.type, f.ctoken, attribute.names=NULL, model=NULL, ...){
      apiResponse <- self$BrowserDownloadEntitiesTSVWithHttpInfo(workspace.namespace, workspace.name, entity.type, f.ctoken, attribute.names, model, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    BrowserDownloadEntitiesTSVWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, f.ctoken, attribute.names=NULL, model=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      if (missing(`f.ctoken`)) {
        stop("Missing required parameter `f.ctoken`.")
      }

      body <- list(
        "FCtoken" = f.ctoken,
        "attributeNames" = attribute.names,
        "model" = model
      )

      urlPath <- "/cookie-authed/workspaces/{workspaceNamespace}/{workspaceName}/entities/{entityType}/tsv"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "data.frame", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    BrowserDownloadEntitiesTSVGet = function(workspace.namespace, workspace.name, entity.type, attribute.names=NULL, model=NULL, ...){
      apiResponse <- self$BrowserDownloadEntitiesTSVGetWithHttpInfo(workspace.namespace, workspace.name, entity.type, attribute.names, model, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    BrowserDownloadEntitiesTSVGetWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, attribute.names=NULL, model=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      queryParams['attributeNames'] <- attribute.names

      queryParams['model'] <- model

      body <- NULL
      urlPath <- "/cookie-authed/workspaces/{workspaceNamespace}/{workspaceName}/entities/{entityType}/tsv"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "data.frame", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    CopyEntities = function(workspace.namespace, workspace.name, body, link.existing.entities=FALSE, ...){
      apiResponse <- self$CopyEntitiesWithHttpInfo(workspace.namespace, workspace.name, body, link.existing.entities, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    CopyEntitiesWithHttpInfo = function(workspace.namespace, workspace.name, body, link.existing.entities=FALSE, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`body`)) {
        stop("Missing required parameter `body`.")
      }

      queryParams['linkExistingEntities'] <- link.existing.entities

      if (!missing(`body`)) {
        body <- `body`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities/copy"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "EntityCopyResponse", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    DeleteEntities = function(workspace.namespace, workspace.name, body, ...){
      apiResponse <- self$DeleteEntitiesWithHttpInfo(workspace.namespace, workspace.name, body, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    DeleteEntitiesWithHttpInfo = function(workspace.namespace, workspace.name, body, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`body`)) {
        stop("Missing required parameter `body`.")
      }

      if (!missing(`body`)) {
        body.items = paste(unlist(lapply(body, function(param){param$toJSONString()})), collapse = ",")
        body <- paste0('[', body.items, ']')
      } else {
        body <- NULL
      }

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities/delete"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    DownloadEntitiesTSV = function(workspace.namespace, workspace.name, entity.type, attribute.names=NULL, model=NULL, ...){
      apiResponse <- self$DownloadEntitiesTSVWithHttpInfo(workspace.namespace, workspace.name, entity.type, attribute.names, model, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    DownloadEntitiesTSVWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, attribute.names=NULL, model=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      queryParams['attributeNames'] <- attribute.names

      queryParams['model'] <- model

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities/{entityType}/tsv"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "data.frame", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    EntityQuery = function(workspace.namespace, workspace.name, entity.type, page=1, page.size=10, sort.field='name', sort.direction='asc', filter.terms=NULL, ...){
      apiResponse <- self$EntityQueryWithHttpInfo(workspace.namespace, workspace.name, entity.type, page, page.size, sort.field, sort.direction, filter.terms, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    EntityQueryWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, page=1, page.size=10, sort.field='name', sort.direction='asc', filter.terms=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      queryParams['page'] <- page

      queryParams['pageSize'] <- page.size

      queryParams['sortField'] <- sort.field

      queryParams['sortDirection'] <- sort.direction

      queryParams['filterTerms'] <- filter.terms

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entityQuery/{entityType}"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "EntityQueryResponse", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    EvaluateEntityExpression = function(workspace.namespace, workspace.name, entity.type, entity.name, expression, ...){
      apiResponse <- self$EvaluateEntityExpressionWithHttpInfo(workspace.namespace, workspace.name, entity.type, entity.name, expression, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    EvaluateEntityExpressionWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, entity.name, expression, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      if (missing(`entity.name`)) {
        stop("Missing required parameter `entity.name`.")
      }

      if (missing(`expression`)) {
        stop("Missing required parameter `expression`.")
      }

      if (!missing(`expression`)) {
        body <- `expression`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities/{entityType}/{entityName}/evaluate"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.name`)) {
        urlPath <- gsub(paste0("\\{", "entityName", "\\}"), URLencode(as.character(`entity.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    FlexibleImportEntities = function(workspace.namespace, workspace.name, entities, ...){
      apiResponse <- self$FlexibleImportEntitiesWithHttpInfo(workspace.namespace, workspace.name, entities, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    FlexibleImportEntitiesWithHttpInfo = function(workspace.namespace, workspace.name, entities, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entities`)) {
        stop("Missing required parameter `entities`.")
      }

      body <- list(
        "entities" = httr::upload_file(entities)
      )

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/flexibleImportEntities"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GetEntities = function(workspace.namespace, workspace.name, entity.type, ...){
      apiResponse <- self$GetEntitiesWithHttpInfo(workspace.namespace, workspace.name, entity.type, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GetEntitiesWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities/{entityType}"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[Entity]", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GetEntitiesWithType = function(workspace.namespace, workspace.name, ...){
      apiResponse <- self$GetEntitiesWithTypeWithHttpInfo(workspace.namespace, workspace.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GetEntitiesWithTypeWithHttpInfo = function(workspace.namespace, workspace.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities_with_type"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GetEntity = function(workspace.namespace, workspace.name, entity.type, entity.name, ...){
      apiResponse <- self$GetEntityWithHttpInfo(workspace.namespace, workspace.name, entity.type, entity.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GetEntityWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, entity.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      if (missing(`entity.name`)) {
        stop("Missing required parameter `entity.name`.")
      }

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities/{entityType}/{entityName}"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.name`)) {
        urlPath <- gsub(paste0("\\{", "entityName", "\\}"), URLencode(as.character(`entity.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    GetEntityTypes = function(workspace.namespace, workspace.name, ...){
      apiResponse <- self$GetEntityTypesWithHttpInfo(workspace.namespace, workspace.name, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    GetEntityTypesWithHttpInfo = function(workspace.namespace, workspace.name, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ImportBagit = function(workspace.namespace, workspace.name, bagit.import.request, ...){
      apiResponse <- self$ImportBagitWithHttpInfo(workspace.namespace, workspace.name, bagit.import.request, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ImportBagitWithHttpInfo = function(workspace.namespace, workspace.name, bagit.import.request, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`bagit.import.request`)) {
        stop("Missing required parameter `bagit.import.request`.")
      }

      if (!missing(`bagit.import.request`)) {
        body <- `bagit.import.request`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/importBagit"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ImportEntities = function(workspace.namespace, workspace.name, entities, ...){
      apiResponse <- self$ImportEntitiesWithHttpInfo(workspace.namespace, workspace.name, entities, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ImportEntitiesWithHttpInfo = function(workspace.namespace, workspace.name, entities, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entities`)) {
        stop("Missing required parameter `entities`.")
      }

      body <- list(
        "entities" = httr::upload_file(entities)
      )

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/importEntities"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        ApiResponse$new(NULL, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ImportPFB = function(workspace.namespace, workspace.name, pfb.import.request, ...){
      apiResponse <- self$ImportPFBWithHttpInfo(workspace.namespace, workspace.name, pfb.import.request, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ImportPFBWithHttpInfo = function(workspace.namespace, workspace.name, pfb.import.request, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`pfb.import.request`)) {
        stop("Missing required parameter `pfb.import.request`.")
      }

      if (!missing(`pfb.import.request`)) {
        body <- `pfb.import.request`$toJSONString()
      } else {
        body <- NULL
      }

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/importPFB"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "POST",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "PFBResponse", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ImportPFBStatus = function(workspace.namespace, workspace.name, job.id, ...){
      apiResponse <- self$ImportPFBStatusWithHttpInfo(workspace.namespace, workspace.name, job.id, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ImportPFBStatusWithHttpInfo = function(workspace.namespace, workspace.name, job.id, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`job.id`)) {
        stop("Missing required parameter `job.id`.")
      }

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/importPFB/{jobId}"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`job.id`)) {
        urlPath <- gsub(paste0("\\{", "jobId", "\\}"), URLencode(as.character(`job.id`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "PFBStatusResponse", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    ListImportPFBJobs = function(workspace.namespace, workspace.name, running.only=FALSE, ...){
      apiResponse <- self$ListImportPFBJobsWithHttpInfo(workspace.namespace, workspace.name, running.only, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    ListImportPFBJobsWithHttpInfo = function(workspace.namespace, workspace.name, running.only=FALSE, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      queryParams['running_only'] <- running.only

      body <- NULL
      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/importPFB"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "GET",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "array[PFBStatusResponse]", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    },
    UpdateEntity = function(workspace.namespace, workspace.name, entity.type, entity.name, attribute.update.json=NULL, ...){
      apiResponse <- self$UpdateEntityWithHttpInfo(workspace.namespace, workspace.name, entity.type, entity.name, attribute.update.json, ...)
      resp <- apiResponse$response
      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        apiResponse$content
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        apiResponse
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        apiResponse
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        apiResponse
      }
    },

    UpdateEntityWithHttpInfo = function(workspace.namespace, workspace.name, entity.type, entity.name, attribute.update.json=NULL, ...){
      args <- list(...)
      queryParams <- list()
      headerParams <- c()

      if (missing(`workspace.namespace`)) {
        stop("Missing required parameter `workspace.namespace`.")
      }

      if (missing(`workspace.name`)) {
        stop("Missing required parameter `workspace.name`.")
      }

      if (missing(`entity.type`)) {
        stop("Missing required parameter `entity.type`.")
      }

      if (missing(`entity.name`)) {
        stop("Missing required parameter `entity.name`.")
      }

      if (!missing(`attribute.update.json`)) {
        body.items = paste(unlist(lapply(attribute.update.json, function(param){param$toJSONString()})), collapse = ",")
        body <- paste0('[', body.items, ']')
      } else {
        body <- NULL
      }

      urlPath <- "/api/workspaces/{workspaceNamespace}/{workspaceName}/entities/{entityType}/{entityName}"
      if (!missing(`workspace.namespace`)) {
        urlPath <- gsub(paste0("\\{", "workspaceNamespace", "\\}"), URLencode(as.character(`workspace.namespace`), reserved = TRUE), urlPath)
      }

      if (!missing(`workspace.name`)) {
        urlPath <- gsub(paste0("\\{", "workspaceName", "\\}"), URLencode(as.character(`workspace.name`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.type`)) {
        urlPath <- gsub(paste0("\\{", "entityType", "\\}"), URLencode(as.character(`entity.type`), reserved = TRUE), urlPath)
      }

      if (!missing(`entity.name`)) {
        urlPath <- gsub(paste0("\\{", "entityName", "\\}"), URLencode(as.character(`entity.name`), reserved = TRUE), urlPath)
      }

      # OAuth token
      headerParams['Authorization'] <- paste("Bearer", self$apiClient$accessToken, sep=" ")

      resp <- self$apiClient$CallApi(url = paste0(self$apiClient$basePath, urlPath),
                                 method = "PATCH",
                                 queryParams = queryParams,
                                 headerParams = headerParams,
                                 body = body,
                                 ...)

      if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) {
        deserializedRespObj <- tryCatch(
          self$apiClient$deserialize(resp, "Entity", loadNamespace("openapi")),
          error = function(e){
             stop("Failed to deserialize response")
          }
        )
        ApiResponse$new(deserializedRespObj, resp)
      } else if (httr::status_code(resp) >= 300 && httr::status_code(resp) <= 399) {
        ApiResponse$new(paste("Server returned " , httr::status_code(resp) , " response status code."), resp)
      } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
        ApiResponse$new("API client error", resp)
      } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
        ApiResponse$new("API server error", resp)
      }
    }
  )
)
vjcitn/terraClientR documentation built on Dec. 23, 2021, 4:07 p.m.