Skip to content

Commit

Permalink
rust: Regenerate model files (#1697)
Browse files Browse the repository at this point in the history
Follow-up to #1695, last prep
PR for including the new openapi-codegen in CI.
  • Loading branch information
svix-jplatte authored Feb 4, 2025
2 parents 3cee9f0 + 0932f59 commit 1c2b795
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 43 deletions.
2 changes: 1 addition & 1 deletion rust/src/models/background_task_out.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// this file is @generated (with minor manual edits)
// this file is @generated
use serde::{Deserialize, Serialize};

use super::{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// this file is @generated
use serde::{Deserialize, Serialize};

use super::transformation_template_kind::TransformationTemplateKind;
use super::connector_kind::ConnectorKind;

#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
pub struct TemplateIn {
pub struct ConnectorIn {
#[serde(skip_serializing_if = "Option::is_none")]
pub description: Option<String>,

Expand All @@ -24,7 +24,7 @@ pub struct TemplateIn {
pub instructions_link: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
pub kind: Option<TransformationTemplateKind>,
pub kind: Option<ConnectorKind>,

pub logo: String,

Expand All @@ -33,7 +33,7 @@ pub struct TemplateIn {
pub transformation: String,
}

impl TemplateIn {
impl ConnectorIn {
pub fn new(logo: String, name: String, transformation: String) -> Self {
Self {
description: None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
#[derive(
Clone, Copy, Debug, Default, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize,
)]
pub enum TransformationTemplateKind {
pub enum ConnectorKind {
#[default]
#[serde(rename = "Custom")]
Custom,
Expand Down Expand Up @@ -34,7 +34,7 @@ pub enum TransformationTemplateKind {
Zapier,
}

impl fmt::Display for TransformationTemplateKind {
impl fmt::Display for ConnectorKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let value = match self {
Self::Custom => "Custom",
Expand Down
11 changes: 5 additions & 6 deletions rust/src/models/environment_in.rs
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
// this file is @generated
use serde::{Deserialize, Serialize};

use super::{event_type_in::EventTypeIn, template_in::TemplateIn};
use super::{connector_in::ConnectorIn, event_type_in::EventTypeIn};

#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
pub struct EnvironmentIn {
#[serde(skip_serializing_if = "Option::is_none")]
pub connectors: Option<Vec<ConnectorIn>>,

#[serde(rename = "eventTypes")]
#[serde(skip_serializing_if = "Option::is_none")]
pub event_types: Option<Vec<EventTypeIn>>,

#[serde(skip_serializing_if = "Option::is_none")]
pub settings: Option<serde_json::Value>,

#[serde(rename = "transformationTemplates")]
#[serde(skip_serializing_if = "Option::is_none")]
pub transformation_templates: Option<Vec<TemplateIn>>,
}

impl EnvironmentIn {
pub fn new() -> Self {
Self {
connectors: None,
event_types: None,
settings: None,
transformation_templates: None,
}
}
}
10 changes: 9 additions & 1 deletion rust/src/models/integration_in.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
pub struct IntegrationIn {
/// The set of feature flags the integration will have access to.
#[serde(rename = "featureFlags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub feature_flags: Option<Vec<String>>,

pub name: String,
}

impl IntegrationIn {
pub fn new(name: String) -> Self {
Self { name }
Self {
feature_flags: None,
name,
}
}
}
6 changes: 6 additions & 0 deletions rust/src/models/integration_out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ pub struct IntegrationOut {
#[serde(rename = "createdAt")]
pub created_at: String,

/// The set of feature flags the integration has access to.
#[serde(rename = "featureFlags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub feature_flags: Option<Vec<String>>,

/// The integ's ID
pub id: String,

Expand All @@ -19,6 +24,7 @@ impl IntegrationOut {
pub fn new(created_at: String, id: String, name: String, updated_at: String) -> Self {
Self {
created_at,
feature_flags: None,
id,
name,
updated_at,
Expand Down
10 changes: 9 additions & 1 deletion rust/src/models/integration_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
pub struct IntegrationUpdate {
/// The set of feature flags the integration will have access to.
#[serde(rename = "featureFlags")]
#[serde(skip_serializing_if = "Option::is_none")]
pub feature_flags: Option<Vec<String>>,

pub name: String,
}

impl IntegrationUpdate {
pub fn new(name: String) -> Self {
Self { name }
Self {
feature_flags: None,
name,
}
}
}
6 changes: 1 addition & 5 deletions rust/src/models/message_attempt_trigger_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ pub enum MessageAttemptTriggerType {

impl fmt::Display for MessageAttemptTriggerType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let value = match self {
Self::Scheduled => "0",
Self::Manual => "1",
};
f.write_str(value)
write!(f, "{}", *self as i64)
}
}
8 changes: 1 addition & 7 deletions rust/src/models/message_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ pub enum MessageStatus {

impl fmt::Display for MessageStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let value = match self {
Self::Success => "0",
Self::Pending => "1",
Self::Fail => "2",
Self::Sending => "3",
};
f.write_str(value)
write!(f, "{}", *self as i64)
}
}
8 changes: 4 additions & 4 deletions rust/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub mod application_token_expire_in;
pub mod background_task_out;
pub mod background_task_status;
pub mod background_task_type;
pub mod connector_in;
pub mod connector_kind;
pub mod dashboard_access_out;
pub mod endpoint_headers_in;
pub mod endpoint_headers_out;
Expand Down Expand Up @@ -75,9 +77,7 @@ pub mod recover_out;
pub mod replay_in;
pub mod replay_out;
pub mod status_code_class;
pub mod template_in;
pub mod template_out;
pub mod transformation_template_kind;
pub mod validation_error;

#[rustfmt::skip]
Expand All @@ -94,6 +94,8 @@ pub use self::{
background_task_out::BackgroundTaskOut,
background_task_status::BackgroundTaskStatus,
background_task_type::BackgroundTaskType,
connector_in::ConnectorIn,
connector_kind::ConnectorKind,
dashboard_access_out::DashboardAccessOut,
endpoint_headers_in::EndpointHeadersIn,
endpoint_headers_out::EndpointHeadersOut,
Expand Down Expand Up @@ -157,8 +159,6 @@ pub use self::{
replay_in::ReplayIn,
replay_out::ReplayOut,
status_code_class::StatusCodeClass,
template_in::TemplateIn,
template_out::TemplateOut,
transformation_template_kind::TransformationTemplateKind,
validation_error::ValidationError,
};
10 changes: 1 addition & 9 deletions rust/src/models/status_code_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ pub enum StatusCodeClass {

impl fmt::Display for StatusCodeClass {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let value = match self {
Self::CodeNone => "0",
Self::Code1xx => "100",
Self::Code2xx => "200",
Self::Code3xx => "300",
Self::Code4xx => "400",
Self::Code5xx => "500",
};
f.write_str(value)
write!(f, "{}", *self as i64)
}
}
6 changes: 3 additions & 3 deletions rust/src/models/template_out.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// this file is @generated
use serde::{Deserialize, Serialize};

use super::transformation_template_kind::TransformationTemplateKind;
use super::connector_kind::ConnectorKind;

#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)]
pub struct TemplateOut {
Expand All @@ -26,7 +26,7 @@ pub struct TemplateOut {
#[serde(skip_serializing_if = "Option::is_none")]
pub instructions_link: Option<String>,

pub kind: TransformationTemplateKind,
pub kind: ConnectorKind,

pub logo: String,

Expand All @@ -47,7 +47,7 @@ impl TemplateOut {
description: String,
id: String,
instructions: String,
kind: TransformationTemplateKind,
kind: ConnectorKind,
logo: String,
name: String,
org_id: String,
Expand Down

0 comments on commit 1c2b795

Please sign in to comment.