- response <- private$REST$http$exec("POST", url, headers, body,
- queryArgs, private$numRetries)
- resource <- private$REST$httpParser$parseJSONResponse(response)
-
- if(!is.null(resource$errors))
- stop(resource$errors)
-
- resource
- },
-
- traits.update = function(trait, uuid)
- {
- endPoint <- stringr::str_interp("traits/${uuid}")
- url <- paste0(private$host, endPoint)
- headers <- list(Authorization = paste("OAuth2", private$token),
- "Content-Type" = "application/json")
- queryArgs <- NULL
-
- if(length(trait) > 0)
- body <- jsonlite::toJSON(list(trait = trait),
- auto_unbox = TRUE)
- else
- body <- NULL
-
- response <- private$REST$http$exec("PUT", url, headers, body,
- queryArgs, private$numRetries)
- resource <- private$REST$httpParser$parseJSONResponse(response)
-
- if(!is.null(resource$errors))
- stop(resource$errors)
-
- resource
- },
-
- traits.delete = function(uuid)
- {
- endPoint <- stringr::str_interp("traits/${uuid}")
- url <- paste0(private$host, endPoint)
- headers <- list(Authorization = paste("OAuth2", private$token),
- "Content-Type" = "application/json")
- queryArgs <- NULL
-
- body <- NULL
-
- response <- private$REST$http$exec("DELETE", url, headers, body,
- queryArgs, private$numRetries)
- resource <- private$REST$httpParser$parseJSONResponse(response)
-
- if(!is.null(resource$errors))
- stop(resource$errors)
-
- resource
- },
-
- traits.list = function(filters = NULL, where = NULL,
- order = NULL, select = NULL, distinct = NULL,
- limit = "100", offset = "0", count = "exact")
- {
- endPoint <- stringr::str_interp("traits")
- url <- paste0(private$host, endPoint)
- headers <- list(Authorization = paste("OAuth2", private$token),
- "Content-Type" = "application/json")
- queryArgs <- list(filters = filters, where = where,
- order = order, select = select, distinct = distinct,
- limit = limit, offset = offset, count = count)
-
- body <- NULL
-
- response <- private$REST$http$exec("GET", url, headers, body,