# sunagriAPI
#
# An instance of OpenSILEX WebService
#
# OpenAPI spec version: 3.3.0
#
# Generated by: https://github.com/swagger-api/swagger-codegen.git
#' TokenDTO Class
#'
#' @field grant_type
#' @field username
#' @field password
#' @field client_id
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
TokenDTO <- R6::R6Class(
'TokenDTO',
public = list(
`grant_type` = NULL,
`username` = NULL,
`password` = NULL,
`client_id` = NULL,
initialize = function(`grant_type`, `username`, `password`, `client_id`){
if (!missing(`grant_type`)) {
stopifnot(is.character(`grant_type`), length(`grant_type`) == 1)
self$`grant_type` <- `grant_type`
}
if (!missing(`username`)) {
stopifnot(is.character(`username`), length(`username`) == 1)
self$`username` <- `username`
}
if (!missing(`password`)) {
stopifnot(is.character(`password`), length(`password`) == 1)
self$`password` <- `password`
}
if (!missing(`client_id`)) {
stopifnot(is.character(`client_id`), length(`client_id`) == 1)
self$`client_id` <- `client_id`
}
},
toJSON = function() {
TokenDTOObject <- list()
if (!is.null(self$`grant_type`)) {
TokenDTOObject[['grant_type']] <- self$`grant_type`
}
if (!is.null(self$`username`)) {
TokenDTOObject[['username']] <- self$`username`
}
if (!is.null(self$`password`)) {
TokenDTOObject[['password']] <- self$`password`
}
if (!is.null(self$`client_id`)) {
TokenDTOObject[['client_id']] <- self$`client_id`
}
TokenDTOObject
},
fromJSON = function(TokenDTOJson) {
TokenDTOObject <- jsonlite::fromJSON(TokenDTOJson)
if (!is.null(TokenDTOObject$`grant_type`)) {
self$`grant_type` <- TokenDTOObject$`grant_type`
}
if (!is.null(TokenDTOObject$`username`)) {
self$`username` <- TokenDTOObject$`username`
}
if (!is.null(TokenDTOObject$`password`)) {
self$`password` <- TokenDTOObject$`password`
}
if (!is.null(TokenDTOObject$`client_id`)) {
self$`client_id` <- TokenDTOObject$`client_id`
}
},
fromJSONObject = function(TokenDTOObject) {
if (!is.null(TokenDTOObject$`grant_type`)) {
self$`grant_type` <- TokenDTOObject$`grant_type`
}
if (!is.null(TokenDTOObject$`username`)) {
self$`username` <- TokenDTOObject$`username`
}
if (!is.null(TokenDTOObject$`password`)) {
self$`password` <- TokenDTOObject$`password`
}
if (!is.null(TokenDTOObject$`client_id`)) {
self$`client_id` <- TokenDTOObject$`client_id`
}
},
toJSONString = function() {
sprintf(
'{
"grant_type": %s,
"username": %s,
"password": %s,
"client_id": %s
}',
jsonlite::toJSON(self$`grant_type`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`username`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`password`,auto_unbox=TRUE, null = "null"),
jsonlite::toJSON(self$`client_id`,auto_unbox=TRUE, null = "null")
)
},
fromJSONString = function(TokenDTOJson) {
TokenDTOObject <- jsonlite::fromJSON(TokenDTOJson)
self$`grant_type` <- TokenDTOObject$`grant_type`
self$`username` <- TokenDTOObject$`username`
self$`password` <- TokenDTOObject$`password`
self$`client_id` <- TokenDTOObject$`client_id`
}
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.