Skip to content

fix: map reserved word _typetype_ #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ for spec_file in "$@"; do

./openapi-generator-cli generate \
--generator-name rust \
--reserved-words-mappings 'type=type_' \
--input-spec "$spec_file" \
--ignore-file-override '.openapi-generator-ignore' \
--library 'reqwest' \
Expand Down
4 changes: 2 additions & 2 deletions twilio-oai-api-v2010/src/models/api_v2010_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct ApiV2010Account {
pub subresource_uris: Option<serde_json::Value>,
/// The type of this account
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<Type>,
pub type_: Option<Type>,
/// The URI for this resource, relative to `https://api.twilio.com`
#[serde(rename = "uri", skip_serializing_if = "Option::is_none")]
pub uri: Option<String>,
Expand All @@ -53,7 +53,7 @@ impl ApiV2010Account {
sid: None,
status: None,
subresource_uris: None,
_type: None,
type_: None,
uri: None,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct ApiV2010AccountRecordingRecordingTranscription {
pub transcription_text: Option<String>,
/// The transcription type
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<String>,
pub type_: Option<String>,
/// The URI of the resource, relative to `https://api.twilio.com`
#[serde(rename = "uri", skip_serializing_if = "Option::is_none")]
pub uri: Option<String>,
Expand All @@ -65,7 +65,7 @@ impl ApiV2010AccountRecordingRecordingTranscription {
sid: None,
status: None,
transcription_text: None,
_type: None,
type_: None,
uri: None,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct ApiV2010AccountTranscription {
pub transcription_text: Option<String>,
/// The transcription type
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<String>,
pub type_: Option<String>,
/// The URI of the resource, relative to `https://api.twilio.com`
#[serde(rename = "uri", skip_serializing_if = "Option::is_none")]
pub uri: Option<String>,
Expand All @@ -65,7 +65,7 @@ impl ApiV2010AccountTranscription {
sid: None,
status: None,
transcription_text: None,
_type: None,
type_: None,
uri: None,
}
}
Expand Down
24 changes: 12 additions & 12 deletions twilio-oai-chat-v1/src/apis/default_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct CreateChannelParams {
/// A descriptive string that you create to describe the new resource. It can be up to 64 characters long.
pub friendly_name: Option<String>,
/// The visibility of the channel. Can be: `public` or `private` and defaults to `public`.
pub _type: Option<String>,
pub type_: Option<String>,
/// An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service.
pub unique_name: Option<String>,
}
Expand All @@ -32,7 +32,7 @@ pub struct CreateChannelParams {
#[derive(Clone, Debug, Default)]
pub struct CreateCredentialParams {
/// The type of push-notification service the credential is for. Can be: `gcm`, `fcm`, or `apn`.
pub _type: String,
pub type_: String,
/// [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential.
pub api_key: Option<String>,
/// [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV.....A== -----END CERTIFICATE-----`
Expand Down Expand Up @@ -98,7 +98,7 @@ pub struct CreateRoleParams {
/// A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type` and are described in the documentation.
pub permission: Vec<String>,
/// The type of role. Can be: `channel` for [Channel](https://www.twilio.com/docs/chat/api/channels) roles or `deployment` for [Service](https://www.twilio.com/docs/chat/api/services) roles.
pub _type: String,
pub type_: String,
}

/// struct for passing parameters to the method [`create_service`]
Expand Down Expand Up @@ -277,7 +277,7 @@ pub struct ListChannelParams {
/// The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) to read the resources from.
pub service_sid: String,
/// The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`.
pub _type: Option<Vec<String>>,
pub type_: Option<Vec<String>>,
/// How many resources to return in each list page. The default is 50, and the maximum is 1000.
pub page_size: Option<i32>,
}
Expand Down Expand Up @@ -1179,7 +1179,7 @@ pub async fn create_channel(
let service_sid = params.service_sid;
let attributes = params.attributes;
let friendly_name = params.friendly_name;
let _type = params._type;
let type_ = params.type_;
let unique_name = params.unique_name;

let local_var_client = &local_var_configuration.client;
Expand Down Expand Up @@ -1209,7 +1209,7 @@ pub async fn create_channel(
if let Some(local_var_param_value) = friendly_name {
local_var_form_params.insert("FriendlyName", local_var_param_value.to_string());
}
if let Some(local_var_param_value) = _type {
if let Some(local_var_param_value) = type_ {
local_var_form_params.insert("Type", local_var_param_value.to_string());
}
if let Some(local_var_param_value) = unique_name {
Expand Down Expand Up @@ -1251,7 +1251,7 @@ pub async fn create_credential(
let local_var_configuration = configuration;

// unbox the parameters
let _type = params._type;
let type_ = params.type_;
let api_key = params.api_key;
let certificate = params.certificate;
let friendly_name = params.friendly_name;
Expand Down Expand Up @@ -1294,7 +1294,7 @@ pub async fn create_credential(
if let Some(local_var_param_value) = secret {
local_var_form_params.insert("Secret", local_var_param_value.to_string());
}
local_var_form_params.insert("Type", _type.to_string());
local_var_form_params.insert("Type", type_.to_string());
local_var_req_builder = local_var_req_builder.form(&local_var_form_params);

let local_var_req = local_var_req_builder.build()?;
Expand Down Expand Up @@ -1539,7 +1539,7 @@ pub async fn create_role(
let service_sid = params.service_sid;
let friendly_name = params.friendly_name;
let permission = params.permission;
let _type = params._type;
let type_ = params.type_;

let local_var_client = &local_var_configuration.client;

Expand Down Expand Up @@ -1572,7 +1572,7 @@ pub async fn create_role(
.join(",")
.to_string(),
);
local_var_form_params.insert("Type", _type.to_string());
local_var_form_params.insert("Type", type_.to_string());
local_var_req_builder = local_var_req_builder.form(&local_var_form_params);

let local_var_req = local_var_req_builder.build()?;
Expand Down Expand Up @@ -2687,7 +2687,7 @@ pub async fn list_channel(

// unbox the parameters
let service_sid = params.service_sid;
let _type = params._type;
let type_ = params.type_;
let page_size = params.page_size;

let local_var_client = &local_var_configuration.client;
Expand All @@ -2700,7 +2700,7 @@ pub async fn list_channel(
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) = _type {
if let Some(ref local_var_str) = type_ {
local_var_req_builder = local_var_req_builder.query(&[(
"Type",
&local_var_str
Expand Down
4 changes: 2 additions & 2 deletions twilio-oai-chat-v1/src/models/chat_v1_credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct ChatV1Credential {
pub sid: Option<String>,
/// The type of push-notification service the credential is for
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<Type>,
pub type_: Option<Type>,
/// The absolute URL of the Credential resource
#[serde(rename = "url", skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
Expand All @@ -45,7 +45,7 @@ impl ChatV1Credential {
friendly_name: None,
sandbox: None,
sid: None,
_type: None,
type_: None,
url: None,
}
}
Expand Down
4 changes: 2 additions & 2 deletions twilio-oai-chat-v1/src/models/chat_v1_service_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct ChatV1ServiceChannel {
pub sid: Option<String>,
/// The visibility of the channel. Can be: `public` or `private`
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<Type>,
pub type_: Option<Type>,
/// An application-defined string that uniquely identifies the resource
#[serde(rename = "unique_name", skip_serializing_if = "Option::is_none")]
pub unique_name: Option<String>,
Expand All @@ -68,7 +68,7 @@ impl ChatV1ServiceChannel {
messages_count: None,
service_sid: None,
sid: None,
_type: None,
type_: None,
unique_name: None,
url: None,
}
Expand Down
4 changes: 2 additions & 2 deletions twilio-oai-chat-v1/src/models/chat_v1_service_role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct ChatV1ServiceRole {
pub sid: Option<String>,
/// The type of role
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<Type>,
pub type_: Option<Type>,
/// The absolute URL of the Role resource
#[serde(rename = "url", skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
Expand All @@ -49,7 +49,7 @@ impl ChatV1ServiceRole {
permissions: None,
service_sid: None,
sid: None,
_type: None,
type_: None,
url: None,
}
}
Expand Down
30 changes: 15 additions & 15 deletions twilio-oai-chat-v2/src/apis/default_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct CreateChannelParams {
/// A descriptive string that you create to describe the new resource. It can be up to 64 characters long.
pub friendly_name: Option<String>,
/// The visibility of the channel. Can be: `public` or `private` and defaults to `public`.
pub _type: Option<String>,
pub type_: Option<String>,
/// An application-defined string that uniquely identifies the resource. It can be used to address the resource in place of the Channel resource's `sid` in the URL. This value must be 64 characters or less in length and be unique within the Service.
pub unique_name: Option<String>,
}
Expand All @@ -44,7 +44,7 @@ pub struct CreateChannelWebhookParams {
/// The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the new Channel Webhook resource belongs to. This value can be the Channel resource's `sid` or `unique_name`.
pub channel_sid: String,
/// The type of webhook. Can be: `webhook`, `studio`, or `trigger`.
pub _type: String,
pub type_: String,
/// The events that cause us to call the Channel Webhook. Used when `type` is `webhook`. This parameter takes only one event. To specify more than one event, repeat this parameter for each event. For the list of possible events, see [Webhook Event Triggers](https://www.twilio.com/docs/chat/webhook-events#webhook-event-trigger).
pub configuration_filters: Option<Vec<String>>,
/// The SID of the Studio [Flow](https://www.twilio.com/docs/studio/rest-api/flow) to call when an event in `configuration.filters` occurs. Used only when `type` is `studio`.
Expand All @@ -63,7 +63,7 @@ pub struct CreateChannelWebhookParams {
#[derive(Clone, Debug, Default)]
pub struct CreateCredentialParams {
/// The type of push-notification service the credential is for. Can be: `gcm`, `fcm`, or `apn`.
pub _type: String,
pub type_: String,
/// [GCM only] The API key for the project that was obtained from the Google Developer console for your GCM Service application credential.
pub api_key: Option<String>,
/// [APN only] The URL encoded representation of the certificate. For example, `-----BEGIN CERTIFICATE----- MIIFnTCCBIWgAwIBAgIIAjy9H849+E8wDQYJKoZIhvcNAQEF.....A== -----END CERTIFICATE-----`
Expand Down Expand Up @@ -151,7 +151,7 @@ pub struct CreateRoleParams {
/// A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`.
pub permission: Vec<String>,
/// The type of role. Can be: `channel` for [Channel](https://www.twilio.com/docs/chat/channels) roles or `deployment` for [Service](https://www.twilio.com/docs/chat/rest/service-resource) roles.
pub _type: String,
pub type_: String,
}

/// struct for passing parameters to the method [`create_service`]
Expand Down Expand Up @@ -435,7 +435,7 @@ pub struct ListChannelParams {
/// The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the Channel resources from.
pub service_sid: String,
/// The visibility of the Channels to read. Can be: `public` or `private` and defaults to `public`.
pub _type: Option<Vec<String>>,
pub type_: Option<Vec<String>>,
/// How many resources to return in each list page. The default is 50, and the maximum is 1000.
pub page_size: Option<i32>,
}
Expand Down Expand Up @@ -1599,7 +1599,7 @@ pub async fn create_channel(
let date_created = params.date_created;
let date_updated = params.date_updated;
let friendly_name = params.friendly_name;
let _type = params._type;
let type_ = params.type_;
let unique_name = params.unique_name;

let local_var_client = &local_var_configuration.client;
Expand Down Expand Up @@ -1644,7 +1644,7 @@ pub async fn create_channel(
if let Some(local_var_param_value) = friendly_name {
local_var_form_params.insert("FriendlyName", local_var_param_value.to_string());
}
if let Some(local_var_param_value) = _type {
if let Some(local_var_param_value) = type_ {
local_var_form_params.insert("Type", local_var_param_value.to_string());
}
if let Some(local_var_param_value) = unique_name {
Expand Down Expand Up @@ -1688,7 +1688,7 @@ pub async fn create_channel_webhook(
// unbox the parameters
let service_sid = params.service_sid;
let channel_sid = params.channel_sid;
let _type = params._type;
let type_ = params.type_;
let configuration_filters = params.configuration_filters;
let configuration_flow_sid = params.configuration_flow_sid;
let configuration_method = params.configuration_method;
Expand Down Expand Up @@ -1755,7 +1755,7 @@ pub async fn create_channel_webhook(
if let Some(local_var_param_value) = configuration_url {
local_var_form_params.insert("Configuration.Url", local_var_param_value.to_string());
}
local_var_form_params.insert("Type", _type.to_string());
local_var_form_params.insert("Type", type_.to_string());
local_var_req_builder = local_var_req_builder.form(&local_var_form_params);

let local_var_req = local_var_req_builder.build()?;
Expand Down Expand Up @@ -1792,7 +1792,7 @@ pub async fn create_credential(
let local_var_configuration = configuration;

// unbox the parameters
let _type = params._type;
let type_ = params.type_;
let api_key = params.api_key;
let certificate = params.certificate;
let friendly_name = params.friendly_name;
Expand Down Expand Up @@ -1835,7 +1835,7 @@ pub async fn create_credential(
if let Some(local_var_param_value) = secret {
local_var_form_params.insert("Secret", local_var_param_value.to_string());
}
local_var_form_params.insert("Type", _type.to_string());
local_var_form_params.insert("Type", type_.to_string());
local_var_req_builder = local_var_req_builder.form(&local_var_form_params);

let local_var_req = local_var_req_builder.build()?;
Expand Down Expand Up @@ -2138,7 +2138,7 @@ pub async fn create_role(
let service_sid = params.service_sid;
let friendly_name = params.friendly_name;
let permission = params.permission;
let _type = params._type;
let type_ = params.type_;

let local_var_client = &local_var_configuration.client;

Expand Down Expand Up @@ -2171,7 +2171,7 @@ pub async fn create_role(
.join(",")
.to_string(),
);
local_var_form_params.insert("Type", _type.to_string());
local_var_form_params.insert("Type", type_.to_string());
local_var_req_builder = local_var_req_builder.form(&local_var_form_params);

let local_var_req = local_var_req_builder.build()?;
Expand Down Expand Up @@ -3885,7 +3885,7 @@ pub async fn list_channel(

// unbox the parameters
let service_sid = params.service_sid;
let _type = params._type;
let type_ = params.type_;
let page_size = params.page_size;

let local_var_client = &local_var_configuration.client;
Expand All @@ -3898,7 +3898,7 @@ pub async fn list_channel(
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) = _type {
if let Some(ref local_var_str) = type_ {
local_var_req_builder = local_var_req_builder.query(&[(
"Type",
&local_var_str
Expand Down
4 changes: 2 additions & 2 deletions twilio-oai-chat-v2/src/models/chat_v2_credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub struct ChatV2Credential {
pub sid: Option<String>,
/// The type of push-notification service the credential is for
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<Type>,
pub type_: Option<Type>,
/// The absolute URL of the Credential resource
#[serde(rename = "url", skip_serializing_if = "Option::is_none")]
pub url: Option<String>,
Expand All @@ -45,7 +45,7 @@ impl ChatV2Credential {
friendly_name: None,
sandbox: None,
sid: None,
_type: None,
type_: None,
url: None,
}
}
Expand Down
4 changes: 2 additions & 2 deletions twilio-oai-chat-v2/src/models/chat_v2_service_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub struct ChatV2ServiceChannel {
pub sid: Option<String>,
/// The visibility of the channel. Can be: `public` or `private`
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<Type>,
pub type_: Option<Type>,
/// An application-defined string that uniquely identifies the resource
#[serde(rename = "unique_name", skip_serializing_if = "Option::is_none")]
pub unique_name: Option<String>,
Expand All @@ -68,7 +68,7 @@ impl ChatV2ServiceChannel {
messages_count: None,
service_sid: None,
sid: None,
_type: None,
type_: None,
unique_name: None,
url: None,
}
Expand Down
Loading