Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rust/.rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
wrap_comments = true
imports_granularity = "Crate"
fn_params_layout = "Vertical"
struct_lit_width = 0
imports_layout = "Vertical"
fn_call_width = 0
146 changes: 103 additions & 43 deletions rust/src/api/application.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// this file is @generated
use crate::{error::Result, models::*, Configuration};
use crate::{
error::Result,
models::*,
Configuration,
};

#[derive(Default)]
pub struct ApplicationListOptions {
Expand All @@ -24,7 +28,9 @@ pub struct Application<'a> {

impl<'a> Application<'a> {
pub(super) fn new(cfg: &'a Configuration) -> Self {
Self { cfg }
Self {
cfg,
}
}

/// List of all the organization's applications.
Expand All @@ -38,12 +44,21 @@ impl<'a> Application<'a> {
order,
} = options.unwrap_or_default();

crate::request::Request::new(http1::Method::GET, "/api/v1/app")
.with_optional_query_param("limit", limit)
.with_optional_query_param("iterator", iterator)
.with_optional_query_param("order", order)
.execute(self.cfg)
.await
crate::request::Request::new(
http1::Method::GET,
"/api/v1/app",
)
.with_optional_query_param(
"limit", limit,
)
.with_optional_query_param(
"iterator", iterator,
)
.with_optional_query_param(
"order", order,
)
.execute(self.cfg)
.await
}

/// Create a new application.
Expand All @@ -52,13 +67,21 @@ impl<'a> Application<'a> {
application_in: ApplicationIn,
options: Option<ApplicationCreateOptions>,
) -> Result<ApplicationOut> {
let ApplicationCreateOptions { idempotency_key } = options.unwrap_or_default();
let ApplicationCreateOptions {
idempotency_key,
} = options.unwrap_or_default();

crate::request::Request::new(http1::Method::POST, "/api/v1/app")
.with_optional_header_param("idempotency-key", idempotency_key)
.with_body_param(application_in)
.execute(self.cfg)
.await
crate::request::Request::new(
http1::Method::POST,
"/api/v1/app",
)
.with_optional_header_param(
"idempotency-key",
idempotency_key,
)
.with_body_param(application_in)
.execute(self.cfg)
.await
}

/// Create the application with the given ID, or create a new one if it
Expand All @@ -68,22 +91,41 @@ impl<'a> Application<'a> {
application_in: ApplicationIn,
options: Option<ApplicationCreateOptions>,
) -> Result<ApplicationOut> {
let ApplicationCreateOptions { idempotency_key } = options.unwrap_or_default();

crate::request::Request::new(http1::Method::POST, "/api/v1/app")
.with_query_param("get_if_exists", "true".to_owned())
.with_optional_header_param("idempotency-key", idempotency_key)
.with_body_param(application_in)
.execute(self.cfg)
.await
let ApplicationCreateOptions {
idempotency_key,
} = options.unwrap_or_default();

crate::request::Request::new(
http1::Method::POST,
"/api/v1/app",
)
.with_query_param(
"get_if_exists",
"true".to_owned(),
)
.with_optional_header_param(
"idempotency-key",
idempotency_key,
)
.with_body_param(application_in)
.execute(self.cfg)
.await
}

/// Get an application.
pub async fn get(&self, app_id: String) -> Result<ApplicationOut> {
crate::request::Request::new(http1::Method::GET, "/api/v1/app/{app_id}")
.with_path_param("app_id", app_id)
.execute(self.cfg)
.await
pub async fn get(
&self,
app_id: String,
) -> Result<ApplicationOut> {
crate::request::Request::new(
http1::Method::GET,
"/api/v1/app/{app_id}",
)
.with_path_param(
"app_id", app_id,
)
.execute(self.cfg)
.await
}

/// Update an application.
Expand All @@ -92,20 +134,33 @@ impl<'a> Application<'a> {
app_id: String,
application_in: ApplicationIn,
) -> Result<ApplicationOut> {
crate::request::Request::new(http1::Method::PUT, "/api/v1/app/{app_id}")
.with_path_param("app_id", app_id)
.with_body_param(application_in)
.execute(self.cfg)
.await
crate::request::Request::new(
http1::Method::PUT,
"/api/v1/app/{app_id}",
)
.with_path_param(
"app_id", app_id,
)
.with_body_param(application_in)
.execute(self.cfg)
.await
}

/// Delete an application.
pub async fn delete(&self, app_id: String) -> Result<()> {
crate::request::Request::new(http1::Method::DELETE, "/api/v1/app/{app_id}")
.with_path_param("app_id", app_id)
.returns_nothing()
.execute(self.cfg)
.await
pub async fn delete(
&self,
app_id: String,
) -> Result<()> {
crate::request::Request::new(
http1::Method::DELETE,
"/api/v1/app/{app_id}",
)
.with_path_param(
"app_id", app_id,
)
.returns_nothing()
.execute(self.cfg)
.await
}

/// Partially update an application.
Expand All @@ -114,10 +169,15 @@ impl<'a> Application<'a> {
app_id: String,
application_patch: ApplicationPatch,
) -> Result<ApplicationOut> {
crate::request::Request::new(http1::Method::PATCH, "/api/v1/app/{app_id}")
.with_path_param("app_id", app_id)
.with_body_param(application_patch)
.execute(self.cfg)
.await
crate::request::Request::new(
http1::Method::PATCH,
"/api/v1/app/{app_id}",
)
.with_path_param(
"app_id", app_id,
)
.with_body_param(application_patch)
.execute(self.cfg)
.await
}
}
Loading
Loading