Added Location and location ownership/rights to gamenight.
This commit is contained in:
@@ -15,6 +15,15 @@ use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration, ContentType};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`authorized_location_user_ids_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum AuthorizedLocationUserIdsGetError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`disown_post`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
@@ -95,6 +104,42 @@ pub enum LeavePostError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`location_authorize_post`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum LocationAuthorizePostError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`location_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum LocationGetError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`location_post`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum LocationPostError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`locations_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum LocationsGetError {
|
||||
Status401(models::Failure),
|
||||
Status422(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`own_post`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
@@ -166,10 +211,59 @@ pub enum UserGetError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`users_get`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum UsersGetError {
|
||||
Status400(models::Failure),
|
||||
Status401(models::Failure),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn authorized_location_user_ids_get(configuration: &configuration::Configuration, location_id: Option<models::LocationId>) -> Result<Vec<models::UserId>, Error<AuthorizedLocationUserIdsGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_location_id = location_id;
|
||||
|
||||
let uri_str = format!("{}/authorized_location_user_ids", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_body_location_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::UserId>`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::UserId>`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<AuthorizedLocationUserIdsGetError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn disown_post(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<(), Error<DisownPostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_game_id = game_id;
|
||||
let p_body_game_id = game_id;
|
||||
|
||||
let uri_str = format!("{}/disown", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -180,7 +274,7 @@ pub async fn disown_post(configuration: &configuration::Configuration, game_id:
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_game_id);
|
||||
req_builder = req_builder.json(&p_body_game_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -198,7 +292,7 @@ pub async fn disown_post(configuration: &configuration::Configuration, game_id:
|
||||
|
||||
pub async fn game_get(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<models::Game, Error<GameGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_game_id = game_id;
|
||||
let p_body_game_id = game_id;
|
||||
|
||||
let uri_str = format!("{}/game", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
@@ -209,7 +303,7 @@ pub async fn game_get(configuration: &configuration::Configuration, game_id: Opt
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_game_id);
|
||||
req_builder = req_builder.json(&p_body_game_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -238,7 +332,7 @@ pub async fn game_get(configuration: &configuration::Configuration, game_id: Opt
|
||||
|
||||
pub async fn game_post(configuration: &configuration::Configuration, add_game_request_body: Option<models::AddGameRequestBody>) -> Result<(), Error<GamePostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_add_game_request_body = add_game_request_body;
|
||||
let p_body_add_game_request_body = add_game_request_body;
|
||||
|
||||
let uri_str = format!("{}/game", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -249,7 +343,7 @@ pub async fn game_post(configuration: &configuration::Configuration, add_game_re
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_add_game_request_body);
|
||||
req_builder = req_builder.json(&p_body_add_game_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -304,7 +398,7 @@ pub async fn games_get(configuration: &configuration::Configuration, ) -> Result
|
||||
|
||||
pub async fn get_gamenight(configuration: &configuration::Configuration, get_gamenight_request_body: Option<models::GetGamenightRequestBody>) -> Result<models::Gamenight, Error<GetGamenightError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_get_gamenight_request_body = get_gamenight_request_body;
|
||||
let p_body_get_gamenight_request_body = get_gamenight_request_body;
|
||||
|
||||
let uri_str = format!("{}/gamenight", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
@@ -315,7 +409,7 @@ pub async fn get_gamenight(configuration: &configuration::Configuration, get_gam
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_get_gamenight_request_body);
|
||||
req_builder = req_builder.json(&p_body_get_gamenight_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -383,7 +477,7 @@ pub async fn get_gamenights(configuration: &configuration::Configuration, ) -> R
|
||||
/// Submit your credentials to get a JWT-token to use with the rest of the api.
|
||||
pub async fn get_token(configuration: &configuration::Configuration, login: Option<models::Login>) -> Result<models::Token, Error<GetTokenError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_login = login;
|
||||
let p_body_login = login;
|
||||
|
||||
let uri_str = format!("{}/token", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
@@ -391,7 +485,7 @@ pub async fn get_token(configuration: &configuration::Configuration, login: Opti
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
req_builder = req_builder.json(&p_login);
|
||||
req_builder = req_builder.json(&p_body_login);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -420,7 +514,7 @@ pub async fn get_token(configuration: &configuration::Configuration, login: Opti
|
||||
|
||||
pub async fn join_post(configuration: &configuration::Configuration, gamenight_id: Option<models::GamenightId>) -> Result<(), Error<JoinPostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_gamenight_id = gamenight_id;
|
||||
let p_body_gamenight_id = gamenight_id;
|
||||
|
||||
let uri_str = format!("{}/join", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -431,7 +525,7 @@ pub async fn join_post(configuration: &configuration::Configuration, gamenight_i
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_gamenight_id);
|
||||
req_builder = req_builder.json(&p_body_gamenight_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -449,7 +543,7 @@ pub async fn join_post(configuration: &configuration::Configuration, gamenight_i
|
||||
|
||||
pub async fn leave_post(configuration: &configuration::Configuration, gamenight_id: Option<models::GamenightId>) -> Result<(), Error<LeavePostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_gamenight_id = gamenight_id;
|
||||
let p_body_gamenight_id = gamenight_id;
|
||||
|
||||
let uri_str = format!("{}/leave", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -460,7 +554,7 @@ pub async fn leave_post(configuration: &configuration::Configuration, gamenight_
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_gamenight_id);
|
||||
req_builder = req_builder.json(&p_body_gamenight_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -476,9 +570,155 @@ pub async fn leave_post(configuration: &configuration::Configuration, gamenight_
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn location_authorize_post(configuration: &configuration::Configuration, authorize_location_request_body: Option<models::AuthorizeLocationRequestBody>) -> Result<(), Error<LocationAuthorizePostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_authorize_location_request_body = authorize_location_request_body;
|
||||
|
||||
let uri_str = format!("{}/location_authorize", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_body_authorize_location_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
Ok(())
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<LocationAuthorizePostError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn location_get(configuration: &configuration::Configuration, location_id: Option<models::LocationId>) -> Result<models::Location, Error<LocationGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_location_id = location_id;
|
||||
|
||||
let uri_str = format!("{}/location", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_body_location_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Location`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::Location`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<LocationGetError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn location_post(configuration: &configuration::Configuration, add_location_request_body: Option<models::AddLocationRequestBody>) -> Result<models::LocationId, Error<LocationPostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_body_add_location_request_body = add_location_request_body;
|
||||
|
||||
let uri_str = format!("{}/location", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_body_add_location_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LocationId`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::LocationId`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<LocationPostError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn locations_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::Location>, Error<LocationsGetError>> {
|
||||
|
||||
let uri_str = format!("{}/locations", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Location>`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Location>`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<LocationsGetError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn own_post(configuration: &configuration::Configuration, game_id: Option<models::GameId>) -> Result<(), Error<OwnPostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_game_id = game_id;
|
||||
let p_body_game_id = game_id;
|
||||
|
||||
let uri_str = format!("{}/own", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -489,7 +729,7 @@ pub async fn own_post(configuration: &configuration::Configuration, game_id: Opt
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_game_id);
|
||||
req_builder = req_builder.json(&p_body_game_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -507,7 +747,7 @@ pub async fn own_post(configuration: &configuration::Configuration, game_id: Opt
|
||||
|
||||
pub async fn owned_games_get(configuration: &configuration::Configuration, user_id: Option<models::UserId>) -> Result<Vec<String>, Error<OwnedGamesGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_user_id = user_id;
|
||||
let p_body_user_id = user_id;
|
||||
|
||||
let uri_str = format!("{}/owned_games", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
@@ -518,7 +758,7 @@ pub async fn owned_games_get(configuration: &configuration::Configuration, user_
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_user_id);
|
||||
req_builder = req_builder.json(&p_body_user_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -548,7 +788,7 @@ pub async fn owned_games_get(configuration: &configuration::Configuration, user_
|
||||
/// Retrieve the participants of a single gamenight by id.
|
||||
pub async fn participants_get(configuration: &configuration::Configuration, gamenight_id: Option<models::GamenightId>) -> Result<models::Participants, Error<ParticipantsGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_gamenight_id = gamenight_id;
|
||||
let p_body_gamenight_id = gamenight_id;
|
||||
|
||||
let uri_str = format!("{}/participants", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
@@ -559,7 +799,7 @@ pub async fn participants_get(configuration: &configuration::Configuration, game
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_gamenight_id);
|
||||
req_builder = req_builder.json(&p_body_gamenight_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -589,7 +829,7 @@ pub async fn participants_get(configuration: &configuration::Configuration, game
|
||||
/// Add a gamenight by providing a name and a date, only available when providing an JWT token.
|
||||
pub async fn post_gamenight(configuration: &configuration::Configuration, add_gamenight_request_body: Option<models::AddGamenightRequestBody>) -> Result<(), Error<PostGamenightError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_add_gamenight_request_body = add_gamenight_request_body;
|
||||
let p_body_add_gamenight_request_body = add_gamenight_request_body;
|
||||
|
||||
let uri_str = format!("{}/gamenight", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -600,7 +840,7 @@ pub async fn post_gamenight(configuration: &configuration::Configuration, add_ga
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_add_gamenight_request_body);
|
||||
req_builder = req_builder.json(&p_body_add_gamenight_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -619,7 +859,7 @@ pub async fn post_gamenight(configuration: &configuration::Configuration, add_ga
|
||||
/// Create a new user given a registration token and user information, username and email must be unique, and password and password_repeat must match.
|
||||
pub async fn post_register(configuration: &configuration::Configuration, registration: Option<models::Registration>) -> Result<(), Error<PostRegisterError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_registration = registration;
|
||||
let p_body_registration = registration;
|
||||
|
||||
let uri_str = format!("{}/user", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -630,7 +870,7 @@ pub async fn post_register(configuration: &configuration::Configuration, registr
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_registration);
|
||||
req_builder = req_builder.json(&p_body_registration);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -686,7 +926,7 @@ pub async fn post_token(configuration: &configuration::Configuration, ) -> Resul
|
||||
|
||||
pub async fn rename_game_post(configuration: &configuration::Configuration, rename_game_request_body: Option<models::RenameGameRequestBody>) -> Result<(), Error<RenameGamePostError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_rename_game_request_body = rename_game_request_body;
|
||||
let p_body_rename_game_request_body = rename_game_request_body;
|
||||
|
||||
let uri_str = format!("{}/rename_game", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
|
||||
@@ -697,7 +937,7 @@ pub async fn rename_game_post(configuration: &configuration::Configuration, rena
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_rename_game_request_body);
|
||||
req_builder = req_builder.json(&p_body_rename_game_request_body);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -716,7 +956,7 @@ pub async fn rename_game_post(configuration: &configuration::Configuration, rena
|
||||
/// Get a user from primary id
|
||||
pub async fn user_get(configuration: &configuration::Configuration, user_id: Option<models::UserId>) -> Result<models::User, Error<UserGetError>> {
|
||||
// add a prefix to parameters to efficiently prevent name collisions
|
||||
let p_user_id = user_id;
|
||||
let p_body_user_id = user_id;
|
||||
|
||||
let uri_str = format!("{}/user", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
@@ -727,7 +967,7 @@ pub async fn user_get(configuration: &configuration::Configuration, user_id: Opt
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
req_builder = req_builder.json(&p_user_id);
|
||||
req_builder = req_builder.json(&p_body_user_id);
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
@@ -754,3 +994,40 @@ pub async fn user_get(configuration: &configuration::Configuration, user_id: Opt
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn users_get(configuration: &configuration::Configuration, ) -> Result<Vec<models::User>, Error<UsersGetError>> {
|
||||
|
||||
let uri_str = format!("{}/users", configuration.base_path);
|
||||
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
|
||||
|
||||
if let Some(ref user_agent) = configuration.user_agent {
|
||||
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
|
||||
}
|
||||
if let Some(ref token) = configuration.bearer_access_token {
|
||||
req_builder = req_builder.bearer_auth(token.to_owned());
|
||||
};
|
||||
|
||||
let req = req_builder.build()?;
|
||||
let resp = configuration.client.execute(req).await?;
|
||||
|
||||
let status = resp.status();
|
||||
let content_type = resp
|
||||
.headers()
|
||||
.get("content-type")
|
||||
.and_then(|v| v.to_str().ok())
|
||||
.unwrap_or("application/octet-stream");
|
||||
let content_type = super::ContentType::from(content_type);
|
||||
|
||||
if !status.is_client_error() && !status.is_server_error() {
|
||||
let content = resp.text().await?;
|
||||
match content_type {
|
||||
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
|
||||
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::User>`"))),
|
||||
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::User>`")))),
|
||||
}
|
||||
} else {
|
||||
let content = resp.text().await?;
|
||||
let entity: Option<UsersGetError> = serde_json::from_str(&content).ok();
|
||||
Err(Error::ResponseError(ResponseContent { status, content, entity }))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user