Initial implementation #1

Merged
dzu merged 7 commits from forgejo-openapi-generator into master 2026-02-11 06:36:51 +01:00
241 changed files with 9357 additions and 2534 deletions
Showing only changes of commit 7de555e13f - Show all commits

cargo fmt over generated client

Artem Diachenko 2026-02-08 02:20:14 +00:00

View file

@ -8,12 +8,10 @@
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use super::{configuration, ContentType, Error};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
use reqwest;
use serde::{de::Error as _, Deserialize, Serialize};
/// struct for typed errors of method [`activitypub_instance_actor`]
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -93,9 +91,9 @@ pub enum ActivitypubRepositoryOutboxError {
UnknownValue(serde_json::Value),
}
pub async fn activitypub_instance_actor(configuration: &configuration::Configuration, ) -> Result<models::ActivityPub, Error<ActivitypubInstanceActorError>> {
pub async fn activitypub_instance_actor(
configuration: &configuration::Configuration,
) -> Result<models::ActivityPub, Error<ActivitypubInstanceActorError>> {
let uri_str = format!("{}/activitypub/actor", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -175,14 +173,21 @@ pub async fn activitypub_instance_actor(configuration: &configuration::Configura
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubInstanceActorError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_instance_actor_inbox(configuration: &configuration::Configuration, ) -> Result<(), Error<ActivitypubInstanceActorInboxError>> {
pub async fn activitypub_instance_actor_inbox(
configuration: &configuration::Configuration,
) -> Result<(), Error<ActivitypubInstanceActorInboxError>> {
let uri_str = format!("{}/activitypub/actor/inbox", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -248,15 +253,23 @@ pub async fn activitypub_instance_actor_inbox(configuration: &configuration::Con
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubInstanceActorInboxError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
let entity: Option<ActivitypubInstanceActorInboxError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_instance_actor_outbox(configuration: &configuration::Configuration, ) -> Result<serde_json::Value, Error<ActivitypubInstanceActorOutboxError>> {
pub async fn activitypub_instance_actor_outbox(
configuration: &configuration::Configuration,
) -> Result<serde_json::Value, Error<ActivitypubInstanceActorOutboxError>> {
let uri_str = format!("{}/activitypub/actor/outbox", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -333,16 +346,28 @@ pub async fn activitypub_instance_actor_outbox(configuration: &configuration::Co
}
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubInstanceActorOutboxError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
let entity: Option<ActivitypubInstanceActorOutboxError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_person(configuration: &configuration::Configuration, user_id: i64) -> Result<models::ActivityPub, Error<ActivitypubPersonError>> {
pub async fn activitypub_person(
configuration: &configuration::Configuration,
user_id: i64,
) -> Result<models::ActivityPub, Error<ActivitypubPersonError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_user_id = user_id;
let uri_str = format!("{}/activitypub/user-id/{user_id}", configuration.base_path, user_id=p_path_user_id);
let uri_str = format!(
"{}/activitypub/user-id/{user_id}",
configuration.base_path,
user_id = p_path_user_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -421,16 +446,29 @@ pub async fn activitypub_person(configuration: &configuration::Configuration, us
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubPersonError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_person_activity(configuration: &configuration::Configuration, user_id: i32, activity_id: i32) -> Result<models::ActivityPub, Error<ActivitypubPersonActivityError>> {
pub async fn activitypub_person_activity(
configuration: &configuration::Configuration,
user_id: i32,
activity_id: i32,
) -> Result<models::ActivityPub, Error<ActivitypubPersonActivityError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_user_id = user_id;
let p_path_activity_id = activity_id;
let uri_str = format!("{}/activitypub/user-id/{user_id}/activities/{activity_id}/activity", configuration.base_path, user_id=p_path_user_id, activity_id=p_path_activity_id);
let uri_str = format!(
"{}/activitypub/user-id/{user_id}/activities/{activity_id}/activity",
configuration.base_path,
user_id = p_path_user_id,
activity_id = p_path_activity_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -509,16 +547,29 @@ pub async fn activitypub_person_activity(configuration: &configuration::Configur
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubPersonActivityError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_person_activity_note(configuration: &configuration::Configuration, user_id: i32, activity_id: i32) -> Result<models::ActivityPub, Error<ActivitypubPersonActivityNoteError>> {
pub async fn activitypub_person_activity_note(
configuration: &configuration::Configuration,
user_id: i32,
activity_id: i32,
) -> Result<models::ActivityPub, Error<ActivitypubPersonActivityNoteError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_user_id = user_id;
let p_path_activity_id = activity_id;
let uri_str = format!("{}/activitypub/user-id/{user_id}/activities/{activity_id}", configuration.base_path, user_id=p_path_user_id, activity_id=p_path_activity_id);
let uri_str = format!(
"{}/activitypub/user-id/{user_id}/activities/{activity_id}",
configuration.base_path,
user_id = p_path_user_id,
activity_id = p_path_activity_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -596,16 +647,28 @@ pub async fn activitypub_person_activity_note(configuration: &configuration::Con
}
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubPersonActivityNoteError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
let entity: Option<ActivitypubPersonActivityNoteError> =
serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_person_feed(configuration: &configuration::Configuration, user_id: i32) -> Result<serde_json::Value, Error<ActivitypubPersonFeedError>> {
pub async fn activitypub_person_feed(
configuration: &configuration::Configuration,
user_id: i32,
) -> Result<serde_json::Value, Error<ActivitypubPersonFeedError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_user_id = user_id;
let uri_str = format!("{}/activitypub/user-id/{user_id}/outbox", configuration.base_path, user_id=p_path_user_id);
let uri_str = format!(
"{}/activitypub/user-id/{user_id}/outbox",
configuration.base_path,
user_id = p_path_user_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -684,16 +747,29 @@ pub async fn activitypub_person_feed(configuration: &configuration::Configuratio
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubPersonFeedError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_person_inbox(configuration: &configuration::Configuration, user_id: i64) -> Result<(), Error<ActivitypubPersonInboxError>> {
pub async fn activitypub_person_inbox(
configuration: &configuration::Configuration,
user_id: i64,
) -> Result<(), Error<ActivitypubPersonInboxError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_user_id = user_id;
let uri_str = format!("{}/activitypub/user-id/{user_id}/inbox", configuration.base_path, user_id=p_path_user_id);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let uri_str = format!(
"{}/activitypub/user-id/{user_id}/inbox",
configuration.base_path,
user_id = p_path_user_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -760,15 +836,26 @@ pub async fn activitypub_person_inbox(configuration: &configuration::Configurati
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubPersonInboxError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_repository(configuration: &configuration::Configuration, repository_id: i64) -> Result<models::ActivityPub, Error<ActivitypubRepositoryError>> {
pub async fn activitypub_repository(
configuration: &configuration::Configuration,
repository_id: i64,
) -> Result<models::ActivityPub, Error<ActivitypubRepositoryError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_repository_id = repository_id;
let uri_str = format!("{}/activitypub/repository-id/{repository_id}", configuration.base_path, repository_id=p_path_repository_id);
let uri_str = format!(
"{}/activitypub/repository-id/{repository_id}",
configuration.base_path,
repository_id = p_path_repository_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -847,17 +934,31 @@ pub async fn activitypub_repository(configuration: &configuration::Configuration
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubRepositoryError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_repository_inbox(configuration: &configuration::Configuration, repository_id: i64, body: Option<serde_json::Value>) -> Result<(), Error<ActivitypubRepositoryInboxError>> {
pub async fn activitypub_repository_inbox(
configuration: &configuration::Configuration,
repository_id: i64,
body: Option<serde_json::Value>,
) -> Result<(), Error<ActivitypubRepositoryInboxError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_repository_id = repository_id;
let p_body_body = body;
let uri_str = format!("{}/activitypub/repository-id/{repository_id}/inbox", configuration.base_path, repository_id=p_path_repository_id);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let uri_str = format!(
"{}/activitypub/repository-id/{repository_id}/inbox",
configuration.base_path,
repository_id = p_path_repository_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -925,16 +1026,29 @@ pub async fn activitypub_repository_inbox(configuration: &configuration::Configu
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubRepositoryInboxError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn activitypub_repository_outbox(configuration: &configuration::Configuration, repository_id: i64) -> Result<serde_json::Value, Error<ActivitypubRepositoryOutboxError>> {
pub async fn activitypub_repository_outbox(
configuration: &configuration::Configuration,
repository_id: i64,
) -> Result<serde_json::Value, Error<ActivitypubRepositoryOutboxError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_repository_id = repository_id;
let uri_str = format!("{}/activitypub/repository-id/{repository_id}/outbox", configuration.base_path, repository_id=p_path_repository_id);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let uri_str = format!(
"{}/activitypub/repository-id/{repository_id}/outbox",
configuration.base_path,
repository_id = p_path_repository_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -1012,7 +1126,10 @@ pub async fn activitypub_repository_outbox(configuration: &configuration::Config
} else {
let content = resp.text().await?;
let entity: Option<ActivitypubRepositoryOutboxError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,6 @@
* Generated by: https://openapi-generator.tech
*/
#[derive(Debug, Clone)]
pub struct Configuration {
pub base_path: String,
@ -29,7 +27,6 @@ pub struct ApiKey {
pub key: String,
}
impl Configuration {
pub fn new() -> Configuration {
Configuration::default()

File diff suppressed because it is too large Load diff

View file

@ -8,12 +8,10 @@
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use super::{configuration, ContentType, Error};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
use reqwest;
use serde::{de::Error as _, Deserialize, Serialize};
/// struct for typed errors of method [`get_gitignore_template_info`]
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -113,12 +111,18 @@ pub enum RenderMarkupError {
UnknownValue(serde_json::Value),
}
pub async fn get_gitignore_template_info(configuration: &configuration::Configuration, name: &str) -> Result<models::GitignoreTemplateInfo, Error<GetGitignoreTemplateInfoError>> {
pub async fn get_gitignore_template_info(
configuration: &configuration::Configuration,
name: &str,
) -> Result<models::GitignoreTemplateInfo, Error<GetGitignoreTemplateInfoError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_name = name;
let uri_str = format!("{}/gitignore/templates/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
let uri_str = format!(
"{}/gitignore/templates/{name}",
configuration.base_path,
name = crate::apis::urlencode(p_path_name)
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -197,15 +201,26 @@ pub async fn get_gitignore_template_info(configuration: &configuration::Configur
} else {
let content = resp.text().await?;
let entity: Option<GetGitignoreTemplateInfoError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_label_template_info(configuration: &configuration::Configuration, name: &str) -> Result<Vec<models::LabelTemplate>, Error<GetLabelTemplateInfoError>> {
pub async fn get_label_template_info(
configuration: &configuration::Configuration,
name: &str,
) -> Result<Vec<models::LabelTemplate>, Error<GetLabelTemplateInfoError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_name = name;
let uri_str = format!("{}/label/templates/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
let uri_str = format!(
"{}/label/templates/{name}",
configuration.base_path,
name = crate::apis::urlencode(p_path_name)
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -284,15 +299,26 @@ pub async fn get_label_template_info(configuration: &configuration::Configuratio
} else {
let content = resp.text().await?;
let entity: Option<GetLabelTemplateInfoError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_license_template_info(configuration: &configuration::Configuration, name: &str) -> Result<models::LicenseTemplateInfo, Error<GetLicenseTemplateInfoError>> {
pub async fn get_license_template_info(
configuration: &configuration::Configuration,
name: &str,
) -> Result<models::LicenseTemplateInfo, Error<GetLicenseTemplateInfoError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_name = name;
let uri_str = format!("{}/licenses/{name}", configuration.base_path, name=crate::apis::urlencode(p_path_name));
let uri_str = format!(
"{}/licenses/{name}",
configuration.base_path,
name = crate::apis::urlencode(p_path_name)
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -371,12 +397,17 @@ pub async fn get_license_template_info(configuration: &configuration::Configurat
} else {
let content = resp.text().await?;
let entity: Option<GetLicenseTemplateInfoError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_node_info(configuration: &configuration::Configuration, ) -> Result<models::NodeInfo, Error<GetNodeInfoError>> {
pub async fn get_node_info(
configuration: &configuration::Configuration,
) -> Result<models::NodeInfo, Error<GetNodeInfoError>> {
let uri_str = format!("{}/nodeinfo", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -456,12 +487,17 @@ pub async fn get_node_info(configuration: &configuration::Configuration, ) -> Re
} else {
let content = resp.text().await?;
let entity: Option<GetNodeInfoError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_signing_key(configuration: &configuration::Configuration, ) -> Result<String, Error<GetSigningKeyError>> {
pub async fn get_signing_key(
configuration: &configuration::Configuration,
) -> Result<String, Error<GetSigningKeyError>> {
let uri_str = format!("{}/signing-key.gpg", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -541,12 +577,17 @@ pub async fn get_signing_key(configuration: &configuration::Configuration, ) ->
} else {
let content = resp.text().await?;
let entity: Option<GetSigningKeyError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_ssh_signing_key(configuration: &configuration::Configuration, ) -> Result<String, Error<GetSshSigningKeyError>> {
pub async fn get_ssh_signing_key(
configuration: &configuration::Configuration,
) -> Result<String, Error<GetSshSigningKeyError>> {
let uri_str = format!("{}/signing-key.ssh", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -626,12 +667,17 @@ pub async fn get_ssh_signing_key(configuration: &configuration::Configuration, )
} else {
let content = resp.text().await?;
let entity: Option<GetSshSigningKeyError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_version(configuration: &configuration::Configuration, ) -> Result<models::ServerVersion, Error<GetVersionError>> {
pub async fn get_version(
configuration: &configuration::Configuration,
) -> Result<models::ServerVersion, Error<GetVersionError>> {
let uri_str = format!("{}/version", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -711,12 +757,17 @@ pub async fn get_version(configuration: &configuration::Configuration, ) -> Resu
} else {
let content = resp.text().await?;
let entity: Option<GetVersionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn list_gitignores_templates(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<ListGitignoresTemplatesError>> {
pub async fn list_gitignores_templates(
configuration: &configuration::Configuration,
) -> Result<Vec<String>, Error<ListGitignoresTemplatesError>> {
let uri_str = format!("{}/gitignore/templates", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -796,12 +847,17 @@ pub async fn list_gitignores_templates(configuration: &configuration::Configurat
} else {
let content = resp.text().await?;
let entity: Option<ListGitignoresTemplatesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn list_label_templates(configuration: &configuration::Configuration, ) -> Result<Vec<String>, Error<ListLabelTemplatesError>> {
pub async fn list_label_templates(
configuration: &configuration::Configuration,
) -> Result<Vec<String>, Error<ListLabelTemplatesError>> {
let uri_str = format!("{}/label/templates", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -881,12 +937,17 @@ pub async fn list_label_templates(configuration: &configuration::Configuration,
} else {
let content = resp.text().await?;
let entity: Option<ListLabelTemplatesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn list_license_templates(configuration: &configuration::Configuration, ) -> Result<Vec<models::LicensesTemplateListEntry>, Error<ListLicenseTemplatesError>> {
pub async fn list_license_templates(
configuration: &configuration::Configuration,
) -> Result<Vec<models::LicensesTemplateListEntry>, Error<ListLicenseTemplatesError>> {
let uri_str = format!("{}/licenses", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -966,16 +1027,25 @@ pub async fn list_license_templates(configuration: &configuration::Configuration
} else {
let content = resp.text().await?;
let entity: Option<ListLicenseTemplatesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn render_markdown(configuration: &configuration::Configuration, body: Option<models::MarkdownOption>) -> Result<String, Error<RenderMarkdownError>> {
pub async fn render_markdown(
configuration: &configuration::Configuration,
body: Option<models::MarkdownOption>,
) -> Result<String, Error<RenderMarkdownError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/markdown", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -1054,16 +1124,25 @@ pub async fn render_markdown(configuration: &configuration::Configuration, body:
} else {
let content = resp.text().await?;
let entity: Option<RenderMarkdownError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn render_markdown_raw(configuration: &configuration::Configuration, body: &str) -> Result<String, Error<RenderMarkdownRawError>> {
pub async fn render_markdown_raw(
configuration: &configuration::Configuration,
body: &str,
) -> Result<String, Error<RenderMarkdownRawError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/markdown/raw", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -1142,16 +1221,25 @@ pub async fn render_markdown_raw(configuration: &configuration::Configuration, b
} else {
let content = resp.text().await?;
let entity: Option<RenderMarkdownRawError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn render_markup(configuration: &configuration::Configuration, body: Option<models::MarkupOption>) -> Result<String, Error<RenderMarkupError>> {
pub async fn render_markup(
configuration: &configuration::Configuration,
body: Option<models::MarkupOption>,
) -> Result<String, Error<RenderMarkupError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body_body = body;
let uri_str = format!("{}/markup", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -1230,7 +1318,10 @@ pub async fn render_markup(configuration: &configuration::Configuration, body: O
} else {
let content = resp.text().await?;
let entity: Option<RenderMarkupError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}

View file

@ -78,8 +78,10 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String
value,
));
}
},
serde_json::Value::String(s) => params.push((format!("{}[{}]", prefix, key), s.clone())),
}
serde_json::Value::String(s) => {
params.push((format!("{}[{}]", prefix, key), s.clone()))
}
_ => params.push((format!("{}[{}]", prefix, key), value.to_string())),
}
}
@ -96,7 +98,7 @@ pub fn parse_deep_object(prefix: &str, value: &serde_json::Value) -> Vec<(String
enum ContentType {
Json,
Text,
Unsupported(String)
Unsupported(String),
}
impl From<&str> for ContentType {

View file

@ -8,12 +8,10 @@
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use super::{configuration, ContentType, Error};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
use reqwest;
use serde::{de::Error as _, Deserialize, Serialize};
/// struct for typed errors of method [`notify_get_list`]
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -68,8 +66,16 @@ pub enum NotifyReadThreadError {
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>> {
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>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_all = all;
let p_query_status_types = status_types;
@ -87,14 +93,40 @@ pub async fn notify_get_list(configuration: &configuration::Configuration, all:
}
if let Some(ref param_value) = p_query_status_types {
req_builder = match "multi" {
"multi" => req_builder.query(&param_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("status-types", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
"multi" => req_builder.query(
&param_value
.into_iter()
.map(|p| ("status-types".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"status-types",
&param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_subject_type {
req_builder = match "multi" {
"multi" => req_builder.query(&param_value.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("subject-type", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
"multi" => req_builder.query(
&param_value
.into_iter()
.map(|p| ("subject-type".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"subject-type",
&param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_since {
@ -185,11 +217,26 @@ pub async fn notify_get_list(configuration: &configuration::Configuration, all:
} else {
let content = resp.text().await?;
let entity: Option<NotifyGetListError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
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>> {
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>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_path_repo = repo;
@ -201,7 +248,12 @@ pub async fn notify_get_repo_list(configuration: &configuration::Configuration,
let p_query_page = page;
let p_query_limit = limit;
let uri_str = format!("{}/repos/{owner}/{repo}/notifications", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
let uri_str = format!(
"{}/repos/{owner}/{repo}/notifications",
configuration.base_path,
owner = crate::apis::urlencode(p_path_owner),
repo = crate::apis::urlencode(p_path_repo)
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_all {
@ -209,14 +261,40 @@ pub async fn notify_get_repo_list(configuration: &configuration::Configuration,
}
if let Some(ref param_value) = p_query_status_types {
req_builder = match "multi" {
"multi" => req_builder.query(&param_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("status-types", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
"multi" => req_builder.query(
&param_value
.into_iter()
.map(|p| ("status-types".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"status-types",
&param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_subject_type {
req_builder = match "multi" {
"multi" => req_builder.query(&param_value.into_iter().map(|p| ("subject-type".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("subject-type", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
"multi" => req_builder.query(
&param_value
.into_iter()
.map(|p| ("subject-type".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"subject-type",
&param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_since {
@ -307,15 +385,26 @@ pub async fn notify_get_repo_list(configuration: &configuration::Configuration,
} else {
let content = resp.text().await?;
let entity: Option<NotifyGetRepoListError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn notify_get_thread(configuration: &configuration::Configuration, id: i64) -> Result<models::NotificationThread, Error<NotifyGetThreadError>> {
pub async fn notify_get_thread(
configuration: &configuration::Configuration,
id: i64,
) -> Result<models::NotificationThread, Error<NotifyGetThreadError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_id = id;
let uri_str = format!("{}/notifications/threads/{id}", configuration.base_path, id=p_path_id);
let uri_str = format!(
"{}/notifications/threads/{id}",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref apikey) = configuration.api_key {
@ -394,12 +483,17 @@ pub async fn notify_get_thread(configuration: &configuration::Configuration, id:
} else {
let content = resp.text().await?;
let entity: Option<NotifyGetThreadError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn notify_new_available(configuration: &configuration::Configuration, ) -> Result<models::NotificationCount, Error<NotifyNewAvailableError>> {
pub async fn notify_new_available(
configuration: &configuration::Configuration,
) -> Result<models::NotificationCount, Error<NotifyNewAvailableError>> {
let uri_str = format!("{}/notifications/new", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -479,11 +573,21 @@ pub async fn notify_new_available(configuration: &configuration::Configuration,
} else {
let content = resp.text().await?;
let entity: Option<NotifyNewAvailableError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn notify_read_list(configuration: &configuration::Configuration, last_read_at: Option<String>, all: Option<bool>, status_types: Option<Vec<String>>, to_status: Option<&str>) -> Result<Vec<models::NotificationThread>, Error<NotifyReadListError>> {
pub async fn notify_read_list(
configuration: &configuration::Configuration,
last_read_at: Option<String>,
all: Option<bool>,
status_types: Option<Vec<String>>,
to_status: Option<&str>,
) -> Result<Vec<models::NotificationThread>, Error<NotifyReadListError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_last_read_at = last_read_at;
let p_query_all = all;
@ -501,8 +605,21 @@ pub async fn notify_read_list(configuration: &configuration::Configuration, last
}
if let Some(ref param_value) = p_query_status_types {
req_builder = match "multi" {
"multi" => req_builder.query(&param_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("status-types", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
"multi" => req_builder.query(
&param_value
.into_iter()
.map(|p| ("status-types".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"status-types",
&param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_to_status {
@ -584,11 +701,23 @@ pub async fn notify_read_list(configuration: &configuration::Configuration, last
} else {
let content = resp.text().await?;
let entity: Option<NotifyReadListError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn notify_read_repo_list(configuration: &configuration::Configuration, owner: &str, repo: &str, all: Option<bool>, status_types: Option<Vec<String>>, to_status: Option<&str>, last_read_at: Option<String>) -> Result<Vec<models::NotificationThread>, Error<NotifyReadRepoListError>> {
pub async fn notify_read_repo_list(
configuration: &configuration::Configuration,
owner: &str,
repo: &str,
all: Option<bool>,
status_types: Option<Vec<String>>,
to_status: Option<&str>,
last_read_at: Option<String>,
) -> Result<Vec<models::NotificationThread>, Error<NotifyReadRepoListError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_path_repo = repo;
@ -597,7 +726,12 @@ pub async fn notify_read_repo_list(configuration: &configuration::Configuration,
let p_query_to_status = to_status;
let p_query_last_read_at = last_read_at;
let uri_str = format!("{}/repos/{owner}/{repo}/notifications", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), repo=crate::apis::urlencode(p_path_repo));
let uri_str = format!(
"{}/repos/{owner}/{repo}/notifications",
configuration.base_path,
owner = crate::apis::urlencode(p_path_owner),
repo = crate::apis::urlencode(p_path_repo)
);
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref param_value) = p_query_all {
@ -605,8 +739,21 @@ pub async fn notify_read_repo_list(configuration: &configuration::Configuration,
}
if let Some(ref param_value) = p_query_status_types {
req_builder = match "multi" {
"multi" => req_builder.query(&param_value.into_iter().map(|p| ("status-types".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("status-types", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
"multi" => req_builder.query(
&param_value
.into_iter()
.map(|p| ("status-types".to_owned(), p.to_string()))
.collect::<Vec<(std::string::String, std::string::String)>>(),
),
_ => req_builder.query(&[(
"status-types",
&param_value
.into_iter()
.map(|p| p.to_string())
.collect::<Vec<String>>()
.join(",")
.to_string(),
)]),
};
}
if let Some(ref param_value) = p_query_to_status {
@ -691,17 +838,31 @@ pub async fn notify_read_repo_list(configuration: &configuration::Configuration,
} else {
let content = resp.text().await?;
let entity: Option<NotifyReadRepoListError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn notify_read_thread(configuration: &configuration::Configuration, id: i64, to_status: Option<&str>) -> Result<models::NotificationThread, Error<NotifyReadThreadError>> {
pub async fn notify_read_thread(
configuration: &configuration::Configuration,
id: i64,
to_status: Option<&str>,
) -> Result<models::NotificationThread, Error<NotifyReadThreadError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_id = id;
let p_query_to_status = to_status;
let uri_str = format!("{}/notifications/threads/{id}", configuration.base_path, id=p_path_id);
let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
let uri_str = format!(
"{}/notifications/threads/{id}",
configuration.base_path,
id = p_path_id
);
let mut req_builder = configuration
.client
.request(reqwest::Method::PATCH, &uri_str);
if let Some(ref param_value) = p_query_to_status {
req_builder = req_builder.query(&[("to-status", &param_value.to_string())]);
@ -782,7 +943,10 @@ pub async fn notify_read_thread(configuration: &configuration::Configuration, id
} else {
let content = resp.text().await?;
let entity: Option<NotifyReadThreadError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}

File diff suppressed because it is too large Load diff

View file

@ -8,12 +8,10 @@
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use super::{configuration, ContentType, Error};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
use reqwest;
use serde::{de::Error as _, Deserialize, Serialize};
/// struct for typed errors of method [`delete_package`]
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -63,8 +61,13 @@ pub enum UnlinkPackageError {
UnknownValue(serde_json::Value),
}
pub async fn delete_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result<(), Error<DeletePackageError>> {
pub async fn delete_package(
configuration: &configuration::Configuration,
owner: &str,
r#type: &str,
name: &str,
version: &str,
) -> Result<(), Error<DeletePackageError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_path_type = r#type;
@ -72,7 +75,9 @@ pub async fn delete_package(configuration: &configuration::Configuration, owner:
let p_path_version = version;
let uri_str = format!("{}/packages/{owner}/{type}/{name}/{version}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name), version=crate::apis::urlencode(p_path_version));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -139,11 +144,21 @@ pub async fn delete_package(configuration: &configuration::Configuration, owner:
} else {
let content = resp.text().await?;
let entity: Option<DeletePackageError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result<models::Package, Error<GetPackageError>> {
pub async fn get_package(
configuration: &configuration::Configuration,
owner: &str,
r#type: &str,
name: &str,
version: &str,
) -> Result<models::Package, Error<GetPackageError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_path_type = r#type;
@ -229,11 +244,21 @@ pub async fn get_package(configuration: &configuration::Configuration, owner: &s
} else {
let content = resp.text().await?;
let entity: Option<GetPackageError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn link_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, repo_name: &str) -> Result<(), Error<LinkPackageError>> {
pub async fn link_package(
configuration: &configuration::Configuration,
owner: &str,
r#type: &str,
name: &str,
repo_name: &str,
) -> Result<(), Error<LinkPackageError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_path_type = r#type;
@ -241,7 +266,9 @@ pub async fn link_package(configuration: &configuration::Configuration, owner: &
let p_path_repo_name = repo_name;
let uri_str = format!("{}/packages/{owner}/{type}/{name}/-/link/{repo_name}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name), repo_name=crate::apis::urlencode(p_path_repo_name));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -308,11 +335,21 @@ pub async fn link_package(configuration: &configuration::Configuration, owner: &
} else {
let content = resp.text().await?;
let entity: Option<LinkPackageError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn list_package_files(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str, version: &str) -> Result<Vec<models::PackageFile>, Error<ListPackageFilesError>> {
pub async fn list_package_files(
configuration: &configuration::Configuration,
owner: &str,
r#type: &str,
name: &str,
version: &str,
) -> Result<Vec<models::PackageFile>, Error<ListPackageFilesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_path_type = r#type;
@ -398,11 +435,22 @@ pub async fn list_package_files(configuration: &configuration::Configuration, ow
} else {
let content = resp.text().await?;
let entity: Option<ListPackageFilesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
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>> {
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>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_query_page = page;
@ -410,7 +458,11 @@ pub async fn list_packages(configuration: &configuration::Configuration, owner:
let p_query_type = r#type;
let p_query_q = q;
let uri_str = format!("{}/packages/{owner}", configuration.base_path, owner=crate::apis::urlencode(p_path_owner));
let uri_str = format!(
"{}/packages/{owner}",
configuration.base_path,
owner = crate::apis::urlencode(p_path_owner)
);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_page {
@ -501,18 +553,29 @@ pub async fn list_packages(configuration: &configuration::Configuration, owner:
} else {
let content = resp.text().await?;
let entity: Option<ListPackagesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn unlink_package(configuration: &configuration::Configuration, owner: &str, r#type: &str, name: &str) -> Result<(), Error<UnlinkPackageError>> {
pub async fn unlink_package(
configuration: &configuration::Configuration,
owner: &str,
r#type: &str,
name: &str,
) -> Result<(), Error<UnlinkPackageError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_path_owner = owner;
let p_path_type = r#type;
let p_path_name = name;
let uri_str = format!("{}/packages/{owner}/{type}/{name}/-/unlink", configuration.base_path, owner=crate::apis::urlencode(p_path_owner), type=crate::apis::urlencode(p_path_type), name=crate::apis::urlencode(p_path_name));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
let mut req_builder = configuration
.client
.request(reqwest::Method::POST, &uri_str);
if let Some(ref apikey) = configuration.api_key {
let key = apikey.key.clone();
@ -579,7 +642,10 @@ pub async fn unlink_package(configuration: &configuration::Configuration, owner:
} else {
let content = resp.text().await?;
let entity: Option<UnlinkPackageError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}

File diff suppressed because it is too large Load diff

View file

@ -8,12 +8,10 @@
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use super::{configuration, ContentType, Error};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
use reqwest;
use serde::{de::Error as _, Deserialize, Serialize};
/// struct for typed errors of method [`get_general_api_settings`]
#[derive(Debug, Clone, Serialize, Deserialize)]
@ -43,9 +41,9 @@ pub enum GetGeneralUiSettingsError {
UnknownValue(serde_json::Value),
}
pub async fn get_general_api_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralApiSettings, Error<GetGeneralApiSettingsError>> {
pub async fn get_general_api_settings(
configuration: &configuration::Configuration,
) -> Result<models::GeneralApiSettings, Error<GetGeneralApiSettingsError>> {
let uri_str = format!("{}/settings/api", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -125,12 +123,17 @@ pub async fn get_general_api_settings(configuration: &configuration::Configurati
} else {
let content = resp.text().await?;
let entity: Option<GetGeneralApiSettingsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_general_attachment_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralAttachmentSettings, Error<GetGeneralAttachmentSettingsError>> {
pub async fn get_general_attachment_settings(
configuration: &configuration::Configuration,
) -> Result<models::GeneralAttachmentSettings, Error<GetGeneralAttachmentSettingsError>> {
let uri_str = format!("{}/settings/attachment", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -210,12 +213,17 @@ pub async fn get_general_attachment_settings(configuration: &configuration::Conf
} else {
let content = resp.text().await?;
let entity: Option<GetGeneralAttachmentSettingsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_general_repository_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralRepoSettings, Error<GetGeneralRepositorySettingsError>> {
pub async fn get_general_repository_settings(
configuration: &configuration::Configuration,
) -> Result<models::GeneralRepoSettings, Error<GetGeneralRepositorySettingsError>> {
let uri_str = format!("{}/settings/repository", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -295,12 +303,17 @@ pub async fn get_general_repository_settings(configuration: &configuration::Conf
} else {
let content = resp.text().await?;
let entity: Option<GetGeneralRepositorySettingsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}
pub async fn get_general_ui_settings(configuration: &configuration::Configuration, ) -> Result<models::GeneralUiSettings, Error<GetGeneralUiSettingsError>> {
pub async fn get_general_ui_settings(
configuration: &configuration::Configuration,
) -> Result<models::GeneralUiSettings, Error<GetGeneralUiSettingsError>> {
let uri_str = format!("{}/settings/ui", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
@ -380,7 +393,10 @@ pub async fn get_general_ui_settings(configuration: &configuration::Configuratio
} else {
let content = resp.text().await?;
let entity: Option<GetGeneralUiSettingsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
Err(Error::ResponseError(ResponseContent {
status,
content,
entity,
}))
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,11 +1,11 @@
#![allow(unused_imports)]
#![allow(clippy::too_many_arguments)]
extern crate serde_repr;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate serde_repr;
extern crate url;
extern crate reqwest;
pub mod apis;
pub mod models;

View file

@ -36,4 +36,3 @@ impl AccessToken {
}
}
}

View file

@ -45,7 +45,10 @@ pub struct ActionRun {
#[serde(rename = "index_in_repo", skip_serializing_if = "Option::is_none")]
pub index_in_repo: Option<i64>,
/// If this is triggered by a PR from a forked repository or an untrusted user, we need to check if it is approved and limit permissions when running the workflow.
#[serde(rename = "is_fork_pull_request", skip_serializing_if = "Option::is_none")]
#[serde(
rename = "is_fork_pull_request",
skip_serializing_if = "Option::is_none"
)]
pub is_fork_pull_request: Option<bool>,
/// has the commit/tag/… the action run ran on been deleted
#[serde(rename = "is_ref_deleted", skip_serializing_if = "Option::is_none")]
@ -113,4 +116,3 @@ impl ActionRun {
}
}
}

View file

@ -55,4 +55,3 @@ impl ActionRunJob {
}
}
}

View file

@ -62,4 +62,3 @@ impl ActionTask {
}
}
}

View file

@ -29,4 +29,3 @@ impl ActionTaskResponse {
}
}
}

View file

@ -39,4 +39,3 @@ impl ActionVariable {
}
}
}

View file

@ -125,4 +125,3 @@ impl Default for OpType {
Self::CreateRepo
}
}

Some files were not shown because too many files have changed in this diff Show more