1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
//! Structures for the access token response from the Box API.
/*
* Box Platform API
*
* [Box Platform](https://box.dev) provides functionality to provide access to content stored within [Box](https://box.com). It provides endpoints for basic manipulation of files and folders, management of users within an enterprise, as well as more complex topics such as legal holds and retention policies.
*
* The version of the OpenAPI document: 2.0.0
* Contact: devrel@box.com
* Generated by: https://openapi-generator.tech
*/
use crate::rest_api::files::models::file_scope::FileScope;
/// AccessToken : A token that can be used to make authenticated API calls.
#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
pub struct AccessToken {
/// The requested access token.
#[serde(rename = "access_token", skip_serializing_if = "Option::is_none")]
pub access_token: Option<String>,
/// The time in seconds in seconds by which this token will expire.
#[serde(rename = "expires_in", skip_serializing_if = "Option::is_none")]
pub expires_in: Option<i64>,
/// The type of access token returned.
#[serde(rename = "token_type", skip_serializing_if = "Option::is_none")]
pub token_type: Option<TokenType>,
/// The permissions that this access token permits, providing a list of resources (files, folders, etc) and the scopes permitted for each of those resources.
#[serde(rename = "restricted_to", skip_serializing_if = "Option::is_none")]
pub restricted_to: Option<Vec<FileScope>>,
/// The refresh token for this access token, which can be used to request a new access token when the current one expires.
#[serde(rename = "refresh_token", skip_serializing_if = "Option::is_none")]
pub refresh_token: Option<String>,
/// The type of downscoped access token returned. This is only returned if an access token has been downscoped.
#[serde(rename = "issued_token_type", skip_serializing_if = "Option::is_none")]
pub issued_token_type: Option<IssuedTokenType>,
}
impl AccessToken {
/// A token that can be used to make authenticated API calls.
pub fn new() -> AccessToken {
AccessToken {
access_token: None,
expires_in: None,
token_type: None,
restricted_to: None,
refresh_token: None,
issued_token_type: None,
}
}
}
/// The type of access token returned.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TokenType {
#[serde(rename = "bearer")]
Bearer,
}
impl Default for TokenType {
fn default() -> TokenType {
Self::Bearer
}
}
/// The type of downscoped access token returned. This is only returned if an access token has been downscoped.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum IssuedTokenType {
#[serde(rename = "urn:ietf:params:oauth:token-type:access_token")]
UrnColonIetfColonParamsColonOauthColonTokenTypeColonAccessToken,
}
impl Default for IssuedTokenType {
fn default() -> IssuedTokenType {
Self::UrnColonIetfColonParamsColonOauthColonTokenTypeColonAccessToken
}
}