188
crates/gitea-client/src/apis/activitypub_api.rs
Normal file
188
crates/gitea-client/src/apis/activitypub_api.rs
Normal file
@@ -0,0 +1,188 @@
|
||||
/*
|
||||
* Gitea API
|
||||
*
|
||||
* This documentation describes the Gitea API.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.22.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`activitypub_person`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ActivitypubPersonError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`activitypub_person_inbox`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ActivitypubPersonInboxError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn activitypub_person(configuration: &configuration::Configuration, user_id: i32) -> Result<models::ActivityPub, Error<ActivitypubPersonError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/activitypub/user-id/{user_id}", local_var_configuration.base_path, user_id=user_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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<ActivitypubPersonError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn activitypub_person_inbox(configuration: &configuration::Configuration, user_id: i32) -> Result<(), Error<ActivitypubPersonInboxError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/activitypub/user-id/{user_id}/inbox", local_var_configuration.base_path, user_id=user_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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<ActivitypubPersonInboxError> = 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))
|
||||
}
|
||||
}
|
||||
|
2331
crates/gitea-client/src/apis/admin_api.rs
Normal file
2331
crates/gitea-client/src/apis/admin_api.rs
Normal file
File diff suppressed because it is too large
Load Diff
53
crates/gitea-client/src/apis/configuration.rs
Normal file
53
crates/gitea-client/src/apis/configuration.rs
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Gitea API
|
||||
*
|
||||
* This documentation describes the Gitea API.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.22.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Configuration {
|
||||
pub base_path: String,
|
||||
pub user_agent: Option<String>,
|
||||
pub client: reqwest::Client,
|
||||
pub basic_auth: Option<BasicAuth>,
|
||||
pub oauth_access_token: Option<String>,
|
||||
pub bearer_access_token: Option<String>,
|
||||
pub api_key: Option<ApiKey>,
|
||||
// TODO: take an oauth2 token source, similar to the go one
|
||||
}
|
||||
|
||||
pub type BasicAuth = (String, Option<String>);
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ApiKey {
|
||||
pub prefix: Option<String>,
|
||||
pub key: String,
|
||||
}
|
||||
|
||||
|
||||
impl Configuration {
|
||||
pub fn new() -> Configuration {
|
||||
Configuration::default()
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Configuration {
|
||||
fn default() -> Self {
|
||||
Configuration {
|
||||
base_path: "/api/v1".to_owned(),
|
||||
user_agent: Some("OpenAPI-Generator/1.22.1/rust".to_owned()),
|
||||
client: reqwest::Client::new(),
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
bearer_access_token: None,
|
||||
api_key: None,
|
||||
|
||||
}
|
||||
}
|
||||
}
|
6045
crates/gitea-client/src/apis/issue_api.rs
Normal file
6045
crates/gitea-client/src/apis/issue_api.rs
Normal file
File diff suppressed because it is too large
Load Diff
1047
crates/gitea-client/src/apis/miscellaneous_api.rs
Normal file
1047
crates/gitea-client/src/apis/miscellaneous_api.rs
Normal file
File diff suppressed because it is too large
Load Diff
104
crates/gitea-client/src/apis/mod.rs
Normal file
104
crates/gitea-client/src/apis/mod.rs
Normal file
@@ -0,0 +1,104 @@
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResponseContent<T> {
|
||||
pub status: reqwest::StatusCode,
|
||||
pub content: String,
|
||||
pub entity: Option<T>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error<T> {
|
||||
Reqwest(reqwest::Error),
|
||||
Serde(serde_json::Error),
|
||||
Io(std::io::Error),
|
||||
ResponseError(ResponseContent<T>),
|
||||
}
|
||||
|
||||
impl <T> fmt::Display for Error<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let (module, e) = match self {
|
||||
Error::Reqwest(e) => ("reqwest", e.to_string()),
|
||||
Error::Serde(e) => ("serde", e.to_string()),
|
||||
Error::Io(e) => ("IO", e.to_string()),
|
||||
Error::ResponseError(e) => ("response", format!("status code {}", e.status)),
|
||||
};
|
||||
write!(f, "error in {}: {}", module, e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T: fmt::Debug> error::Error for Error<T> {
|
||||
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
|
||||
Some(match self {
|
||||
Error::Reqwest(e) => e,
|
||||
Error::Serde(e) => e,
|
||||
Error::Io(e) => e,
|
||||
Error::ResponseError(_) => return None,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<reqwest::Error> for Error<T> {
|
||||
fn from(e: reqwest::Error) -> Self {
|
||||
Error::Reqwest(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<serde_json::Error> for Error<T> {
|
||||
fn from(e: serde_json::Error) -> Self {
|
||||
Error::Serde(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl <T> From<std::io::Error> for Error<T> {
|
||||
fn from(e: std::io::Error) -> Self {
|
||||
Error::Io(e)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn urlencode<T: AsRef<str>>(s: T) -> String {
|
||||
::url::form_urlencoded::byte_serialize(s.as_ref().as_bytes()).collect()
|
||||
}
|
||||
|
||||
pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String, String)> {
|
||||
if let serde_json::Value::Object(object) = value {
|
||||
let mut params = vec![];
|
||||
|
||||
for (key, value) in object {
|
||||
match value {
|
||||
serde_json::Value::Object(_) => params.append(&mut parse_deep_object(
|
||||
&format!("{}[{}]", prefix, key),
|
||||
value,
|
||||
)),
|
||||
serde_json::Value::Array(array) => {
|
||||
for (i, value) in array.iter().enumerate() {
|
||||
params.append(&mut parse_deep_object(
|
||||
&format!("{}[{}][{}]", prefix, key, i),
|
||||
value,
|
||||
));
|
||||
}
|
||||
},
|
||||
serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())),
|
||||
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
unimplemented!("Only objects are supported with style=deepObject")
|
||||
}
|
||||
|
||||
pub mod activitypub_api;
|
||||
pub mod admin_api;
|
||||
pub mod issue_api;
|
||||
pub mod miscellaneous_api;
|
||||
pub mod notification_api;
|
||||
pub mod organization_api;
|
||||
pub mod package_api;
|
||||
pub mod repository_api;
|
||||
pub mod settings_api;
|
||||
pub mod user_api;
|
||||
|
||||
pub mod configuration;
|
704
crates/gitea-client/src/apis/notification_api.rs
Normal file
704
crates/gitea-client/src/apis/notification_api.rs
Normal file
@@ -0,0 +1,704 @@
|
||||
/*
|
||||
* Gitea API
|
||||
*
|
||||
* This documentation describes the Gitea API.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.22.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`notify_get_list`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NotifyGetListError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`notify_get_repo_list`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NotifyGetRepoListError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`notify_get_thread`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NotifyGetThreadError {
|
||||
Status403(),
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`notify_new_available`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NotifyNewAvailableError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`notify_read_list`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NotifyReadListError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`notify_read_repo_list`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NotifyReadRepoListError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`notify_read_thread`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum NotifyReadThreadError {
|
||||
Status403(),
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn notify_get_list(configuration: &configuration::Configuration, all: Option<bool>, status_types: Option<Vec<String>>, subject_type: Option<Vec<String>>, since: Option<String>, before: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::NotificationThread>, Error<NotifyGetListError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/notifications", local_var_configuration.base_path);
|
||||
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) = all {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = status_types {
|
||||
local_var_req_builder = match "multi" {
|
||||
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
||||
_ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||
};
|
||||
}
|
||||
if let Some(ref local_var_str) = subject_type {
|
||||
local_var_req_builder = match "multi" {
|
||||
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
||||
_ => local_var_req_builder.query(&[("subject-type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||
};
|
||||
}
|
||||
if let Some(ref local_var_str) = since {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = before {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = page {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = limit {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<NotifyGetListError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn notify_get_repo_list(configuration: &configuration::Configuration, owner: &str, repo: &str, all: Option<bool>, status_types: Option<Vec<String>>, subject_type: Option<Vec<String>>, since: Option<String>, before: Option<String>, page: Option<i32>, limit: Option<i32>) -> Result<Vec<models::NotificationThread>, Error<NotifyGetRepoListError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/notifications", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
|
||||
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) = all {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = status_types {
|
||||
local_var_req_builder = match "multi" {
|
||||
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
||||
_ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||
};
|
||||
}
|
||||
if let Some(ref local_var_str) = subject_type {
|
||||
local_var_req_builder = match "multi" {
|
||||
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
||||
_ => local_var_req_builder.query(&[("subject-type", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||
};
|
||||
}
|
||||
if let Some(ref local_var_str) = since {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("since", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = before {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("before", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = page {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = limit {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<NotifyGetRepoListError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn notify_get_thread(configuration: &configuration::Configuration, id: &str) -> Result<models::NotificationThread, Error<NotifyGetThreadError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/notifications/threads/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<NotifyGetThreadError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn notify_new_available(configuration: &configuration::Configuration, ) -> Result<models::NotificationCount, Error<NotifyNewAvailableError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/notifications/new", local_var_configuration.base_path);
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<NotifyNewAvailableError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn notify_read_list(configuration: &configuration::Configuration, last_read_at: Option<String>, all: Option<&str>, status_types: Option<Vec<String>>, to_status: Option<&str>) -> Result<Vec<models::NotificationThread>, Error<NotifyReadListError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/notifications", local_var_configuration.base_path);
|
||||
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
|
||||
|
||||
if let Some(ref local_var_str) = last_read_at {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("last_read_at", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = all {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = status_types {
|
||||
local_var_req_builder = match "multi" {
|
||||
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
||||
_ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||
};
|
||||
}
|
||||
if let Some(ref local_var_str) = to_status {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("to-status", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<NotifyReadListError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn notify_read_repo_list(configuration: &configuration::Configuration, owner: &str, repo: &str, all: Option<&str>, status_types: Option<Vec<String>>, to_status: Option<&str>, last_read_at: Option<String>) -> Result<Vec<models::NotificationThread>, Error<NotifyReadRepoListError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/repos/{owner}/{repo}/notifications", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), repo=crate::apis::urlencode(repo));
|
||||
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
|
||||
|
||||
if let Some(ref local_var_str) = all {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("all", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = status_types {
|
||||
local_var_req_builder = match "multi" {
|
||||
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
|
||||
_ => local_var_req_builder.query(&[("status-types", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
|
||||
};
|
||||
}
|
||||
if let Some(ref local_var_str) = to_status {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("to-status", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = last_read_at {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("last_read_at", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<NotifyReadRepoListError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn notify_read_thread(configuration: &configuration::Configuration, id: &str, to_status: Option<&str>) -> Result<models::NotificationThread, Error<NotifyReadThreadError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/notifications/threads/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
|
||||
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
|
||||
|
||||
if let Some(ref local_var_str) = to_status {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("to-status", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<NotifyReadThreadError> = 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))
|
||||
}
|
||||
}
|
||||
|
5244
crates/gitea-client/src/apis/organization_api.rs
Normal file
5244
crates/gitea-client/src/apis/organization_api.rs
Normal file
File diff suppressed because it is too large
Load Diff
374
crates/gitea-client/src/apis/package_api.rs
Normal file
374
crates/gitea-client/src/apis/package_api.rs
Normal file
@@ -0,0 +1,374 @@
|
||||
/*
|
||||
* Gitea API
|
||||
*
|
||||
* This documentation describes the Gitea API.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.22.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`delete_package`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum DeletePackageError {
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_package`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetPackageError {
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`list_package_files`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ListPackageFilesError {
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`list_packages`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ListPackagesError {
|
||||
Status404(),
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn delete_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result<(), Error<DeletePackageError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), type=crate::apis::urlencode(r#type), name=crate::apis::urlencode(name), version=crate::apis::urlencode(version));
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
Ok(())
|
||||
} else {
|
||||
let local_var_entity: Option<DeletePackageError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result<models::Package, Error<GetPackageError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), type=crate::apis::urlencode(r#type), name=crate::apis::urlencode(name), version=crate::apis::urlencode(version));
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetPackageError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn list_package_files(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result<Vec<models::PackageFile>, Error<ListPackageFilesError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}/files", local_var_configuration.base_path, owner=crate::apis::urlencode(owner), type=crate::apis::urlencode(r#type), name=crate::apis::urlencode(name), version=crate::apis::urlencode(version));
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<ListPackageFilesError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn list_packages(configuration: &configuration::Configuration, owner: &str, page: Option<i32>, limit: Option<i32>, r#type: Option<&str>, q: Option<&str>) -> Result<Vec<models::Package>, Error<ListPackagesError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/packages/{owner}", local_var_configuration.base_path, owner=crate::apis::urlencode(owner));
|
||||
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) = page {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = limit {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("limit", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = r#type {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("type", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_str) = q {
|
||||
local_var_req_builder = local_var_req_builder.query(&[("q", &local_var_str.to_string())]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<ListPackagesError> = 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))
|
||||
}
|
||||
}
|
||||
|
13945
crates/gitea-client/src/apis/repository_api.rs
Normal file
13945
crates/gitea-client/src/apis/repository_api.rs
Normal file
File diff suppressed because it is too large
Load Diff
358
crates/gitea-client/src/apis/settings_api.rs
Normal file
358
crates/gitea-client/src/apis/settings_api.rs
Normal file
@@ -0,0 +1,358 @@
|
||||
/*
|
||||
* Gitea API
|
||||
*
|
||||
* This documentation describes the Gitea API.
|
||||
*
|
||||
* The version of the OpenAPI document: 1.22.1
|
||||
*
|
||||
* Generated by: https://openapi-generator.tech
|
||||
*/
|
||||
|
||||
|
||||
use reqwest;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::{apis::ResponseContent, models};
|
||||
use super::{Error, configuration};
|
||||
|
||||
|
||||
/// struct for typed errors of method [`get_general_api_settings`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetGeneralApiSettingsError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_general_attachment_settings`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetGeneralAttachmentSettingsError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_general_repository_settings`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetGeneralRepositorySettingsError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
/// struct for typed errors of method [`get_general_ui_settings`]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum GetGeneralUiSettingsError {
|
||||
UnknownValue(serde_json::Value),
|
||||
}
|
||||
|
||||
|
||||
pub async fn get_general_api_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralApiSettings, Error<GetGeneralApiSettingsError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/settings/api", local_var_configuration.base_path);
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetGeneralApiSettingsError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_general_attachment_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralAttachmentSettings, Error<GetGeneralAttachmentSettingsError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/settings/attachment", local_var_configuration.base_path);
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetGeneralAttachmentSettingsError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_general_repository_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralRepoSettings, Error<GetGeneralRepositorySettingsError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/settings/repository", local_var_configuration.base_path);
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetGeneralRepositorySettingsError> = 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))
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn get_general_ui_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralUiSettings, Error<GetGeneralUiSettingsError>> {
|
||||
let local_var_configuration = configuration;
|
||||
|
||||
let local_var_client = &local_var_configuration.client;
|
||||
|
||||
let local_var_uri_str = format!("{}/settings/ui", local_var_configuration.base_path);
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("access_token", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("sudo", local_var_value)]);
|
||||
}
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.query(&[("token", local_var_value)]);
|
||||
}
|
||||
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_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("X-GITEA-OTP", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Authorization", local_var_value);
|
||||
};
|
||||
if let Some(ref local_var_apikey) = local_var_configuration.api_key {
|
||||
let local_var_key = local_var_apikey.key.clone();
|
||||
let local_var_value = match local_var_apikey.prefix {
|
||||
Some(ref local_var_prefix) => format!("{} {}", local_var_prefix, local_var_key),
|
||||
None => local_var_key,
|
||||
};
|
||||
local_var_req_builder = local_var_req_builder.header("Sudo", local_var_value);
|
||||
};
|
||||
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() {
|
||||
serde_json::from_str(&local_var_content).map_err(Error::from)
|
||||
} else {
|
||||
let local_var_entity: Option<GetGeneralUiSettingsError> = 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))
|
||||
}
|
||||
}
|
||||
|
6219
crates/gitea-client/src/apis/user_api.rs
Normal file
6219
crates/gitea-client/src/apis/user_api.rs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user