# Altana Atlas API
#
# Altana Atlas for Regulatory Risk and Trade Compliance
#
# OpenAPI spec version: {{ version or \"v0.0.1\" }}
# Contact: engineering@altanatech.com
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' @title Product operations
#' @description swagger.Product
#'
#' @field path Stores url path of the request.
#' @field apiClient Handles the client-server communication.
#' @field userAgent Set the user agent of the request.
#'
#' @importFrom R6 R6Class
#'
#' @section Methods:
#' \describe{
#'
#' get_product_by_id Product ID
#'
#'
#' get_product_companies Product Companies
#'
#'
#' get_product_facilities Product Facilities
#'
#' }
#'
#' @export
ProductApi <- R6::R6Class(
'ProductApi',
public = list(
userAgent = "Swagger-Codegen/1.0.0/r",
apiClient = NULL,
initialize = function(apiClient){
if (!missing(apiClient)) {
self$apiClient <- apiClient
}
else {
self$apiClient <- ApiClient$new()
}
},
get_product_by_id = function(product_id, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
urlPath <- "/product/id/{product_id}"
if (!missing(`product_id`)) {
urlPath <- gsub(paste0("\\{", "product_id", "\\}"), `product_id`, urlPath)
}
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) {
returnObject <- Product$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
},
get_product_companies = function(product_id, trade_direction, page, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`trade_direction`)) {
queryParams['trade_direction'] <- trade_direction
}
if (!missing(`page`)) {
queryParams['page'] <- page
}
urlPath <- "/product/id/{product_id}/companies"
if (!missing(`product_id`)) {
urlPath <- gsub(paste0("\\{", "product_id", "\\}"), `product_id`, urlPath)
}
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) {
returnObject <- Companies$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
},
get_product_facilities = function(product_id, trade_direction, page, ...){
args <- list(...)
queryParams <- list()
headerParams <- character()
if (!missing(`trade_direction`)) {
queryParams['trade_direction'] <- trade_direction
}
if (!missing(`page`)) {
queryParams['page'] <- page
}
urlPath <- "/product/id/{product_id}/facilities"
if (!missing(`product_id`)) {
urlPath <- gsub(paste0("\\{", "product_id", "\\}"), `product_id`, urlPath)
}
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) {
returnObject <- Facilities$new()
result <- returnObject$fromJSON(httr::content(resp, "text", encoding = "UTF-8"))
Response$new(returnObject, resp)
} else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) {
Response$new("API client error", resp)
} else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) {
Response$new("API server error", resp)
}
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.