/*
* The Jira Cloud platform REST API
*
* Jira Cloud platform REST API documentation
*
* The version of the OpenAPI document: 1001.0.0-SNAPSHOT
* Contact: ecosystem@atlassian.com
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use crate::apis::ResponseContent;
use super::{Error, configuration};
/// struct for passing parameters to the method [`delete_avatar`]
#[derive(Clone, Debug, Default)]
pub struct DeleteAvatarParams {
/// The avatar type.
pub _type: String,
/// The ID of the item the avatar is associated with.
pub owning_object_id: String,
/// The ID of the avatar.
pub id: i64
}
/// struct for passing parameters to the method [`get_all_system_avatars`]
#[derive(Clone, Debug, Default)]
pub struct GetAllSystemAvatarsParams {
/// The avatar type.
pub _type: String
}
/// struct for passing parameters to the method [`get_avatar_image_by_id`]
#[derive(Clone, Debug, Default)]
pub struct GetAvatarImageByIdParams {
/// The icon type of the avatar.
pub _type: String,
/// The ID of the avatar.
pub id: i64,
/// The size of the avatar image. If not provided the default size is returned.
pub size: Option<String>,
/// The format to return the avatar image in. If not provided the original content format is returned.
pub format: Option<String>
}
/// struct for passing parameters to the method [`get_avatar_image_by_owner`]
#[derive(Clone, Debug, Default)]
pub struct GetAvatarImageByOwnerParams {
/// The icon type of the avatar.
pub _type: String,
/// The ID of the project or issue type the avatar belongs to.
pub entity_id: String,
/// The size of the avatar image. If not provided the default size is returned.
pub size: Option<String>,
/// The format to return the avatar image in. If not provided the original content format is returned.
pub format: Option<String>
}
/// struct for passing parameters to the method [`get_avatar_image_by_type`]
#[derive(Clone, Debug, Default)]
pub struct GetAvatarImageByTypeParams {
/// The icon type of the avatar.
pub _type: String,
/// The size of the avatar image. If not provided the default size is returned.
pub size: Option<String>,
/// The format to return the avatar image in. If not provided the original content format is returned.
pub format: Option<String>
}
/// struct for passing parameters to the method [`get_avatars`]
#[derive(Clone, Debug, Default)]
pub struct GetAvatarsParams {
/// The avatar type.
pub _type: String,
/// The ID of the item the avatar is associated with.
pub entity_id: String
}
/// struct for passing parameters to the method [`store_avatar`]
#[derive(Clone, Debug, Default)]
pub struct StoreAvatarParams {
/// The avatar type.
pub _type: String,
/// The ID of the item the avatar is associated with.
pub entity_id: String,
/// The length of each side of the crop region.
pub size: i32,
pub body: Option<serde_json::Value>,
/// The X coordinate of the top-left corner of the crop region.
pub x: Option<i32>,
/// The Y coordinate of the top-left corner of the crop region.
pub y: Option<i32>
}
/// struct for typed successes of method [`delete_avatar`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteAvatarSuccess {
Status204(),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_all_system_avatars`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAllSystemAvatarsSuccess {
Status200(crate::models::SystemAvatars),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_avatar_image_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarImageByIdSuccess {
Status200(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_avatar_image_by_owner`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarImageByOwnerSuccess {
Status200(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_avatar_image_by_type`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarImageByTypeSuccess {
Status200(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_avatars`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarsSuccess {
Status200(crate::models::Avatars),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`store_avatar`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StoreAvatarSuccess {
Status201(crate::models::Avatar),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_avatar`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteAvatarError {
Status400(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_all_system_avatars`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAllSystemAvatarsError {
Status401(),
Status500(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_avatar_image_by_id`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarImageByIdError {
Status400(crate::models::ErrorCollection),
Status401(crate::models::ErrorCollection),
Status403(crate::models::ErrorCollection),
Status404(crate::models::ErrorCollection),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_avatar_image_by_owner`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarImageByOwnerError {
Status400(crate::models::ErrorCollection),
Status401(crate::models::ErrorCollection),
Status403(crate::models::ErrorCollection),
Status404(crate::models::ErrorCollection),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_avatar_image_by_type`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarImageByTypeError {
Status401(crate::models::ErrorCollection),
Status403(crate::models::ErrorCollection),
Status404(crate::models::ErrorCollection),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_avatars`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAvatarsError {
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`store_avatar`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum StoreAvatarError {
Status400(),
Status401(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// Deletes an avatar from a project or issue type. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub async fn delete_avatar(configuration: &configuration::Configuration, params: DeleteAvatarParams) -> Result<ResponseContent<DeleteAvatarSuccess>, Error<DeleteAvatarError>> {
let local_var_configuration = configuration;
// unbox the parameters
let _type = params._type;
let owning_object_id = params.owning_object_id;
let id = params.id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/universal_avatar/type/{type}/owner/{owningObjectId}/avatar/{id}", local_var_configuration.base_path, type=crate::apis::urlencode(_type), owningObjectId=crate::apis::urlencode(owning_object_id), id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<DeleteAvatarSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<DeleteAvatarError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Returns a list of system avatar details by owner type, where the owner types are issue type, project, or user. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None.
pub async fn get_all_system_avatars(configuration: &configuration::Configuration, params: GetAllSystemAvatarsParams) -> Result<ResponseContent<GetAllSystemAvatarsSuccess>, Error<GetAllSystemAvatarsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let _type = params._type;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/avatar/{type}/system", local_var_configuration.base_path, type=crate::apis::urlencode(_type));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<GetAllSystemAvatarsSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetAllSystemAvatarsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Returns a project or issue type avatar image by ID. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * For system avatars, none. * For custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project the avatar belongs to. * For custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for at least one project the issue type is used in.
pub async fn get_avatar_image_by_id(configuration: &configuration::Configuration, params: GetAvatarImageByIdParams) -> Result<ResponseContent<GetAvatarImageByIdSuccess>, Error<GetAvatarImageByIdError>> {
let local_var_configuration = configuration;
// unbox the parameters
let _type = params._type;
let id = params.id;
let size = params.size;
let format = params.format;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/universal_avatar/view/type/{type}/avatar/{id}", local_var_configuration.base_path, type=crate::apis::urlencode(_type), id=id);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = size {
local_var_req_builder = local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = format {
local_var_req_builder = local_var_req_builder.query(&[("format", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<GetAvatarImageByIdSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetAvatarImageByIdError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the avatar image for a project or issue type. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * For system avatars, none. * For custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project the avatar belongs to. * For custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for at least one project the issue type is used in.
pub async fn get_avatar_image_by_owner(configuration: &configuration::Configuration, params: GetAvatarImageByOwnerParams) -> Result<ResponseContent<GetAvatarImageByOwnerSuccess>, Error<GetAvatarImageByOwnerError>> {
let local_var_configuration = configuration;
// unbox the parameters
let _type = params._type;
let entity_id = params.entity_id;
let size = params.size;
let format = params.format;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/universal_avatar/view/type/{type}/owner/{entityId}", local_var_configuration.base_path, type=crate::apis::urlencode(_type), entityId=crate::apis::urlencode(entity_id));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = size {
local_var_req_builder = local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = format {
local_var_req_builder = local_var_req_builder.query(&[("format", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<GetAvatarImageByOwnerSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetAvatarImageByOwnerError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the default project or issue type avatar image. This operation can be accessed anonymously. **[Permissions](#permissions) required:** None.
pub async fn get_avatar_image_by_type(configuration: &configuration::Configuration, params: GetAvatarImageByTypeParams) -> Result<ResponseContent<GetAvatarImageByTypeSuccess>, Error<GetAvatarImageByTypeError>> {
let local_var_configuration = configuration;
// unbox the parameters
let _type = params._type;
let size = params.size;
let format = params.format;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/universal_avatar/view/type/{type}", local_var_configuration.base_path, type=crate::apis::urlencode(_type));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = size {
local_var_req_builder = local_var_req_builder.query(&[("size", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = format {
local_var_req_builder = local_var_req_builder.query(&[("format", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<GetAvatarImageByTypeSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetAvatarImageByTypeError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Returns the system and custom avatars for a project or issue type. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * for custom project avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project the avatar belongs to. * for custom issue type avatars, *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for at least one project the issue type is used in. * for system avatars, none.
pub async fn get_avatars(configuration: &configuration::Configuration, params: GetAvatarsParams) -> Result<ResponseContent<GetAvatarsSuccess>, Error<GetAvatarsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let _type = params._type;
let entity_id = params.entity_id;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/universal_avatar/type/{type}/owner/{entityId}", local_var_configuration.base_path, type=crate::apis::urlencode(_type), entityId=crate::apis::urlencode(entity_id));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<GetAvatarsSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<GetAvatarsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// Loads a custom avatar for a project or issue type. Specify the avatar's local file location in the body of the request. Also, include the following headers: * `X-Atlassian-Token: no-check` To prevent XSRF protection blocking the request, for more information see [Special Headers](#special-request-headers). * `Content-Type: image/image type` Valid image types are JPEG, GIF, or PNG. For example: `curl --request POST ` `--user email@example.com:<api_token> ` `--header 'X-Atlassian-Token: no-check' ` `--header 'Content-Type: image/< image_type>' ` `--data-binary \"<@/path/to/file/with/your/avatar>\" ` `--url 'https://your-domain.atlassian.net/rest/api/2/universal_avatar/type/{type}/owner/{entityId}'` The avatar is cropped to a square. If no crop parameters are specified, the square originates at the top left of the image. The length of the square's sides is set to the smaller of the height or width of the image. The cropped image is then used to create avatars of 16x16, 24x24, 32x32, and 48x48 in size. After creating the avatar use: * [Update issue type](#api-rest-api-2-issuetype-id-put) to set it as the issue type's displayed avatar. * [Set project avatar](#api-rest-api-2-project-projectIdOrKey-avatar-put) to set it as the project's displayed avatar. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub async fn store_avatar(configuration: &configuration::Configuration, params: StoreAvatarParams) -> Result<ResponseContent<StoreAvatarSuccess>, Error<StoreAvatarError>> {
let local_var_configuration = configuration;
// unbox the parameters
let _type = params._type;
let entity_id = params.entity_id;
let size = params.size;
let body = params.body;
let x = params.x;
let y = params.y;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/universal_avatar/type/{type}/owner/{entityId}", local_var_configuration.base_path, type=crate::apis::urlencode(_type), entityId=crate::apis::urlencode(entity_id));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_str) = x {
local_var_req_builder = local_var_req_builder.query(&[("x", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = y {
local_var_req_builder = local_var_req_builder.query(&[("y", &local_var_str.to_string())]);
}
local_var_req_builder = local_var_req_builder.query(&[("size", &size.to_string())]);
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
local_var_req_builder = local_var_req_builder.json(&body);
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<StoreAvatarSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<StoreAvatarError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}