From f1dd24c0df880a46a7bfba7ac8685f7f4d3415d5 Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Wed, 11 Dec 2024 17:44:08 -0500 Subject: [PATCH] Add query parameter docs and reorder some things Adjust some field lists and impl block items to match the order in the spec. --- rust/src/api/application.rs | 28 ++++++++++++-------- rust/src/api/endpoint.rs | 52 +++++++++++++++++++++++-------------- rust/src/api/event_type.rs | 27 ++++++++++++++----- rust/src/api/integration.rs | 13 +++++++--- rust/src/api/message.rs | 13 +++++----- 5 files changed, 87 insertions(+), 46 deletions(-) diff --git a/rust/src/api/application.rs b/rust/src/api/application.rs index d8797dbb3..53e830d51 100644 --- a/rust/src/api/application.rs +++ b/rust/src/api/application.rs @@ -3,8 +3,13 @@ use crate::{apis::application_api, error::Result, models::*, Configuration}; #[derive(Default)] pub struct ApplicationListOptions { - pub iterator: Option, + /// Limit the number of returned items pub limit: Option, + + /// The iterator returned from a prior invocation + pub iterator: Option, + + /// The sorting order of the returned items pub order: Option, } @@ -22,15 +27,16 @@ impl<'a> Application<'a> { options: Option, ) -> Result { let ApplicationListOptions { - iterator, limit, + iterator, order, } = options.unwrap_or_default(); + application_api::v1_period_application_period_list( self.cfg, application_api::V1PeriodApplicationPeriodListParams { - iterator, limit, + iterator, order, }, ) @@ -94,6 +100,14 @@ impl<'a> Application<'a> { .await } + pub async fn delete(&self, app_id: String) -> Result<()> { + application_api::v1_period_application_period_delete( + self.cfg, + application_api::V1PeriodApplicationPeriodDeleteParams { app_id }, + ) + .await + } + pub async fn patch( &self, app_id: String, @@ -108,12 +122,4 @@ impl<'a> Application<'a> { ) .await } - - pub async fn delete(&self, app_id: String) -> Result<()> { - application_api::v1_period_application_period_delete( - self.cfg, - application_api::V1PeriodApplicationPeriodDeleteParams { app_id }, - ) - .await - } } diff --git a/rust/src/api/endpoint.rs b/rust/src/api/endpoint.rs index 4b7f36166..dce70f1bb 100644 --- a/rust/src/api/endpoint.rs +++ b/rust/src/api/endpoint.rs @@ -3,21 +3,33 @@ use crate::{apis::endpoint_api, error::Result, models::*, Configuration}; #[derive(Default)] pub struct EndpointListOptions { - pub iterator: Option, + /// Limit the number of returned items pub limit: Option, - pub order: Option, -} -pub struct Endpoint<'a> { - cfg: &'a Configuration, + /// The iterator returned from a prior invocation + pub iterator: Option, + + /// The sorting order of the returned items + pub order: Option, } #[derive(Default)] pub struct EndpointStatsOptions { + /// Filter the range to data starting from this date + /// + /// RFC3339 date string. pub since: Option, + + /// Filter the range to data ending by this date + /// + /// RFC3339 date string. pub until: Option, } +pub struct Endpoint<'a> { + cfg: &'a Configuration, +} + impl<'a> Endpoint<'a> { pub(super) fn new(cfg: &'a Configuration) -> Self { Self { cfg } @@ -29,17 +41,18 @@ impl<'a> Endpoint<'a> { options: Option, ) -> Result { let EndpointListOptions { - iterator, limit, + iterator, order, } = options.unwrap_or_default(); + endpoint_api::v1_period_endpoint_period_list( self.cfg, endpoint_api::V1PeriodEndpointPeriodListParams { app_id, - order, - iterator, limit, + iterator, + order, }, ) .await @@ -52,6 +65,7 @@ impl<'a> Endpoint<'a> { options: Option, ) -> Result { let PostOptions { idempotency_key } = options.unwrap_or_default(); + endpoint_api::v1_period_endpoint_period_create( self.cfg, endpoint_api::V1PeriodEndpointPeriodCreateParams { @@ -91,6 +105,17 @@ impl<'a> Endpoint<'a> { .await } + pub async fn delete(&self, app_id: String, endpoint_id: String) -> Result<()> { + endpoint_api::v1_period_endpoint_period_delete( + self.cfg, + endpoint_api::V1PeriodEndpointPeriodDeleteParams { + app_id, + endpoint_id, + }, + ) + .await + } + pub async fn patch( &self, app_id: String, @@ -108,17 +133,6 @@ impl<'a> Endpoint<'a> { .await } - pub async fn delete(&self, app_id: String, endpoint_id: String) -> Result<()> { - endpoint_api::v1_period_endpoint_period_delete( - self.cfg, - endpoint_api::V1PeriodEndpointPeriodDeleteParams { - app_id, - endpoint_id, - }, - ) - .await - } - pub async fn get_secret( &self, app_id: String, diff --git a/rust/src/api/event_type.rs b/rust/src/api/event_type.rs index d5acebd3f..25b3581fc 100644 --- a/rust/src/api/event_type.rs +++ b/rust/src/api/event_type.rs @@ -3,10 +3,19 @@ use crate::{apis::event_type_api, error::Result, models::*, Configuration}; #[derive(Default)] pub struct EventTypeListOptions { - pub iterator: Option, + /// Limit the number of returned items pub limit: Option, - pub with_content: Option, + + /// The iterator returned from a prior invocation + pub iterator: Option, + + /// When `true` archived (deleted but not expunged) items are included in + /// the response pub include_archived: Option, + + /// When `true` the full item (including the schema) is included in the + /// response + pub with_content: Option, } pub struct EventType<'a> { @@ -23,19 +32,21 @@ impl<'a> EventType<'a> { options: Option, ) -> Result { let EventTypeListOptions { - iterator, limit, - with_content, + iterator, include_archived, + with_content, } = options.unwrap_or_default(); + event_type_api::v1_period_event_type_period_list( self.cfg, event_type_api::V1PeriodEventTypePeriodListParams { - iterator, limit, - with_content, - include_archived, + iterator, + // FIXME: not included for backwards compatibility, for now order: None, + include_archived, + with_content, }, ) .await @@ -47,6 +58,7 @@ impl<'a> EventType<'a> { options: Option, ) -> Result { let PostOptions { idempotency_key } = options.unwrap_or_default(); + event_type_api::v1_period_event_type_period_create( self.cfg, event_type_api::V1PeriodEventTypePeriodCreateParams { @@ -112,6 +124,7 @@ impl<'a> EventType<'a> { options: Option, ) -> Result { let PostOptions { idempotency_key } = options.unwrap_or_default(); + event_type_api::v1_period_event_type_period_import_openapi( self.cfg, event_type_api::V1PeriodEventTypePeriodImportOpenapiParams { diff --git a/rust/src/api/integration.rs b/rust/src/api/integration.rs index de453f621..87bec12ce 100644 --- a/rust/src/api/integration.rs +++ b/rust/src/api/integration.rs @@ -3,8 +3,13 @@ use crate::{apis::integration_api, error::Result, models::*, Configuration}; #[derive(Default)] pub struct IntegrationListOptions { - pub iterator: Option, + /// Limit the number of returned items pub limit: Option, + + /// The iterator returned from a prior invocation + pub iterator: Option, + + /// The sorting order of the returned items pub order: Option, } @@ -23,16 +28,17 @@ impl<'a> Integration<'a> { options: Option, ) -> Result { let IntegrationListOptions { - iterator, limit, + iterator, order, } = options.unwrap_or_default(); + integration_api::v1_period_integration_period_list( self.cfg, integration_api::V1PeriodIntegrationPeriodListParams { app_id, - iterator, limit, + iterator, order, }, ) @@ -46,6 +52,7 @@ impl<'a> Integration<'a> { options: Option, ) -> Result { let PostOptions { idempotency_key } = options.unwrap_or_default(); + integration_api::v1_period_integration_period_create( self.cfg, integration_api::V1PeriodIntegrationPeriodCreateParams { diff --git a/rust/src/api/message.rs b/rust/src/api/message.rs index 29ac7b9e4..df4e6c1b2 100644 --- a/rust/src/api/message.rs +++ b/rust/src/api/message.rs @@ -31,27 +31,28 @@ impl<'a> Message<'a> { options: Option, ) -> Result { let MessageListOptions { - iterator, limit, - event_types, + iterator, + channel, before, after, - channel, with_content, tag, + event_types, } = options.unwrap_or_default(); + message_api::v1_period_message_period_list( self.cfg, message_api::V1PeriodMessagePeriodListParams { app_id, - iterator, limit, - event_types, + iterator, + channel, before, after, - channel, with_content, tag, + event_types, }, ) .await