use crate::client::Client;
#[allow(unused_imports)]
use crate::enums::*;
use crate::error::Error;
#[allow(unused_imports)]
use crate::models::*;
#[allow(unused_imports)]
use serde::Serialize;
pub struct WebhookChannelsApi<'a> {
pub(crate) client: &'a Client,
}
#[derive(Debug, Clone, Serialize)]
pub struct ListParams {
#[serde(skip_serializing_if = "Option::is_none")]
pub page: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub limit: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
impl Default for ListParams {
#[allow(deprecated)]
fn default() -> Self {
Self {
page: Some(1),
limit: Some(15),
x_store: Default::default(),
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct CreateParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkCreateWebhookChannelRequestApplicationJson,
}
impl CreateParams {
#[allow(deprecated)]
pub fn new(body: SdkCreateWebhookChannelRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct SearchParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkSearchWebhookChannelsRequestApplicationJson,
}
impl SearchParams {
#[allow(deprecated)]
pub fn new(body: SdkSearchWebhookChannelsRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct RotateParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkRotateWebhookSigningSecretRequestApplicationJson,
}
impl RotateParams {
#[allow(deprecated)]
pub fn new(body: SdkRotateWebhookSigningSecretRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct GetParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct ReplaceParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkReplaceWebhookChannelRequestApplicationJson,
}
impl ReplaceParams {
#[allow(deprecated)]
pub fn new(body: SdkReplaceWebhookChannelRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Serialize)]
pub struct UpdateParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkUpdateWebhookChannelRequestApplicationJson,
}
impl UpdateParams {
#[allow(deprecated)]
pub fn new(body: SdkUpdateWebhookChannelRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
#[derive(Debug, Clone, Default, Serialize)]
pub struct DeleteParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
}
#[derive(Debug, Clone, Serialize)]
pub struct SendParams {
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "X-STORE")]
pub x_store: Option<String>,
#[serde(skip)]
pub body: SdkSendTestWebhookRequestApplicationJson,
}
impl SendParams {
#[allow(deprecated)]
pub fn new(body: SdkSendTestWebhookRequestApplicationJson) -> Self {
Self {
x_store: Default::default(),
body,
}
}
}
impl<'a> WebhookChannelsApi<'a> {
pub async fn list(
&self,
params: ListParams,
) -> Result<SdkListWebhookChannelsResponseValue200ApplicationJson, Error> {
self.list_with_options(params, None).await
}
pub async fn list_with_options(
&self,
params: ListParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkListWebhookChannelsResponseValue200ApplicationJson, Error> {
self.list_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn list_raw(
&self,
params: ListParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkListWebhookChannelsResponseValue200ApplicationJson>, Error>
{
let path = "/v2/webhook-channels".to_string();
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("listWebhookChannels".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/webhook-channels",
)
.await
}
pub async fn create(
&self,
params: CreateParams,
) -> Result<SdkCreateWebhookChannelResponseValue201ApplicationJson, Error> {
self.create_with_options(params, None).await
}
pub async fn create_with_options(
&self,
params: CreateParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkCreateWebhookChannelResponseValue201ApplicationJson, Error> {
self.create_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn create_raw(
&self,
params: CreateParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkCreateWebhookChannelResponseValue201ApplicationJson>, Error>
{
let path = "/v2/webhook-channels".to_string();
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("createWebhookChannel".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"POST /v2/webhook-channels",
)
.await
}
pub async fn search(
&self,
params: SearchParams,
) -> Result<SdkSearchWebhookChannelsResponseValue200ApplicationJson, Error> {
self.search_with_options(params, None).await
}
pub async fn search_with_options(
&self,
params: SearchParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkSearchWebhookChannelsResponseValue200ApplicationJson, Error> {
self.search_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn search_raw(
&self,
params: SearchParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkSearchWebhookChannelsResponseValue200ApplicationJson>, Error>
{
let path = "/v2/webhook-channels/search".to_string();
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("searchWebhookChannels".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"POST /v2/webhook-channels/search",
)
.await
}
pub async fn rotate(
&self,
params: RotateParams,
) -> Result<SdkRotateWebhookSigningSecretResponseValue200ApplicationJson, Error> {
self.rotate_with_options(params, None).await
}
pub async fn rotate_with_options(
&self,
params: RotateParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkRotateWebhookSigningSecretResponseValue200ApplicationJson, Error> {
self.rotate_raw(params, options)
.await
.map(|response| response.data)
}
pub async fn rotate_raw(
&self,
params: RotateParams,
options: Option<&crate::RequestOptions>,
) -> Result<
crate::RawResponse<SdkRotateWebhookSigningSecretResponseValue200ApplicationJson>,
Error,
> {
let path = "/v2/webhook-channels/signing-secret".to_string();
let method = http::Method::PUT;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("rotateWebhookSigningSecret".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PUT /v2/webhook-channels/signing-secret",
)
.await
}
pub async fn get(
&self,
webhook_channel: &str,
params: GetParams,
) -> Result<SdkGetWebhookChannelResponseValue200ApplicationJson, Error> {
self.get_with_options(webhook_channel, params, None).await
}
pub async fn get_with_options(
&self,
webhook_channel: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkGetWebhookChannelResponseValue200ApplicationJson, Error> {
self.get_raw(webhook_channel, params, options)
.await
.map(|response| response.data)
}
pub async fn get_raw(
&self,
webhook_channel: &str,
params: GetParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkGetWebhookChannelResponseValue200ApplicationJson>, Error>
{
let webhook_channel = crate::client::path_segment(webhook_channel);
let path = format!("/v2/webhook-channels/{webhook_channel}");
let method = http::Method::GET;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("getWebhookChannel".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"GET /v2/webhook-channels/{webhookChannel}",
)
.await
}
pub async fn replace(
&self,
webhook_channel: &str,
params: ReplaceParams,
) -> Result<SdkReplaceWebhookChannelResponseValue200ApplicationJson, Error> {
self.replace_with_options(webhook_channel, params, None)
.await
}
pub async fn replace_with_options(
&self,
webhook_channel: &str,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkReplaceWebhookChannelResponseValue200ApplicationJson, Error> {
self.replace_raw(webhook_channel, params, options)
.await
.map(|response| response.data)
}
pub async fn replace_raw(
&self,
webhook_channel: &str,
params: ReplaceParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkReplaceWebhookChannelResponseValue200ApplicationJson>, Error>
{
let webhook_channel = crate::client::path_segment(webhook_channel);
let path = format!("/v2/webhook-channels/{webhook_channel}");
let method = http::Method::PUT;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("replaceWebhookChannel".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PUT /v2/webhook-channels/{webhookChannel}",
)
.await
}
pub async fn update(
&self,
webhook_channel: &str,
params: UpdateParams,
) -> Result<SdkUpdateWebhookChannelResponseValue200ApplicationJson, Error> {
self.update_with_options(webhook_channel, params, None)
.await
}
pub async fn update_with_options(
&self,
webhook_channel: &str,
params: UpdateParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkUpdateWebhookChannelResponseValue200ApplicationJson, Error> {
self.update_raw(webhook_channel, params, options)
.await
.map(|response| response.data)
}
pub async fn update_raw(
&self,
webhook_channel: &str,
params: UpdateParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkUpdateWebhookChannelResponseValue200ApplicationJson>, Error>
{
let webhook_channel = crate::client::path_segment(webhook_channel);
let path = format!("/v2/webhook-channels/{webhook_channel}");
let method = http::Method::PATCH;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("updateWebhookChannel".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"PATCH /v2/webhook-channels/{webhookChannel}",
)
.await
}
pub async fn delete(
&self,
webhook_channel: &str,
params: DeleteParams,
) -> Result<SdkDeleteWebhookChannelResponseValue200ApplicationJson, Error> {
self.delete_with_options(webhook_channel, params, None)
.await
}
pub async fn delete_with_options(
&self,
webhook_channel: &str,
params: DeleteParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkDeleteWebhookChannelResponseValue200ApplicationJson, Error> {
self.delete_raw(webhook_channel, params, options)
.await
.map(|response| response.data)
}
pub async fn delete_raw(
&self,
webhook_channel: &str,
params: DeleteParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkDeleteWebhookChannelResponseValue200ApplicationJson>, Error>
{
let webhook_channel = crate::client::path_segment(webhook_channel);
let path = format!("/v2/webhook-channels/{webhook_channel}");
let method = http::Method::DELETE;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("deleteWebhookChannel".to_string());
let options = Some(&merged);
self.client
.request_with_query_schema_opts_raw(
method,
&path,
¶ms,
options,
"DELETE /v2/webhook-channels/{webhookChannel}",
)
.await
}
pub async fn send(
&self,
webhook_channel: &str,
params: SendParams,
) -> Result<SdkSendTestWebhookResponseValue200ApplicationJson, Error> {
self.send_with_options(webhook_channel, params, None).await
}
pub async fn send_with_options(
&self,
webhook_channel: &str,
params: SendParams,
options: Option<&crate::RequestOptions>,
) -> Result<SdkSendTestWebhookResponseValue200ApplicationJson, Error> {
self.send_raw(webhook_channel, params, options)
.await
.map(|response| response.data)
}
pub async fn send_raw(
&self,
webhook_channel: &str,
params: SendParams,
options: Option<&crate::RequestOptions>,
) -> Result<crate::RawResponse<SdkSendTestWebhookResponseValue200ApplicationJson>, Error> {
let webhook_channel = crate::client::path_segment(webhook_channel);
let path = format!("/v2/webhook-channels/{webhook_channel}/test");
let method = http::Method::POST;
let mut merged = options.cloned().unwrap_or_default();
merged.idempotency_supported = false;
merged.operation_id = Some("sendTestWebhook".to_string());
let options = Some(&merged);
self.client
.request_with_body_schema_opts_raw(
method,
&path,
¶ms,
Some(¶ms.body),
options,
"POST /v2/webhook-channels/{webhookChannel}/test",
)
.await
}
}