diff --git a/docs/lib/utils/retryconfig.md b/docs/lib/utils/retryconfig.md new file mode 100644 index 00000000..08f95f45 --- /dev/null +++ b/docs/lib/utils/retryconfig.md @@ -0,0 +1,24 @@ +# RetryConfig + +Allows customizing the default retry configuration. It is only permitted in methods that accept retry policies. + +## Fields + +| Name | Type | Description | Example | +| ------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------ | ----------- | +| `strategy` | `"backoff" | "none"` | The retry strategy to use. | `"backoff"` | +| `backoff` | [BackoffStrategy](#backoffstrategy) | When strategy is "backoff", this configurates for the backoff parameters. | | +| `retryConnectionErrors` | `*boolean*` | When strategy is "backoff", this determines whether or not to retry on connection errors. | `true` | + +## BackoffStrategy + +The backoff strategy allows retrying a request with an exponential backoff between each retry. + +### Fields + +| Name | Type | Description | Example | +| ------------------ | ------------ | ----------------------------------------- | -------- | +| `initialInterval` | `*number*` | The initial interval in milliseconds. | `500` | +| `maxInterval` | `*number*` | The maximum interval in milliseconds. | `60000` | +| `exponent` | `*number*` | The exponent to use for the backoff. | `1.5` | +| `maxElapsedTime` | `*number*` | The maximum elapsed time in milliseconds. | `300000` | \ No newline at end of file diff --git a/docs/models/components/activitiesresponsedto.md b/docs/models/components/activitiesresponsedto.md new file mode 100644 index 00000000..c4fa33ec --- /dev/null +++ b/docs/models/components/activitiesresponsedto.md @@ -0,0 +1,25 @@ +# ActivitiesResponseDto + +## Example Usage + +```typescript +import { ActivitiesResponseDto } from "@novu/api/models/components"; + +let value: ActivitiesResponseDto = { + hasMore: false, + data: [ + "", + ], + pageSize: 9767.61, + page: 6048.46, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `hasMore` | *boolean* | :heavy_check_mark: | N/A | +| `data` | *string*[] | :heavy_check_mark: | N/A | +| `pageSize` | *number* | :heavy_check_mark: | N/A | +| `page` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/activitygraphstatesresponse.md b/docs/models/components/activitygraphstatesresponse.md new file mode 100644 index 00000000..2acbe744 --- /dev/null +++ b/docs/models/components/activitygraphstatesresponse.md @@ -0,0 +1,27 @@ +# ActivityGraphStatesResponse + +## Example Usage + +```typescript +import { ActivityGraphStatesResponse } from "@novu/api/models/components"; + +let value: ActivityGraphStatesResponse = { + id: "", + count: 2961.40, + templates: [ + "", + ], + channels: [ + "in_app", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | +| `count` | *number* | :heavy_check_mark: | N/A | +| `templates` | *string*[] | :heavy_check_mark: | N/A | +| `channels` | [components.Channels](../../models/components/channels.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/activitynotificationresponsedto.md b/docs/models/components/activitynotificationresponsedto.md new file mode 100644 index 00000000..65be8f43 --- /dev/null +++ b/docs/models/components/activitynotificationresponsedto.md @@ -0,0 +1,27 @@ +# ActivityNotificationResponseDto + +## Example Usage + +```typescript +import { ActivityNotificationResponseDto } from "@novu/api/models/components"; + +let value: ActivityNotificationResponseDto = { + environmentId: "", + organizationId: "", + transactionId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `transactionId` | *string* | :heavy_check_mark: | N/A | +| `createdAt` | *string* | :heavy_minus_sign: | N/A | +| `channels` | [components.ActivityNotificationResponseDtoChannels](../../models/components/activitynotificationresponsedtochannels.md) | :heavy_minus_sign: | N/A | +| `subscriber` | [components.ActivityNotificationSubscriberResponseDto](../../models/components/activitynotificationsubscriberresponsedto.md) | :heavy_minus_sign: | N/A | +| `template` | [components.ActivityNotificationTemplateResponseDto](../../models/components/activitynotificationtemplateresponsedto.md) | :heavy_minus_sign: | N/A | +| `jobs` | *string*[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/activitynotificationresponsedtochannels.md b/docs/models/components/activitynotificationresponsedtochannels.md new file mode 100644 index 00000000..452b1139 --- /dev/null +++ b/docs/models/components/activitynotificationresponsedtochannels.md @@ -0,0 +1,15 @@ +# ActivityNotificationResponseDtoChannels + +## Example Usage + +```typescript +import { ActivityNotificationResponseDtoChannels } from "@novu/api/models/components"; + +let value: ActivityNotificationResponseDtoChannels = "trigger"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" | "digest" | "trigger" | "delay" | "custom" +``` \ No newline at end of file diff --git a/docs/models/components/activitynotificationsubscriberresponsedto.md b/docs/models/components/activitynotificationsubscriberresponsedto.md new file mode 100644 index 00000000..f6fb409b --- /dev/null +++ b/docs/models/components/activitynotificationsubscriberresponsedto.md @@ -0,0 +1,21 @@ +# ActivityNotificationSubscriberResponseDto + +## Example Usage + +```typescript +import { ActivityNotificationSubscriberResponseDto } from "@novu/api/models/components"; + +let value: ActivityNotificationSubscriberResponseDto = { + id: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `firstName` | *string* | :heavy_minus_sign: | N/A | +| `id` | *string* | :heavy_check_mark: | N/A | +| `lastName` | *string* | :heavy_minus_sign: | N/A | +| `email` | *string* | :heavy_minus_sign: | N/A | +| `phone` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/activitynotificationtemplateresponsedto.md b/docs/models/components/activitynotificationtemplateresponsedto.md new file mode 100644 index 00000000..54054b48 --- /dev/null +++ b/docs/models/components/activitynotificationtemplateresponsedto.md @@ -0,0 +1,22 @@ +# ActivityNotificationTemplateResponseDto + +## Example Usage + +```typescript +import { ActivityNotificationTemplateResponseDto } from "@novu/api/models/components"; + +let value: ActivityNotificationTemplateResponseDto = { + name: "", + triggers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `triggers` | *string*[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/activitystatsresponsedto.md b/docs/models/components/activitystatsresponsedto.md new file mode 100644 index 00000000..46aee20a --- /dev/null +++ b/docs/models/components/activitystatsresponsedto.md @@ -0,0 +1,19 @@ +# ActivityStatsResponseDto + +## Example Usage + +```typescript +import { ActivityStatsResponseDto } from "@novu/api/models/components"; + +let value: ActivityStatsResponseDto = { + weeklySent: 391.88, + monthlySent: 2828.07, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `weeklySent` | *number* | :heavy_check_mark: | N/A | +| `monthlySent` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/actor.md b/docs/models/components/actor.md new file mode 100644 index 00000000..ea709b08 --- /dev/null +++ b/docs/models/components/actor.md @@ -0,0 +1,23 @@ +# Actor + +It is used to display the Avatar of the provided actor's subscriber id or actor object. + If a new actor object is provided, we will create a new subscriber in our system + + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `components.SubscriberPayloadDto` + +```typescript +const value: components.SubscriberPayloadDto = { + subscriberId: "", +}; +``` + diff --git a/docs/models/components/addsubscribersrequestdto.md b/docs/models/components/addsubscribersrequestdto.md new file mode 100644 index 00000000..983a3b5f --- /dev/null +++ b/docs/models/components/addsubscribersrequestdto.md @@ -0,0 +1,19 @@ +# AddSubscribersRequestDto + +## Example Usage + +```typescript +import { AddSubscribersRequestDto } from "@novu/api/models/components"; + +let value: AddSubscribersRequestDto = { + subscribers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------------------------------------- | +| `subscribers` | *string*[] | :heavy_check_mark: | List of subscriber identifiers that will be associated to the topic | \ No newline at end of file diff --git a/docs/models/components/apikey.md b/docs/models/components/apikey.md new file mode 100644 index 00000000..32d8641c --- /dev/null +++ b/docs/models/components/apikey.md @@ -0,0 +1,19 @@ +# ApiKey + +## Example Usage + +```typescript +import { ApiKey } from "@novu/api/models/components"; + +let value: ApiKey = { + key: "", + userId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `key` | *string* | :heavy_check_mark: | N/A | +| `userId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/backoffunit.md b/docs/models/components/backoffunit.md new file mode 100644 index 00000000..a7ea32ff --- /dev/null +++ b/docs/models/components/backoffunit.md @@ -0,0 +1,15 @@ +# BackoffUnit + +## Example Usage + +```typescript +import { BackoffUnit } from "@novu/api/models/components"; + +let value: BackoffUnit = "weeks"; +``` + +## Values + +```typescript +"seconds" | "minutes" | "hours" | "days" | "weeks" | "months" +``` \ No newline at end of file diff --git a/docs/models/components/bulksubscribercreatedto.md b/docs/models/components/bulksubscribercreatedto.md new file mode 100644 index 00000000..497e5fb5 --- /dev/null +++ b/docs/models/components/bulksubscribercreatedto.md @@ -0,0 +1,19 @@ +# BulkSubscriberCreateDto + +## Example Usage + +```typescript +import { BulkSubscriberCreateDto } from "@novu/api/models/components"; + +let value: BulkSubscriberCreateDto = { + subscribers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `subscribers` | *string*[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/bulktriggereventdto.md b/docs/models/components/bulktriggereventdto.md new file mode 100644 index 00000000..a93c4ac6 --- /dev/null +++ b/docs/models/components/bulktriggereventdto.md @@ -0,0 +1,26 @@ +# BulkTriggerEventDto + +## Example Usage + +```typescript +import { BulkTriggerEventDto } from "@novu/api/models/components"; + +let value: BulkTriggerEventDto = { + events: [ + { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + "SUBSCRIBER_ID", + ], + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `events` | [components.TriggerEventRequestDto](../../models/components/triggereventrequestdto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/channel.md b/docs/models/components/channel.md new file mode 100644 index 00000000..0f6af4c2 --- /dev/null +++ b/docs/models/components/channel.md @@ -0,0 +1,15 @@ +# Channel + +## Example Usage + +```typescript +import { Channel } from "@novu/api/models/components"; + +let value: Channel = "delay"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" | "digest" | "trigger" | "delay" | "custom" +``` \ No newline at end of file diff --git a/docs/models/components/channelcredentials.md b/docs/models/components/channelcredentials.md new file mode 100644 index 00000000..a4462dc6 --- /dev/null +++ b/docs/models/components/channelcredentials.md @@ -0,0 +1,24 @@ +# ChannelCredentials + +## Example Usage + +```typescript +import { ChannelCredentials } from "@novu/api/models/components"; + +let value: ChannelCredentials = { + webhookUrl: "https://finished-receptor.org", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `webhookUrl` | *string* | :heavy_check_mark: | Webhook url used by chat app integrations. The webhook should be obtained from the chat app provider. | +| `channel` | *string* | :heavy_minus_sign: | Channel specification for Mattermost chat notifications | +| `deviceTokens` | *string*[] | :heavy_minus_sign: | Contains an array of the subscriber device tokens for a given provider. Used on Push integrations | +| `alertUid` | *string* | :heavy_minus_sign: | alert_uid for grafana on-call webhook payload | +| `title` | *string* | :heavy_minus_sign: | title to be used with grafana on call webhook | +| `imageUrl` | *string* | :heavy_minus_sign: | image_url property fo grafana on call webhook | +| `state` | *string* | :heavy_minus_sign: | state property fo grafana on call webhook | +| `externalUrl` | *string* | :heavy_minus_sign: | link_to_upstream_details property fo grafana on call webhook | \ No newline at end of file diff --git a/docs/models/components/channelpreference.md b/docs/models/components/channelpreference.md new file mode 100644 index 00000000..ddd3acb6 --- /dev/null +++ b/docs/models/components/channelpreference.md @@ -0,0 +1,19 @@ +# ChannelPreference + +## Example Usage + +```typescript +import { ChannelPreference } from "@novu/api/models/components"; + +let value: ChannelPreference = { + type: "push", + enabled: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `type` | [components.ChannelPreferenceType](../../models/components/channelpreferencetype.md) | :heavy_check_mark: | The type of channel that is enabled or not | +| `enabled` | *boolean* | :heavy_check_mark: | If channel is enabled or not | \ No newline at end of file diff --git a/docs/models/components/channelpreferencetype.md b/docs/models/components/channelpreferencetype.md new file mode 100644 index 00000000..3fe32c71 --- /dev/null +++ b/docs/models/components/channelpreferencetype.md @@ -0,0 +1,17 @@ +# ChannelPreferenceType + +The type of channel that is enabled or not + +## Example Usage + +```typescript +import { ChannelPreferenceType } from "@novu/api/models/components"; + +let value: ChannelPreferenceType = "sms"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/components/channels.md b/docs/models/components/channels.md new file mode 100644 index 00000000..921dc283 --- /dev/null +++ b/docs/models/components/channels.md @@ -0,0 +1,15 @@ +# Channels + +## Example Usage + +```typescript +import { Channels } from "@novu/api/models/components"; + +let value: Channels = "in_app"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/components/channelsettings.md b/docs/models/components/channelsettings.md new file mode 100644 index 00000000..ec7684c0 --- /dev/null +++ b/docs/models/components/channelsettings.md @@ -0,0 +1,24 @@ +# ChannelSettings + +## Example Usage + +```typescript +import { ChannelSettings } from "@novu/api/models/components"; + +let value: ChannelSettings = { + providerId: "mattermost", + credentials: { + webhookUrl: "https://ajar-solvency.com", + }, + integrationId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `providerId` | [components.ProviderId](../../models/components/providerid.md) | :heavy_check_mark: | The provider identifier for the credentials | +| `integrationIdentifier` | *string* | :heavy_minus_sign: | The integration identifier | +| `credentials` | [components.ChannelCredentials](../../models/components/channelcredentials.md) | :heavy_check_mark: | Credentials payload for the specified provider | +| `integrationId` | *string* | :heavy_check_mark: | Id of the integration that is used for this channel | \ No newline at end of file diff --git a/docs/models/components/content.md b/docs/models/components/content.md new file mode 100644 index 00000000..1f27e6d7 --- /dev/null +++ b/docs/models/components/content.md @@ -0,0 +1,20 @@ +# Content + + +## Supported Types + +### `components.EmailBlock` + +```typescript +const value: components.EmailBlock = { + type: "text", + content: "", +}; +``` + +### `string` + +```typescript +const value: string = ""; +``` + diff --git a/docs/models/components/controls.md b/docs/models/components/controls.md new file mode 100644 index 00000000..94e492f7 --- /dev/null +++ b/docs/models/components/controls.md @@ -0,0 +1,14 @@ +# Controls + +## Example Usage + +```typescript +import { Controls } from "@novu/api/models/components"; + +let value: Controls = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/createintegrationrequestdto.md b/docs/models/components/createintegrationrequestdto.md new file mode 100644 index 00000000..65b94eb8 --- /dev/null +++ b/docs/models/components/createintegrationrequestdto.md @@ -0,0 +1,26 @@ +# CreateIntegrationRequestDto + +## Example Usage + +```typescript +import { CreateIntegrationRequestDto } from "@novu/api/models/components"; + +let value: CreateIntegrationRequestDto = { + providerId: "", + channel: "chat", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `name` | *string* | :heavy_minus_sign: | N/A | +| `identifier` | *string* | :heavy_minus_sign: | N/A | +| `environmentId` | *string* | :heavy_minus_sign: | N/A | +| `providerId` | *string* | :heavy_check_mark: | N/A | +| `channel` | [components.CreateIntegrationRequestDtoChannel](../../models/components/createintegrationrequestdtochannel.md) | :heavy_check_mark: | N/A | +| `credentials` | [components.CredentialsDto](../../models/components/credentialsdto.md) | :heavy_minus_sign: | N/A | +| `active` | *boolean* | :heavy_minus_sign: | If the integration is active the validation on the credentials field will run | +| `check` | *boolean* | :heavy_minus_sign: | N/A | +| `conditions` | [components.StepFilter](../../models/components/stepfilter.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/createintegrationrequestdtochannel.md b/docs/models/components/createintegrationrequestdtochannel.md new file mode 100644 index 00000000..c908a7b9 --- /dev/null +++ b/docs/models/components/createintegrationrequestdtochannel.md @@ -0,0 +1,15 @@ +# CreateIntegrationRequestDtoChannel + +## Example Usage + +```typescript +import { CreateIntegrationRequestDtoChannel } from "@novu/api/models/components"; + +let value: CreateIntegrationRequestDtoChannel = "in_app"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/components/createnotificationgrouprequestdto.md b/docs/models/components/createnotificationgrouprequestdto.md new file mode 100644 index 00000000..330c7811 --- /dev/null +++ b/docs/models/components/createnotificationgrouprequestdto.md @@ -0,0 +1,17 @@ +# CreateNotificationGroupRequestDto + +## Example Usage + +```typescript +import { CreateNotificationGroupRequestDto } from "@novu/api/models/components"; + +let value: CreateNotificationGroupRequestDto = { + name: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `name` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/createsubscriberrequestdto.md b/docs/models/components/createsubscriberrequestdto.md new file mode 100644 index 00000000..3af75e08 --- /dev/null +++ b/docs/models/components/createsubscriberrequestdto.md @@ -0,0 +1,25 @@ +# CreateSubscriberRequestDto + +## Example Usage + +```typescript +import { CreateSubscriberRequestDto } from "@novu/api/models/components"; + +let value: CreateSubscriberRequestDto = { + subscriberId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems | +| `email` | *string* | :heavy_minus_sign: | N/A | +| `firstName` | *string* | :heavy_minus_sign: | N/A | +| `lastName` | *string* | :heavy_minus_sign: | N/A | +| `phone` | *string* | :heavy_minus_sign: | N/A | +| `avatar` | *string* | :heavy_minus_sign: | An http url to the profile image of your subscriber | +| `locale` | *string* | :heavy_minus_sign: | N/A | +| `data` | [components.CreateSubscriberRequestDtoData](../../models/components/createsubscriberrequestdtodata.md) | :heavy_minus_sign: | N/A | +| `channels` | *string*[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/createsubscriberrequestdtodata.md b/docs/models/components/createsubscriberrequestdtodata.md new file mode 100644 index 00000000..f0b620c2 --- /dev/null +++ b/docs/models/components/createsubscriberrequestdtodata.md @@ -0,0 +1,14 @@ +# CreateSubscriberRequestDtoData + +## Example Usage + +```typescript +import { CreateSubscriberRequestDtoData } from "@novu/api/models/components"; + +let value: CreateSubscriberRequestDtoData = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/createtopicrequestdto.md b/docs/models/components/createtopicrequestdto.md new file mode 100644 index 00000000..611f5b5a --- /dev/null +++ b/docs/models/components/createtopicrequestdto.md @@ -0,0 +1,19 @@ +# CreateTopicRequestDto + +## Example Usage + +```typescript +import { CreateTopicRequestDto } from "@novu/api/models/components"; + +let value: CreateTopicRequestDto = { + key: "", + name: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `key` | *string* | :heavy_check_mark: | User defined custom key and provided by the user that will be an unique identifier for the Topic created. | +| `name` | *string* | :heavy_check_mark: | User defined custom name and provided by the user that will name the Topic created. | \ No newline at end of file diff --git a/docs/models/components/createtopicresponsedto.md b/docs/models/components/createtopicresponsedto.md new file mode 100644 index 00000000..7399856b --- /dev/null +++ b/docs/models/components/createtopicresponsedto.md @@ -0,0 +1,18 @@ +# CreateTopicResponseDto + +## Example Usage + +```typescript +import { CreateTopicResponseDto } from "@novu/api/models/components"; + +let value: CreateTopicResponseDto = { + key: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The unique identifier for the Topic created. | +| `key` | *string* | :heavy_check_mark: | User defined custom key and provided by the user that will be an unique identifier for the Topic created. | \ No newline at end of file diff --git a/docs/models/components/credentialsdto.md b/docs/models/components/credentialsdto.md new file mode 100644 index 00000000..3a905cac --- /dev/null +++ b/docs/models/components/credentialsdto.md @@ -0,0 +1,56 @@ +# CredentialsDto + +## Example Usage + +```typescript +import { CredentialsDto } from "@novu/api/models/components"; + +let value: CredentialsDto = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | +| `apiKey` | *string* | :heavy_minus_sign: | N/A | +| `user` | *string* | :heavy_minus_sign: | N/A | +| `secretKey` | *string* | :heavy_minus_sign: | N/A | +| `domain` | *string* | :heavy_minus_sign: | N/A | +| `password` | *string* | :heavy_minus_sign: | N/A | +| `host` | *string* | :heavy_minus_sign: | N/A | +| `port` | *string* | :heavy_minus_sign: | N/A | +| `secure` | *boolean* | :heavy_minus_sign: | N/A | +| `region` | *string* | :heavy_minus_sign: | N/A | +| `accountSid` | *string* | :heavy_minus_sign: | N/A | +| `messageProfileId` | *string* | :heavy_minus_sign: | N/A | +| `token` | *string* | :heavy_minus_sign: | N/A | +| `from` | *string* | :heavy_minus_sign: | N/A | +| `senderName` | *string* | :heavy_minus_sign: | N/A | +| `projectName` | *string* | :heavy_minus_sign: | N/A | +| `applicationId` | *string* | :heavy_minus_sign: | N/A | +| `clientId` | *string* | :heavy_minus_sign: | N/A | +| `requireTls` | *boolean* | :heavy_minus_sign: | N/A | +| `ignoreTls` | *boolean* | :heavy_minus_sign: | N/A | +| `tlsOptions` | [components.TlsOptions](../../models/components/tlsoptions.md) | :heavy_minus_sign: | N/A | +| `baseUrl` | *string* | :heavy_minus_sign: | N/A | +| `webhookUrl` | *string* | :heavy_minus_sign: | N/A | +| `redirectUrl` | *string* | :heavy_minus_sign: | N/A | +| `hmac` | *boolean* | :heavy_minus_sign: | N/A | +| `serviceAccount` | *string* | :heavy_minus_sign: | N/A | +| `ipPoolName` | *string* | :heavy_minus_sign: | N/A | +| `apiKeyRequestHeader` | *string* | :heavy_minus_sign: | N/A | +| `secretKeyRequestHeader` | *string* | :heavy_minus_sign: | N/A | +| `idPath` | *string* | :heavy_minus_sign: | N/A | +| `datePath` | *string* | :heavy_minus_sign: | N/A | +| `apiToken` | *string* | :heavy_minus_sign: | N/A | +| `authenticateByToken` | *boolean* | :heavy_minus_sign: | N/A | +| `authenticationTokenKey` | *string* | :heavy_minus_sign: | N/A | +| `instanceId` | *string* | :heavy_minus_sign: | N/A | +| `alertUid` | *string* | :heavy_minus_sign: | N/A | +| `title` | *string* | :heavy_minus_sign: | N/A | +| `imageUrl` | *string* | :heavy_minus_sign: | N/A | +| `state` | *string* | :heavy_minus_sign: | N/A | +| `externalLink` | *string* | :heavy_minus_sign: | N/A | +| `channelId` | *string* | :heavy_minus_sign: | N/A | +| `phoneNumberIdentification` | *string* | :heavy_minus_sign: | N/A | +| `accessKey` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/data.md b/docs/models/components/data.md new file mode 100644 index 00000000..936dce25 --- /dev/null +++ b/docs/models/components/data.md @@ -0,0 +1,14 @@ +# Data + +## Example Usage + +```typescript +import { Data } from "@novu/api/models/components"; + +let value: Data = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/databooleandto.md b/docs/models/components/databooleandto.md new file mode 100644 index 00000000..fd5bdad6 --- /dev/null +++ b/docs/models/components/databooleandto.md @@ -0,0 +1,17 @@ +# DataBooleanDto + +## Example Usage + +```typescript +import { DataBooleanDto } from "@novu/api/models/components"; + +let value: DataBooleanDto = { + data: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `data` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/delayregularmetadata.md b/docs/models/components/delayregularmetadata.md new file mode 100644 index 00000000..152d6ccf --- /dev/null +++ b/docs/models/components/delayregularmetadata.md @@ -0,0 +1,19 @@ +# DelayRegularMetadata + +## Example Usage + +```typescript +import { DelayRegularMetadata } from "@novu/api/models/components"; + +let value: DelayRegularMetadata = { + type: "regular", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `amount` | *number* | :heavy_minus_sign: | N/A | +| `unit` | [components.DelayRegularMetadataUnit](../../models/components/delayregularmetadataunit.md) | :heavy_minus_sign: | N/A | +| `type` | [components.DelayRegularMetadataType](../../models/components/delayregularmetadatatype.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/delayregularmetadatatype.md b/docs/models/components/delayregularmetadatatype.md new file mode 100644 index 00000000..52666530 --- /dev/null +++ b/docs/models/components/delayregularmetadatatype.md @@ -0,0 +1,15 @@ +# DelayRegularMetadataType + +## Example Usage + +```typescript +import { DelayRegularMetadataType } from "@novu/api/models/components"; + +let value: DelayRegularMetadataType = "regular"; +``` + +## Values + +```typescript +"regular" +``` \ No newline at end of file diff --git a/docs/models/components/delayregularmetadataunit.md b/docs/models/components/delayregularmetadataunit.md new file mode 100644 index 00000000..579f0e83 --- /dev/null +++ b/docs/models/components/delayregularmetadataunit.md @@ -0,0 +1,15 @@ +# DelayRegularMetadataUnit + +## Example Usage + +```typescript +import { DelayRegularMetadataUnit } from "@novu/api/models/components"; + +let value: DelayRegularMetadataUnit = "hours"; +``` + +## Values + +```typescript +"seconds" | "minutes" | "hours" | "days" | "weeks" | "months" +``` \ No newline at end of file diff --git a/docs/models/components/delayscheduledmetadata.md b/docs/models/components/delayscheduledmetadata.md new file mode 100644 index 00000000..cc5d6fdf --- /dev/null +++ b/docs/models/components/delayscheduledmetadata.md @@ -0,0 +1,19 @@ +# DelayScheduledMetadata + +## Example Usage + +```typescript +import { DelayScheduledMetadata } from "@novu/api/models/components"; + +let value: DelayScheduledMetadata = { + type: "scheduled", + delayPath: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `type` | [components.DelayScheduledMetadataType](../../models/components/delayscheduledmetadatatype.md) | :heavy_check_mark: | N/A | +| `delayPath` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/delayscheduledmetadatatype.md b/docs/models/components/delayscheduledmetadatatype.md new file mode 100644 index 00000000..adfbf2db --- /dev/null +++ b/docs/models/components/delayscheduledmetadatatype.md @@ -0,0 +1,15 @@ +# DelayScheduledMetadataType + +## Example Usage + +```typescript +import { DelayScheduledMetadataType } from "@novu/api/models/components"; + +let value: DelayScheduledMetadataType = "scheduled"; +``` + +## Values + +```typescript +"scheduled" +``` \ No newline at end of file diff --git a/docs/models/components/deletemessageresponsedto.md b/docs/models/components/deletemessageresponsedto.md new file mode 100644 index 00000000..2942b551 --- /dev/null +++ b/docs/models/components/deletemessageresponsedto.md @@ -0,0 +1,19 @@ +# DeleteMessageResponseDto + +## Example Usage + +```typescript +import { DeleteMessageResponseDto } from "@novu/api/models/components"; + +let value: DeleteMessageResponseDto = { + acknowledged: false, + status: "deleted", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `acknowledged` | *boolean* | :heavy_check_mark: | A boolean stating the success of the action | +| `status` | [components.DeleteMessageResponseDtoStatus](../../models/components/deletemessageresponsedtostatus.md) | :heavy_check_mark: | The status enum for the performed action | \ No newline at end of file diff --git a/docs/models/components/deletemessageresponsedtostatus.md b/docs/models/components/deletemessageresponsedtostatus.md new file mode 100644 index 00000000..60cab91b --- /dev/null +++ b/docs/models/components/deletemessageresponsedtostatus.md @@ -0,0 +1,17 @@ +# DeleteMessageResponseDtoStatus + +The status enum for the performed action + +## Example Usage + +```typescript +import { DeleteMessageResponseDtoStatus } from "@novu/api/models/components"; + +let value: DeleteMessageResponseDtoStatus = "deleted"; +``` + +## Values + +```typescript +"deleted" +``` \ No newline at end of file diff --git a/docs/models/components/deletenotificationgroupresponsedto.md b/docs/models/components/deletenotificationgroupresponsedto.md new file mode 100644 index 00000000..1543e617 --- /dev/null +++ b/docs/models/components/deletenotificationgroupresponsedto.md @@ -0,0 +1,19 @@ +# DeleteNotificationGroupResponseDto + +## Example Usage + +```typescript +import { DeleteNotificationGroupResponseDto } from "@novu/api/models/components"; + +let value: DeleteNotificationGroupResponseDto = { + acknowledged: false, + status: "deleted", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| `acknowledged` | *boolean* | :heavy_check_mark: | A boolean stating the success of the action | +| `status` | [components.DeleteNotificationGroupResponseDtoStatus](../../models/components/deletenotificationgroupresponsedtostatus.md) | :heavy_check_mark: | The status enum for the performed action | \ No newline at end of file diff --git a/docs/models/components/deletenotificationgroupresponsedtostatus.md b/docs/models/components/deletenotificationgroupresponsedtostatus.md new file mode 100644 index 00000000..97ae3ee1 --- /dev/null +++ b/docs/models/components/deletenotificationgroupresponsedtostatus.md @@ -0,0 +1,17 @@ +# DeleteNotificationGroupResponseDtoStatus + +The status enum for the performed action + +## Example Usage + +```typescript +import { DeleteNotificationGroupResponseDtoStatus } from "@novu/api/models/components"; + +let value: DeleteNotificationGroupResponseDtoStatus = "deleted"; +``` + +## Values + +```typescript +"deleted" +``` \ No newline at end of file diff --git a/docs/models/components/deletesubscriberresponsedto.md b/docs/models/components/deletesubscriberresponsedto.md new file mode 100644 index 00000000..68e2ba72 --- /dev/null +++ b/docs/models/components/deletesubscriberresponsedto.md @@ -0,0 +1,19 @@ +# DeleteSubscriberResponseDto + +## Example Usage + +```typescript +import { DeleteSubscriberResponseDto } from "@novu/api/models/components"; + +let value: DeleteSubscriberResponseDto = { + acknowledged: false, + status: "deleted", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `acknowledged` | *boolean* | :heavy_check_mark: | A boolean stating the success of the action | +| `status` | [components.DeleteSubscriberResponseDtoStatus](../../models/components/deletesubscriberresponsedtostatus.md) | :heavy_check_mark: | The status enum for the performed action | \ No newline at end of file diff --git a/docs/models/components/deletesubscriberresponsedtostatus.md b/docs/models/components/deletesubscriberresponsedtostatus.md new file mode 100644 index 00000000..80e97b35 --- /dev/null +++ b/docs/models/components/deletesubscriberresponsedtostatus.md @@ -0,0 +1,17 @@ +# DeleteSubscriberResponseDtoStatus + +The status enum for the performed action + +## Example Usage + +```typescript +import { DeleteSubscriberResponseDtoStatus } from "@novu/api/models/components"; + +let value: DeleteSubscriberResponseDtoStatus = "deleted"; +``` + +## Values + +```typescript +"deleted" +``` \ No newline at end of file diff --git a/docs/models/components/digestregularmetadata.md b/docs/models/components/digestregularmetadata.md new file mode 100644 index 00000000..b667be64 --- /dev/null +++ b/docs/models/components/digestregularmetadata.md @@ -0,0 +1,24 @@ +# DigestRegularMetadata + +## Example Usage + +```typescript +import { DigestRegularMetadata } from "@novu/api/models/components"; + +let value: DigestRegularMetadata = { + type: "regular", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | N/A | +| `unit` | [components.Unit](../../models/components/unit.md) | :heavy_minus_sign: | N/A | +| `digestKey` | *string* | :heavy_minus_sign: | N/A | +| `type` | [components.DigestRegularMetadataType](../../models/components/digestregularmetadatatype.md) | :heavy_check_mark: | N/A | +| `backoff` | *boolean* | :heavy_minus_sign: | N/A | +| `backoffAmount` | *number* | :heavy_minus_sign: | N/A | +| `backoffUnit` | [components.BackoffUnit](../../models/components/backoffunit.md) | :heavy_minus_sign: | N/A | +| `updateMode` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/digestregularmetadatatype.md b/docs/models/components/digestregularmetadatatype.md new file mode 100644 index 00000000..6830975b --- /dev/null +++ b/docs/models/components/digestregularmetadatatype.md @@ -0,0 +1,15 @@ +# DigestRegularMetadataType + +## Example Usage + +```typescript +import { DigestRegularMetadataType } from "@novu/api/models/components"; + +let value: DigestRegularMetadataType = "backoff"; +``` + +## Values + +```typescript +"regular" | "backoff" +``` \ No newline at end of file diff --git a/docs/models/components/digesttimedmetadata.md b/docs/models/components/digesttimedmetadata.md new file mode 100644 index 00000000..c45fc8d6 --- /dev/null +++ b/docs/models/components/digesttimedmetadata.md @@ -0,0 +1,21 @@ +# DigestTimedMetadata + +## Example Usage + +```typescript +import { DigestTimedMetadata } from "@novu/api/models/components"; + +let value: DigestTimedMetadata = { + type: "timed", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `amount` | *number* | :heavy_minus_sign: | N/A | +| `unit` | [components.DigestTimedMetadataUnit](../../models/components/digesttimedmetadataunit.md) | :heavy_minus_sign: | N/A | +| `digestKey` | *string* | :heavy_minus_sign: | N/A | +| `type` | [components.DigestTimedMetadataType](../../models/components/digesttimedmetadatatype.md) | :heavy_check_mark: | N/A | +| `timed` | [components.TimedConfig](../../models/components/timedconfig.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/digesttimedmetadatatype.md b/docs/models/components/digesttimedmetadatatype.md new file mode 100644 index 00000000..a1b443b3 --- /dev/null +++ b/docs/models/components/digesttimedmetadatatype.md @@ -0,0 +1,15 @@ +# DigestTimedMetadataType + +## Example Usage + +```typescript +import { DigestTimedMetadataType } from "@novu/api/models/components"; + +let value: DigestTimedMetadataType = "timed"; +``` + +## Values + +```typescript +"timed" +``` \ No newline at end of file diff --git a/docs/models/components/digesttimedmetadataunit.md b/docs/models/components/digesttimedmetadataunit.md new file mode 100644 index 00000000..6f392cc4 --- /dev/null +++ b/docs/models/components/digesttimedmetadataunit.md @@ -0,0 +1,15 @@ +# DigestTimedMetadataUnit + +## Example Usage + +```typescript +import { DigestTimedMetadataUnit } from "@novu/api/models/components"; + +let value: DigestTimedMetadataUnit = "hours"; +``` + +## Values + +```typescript +"seconds" | "minutes" | "hours" | "days" | "weeks" | "months" +``` \ No newline at end of file diff --git a/docs/models/components/emailblock.md b/docs/models/components/emailblock.md new file mode 100644 index 00000000..885e482c --- /dev/null +++ b/docs/models/components/emailblock.md @@ -0,0 +1,21 @@ +# EmailBlock + +## Example Usage + +```typescript +import { EmailBlock } from "@novu/api/models/components"; + +let value: EmailBlock = { + type: "button", + content: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `type` | [components.EmailBlockType](../../models/components/emailblocktype.md) | :heavy_check_mark: | N/A | +| `content` | *string* | :heavy_check_mark: | N/A | +| `url` | *string* | :heavy_minus_sign: | N/A | +| `styles` | [components.EmailBlockStyles](../../models/components/emailblockstyles.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/emailblockstyles.md b/docs/models/components/emailblockstyles.md new file mode 100644 index 00000000..8ddbd4e2 --- /dev/null +++ b/docs/models/components/emailblockstyles.md @@ -0,0 +1,17 @@ +# EmailBlockStyles + +## Example Usage + +```typescript +import { EmailBlockStyles } from "@novu/api/models/components"; + +let value: EmailBlockStyles = { + textAlign: "center", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `textAlign` | [components.TextAlign](../../models/components/textalign.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/emailblocktype.md b/docs/models/components/emailblocktype.md new file mode 100644 index 00000000..63e25e19 --- /dev/null +++ b/docs/models/components/emailblocktype.md @@ -0,0 +1,15 @@ +# EmailBlockType + +## Example Usage + +```typescript +import { EmailBlockType } from "@novu/api/models/components"; + +let value: EmailBlockType = "text"; +``` + +## Values + +```typescript +"button" | "text" +``` \ No newline at end of file diff --git a/docs/models/components/environmentresponsedto.md b/docs/models/components/environmentresponsedto.md new file mode 100644 index 00000000..c9b4473d --- /dev/null +++ b/docs/models/components/environmentresponsedto.md @@ -0,0 +1,26 @@ +# EnvironmentResponseDto + +## Example Usage + +```typescript +import { EnvironmentResponseDto } from "@novu/api/models/components"; + +let value: EnvironmentResponseDto = { + name: "", + organizationId: "", + identifier: "", + parentId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `identifier` | *string* | :heavy_check_mark: | N/A | +| `apiKeys` | *string*[] | :heavy_minus_sign: | N/A | +| `parentId` | *string* | :heavy_check_mark: | N/A | +| `slug` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/executiondetailsresponsedto.md b/docs/models/components/executiondetailsresponsedto.md new file mode 100644 index 00000000..62471cb7 --- /dev/null +++ b/docs/models/components/executiondetailsresponsedto.md @@ -0,0 +1,45 @@ +# ExecutionDetailsResponseDto + +## Example Usage + +```typescript +import { ExecutionDetailsResponseDto } from "@novu/api/models/components"; + +let value: ExecutionDetailsResponseDto = { + organizationId: "", + jobId: "", + environmentId: "", + notificationId: "", + notificationTemplateId: "", + subscriberId: "", + transactionId: "", + channel: "in_app", + detail: "", + source: "Webhook", + status: "Failed", + isTest: false, + isRetry: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `jobId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `notificationId` | *string* | :heavy_check_mark: | N/A | +| `notificationTemplateId` | *string* | :heavy_check_mark: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `messageId` | *string* | :heavy_minus_sign: | N/A | +| `providerId` | *string* | :heavy_minus_sign: | N/A | +| `transactionId` | *string* | :heavy_check_mark: | N/A | +| `channel` | [components.Channel](../../models/components/channel.md) | :heavy_check_mark: | N/A | +| `detail` | *string* | :heavy_check_mark: | N/A | +| `source` | [components.Source](../../models/components/source.md) | :heavy_check_mark: | N/A | +| `status` | [components.Status](../../models/components/status.md) | :heavy_check_mark: | N/A | +| `isTest` | *boolean* | :heavy_check_mark: | N/A | +| `isRetry` | *boolean* | :heavy_check_mark: | N/A | +| `createdAt` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/feedid.md b/docs/models/components/feedid.md new file mode 100644 index 00000000..1b186e15 --- /dev/null +++ b/docs/models/components/feedid.md @@ -0,0 +1,14 @@ +# FeedId + +## Example Usage + +```typescript +import { FeedId } from "@novu/api/models/components"; + +let value: FeedId = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/feedidentifier.md b/docs/models/components/feedidentifier.md new file mode 100644 index 00000000..10cebf51 --- /dev/null +++ b/docs/models/components/feedidentifier.md @@ -0,0 +1,21 @@ +# FeedIdentifier + +Optional feed identifier or array of feed identifiers + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `string[]` + +```typescript +const value: string[] = [ + "", +]; +``` + diff --git a/docs/models/components/feedresponsedto.md b/docs/models/components/feedresponsedto.md new file mode 100644 index 00000000..c8a09ed7 --- /dev/null +++ b/docs/models/components/feedresponsedto.md @@ -0,0 +1,26 @@ +# FeedResponseDto + +## Example Usage + +```typescript +import { FeedResponseDto } from "@novu/api/models/components"; + +let value: FeedResponseDto = { + hasMore: false, + data: [ + "", + ], + pageSize: 6994.79, + page: 2974.37, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `totalCount` | *number* | :heavy_minus_sign: | N/A | +| `hasMore` | *boolean* | :heavy_check_mark: | N/A | +| `data` | *string*[] | :heavy_check_mark: | N/A | +| `pageSize` | *number* | :heavy_check_mark: | N/A | +| `page` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/fieldfilterpart.md b/docs/models/components/fieldfilterpart.md new file mode 100644 index 00000000..c8c2e97b --- /dev/null +++ b/docs/models/components/fieldfilterpart.md @@ -0,0 +1,23 @@ +# FieldFilterPart + +## Example Usage + +```typescript +import { FieldFilterPart } from "@novu/api/models/components"; + +let value: FieldFilterPart = { + field: "", + value: "", + operator: "EQUAL", + on: "payload", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | ---------------------------------------------------------- | +| `field` | *string* | :heavy_check_mark: | N/A | +| `value` | *string* | :heavy_check_mark: | N/A | +| `operator` | [components.Operator](../../models/components/operator.md) | :heavy_check_mark: | N/A | +| `on` | [components.On](../../models/components/on.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/filtertopicsresponsedto.md b/docs/models/components/filtertopicsresponsedto.md new file mode 100644 index 00000000..09083966 --- /dev/null +++ b/docs/models/components/filtertopicsresponsedto.md @@ -0,0 +1,33 @@ +# FilterTopicsResponseDto + +## Example Usage + +```typescript +import { FilterTopicsResponseDto } from "@novu/api/models/components"; + +let value: FilterTopicsResponseDto = { + data: [ + { + organizationId: "", + environmentId: "", + key: "", + name: "", + subscribers: [ + "", + ], + }, + ], + page: 580.29, + pageSize: 4344.17, + totalCount: 3117.96, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| `data` | [components.TopicDto](../../models/components/topicdto.md)[] | :heavy_check_mark: | N/A | +| `page` | *number* | :heavy_check_mark: | N/A | +| `pageSize` | *number* | :heavy_check_mark: | N/A | +| `totalCount` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/getsubscriberpreferencesresponsedto.md b/docs/models/components/getsubscriberpreferencesresponsedto.md new file mode 100644 index 00000000..a79fe0e5 --- /dev/null +++ b/docs/models/components/getsubscriberpreferencesresponsedto.md @@ -0,0 +1,21 @@ +# GetSubscriberPreferencesResponseDto + +## Example Usage + +```typescript +import { GetSubscriberPreferencesResponseDto } from "@novu/api/models/components"; + +let value: GetSubscriberPreferencesResponseDto = { + preference: { + enabled: false, + channels: {}, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `template` | [components.TemplateResponse](../../models/components/templateresponse.md) | :heavy_minus_sign: | The workflow information and if it is critical or not | +| `preference` | [components.Preference](../../models/components/preference.md) | :heavy_check_mark: | The preferences of the subscriber regarding the related workflow | \ No newline at end of file diff --git a/docs/models/components/gettopicresponsedto.md b/docs/models/components/gettopicresponsedto.md new file mode 100644 index 00000000..30950928 --- /dev/null +++ b/docs/models/components/gettopicresponsedto.md @@ -0,0 +1,28 @@ +# GetTopicResponseDto + +## Example Usage + +```typescript +import { GetTopicResponseDto } from "@novu/api/models/components"; + +let value: GetTopicResponseDto = { + organizationId: "", + environmentId: "", + key: "", + name: "", + subscribers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `key` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `subscribers` | *string*[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/integrationresponsedto.md b/docs/models/components/integrationresponsedto.md new file mode 100644 index 00000000..6e1a89c8 --- /dev/null +++ b/docs/models/components/integrationresponsedto.md @@ -0,0 +1,41 @@ +# IntegrationResponseDto + +## Example Usage + +```typescript +import { IntegrationResponseDto } from "@novu/api/models/components"; + +let value: IntegrationResponseDto = { + environmentId: "", + organizationId: "", + name: "", + identifier: "", + providerId: "", + channel: "sms", + credentials: {}, + active: false, + deleted: false, + deletedAt: "", + deletedBy: "", + primary: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `identifier` | *string* | :heavy_check_mark: | N/A | +| `providerId` | *string* | :heavy_check_mark: | N/A | +| `channel` | [components.IntegrationResponseDtoChannel](../../models/components/integrationresponsedtochannel.md) | :heavy_check_mark: | N/A | +| `credentials` | [components.CredentialsDto](../../models/components/credentialsdto.md) | :heavy_check_mark: | N/A | +| `active` | *boolean* | :heavy_check_mark: | N/A | +| `deleted` | *boolean* | :heavy_check_mark: | N/A | +| `deletedAt` | *string* | :heavy_check_mark: | N/A | +| `deletedBy` | *string* | :heavy_check_mark: | N/A | +| `primary` | *boolean* | :heavy_check_mark: | N/A | +| `conditions` | [components.StepFilter](../../models/components/stepfilter.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/integrationresponsedtochannel.md b/docs/models/components/integrationresponsedtochannel.md new file mode 100644 index 00000000..57607f6e --- /dev/null +++ b/docs/models/components/integrationresponsedtochannel.md @@ -0,0 +1,15 @@ +# IntegrationResponseDtoChannel + +## Example Usage + +```typescript +import { IntegrationResponseDtoChannel } from "@novu/api/models/components"; + +let value: IntegrationResponseDtoChannel = "email"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/components/markallmessageasrequestdto.md b/docs/models/components/markallmessageasrequestdto.md new file mode 100644 index 00000000..c4b5ef09 --- /dev/null +++ b/docs/models/components/markallmessageasrequestdto.md @@ -0,0 +1,18 @@ +# MarkAllMessageAsRequestDto + +## Example Usage + +```typescript +import { MarkAllMessageAsRequestDto } from "@novu/api/models/components"; + +let value: MarkAllMessageAsRequestDto = { + markAs: "unread", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| `feedIdentifier` | *components.FeedIdentifier* | :heavy_minus_sign: | Optional feed identifier or array of feed identifiers | +| `markAs` | [components.MarkAllMessageAsRequestDtoMarkAs](../../models/components/markallmessageasrequestdtomarkas.md) | :heavy_check_mark: | Mark all subscriber messages as read, unread, seen or unseen | \ No newline at end of file diff --git a/docs/models/components/markallmessageasrequestdtomarkas.md b/docs/models/components/markallmessageasrequestdtomarkas.md new file mode 100644 index 00000000..e6c8a0f7 --- /dev/null +++ b/docs/models/components/markallmessageasrequestdtomarkas.md @@ -0,0 +1,17 @@ +# MarkAllMessageAsRequestDtoMarkAs + +Mark all subscriber messages as read, unread, seen or unseen + +## Example Usage + +```typescript +import { MarkAllMessageAsRequestDtoMarkAs } from "@novu/api/models/components"; + +let value: MarkAllMessageAsRequestDtoMarkAs = "unseen"; +``` + +## Values + +```typescript +"read" | "seen" | "unread" | "unseen" +``` \ No newline at end of file diff --git a/docs/models/components/markas.md b/docs/models/components/markas.md new file mode 100644 index 00000000..63197c56 --- /dev/null +++ b/docs/models/components/markas.md @@ -0,0 +1,15 @@ +# MarkAs + +## Example Usage + +```typescript +import { MarkAs } from "@novu/api/models/components"; + +let value: MarkAs = "seen"; +``` + +## Values + +```typescript +"read" | "seen" | "unread" | "unseen" +``` \ No newline at end of file diff --git a/docs/models/components/markmessageactionasseendto.md b/docs/models/components/markmessageactionasseendto.md new file mode 100644 index 00000000..862a243c --- /dev/null +++ b/docs/models/components/markmessageactionasseendto.md @@ -0,0 +1,18 @@ +# MarkMessageActionAsSeenDto + +## Example Usage + +```typescript +import { MarkMessageActionAsSeenDto } from "@novu/api/models/components"; + +let value: MarkMessageActionAsSeenDto = { + status: "pending", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `status` | [components.MarkMessageActionAsSeenDtoStatus](../../models/components/markmessageactionasseendtostatus.md) | :heavy_check_mark: | Message action status | +| `payload` | [components.MarkMessageActionAsSeenDtoPayload](../../models/components/markmessageactionasseendtopayload.md) | :heavy_minus_sign: | Message action payload | \ No newline at end of file diff --git a/docs/models/components/markmessageactionasseendtopayload.md b/docs/models/components/markmessageactionasseendtopayload.md new file mode 100644 index 00000000..f176f4e9 --- /dev/null +++ b/docs/models/components/markmessageactionasseendtopayload.md @@ -0,0 +1,16 @@ +# MarkMessageActionAsSeenDtoPayload + +Message action payload + +## Example Usage + +```typescript +import { MarkMessageActionAsSeenDtoPayload } from "@novu/api/models/components"; + +let value: MarkMessageActionAsSeenDtoPayload = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/markmessageactionasseendtostatus.md b/docs/models/components/markmessageactionasseendtostatus.md new file mode 100644 index 00000000..10687933 --- /dev/null +++ b/docs/models/components/markmessageactionasseendtostatus.md @@ -0,0 +1,17 @@ +# MarkMessageActionAsSeenDtoStatus + +Message action status + +## Example Usage + +```typescript +import { MarkMessageActionAsSeenDtoStatus } from "@novu/api/models/components"; + +let value: MarkMessageActionAsSeenDtoStatus = "pending"; +``` + +## Values + +```typescript +"pending" | "done" +``` \ No newline at end of file diff --git a/docs/models/components/messageaction.md b/docs/models/components/messageaction.md new file mode 100644 index 00000000..33317d1d --- /dev/null +++ b/docs/models/components/messageaction.md @@ -0,0 +1,17 @@ +# MessageAction + +## Example Usage + +```typescript +import { MessageAction } from "@novu/api/models/components"; + +let value: MessageAction = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `status` | [components.MessageActionStatus](../../models/components/messageactionstatus.md) | :heavy_minus_sign: | N/A | +| `buttons` | [components.MessageButton](../../models/components/messagebutton.md)[] | :heavy_minus_sign: | N/A | +| `result` | [components.MessageActionResult](../../models/components/messageactionresult.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/messageactionresult.md b/docs/models/components/messageactionresult.md new file mode 100644 index 00000000..bf928d87 --- /dev/null +++ b/docs/models/components/messageactionresult.md @@ -0,0 +1,16 @@ +# MessageActionResult + +## Example Usage + +```typescript +import { MessageActionResult } from "@novu/api/models/components"; + +let value: MessageActionResult = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `payload` | [components.MessageActionResultPayload](../../models/components/messageactionresultpayload.md) | :heavy_minus_sign: | N/A | +| `type` | [components.MessageActionResultType](../../models/components/messageactionresulttype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/messageactionresultpayload.md b/docs/models/components/messageactionresultpayload.md new file mode 100644 index 00000000..bbac45e2 --- /dev/null +++ b/docs/models/components/messageactionresultpayload.md @@ -0,0 +1,14 @@ +# MessageActionResultPayload + +## Example Usage + +```typescript +import { MessageActionResultPayload } from "@novu/api/models/components"; + +let value: MessageActionResultPayload = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/messageactionresulttype.md b/docs/models/components/messageactionresulttype.md new file mode 100644 index 00000000..7b4520f3 --- /dev/null +++ b/docs/models/components/messageactionresulttype.md @@ -0,0 +1,15 @@ +# MessageActionResultType + +## Example Usage + +```typescript +import { MessageActionResultType } from "@novu/api/models/components"; + +let value: MessageActionResultType = "primary"; +``` + +## Values + +```typescript +"primary" | "secondary" +``` \ No newline at end of file diff --git a/docs/models/components/messageactionstatus.md b/docs/models/components/messageactionstatus.md new file mode 100644 index 00000000..c039a55b --- /dev/null +++ b/docs/models/components/messageactionstatus.md @@ -0,0 +1,15 @@ +# MessageActionStatus + +## Example Usage + +```typescript +import { MessageActionStatus } from "@novu/api/models/components"; + +let value: MessageActionStatus = "pending"; +``` + +## Values + +```typescript +"pending" | "done" +``` \ No newline at end of file diff --git a/docs/models/components/messagebutton.md b/docs/models/components/messagebutton.md new file mode 100644 index 00000000..f51b4781 --- /dev/null +++ b/docs/models/components/messagebutton.md @@ -0,0 +1,20 @@ +# MessageButton + +## Example Usage + +```typescript +import { MessageButton } from "@novu/api/models/components"; + +let value: MessageButton = { + type: "primary", + content: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `type` | [components.MessageButtonType](../../models/components/messagebuttontype.md) | :heavy_check_mark: | N/A | +| `content` | *string* | :heavy_check_mark: | N/A | +| `resultContent` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/messagebuttontype.md b/docs/models/components/messagebuttontype.md new file mode 100644 index 00000000..b06cb585 --- /dev/null +++ b/docs/models/components/messagebuttontype.md @@ -0,0 +1,15 @@ +# MessageButtonType + +## Example Usage + +```typescript +import { MessageButtonType } from "@novu/api/models/components"; + +let value: MessageButtonType = "secondary"; +``` + +## Values + +```typescript +"primary" | "secondary" +``` \ No newline at end of file diff --git a/docs/models/components/messagecta.md b/docs/models/components/messagecta.md new file mode 100644 index 00000000..3b30fef1 --- /dev/null +++ b/docs/models/components/messagecta.md @@ -0,0 +1,19 @@ +# MessageCTA + +## Example Usage + +```typescript +import { MessageCTA } from "@novu/api/models/components"; + +let value: MessageCTA = { + data: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `type` | [components.MessageCTAType](../../models/components/messagectatype.md) | :heavy_minus_sign: | N/A | +| `data` | [components.MessageCTAData](../../models/components/messagectadata.md) | :heavy_check_mark: | N/A | +| `action` | [components.MessageAction](../../models/components/messageaction.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/messagectadata.md b/docs/models/components/messagectadata.md new file mode 100644 index 00000000..6256b50c --- /dev/null +++ b/docs/models/components/messagectadata.md @@ -0,0 +1,15 @@ +# MessageCTAData + +## Example Usage + +```typescript +import { MessageCTAData } from "@novu/api/models/components"; + +let value: MessageCTAData = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `url` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/messagectatype.md b/docs/models/components/messagectatype.md new file mode 100644 index 00000000..297b495e --- /dev/null +++ b/docs/models/components/messagectatype.md @@ -0,0 +1,15 @@ +# MessageCTAType + +## Example Usage + +```typescript +import { MessageCTAType } from "@novu/api/models/components"; + +let value: MessageCTAType = "redirect"; +``` + +## Values + +```typescript +"redirect" +``` \ No newline at end of file diff --git a/docs/models/components/messageentity.md b/docs/models/components/messageentity.md new file mode 100644 index 00000000..6e91c47a --- /dev/null +++ b/docs/models/components/messageentity.md @@ -0,0 +1,14 @@ +# MessageEntity + +## Example Usage + +```typescript +import { MessageEntity } from "@novu/api/models/components"; + +let value: MessageEntity = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/messageid.md b/docs/models/components/messageid.md new file mode 100644 index 00000000..46eeb36d --- /dev/null +++ b/docs/models/components/messageid.md @@ -0,0 +1,19 @@ +# MessageId + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `string[]` + +```typescript +const value: string[] = [ + "", +]; +``` + diff --git a/docs/models/components/messagemarkasrequestdto.md b/docs/models/components/messagemarkasrequestdto.md new file mode 100644 index 00000000..7a8a3575 --- /dev/null +++ b/docs/models/components/messagemarkasrequestdto.md @@ -0,0 +1,21 @@ +# MessageMarkAsRequestDto + +## Example Usage + +```typescript +import { MessageMarkAsRequestDto } from "@novu/api/models/components"; + +let value: MessageMarkAsRequestDto = { + messageId: [ + "", + ], + markAs: "unread", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------ | +| `messageId` | *components.MessageId* | :heavy_check_mark: | N/A | +| `markAs` | [components.MarkAs](../../models/components/markas.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/messageresponsedto.md b/docs/models/components/messageresponsedto.md new file mode 100644 index 00000000..544b5ad3 --- /dev/null +++ b/docs/models/components/messageresponsedto.md @@ -0,0 +1,67 @@ +# MessageResponseDto + +## Example Usage + +```typescript +import { MessageResponseDto } from "@novu/api/models/components"; + +let value: MessageResponseDto = { + templateId: "", + environmentId: "", + messageTemplateId: "", + organizationId: "", + notificationId: "", + subscriberId: "", + createdAt: "", + content: "", + transactionId: "", + channel: "sms", + read: false, + seen: false, + cta: { + data: {}, + }, + status: "error", + errorId: "", + errorText: "", + payload: {}, + overrides: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `templateId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `messageTemplateId` | *string* | :heavy_check_mark: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `notificationId` | *string* | :heavy_check_mark: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `subscriber` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md) | :heavy_minus_sign: | N/A | +| `template` | [components.WorkflowResponse](../../models/components/workflowresponse.md) | :heavy_minus_sign: | N/A | +| `templateIdentifier` | *string* | :heavy_minus_sign: | N/A | +| `createdAt` | *string* | :heavy_check_mark: | N/A | +| `lastSeenDate` | *string* | :heavy_minus_sign: | N/A | +| `lastReadDate` | *string* | :heavy_minus_sign: | N/A | +| `content` | *components.Content* | :heavy_check_mark: | N/A | +| `transactionId` | *string* | :heavy_check_mark: | N/A | +| `subject` | *string* | :heavy_minus_sign: | N/A | +| `channel` | [components.MessageResponseDtoChannel](../../models/components/messageresponsedtochannel.md) | :heavy_check_mark: | N/A | +| `read` | *boolean* | :heavy_check_mark: | N/A | +| `seen` | *boolean* | :heavy_check_mark: | N/A | +| `email` | *string* | :heavy_minus_sign: | N/A | +| `phone` | *string* | :heavy_minus_sign: | N/A | +| `directWebhookUrl` | *string* | :heavy_minus_sign: | N/A | +| `providerId` | *string* | :heavy_minus_sign: | N/A | +| `deviceTokens` | *string*[] | :heavy_minus_sign: | N/A | +| `title` | *string* | :heavy_minus_sign: | N/A | +| `cta` | [components.MessageCTA](../../models/components/messagecta.md) | :heavy_check_mark: | N/A | +| `feedId` | [components.FeedId](../../models/components/feedid.md) | :heavy_minus_sign: | N/A | +| `status` | [components.MessageResponseDtoStatus](../../models/components/messageresponsedtostatus.md) | :heavy_check_mark: | N/A | +| `errorId` | *string* | :heavy_check_mark: | N/A | +| `errorText` | *string* | :heavy_check_mark: | N/A | +| `payload` | [components.MessageResponseDtoPayload](../../models/components/messageresponsedtopayload.md) | :heavy_check_mark: | The payload that was used to send the notification trigger | +| `overrides` | [components.MessageResponseDtoOverrides](../../models/components/messageresponsedtooverrides.md) | :heavy_check_mark: | Provider specific overrides used when triggering the notification | \ No newline at end of file diff --git a/docs/models/components/messageresponsedtochannel.md b/docs/models/components/messageresponsedtochannel.md new file mode 100644 index 00000000..1e367bec --- /dev/null +++ b/docs/models/components/messageresponsedtochannel.md @@ -0,0 +1,15 @@ +# MessageResponseDtoChannel + +## Example Usage + +```typescript +import { MessageResponseDtoChannel } from "@novu/api/models/components"; + +let value: MessageResponseDtoChannel = "sms"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/components/messageresponsedtooverrides.md b/docs/models/components/messageresponsedtooverrides.md new file mode 100644 index 00000000..f8131ed8 --- /dev/null +++ b/docs/models/components/messageresponsedtooverrides.md @@ -0,0 +1,16 @@ +# MessageResponseDtoOverrides + +Provider specific overrides used when triggering the notification + +## Example Usage + +```typescript +import { MessageResponseDtoOverrides } from "@novu/api/models/components"; + +let value: MessageResponseDtoOverrides = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/messageresponsedtopayload.md b/docs/models/components/messageresponsedtopayload.md new file mode 100644 index 00000000..cee9625c --- /dev/null +++ b/docs/models/components/messageresponsedtopayload.md @@ -0,0 +1,16 @@ +# MessageResponseDtoPayload + +The payload that was used to send the notification trigger + +## Example Usage + +```typescript +import { MessageResponseDtoPayload } from "@novu/api/models/components"; + +let value: MessageResponseDtoPayload = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/messageresponsedtostatus.md b/docs/models/components/messageresponsedtostatus.md new file mode 100644 index 00000000..d2a8d2eb --- /dev/null +++ b/docs/models/components/messageresponsedtostatus.md @@ -0,0 +1,15 @@ +# MessageResponseDtoStatus + +## Example Usage + +```typescript +import { MessageResponseDtoStatus } from "@novu/api/models/components"; + +let value: MessageResponseDtoStatus = "warning"; +``` + +## Values + +```typescript +"sent" | "error" | "warning" +``` \ No newline at end of file diff --git a/docs/models/components/messagetemplate.md b/docs/models/components/messagetemplate.md new file mode 100644 index 00000000..cb701122 --- /dev/null +++ b/docs/models/components/messagetemplate.md @@ -0,0 +1,14 @@ +# MessageTemplate + +## Example Usage + +```typescript +import { MessageTemplate } from "@novu/api/models/components"; + +let value: MessageTemplate = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/metadata.md b/docs/models/components/metadata.md new file mode 100644 index 00000000..d4991d52 --- /dev/null +++ b/docs/models/components/metadata.md @@ -0,0 +1,38 @@ +# Metadata + + +## Supported Types + +### `components.DigestRegularMetadata` + +```typescript +const value: components.DigestRegularMetadata = { + type: "backoff", +}; +``` + +### `components.DigestTimedMetadata` + +```typescript +const value: components.DigestTimedMetadata = { + type: "timed", +}; +``` + +### `components.DelayRegularMetadata` + +```typescript +const value: components.DelayRegularMetadata = { + type: "regular", +}; +``` + +### `components.DelayScheduledMetadata` + +```typescript +const value: components.DelayScheduledMetadata = { + type: "scheduled", + delayPath: "", +}; +``` + diff --git a/docs/models/components/monthlytype.md b/docs/models/components/monthlytype.md new file mode 100644 index 00000000..8b6ac551 --- /dev/null +++ b/docs/models/components/monthlytype.md @@ -0,0 +1,15 @@ +# MonthlyType + +## Example Usage + +```typescript +import { MonthlyType } from "@novu/api/models/components"; + +let value: MonthlyType = "on"; +``` + +## Values + +```typescript +"each" | "on" +``` \ No newline at end of file diff --git a/docs/models/components/notificationgroup.md b/docs/models/components/notificationgroup.md new file mode 100644 index 00000000..da0294bb --- /dev/null +++ b/docs/models/components/notificationgroup.md @@ -0,0 +1,23 @@ +# NotificationGroup + +## Example Usage + +```typescript +import { NotificationGroup } from "@novu/api/models/components"; + +let value: NotificationGroup = { + name: "", + environmentId: "", + organizationId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `parentId` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/notificationgroupresponsedto.md b/docs/models/components/notificationgroupresponsedto.md new file mode 100644 index 00000000..55741489 --- /dev/null +++ b/docs/models/components/notificationgroupresponsedto.md @@ -0,0 +1,23 @@ +# NotificationGroupResponseDto + +## Example Usage + +```typescript +import { NotificationGroupResponseDto } from "@novu/api/models/components"; + +let value: NotificationGroupResponseDto = { + name: "", + environmentId: "", + organizationId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `parentId` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/notificationstep.md b/docs/models/components/notificationstep.md new file mode 100644 index 00000000..5cab470b --- /dev/null +++ b/docs/models/components/notificationstep.md @@ -0,0 +1,26 @@ +# NotificationStep + +## Example Usage + +```typescript +import { NotificationStep } from "@novu/api/models/components"; + +let value: NotificationStep = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `uuid` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_minus_sign: | N/A | +| `templateId` | *string* | :heavy_minus_sign: | N/A | +| `active` | *boolean* | :heavy_minus_sign: | N/A | +| `shouldStopOnFail` | *boolean* | :heavy_minus_sign: | N/A | +| `template` | [components.MessageTemplate](../../models/components/messagetemplate.md) | :heavy_minus_sign: | N/A | +| `filters` | [components.StepFilter](../../models/components/stepfilter.md)[] | :heavy_minus_sign: | N/A | +| `parentId` | [components.ParentId](../../models/components/parentid.md) | :heavy_minus_sign: | N/A | +| `metadata` | *components.Metadata* | :heavy_minus_sign: | N/A | +| `replyCallback` | [components.ReplyCallback](../../models/components/replycallback.md) | :heavy_minus_sign: | N/A | +| `variants` | [components.NotificationStepVariant](../../models/components/notificationstepvariant.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/notificationstepvariant.md b/docs/models/components/notificationstepvariant.md new file mode 100644 index 00000000..cfb4d749 --- /dev/null +++ b/docs/models/components/notificationstepvariant.md @@ -0,0 +1,25 @@ +# NotificationStepVariant + +## Example Usage + +```typescript +import { NotificationStepVariant } from "@novu/api/models/components"; + +let value: NotificationStepVariant = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `uuid` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_minus_sign: | N/A | +| `templateId` | *string* | :heavy_minus_sign: | N/A | +| `active` | *boolean* | :heavy_minus_sign: | N/A | +| `shouldStopOnFail` | *boolean* | :heavy_minus_sign: | N/A | +| `template` | [components.MessageTemplate](../../models/components/messagetemplate.md) | :heavy_minus_sign: | N/A | +| `filters` | [components.StepFilter](../../models/components/stepfilter.md)[] | :heavy_minus_sign: | N/A | +| `parentId` | [components.NotificationStepVariantParentId](../../models/components/notificationstepvariantparentid.md) | :heavy_minus_sign: | N/A | +| `metadata` | *components.NotificationStepVariantMetadata* | :heavy_minus_sign: | N/A | +| `replyCallback` | [components.NotificationStepVariantReplyCallback](../../models/components/notificationstepvariantreplycallback.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/notificationstepvariantmetadata.md b/docs/models/components/notificationstepvariantmetadata.md new file mode 100644 index 00000000..bcea460c --- /dev/null +++ b/docs/models/components/notificationstepvariantmetadata.md @@ -0,0 +1,38 @@ +# NotificationStepVariantMetadata + + +## Supported Types + +### `components.DigestRegularMetadata` + +```typescript +const value: components.DigestRegularMetadata = { + type: "backoff", +}; +``` + +### `components.DigestTimedMetadata` + +```typescript +const value: components.DigestTimedMetadata = { + type: "timed", +}; +``` + +### `components.DelayRegularMetadata` + +```typescript +const value: components.DelayRegularMetadata = { + type: "regular", +}; +``` + +### `components.DelayScheduledMetadata` + +```typescript +const value: components.DelayScheduledMetadata = { + type: "scheduled", + delayPath: "", +}; +``` + diff --git a/docs/models/components/notificationstepvariantparentid.md b/docs/models/components/notificationstepvariantparentid.md new file mode 100644 index 00000000..9a182149 --- /dev/null +++ b/docs/models/components/notificationstepvariantparentid.md @@ -0,0 +1,14 @@ +# NotificationStepVariantParentId + +## Example Usage + +```typescript +import { NotificationStepVariantParentId } from "@novu/api/models/components"; + +let value: NotificationStepVariantParentId = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/notificationstepvariantreplycallback.md b/docs/models/components/notificationstepvariantreplycallback.md new file mode 100644 index 00000000..8ab047a7 --- /dev/null +++ b/docs/models/components/notificationstepvariantreplycallback.md @@ -0,0 +1,14 @@ +# NotificationStepVariantReplyCallback + +## Example Usage + +```typescript +import { NotificationStepVariantReplyCallback } from "@novu/api/models/components"; + +let value: NotificationStepVariantReplyCallback = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/notificationtrigger.md b/docs/models/components/notificationtrigger.md new file mode 100644 index 00000000..d15253f7 --- /dev/null +++ b/docs/models/components/notificationtrigger.md @@ -0,0 +1,26 @@ +# NotificationTrigger + +## Example Usage + +```typescript +import { NotificationTrigger } from "@novu/api/models/components"; + +let value: NotificationTrigger = { + type: "event", + identifier: "", + variables: [ + { + name: "", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `type` | [components.NotificationTriggerType](../../models/components/notificationtriggertype.md) | :heavy_check_mark: | N/A | +| `identifier` | *string* | :heavy_check_mark: | N/A | +| `variables` | [components.NotificationTriggerVariable](../../models/components/notificationtriggervariable.md)[] | :heavy_check_mark: | N/A | +| `subscriberVariables` | [components.NotificationTriggerVariable](../../models/components/notificationtriggervariable.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/notificationtriggertype.md b/docs/models/components/notificationtriggertype.md new file mode 100644 index 00000000..e8715b58 --- /dev/null +++ b/docs/models/components/notificationtriggertype.md @@ -0,0 +1,15 @@ +# NotificationTriggerType + +## Example Usage + +```typescript +import { NotificationTriggerType } from "@novu/api/models/components"; + +let value: NotificationTriggerType = "event"; +``` + +## Values + +```typescript +"event" +``` \ No newline at end of file diff --git a/docs/models/components/notificationtriggervariable.md b/docs/models/components/notificationtriggervariable.md new file mode 100644 index 00000000..4bca567c --- /dev/null +++ b/docs/models/components/notificationtriggervariable.md @@ -0,0 +1,17 @@ +# NotificationTriggerVariable + +## Example Usage + +```typescript +import { NotificationTriggerVariable } from "@novu/api/models/components"; + +let value: NotificationTriggerVariable = { + name: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `name` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/on.md b/docs/models/components/on.md new file mode 100644 index 00000000..3f67d3c1 --- /dev/null +++ b/docs/models/components/on.md @@ -0,0 +1,15 @@ +# On + +## Example Usage + +```typescript +import { On } from "@novu/api/models/components"; + +let value: On = "payload"; +``` + +## Values + +```typescript +"subscriber" | "payload" +``` \ No newline at end of file diff --git a/docs/models/components/operator.md b/docs/models/components/operator.md new file mode 100644 index 00000000..4d9a5b40 --- /dev/null +++ b/docs/models/components/operator.md @@ -0,0 +1,15 @@ +# Operator + +## Example Usage + +```typescript +import { Operator } from "@novu/api/models/components"; + +let value: Operator = "NOT_IN"; +``` + +## Values + +```typescript +"LARGER" | "SMALLER" | "LARGER_EQUAL" | "SMALLER_EQUAL" | "EQUAL" | "NOT_EQUAL" | "ALL_IN" | "ANY_IN" | "NOT_IN" | "BETWEEN" | "NOT_BETWEEN" | "LIKE" | "NOT_LIKE" | "IN" +``` \ No newline at end of file diff --git a/docs/models/components/ordinal.md b/docs/models/components/ordinal.md new file mode 100644 index 00000000..d30ab30d --- /dev/null +++ b/docs/models/components/ordinal.md @@ -0,0 +1,15 @@ +# Ordinal + +## Example Usage + +```typescript +import { Ordinal } from "@novu/api/models/components"; + +let value: Ordinal = "2"; +``` + +## Values + +```typescript +"1" | "2" | "3" | "4" | "5" | "last" +``` \ No newline at end of file diff --git a/docs/models/components/ordinalvalue.md b/docs/models/components/ordinalvalue.md new file mode 100644 index 00000000..31c73e0b --- /dev/null +++ b/docs/models/components/ordinalvalue.md @@ -0,0 +1,15 @@ +# OrdinalValue + +## Example Usage + +```typescript +import { OrdinalValue } from "@novu/api/models/components"; + +let value: OrdinalValue = "saturday"; +``` + +## Values + +```typescript +"day" | "weekday" | "weekend" | "sunday" | "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" +``` \ No newline at end of file diff --git a/docs/models/components/overrides.md b/docs/models/components/overrides.md new file mode 100644 index 00000000..99d8c8be --- /dev/null +++ b/docs/models/components/overrides.md @@ -0,0 +1,16 @@ +# Overrides + +This could be used to override provider specific configurations + +## Example Usage + +```typescript +import { Overrides } from "@novu/api/models/components"; + +let value: Overrides = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/parentid.md b/docs/models/components/parentid.md new file mode 100644 index 00000000..8c641363 --- /dev/null +++ b/docs/models/components/parentid.md @@ -0,0 +1,14 @@ +# ParentId + +## Example Usage + +```typescript +import { ParentId } from "@novu/api/models/components"; + +let value: ParentId = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/payload.md b/docs/models/components/payload.md new file mode 100644 index 00000000..0d201d57 --- /dev/null +++ b/docs/models/components/payload.md @@ -0,0 +1,17 @@ +# Payload + +The payload object is used to pass additional custom information that could be used to render the workflow, or perform routing rules based on it. + This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. + +## Example Usage + +```typescript +import { Payload } from "@novu/api/models/components"; + +let value: Payload = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/preference.md b/docs/models/components/preference.md new file mode 100644 index 00000000..3d3470b3 --- /dev/null +++ b/docs/models/components/preference.md @@ -0,0 +1,19 @@ +# Preference + +## Example Usage + +```typescript +import { Preference } from "@novu/api/models/components"; + +let value: Preference = { + enabled: false, + channels: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `enabled` | *boolean* | :heavy_check_mark: | Sets if the workflow is fully enabled for all channels or not for the subscriber. | +| `channels` | [components.PreferenceChannels](../../models/components/preferencechannels.md) | :heavy_check_mark: | Subscriber preferences for the different channels regarding this workflow | \ No newline at end of file diff --git a/docs/models/components/preferencechannels.md b/docs/models/components/preferencechannels.md new file mode 100644 index 00000000..f6df176a --- /dev/null +++ b/docs/models/components/preferencechannels.md @@ -0,0 +1,19 @@ +# PreferenceChannels + +## Example Usage + +```typescript +import { PreferenceChannels } from "@novu/api/models/components"; + +let value: PreferenceChannels = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `email` | *boolean* | :heavy_minus_sign: | N/A | +| `sms` | *boolean* | :heavy_minus_sign: | N/A | +| `inApp` | *boolean* | :heavy_minus_sign: | N/A | +| `chat` | *boolean* | :heavy_minus_sign: | N/A | +| `push` | *boolean* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/providerid.md b/docs/models/components/providerid.md new file mode 100644 index 00000000..d9bbdbd0 --- /dev/null +++ b/docs/models/components/providerid.md @@ -0,0 +1,17 @@ +# ProviderId + +The provider identifier for the credentials + +## Example Usage + +```typescript +import { ProviderId } from "@novu/api/models/components"; + +let value: ProviderId = "ryver"; +``` + +## Values + +```typescript +"slack" | "discord" | "msteams" | "mattermost" | "ryver" | "zulip" | "grafana-on-call" | "getstream" | "rocket-chat" | "whatsapp-business" | "fcm" | "apns" | "expo" | "one-signal" | "pushpad" | "push-webhook" | "pusher-beams" +``` \ No newline at end of file diff --git a/docs/models/components/removesubscribersrequestdto.md b/docs/models/components/removesubscribersrequestdto.md new file mode 100644 index 00000000..6378417e --- /dev/null +++ b/docs/models/components/removesubscribersrequestdto.md @@ -0,0 +1,19 @@ +# RemoveSubscribersRequestDto + +## Example Usage + +```typescript +import { RemoveSubscribersRequestDto } from "@novu/api/models/components"; + +let value: RemoveSubscribersRequestDto = { + subscribers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | +| `subscribers` | *string*[] | :heavy_check_mark: | List of subscriber identifiers that will be removed to the topic | \ No newline at end of file diff --git a/docs/models/components/renametopicrequestdto.md b/docs/models/components/renametopicrequestdto.md new file mode 100644 index 00000000..7e0ec720 --- /dev/null +++ b/docs/models/components/renametopicrequestdto.md @@ -0,0 +1,17 @@ +# RenameTopicRequestDto + +## Example Usage + +```typescript +import { RenameTopicRequestDto } from "@novu/api/models/components"; + +let value: RenameTopicRequestDto = { + name: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `name` | *string* | :heavy_check_mark: | User defined custom name and provided by the user to rename the topic. | \ No newline at end of file diff --git a/docs/models/components/renametopicresponsedto.md b/docs/models/components/renametopicresponsedto.md new file mode 100644 index 00000000..2e200baf --- /dev/null +++ b/docs/models/components/renametopicresponsedto.md @@ -0,0 +1,28 @@ +# RenameTopicResponseDto + +## Example Usage + +```typescript +import { RenameTopicResponseDto } from "@novu/api/models/components"; + +let value: RenameTopicResponseDto = { + organizationId: "", + environmentId: "", + key: "", + name: "", + subscribers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `key` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `subscribers` | *string*[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/replycallback.md b/docs/models/components/replycallback.md new file mode 100644 index 00000000..e23aabc6 --- /dev/null +++ b/docs/models/components/replycallback.md @@ -0,0 +1,14 @@ +# ReplyCallback + +## Example Usage + +```typescript +import { ReplyCallback } from "@novu/api/models/components"; + +let value: ReplyCallback = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/security.md b/docs/models/components/security.md new file mode 100644 index 00000000..59a810c2 --- /dev/null +++ b/docs/models/components/security.md @@ -0,0 +1,17 @@ +# Security + +## Example Usage + +```typescript +import { Security } from "@novu/api/models/components"; + +let value: Security = { + apiKey: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `apiKey` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/source.md b/docs/models/components/source.md new file mode 100644 index 00000000..cc43d1f7 --- /dev/null +++ b/docs/models/components/source.md @@ -0,0 +1,15 @@ +# Source + +## Example Usage + +```typescript +import { Source } from "@novu/api/models/components"; + +let value: Source = "Credentials"; +``` + +## Values + +```typescript +"Credentials" | "Internal" | "Payload" | "Webhook" +``` \ No newline at end of file diff --git a/docs/models/components/status.md b/docs/models/components/status.md new file mode 100644 index 00000000..37cc848a --- /dev/null +++ b/docs/models/components/status.md @@ -0,0 +1,15 @@ +# Status + +## Example Usage + +```typescript +import { Status } from "@novu/api/models/components"; + +let value: Status = "ReadConfirmation"; +``` + +## Values + +```typescript +"Success" | "Warning" | "Failed" | "Pending" | "Queued" | "ReadConfirmation" +``` \ No newline at end of file diff --git a/docs/models/components/stepfilter.md b/docs/models/components/stepfilter.md new file mode 100644 index 00000000..92ed9d29 --- /dev/null +++ b/docs/models/components/stepfilter.md @@ -0,0 +1,30 @@ +# StepFilter + +## Example Usage + +```typescript +import { StepFilter } from "@novu/api/models/components"; + +let value: StepFilter = { + isNegated: false, + type: "STATEMENT", + value: "AND", + children: [ + { + field: "", + value: "", + operator: "ANY_IN", + on: "subscriber", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `isNegated` | *boolean* | :heavy_check_mark: | N/A | +| `type` | [components.StepFilterType](../../models/components/stepfiltertype.md) | :heavy_check_mark: | N/A | +| `value` | [components.Value](../../models/components/value.md) | :heavy_check_mark: | N/A | +| `children` | [components.FieldFilterPart](../../models/components/fieldfilterpart.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/stepfiltertype.md b/docs/models/components/stepfiltertype.md new file mode 100644 index 00000000..ace94e10 --- /dev/null +++ b/docs/models/components/stepfiltertype.md @@ -0,0 +1,15 @@ +# StepFilterType + +## Example Usage + +```typescript +import { StepFilterType } from "@novu/api/models/components"; + +let value: StepFilterType = "BOOLEAN"; +``` + +## Values + +```typescript +"BOOLEAN" | "TEXT" | "DATE" | "NUMBER" | "STATEMENT" | "LIST" | "MULTI_LIST" | "GROUP" +``` \ No newline at end of file diff --git a/docs/models/components/subscriberpayloaddto.md b/docs/models/components/subscriberpayloaddto.md new file mode 100644 index 00000000..d8af3779 --- /dev/null +++ b/docs/models/components/subscriberpayloaddto.md @@ -0,0 +1,25 @@ +# SubscriberPayloadDto + +## Example Usage + +```typescript +import { SubscriberPayloadDto } from "@novu/api/models/components"; + +let value: SubscriberPayloadDto = { + subscriberId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems | +| `email` | *string* | :heavy_minus_sign: | N/A | +| `firstName` | *string* | :heavy_minus_sign: | N/A | +| `lastName` | *string* | :heavy_minus_sign: | N/A | +| `phone` | *string* | :heavy_minus_sign: | N/A | +| `avatar` | *string* | :heavy_minus_sign: | An http url to the profile image of your subscriber | +| `locale` | *string* | :heavy_minus_sign: | N/A | +| `data` | [components.Data](../../models/components/data.md) | :heavy_minus_sign: | N/A | +| `channels` | *string*[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/subscriberresponsedto.md b/docs/models/components/subscriberresponsedto.md new file mode 100644 index 00000000..c42f918e --- /dev/null +++ b/docs/models/components/subscriberresponsedto.md @@ -0,0 +1,39 @@ +# SubscriberResponseDto + +## Example Usage + +```typescript +import { SubscriberResponseDto } from "@novu/api/models/components"; + +let value: SubscriberResponseDto = { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | The internal id novu generated for your subscriber, this is not the subscriberId matching your query. See `subscriberId` for that | +| `firstName` | *string* | :heavy_minus_sign: | N/A | +| `lastName` | *string* | :heavy_minus_sign: | N/A | +| `email` | *string* | :heavy_minus_sign: | N/A | +| `phone` | *string* | :heavy_minus_sign: | N/A | +| `avatar` | *string* | :heavy_minus_sign: | N/A | +| `locale` | *string* | :heavy_minus_sign: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems | +| `channels` | [components.ChannelSettings](../../models/components/channelsettings.md)[] | :heavy_minus_sign: | Channels settings for subscriber | +| `topics` | *string*[] | :heavy_minus_sign: | Topics that subscriber belongs to | +| `isOnline` | *boolean* | :heavy_minus_sign: | N/A | +| `lastOnlineAt` | *string* | :heavy_minus_sign: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `deleted` | *boolean* | :heavy_check_mark: | N/A | +| `createdAt` | *string* | :heavy_check_mark: | N/A | +| `updatedAt` | *string* | :heavy_check_mark: | N/A | +| `v` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/templateresponse.md b/docs/models/components/templateresponse.md new file mode 100644 index 00000000..b7db0638 --- /dev/null +++ b/docs/models/components/templateresponse.md @@ -0,0 +1,25 @@ +# TemplateResponse + +## Example Usage + +```typescript +import { TemplateResponse } from "@novu/api/models/components"; + +let value: TemplateResponse = { + id: "", + name: "", + critical: false, + triggers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_check_mark: | Unique identifier of the workflow | +| `name` | *string* | :heavy_check_mark: | Name of the workflow | +| `critical` | *boolean* | :heavy_check_mark: | Critical templates will always be delivered to the end user and should be hidden from the subscriber preferences screen | +| `triggers` | *string*[] | :heavy_check_mark: | Triggers are the events that will trigger the workflow. | \ No newline at end of file diff --git a/docs/models/components/tenant.md b/docs/models/components/tenant.md new file mode 100644 index 00000000..41d67814 --- /dev/null +++ b/docs/models/components/tenant.md @@ -0,0 +1,21 @@ +# Tenant + +It is used to specify a tenant context during trigger event. + Existing tenants will be updated with the provided details. + + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `components.TenantPayloadDto` + +```typescript +const value: components.TenantPayloadDto = {}; +``` + diff --git a/docs/models/components/tenantpayloaddto.md b/docs/models/components/tenantpayloaddto.md new file mode 100644 index 00000000..661d9a83 --- /dev/null +++ b/docs/models/components/tenantpayloaddto.md @@ -0,0 +1,17 @@ +# TenantPayloadDto + +## Example Usage + +```typescript +import { TenantPayloadDto } from "@novu/api/models/components"; + +let value: TenantPayloadDto = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| `identifier` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_minus_sign: | N/A | +| `data` | [components.TenantPayloadDtoData](../../models/components/tenantpayloaddtodata.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/tenantpayloaddtodata.md b/docs/models/components/tenantpayloaddtodata.md new file mode 100644 index 00000000..04522a7e --- /dev/null +++ b/docs/models/components/tenantpayloaddtodata.md @@ -0,0 +1,14 @@ +# TenantPayloadDtoData + +## Example Usage + +```typescript +import { TenantPayloadDtoData } from "@novu/api/models/components"; + +let value: TenantPayloadDtoData = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/textalign.md b/docs/models/components/textalign.md new file mode 100644 index 00000000..aa50769d --- /dev/null +++ b/docs/models/components/textalign.md @@ -0,0 +1,15 @@ +# TextAlign + +## Example Usage + +```typescript +import { TextAlign } from "@novu/api/models/components"; + +let value: TextAlign = "center"; +``` + +## Values + +```typescript +"center" | "left" | "right" +``` \ No newline at end of file diff --git a/docs/models/components/timedconfig.md b/docs/models/components/timedconfig.md new file mode 100644 index 00000000..201d9d7e --- /dev/null +++ b/docs/models/components/timedconfig.md @@ -0,0 +1,20 @@ +# TimedConfig + +## Example Usage + +```typescript +import { TimedConfig } from "@novu/api/models/components"; + +let value: TimedConfig = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `atTime` | *string* | :heavy_minus_sign: | N/A | +| `weekDays` | [components.WeekDays](../../models/components/weekdays.md)[] | :heavy_minus_sign: | N/A | +| `monthDays` | *string*[] | :heavy_minus_sign: | N/A | +| `ordinal` | [components.Ordinal](../../models/components/ordinal.md) | :heavy_minus_sign: | N/A | +| `ordinalValue` | [components.OrdinalValue](../../models/components/ordinalvalue.md) | :heavy_minus_sign: | N/A | +| `monthlyType` | [components.MonthlyType](../../models/components/monthlytype.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/tlsoptions.md b/docs/models/components/tlsoptions.md new file mode 100644 index 00000000..a0471566 --- /dev/null +++ b/docs/models/components/tlsoptions.md @@ -0,0 +1,14 @@ +# TlsOptions + +## Example Usage + +```typescript +import { TlsOptions } from "@novu/api/models/components"; + +let value: TlsOptions = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/to.md b/docs/models/components/to.md new file mode 100644 index 00000000..6a16d8b4 --- /dev/null +++ b/docs/models/components/to.md @@ -0,0 +1,28 @@ +# To + + +## Supported Types + +### `components.SubscriberPayloadDto` + +```typescript +const value: components.SubscriberPayloadDto = { + subscriberId: "", +}; +``` + +### `string` + +```typescript +const value: string = "SUBSCRIBER_ID"; +``` + +### `components.TopicPayloadDto` + +```typescript +const value: components.TopicPayloadDto = { + topicKey: "", + type: "Topic", +}; +``` + diff --git a/docs/models/components/topicdto.md b/docs/models/components/topicdto.md new file mode 100644 index 00000000..5bfda316 --- /dev/null +++ b/docs/models/components/topicdto.md @@ -0,0 +1,28 @@ +# TopicDto + +## Example Usage + +```typescript +import { TopicDto } from "@novu/api/models/components"; + +let value: TopicDto = { + organizationId: "", + environmentId: "", + key: "", + name: "", + subscribers: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `key` | *string* | :heavy_check_mark: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `subscribers` | *string*[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/topicpayloaddto.md b/docs/models/components/topicpayloaddto.md new file mode 100644 index 00000000..030a93e5 --- /dev/null +++ b/docs/models/components/topicpayloaddto.md @@ -0,0 +1,19 @@ +# TopicPayloadDto + +## Example Usage + +```typescript +import { TopicPayloadDto } from "@novu/api/models/components"; + +let value: TopicPayloadDto = { + topicKey: "", + type: "Topic", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `topicKey` | *string* | :heavy_check_mark: | N/A | | +| `type` | [components.Type](../../models/components/type.md) | :heavy_check_mark: | N/A | Topic | \ No newline at end of file diff --git a/docs/models/components/topicsubscriberdto.md b/docs/models/components/topicsubscriberdto.md new file mode 100644 index 00000000..99c8f9b0 --- /dev/null +++ b/docs/models/components/topicsubscriberdto.md @@ -0,0 +1,27 @@ +# TopicSubscriberDto + +## Example Usage + +```typescript +import { TopicSubscriberDto } from "@novu/api/models/components"; + +let value: TopicSubscriberDto = { + organizationId: "", + environmentId: "", + subscriberId: "", + topicId: "", + topicKey: "", + externalSubscriberId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------- | ---------------------- | ---------------------- | ---------------------- | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `topicId` | *string* | :heavy_check_mark: | N/A | +| `topicKey` | *string* | :heavy_check_mark: | N/A | +| `externalSubscriberId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/triggereventrequestdto.md b/docs/models/components/triggereventrequestdto.md new file mode 100644 index 00000000..f852e4c2 --- /dev/null +++ b/docs/models/components/triggereventrequestdto.md @@ -0,0 +1,32 @@ +# TriggerEventRequestDto + +## Example Usage + +```typescript +import { TriggerEventRequestDto } from "@novu/api/models/components"; + +let value: TriggerEventRequestDto = { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + subscriberId: "", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *string* | :heavy_check_mark: | The trigger identifier of the workflow you wish to send. This identifier can be found on the workflow page. | workflow_identifier | +| `payload` | [components.Payload](../../models/components/payload.md) | :heavy_minus_sign: | The payload object is used to pass additional custom information that could be used to render the workflow, or perform routing rules based on it.
This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. | {
"comment_id": "string",
"post": {
"text": "string"
}
} | +| `overrides` | [components.Overrides](../../models/components/overrides.md) | :heavy_minus_sign: | This could be used to override provider specific configurations | {
"fcm": {
"data": {
"key": "value"
}
}
} | +| `to` | *components.To*[] | :heavy_check_mark: | The recipients list of people who will receive the notification. | | +| `transactionId` | *string* | :heavy_minus_sign: | A unique identifier for this transaction, we will generated a UUID if not provided. | | +| `actor` | *components.Actor* | :heavy_minus_sign: | It is used to display the Avatar of the provided actor's subscriber id or actor object.
If a new actor object is provided, we will create a new subscriber in our system
| | +| `tenant` | *components.Tenant* | :heavy_minus_sign: | It is used to specify a tenant context during trigger event.
Existing tenants will be updated with the provided details.
| | +| `bridgeUrl` | *string* | :heavy_minus_sign: | N/A | | +| `controls` | [components.Controls](../../models/components/controls.md) | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/components/triggereventresponsedto.md b/docs/models/components/triggereventresponsedto.md new file mode 100644 index 00000000..89c9af1b --- /dev/null +++ b/docs/models/components/triggereventresponsedto.md @@ -0,0 +1,21 @@ +# TriggerEventResponseDto + +## Example Usage + +```typescript +import { TriggerEventResponseDto } from "@novu/api/models/components"; + +let value: TriggerEventResponseDto = { + acknowledged: false, + status: "error", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `acknowledged` | *boolean* | :heavy_check_mark: | If trigger was acknowledged or not | +| `status` | [components.TriggerEventResponseDtoStatus](../../models/components/triggereventresponsedtostatus.md) | :heavy_check_mark: | Status for trigger | +| `error` | *string*[] | :heavy_minus_sign: | In case of an error, this field will contain the error message | +| `transactionId` | *string* | :heavy_minus_sign: | Transaction id for trigger | \ No newline at end of file diff --git a/docs/models/components/triggereventresponsedtostatus.md b/docs/models/components/triggereventresponsedtostatus.md new file mode 100644 index 00000000..548b3edd --- /dev/null +++ b/docs/models/components/triggereventresponsedtostatus.md @@ -0,0 +1,17 @@ +# TriggerEventResponseDtoStatus + +Status for trigger + +## Example Usage + +```typescript +import { TriggerEventResponseDtoStatus } from "@novu/api/models/components"; + +let value: TriggerEventResponseDtoStatus = "processed"; +``` + +## Values + +```typescript +"error" | "trigger_not_active" | "no_workflow_active_steps_defined" | "no_workflow_steps_defined" | "processed" | "subscriber_id_missing" | "no_tenant_found" +``` \ No newline at end of file diff --git a/docs/models/components/triggereventtoallrequestdto.md b/docs/models/components/triggereventtoallrequestdto.md new file mode 100644 index 00000000..393033e9 --- /dev/null +++ b/docs/models/components/triggereventtoallrequestdto.md @@ -0,0 +1,24 @@ +# TriggerEventToAllRequestDto + +## Example Usage + +```typescript +import { TriggerEventToAllRequestDto } from "@novu/api/models/components"; + +let value: TriggerEventToAllRequestDto = { + name: "", + payload: {}, + overrides: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `name` | *string* | :heavy_check_mark: | The trigger identifier associated for the template you wish to send. This identifier can be found on the template page. | | +| `payload` | [components.TriggerEventToAllRequestDtoPayload](../../models/components/triggereventtoallrequestdtopayload.md) | :heavy_check_mark: | The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it.
This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. | {
"comment_id": "string",
"post": {
"text": "string"
}
} | +| `overrides` | [components.TriggerEventToAllRequestDtoOverrides](../../models/components/triggereventtoallrequestdtooverrides.md) | :heavy_minus_sign: | This could be used to override provider specific configurations | {
"fcm": {
"data": {
"key": "value"
}
}
} | +| `transactionId` | *string* | :heavy_minus_sign: | A unique identifier for this transaction, we will generated a UUID if not provided. | | +| `actor` | *components.TriggerEventToAllRequestDtoActor* | :heavy_minus_sign: | It is used to display the Avatar of the provided actor's subscriber id or actor object.
If a new actor object is provided, we will create a new subscriber in our system
| | +| `tenant` | *components.TriggerEventToAllRequestDtoTenant* | :heavy_minus_sign: | It is used to specify a tenant context during trigger event.
If a new tenant object is provided, we will create a new tenant.
| | \ No newline at end of file diff --git a/docs/models/components/triggereventtoallrequestdtoactor.md b/docs/models/components/triggereventtoallrequestdtoactor.md new file mode 100644 index 00000000..8eb237df --- /dev/null +++ b/docs/models/components/triggereventtoallrequestdtoactor.md @@ -0,0 +1,23 @@ +# TriggerEventToAllRequestDtoActor + +It is used to display the Avatar of the provided actor's subscriber id or actor object. + If a new actor object is provided, we will create a new subscriber in our system + + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `components.SubscriberPayloadDto` + +```typescript +const value: components.SubscriberPayloadDto = { + subscriberId: "", +}; +``` + diff --git a/docs/models/components/triggereventtoallrequestdtooverrides.md b/docs/models/components/triggereventtoallrequestdtooverrides.md new file mode 100644 index 00000000..89918b67 --- /dev/null +++ b/docs/models/components/triggereventtoallrequestdtooverrides.md @@ -0,0 +1,16 @@ +# TriggerEventToAllRequestDtoOverrides + +This could be used to override provider specific configurations + +## Example Usage + +```typescript +import { TriggerEventToAllRequestDtoOverrides } from "@novu/api/models/components"; + +let value: TriggerEventToAllRequestDtoOverrides = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/triggereventtoallrequestdtopayload.md b/docs/models/components/triggereventtoallrequestdtopayload.md new file mode 100644 index 00000000..70baab8a --- /dev/null +++ b/docs/models/components/triggereventtoallrequestdtopayload.md @@ -0,0 +1,17 @@ +# TriggerEventToAllRequestDtoPayload + +The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. + This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. + +## Example Usage + +```typescript +import { TriggerEventToAllRequestDtoPayload } from "@novu/api/models/components"; + +let value: TriggerEventToAllRequestDtoPayload = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/triggereventtoallrequestdtotenant.md b/docs/models/components/triggereventtoallrequestdtotenant.md new file mode 100644 index 00000000..c7d3d28b --- /dev/null +++ b/docs/models/components/triggereventtoallrequestdtotenant.md @@ -0,0 +1,21 @@ +# TriggerEventToAllRequestDtoTenant + +It is used to specify a tenant context during trigger event. + If a new tenant object is provided, we will create a new tenant. + + + +## Supported Types + +### `string` + +```typescript +const value: string = ""; +``` + +### `components.TenantPayloadDto` + +```typescript +const value: components.TenantPayloadDto = {}; +``` + diff --git a/docs/models/components/type.md b/docs/models/components/type.md new file mode 100644 index 00000000..ffc431f7 --- /dev/null +++ b/docs/models/components/type.md @@ -0,0 +1,15 @@ +# Type + +## Example Usage + +```typescript +import { Type } from "@novu/api/models/components"; + +let value: Type = "Topic"; +``` + +## Values + +```typescript +"Subscriber" | "Topic" +``` \ No newline at end of file diff --git a/docs/models/components/unit.md b/docs/models/components/unit.md new file mode 100644 index 00000000..2d1fae4a --- /dev/null +++ b/docs/models/components/unit.md @@ -0,0 +1,15 @@ +# Unit + +## Example Usage + +```typescript +import { Unit } from "@novu/api/models/components"; + +let value: Unit = "days"; +``` + +## Values + +```typescript +"seconds" | "minutes" | "hours" | "days" | "weeks" | "months" +``` \ No newline at end of file diff --git a/docs/models/components/unseencountresponse.md b/docs/models/components/unseencountresponse.md new file mode 100644 index 00000000..0c18cc03 --- /dev/null +++ b/docs/models/components/unseencountresponse.md @@ -0,0 +1,17 @@ +# UnseenCountResponse + +## Example Usage + +```typescript +import { UnseenCountResponse } from "@novu/api/models/components"; + +let value: UnseenCountResponse = { + count: 8137.98, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `count` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/updateintegrationrequestdto.md b/docs/models/components/updateintegrationrequestdto.md new file mode 100644 index 00000000..a5db2b51 --- /dev/null +++ b/docs/models/components/updateintegrationrequestdto.md @@ -0,0 +1,22 @@ +# UpdateIntegrationRequestDto + +## Example Usage + +```typescript +import { UpdateIntegrationRequestDto } from "@novu/api/models/components"; + +let value: UpdateIntegrationRequestDto = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------- | +| `name` | *string* | :heavy_minus_sign: | N/A | +| `identifier` | *string* | :heavy_minus_sign: | N/A | +| `environmentId` | *string* | :heavy_minus_sign: | N/A | +| `active` | *boolean* | :heavy_minus_sign: | If the integration is active the validation on the credentials field will run | +| `credentials` | [components.CredentialsDto](../../models/components/credentialsdto.md) | :heavy_minus_sign: | N/A | +| `removeNovuBranding` | *boolean* | :heavy_minus_sign: | If true, the Novu branding will be removed from the Inbox component | +| `check` | *boolean* | :heavy_minus_sign: | N/A | +| `conditions` | [components.StepFilter](../../models/components/stepfilter.md)[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/updatesubscriberchannelrequestdto.md b/docs/models/components/updatesubscriberchannelrequestdto.md new file mode 100644 index 00000000..45d6f666 --- /dev/null +++ b/docs/models/components/updatesubscriberchannelrequestdto.md @@ -0,0 +1,22 @@ +# UpdateSubscriberChannelRequestDto + +## Example Usage + +```typescript +import { UpdateSubscriberChannelRequestDto } from "@novu/api/models/components"; + +let value: UpdateSubscriberChannelRequestDto = { + providerId: "whatsapp-business", + credentials: { + webhookUrl: "https://old-fashioned-deck.org", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `providerId` | [components.UpdateSubscriberChannelRequestDtoProviderId](../../models/components/updatesubscriberchannelrequestdtoproviderid.md) | :heavy_check_mark: | The provider identifier for the credentials | +| `integrationIdentifier` | *string* | :heavy_minus_sign: | The integration identifier | +| `credentials` | [components.ChannelCredentials](../../models/components/channelcredentials.md) | :heavy_check_mark: | Credentials payload for the specified provider | \ No newline at end of file diff --git a/docs/models/components/updatesubscriberchannelrequestdtoproviderid.md b/docs/models/components/updatesubscriberchannelrequestdtoproviderid.md new file mode 100644 index 00000000..78e8a2e8 --- /dev/null +++ b/docs/models/components/updatesubscriberchannelrequestdtoproviderid.md @@ -0,0 +1,17 @@ +# UpdateSubscriberChannelRequestDtoProviderId + +The provider identifier for the credentials + +## Example Usage + +```typescript +import { UpdateSubscriberChannelRequestDtoProviderId } from "@novu/api/models/components"; + +let value: UpdateSubscriberChannelRequestDtoProviderId = "ryver"; +``` + +## Values + +```typescript +"slack" | "discord" | "msteams" | "mattermost" | "ryver" | "zulip" | "grafana-on-call" | "getstream" | "rocket-chat" | "whatsapp-business" | "fcm" | "apns" | "expo" | "one-signal" | "pushpad" | "push-webhook" | "pusher-beams" +``` \ No newline at end of file diff --git a/docs/models/components/updatesubscriberglobalpreferencesrequestdto.md b/docs/models/components/updatesubscriberglobalpreferencesrequestdto.md new file mode 100644 index 00000000..3f65c6d8 --- /dev/null +++ b/docs/models/components/updatesubscriberglobalpreferencesrequestdto.md @@ -0,0 +1,16 @@ +# UpdateSubscriberGlobalPreferencesRequestDto + +## Example Usage + +```typescript +import { UpdateSubscriberGlobalPreferencesRequestDto } from "@novu/api/models/components"; + +let value: UpdateSubscriberGlobalPreferencesRequestDto = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `enabled` | *boolean* | :heavy_minus_sign: | Enable or disable the subscriber global preferences. | +| `preferences` | [components.ChannelPreference](../../models/components/channelpreference.md)[] | :heavy_minus_sign: | The subscriber global preferences for every ChannelTypeEnum. | \ No newline at end of file diff --git a/docs/models/components/updatesubscriberonlineflagrequestdto.md b/docs/models/components/updatesubscriberonlineflagrequestdto.md new file mode 100644 index 00000000..83061978 --- /dev/null +++ b/docs/models/components/updatesubscriberonlineflagrequestdto.md @@ -0,0 +1,17 @@ +# UpdateSubscriberOnlineFlagRequestDto + +## Example Usage + +```typescript +import { UpdateSubscriberOnlineFlagRequestDto } from "@novu/api/models/components"; + +let value: UpdateSubscriberOnlineFlagRequestDto = { + isOnline: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `isOnline` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/components/updatesubscriberpreferencerequestdto.md b/docs/models/components/updatesubscriberpreferencerequestdto.md new file mode 100644 index 00000000..ab38c659 --- /dev/null +++ b/docs/models/components/updatesubscriberpreferencerequestdto.md @@ -0,0 +1,16 @@ +# UpdateSubscriberPreferenceRequestDto + +## Example Usage + +```typescript +import { UpdateSubscriberPreferenceRequestDto } from "@novu/api/models/components"; + +let value: UpdateSubscriberPreferenceRequestDto = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| `channel` | [components.ChannelPreference](../../models/components/channelpreference.md) | :heavy_minus_sign: | The subscriber preferences for every ChannelTypeEnum for the workflow assigned. | +| `enabled` | *boolean* | :heavy_minus_sign: | Sets if the workflow is fully enabled for all channels or not for the subscriber. | \ No newline at end of file diff --git a/docs/models/components/updatesubscriberpreferenceresponsedto.md b/docs/models/components/updatesubscriberpreferenceresponsedto.md new file mode 100644 index 00000000..1d52bc61 --- /dev/null +++ b/docs/models/components/updatesubscriberpreferenceresponsedto.md @@ -0,0 +1,29 @@ +# UpdateSubscriberPreferenceResponseDto + +## Example Usage + +```typescript +import { UpdateSubscriberPreferenceResponseDto } from "@novu/api/models/components"; + +let value: UpdateSubscriberPreferenceResponseDto = { + template: { + id: "", + name: "", + critical: false, + triggers: [ + "", + ], + }, + preference: { + enabled: false, + channels: {}, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `template` | [components.TemplateResponse](../../models/components/templateresponse.md) | :heavy_check_mark: | The workflow information and if it is critical or not | +| `preference` | [components.Preference](../../models/components/preference.md) | :heavy_check_mark: | The preferences of the subscriber regarding the related workflow | \ No newline at end of file diff --git a/docs/models/components/updatesubscriberrequestdto.md b/docs/models/components/updatesubscriberrequestdto.md new file mode 100644 index 00000000..abfd3ec6 --- /dev/null +++ b/docs/models/components/updatesubscriberrequestdto.md @@ -0,0 +1,22 @@ +# UpdateSubscriberRequestDto + +## Example Usage + +```typescript +import { UpdateSubscriberRequestDto } from "@novu/api/models/components"; + +let value: UpdateSubscriberRequestDto = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------ | +| `email` | *string* | :heavy_minus_sign: | N/A | +| `firstName` | *string* | :heavy_minus_sign: | N/A | +| `lastName` | *string* | :heavy_minus_sign: | N/A | +| `phone` | *string* | :heavy_minus_sign: | N/A | +| `avatar` | *string* | :heavy_minus_sign: | N/A | +| `locale` | *string* | :heavy_minus_sign: | N/A | +| `data` | [components.UpdateSubscriberRequestDtoData](../../models/components/updatesubscriberrequestdtodata.md) | :heavy_minus_sign: | N/A | +| `channels` | *string*[] | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/updatesubscriberrequestdtodata.md b/docs/models/components/updatesubscriberrequestdtodata.md new file mode 100644 index 00000000..71cb8daa --- /dev/null +++ b/docs/models/components/updatesubscriberrequestdtodata.md @@ -0,0 +1,14 @@ +# UpdateSubscriberRequestDtoData + +## Example Usage + +```typescript +import { UpdateSubscriberRequestDtoData } from "@novu/api/models/components"; + +let value: UpdateSubscriberRequestDtoData = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/value.md b/docs/models/components/value.md new file mode 100644 index 00000000..b9f79c7e --- /dev/null +++ b/docs/models/components/value.md @@ -0,0 +1,15 @@ +# Value + +## Example Usage + +```typescript +import { Value } from "@novu/api/models/components"; + +let value: Value = "OR"; +``` + +## Values + +```typescript +"AND" | "OR" +``` \ No newline at end of file diff --git a/docs/models/components/weekdays.md b/docs/models/components/weekdays.md new file mode 100644 index 00000000..4a73d079 --- /dev/null +++ b/docs/models/components/weekdays.md @@ -0,0 +1,15 @@ +# WeekDays + +## Example Usage + +```typescript +import { WeekDays } from "@novu/api/models/components"; + +let value: WeekDays = "tuesday"; +``` + +## Values + +```typescript +"monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" +``` \ No newline at end of file diff --git a/docs/models/components/workflowintegrationstatus.md b/docs/models/components/workflowintegrationstatus.md new file mode 100644 index 00000000..e7915938 --- /dev/null +++ b/docs/models/components/workflowintegrationstatus.md @@ -0,0 +1,14 @@ +# WorkflowIntegrationStatus + +## Example Usage + +```typescript +import { WorkflowIntegrationStatus } from "@novu/api/models/components"; + +let value: WorkflowIntegrationStatus = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/components/workflowresponse.md b/docs/models/components/workflowresponse.md new file mode 100644 index 00000000..a0bbc1bd --- /dev/null +++ b/docs/models/components/workflowresponse.md @@ -0,0 +1,66 @@ +# WorkflowResponse + +## Example Usage + +```typescript +import { WorkflowResponse } from "@novu/api/models/components"; + +let value: WorkflowResponse = { + name: "", + description: "hidden remand whether seriously huzzah immediately geez", + active: false, + draft: false, + preferenceSettings: {}, + critical: false, + tags: [ + "", + ], + steps: [ + {}, + ], + organizationId: "", + creatorId: "", + environmentId: "", + triggers: [ + { + type: "event", + identifier: "", + variables: [ + { + name: "", + }, + ], + }, + ], + notificationGroupId: "", + deleted: false, + deletedAt: "", + deletedBy: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | +| `id` | *string* | :heavy_minus_sign: | N/A | +| `name` | *string* | :heavy_check_mark: | N/A | +| `description` | *string* | :heavy_check_mark: | N/A | +| `active` | *boolean* | :heavy_check_mark: | N/A | +| `draft` | *boolean* | :heavy_check_mark: | N/A | +| `preferenceSettings` | [components.PreferenceChannels](../../models/components/preferencechannels.md) | :heavy_check_mark: | N/A | +| `critical` | *boolean* | :heavy_check_mark: | N/A | +| `tags` | *string*[] | :heavy_check_mark: | N/A | +| `steps` | [components.NotificationStep](../../models/components/notificationstep.md)[] | :heavy_check_mark: | N/A | +| `organizationId` | *string* | :heavy_check_mark: | N/A | +| `creatorId` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `triggers` | [components.NotificationTrigger](../../models/components/notificationtrigger.md)[] | :heavy_check_mark: | N/A | +| `notificationGroupId` | *string* | :heavy_check_mark: | N/A | +| `parentId` | *string* | :heavy_minus_sign: | N/A | +| `deleted` | *boolean* | :heavy_check_mark: | N/A | +| `deletedAt` | *string* | :heavy_check_mark: | N/A | +| `deletedBy` | *string* | :heavy_check_mark: | N/A | +| `notificationGroup` | [components.NotificationGroup](../../models/components/notificationgroup.md) | :heavy_minus_sign: | N/A | +| `data` | [components.WorkflowResponseData](../../models/components/workflowresponsedata.md) | :heavy_minus_sign: | N/A | +| `workflowIntegrationStatus` | [components.WorkflowIntegrationStatus](../../models/components/workflowintegrationstatus.md) | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/components/workflowresponsedata.md b/docs/models/components/workflowresponsedata.md new file mode 100644 index 00000000..23301dd5 --- /dev/null +++ b/docs/models/components/workflowresponsedata.md @@ -0,0 +1,14 @@ +# WorkflowResponseData + +## Example Usage + +```typescript +import { WorkflowResponseData } from "@novu/api/models/components"; + +let value: WorkflowResponseData = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/channel.md b/docs/models/operations/channel.md new file mode 100644 index 00000000..e7ab724b --- /dev/null +++ b/docs/models/operations/channel.md @@ -0,0 +1,15 @@ +# Channel + +## Example Usage + +```typescript +import { Channel } from "@novu/api/models/operations"; + +let value: Channel = "in_app"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/operations/channels.md b/docs/models/operations/channels.md new file mode 100644 index 00000000..a38b610c --- /dev/null +++ b/docs/models/operations/channels.md @@ -0,0 +1,15 @@ +# Channels + +## Example Usage + +```typescript +import { Channels } from "@novu/api/models/operations"; + +let value: Channels = "sms"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/operations/environmentscontrollerv1getcurrentenvironmentresponse.md b/docs/models/operations/environmentscontrollerv1getcurrentenvironmentresponse.md new file mode 100644 index 00000000..57876028 --- /dev/null +++ b/docs/models/operations/environmentscontrollerv1getcurrentenvironmentresponse.md @@ -0,0 +1,28 @@ +# EnvironmentsControllerV1GetCurrentEnvironmentResponse + +## Example Usage + +```typescript +import { EnvironmentsControllerV1GetCurrentEnvironmentResponse } from "@novu/api/models/operations"; + +let value: EnvironmentsControllerV1GetCurrentEnvironmentResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + name: "", + organizationId: "", + identifier: "", + parentId: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.EnvironmentResponseDto](../../models/components/environmentresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/environmentscontrollerv1listmyenvironmentsresponse.md b/docs/models/operations/environmentscontrollerv1listmyenvironmentsresponse.md new file mode 100644 index 00000000..b91cef1e --- /dev/null +++ b/docs/models/operations/environmentscontrollerv1listmyenvironmentsresponse.md @@ -0,0 +1,30 @@ +# EnvironmentsControllerV1ListMyEnvironmentsResponse + +## Example Usage + +```typescript +import { EnvironmentsControllerV1ListMyEnvironmentsResponse } from "@novu/api/models/operations"; + +let value: EnvironmentsControllerV1ListMyEnvironmentsResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + name: "", + organizationId: "", + identifier: "", + parentId: "", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.EnvironmentResponseDto](../../models/components/environmentresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/environmentscontrollerv1listorganizationapikeysresponse.md b/docs/models/operations/environmentscontrollerv1listorganizationapikeysresponse.md new file mode 100644 index 00000000..fb55d9a1 --- /dev/null +++ b/docs/models/operations/environmentscontrollerv1listorganizationapikeysresponse.md @@ -0,0 +1,28 @@ +# EnvironmentsControllerV1ListOrganizationApiKeysResponse + +## Example Usage + +```typescript +import { EnvironmentsControllerV1ListOrganizationApiKeysResponse } from "@novu/api/models/operations"; + +let value: EnvironmentsControllerV1ListOrganizationApiKeysResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + key: "", + userId: "", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.ApiKey](../../models/components/apikey.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/eventscontrollerbroadcasteventtoallresponse.md b/docs/models/operations/eventscontrollerbroadcasteventtoallresponse.md new file mode 100644 index 00000000..27d634f0 --- /dev/null +++ b/docs/models/operations/eventscontrollerbroadcasteventtoallresponse.md @@ -0,0 +1,26 @@ +# EventsControllerBroadcastEventToAllResponse + +## Example Usage + +```typescript +import { EventsControllerBroadcastEventToAllResponse } from "@novu/api/models/operations"; + +let value: EventsControllerBroadcastEventToAllResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + acknowledged: false, + status: "processed", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.TriggerEventResponseDto](../../models/components/triggereventresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/eventscontrollercancelrequest.md b/docs/models/operations/eventscontrollercancelrequest.md new file mode 100644 index 00000000..72bf067b --- /dev/null +++ b/docs/models/operations/eventscontrollercancelrequest.md @@ -0,0 +1,17 @@ +# EventsControllerCancelRequest + +## Example Usage + +```typescript +import { EventsControllerCancelRequest } from "@novu/api/models/operations"; + +let value: EventsControllerCancelRequest = { + transactionId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `transactionId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/eventscontrollercancelresponse.md b/docs/models/operations/eventscontrollercancelresponse.md new file mode 100644 index 00000000..54202b4f --- /dev/null +++ b/docs/models/operations/eventscontrollercancelresponse.md @@ -0,0 +1,25 @@ +# EventsControllerCancelResponse + +## Example Usage + +```typescript +import { EventsControllerCancelResponse } from "@novu/api/models/operations"; + +let value: EventsControllerCancelResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + data: false, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.DataBooleanDto](../../models/components/databooleandto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/eventscontrollertriggerbulkresponse.md b/docs/models/operations/eventscontrollertriggerbulkresponse.md new file mode 100644 index 00000000..774620e9 --- /dev/null +++ b/docs/models/operations/eventscontrollertriggerbulkresponse.md @@ -0,0 +1,28 @@ +# EventsControllerTriggerBulkResponse + +## Example Usage + +```typescript +import { EventsControllerTriggerBulkResponse } from "@novu/api/models/operations"; + +let value: EventsControllerTriggerBulkResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + acknowledged: false, + status: "subscriber_id_missing", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.TriggerEventResponseDto](../../models/components/triggereventresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/eventscontrollertriggerresponse.md b/docs/models/operations/eventscontrollertriggerresponse.md new file mode 100644 index 00000000..0fd91b3a --- /dev/null +++ b/docs/models/operations/eventscontrollertriggerresponse.md @@ -0,0 +1,26 @@ +# EventsControllerTriggerResponse + +## Example Usage + +```typescript +import { EventsControllerTriggerResponse } from "@novu/api/models/operations"; + +let value: EventsControllerTriggerResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + acknowledged: false, + status: "no_workflow_steps_defined", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.TriggerEventResponseDto](../../models/components/triggereventresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/executiondetailscontrollergetexecutiondetailsfornotificationrequest.md b/docs/models/operations/executiondetailscontrollergetexecutiondetailsfornotificationrequest.md new file mode 100644 index 00000000..edd1a2ca --- /dev/null +++ b/docs/models/operations/executiondetailscontrollergetexecutiondetailsfornotificationrequest.md @@ -0,0 +1,20 @@ +# ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest + +## Example Usage + +```typescript +import { ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest } from "@novu/api/models/operations"; + +let value: ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest = + { + notificationId: "", + subscriberId: "", + }; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `notificationId` | *string* | :heavy_check_mark: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/executiondetailscontrollergetexecutiondetailsfornotificationresponse.md b/docs/models/operations/executiondetailscontrollergetexecutiondetailsfornotificationresponse.md new file mode 100644 index 00000000..161f7486 --- /dev/null +++ b/docs/models/operations/executiondetailscontrollergetexecutiondetailsfornotificationresponse.md @@ -0,0 +1,40 @@ +# ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse + +## Example Usage + +```typescript +import { ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse } from "@novu/api/models/operations"; + +let value: + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + organizationId: "", + jobId: "", + environmentId: "", + notificationId: "", + notificationTemplateId: "", + subscriberId: "", + transactionId: "", + channel: "push", + detail: "", + source: "Internal", + status: "Pending", + isTest: false, + isRetry: false, + }, + ], + }; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.ExecutionDetailsResponseDto](../../models/components/executiondetailsresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollercreateintegrationresponse.md b/docs/models/operations/integrationscontrollercreateintegrationresponse.md new file mode 100644 index 00000000..5a964ab9 --- /dev/null +++ b/docs/models/operations/integrationscontrollercreateintegrationresponse.md @@ -0,0 +1,36 @@ +# IntegrationsControllerCreateIntegrationResponse + +## Example Usage + +```typescript +import { IntegrationsControllerCreateIntegrationResponse } from "@novu/api/models/operations"; + +let value: IntegrationsControllerCreateIntegrationResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + environmentId: "", + organizationId: "", + name: "", + identifier: "", + providerId: "", + channel: "in_app", + credentials: {}, + active: false, + deleted: false, + deletedAt: "", + deletedBy: "", + primary: false, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.IntegrationResponseDto](../../models/components/integrationresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollergetactiveintegrationsresponse.md b/docs/models/operations/integrationscontrollergetactiveintegrationsresponse.md new file mode 100644 index 00000000..4b4c3e30 --- /dev/null +++ b/docs/models/operations/integrationscontrollergetactiveintegrationsresponse.md @@ -0,0 +1,38 @@ +# IntegrationsControllerGetActiveIntegrationsResponse + +## Example Usage + +```typescript +import { IntegrationsControllerGetActiveIntegrationsResponse } from "@novu/api/models/operations"; + +let value: IntegrationsControllerGetActiveIntegrationsResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + environmentId: "", + organizationId: "", + name: "", + identifier: "", + providerId: "", + channel: "in_app", + credentials: {}, + active: false, + deleted: false, + deletedAt: "", + deletedBy: "", + primary: false, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.IntegrationResponseDto](../../models/components/integrationresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollergetwebhooksupportstatusrequest.md b/docs/models/operations/integrationscontrollergetwebhooksupportstatusrequest.md new file mode 100644 index 00000000..a3439ab3 --- /dev/null +++ b/docs/models/operations/integrationscontrollergetwebhooksupportstatusrequest.md @@ -0,0 +1,17 @@ +# IntegrationsControllerGetWebhookSupportStatusRequest + +## Example Usage + +```typescript +import { IntegrationsControllerGetWebhookSupportStatusRequest } from "@novu/api/models/operations"; + +let value: IntegrationsControllerGetWebhookSupportStatusRequest = { + providerOrIntegrationId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------- | ------------------------- | ------------------------- | ------------------------- | +| `providerOrIntegrationId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollergetwebhooksupportstatusresponse.md b/docs/models/operations/integrationscontrollergetwebhooksupportstatusresponse.md new file mode 100644 index 00000000..e68cdb44 --- /dev/null +++ b/docs/models/operations/integrationscontrollergetwebhooksupportstatusresponse.md @@ -0,0 +1,23 @@ +# IntegrationsControllerGetWebhookSupportStatusResponse + +## Example Usage + +```typescript +import { IntegrationsControllerGetWebhookSupportStatusResponse } from "@novu/api/models/operations"; + +let value: IntegrationsControllerGetWebhookSupportStatusResponse = { + headers: { + "key": [ + "", + ], + }, + result: false, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | *boolean* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollerlistintegrationsresponse.md b/docs/models/operations/integrationscontrollerlistintegrationsresponse.md new file mode 100644 index 00000000..40dd8daa --- /dev/null +++ b/docs/models/operations/integrationscontrollerlistintegrationsresponse.md @@ -0,0 +1,38 @@ +# IntegrationsControllerListIntegrationsResponse + +## Example Usage + +```typescript +import { IntegrationsControllerListIntegrationsResponse } from "@novu/api/models/operations"; + +let value: IntegrationsControllerListIntegrationsResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + environmentId: "", + organizationId: "", + name: "", + identifier: "", + providerId: "", + channel: "in_app", + credentials: {}, + active: false, + deleted: false, + deletedAt: "", + deletedBy: "", + primary: false, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.IntegrationResponseDto](../../models/components/integrationresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollerremoveintegrationrequest.md b/docs/models/operations/integrationscontrollerremoveintegrationrequest.md new file mode 100644 index 00000000..0c1c7606 --- /dev/null +++ b/docs/models/operations/integrationscontrollerremoveintegrationrequest.md @@ -0,0 +1,17 @@ +# IntegrationsControllerRemoveIntegrationRequest + +## Example Usage + +```typescript +import { IntegrationsControllerRemoveIntegrationRequest } from "@novu/api/models/operations"; + +let value: IntegrationsControllerRemoveIntegrationRequest = { + integrationId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `integrationId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollerremoveintegrationresponse.md b/docs/models/operations/integrationscontrollerremoveintegrationresponse.md new file mode 100644 index 00000000..61c6a362 --- /dev/null +++ b/docs/models/operations/integrationscontrollerremoveintegrationresponse.md @@ -0,0 +1,38 @@ +# IntegrationsControllerRemoveIntegrationResponse + +## Example Usage + +```typescript +import { IntegrationsControllerRemoveIntegrationResponse } from "@novu/api/models/operations"; + +let value: IntegrationsControllerRemoveIntegrationResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + environmentId: "", + organizationId: "", + name: "", + identifier: "", + providerId: "", + channel: "chat", + credentials: {}, + active: false, + deleted: false, + deletedAt: "", + deletedBy: "", + primary: false, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.IntegrationResponseDto](../../models/components/integrationresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollersetintegrationasprimaryrequest.md b/docs/models/operations/integrationscontrollersetintegrationasprimaryrequest.md new file mode 100644 index 00000000..facc8217 --- /dev/null +++ b/docs/models/operations/integrationscontrollersetintegrationasprimaryrequest.md @@ -0,0 +1,17 @@ +# IntegrationsControllerSetIntegrationAsPrimaryRequest + +## Example Usage + +```typescript +import { IntegrationsControllerSetIntegrationAsPrimaryRequest } from "@novu/api/models/operations"; + +let value: IntegrationsControllerSetIntegrationAsPrimaryRequest = { + integrationId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `integrationId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollersetintegrationasprimaryresponse.md b/docs/models/operations/integrationscontrollersetintegrationasprimaryresponse.md new file mode 100644 index 00000000..57678ea8 --- /dev/null +++ b/docs/models/operations/integrationscontrollersetintegrationasprimaryresponse.md @@ -0,0 +1,36 @@ +# IntegrationsControllerSetIntegrationAsPrimaryResponse + +## Example Usage + +```typescript +import { IntegrationsControllerSetIntegrationAsPrimaryResponse } from "@novu/api/models/operations"; + +let value: IntegrationsControllerSetIntegrationAsPrimaryResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + environmentId: "", + organizationId: "", + name: "", + identifier: "", + providerId: "", + channel: "push", + credentials: {}, + active: false, + deleted: false, + deletedAt: "", + deletedBy: "", + primary: false, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.IntegrationResponseDto](../../models/components/integrationresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollerupdateintegrationbyidrequest.md b/docs/models/operations/integrationscontrollerupdateintegrationbyidrequest.md new file mode 100644 index 00000000..cb43386a --- /dev/null +++ b/docs/models/operations/integrationscontrollerupdateintegrationbyidrequest.md @@ -0,0 +1,19 @@ +# IntegrationsControllerUpdateIntegrationByIdRequest + +## Example Usage + +```typescript +import { IntegrationsControllerUpdateIntegrationByIdRequest } from "@novu/api/models/operations"; + +let value: IntegrationsControllerUpdateIntegrationByIdRequest = { + integrationId: "", + updateIntegrationRequestDto: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `integrationId` | *string* | :heavy_check_mark: | N/A | +| `updateIntegrationRequestDto` | [components.UpdateIntegrationRequestDto](../../models/components/updateintegrationrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/integrationscontrollerupdateintegrationbyidresponse.md b/docs/models/operations/integrationscontrollerupdateintegrationbyidresponse.md new file mode 100644 index 00000000..01b31772 --- /dev/null +++ b/docs/models/operations/integrationscontrollerupdateintegrationbyidresponse.md @@ -0,0 +1,36 @@ +# IntegrationsControllerUpdateIntegrationByIdResponse + +## Example Usage + +```typescript +import { IntegrationsControllerUpdateIntegrationByIdResponse } from "@novu/api/models/operations"; + +let value: IntegrationsControllerUpdateIntegrationByIdResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + environmentId: "", + organizationId: "", + name: "", + identifier: "", + providerId: "", + channel: "push", + credentials: {}, + active: false, + deleted: false, + deletedAt: "", + deletedBy: "", + primary: false, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.IntegrationResponseDto](../../models/components/integrationresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/messagescontrollerdeletemessagerequest.md b/docs/models/operations/messagescontrollerdeletemessagerequest.md new file mode 100644 index 00000000..bd9b94de --- /dev/null +++ b/docs/models/operations/messagescontrollerdeletemessagerequest.md @@ -0,0 +1,17 @@ +# MessagesControllerDeleteMessageRequest + +## Example Usage + +```typescript +import { MessagesControllerDeleteMessageRequest } from "@novu/api/models/operations"; + +let value: MessagesControllerDeleteMessageRequest = { + messageId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `messageId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/messagescontrollerdeletemessageresponse.md b/docs/models/operations/messagescontrollerdeletemessageresponse.md new file mode 100644 index 00000000..f54d9dec --- /dev/null +++ b/docs/models/operations/messagescontrollerdeletemessageresponse.md @@ -0,0 +1,26 @@ +# MessagesControllerDeleteMessageResponse + +## Example Usage + +```typescript +import { MessagesControllerDeleteMessageResponse } from "@novu/api/models/operations"; + +let value: MessagesControllerDeleteMessageResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + acknowledged: false, + status: "deleted", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.DeleteMessageResponseDto](../../models/components/deletemessageresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/messagescontrollerdeletemessagesbytransactionidrequest.md b/docs/models/operations/messagescontrollerdeletemessagesbytransactionidrequest.md new file mode 100644 index 00000000..5bea039e --- /dev/null +++ b/docs/models/operations/messagescontrollerdeletemessagesbytransactionidrequest.md @@ -0,0 +1,18 @@ +# MessagesControllerDeleteMessagesByTransactionIdRequest + +## Example Usage + +```typescript +import { MessagesControllerDeleteMessagesByTransactionIdRequest } from "@novu/api/models/operations"; + +let value: MessagesControllerDeleteMessagesByTransactionIdRequest = { + transactionId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | +| `channel` | [operations.QueryParamChannel](../../models/operations/queryparamchannel.md) | :heavy_minus_sign: | The channel of the message to be deleted | +| `transactionId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/messagescontrollerdeletemessagesbytransactionidresponse.md b/docs/models/operations/messagescontrollerdeletemessagesbytransactionidresponse.md new file mode 100644 index 00000000..eb117477 --- /dev/null +++ b/docs/models/operations/messagescontrollerdeletemessagesbytransactionidresponse.md @@ -0,0 +1,21 @@ +# MessagesControllerDeleteMessagesByTransactionIdResponse + +## Example Usage + +```typescript +import { MessagesControllerDeleteMessagesByTransactionIdResponse } from "@novu/api/models/operations"; + +let value: MessagesControllerDeleteMessagesByTransactionIdResponse = { + headers: { + "key": [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/messagescontrollergetmessagesrequest.md b/docs/models/operations/messagescontrollergetmessagesrequest.md new file mode 100644 index 00000000..1a23c80a --- /dev/null +++ b/docs/models/operations/messagescontrollergetmessagesrequest.md @@ -0,0 +1,19 @@ +# MessagesControllerGetMessagesRequest + +## Example Usage + +```typescript +import { MessagesControllerGetMessagesRequest } from "@novu/api/models/operations"; + +let value: MessagesControllerGetMessagesRequest = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------------------- | +| `channel` | [operations.Channel](../../models/operations/channel.md) | :heavy_minus_sign: | N/A | +| `subscriberId` | *string* | :heavy_minus_sign: | N/A | +| `transactionId` | *string*[] | :heavy_minus_sign: | N/A | +| `page` | *number* | :heavy_minus_sign: | N/A | +| `limit` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/messagescontrollergetmessagesresponse.md b/docs/models/operations/messagescontrollergetmessagesresponse.md new file mode 100644 index 00000000..e3444aa3 --- /dev/null +++ b/docs/models/operations/messagescontrollergetmessagesresponse.md @@ -0,0 +1,30 @@ +# MessagesControllerGetMessagesResponse + +## Example Usage + +```typescript +import { MessagesControllerGetMessagesResponse } from "@novu/api/models/operations"; + +let value: MessagesControllerGetMessagesResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + hasMore: false, + data: [ + "", + ], + pageSize: 6531.08, + page: 2532.92, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.ActivitiesResponseDto](../../models/components/activitiesresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollercreatenotificationgroupresponse.md b/docs/models/operations/notificationgroupscontrollercreatenotificationgroupresponse.md new file mode 100644 index 00000000..30dd544a --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollercreatenotificationgroupresponse.md @@ -0,0 +1,27 @@ +# NotificationGroupsControllerCreateNotificationGroupResponse + +## Example Usage + +```typescript +import { NotificationGroupsControllerCreateNotificationGroupResponse } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerCreateNotificationGroupResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + name: "", + environmentId: "", + organizationId: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.NotificationGroupResponseDto](../../models/components/notificationgroupresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollerdeletenotificationgrouprequest.md b/docs/models/operations/notificationgroupscontrollerdeletenotificationgrouprequest.md new file mode 100644 index 00000000..f460ee17 --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollerdeletenotificationgrouprequest.md @@ -0,0 +1,17 @@ +# NotificationGroupsControllerDeleteNotificationGroupRequest + +## Example Usage + +```typescript +import { NotificationGroupsControllerDeleteNotificationGroupRequest } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerDeleteNotificationGroupRequest = { + id: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollerdeletenotificationgroupresponse.md b/docs/models/operations/notificationgroupscontrollerdeletenotificationgroupresponse.md new file mode 100644 index 00000000..9d4b3783 --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollerdeletenotificationgroupresponse.md @@ -0,0 +1,26 @@ +# NotificationGroupsControllerDeleteNotificationGroupResponse + +## Example Usage + +```typescript +import { NotificationGroupsControllerDeleteNotificationGroupResponse } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerDeleteNotificationGroupResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + acknowledged: false, + status: "deleted", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.DeleteNotificationGroupResponseDto](../../models/components/deletenotificationgroupresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollergetnotificationgrouprequest.md b/docs/models/operations/notificationgroupscontrollergetnotificationgrouprequest.md new file mode 100644 index 00000000..51bff1be --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollergetnotificationgrouprequest.md @@ -0,0 +1,17 @@ +# NotificationGroupsControllerGetNotificationGroupRequest + +## Example Usage + +```typescript +import { NotificationGroupsControllerGetNotificationGroupRequest } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerGetNotificationGroupRequest = { + id: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollergetnotificationgroupresponse.md b/docs/models/operations/notificationgroupscontrollergetnotificationgroupresponse.md new file mode 100644 index 00000000..0a5962b8 --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollergetnotificationgroupresponse.md @@ -0,0 +1,27 @@ +# NotificationGroupsControllerGetNotificationGroupResponse + +## Example Usage + +```typescript +import { NotificationGroupsControllerGetNotificationGroupResponse } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerGetNotificationGroupResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + name: "", + environmentId: "", + organizationId: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.NotificationGroupResponseDto](../../models/components/notificationgroupresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollerlistnotificationgroupsresponse.md b/docs/models/operations/notificationgroupscontrollerlistnotificationgroupsresponse.md new file mode 100644 index 00000000..bfc3148c --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollerlistnotificationgroupsresponse.md @@ -0,0 +1,29 @@ +# NotificationGroupsControllerListNotificationGroupsResponse + +## Example Usage + +```typescript +import { NotificationGroupsControllerListNotificationGroupsResponse } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerListNotificationGroupsResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + name: "", + environmentId: "", + organizationId: "", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.NotificationGroupResponseDto](../../models/components/notificationgroupresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollerupdatenotificationgrouprequest.md b/docs/models/operations/notificationgroupscontrollerupdatenotificationgrouprequest.md new file mode 100644 index 00000000..464f6cac --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollerupdatenotificationgrouprequest.md @@ -0,0 +1,21 @@ +# NotificationGroupsControllerUpdateNotificationGroupRequest + +## Example Usage + +```typescript +import { NotificationGroupsControllerUpdateNotificationGroupRequest } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerUpdateNotificationGroupRequest = { + id: "", + createNotificationGroupRequestDto: { + name: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | +| `createNotificationGroupRequestDto` | [components.CreateNotificationGroupRequestDto](../../models/components/createnotificationgrouprequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationgroupscontrollerupdatenotificationgroupresponse.md b/docs/models/operations/notificationgroupscontrollerupdatenotificationgroupresponse.md new file mode 100644 index 00000000..257ac529 --- /dev/null +++ b/docs/models/operations/notificationgroupscontrollerupdatenotificationgroupresponse.md @@ -0,0 +1,27 @@ +# NotificationGroupsControllerUpdateNotificationGroupResponse + +## Example Usage + +```typescript +import { NotificationGroupsControllerUpdateNotificationGroupResponse } from "@novu/api/models/operations"; + +let value: NotificationGroupsControllerUpdateNotificationGroupResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + name: "", + environmentId: "", + organizationId: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.NotificationGroupResponseDto](../../models/components/notificationgroupresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationscontrollergetactivitygraphstatsrequest.md b/docs/models/operations/notificationscontrollergetactivitygraphstatsrequest.md new file mode 100644 index 00000000..a846d6c7 --- /dev/null +++ b/docs/models/operations/notificationscontrollergetactivitygraphstatsrequest.md @@ -0,0 +1,15 @@ +# NotificationsControllerGetActivityGraphStatsRequest + +## Example Usage + +```typescript +import { NotificationsControllerGetActivityGraphStatsRequest } from "@novu/api/models/operations"; + +let value: NotificationsControllerGetActivityGraphStatsRequest = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `days` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationscontrollergetactivitygraphstatsresponse.md b/docs/models/operations/notificationscontrollergetactivitygraphstatsresponse.md new file mode 100644 index 00000000..f8de7850 --- /dev/null +++ b/docs/models/operations/notificationscontrollergetactivitygraphstatsresponse.md @@ -0,0 +1,34 @@ +# NotificationsControllerGetActivityGraphStatsResponse + +## Example Usage + +```typescript +import { NotificationsControllerGetActivityGraphStatsResponse } from "@novu/api/models/operations"; + +let value: NotificationsControllerGetActivityGraphStatsResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + id: "", + count: 5680.45, + templates: [ + "", + ], + channels: [ + "push", + ], + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.ActivityGraphStatesResponse](../../models/components/activitygraphstatesresponse.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationscontrollergetactivitystatsresponse.md b/docs/models/operations/notificationscontrollergetactivitystatsresponse.md new file mode 100644 index 00000000..0b4e27c4 --- /dev/null +++ b/docs/models/operations/notificationscontrollergetactivitystatsresponse.md @@ -0,0 +1,26 @@ +# NotificationsControllerGetActivityStatsResponse + +## Example Usage + +```typescript +import { NotificationsControllerGetActivityStatsResponse } from "@novu/api/models/operations"; + +let value: NotificationsControllerGetActivityStatsResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + weeklySent: 7917.25, + monthlySent: 5288.95, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.ActivityStatsResponseDto](../../models/components/activitystatsresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationscontrollergetnotificationrequest.md b/docs/models/operations/notificationscontrollergetnotificationrequest.md new file mode 100644 index 00000000..41341f5c --- /dev/null +++ b/docs/models/operations/notificationscontrollergetnotificationrequest.md @@ -0,0 +1,17 @@ +# NotificationsControllerGetNotificationRequest + +## Example Usage + +```typescript +import { NotificationsControllerGetNotificationRequest } from "@novu/api/models/operations"; + +let value: NotificationsControllerGetNotificationRequest = { + notificationId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `notificationId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationscontrollergetnotificationresponse.md b/docs/models/operations/notificationscontrollergetnotificationresponse.md new file mode 100644 index 00000000..b8b29c82 --- /dev/null +++ b/docs/models/operations/notificationscontrollergetnotificationresponse.md @@ -0,0 +1,27 @@ +# NotificationsControllerGetNotificationResponse + +## Example Usage + +```typescript +import { NotificationsControllerGetNotificationResponse } from "@novu/api/models/operations"; + +let value: NotificationsControllerGetNotificationResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + environmentId: "", + organizationId: "", + transactionId: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.ActivityNotificationResponseDto](../../models/components/activitynotificationresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationscontrollerlistnotificationsrequest.md b/docs/models/operations/notificationscontrollerlistnotificationsrequest.md new file mode 100644 index 00000000..052e45b8 --- /dev/null +++ b/docs/models/operations/notificationscontrollerlistnotificationsrequest.md @@ -0,0 +1,35 @@ +# NotificationsControllerListNotificationsRequest + +## Example Usage + +```typescript +import { NotificationsControllerListNotificationsRequest } from "@novu/api/models/operations"; + +let value: NotificationsControllerListNotificationsRequest = { + channels: [ + "push", + ], + templates: [ + "", + ], + emails: [ + "", + ], + search: "", + subscriberIds: [ + "", + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | +| `channels` | [operations.Channels](../../models/operations/channels.md)[] | :heavy_check_mark: | N/A | +| `templates` | *string*[] | :heavy_check_mark: | N/A | +| `emails` | *string*[] | :heavy_check_mark: | N/A | +| ~~`search`~~ | *string* | :heavy_check_mark: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible. | +| `subscriberIds` | *string*[] | :heavy_check_mark: | N/A | +| `page` | *number* | :heavy_minus_sign: | N/A | +| `transactionId` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/notificationscontrollerlistnotificationsresponse.md b/docs/models/operations/notificationscontrollerlistnotificationsresponse.md new file mode 100644 index 00000000..220f95f4 --- /dev/null +++ b/docs/models/operations/notificationscontrollerlistnotificationsresponse.md @@ -0,0 +1,30 @@ +# NotificationsControllerListNotificationsResponse + +## Example Usage + +```typescript +import { NotificationsControllerListNotificationsResponse } from "@novu/api/models/operations"; + +let value: NotificationsControllerListNotificationsResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + hasMore: false, + data: [ + "", + ], + pageSize: 9636.63, + page: 3834.42, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.ActivitiesResponseDto](../../models/components/activitiesresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/parameter.md b/docs/models/operations/parameter.md new file mode 100644 index 00000000..db1b216b --- /dev/null +++ b/docs/models/operations/parameter.md @@ -0,0 +1,17 @@ +# Parameter + +the preferences level to be retrieved (template / global) + +## Example Usage + +```typescript +import { Parameter } from "@novu/api/models/operations"; + +let value: Parameter = "global"; +``` + +## Values + +```typescript +"global" | "template" +``` \ No newline at end of file diff --git a/docs/models/operations/queryparamchannel.md b/docs/models/operations/queryparamchannel.md new file mode 100644 index 00000000..a9acdf68 --- /dev/null +++ b/docs/models/operations/queryparamchannel.md @@ -0,0 +1,17 @@ +# QueryParamChannel + +The channel of the message to be deleted + +## Example Usage + +```typescript +import { QueryParamChannel } from "@novu/api/models/operations"; + +let value: QueryParamChannel = "sms"; +``` + +## Values + +```typescript +"in_app" | "email" | "sms" | "chat" | "push" +``` \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerbulkcreatesubscribersresponse.md b/docs/models/operations/subscriberscontrollerbulkcreatesubscribersresponse.md new file mode 100644 index 00000000..c03b7c54 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerbulkcreatesubscribersresponse.md @@ -0,0 +1,21 @@ +# SubscribersControllerBulkCreateSubscribersResponse + +## Example Usage + +```typescript +import { SubscribersControllerBulkCreateSubscribersResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerBulkCreateSubscribersResponse = { + headers: { + "key": [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerchataccessoauthrequest.md b/docs/models/operations/subscriberscontrollerchataccessoauthrequest.md new file mode 100644 index 00000000..e1a3c7a7 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerchataccessoauthrequest.md @@ -0,0 +1,24 @@ +# SubscribersControllerChatAccessOauthRequest + +## Example Usage + +```typescript +import { SubscribersControllerChatAccessOauthRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerChatAccessOauthRequest = { + subscriberId: "", + providerId: "", + hmacHash: "", + environmentId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `providerId` | *any* | :heavy_check_mark: | N/A | +| `hmacHash` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `integrationIdentifier` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerchataccessoauthresponse.md b/docs/models/operations/subscriberscontrollerchataccessoauthresponse.md new file mode 100644 index 00000000..45085487 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerchataccessoauthresponse.md @@ -0,0 +1,21 @@ +# SubscribersControllerChatAccessOauthResponse + +## Example Usage + +```typescript +import { SubscribersControllerChatAccessOauthResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerChatAccessOauthResponse = { + headers: { + "key": [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerchatoauthcallbackrequest.md b/docs/models/operations/subscriberscontrollerchatoauthcallbackrequest.md new file mode 100644 index 00000000..115eb8c6 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerchatoauthcallbackrequest.md @@ -0,0 +1,26 @@ +# SubscribersControllerChatOauthCallbackRequest + +## Example Usage + +```typescript +import { SubscribersControllerChatOauthCallbackRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerChatOauthCallbackRequest = { + subscriberId: "", + providerId: "", + code: "", + hmacHash: "", + environmentId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------------------- | ----------------------- | ----------------------- | ----------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `providerId` | *any* | :heavy_check_mark: | N/A | +| `code` | *string* | :heavy_check_mark: | N/A | +| `hmacHash` | *string* | :heavy_check_mark: | N/A | +| `environmentId` | *string* | :heavy_check_mark: | N/A | +| `integrationIdentifier` | *string* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerchatoauthcallbackresponse.md b/docs/models/operations/subscriberscontrollerchatoauthcallbackresponse.md new file mode 100644 index 00000000..1f17ff94 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerchatoauthcallbackresponse.md @@ -0,0 +1,23 @@ +# SubscribersControllerChatOauthCallbackResponse + +## Example Usage + +```typescript +import { SubscribersControllerChatOauthCallbackResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerChatOauthCallbackResponse = { + headers: { + "key": [ + "", + ], + }, + result: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [operations.SubscribersControllerChatOauthCallbackResponseBody](../../models/operations/subscriberscontrollerchatoauthcallbackresponsebody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerchatoauthcallbackresponsebody.md b/docs/models/operations/subscriberscontrollerchatoauthcallbackresponsebody.md new file mode 100644 index 00000000..9476de24 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerchatoauthcallbackresponsebody.md @@ -0,0 +1,14 @@ +# SubscribersControllerChatOauthCallbackResponseBody + +## Example Usage + +```typescript +import { SubscribersControllerChatOauthCallbackResponseBody } from "@novu/api/models/operations"; + +let value: SubscribersControllerChatOauthCallbackResponseBody = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ----------- | ----------- | ----------- | ----------- | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollercreatesubscriberresponse.md b/docs/models/operations/subscriberscontrollercreatesubscriberresponse.md new file mode 100644 index 00000000..12c5d2d3 --- /dev/null +++ b/docs/models/operations/subscriberscontrollercreatesubscriberresponse.md @@ -0,0 +1,30 @@ +# SubscribersControllerCreateSubscriberResponse + +## Example Usage + +```typescript +import { SubscribersControllerCreateSubscriberResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerCreateSubscriberResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerdeletesubscribercredentialsrequest.md b/docs/models/operations/subscriberscontrollerdeletesubscribercredentialsrequest.md new file mode 100644 index 00000000..6f2cf92f --- /dev/null +++ b/docs/models/operations/subscriberscontrollerdeletesubscribercredentialsrequest.md @@ -0,0 +1,19 @@ +# SubscribersControllerDeleteSubscriberCredentialsRequest + +## Example Usage + +```typescript +import { SubscribersControllerDeleteSubscriberCredentialsRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerDeleteSubscriberCredentialsRequest = { + subscriberId: "", + providerId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `providerId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerdeletesubscribercredentialsresponse.md b/docs/models/operations/subscriberscontrollerdeletesubscribercredentialsresponse.md new file mode 100644 index 00000000..96b2334f --- /dev/null +++ b/docs/models/operations/subscriberscontrollerdeletesubscribercredentialsresponse.md @@ -0,0 +1,21 @@ +# SubscribersControllerDeleteSubscriberCredentialsResponse + +## Example Usage + +```typescript +import { SubscribersControllerDeleteSubscriberCredentialsResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerDeleteSubscriberCredentialsResponse = { + headers: { + "key": [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetnotificationsfeedrequest.md b/docs/models/operations/subscriberscontrollergetnotificationsfeedrequest.md new file mode 100644 index 00000000..59ad8e16 --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetnotificationsfeedrequest.md @@ -0,0 +1,24 @@ +# SubscribersControllerGetNotificationsFeedRequest + +## Example Usage + +```typescript +import { SubscribersControllerGetNotificationsFeedRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetNotificationsFeedRequest = { + subscriberId: "", + payload: + "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=", +}; +``` + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | | +| `page` | *number* | :heavy_minus_sign: | N/A | | +| `limit` | *number* | :heavy_minus_sign: | N/A | | +| `read` | *boolean* | :heavy_minus_sign: | N/A | | +| `seen` | *boolean* | :heavy_minus_sign: | N/A | | +| `payload` | *string* | :heavy_minus_sign: | Base64 encoded string of the partial payload JSON object | btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30= | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetnotificationsfeedresponse.md b/docs/models/operations/subscriberscontrollergetnotificationsfeedresponse.md new file mode 100644 index 00000000..8941f043 --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetnotificationsfeedresponse.md @@ -0,0 +1,37 @@ +# SubscribersControllerGetNotificationsFeedResponse + +## Example Usage + +```typescript +import { SubscribersControllerGetNotificationsFeedResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetNotificationsFeedResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + page: 3595.08, + hasMore: false, + pageSize: 4370.32, + data: [ + { + hasMore: false, + data: [ + "", + ], + pageSize: 6976.31, + page: 602.25, + }, + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [operations.SubscribersControllerGetNotificationsFeedResponseBody](../../models/operations/subscriberscontrollergetnotificationsfeedresponsebody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetnotificationsfeedresponsebody.md b/docs/models/operations/subscriberscontrollergetnotificationsfeedresponsebody.md new file mode 100644 index 00000000..a612bdac --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetnotificationsfeedresponsebody.md @@ -0,0 +1,32 @@ +# SubscribersControllerGetNotificationsFeedResponseBody + +## Example Usage + +```typescript +import { SubscribersControllerGetNotificationsFeedResponseBody } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetNotificationsFeedResponseBody = { + page: 6120.96, + hasMore: false, + pageSize: 6169.34, + data: [ + { + hasMore: false, + data: [ + "", + ], + pageSize: 9437.48, + page: 6818.20, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -------------------------------------------------------------------------- | +| `page` | *number* | :heavy_check_mark: | The current page of the paginated response | +| `hasMore` | *boolean* | :heavy_check_mark: | Does the list have more items to fetch | +| `pageSize` | *number* | :heavy_check_mark: | Number of items on each page | +| `data` | [components.FeedResponseDto](../../models/components/feedresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetsubscriberpreferencebylevelrequest.md b/docs/models/operations/subscriberscontrollergetsubscriberpreferencebylevelrequest.md new file mode 100644 index 00000000..e8279689 --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetsubscriberpreferencebylevelrequest.md @@ -0,0 +1,20 @@ +# SubscribersControllerGetSubscriberPreferenceByLevelRequest + +## Example Usage + +```typescript +import { SubscribersControllerGetSubscriberPreferenceByLevelRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetSubscriberPreferenceByLevelRequest = { + parameter: "template", + subscriberId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `includeInactiveChannels` | *boolean* | :heavy_minus_sign: | A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true | +| `parameter` | [operations.Parameter](../../models/operations/parameter.md) | :heavy_check_mark: | the preferences level to be retrieved (template / global) | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetsubscriberpreferencebylevelresponse.md b/docs/models/operations/subscriberscontrollergetsubscriberpreferencebylevelresponse.md new file mode 100644 index 00000000..4c8c5595 --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetsubscriberpreferencebylevelresponse.md @@ -0,0 +1,30 @@ +# SubscribersControllerGetSubscriberPreferenceByLevelResponse + +## Example Usage + +```typescript +import { SubscribersControllerGetSubscriberPreferenceByLevelResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetSubscriberPreferenceByLevelResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + preference: { + enabled: false, + channels: {}, + }, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.GetSubscriberPreferencesResponseDto](../../models/components/getsubscriberpreferencesresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetsubscriberrequest.md b/docs/models/operations/subscriberscontrollergetsubscriberrequest.md new file mode 100644 index 00000000..e7ad3e9f --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetsubscriberrequest.md @@ -0,0 +1,18 @@ +# SubscribersControllerGetSubscriberRequest + +## Example Usage + +```typescript +import { SubscribersControllerGetSubscriberRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetSubscriberRequest = { + subscriberId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `includeTopics` | *string* | :heavy_minus_sign: | Includes the topics associated with the subscriber | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetsubscriberresponse.md b/docs/models/operations/subscriberscontrollergetsubscriberresponse.md new file mode 100644 index 00000000..1b9b405e --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetsubscriberresponse.md @@ -0,0 +1,30 @@ +# SubscribersControllerGetSubscriberResponse + +## Example Usage + +```typescript +import { SubscribersControllerGetSubscriberResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetSubscriberResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetunseencountrequest.md b/docs/models/operations/subscriberscontrollergetunseencountrequest.md new file mode 100644 index 00000000..be7f9ad7 --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetunseencountrequest.md @@ -0,0 +1,21 @@ +# SubscribersControllerGetUnseenCountRequest + +## Example Usage + +```typescript +import { SubscribersControllerGetUnseenCountRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetUnseenCountRequest = { + seen: false, + subscriberId: "", + limit: 6667.67, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `seen` | *boolean* | :heavy_check_mark: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `limit` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollergetunseencountresponse.md b/docs/models/operations/subscriberscontrollergetunseencountresponse.md new file mode 100644 index 00000000..5f1db382 --- /dev/null +++ b/docs/models/operations/subscriberscontrollergetunseencountresponse.md @@ -0,0 +1,25 @@ +# SubscribersControllerGetUnseenCountResponse + +## Example Usage + +```typescript +import { SubscribersControllerGetUnseenCountResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerGetUnseenCountResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + count: 6706.38, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.UnseenCountResponse](../../models/components/unseencountresponse.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerlistsubscriberpreferencesrequest.md b/docs/models/operations/subscriberscontrollerlistsubscriberpreferencesrequest.md new file mode 100644 index 00000000..fdc52a3e --- /dev/null +++ b/docs/models/operations/subscriberscontrollerlistsubscriberpreferencesrequest.md @@ -0,0 +1,18 @@ +# SubscribersControllerListSubscriberPreferencesRequest + +## Example Usage + +```typescript +import { SubscribersControllerListSubscriberPreferencesRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerListSubscriberPreferencesRequest = { + subscriberId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `includeInactiveChannels` | *boolean* | :heavy_minus_sign: | A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerlistsubscriberpreferencesresponse.md b/docs/models/operations/subscriberscontrollerlistsubscriberpreferencesresponse.md new file mode 100644 index 00000000..bddcc179 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerlistsubscriberpreferencesresponse.md @@ -0,0 +1,38 @@ +# SubscribersControllerListSubscriberPreferencesResponse + +## Example Usage + +```typescript +import { SubscribersControllerListSubscriberPreferencesResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerListSubscriberPreferencesResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + { + template: { + id: "", + name: "", + critical: false, + triggers: [ + "", + ], + }, + preference: { + enabled: false, + channels: {}, + }, + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.UpdateSubscriberPreferenceResponseDto](../../models/components/updatesubscriberpreferenceresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerlistsubscribersrequest.md b/docs/models/operations/subscriberscontrollerlistsubscribersrequest.md new file mode 100644 index 00000000..b96e44f9 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerlistsubscribersrequest.md @@ -0,0 +1,16 @@ +# SubscribersControllerListSubscribersRequest + +## Example Usage + +```typescript +import { SubscribersControllerListSubscribersRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerListSubscribersRequest = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `page` | *number* | :heavy_minus_sign: | N/A | +| `limit` | *number* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerlistsubscribersresponse.md b/docs/models/operations/subscriberscontrollerlistsubscribersresponse.md new file mode 100644 index 00000000..0e8e1a77 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerlistsubscribersresponse.md @@ -0,0 +1,37 @@ +# SubscribersControllerListSubscribersResponse + +## Example Usage + +```typescript +import { SubscribersControllerListSubscribersResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerListSubscribersResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + page: 4614.79, + hasMore: false, + pageSize: 7805.29, + data: [ + { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [operations.SubscribersControllerListSubscribersResponseBody](../../models/operations/subscriberscontrollerlistsubscribersresponsebody.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerlistsubscribersresponsebody.md b/docs/models/operations/subscriberscontrollerlistsubscribersresponsebody.md new file mode 100644 index 00000000..d52b116f --- /dev/null +++ b/docs/models/operations/subscriberscontrollerlistsubscribersresponsebody.md @@ -0,0 +1,32 @@ +# SubscribersControllerListSubscribersResponseBody + +## Example Usage + +```typescript +import { SubscribersControllerListSubscribersResponseBody } from "@novu/api/models/operations"; + +let value: SubscribersControllerListSubscribersResponseBody = { + page: 9786.18, + hasMore: false, + pageSize: 7991.59, + data: [ + { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `page` | *number* | :heavy_check_mark: | The current page of the paginated response | +| `hasMore` | *boolean* | :heavy_check_mark: | Does the list have more items to fetch | +| `pageSize` | *number* | :heavy_check_mark: | Number of items on each page | +| `data` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermarkactionasseenrequest.md b/docs/models/operations/subscriberscontrollermarkactionasseenrequest.md new file mode 100644 index 00000000..9437042b --- /dev/null +++ b/docs/models/operations/subscriberscontrollermarkactionasseenrequest.md @@ -0,0 +1,25 @@ +# SubscribersControllerMarkActionAsSeenRequest + +## Example Usage + +```typescript +import { SubscribersControllerMarkActionAsSeenRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerMarkActionAsSeenRequest = { + messageId: "", + type: "", + subscriberId: "", + markMessageActionAsSeenDto: { + status: "done", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `messageId` | *string* | :heavy_check_mark: | N/A | +| `type` | *any* | :heavy_check_mark: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `markMessageActionAsSeenDto` | [components.MarkMessageActionAsSeenDto](../../models/components/markmessageactionasseendto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermarkactionasseenresponse.md b/docs/models/operations/subscriberscontrollermarkactionasseenresponse.md new file mode 100644 index 00000000..8880a20d --- /dev/null +++ b/docs/models/operations/subscriberscontrollermarkactionasseenresponse.md @@ -0,0 +1,47 @@ +# SubscribersControllerMarkActionAsSeenResponse + +## Example Usage + +```typescript +import { SubscribersControllerMarkActionAsSeenResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerMarkActionAsSeenResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + templateId: "", + environmentId: "", + messageTemplateId: "", + organizationId: "", + notificationId: "", + subscriberId: "", + createdAt: "", + content: { + type: "text", + content: "", + }, + transactionId: "", + channel: "in_app", + read: false, + seen: false, + cta: { + data: {}, + }, + status: "sent", + errorId: "", + errorText: "", + payload: {}, + overrides: {}, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.MessageResponseDto](../../models/components/messageresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermarkallunreadasreadrequest.md b/docs/models/operations/subscriberscontrollermarkallunreadasreadrequest.md new file mode 100644 index 00000000..201ffad6 --- /dev/null +++ b/docs/models/operations/subscriberscontrollermarkallunreadasreadrequest.md @@ -0,0 +1,21 @@ +# SubscribersControllerMarkAllUnreadAsReadRequest + +## Example Usage + +```typescript +import { SubscribersControllerMarkAllUnreadAsReadRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerMarkAllUnreadAsReadRequest = { + subscriberId: "", + markAllMessageAsRequestDto: { + markAs: "seen", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `markAllMessageAsRequestDto` | [components.MarkAllMessageAsRequestDto](../../models/components/markallmessageasrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermarkallunreadasreadresponse.md b/docs/models/operations/subscriberscontrollermarkallunreadasreadresponse.md new file mode 100644 index 00000000..a8d15823 --- /dev/null +++ b/docs/models/operations/subscriberscontrollermarkallunreadasreadresponse.md @@ -0,0 +1,23 @@ +# SubscribersControllerMarkAllUnreadAsReadResponse + +## Example Usage + +```typescript +import { SubscribersControllerMarkAllUnreadAsReadResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerMarkAllUnreadAsReadResponse = { + headers: { + "key": [ + "", + ], + }, + result: 3637.11, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | *number* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermarkmessagesasrequest.md b/docs/models/operations/subscriberscontrollermarkmessagesasrequest.md new file mode 100644 index 00000000..6869e508 --- /dev/null +++ b/docs/models/operations/subscriberscontrollermarkmessagesasrequest.md @@ -0,0 +1,22 @@ +# SubscribersControllerMarkMessagesAsRequest + +## Example Usage + +```typescript +import { SubscribersControllerMarkMessagesAsRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerMarkMessagesAsRequest = { + subscriberId: "", + messageMarkAsRequestDto: { + messageId: "", + markAs: "read", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `messageMarkAsRequestDto` | [components.MessageMarkAsRequestDto](../../models/components/messagemarkasrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermarkmessagesasresponse.md b/docs/models/operations/subscriberscontrollermarkmessagesasresponse.md new file mode 100644 index 00000000..080c2291 --- /dev/null +++ b/docs/models/operations/subscriberscontrollermarkmessagesasresponse.md @@ -0,0 +1,25 @@ +# SubscribersControllerMarkMessagesAsResponse + +## Example Usage + +```typescript +import { SubscribersControllerMarkMessagesAsResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerMarkMessagesAsResponse = { + headers: { + "key": [ + "", + ], + }, + result: [ + {}, + ], +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.MessageEntity](../../models/components/messageentity.md)[] | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermodifysubscriberchannelrequest.md b/docs/models/operations/subscriberscontrollermodifysubscriberchannelrequest.md new file mode 100644 index 00000000..9d4fa810 --- /dev/null +++ b/docs/models/operations/subscriberscontrollermodifysubscriberchannelrequest.md @@ -0,0 +1,24 @@ +# SubscribersControllerModifySubscriberChannelRequest + +## Example Usage + +```typescript +import { SubscribersControllerModifySubscriberChannelRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerModifySubscriberChannelRequest = { + subscriberId: "", + updateSubscriberChannelRequestDto: { + providerId: "getstream", + credentials: { + webhookUrl: "https://sorrowful-import.name/", + }, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberChannelRequestDto` | [components.UpdateSubscriberChannelRequestDto](../../models/components/updatesubscriberchannelrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollermodifysubscriberchannelresponse.md b/docs/models/operations/subscriberscontrollermodifysubscriberchannelresponse.md new file mode 100644 index 00000000..8c1d1364 --- /dev/null +++ b/docs/models/operations/subscriberscontrollermodifysubscriberchannelresponse.md @@ -0,0 +1,30 @@ +# SubscribersControllerModifySubscriberChannelResponse + +## Example Usage + +```typescript +import { SubscribersControllerModifySubscriberChannelResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerModifySubscriberChannelResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerremovesubscriberrequest.md b/docs/models/operations/subscriberscontrollerremovesubscriberrequest.md new file mode 100644 index 00000000..3f3a9ccb --- /dev/null +++ b/docs/models/operations/subscriberscontrollerremovesubscriberrequest.md @@ -0,0 +1,17 @@ +# SubscribersControllerRemoveSubscriberRequest + +## Example Usage + +```typescript +import { SubscribersControllerRemoveSubscriberRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerRemoveSubscriberRequest = { + subscriberId: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerremovesubscriberresponse.md b/docs/models/operations/subscriberscontrollerremovesubscriberresponse.md new file mode 100644 index 00000000..6b3a99da --- /dev/null +++ b/docs/models/operations/subscriberscontrollerremovesubscriberresponse.md @@ -0,0 +1,26 @@ +# SubscribersControllerRemoveSubscriberResponse + +## Example Usage + +```typescript +import { SubscribersControllerRemoveSubscriberResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerRemoveSubscriberResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + acknowledged: false, + status: "deleted", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.DeleteSubscriberResponseDto](../../models/components/deletesubscriberresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberchannelrequest.md b/docs/models/operations/subscriberscontrollerupdatesubscriberchannelrequest.md new file mode 100644 index 00000000..dd51367f --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberchannelrequest.md @@ -0,0 +1,24 @@ +# SubscribersControllerUpdateSubscriberChannelRequest + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberChannelRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberChannelRequest = { + subscriberId: "", + updateSubscriberChannelRequestDto: { + providerId: "msteams", + credentials: { + webhookUrl: "https://corrupt-unblinking.name", + }, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberChannelRequestDto` | [components.UpdateSubscriberChannelRequestDto](../../models/components/updatesubscriberchannelrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberchannelresponse.md b/docs/models/operations/subscriberscontrollerupdatesubscriberchannelresponse.md new file mode 100644 index 00000000..bf20d9c1 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberchannelresponse.md @@ -0,0 +1,30 @@ +# SubscribersControllerUpdateSubscriberChannelResponse + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberChannelResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberChannelResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberglobalpreferencesrequest.md b/docs/models/operations/subscriberscontrollerupdatesubscriberglobalpreferencesrequest.md new file mode 100644 index 00000000..ddcd4cda --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberglobalpreferencesrequest.md @@ -0,0 +1,19 @@ +# SubscribersControllerUpdateSubscriberGlobalPreferencesRequest + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberGlobalPreferencesRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberGlobalPreferencesRequest = { + subscriberId: "", + updateSubscriberGlobalPreferencesRequestDto: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberGlobalPreferencesRequestDto` | [components.UpdateSubscriberGlobalPreferencesRequestDto](../../models/components/updatesubscriberglobalpreferencesrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberglobalpreferencesresponse.md b/docs/models/operations/subscriberscontrollerupdatesubscriberglobalpreferencesresponse.md new file mode 100644 index 00000000..48ccd5a7 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberglobalpreferencesresponse.md @@ -0,0 +1,36 @@ +# SubscribersControllerUpdateSubscriberGlobalPreferencesResponse + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberGlobalPreferencesResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberGlobalPreferencesResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + template: { + id: "", + name: "", + critical: false, + triggers: [ + "", + ], + }, + preference: { + enabled: false, + channels: {}, + }, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.UpdateSubscriberPreferenceResponseDto](../../models/components/updatesubscriberpreferenceresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberonlineflagrequest.md b/docs/models/operations/subscriberscontrollerupdatesubscriberonlineflagrequest.md new file mode 100644 index 00000000..44b31f42 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberonlineflagrequest.md @@ -0,0 +1,21 @@ +# SubscribersControllerUpdateSubscriberOnlineFlagRequest + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberOnlineFlagRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberOnlineFlagRequest = { + subscriberId: "", + updateSubscriberOnlineFlagRequestDto: { + isOnline: false, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberOnlineFlagRequestDto` | [components.UpdateSubscriberOnlineFlagRequestDto](../../models/components/updatesubscriberonlineflagrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberonlineflagresponse.md b/docs/models/operations/subscriberscontrollerupdatesubscriberonlineflagresponse.md new file mode 100644 index 00000000..84bf07eb --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberonlineflagresponse.md @@ -0,0 +1,30 @@ +# SubscribersControllerUpdateSubscriberOnlineFlagResponse + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberOnlineFlagResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberOnlineFlagResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberpreferencerequest.md b/docs/models/operations/subscriberscontrollerupdatesubscriberpreferencerequest.md new file mode 100644 index 00000000..52454602 --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberpreferencerequest.md @@ -0,0 +1,21 @@ +# SubscribersControllerUpdateSubscriberPreferenceRequest + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberPreferenceRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberPreferenceRequest = { + subscriberId: "", + parameter: "", + updateSubscriberPreferenceRequestDto: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `parameter` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberPreferenceRequestDto` | [components.UpdateSubscriberPreferenceRequestDto](../../models/components/updatesubscriberpreferencerequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberpreferenceresponse.md b/docs/models/operations/subscriberscontrollerupdatesubscriberpreferenceresponse.md new file mode 100644 index 00000000..cf8d8d3b --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberpreferenceresponse.md @@ -0,0 +1,36 @@ +# SubscribersControllerUpdateSubscriberPreferenceResponse + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberPreferenceResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberPreferenceResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + template: { + id: "", + name: "", + critical: false, + triggers: [ + "", + ], + }, + preference: { + enabled: false, + channels: {}, + }, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.UpdateSubscriberPreferenceResponseDto](../../models/components/updatesubscriberpreferenceresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberrequest.md b/docs/models/operations/subscriberscontrollerupdatesubscriberrequest.md new file mode 100644 index 00000000..6e11a5eb --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberrequest.md @@ -0,0 +1,19 @@ +# SubscribersControllerUpdateSubscriberRequest + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberRequest } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberRequest = { + subscriberId: "", + updateSubscriberRequestDto: {}, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberRequestDto` | [components.UpdateSubscriberRequestDto](../../models/components/updatesubscriberrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/subscriberscontrollerupdatesubscriberresponse.md b/docs/models/operations/subscriberscontrollerupdatesubscriberresponse.md new file mode 100644 index 00000000..096c2fed --- /dev/null +++ b/docs/models/operations/subscriberscontrollerupdatesubscriberresponse.md @@ -0,0 +1,30 @@ +# SubscribersControllerUpdateSubscriberResponse + +## Example Usage + +```typescript +import { SubscribersControllerUpdateSubscriberResponse } from "@novu/api/models/operations"; + +let value: SubscribersControllerUpdateSubscriberResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + subscriberId: "", + organizationId: "", + environmentId: "", + deleted: false, + createdAt: "", + updatedAt: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.SubscriberResponseDto](../../models/components/subscriberresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrolleraddsubscribersrequest.md b/docs/models/operations/topicscontrolleraddsubscribersrequest.md new file mode 100644 index 00000000..d618fb15 --- /dev/null +++ b/docs/models/operations/topicscontrolleraddsubscribersrequest.md @@ -0,0 +1,23 @@ +# TopicsControllerAddSubscribersRequest + +## Example Usage + +```typescript +import { TopicsControllerAddSubscribersRequest } from "@novu/api/models/operations"; + +let value: TopicsControllerAddSubscribersRequest = { + topicKey: "", + addSubscribersRequestDto: { + subscribers: [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `addSubscribersRequestDto` | [components.AddSubscribersRequestDto](../../models/components/addsubscribersrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrolleraddsubscribersresponse.md b/docs/models/operations/topicscontrolleraddsubscribersresponse.md new file mode 100644 index 00000000..29fa2cf2 --- /dev/null +++ b/docs/models/operations/topicscontrolleraddsubscribersresponse.md @@ -0,0 +1,21 @@ +# TopicsControllerAddSubscribersResponse + +## Example Usage + +```typescript +import { TopicsControllerAddSubscribersResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerAddSubscribersResponse = { + headers: { + "key": [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollercreatetopicresponse.md b/docs/models/operations/topicscontrollercreatetopicresponse.md new file mode 100644 index 00000000..a4d12ed3 --- /dev/null +++ b/docs/models/operations/topicscontrollercreatetopicresponse.md @@ -0,0 +1,25 @@ +# TopicsControllerCreateTopicResponse + +## Example Usage + +```typescript +import { TopicsControllerCreateTopicResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerCreateTopicResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + key: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.CreateTopicResponseDto](../../models/components/createtopicresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerdeletetopicrequest.md b/docs/models/operations/topicscontrollerdeletetopicrequest.md new file mode 100644 index 00000000..91fa24c2 --- /dev/null +++ b/docs/models/operations/topicscontrollerdeletetopicrequest.md @@ -0,0 +1,17 @@ +# TopicsControllerDeleteTopicRequest + +## Example Usage + +```typescript +import { TopicsControllerDeleteTopicRequest } from "@novu/api/models/operations"; + +let value: TopicsControllerDeleteTopicRequest = { + topicKey: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerdeletetopicresponse.md b/docs/models/operations/topicscontrollerdeletetopicresponse.md new file mode 100644 index 00000000..0016e20e --- /dev/null +++ b/docs/models/operations/topicscontrollerdeletetopicresponse.md @@ -0,0 +1,21 @@ +# TopicsControllerDeleteTopicResponse + +## Example Usage + +```typescript +import { TopicsControllerDeleteTopicResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerDeleteTopicResponse = { + headers: { + "key": [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollergettopicrequest.md b/docs/models/operations/topicscontrollergettopicrequest.md new file mode 100644 index 00000000..10c3e7ba --- /dev/null +++ b/docs/models/operations/topicscontrollergettopicrequest.md @@ -0,0 +1,17 @@ +# TopicsControllerGetTopicRequest + +## Example Usage + +```typescript +import { TopicsControllerGetTopicRequest } from "@novu/api/models/operations"; + +let value: TopicsControllerGetTopicRequest = { + topicKey: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------ | ------------------ | ------------------ | ------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollergettopicresponse.md b/docs/models/operations/topicscontrollergettopicresponse.md new file mode 100644 index 00000000..44458224 --- /dev/null +++ b/docs/models/operations/topicscontrollergettopicresponse.md @@ -0,0 +1,31 @@ +# TopicsControllerGetTopicResponse + +## Example Usage + +```typescript +import { TopicsControllerGetTopicResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerGetTopicResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + organizationId: "", + environmentId: "", + key: "", + name: "", + subscribers: [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.GetTopicResponseDto](../../models/components/gettopicresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollergettopicsubscriberrequest.md b/docs/models/operations/topicscontrollergettopicsubscriberrequest.md new file mode 100644 index 00000000..5037dd89 --- /dev/null +++ b/docs/models/operations/topicscontrollergettopicsubscriberrequest.md @@ -0,0 +1,19 @@ +# TopicsControllerGetTopicSubscriberRequest + +## Example Usage + +```typescript +import { TopicsControllerGetTopicSubscriberRequest } from "@novu/api/models/operations"; + +let value: TopicsControllerGetTopicSubscriberRequest = { + externalSubscriberId: "", + topicKey: "", +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `externalSubscriberId` | *string* | :heavy_check_mark: | The external subscriber id | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollergettopicsubscriberresponse.md b/docs/models/operations/topicscontrollergettopicsubscriberresponse.md new file mode 100644 index 00000000..774ef9c1 --- /dev/null +++ b/docs/models/operations/topicscontrollergettopicsubscriberresponse.md @@ -0,0 +1,30 @@ +# TopicsControllerGetTopicSubscriberResponse + +## Example Usage + +```typescript +import { TopicsControllerGetTopicSubscriberResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerGetTopicSubscriberResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + organizationId: "", + environmentId: "", + subscriberId: "", + topicId: "", + topicKey: "", + externalSubscriberId: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.TopicSubscriberDto](../../models/components/topicsubscriberdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerlisttopicsrequest.md b/docs/models/operations/topicscontrollerlisttopicsrequest.md new file mode 100644 index 00000000..ef798d99 --- /dev/null +++ b/docs/models/operations/topicscontrollerlisttopicsrequest.md @@ -0,0 +1,17 @@ +# TopicsControllerListTopicsRequest + +## Example Usage + +```typescript +import { TopicsControllerListTopicsRequest } from "@novu/api/models/operations"; + +let value: TopicsControllerListTopicsRequest = {}; +``` + +## Fields + +| Field | Type | Required | Description | +| --------------------------------- | --------------------------------- | --------------------------------- | --------------------------------- | +| `page` | *number* | :heavy_minus_sign: | Number of page for the pagination | +| `pageSize` | *number* | :heavy_minus_sign: | Size of page for the pagination | +| `key` | *string* | :heavy_minus_sign: | Topic key | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerlisttopicsresponse.md b/docs/models/operations/topicscontrollerlisttopicsresponse.md new file mode 100644 index 00000000..5e2081d1 --- /dev/null +++ b/docs/models/operations/topicscontrollerlisttopicsresponse.md @@ -0,0 +1,38 @@ +# TopicsControllerListTopicsResponse + +## Example Usage + +```typescript +import { TopicsControllerListTopicsResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerListTopicsResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + data: [ + { + organizationId: "", + environmentId: "", + key: "", + name: "", + subscribers: [ + "", + ], + }, + ], + page: 2444.26, + pageSize: 1589.70, + totalCount: 1103.75, + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.FilterTopicsResponseDto](../../models/components/filtertopicsresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerremovesubscribersrequest.md b/docs/models/operations/topicscontrollerremovesubscribersrequest.md new file mode 100644 index 00000000..2120c9fe --- /dev/null +++ b/docs/models/operations/topicscontrollerremovesubscribersrequest.md @@ -0,0 +1,23 @@ +# TopicsControllerRemoveSubscribersRequest + +## Example Usage + +```typescript +import { TopicsControllerRemoveSubscribersRequest } from "@novu/api/models/operations"; + +let value: TopicsControllerRemoveSubscribersRequest = { + topicKey: "", + removeSubscribersRequestDto: { + subscribers: [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `removeSubscribersRequestDto` | [components.RemoveSubscribersRequestDto](../../models/components/removesubscribersrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerremovesubscribersresponse.md b/docs/models/operations/topicscontrollerremovesubscribersresponse.md new file mode 100644 index 00000000..bca5e233 --- /dev/null +++ b/docs/models/operations/topicscontrollerremovesubscribersresponse.md @@ -0,0 +1,21 @@ +# TopicsControllerRemoveSubscribersResponse + +## Example Usage + +```typescript +import { TopicsControllerRemoveSubscribersResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerRemoveSubscribersResponse = { + headers: { + "key": [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------- | -------------------------- | -------------------------- | -------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerrenametopicrequest.md b/docs/models/operations/topicscontrollerrenametopicrequest.md new file mode 100644 index 00000000..8f50fa1d --- /dev/null +++ b/docs/models/operations/topicscontrollerrenametopicrequest.md @@ -0,0 +1,21 @@ +# TopicsControllerRenameTopicRequest + +## Example Usage + +```typescript +import { TopicsControllerRenameTopicRequest } from "@novu/api/models/operations"; + +let value: TopicsControllerRenameTopicRequest = { + topicKey: "", + renameTopicRequestDto: { + name: "", + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `renameTopicRequestDto` | [components.RenameTopicRequestDto](../../models/components/renametopicrequestdto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/models/operations/topicscontrollerrenametopicresponse.md b/docs/models/operations/topicscontrollerrenametopicresponse.md new file mode 100644 index 00000000..2977f8cc --- /dev/null +++ b/docs/models/operations/topicscontrollerrenametopicresponse.md @@ -0,0 +1,31 @@ +# TopicsControllerRenameTopicResponse + +## Example Usage + +```typescript +import { TopicsControllerRenameTopicResponse } from "@novu/api/models/operations"; + +let value: TopicsControllerRenameTopicResponse = { + headers: { + "key": [ + "", + ], + }, + result: { + organizationId: "", + environmentId: "", + key: "", + name: "", + subscribers: [ + "", + ], + }, +}; +``` + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `headers` | Record | :heavy_check_mark: | N/A | +| `result` | [components.RenameTopicResponseDto](../../models/components/renametopicresponsedto.md) | :heavy_check_mark: | N/A | \ No newline at end of file diff --git a/docs/sdks/apikeys/README.md b/docs/sdks/apikeys/README.md new file mode 100644 index 00000000..166c1cb5 --- /dev/null +++ b/docs/sdks/apikeys/README.md @@ -0,0 +1,79 @@ +# ApiKeys +(*environments.apiKeys*) + +## Overview + +### Available Operations + +* [list](#list) - Get api keys + +## list + +Get api keys + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.environments.apiKeys.list(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { environmentsApiKeysList } from "@novu/api/funcs/environmentsApiKeysList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await environmentsApiKeysList(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.EnvironmentsControllerV1ListOrganizationApiKeysResponse](../../models/operations/environmentscontrollerv1listorganizationapikeysresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md new file mode 100644 index 00000000..879f43a1 --- /dev/null +++ b/docs/sdks/authentication/README.md @@ -0,0 +1,175 @@ +# Authentication +(*subscribers.authentication*) + +## Overview + +### Available Operations + +* [chatAccessOauthCallBack](#chataccessoauthcallback) - Handle providers oauth redirect +* [chatAccessOauth](#chataccessoauth) - Handle chat oauth + +## chatAccessOauthCallBack + +Handle providers oauth redirect + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.authentication.chatAccessOauthCallBack({ + subscriberId: "", + providerId: "", + code: "", + hmacHash: "", + environmentId: "", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersAuthenticationChatAccessOauthCallBack } from "@novu/api/funcs/subscribersAuthenticationChatAccessOauthCallBack.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersAuthenticationChatAccessOauthCallBack(novu, { + subscriberId: "", + providerId: "", + code: "", + hmacHash: "", + environmentId: "", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.SubscribersControllerChatOauthCallbackRequest](../../models/operations/subscriberscontrollerchatoauthcallbackrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerChatOauthCallbackResponse](../../models/operations/subscriberscontrollerchatoauthcallbackresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## chatAccessOauth + +Handle chat oauth + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.authentication.chatAccessOauth({ + subscriberId: "", + providerId: "", + hmacHash: "", + environmentId: "", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersAuthenticationChatAccessOauth } from "@novu/api/funcs/subscribersAuthenticationChatAccessOauth.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersAuthenticationChatAccessOauth(novu, { + subscriberId: "", + providerId: "", + hmacHash: "", + environmentId: "", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.SubscribersControllerChatAccessOauthRequest](../../models/operations/subscriberscontrollerchataccessoauthrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerChatAccessOauthResponse](../../models/operations/subscriberscontrollerchataccessoauthresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/credentials/README.md b/docs/sdks/credentials/README.md new file mode 100644 index 00000000..9d6d880f --- /dev/null +++ b/docs/sdks/credentials/README.md @@ -0,0 +1,251 @@ +# Credentials +(*subscribers.credentials*) + +## Overview + +### Available Operations + +* [update](#update) - Update subscriber credentials +* [append](#append) - Modify subscriber credentials +* [delete](#delete) - Delete subscriber credentials by providerId + +## update + +Subscriber credentials associated to the delivery methods such as slack and push tokens. + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.credentials.update({ + providerId: "pushpad", + credentials: { + webhookUrl: "https://grown-worth.name", + }, + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersCredentialsUpdate } from "@novu/api/funcs/subscribersCredentialsUpdate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersCredentialsUpdate(novu, { + providerId: "pushpad", + credentials: { + webhookUrl: "https://grown-worth.name", + }, + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberChannelRequestDto` | [components.UpdateSubscriberChannelRequestDto](../../models/components/updatesubscriberchannelrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerUpdateSubscriberChannelResponse](../../models/operations/subscriberscontrollerupdatesubscriberchannelresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## append + +Subscriber credentials associated to the delivery methods such as slack and push tokens. + + This endpoint appends provided credentials and deviceTokens to the existing ones. + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.credentials.append({ + providerId: "zulip", + credentials: { + webhookUrl: "https://talkative-pop.org", + }, + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersCredentialsAppend } from "@novu/api/funcs/subscribersCredentialsAppend.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersCredentialsAppend(novu, { + providerId: "zulip", + credentials: { + webhookUrl: "https://talkative-pop.org", + }, + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberChannelRequestDto` | [components.UpdateSubscriberChannelRequestDto](../../models/components/updatesubscriberchannelrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerModifySubscriberChannelResponse](../../models/operations/subscriberscontrollermodifysubscriberchannelresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +Delete subscriber credentials such as slack and expo tokens. + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.credentials.delete("", ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersCredentialsDelete } from "@novu/api/funcs/subscribersCredentialsDelete.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersCredentialsDelete(novu, "", ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `providerId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerDeleteSubscriberCredentialsResponse](../../models/operations/subscriberscontrollerdeletesubscribercredentialsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/environments/README.md b/docs/sdks/environments/README.md new file mode 100644 index 00000000..90933a53 --- /dev/null +++ b/docs/sdks/environments/README.md @@ -0,0 +1,154 @@ +# Environments +(*environments*) + +## Overview + +Novu uses the concept of environments to ensure logical separation of your data and configuration. This means that subscribers, and preferences created in one environment are never accessible to another. + + +### Available Operations + +* [retrieve](#retrieve) - Get current environment +* [list](#list) - Get environments + +## retrieve + +Get current environment + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.environments.retrieve(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { environmentsRetrieve } from "@novu/api/funcs/environmentsRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await environmentsRetrieve(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.EnvironmentsControllerV1GetCurrentEnvironmentResponse](../../models/operations/environmentscontrollerv1getcurrentenvironmentresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +Get environments + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.environments.list(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { environmentsList } from "@novu/api/funcs/environmentsList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await environmentsList(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.EnvironmentsControllerV1ListMyEnvironmentsResponse](../../models/operations/environmentscontrollerv1listmyenvironmentsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/executiondetails/README.md b/docs/sdks/executiondetails/README.md new file mode 100644 index 00000000..150d009c --- /dev/null +++ b/docs/sdks/executiondetails/README.md @@ -0,0 +1,84 @@ +# ExecutionDetails +(*executionDetails*) + +## Overview + +Execution details are used to track the execution of a workflow. They provided detailed information on the execution of a workflow, including the status of each step, the input and output of each step, and the overall status of the execution. + + +### Available Operations + +* [retrieve](#retrieve) - Get execution details + +## retrieve + +Get execution details + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.executionDetails.retrieve("", ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { executionDetailsRetrieve } from "@novu/api/funcs/executionDetailsRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await executionDetailsRetrieve(novu, "", ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `notificationId` | *string* | :heavy_check_mark: | N/A | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse](../../models/operations/executiondetailscontrollergetexecutiondetailsfornotificationresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/integrations/README.md b/docs/sdks/integrations/README.md new file mode 100644 index 00000000..e54c9f26 --- /dev/null +++ b/docs/sdks/integrations/README.md @@ -0,0 +1,453 @@ +# Integrations +(*integrations*) + +## Overview + +With the help of the Integration Store, you can easily integrate your favorite delivery provider. During the runtime of the API, the Integrations Store is responsible for storing the configurations of all the providers. + + +### Available Operations + +* [list](#list) - Get integrations +* [create](#create) - Create integration +* [listActive](#listactive) - Get active integrations +* [update](#update) - Update integration +* [delete](#delete) - Delete integration +* [setAsPrimary](#setasprimary) - Set integration as primary + +## list + +Return all the integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.integrations.list(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { integrationsList } from "@novu/api/funcs/integrationsList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await integrationsList(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.IntegrationsControllerListIntegrationsResponse](../../models/operations/integrationscontrollerlistintegrationsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create + +Create an integration for the current environment the user is based on the API key provided + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.integrations.create({ + providerId: "", + channel: "sms", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { integrationsCreate } from "@novu/api/funcs/integrationsCreate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await integrationsCreate(novu, { + providerId: "", + channel: "sms", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.CreateIntegrationRequestDto](../../models/components/createintegrationrequestdto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.IntegrationsControllerCreateIntegrationResponse](../../models/operations/integrationscontrollercreateintegrationresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## listActive + +Return all the active integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.integrations.listActive(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { integrationsListActive } from "@novu/api/funcs/integrationsListActive.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await integrationsListActive(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.IntegrationsControllerGetActiveIntegrationsResponse](../../models/operations/integrationscontrollergetactiveintegrationsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## update + +Update integration + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.integrations.update({}, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { integrationsUpdate } from "@novu/api/funcs/integrationsUpdate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await integrationsUpdate(novu, {}, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `integrationId` | *string* | :heavy_check_mark: | N/A | +| `updateIntegrationRequestDto` | [components.UpdateIntegrationRequestDto](../../models/components/updateintegrationrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.IntegrationsControllerUpdateIntegrationByIdResponse](../../models/operations/integrationscontrollerupdateintegrationbyidresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +Delete integration + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.integrations.delete(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { integrationsDelete } from "@novu/api/funcs/integrationsDelete.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await integrationsDelete(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `integrationId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.IntegrationsControllerRemoveIntegrationResponse](../../models/operations/integrationscontrollerremoveintegrationresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## setAsPrimary + +Set integration as primary + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.integrations.setAsPrimary(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { integrationsSetAsPrimary } from "@novu/api/funcs/integrationsSetAsPrimary.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await integrationsSetAsPrimary(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `integrationId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.IntegrationsControllerSetIntegrationAsPrimaryResponse](../../models/operations/integrationscontrollersetintegrationasprimaryresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/messages/README.md b/docs/sdks/messages/README.md new file mode 100644 index 00000000..3821db0c --- /dev/null +++ b/docs/sdks/messages/README.md @@ -0,0 +1,230 @@ +# Messages +(*messages*) + +## Overview + +A message in Novu represents a notification delivered to a recipient on a particular channel. Messages contain information about the request that triggered its delivery, a view of the data sent to the recipient, and a timeline of its lifecycle events. Learn more about messages. + + +### Available Operations + +* [retrieve](#retrieve) - Get messages +* [delete](#delete) - Delete message +* [deleteByTransactionId](#deletebytransactionid) - Delete messages by transactionId + +## retrieve + +Returns a list of messages, could paginate using the `page` query parameter + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.messages.retrieve({}); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { messagesRetrieve } from "@novu/api/funcs/messagesRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await messagesRetrieve(novu, {}); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.MessagesControllerGetMessagesRequest](../../models/operations/messagescontrollergetmessagesrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.MessagesControllerGetMessagesResponse](../../models/operations/messagescontrollergetmessagesresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +Deletes a message entity from the Novu platform + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.messages.delete(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { messagesDelete } from "@novu/api/funcs/messagesDelete.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await messagesDelete(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `messageId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.MessagesControllerDeleteMessageResponse](../../models/operations/messagescontrollerdeletemessageresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## deleteByTransactionId + +Deletes messages entity from the Novu platform using TransactionId of message + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.messages.deleteByTransactionId(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { messagesDeleteByTransactionId } from "@novu/api/funcs/messagesDeleteByTransactionId.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await messagesDeleteByTransactionId(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `transactionId` | *string* | :heavy_check_mark: | N/A | +| `channel` | [operations.QueryParamChannel](../../models/operations/queryparamchannel.md) | :heavy_minus_sign: | The channel of the message to be deleted | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.MessagesControllerDeleteMessagesByTransactionIdResponse](../../models/operations/messagescontrollerdeletemessagesbytransactionidresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/notifications/README.md b/docs/sdks/notifications/README.md new file mode 100644 index 00000000..09ed556c --- /dev/null +++ b/docs/sdks/notifications/README.md @@ -0,0 +1,187 @@ +# Notifications +(*notifications*) + +## Overview + +### Available Operations + +* [list](#list) - Get notifications +* [retrieve](#retrieve) - Get notification + +## list + +Get notifications + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.notifications.list({ + channels: [ + "sms", + "chat", + "in_app", + ], + templates: [ + "", + ], + emails: [ + "", + ], + search: "", + subscriberIds: [ + "", + "", + ], + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { notificationsList } from "@novu/api/funcs/notificationsList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await notificationsList(novu, { + channels: [ + "sms", + "chat", + "in_app", + ], + templates: [ + "", + ], + emails: [ + "", + ], + search: "", + subscriberIds: [ + "", + "", + ], + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.NotificationsControllerListNotificationsRequest](../../models/operations/notificationscontrollerlistnotificationsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationsControllerListNotificationsResponse](../../models/operations/notificationscontrollerlistnotificationsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## retrieve + +Get notification + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.notifications.retrieve(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { notificationsRetrieve } from "@novu/api/funcs/notificationsRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await notificationsRetrieve(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `notificationId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationsControllerGetNotificationResponse](../../models/operations/notificationscontrollergetnotificationresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/novu/README.md b/docs/sdks/novu/README.md new file mode 100644 index 00000000..be1d0edb --- /dev/null +++ b/docs/sdks/novu/README.md @@ -0,0 +1,437 @@ +# Novu SDK + +## Overview + +Novu API: Novu REST API. Please see https://docs.novu.co/api-reference for more details. + +Novu Documentation + + +### Available Operations + +* [trigger](#trigger) - Trigger event +* [triggerBulk](#triggerbulk) - Bulk trigger event +* [triggerBroadcast](#triggerbroadcast) - Broadcast event to all +* [cancelByTransactionId](#cancelbytransactionid) - Cancel triggered event + +## trigger + + + Trigger event is the main (and only) way to send notifications to subscribers. + The trigger identifier is used to match the particular workflow associated with it. + Additional information can be passed according the body interface below. + + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.trigger({ + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + { + topicKey: "", + type: "Topic", + }, + ], + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { trigger } from "@novu/api/funcs/trigger.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await trigger(novu, { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + { + topicKey: "", + type: "Topic", + }, + ], + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.TriggerEventRequestDto](../../models/components/triggereventrequestdto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.EventsControllerTriggerResponse](../../models/operations/eventscontrollertriggerresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## triggerBulk + + + Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API. + The bulk API is limited to 100 events per request. + + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.triggerBulk({ + events: [ + { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + { + subscriberId: "", + }, + ], + }, + { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + ], + }, + { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + { + topicKey: "", + type: "Topic", + }, + ], + }, + ], + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { triggerBulk } from "@novu/api/funcs/triggerBulk.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await triggerBulk(novu, { + events: [ + { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + { + subscriberId: "", + }, + ], + }, + { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + ], + }, + { + name: "workflow_identifier", + payload: {}, + overrides: {}, + to: [ + { + topicKey: "", + type: "Topic", + }, + { + topicKey: "", + type: "Topic", + }, + ], + }, + ], + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.BulkTriggerEventDto](../../models/components/bulktriggereventdto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.EventsControllerTriggerBulkResponse](../../models/operations/eventscontrollertriggerbulkresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## triggerBroadcast + +Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc. + + In the future could be used to trigger events to a subset of subscribers based on defined filters. + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.triggerBroadcast({ + name: "", + payload: {}, + overrides: {}, + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { triggerBroadcast } from "@novu/api/funcs/triggerBroadcast.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await triggerBroadcast(novu, { + name: "", + payload: {}, + overrides: {}, + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.TriggerEventToAllRequestDto](../../models/components/triggereventtoallrequestdto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.EventsControllerBroadcastEventToAllResponse](../../models/operations/eventscontrollerbroadcasteventtoallresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## cancelByTransactionId + + + Using a previously generated transactionId during the event trigger, + will cancel any active or pending workflows. This is useful to cancel active digests, delays etc... + + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.cancelByTransactionId(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { cancelByTransactionId } from "@novu/api/funcs/cancelByTransactionId.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await cancelByTransactionId(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `transactionId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.EventsControllerCancelResponse](../../models/operations/eventscontrollercancelresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/novumessages/README.md b/docs/sdks/novumessages/README.md new file mode 100644 index 00000000..a48fcb6d --- /dev/null +++ b/docs/sdks/novumessages/README.md @@ -0,0 +1,252 @@ +# NovuMessages +(*subscribers.messages*) + +## Overview + +### Available Operations + +* [markAllAs](#markallas) - Mark a subscriber messages as seen, read, unseen or unread +* [markAll](#markall) - Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed. +* [updateAsSeen](#updateasseen) - Mark message action as seen + +## markAllAs + +Mark a subscriber messages as seen, read, unseen or unread + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.messages.markAllAs({ + messageId: "", + markAs: "read", + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersMessagesMarkAllAs } from "@novu/api/funcs/subscribersMessagesMarkAllAs.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersMessagesMarkAllAs(novu, { + messageId: "", + markAs: "read", + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `messageMarkAsRequestDto` | [components.MessageMarkAsRequestDto](../../models/components/messagemarkasrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerMarkMessagesAsResponse](../../models/operations/subscriberscontrollermarkmessagesasresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## markAll + +Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed. + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.messages.markAll({ + markAs: "seen", + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersMessagesMarkAll } from "@novu/api/funcs/subscribersMessagesMarkAll.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersMessagesMarkAll(novu, { + markAs: "seen", + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `markAllMessageAsRequestDto` | [components.MarkAllMessageAsRequestDto](../../models/components/markallmessageasrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerMarkAllUnreadAsReadResponse](../../models/operations/subscriberscontrollermarkallunreadasreadresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## updateAsSeen + +Mark message action as seen + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.messages.updateAsSeen({ + messageId: "", + type: "", + subscriberId: "", + markMessageActionAsSeenDto: { + status: "done", + }, + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersMessagesUpdateAsSeen } from "@novu/api/funcs/subscribersMessagesUpdateAsSeen.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersMessagesUpdateAsSeen(novu, { + messageId: "", + type: "", + subscriberId: "", + markMessageActionAsSeenDto: { + status: "done", + }, + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.SubscribersControllerMarkActionAsSeenRequest](../../models/operations/subscriberscontrollermarkactionasseenrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerMarkActionAsSeenResponse](../../models/operations/subscriberscontrollermarkactionasseenresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/novunotifications/README.md b/docs/sdks/novunotifications/README.md new file mode 100644 index 00000000..63357980 --- /dev/null +++ b/docs/sdks/novunotifications/README.md @@ -0,0 +1,167 @@ +# NovuNotifications +(*subscribers.notifications*) + +## Overview + +### Available Operations + +* [retrieve](#retrieve) - Get in-app notification feed for a particular subscriber +* [unseenCount](#unseencount) - Get the unseen in-app notifications count for subscribers feed + +## retrieve + +Get in-app notification feed for a particular subscriber + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.notifications.retrieve({ + subscriberId: "", + payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersNotificationsRetrieve } from "@novu/api/funcs/subscribersNotificationsRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersNotificationsRetrieve(novu, { + subscriberId: "", + payload: "btoa(JSON.stringify({ foo: 123 })) results in base64 encoded string like eyJmb28iOjEyM30=", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.SubscribersControllerGetNotificationsFeedRequest](../../models/operations/subscriberscontrollergetnotificationsfeedrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerGetNotificationsFeedResponse](../../models/operations/subscriberscontrollergetnotificationsfeedresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## unseenCount + +Get the unseen in-app notifications count for subscribers feed + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.notifications.unseenCount({ + seen: false, + subscriberId: "", + limit: 2979.49, + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersNotificationsUnseenCount } from "@novu/api/funcs/subscribersNotificationsUnseenCount.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersNotificationsUnseenCount(novu, { + seen: false, + subscriberId: "", + limit: 2979.49, + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.SubscribersControllerGetUnseenCountRequest](../../models/operations/subscriberscontrollergetunseencountrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerGetUnseenCountResponse](../../models/operations/subscriberscontrollergetunseencountresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/novusubscribers/README.md b/docs/sdks/novusubscribers/README.md new file mode 100644 index 00000000..caeaf6c7 --- /dev/null +++ b/docs/sdks/novusubscribers/README.md @@ -0,0 +1,249 @@ +# NovuSubscribers +(*topics.subscribers*) + +## Overview + +### Available Operations + +* [assign](#assign) - Subscribers addition +* [retrieve](#retrieve) - Check topic subscriber +* [delete](#delete) - Subscribers removal + +## assign + +Add subscribers to a topic by key + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.subscribers.assign({ + subscribers: [ + "", + "", + ], + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsSubscribersAssign } from "@novu/api/funcs/topicsSubscribersAssign.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsSubscribersAssign(novu, { + subscribers: [ + "", + "", + ], + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `addSubscribersRequestDto` | [components.AddSubscribersRequestDto](../../models/components/addsubscribersrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerAddSubscribersResponse](../../models/operations/topicscontrolleraddsubscribersresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## retrieve + +Check if a subscriber belongs to a certain topic + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.subscribers.retrieve("", ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsSubscribersRetrieve } from "@novu/api/funcs/topicsSubscribersRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsSubscribersRetrieve(novu, "", ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `externalSubscriberId` | *string* | :heavy_check_mark: | The external subscriber id | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerGetTopicSubscriberResponse](../../models/operations/topicscontrollergettopicsubscriberresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +Remove subscribers from a topic + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.subscribers.delete({ + subscribers: [ + "", + "", + ], + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsSubscribersDelete } from "@novu/api/funcs/topicsSubscribersDelete.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsSubscribersDelete(novu, { + subscribers: [ + "", + "", + ], + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `removeSubscribersRequestDto` | [components.RemoveSubscribersRequestDto](../../models/components/removesubscribersrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerRemoveSubscribersResponse](../../models/operations/topicscontrollerremovesubscribersresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/preferences/README.md b/docs/sdks/preferences/README.md new file mode 100644 index 00000000..a8f3b2ce --- /dev/null +++ b/docs/sdks/preferences/README.md @@ -0,0 +1,315 @@ +# Preferences +(*subscribers.preferences*) + +## Overview + +### Available Operations + +* [list](#list) - Get subscriber preferences +* [updateGlobal](#updateglobal) - Update subscriber global preferences +* [retrieveByLevel](#retrievebylevel) - Get subscriber preferences by level +* [update](#update) - Update subscriber preference + +## list + +Get subscriber preferences + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.preferences.list(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersPreferencesList } from "@novu/api/funcs/subscribersPreferencesList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersPreferencesList(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `includeInactiveChannels` | *boolean* | :heavy_minus_sign: | A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerListSubscriberPreferencesResponse](../../models/operations/subscriberscontrollerlistsubscriberpreferencesresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## updateGlobal + +Update subscriber global preferences + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.preferences.updateGlobal({}, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersPreferencesUpdateGlobal } from "@novu/api/funcs/subscribersPreferencesUpdateGlobal.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersPreferencesUpdateGlobal(novu, {}, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberGlobalPreferencesRequestDto` | [components.UpdateSubscriberGlobalPreferencesRequestDto](../../models/components/updatesubscriberglobalpreferencesrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerUpdateSubscriberGlobalPreferencesResponse](../../models/operations/subscriberscontrollerupdatesubscriberglobalpreferencesresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## retrieveByLevel + +Get subscriber preferences by level + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.preferences.retrieveByLevel({ + parameter: "global", + subscriberId: "", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersPreferencesRetrieveByLevel } from "@novu/api/funcs/subscribersPreferencesRetrieveByLevel.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersPreferencesRetrieveByLevel(novu, { + parameter: "global", + subscriberId: "", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.SubscribersControllerGetSubscriberPreferenceByLevelRequest](../../models/operations/subscriberscontrollergetsubscriberpreferencebylevelrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerGetSubscriberPreferenceByLevelResponse](../../models/operations/subscriberscontrollergetsubscriberpreferencebylevelresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## update + +Update subscriber preference + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.preferences.update({ + subscriberId: "", + parameter: "", + updateSubscriberPreferenceRequestDto: {}, + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersPreferencesUpdate } from "@novu/api/funcs/subscribersPreferencesUpdate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersPreferencesUpdate(novu, { + subscriberId: "", + parameter: "", + updateSubscriberPreferenceRequestDto: {}, + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.SubscribersControllerUpdateSubscriberPreferenceRequest](../../models/operations/subscriberscontrollerupdatesubscriberpreferencerequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerUpdateSubscriberPreferenceResponse](../../models/operations/subscriberscontrollerupdatesubscriberpreferenceresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/properties/README.md b/docs/sdks/properties/README.md new file mode 100644 index 00000000..3d2dba0a --- /dev/null +++ b/docs/sdks/properties/README.md @@ -0,0 +1,85 @@ +# Properties +(*subscribers.properties*) + +## Overview + +### Available Operations + +* [updateOnlineFlag](#updateonlineflag) - Update subscriber online status + +## updateOnlineFlag + +Used to update the subscriber isOnline flag. + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.properties.updateOnlineFlag({ + isOnline: true, + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersPropertiesUpdateOnlineFlag } from "@novu/api/funcs/subscribersPropertiesUpdateOnlineFlag.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersPropertiesUpdateOnlineFlag(novu, { + isOnline: true, + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberOnlineFlagRequestDto` | [components.UpdateSubscriberOnlineFlagRequestDto](../../models/components/updatesubscriberonlineflagrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerUpdateSubscriberOnlineFlagResponse](../../models/operations/subscriberscontrollerupdatesubscriberonlineflagresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/stats/README.md b/docs/sdks/stats/README.md new file mode 100644 index 00000000..5cd03b19 --- /dev/null +++ b/docs/sdks/stats/README.md @@ -0,0 +1,152 @@ +# Stats +(*notifications.stats*) + +## Overview + +### Available Operations + +* [retrieve](#retrieve) - Get notification statistics +* [graph](#graph) - Get notification graph statistics + +## retrieve + +Get notification statistics + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.notifications.stats.retrieve(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { notificationsStatsRetrieve } from "@novu/api/funcs/notificationsStatsRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await notificationsStatsRetrieve(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationsControllerGetActivityStatsResponse](../../models/operations/notificationscontrollergetactivitystatsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## graph + +Get notification graph statistics + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.notifications.stats.graph(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { notificationsStatsGraph } from "@novu/api/funcs/notificationsStatsGraph.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await notificationsStatsGraph(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `days` | *number* | :heavy_minus_sign: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationsControllerGetActivityGraphStatsResponse](../../models/operations/notificationscontrollergetactivitygraphstatsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/subscribers/README.md b/docs/sdks/subscribers/README.md new file mode 100644 index 00000000..849106c8 --- /dev/null +++ b/docs/sdks/subscribers/README.md @@ -0,0 +1,470 @@ +# Subscribers +(*subscribers*) + +## Overview + +A subscriber in Novu represents someone who should receive a message. A subscriber’s profile information contains important attributes about the subscriber that will be used in messages (name, email). The subscriber object can contain other key-value pairs that can be used to further personalize your messages. + + +### Available Operations + +* [list](#list) - Get subscribers +* [create](#create) - Create subscriber +* [retrieve](#retrieve) - Get subscriber +* [update](#update) - Update subscriber +* [delete](#delete) - Delete subscriber +* [createBulk](#createbulk) - Bulk create subscribers + +## list + +Returns a list of subscribers, could paginated using the `page` and `limit` query parameter + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.list(); + + for await (const page of result) { + // Handle the page + console.log(page); + } +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersList } from "@novu/api/funcs/subscribersList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersList(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + for await (const page of result) { + // Handle the page + console.log(page); + } +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `page` | *number* | :heavy_minus_sign: | N/A | +| `limit` | *number* | :heavy_minus_sign: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerListSubscribersResponse](../../models/operations/subscriberscontrollerlistsubscribersresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## create + +Creates a subscriber entity, in the Novu platform. The subscriber will be later used to receive notifications, and access notification feeds. Communication credentials such as email, phone number, and 3 rd party credentials i.e slack tokens could be later associated to this entity. + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.create({ + subscriberId: "", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersCreate } from "@novu/api/funcs/subscribersCreate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersCreate(novu, { + subscriberId: "", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.CreateSubscriberRequestDto](../../models/components/createsubscriberrequestdto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerCreateSubscriberResponse](../../models/operations/subscriberscontrollercreatesubscriberresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## retrieve + +Get subscriber by your internal id used to identify the subscriber + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.retrieve(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersRetrieve } from "@novu/api/funcs/subscribersRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersRetrieve(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `includeTopics` | *string* | :heavy_minus_sign: | Includes the topics associated with the subscriber | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerGetSubscriberResponse](../../models/operations/subscriberscontrollergetsubscriberresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## update + +Used to update the subscriber entity with new information + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.update({}, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersUpdate } from "@novu/api/funcs/subscribersUpdate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersUpdate(novu, {}, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `updateSubscriberRequestDto` | [components.UpdateSubscriberRequestDto](../../models/components/updatesubscriberrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerUpdateSubscriberResponse](../../models/operations/subscriberscontrollerupdatesubscriberresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +Deletes a subscriber entity from the Novu platform + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.delete(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersDelete } from "@novu/api/funcs/subscribersDelete.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersDelete(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `subscriberId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerRemoveSubscriberResponse](../../models/operations/subscriberscontrollerremovesubscriberresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## createBulk + + + Using this endpoint you can create multiple subscribers at once, to avoid multiple calls to the API. + The bulk API is limited to 500 subscribers per request. + + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.subscribers.createBulk({ + subscribers: [ + "", + ], + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { subscribersCreateBulk } from "@novu/api/funcs/subscribersCreateBulk.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await subscribersCreateBulk(novu, { + subscribers: [ + "", + ], + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.BulkSubscriberCreateDto](../../models/components/bulksubscribercreatedto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.SubscribersControllerBulkCreateSubscribersResponse](../../models/operations/subscriberscontrollerbulkcreatesubscribersresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/topics/README.md b/docs/sdks/topics/README.md new file mode 100644 index 00000000..6bfcdf0e --- /dev/null +++ b/docs/sdks/topics/README.md @@ -0,0 +1,386 @@ +# Topics +(*topics*) + +## Overview + +Topics are a way to group subscribers together so that they can be notified of events at once. A topic is identified by a custom key. This can be helpful for things like sending out marketing emails or notifying users of new features. Topics can also be used to send notifications to the subscribers who have been grouped together based on their interests, location, activities and much more. + + +### Available Operations + +* [create](#create) - Topic creation +* [list](#list) - Filter topics +* [delete](#delete) - Delete topic +* [retrieve](#retrieve) - Get topic +* [rename](#rename) - Rename a topic + +## create + +Create a topic + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.create({ + key: "", + name: "", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsCreate } from "@novu/api/funcs/topicsCreate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsCreate(novu, { + key: "", + name: "", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.CreateTopicRequestDto](../../models/components/createtopicrequestdto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerCreateTopicResponse](../../models/operations/topicscontrollercreatetopicresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +Returns a list of topics that can be paginated using the `page` query parameter and filtered by the topic key with the `key` query parameter + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.list({}); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsList } from "@novu/api/funcs/topicsList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsList(novu, {}); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [operations.TopicsControllerListTopicsRequest](../../models/operations/topicscontrollerlisttopicsrequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerListTopicsResponse](../../models/operations/topicscontrollerlisttopicsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +Delete a topic by its topic key if it has no subscribers + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.delete(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsDelete } from "@novu/api/funcs/topicsDelete.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsDelete(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerDeleteTopicResponse](../../models/operations/topicscontrollerdeletetopicresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## retrieve + +Get a topic by its topic key + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.retrieve(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsRetrieve } from "@novu/api/funcs/topicsRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsRetrieve(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerGetTopicResponse](../../models/operations/topicscontrollergettopicresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## rename + +Rename a topic by providing a new name + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.topics.rename({ + name: "", + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { topicsRename } from "@novu/api/funcs/topicsRename.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await topicsRename(novu, { + name: "", + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `topicKey` | *string* | :heavy_check_mark: | The topic key | +| `renameTopicRequestDto` | [components.RenameTopicRequestDto](../../models/components/renametopicrequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.TopicsControllerRenameTopicResponse](../../models/operations/topicscontrollerrenametopicresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/webhooks/README.md b/docs/sdks/webhooks/README.md new file mode 100644 index 00000000..5497d0aa --- /dev/null +++ b/docs/sdks/webhooks/README.md @@ -0,0 +1,80 @@ +# Webhooks +(*integrations.webhooks*) + +## Overview + +### Available Operations + +* [retrieve](#retrieve) - Get webhook support status for provider + +## retrieve + +Return the status of the webhook for this provider, if it is supported or if it is not based on a boolean value + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.integrations.webhooks.retrieve(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { integrationsWebhooksRetrieve } from "@novu/api/funcs/integrationsWebhooksRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await integrationsWebhooksRetrieve(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `providerOrIntegrationId` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.IntegrationsControllerGetWebhookSupportStatusResponse](../../models/operations/integrationscontrollergetwebhooksupportstatusresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/workflowgroups/README.md b/docs/sdks/workflowgroups/README.md new file mode 100644 index 00000000..d0d7e3ba --- /dev/null +++ b/docs/sdks/workflowgroups/README.md @@ -0,0 +1,382 @@ +# WorkflowGroups +(*workflowGroups*) + +## Overview + +Workflow groups are used to organize workflows into logical groups. + +### Available Operations + +* [create](#create) - Create workflow group +* [list](#list) - Get workflow groups +* [retrieve](#retrieve) - Get workflow group +* [update](#update) - Update workflow group +* [delete](#delete) - Delete workflow group + +## create + +workflow group was previously named notification group + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.workflowGroups.create({ + name: "", + }); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { workflowGroupsCreate } from "@novu/api/funcs/workflowGroupsCreate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await workflowGroupsCreate(novu, { + name: "", + }); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `request` | [components.CreateNotificationGroupRequestDto](../../models/components/createnotificationgrouprequestdto.md) | :heavy_check_mark: | The request object to use for the request. | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationGroupsControllerCreateNotificationGroupResponse](../../models/operations/notificationgroupscontrollercreatenotificationgroupresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## list + +workflow group was previously named notification group + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.workflowGroups.list(); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { workflowGroupsList } from "@novu/api/funcs/workflowGroupsList.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await workflowGroupsList(novu); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationGroupsControllerListNotificationGroupsResponse](../../models/operations/notificationgroupscontrollerlistnotificationgroupsresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## retrieve + +workflow group was previously named notification group + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.workflowGroups.retrieve(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { workflowGroupsRetrieve } from "@novu/api/funcs/workflowGroupsRetrieve.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await workflowGroupsRetrieve(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationGroupsControllerGetNotificationGroupResponse](../../models/operations/notificationgroupscontrollergetnotificationgroupresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## update + +workflow group was previously named notification group + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.workflowGroups.update({ + name: "", + }, ""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { workflowGroupsUpdate } from "@novu/api/funcs/workflowGroupsUpdate.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await workflowGroupsUpdate(novu, { + name: "", + }, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | +| `createNotificationGroupRequestDto` | [components.CreateNotificationGroupRequestDto](../../models/components/createnotificationgrouprequestdto.md) | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationGroupsControllerUpdateNotificationGroupResponse](../../models/operations/notificationgroupscontrollerupdatenotificationgroupresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | + +## delete + +workflow group was previously named notification group + +### Example Usage + +```typescript +import { Novu } from "@novu/api"; + +const novu = new Novu({ + apiKey: "", +}); + +async function run() { + const result = await novu.workflowGroups.delete(""); + + // Handle the result + console.log(result); +} + +run(); +``` + +### Standalone function + +The standalone function version of this method: + +```typescript +import { NovuCore } from "@novu/api/core.js"; +import { workflowGroupsDelete } from "@novu/api/funcs/workflowGroupsDelete.js"; + +// Use `NovuCore` for best tree-shaking performance. +// You can create one instance of it to use across an application. +const novu = new NovuCore({ + apiKey: "", +}); + +async function run() { + const res = await workflowGroupsDelete(novu, ""); + + if (!res.ok) { + throw res.error; + } + + const { value: result } = res; + + // Handle the result + console.log(result); +} + +run(); +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `id` | *string* | :heavy_check_mark: | N/A | +| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. | +| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. | +| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. | + +### Response + +**Promise\<[operations.NotificationGroupsControllerDeleteNotificationGroupResponse](../../models/operations/notificationgroupscontrollerdeletenotificationgroupresponse.md)\>** + +### Errors + +| Error Type | Status Code | Content Type | +| --------------- | --------------- | --------------- | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/src/core.ts b/src/core.ts new file mode 100644 index 00000000..8e7a79d7 --- /dev/null +++ b/src/core.ts @@ -0,0 +1,13 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { ClientSDK } from "./lib/sdks.js"; + +/** + * A minimal client to use when calling standalone SDK functions. Typically, an + * instance of this class would be instantiated once at the start of an + * application and passed around through some dependency injection mechanism to + * parts of an application that need to make SDK calls. + */ +export class NovuCore extends ClientSDK {} diff --git a/src/funcs/cancelByTransactionId.ts b/src/funcs/cancelByTransactionId.ts new file mode 100644 index 00000000..6198c6de --- /dev/null +++ b/src/funcs/cancelByTransactionId.ts @@ -0,0 +1,154 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Cancel triggered event + * + * @remarks + * + * Using a previously generated transactionId during the event trigger, + * will cancel any active or pending workflows. This is useful to cancel active digests, delays etc... + */ +export async function cancelByTransactionId( + client: NovuCore, + transactionId: string, + options?: RequestOptions, +): Promise< + Result< + operations.EventsControllerCancelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.EventsControllerCancelRequest = { + transactionId: transactionId, + }; + + const parsed = safeParse( + input, + (value) => + operations.EventsControllerCancelRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + transactionId: encodeSimple("transactionId", payload.transactionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/events/trigger/{transactionId}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "EventsController_cancel", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.EventsControllerCancelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json(200, operations.EventsControllerCancelResponse$inboundSchema, { + hdrs: true, + key: "Result", + }), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/environmentsApiKeysList.ts b/src/funcs/environmentsApiKeysList.ts new file mode 100644 index 00000000..834bb9a3 --- /dev/null +++ b/src/funcs/environmentsApiKeysList.ts @@ -0,0 +1,124 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get api keys + */ +export async function environmentsApiKeysList( + client: NovuCore, + options?: RequestOptions, +): Promise< + Result< + operations.EnvironmentsControllerV1ListOrganizationApiKeysResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path = pathToFunc("/v1/environments/api-keys")(); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "EnvironmentsControllerV1_listOrganizationApiKeys", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.EnvironmentsControllerV1ListOrganizationApiKeysResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .EnvironmentsControllerV1ListOrganizationApiKeysResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/environmentsList.ts b/src/funcs/environmentsList.ts new file mode 100644 index 00000000..a89ef071 --- /dev/null +++ b/src/funcs/environmentsList.ts @@ -0,0 +1,124 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get environments + */ +export async function environmentsList( + client: NovuCore, + options?: RequestOptions, +): Promise< + Result< + operations.EnvironmentsControllerV1ListMyEnvironmentsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path = pathToFunc("/v1/environments")(); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "EnvironmentsControllerV1_listMyEnvironments", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.EnvironmentsControllerV1ListMyEnvironmentsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .EnvironmentsControllerV1ListMyEnvironmentsResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/environmentsRetrieve.ts b/src/funcs/environmentsRetrieve.ts new file mode 100644 index 00000000..dfbd74df --- /dev/null +++ b/src/funcs/environmentsRetrieve.ts @@ -0,0 +1,124 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get current environment + */ +export async function environmentsRetrieve( + client: NovuCore, + options?: RequestOptions, +): Promise< + Result< + operations.EnvironmentsControllerV1GetCurrentEnvironmentResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path = pathToFunc("/v1/environments/me")(); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "EnvironmentsControllerV1_getCurrentEnvironment", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.EnvironmentsControllerV1GetCurrentEnvironmentResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .EnvironmentsControllerV1GetCurrentEnvironmentResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/executionDetailsRetrieve.ts b/src/funcs/executionDetailsRetrieve.ts new file mode 100644 index 00000000..75a9bd93 --- /dev/null +++ b/src/funcs/executionDetailsRetrieve.ts @@ -0,0 +1,157 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get execution details + */ +export async function executionDetailsRetrieve( + client: NovuCore, + notificationId: string, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest = + { + notificationId: notificationId, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const path = pathToFunc("/v1/execution-details")(); + + const query = encodeFormQuery({ + "notificationId": payload.notificationId, + "subscriberId": payload.subscriberId, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: + "ExecutionDetailsController_getExecutionDetailsForNotification", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/integrationsCreate.ts b/src/funcs/integrationsCreate.ts new file mode 100644 index 00000000..85abc07a --- /dev/null +++ b/src/funcs/integrationsCreate.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Create integration + * + * @remarks + * Create an integration for the current environment the user is based on the API key provided + */ +export async function integrationsCreate( + client: NovuCore, + request: components.CreateIntegrationRequestDto, + options?: RequestOptions, +): Promise< + Result< + operations.IntegrationsControllerCreateIntegrationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + components.CreateIntegrationRequestDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/integrations")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "IntegrationsController_createIntegration", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.IntegrationsControllerCreateIntegrationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 201, + operations.IntegrationsControllerCreateIntegrationResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/integrationsDelete.ts b/src/funcs/integrationsDelete.ts new file mode 100644 index 00000000..564e1e4d --- /dev/null +++ b/src/funcs/integrationsDelete.ts @@ -0,0 +1,151 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete integration + */ +export async function integrationsDelete( + client: NovuCore, + integrationId: string, + options?: RequestOptions, +): Promise< + Result< + operations.IntegrationsControllerRemoveIntegrationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.IntegrationsControllerRemoveIntegrationRequest = { + integrationId: integrationId, + }; + + const parsed = safeParse( + input, + (value) => + operations.IntegrationsControllerRemoveIntegrationRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + integrationId: encodeSimple("integrationId", payload.integrationId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/integrations/{integrationId}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "IntegrationsController_removeIntegration", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.IntegrationsControllerRemoveIntegrationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.IntegrationsControllerRemoveIntegrationResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/integrationsList.ts b/src/funcs/integrationsList.ts new file mode 100644 index 00000000..bf621189 --- /dev/null +++ b/src/funcs/integrationsList.ts @@ -0,0 +1,126 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get integrations + * + * @remarks + * Return all the integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change + */ +export async function integrationsList( + client: NovuCore, + options?: RequestOptions, +): Promise< + Result< + operations.IntegrationsControllerListIntegrationsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path = pathToFunc("/v1/integrations")(); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "IntegrationsController_listIntegrations", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.IntegrationsControllerListIntegrationsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.IntegrationsControllerListIntegrationsResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/integrationsListActive.ts b/src/funcs/integrationsListActive.ts new file mode 100644 index 00000000..aaeba337 --- /dev/null +++ b/src/funcs/integrationsListActive.ts @@ -0,0 +1,127 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get active integrations + * + * @remarks + * Return all the active integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change + */ +export async function integrationsListActive( + client: NovuCore, + options?: RequestOptions, +): Promise< + Result< + operations.IntegrationsControllerGetActiveIntegrationsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path = pathToFunc("/v1/integrations/active")(); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "IntegrationsController_getActiveIntegrations", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.IntegrationsControllerGetActiveIntegrationsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .IntegrationsControllerGetActiveIntegrationsResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/integrationsSetAsPrimary.ts b/src/funcs/integrationsSetAsPrimary.ts new file mode 100644 index 00000000..e3baf90e --- /dev/null +++ b/src/funcs/integrationsSetAsPrimary.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Set integration as primary + */ +export async function integrationsSetAsPrimary( + client: NovuCore, + integrationId: string, + options?: RequestOptions, +): Promise< + Result< + operations.IntegrationsControllerSetIntegrationAsPrimaryResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.IntegrationsControllerSetIntegrationAsPrimaryRequest = + { + integrationId: integrationId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .IntegrationsControllerSetIntegrationAsPrimaryRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + integrationId: encodeSimple("integrationId", payload.integrationId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/integrations/{integrationId}/set-primary")( + pathParams, + ); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "IntegrationsController_setIntegrationAsPrimary", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["404", "409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.IntegrationsControllerSetIntegrationAsPrimaryResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .IntegrationsControllerSetIntegrationAsPrimaryResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([404, 409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/integrationsUpdate.ts b/src/funcs/integrationsUpdate.ts new file mode 100644 index 00000000..75764de9 --- /dev/null +++ b/src/funcs/integrationsUpdate.ts @@ -0,0 +1,159 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Update integration + */ +export async function integrationsUpdate( + client: NovuCore, + updateIntegrationRequestDto: components.UpdateIntegrationRequestDto, + integrationId: string, + options?: RequestOptions, +): Promise< + Result< + operations.IntegrationsControllerUpdateIntegrationByIdResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.IntegrationsControllerUpdateIntegrationByIdRequest = { + updateIntegrationRequestDto: updateIntegrationRequestDto, + integrationId: integrationId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .IntegrationsControllerUpdateIntegrationByIdRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.UpdateIntegrationRequestDto, { + explode: true, + }); + + const pathParams = { + integrationId: encodeSimple("integrationId", payload.integrationId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/integrations/{integrationId}")(pathParams); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "IntegrationsController_updateIntegrationById", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PUT", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["404", "409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.IntegrationsControllerUpdateIntegrationByIdResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .IntegrationsControllerUpdateIntegrationByIdResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([404, 409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/integrationsWebhooksRetrieve.ts b/src/funcs/integrationsWebhooksRetrieve.ts new file mode 100644 index 00000000..2f11ee97 --- /dev/null +++ b/src/funcs/integrationsWebhooksRetrieve.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get webhook support status for provider + * + * @remarks + * Return the status of the webhook for this provider, if it is supported or if it is not based on a boolean value + */ +export async function integrationsWebhooksRetrieve( + client: NovuCore, + providerOrIntegrationId: string, + options?: RequestOptions, +): Promise< + Result< + operations.IntegrationsControllerGetWebhookSupportStatusResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.IntegrationsControllerGetWebhookSupportStatusRequest = + { + providerOrIntegrationId: providerOrIntegrationId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .IntegrationsControllerGetWebhookSupportStatusRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + providerOrIntegrationId: encodeSimple( + "providerOrIntegrationId", + payload.providerOrIntegrationId, + { explode: false, charEncoding: "percent" }, + ), + }; + + const path = pathToFunc( + "/v1/integrations/webhook/provider/{providerOrIntegrationId}/status", + )(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "IntegrationsController_getWebhookSupportStatus", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.IntegrationsControllerGetWebhookSupportStatusResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .IntegrationsControllerGetWebhookSupportStatusResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/messagesDelete.ts b/src/funcs/messagesDelete.ts new file mode 100644 index 00000000..b7a5121a --- /dev/null +++ b/src/funcs/messagesDelete.ts @@ -0,0 +1,155 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete message + * + * @remarks + * Deletes a message entity from the Novu platform + */ +export async function messagesDelete( + client: NovuCore, + messageId: string, + options?: RequestOptions, +): Promise< + Result< + operations.MessagesControllerDeleteMessageResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.MessagesControllerDeleteMessageRequest = { + messageId: messageId, + }; + + const parsed = safeParse( + input, + (value) => + operations.MessagesControllerDeleteMessageRequest$outboundSchema.parse( + value, + ), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + messageId: encodeSimple("messageId", payload.messageId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/messages/{messageId}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "MessagesController_deleteMessage", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.MessagesControllerDeleteMessageResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.MessagesControllerDeleteMessageResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/messagesDeleteByTransactionId.ts b/src/funcs/messagesDeleteByTransactionId.ts new file mode 100644 index 00000000..74617b66 --- /dev/null +++ b/src/funcs/messagesDeleteByTransactionId.ts @@ -0,0 +1,169 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete messages by transactionId + * + * @remarks + * Deletes messages entity from the Novu platform using TransactionId of message + */ +export async function messagesDeleteByTransactionId( + client: NovuCore, + transactionId: string, + channel?: operations.QueryParamChannel | undefined, + options?: RequestOptions, +): Promise< + Result< + | operations.MessagesControllerDeleteMessagesByTransactionIdResponse + | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.MessagesControllerDeleteMessagesByTransactionIdRequest = { + transactionId: transactionId, + channel: channel, + }; + + const parsed = safeParse( + input, + (value) => + operations + .MessagesControllerDeleteMessagesByTransactionIdRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + transactionId: encodeSimple("transactionId", payload.transactionId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/messages/transaction/{transactionId}")( + pathParams, + ); + + const query = encodeFormQuery({ + "channel": payload.channel, + }); + + const headers = new Headers({ + Accept: "*/*", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "MessagesController_deleteMessagesByTransactionId", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + | operations.MessagesControllerDeleteMessagesByTransactionIdResponse + | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.nil( + 204, + operations + .MessagesControllerDeleteMessagesByTransactionIdResponse$inboundSchema + .optional(), + { hdrs: true }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/messagesRetrieve.ts b/src/funcs/messagesRetrieve.ts new file mode 100644 index 00000000..a6c96530 --- /dev/null +++ b/src/funcs/messagesRetrieve.ts @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get messages + * + * @remarks + * Returns a list of messages, could paginate using the `page` query parameter + */ +export async function messagesRetrieve( + client: NovuCore, + request: operations.MessagesControllerGetMessagesRequest, + options?: RequestOptions, +): Promise< + Result< + operations.MessagesControllerGetMessagesResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.MessagesControllerGetMessagesRequest$outboundSchema.parse( + value, + ), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const path = pathToFunc("/v1/messages")(); + + const query = encodeFormQuery({ + "channel": payload.channel, + "limit": payload.limit, + "page": payload.page, + "subscriberId": payload.subscriberId, + "transactionId": payload.transactionId, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "MessagesController_getMessages", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.MessagesControllerGetMessagesResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.MessagesControllerGetMessagesResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/notificationsList.ts b/src/funcs/notificationsList.ts new file mode 100644 index 00000000..b81a75be --- /dev/null +++ b/src/funcs/notificationsList.ts @@ -0,0 +1,151 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get notifications + */ +export async function notificationsList( + client: NovuCore, + request: operations.NotificationsControllerListNotificationsRequest, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationsControllerListNotificationsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.NotificationsControllerListNotificationsRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const path = pathToFunc("/v1/notifications")(); + + const query = encodeFormQuery({ + "channels": payload.channels, + "emails": payload.emails, + "page": payload.page, + "search": payload.search, + "subscriberIds": payload.subscriberIds, + "templates": payload.templates, + "transactionId": payload.transactionId, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationsController_listNotifications", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationsControllerListNotificationsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.NotificationsControllerListNotificationsResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/notificationsRetrieve.ts b/src/funcs/notificationsRetrieve.ts new file mode 100644 index 00000000..c18ce6a2 --- /dev/null +++ b/src/funcs/notificationsRetrieve.ts @@ -0,0 +1,151 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get notification + */ +export async function notificationsRetrieve( + client: NovuCore, + notificationId: string, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationsControllerGetNotificationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.NotificationsControllerGetNotificationRequest = { + notificationId: notificationId, + }; + + const parsed = safeParse( + input, + (value) => + operations.NotificationsControllerGetNotificationRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + notificationId: encodeSimple("notificationId", payload.notificationId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/notifications/{notificationId}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationsController_getNotification", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationsControllerGetNotificationResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.NotificationsControllerGetNotificationResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/notificationsStatsGraph.ts b/src/funcs/notificationsStatsGraph.ts new file mode 100644 index 00000000..518bac45 --- /dev/null +++ b/src/funcs/notificationsStatsGraph.ts @@ -0,0 +1,152 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get notification graph statistics + */ +export async function notificationsStatsGraph( + client: NovuCore, + days?: number | undefined, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationsControllerGetActivityGraphStatsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.NotificationsControllerGetActivityGraphStatsRequest = + { + days: days, + }; + + const parsed = safeParse( + input, + (value) => + operations + .NotificationsControllerGetActivityGraphStatsRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const path = pathToFunc("/v1/notifications/graph/stats")(); + + const query = encodeFormQuery({ + "days": payload.days, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationsController_getActivityGraphStats", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationsControllerGetActivityGraphStatsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .NotificationsControllerGetActivityGraphStatsResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/notificationsStatsRetrieve.ts b/src/funcs/notificationsStatsRetrieve.ts new file mode 100644 index 00000000..d90ece34 --- /dev/null +++ b/src/funcs/notificationsStatsRetrieve.ts @@ -0,0 +1,123 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get notification statistics + */ +export async function notificationsStatsRetrieve( + client: NovuCore, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationsControllerGetActivityStatsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path = pathToFunc("/v1/notifications/stats")(); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationsController_getActivityStats", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationsControllerGetActivityStatsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.NotificationsControllerGetActivityStatsResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersAuthenticationChatAccessOauth.ts b/src/funcs/subscribersAuthenticationChatAccessOauth.ts new file mode 100644 index 00000000..08684004 --- /dev/null +++ b/src/funcs/subscribersAuthenticationChatAccessOauth.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Handle chat oauth + */ +export async function subscribersAuthenticationChatAccessOauth( + client: NovuCore, + request: operations.SubscribersControllerChatAccessOauthRequest, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerChatAccessOauthResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.SubscribersControllerChatAccessOauthRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + providerId: encodeSimple("providerId", payload.providerId, { + explode: false, + charEncoding: "percent", + }), + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/subscribers/{subscriberId}/credentials/{providerId}/oauth", + )(pathParams); + + const query = encodeFormQuery({ + "environmentId": payload.environmentId, + "hmacHash": payload.hmacHash, + "integrationIdentifier": payload.integrationIdentifier, + }); + + const headers = new Headers({ + Accept: "*/*", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_chatAccessOauth", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerChatAccessOauthResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.nil( + 200, + operations.SubscribersControllerChatAccessOauthResponse$inboundSchema + .optional(), + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersAuthenticationChatAccessOauthCallBack.ts b/src/funcs/subscribersAuthenticationChatAccessOauthCallBack.ts new file mode 100644 index 00000000..f4d70e72 --- /dev/null +++ b/src/funcs/subscribersAuthenticationChatAccessOauthCallBack.ts @@ -0,0 +1,161 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Handle providers oauth redirect + */ +export async function subscribersAuthenticationChatAccessOauthCallBack( + client: NovuCore, + request: operations.SubscribersControllerChatOauthCallbackRequest, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerChatOauthCallbackResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.SubscribersControllerChatOauthCallbackRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + providerId: encodeSimple("providerId", payload.providerId, { + explode: false, + charEncoding: "percent", + }), + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/subscribers/{subscriberId}/credentials/{providerId}/oauth/callback", + )(pathParams); + + const query = encodeFormQuery({ + "code": payload.code, + "environmentId": payload.environmentId, + "hmacHash": payload.hmacHash, + "integrationIdentifier": payload.integrationIdentifier, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_chatOauthCallback", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerChatOauthCallbackResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.SubscribersControllerChatOauthCallbackResponse$inboundSchema, + { key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersCreate.ts b/src/funcs/subscribersCreate.ts new file mode 100644 index 00000000..3b5f1f56 --- /dev/null +++ b/src/funcs/subscribersCreate.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Create subscriber + * + * @remarks + * Creates a subscriber entity, in the Novu platform. The subscriber will be later used to receive notifications, and access notification feeds. Communication credentials such as email, phone number, and 3 rd party credentials i.e slack tokens could be later associated to this entity. + */ +export async function subscribersCreate( + client: NovuCore, + request: components.CreateSubscriberRequestDto, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerCreateSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + components.CreateSubscriberRequestDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/subscribers")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_createSubscriber", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerCreateSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 201, + operations.SubscribersControllerCreateSubscriberResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersCreateBulk.ts b/src/funcs/subscribersCreateBulk.ts new file mode 100644 index 00000000..009682f8 --- /dev/null +++ b/src/funcs/subscribersCreateBulk.ts @@ -0,0 +1,146 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Bulk create subscribers + * + * @remarks + * + * Using this endpoint you can create multiple subscribers at once, to avoid multiple calls to the API. + * The bulk API is limited to 500 subscribers per request. + */ +export async function subscribersCreateBulk( + client: NovuCore, + request: components.BulkSubscriberCreateDto, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerBulkCreateSubscribersResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => components.BulkSubscriberCreateDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/subscribers/bulk")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "*/*", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_bulkCreateSubscribers", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerBulkCreateSubscribersResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.nil( + 201, + operations + .SubscribersControllerBulkCreateSubscribersResponse$inboundSchema + .optional(), + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersCredentialsAppend.ts b/src/funcs/subscribersCredentialsAppend.ts new file mode 100644 index 00000000..f5674ecf --- /dev/null +++ b/src/funcs/subscribersCredentialsAppend.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Modify subscriber credentials + * + * @remarks + * Subscriber credentials associated to the delivery methods such as slack and push tokens. + * + * This endpoint appends provided credentials and deviceTokens to the existing ones. + */ +export async function subscribersCredentialsAppend( + client: NovuCore, + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerModifySubscriberChannelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.SubscribersControllerModifySubscriberChannelRequest = + { + updateSubscriberChannelRequestDto: updateSubscriberChannelRequestDto, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .SubscribersControllerModifySubscriberChannelRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.UpdateSubscriberChannelRequestDto, { + explode: true, + }); + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/credentials")( + pathParams, + ); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_modifySubscriberChannel", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PATCH", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerModifySubscriberChannelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerModifySubscriberChannelResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersCredentialsDelete.ts b/src/funcs/subscribersCredentialsDelete.ts new file mode 100644 index 00000000..ed006cbf --- /dev/null +++ b/src/funcs/subscribersCredentialsDelete.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete subscriber credentials by providerId + * + * @remarks + * Delete subscriber credentials such as slack and expo tokens. + */ +export async function subscribersCredentialsDelete( + client: NovuCore, + subscriberId: string, + providerId: string, + options?: RequestOptions, +): Promise< + Result< + | operations.SubscribersControllerDeleteSubscriberCredentialsResponse + | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.SubscribersControllerDeleteSubscriberCredentialsRequest = { + subscriberId: subscriberId, + providerId: providerId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .SubscribersControllerDeleteSubscriberCredentialsRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + providerId: encodeSimple("providerId", payload.providerId, { + explode: false, + charEncoding: "percent", + }), + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/subscribers/{subscriberId}/credentials/{providerId}", + )(pathParams); + + const headers = new Headers({ + Accept: "*/*", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_deleteSubscriberCredentials", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + | operations.SubscribersControllerDeleteSubscriberCredentialsResponse + | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.nil( + 204, + operations + .SubscribersControllerDeleteSubscriberCredentialsResponse$inboundSchema + .optional(), + { hdrs: true }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersCredentialsUpdate.ts b/src/funcs/subscribersCredentialsUpdate.ts new file mode 100644 index 00000000..f5f507f1 --- /dev/null +++ b/src/funcs/subscribersCredentialsUpdate.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Update subscriber credentials + * + * @remarks + * Subscriber credentials associated to the delivery methods such as slack and push tokens. + */ +export async function subscribersCredentialsUpdate( + client: NovuCore, + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerUpdateSubscriberChannelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.SubscribersControllerUpdateSubscriberChannelRequest = + { + updateSubscriberChannelRequestDto: updateSubscriberChannelRequestDto, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .SubscribersControllerUpdateSubscriberChannelRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.UpdateSubscriberChannelRequestDto, { + explode: true, + }); + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/credentials")( + pathParams, + ); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_updateSubscriberChannel", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PUT", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerUpdateSubscriberChannelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerUpdateSubscriberChannelResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersDelete.ts b/src/funcs/subscribersDelete.ts new file mode 100644 index 00000000..09d9f88b --- /dev/null +++ b/src/funcs/subscribersDelete.ts @@ -0,0 +1,154 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete subscriber + * + * @remarks + * Deletes a subscriber entity from the Novu platform + */ +export async function subscribersDelete( + client: NovuCore, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerRemoveSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.SubscribersControllerRemoveSubscriberRequest = { + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations.SubscribersControllerRemoveSubscriberRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_removeSubscriber", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerRemoveSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.SubscribersControllerRemoveSubscriberResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersList.ts b/src/funcs/subscribersList.ts new file mode 100644 index 00000000..edad860b --- /dev/null +++ b/src/funcs/subscribersList.ts @@ -0,0 +1,203 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { dlv } from "../lib/dlv.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; +import { + createPageIterator, + haltIterator, + PageIterator, + Paginator, +} from "../types/operations.js"; + +/** + * Get subscribers + * + * @remarks + * Returns a list of subscribers, could paginated using the `page` and `limit` query parameter + */ +export async function subscribersList( + client: NovuCore, + page?: number | undefined, + limit?: number | undefined, + options?: RequestOptions, +): Promise< + PageIterator< + Result< + operations.SubscribersControllerListSubscribersResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > + > +> { + const input: operations.SubscribersControllerListSubscribersRequest = { + page: page, + limit: limit, + }; + + const parsed = safeParse( + input, + (value) => + operations.SubscribersControllerListSubscribersRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return haltIterator(parsed); + } + const payload = parsed.value; + const body = null; + + const path = pathToFunc("/v1/subscribers")(); + + const query = encodeFormQuery({ + "limit": payload.limit, + "page": payload.page, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_listSubscribers", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return haltIterator(requestRes); + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return haltIterator(doResult); + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result, raw] = await M.match< + operations.SubscribersControllerListSubscribersResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.SubscribersControllerListSubscribersResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return haltIterator(result); + } + + const nextFunc = ( + responseData: unknown, + ): Paginator< + Result< + operations.SubscribersControllerListSubscribersResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > + > => { + const page = input?.page || 0; + const nextPage = page + 1; + + if (!responseData) { + return () => null; + } + const results = dlv(responseData, "data.resultArray"); + if (!Array.isArray(results) || !results.length) { + return () => null; + } + const limit = input?.limit || 0; + if (results.length < limit) { + return () => null; + } + + return () => + subscribersList( + client, + nextPage, + limit, + options, + ); + }; + + const page$ = { ...result, next: nextFunc(raw) }; + return { ...page$, ...createPageIterator(page$, (v) => !v.ok) }; +} diff --git a/src/funcs/subscribersMessagesMarkAll.ts b/src/funcs/subscribersMessagesMarkAll.ts new file mode 100644 index 00000000..4d5df079 --- /dev/null +++ b/src/funcs/subscribersMessagesMarkAll.ts @@ -0,0 +1,159 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed. + */ +export async function subscribersMessagesMarkAll( + client: NovuCore, + markAllMessageAsRequestDto: components.MarkAllMessageAsRequestDto, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerMarkAllUnreadAsReadResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.SubscribersControllerMarkAllUnreadAsReadRequest = { + markAllMessageAsRequestDto: markAllMessageAsRequestDto, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations.SubscribersControllerMarkAllUnreadAsReadRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.MarkAllMessageAsRequestDto, { + explode: true, + }); + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/messages/mark-all")( + pathParams, + ); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_markAllUnreadAsRead", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerMarkAllUnreadAsReadResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 201, + operations.SubscribersControllerMarkAllUnreadAsReadResponse$inboundSchema, + { key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersMessagesMarkAllAs.ts b/src/funcs/subscribersMessagesMarkAllAs.ts new file mode 100644 index 00000000..30029091 --- /dev/null +++ b/src/funcs/subscribersMessagesMarkAllAs.ts @@ -0,0 +1,159 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Mark a subscriber messages as seen, read, unseen or unread + */ +export async function subscribersMessagesMarkAllAs( + client: NovuCore, + messageMarkAsRequestDto: components.MessageMarkAsRequestDto, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerMarkMessagesAsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.SubscribersControllerMarkMessagesAsRequest = { + messageMarkAsRequestDto: messageMarkAsRequestDto, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations.SubscribersControllerMarkMessagesAsRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.MessageMarkAsRequestDto, { + explode: true, + }); + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/messages/mark-as")( + pathParams, + ); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_markMessagesAs", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerMarkMessagesAsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 201, + operations.SubscribersControllerMarkMessagesAsResponse$inboundSchema, + { key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersMessagesUpdateAsSeen.ts b/src/funcs/subscribersMessagesUpdateAsSeen.ts new file mode 100644 index 00000000..0fc8ece6 --- /dev/null +++ b/src/funcs/subscribersMessagesUpdateAsSeen.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Mark message action as seen + */ +export async function subscribersMessagesUpdateAsSeen( + client: NovuCore, + request: operations.SubscribersControllerMarkActionAsSeenRequest, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerMarkActionAsSeenResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.SubscribersControllerMarkActionAsSeenRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.MarkMessageActionAsSeenDto, { + explode: true, + }); + + const pathParams = { + messageId: encodeSimple("messageId", payload.messageId, { + explode: false, + charEncoding: "percent", + }), + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + type: encodeSimple("type", payload.type, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/subscribers/{subscriberId}/messages/{messageId}/actions/{type}", + )(pathParams); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_markActionAsSeen", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerMarkActionAsSeenResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 201, + operations.SubscribersControllerMarkActionAsSeenResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersNotificationsRetrieve.ts b/src/funcs/subscribersNotificationsRetrieve.ts new file mode 100644 index 00000000..8c3615ff --- /dev/null +++ b/src/funcs/subscribersNotificationsRetrieve.ts @@ -0,0 +1,159 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get in-app notification feed for a particular subscriber + */ +export async function subscribersNotificationsRetrieve( + client: NovuCore, + request: operations.SubscribersControllerGetNotificationsFeedRequest, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerGetNotificationsFeedResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.SubscribersControllerGetNotificationsFeedRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/notifications/feed")( + pathParams, + ); + + const query = encodeFormQuery({ + "limit": payload.limit, + "page": payload.page, + "payload": payload.payload, + "read": payload.read, + "seen": payload.seen, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_getNotificationsFeed", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerGetNotificationsFeedResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerGetNotificationsFeedResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersNotificationsUnseenCount.ts b/src/funcs/subscribersNotificationsUnseenCount.ts new file mode 100644 index 00000000..0589d80e --- /dev/null +++ b/src/funcs/subscribersNotificationsUnseenCount.ts @@ -0,0 +1,155 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get the unseen in-app notifications count for subscribers feed + */ +export async function subscribersNotificationsUnseenCount( + client: NovuCore, + request: operations.SubscribersControllerGetUnseenCountRequest, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerGetUnseenCountResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.SubscribersControllerGetUnseenCountRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/subscribers/{subscriberId}/notifications/unseen", + )(pathParams); + + const query = encodeFormQuery({ + "limit": payload.limit, + "seen": payload.seen, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_getUnseenCount", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerGetUnseenCountResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.SubscribersControllerGetUnseenCountResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersPreferencesList.ts b/src/funcs/subscribersPreferencesList.ts new file mode 100644 index 00000000..0207dcfd --- /dev/null +++ b/src/funcs/subscribersPreferencesList.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get subscriber preferences + */ +export async function subscribersPreferencesList( + client: NovuCore, + subscriberId: string, + includeInactiveChannels?: boolean | undefined, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerListSubscriberPreferencesResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.SubscribersControllerListSubscriberPreferencesRequest = { + subscriberId: subscriberId, + includeInactiveChannels: includeInactiveChannels, + }; + + const parsed = safeParse( + input, + (value) => + operations + .SubscribersControllerListSubscriberPreferencesRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/preferences")( + pathParams, + ); + + const query = encodeFormQuery({ + "includeInactiveChannels": payload.includeInactiveChannels, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_listSubscriberPreferences", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerListSubscriberPreferencesResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerListSubscriberPreferencesResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersPreferencesRetrieveByLevel.ts b/src/funcs/subscribersPreferencesRetrieveByLevel.ts new file mode 100644 index 00000000..351067b7 --- /dev/null +++ b/src/funcs/subscribersPreferencesRetrieveByLevel.ts @@ -0,0 +1,161 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get subscriber preferences by level + */ +export async function subscribersPreferencesRetrieveByLevel( + client: NovuCore, + request: + operations.SubscribersControllerGetSubscriberPreferenceByLevelRequest, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerGetSubscriberPreferenceByLevelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations + .SubscribersControllerGetSubscriberPreferenceByLevelRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + parameter: encodeSimple("parameter", payload.parameter, { + explode: false, + charEncoding: "percent", + }), + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/subscribers/{subscriberId}/preferences/{parameter}", + )(pathParams); + + const query = encodeFormQuery({ + "includeInactiveChannels": payload.includeInactiveChannels, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_getSubscriberPreferenceByLevel", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerGetSubscriberPreferenceByLevelResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerGetSubscriberPreferenceByLevelResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersPreferencesUpdate.ts b/src/funcs/subscribersPreferencesUpdate.ts new file mode 100644 index 00000000..67682342 --- /dev/null +++ b/src/funcs/subscribersPreferencesUpdate.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Update subscriber preference + */ +export async function subscribersPreferencesUpdate( + client: NovuCore, + request: operations.SubscribersControllerUpdateSubscriberPreferenceRequest, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerUpdateSubscriberPreferenceResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations + .SubscribersControllerUpdateSubscriberPreferenceRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON( + "body", + payload.UpdateSubscriberPreferenceRequestDto, + { explode: true }, + ); + + const pathParams = { + parameter: encodeSimple("parameter", payload.parameter, { + explode: false, + charEncoding: "percent", + }), + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/subscribers/{subscriberId}/preferences/{parameter}", + )(pathParams); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_updateSubscriberPreference", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PATCH", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerUpdateSubscriberPreferenceResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerUpdateSubscriberPreferenceResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersPreferencesUpdateGlobal.ts b/src/funcs/subscribersPreferencesUpdateGlobal.ts new file mode 100644 index 00000000..8d22e367 --- /dev/null +++ b/src/funcs/subscribersPreferencesUpdateGlobal.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Update subscriber global preferences + */ +export async function subscribersPreferencesUpdateGlobal( + client: NovuCore, + updateSubscriberGlobalPreferencesRequestDto: + components.UpdateSubscriberGlobalPreferencesRequestDto, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerUpdateSubscriberGlobalPreferencesResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.SubscribersControllerUpdateSubscriberGlobalPreferencesRequest = { + updateSubscriberGlobalPreferencesRequestDto: + updateSubscriberGlobalPreferencesRequestDto, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON( + "body", + payload.UpdateSubscriberGlobalPreferencesRequestDto, + { explode: true }, + ); + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/preferences")( + pathParams, + ); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_updateSubscriberGlobalPreferences", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PATCH", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerUpdateSubscriberGlobalPreferencesResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersPropertiesUpdateOnlineFlag.ts b/src/funcs/subscribersPropertiesUpdateOnlineFlag.ts new file mode 100644 index 00000000..309edbbd --- /dev/null +++ b/src/funcs/subscribersPropertiesUpdateOnlineFlag.ts @@ -0,0 +1,169 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Update subscriber online status + * + * @remarks + * Used to update the subscriber isOnline flag. + */ +export async function subscribersPropertiesUpdateOnlineFlag( + client: NovuCore, + updateSubscriberOnlineFlagRequestDto: + components.UpdateSubscriberOnlineFlagRequestDto, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerUpdateSubscriberOnlineFlagResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.SubscribersControllerUpdateSubscriberOnlineFlagRequest = { + updateSubscriberOnlineFlagRequestDto: + updateSubscriberOnlineFlagRequestDto, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations + .SubscribersControllerUpdateSubscriberOnlineFlagRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON( + "body", + payload.UpdateSubscriberOnlineFlagRequestDto, + { explode: true }, + ); + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}/online-status")( + pathParams, + ); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_updateSubscriberOnlineFlag", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PATCH", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerUpdateSubscriberOnlineFlagResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .SubscribersControllerUpdateSubscriberOnlineFlagResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersRetrieve.ts b/src/funcs/subscribersRetrieve.ts new file mode 100644 index 00000000..c53191ce --- /dev/null +++ b/src/funcs/subscribersRetrieve.ts @@ -0,0 +1,162 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get subscriber + * + * @remarks + * Get subscriber by your internal id used to identify the subscriber + */ +export async function subscribersRetrieve( + client: NovuCore, + subscriberId: string, + includeTopics?: string | undefined, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerGetSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.SubscribersControllerGetSubscriberRequest = { + subscriberId: subscriberId, + includeTopics: includeTopics, + }; + + const parsed = safeParse( + input, + (value) => + operations.SubscribersControllerGetSubscriberRequest$outboundSchema.parse( + value, + ), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}")(pathParams); + + const query = encodeFormQuery({ + "includeTopics": payload.includeTopics, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_getSubscriber", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerGetSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.SubscribersControllerGetSubscriberResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/subscribersUpdate.ts b/src/funcs/subscribersUpdate.ts new file mode 100644 index 00000000..77f405e3 --- /dev/null +++ b/src/funcs/subscribersUpdate.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Update subscriber + * + * @remarks + * Used to update the subscriber entity with new information + */ +export async function subscribersUpdate( + client: NovuCore, + updateSubscriberRequestDto: components.UpdateSubscriberRequestDto, + subscriberId: string, + options?: RequestOptions, +): Promise< + Result< + operations.SubscribersControllerUpdateSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.SubscribersControllerUpdateSubscriberRequest = { + updateSubscriberRequestDto: updateSubscriberRequestDto, + subscriberId: subscriberId, + }; + + const parsed = safeParse( + input, + (value) => + operations.SubscribersControllerUpdateSubscriberRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.UpdateSubscriberRequestDto, { + explode: true, + }); + + const pathParams = { + subscriberId: encodeSimple("subscriberId", payload.subscriberId, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/subscribers/{subscriberId}")(pathParams); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "SubscribersController_updateSubscriber", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PUT", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.SubscribersControllerUpdateSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.SubscribersControllerUpdateSubscriberResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsCreate.ts b/src/funcs/topicsCreate.ts new file mode 100644 index 00000000..e2f8b70d --- /dev/null +++ b/src/funcs/topicsCreate.ts @@ -0,0 +1,142 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Topic creation + * + * @remarks + * Create a topic + */ +export async function topicsCreate( + client: NovuCore, + request: components.CreateTopicRequestDto, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerCreateTopicResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => components.CreateTopicRequestDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/topics")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_createTopic", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerCreateTopicResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json(201, operations.TopicsControllerCreateTopicResponse$inboundSchema, { + hdrs: true, + key: "Result", + }), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsDelete.ts b/src/funcs/topicsDelete.ts new file mode 100644 index 00000000..cf295ba2 --- /dev/null +++ b/src/funcs/topicsDelete.ts @@ -0,0 +1,153 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete topic + * + * @remarks + * Delete a topic by its topic key if it has no subscribers + */ +export async function topicsDelete( + client: NovuCore, + topicKey: string, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerDeleteTopicResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.TopicsControllerDeleteTopicRequest = { + topicKey: topicKey, + }; + + const parsed = safeParse( + input, + (value) => + operations.TopicsControllerDeleteTopicRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + topicKey: encodeSimple("topicKey", payload.topicKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/topics/{topicKey}")(pathParams); + + const headers = new Headers({ + Accept: "*/*", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_deleteTopic", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["404", "409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerDeleteTopicResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.nil( + 204, + operations.TopicsControllerDeleteTopicResponse$inboundSchema.optional(), + { hdrs: true }, + ), + M.fail([404, 409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsList.ts b/src/funcs/topicsList.ts new file mode 100644 index 00000000..f545ecc1 --- /dev/null +++ b/src/funcs/topicsList.ts @@ -0,0 +1,148 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeFormQuery } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Filter topics + * + * @remarks + * Returns a list of topics that can be paginated using the `page` query parameter and filtered by the topic key with the `key` query parameter + */ +export async function topicsList( + client: NovuCore, + request: operations.TopicsControllerListTopicsRequest, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerListTopicsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + operations.TopicsControllerListTopicsRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const path = pathToFunc("/v1/topics")(); + + const query = encodeFormQuery({ + "key": payload.key, + "page": payload.page, + "pageSize": payload.pageSize, + }); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_listTopics", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + query: query, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerListTopicsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json(200, operations.TopicsControllerListTopicsResponse$inboundSchema, { + hdrs: true, + key: "Result", + }), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsRename.ts b/src/funcs/topicsRename.ts new file mode 100644 index 00000000..79f89ce9 --- /dev/null +++ b/src/funcs/topicsRename.ts @@ -0,0 +1,158 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Rename a topic + * + * @remarks + * Rename a topic by providing a new name + */ +export async function topicsRename( + client: NovuCore, + renameTopicRequestDto: components.RenameTopicRequestDto, + topicKey: string, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerRenameTopicResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.TopicsControllerRenameTopicRequest = { + renameTopicRequestDto: renameTopicRequestDto, + topicKey: topicKey, + }; + + const parsed = safeParse( + input, + (value) => + operations.TopicsControllerRenameTopicRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.RenameTopicRequestDto, { + explode: true, + }); + + const pathParams = { + topicKey: encodeSimple("topicKey", payload.topicKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/topics/{topicKey}")(pathParams); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_renameTopic", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PATCH", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerRenameTopicResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json(200, operations.TopicsControllerRenameTopicResponse$inboundSchema, { + hdrs: true, + key: "Result", + }), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsRetrieve.ts b/src/funcs/topicsRetrieve.ts new file mode 100644 index 00000000..8f4b71a0 --- /dev/null +++ b/src/funcs/topicsRetrieve.ts @@ -0,0 +1,152 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get topic + * + * @remarks + * Get a topic by its topic key + */ +export async function topicsRetrieve( + client: NovuCore, + topicKey: string, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerGetTopicResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.TopicsControllerGetTopicRequest = { + topicKey: topicKey, + }; + + const parsed = safeParse( + input, + (value) => + operations.TopicsControllerGetTopicRequest$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + topicKey: encodeSimple("topicKey", payload.topicKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/topics/{topicKey}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_getTopic", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerGetTopicResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json(200, operations.TopicsControllerGetTopicResponse$inboundSchema, { + hdrs: true, + key: "Result", + }), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsSubscribersAssign.ts b/src/funcs/topicsSubscribersAssign.ts new file mode 100644 index 00000000..e868c7bd --- /dev/null +++ b/src/funcs/topicsSubscribersAssign.ts @@ -0,0 +1,162 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Subscribers addition + * + * @remarks + * Add subscribers to a topic by key + */ +export async function topicsSubscribersAssign( + client: NovuCore, + addSubscribersRequestDto: components.AddSubscribersRequestDto, + topicKey: string, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerAddSubscribersResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.TopicsControllerAddSubscribersRequest = { + addSubscribersRequestDto: addSubscribersRequestDto, + topicKey: topicKey, + }; + + const parsed = safeParse( + input, + (value) => + operations.TopicsControllerAddSubscribersRequest$outboundSchema.parse( + value, + ), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.AddSubscribersRequestDto, { + explode: true, + }); + + const pathParams = { + topicKey: encodeSimple("topicKey", payload.topicKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/topics/{topicKey}/subscribers")(pathParams); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "*/*", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_addSubscribers", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerAddSubscribersResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.nil( + 204, + operations.TopicsControllerAddSubscribersResponse$inboundSchema + .optional(), + { hdrs: true }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsSubscribersDelete.ts b/src/funcs/topicsSubscribersDelete.ts new file mode 100644 index 00000000..f3059e17 --- /dev/null +++ b/src/funcs/topicsSubscribersDelete.ts @@ -0,0 +1,164 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Subscribers removal + * + * @remarks + * Remove subscribers from a topic + */ +export async function topicsSubscribersDelete( + client: NovuCore, + removeSubscribersRequestDto: components.RemoveSubscribersRequestDto, + topicKey: string, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerRemoveSubscribersResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.TopicsControllerRemoveSubscribersRequest = { + removeSubscribersRequestDto: removeSubscribersRequestDto, + topicKey: topicKey, + }; + + const parsed = safeParse( + input, + (value) => + operations.TopicsControllerRemoveSubscribersRequest$outboundSchema.parse( + value, + ), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.RemoveSubscribersRequestDto, { + explode: true, + }); + + const pathParams = { + topicKey: encodeSimple("topicKey", payload.topicKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/topics/{topicKey}/subscribers/removal")( + pathParams, + ); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "*/*", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_removeSubscribers", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerRemoveSubscribersResponse | undefined, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.nil( + 204, + operations.TopicsControllerRemoveSubscribersResponse$inboundSchema + .optional(), + { hdrs: true }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/topicsSubscribersRetrieve.ts b/src/funcs/topicsSubscribersRetrieve.ts new file mode 100644 index 00000000..d4b068ae --- /dev/null +++ b/src/funcs/topicsSubscribersRetrieve.ts @@ -0,0 +1,164 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Check topic subscriber + * + * @remarks + * Check if a subscriber belongs to a certain topic + */ +export async function topicsSubscribersRetrieve( + client: NovuCore, + externalSubscriberId: string, + topicKey: string, + options?: RequestOptions, +): Promise< + Result< + operations.TopicsControllerGetTopicSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: operations.TopicsControllerGetTopicSubscriberRequest = { + externalSubscriberId: externalSubscriberId, + topicKey: topicKey, + }; + + const parsed = safeParse( + input, + (value) => + operations.TopicsControllerGetTopicSubscriberRequest$outboundSchema.parse( + value, + ), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + externalSubscriberId: encodeSimple( + "externalSubscriberId", + payload.externalSubscriberId, + { explode: false, charEncoding: "percent" }, + ), + topicKey: encodeSimple("topicKey", payload.topicKey, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc( + "/v1/topics/{topicKey}/subscribers/{externalSubscriberId}", + )(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "TopicsController_getTopicSubscriber", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.TopicsControllerGetTopicSubscriberResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.TopicsControllerGetTopicSubscriberResponse$inboundSchema, + { key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/trigger.ts b/src/funcs/trigger.ts new file mode 100644 index 00000000..1c976f9b --- /dev/null +++ b/src/funcs/trigger.ts @@ -0,0 +1,145 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Trigger event + * + * @remarks + * + * Trigger event is the main (and only) way to send notifications to subscribers. + * The trigger identifier is used to match the particular workflow associated with it. + * Additional information can be passed according the body interface below. + */ +export async function trigger( + client: NovuCore, + request: components.TriggerEventRequestDto, + options?: RequestOptions, +): Promise< + Result< + operations.EventsControllerTriggerResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => components.TriggerEventRequestDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/events/trigger")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "EventsController_trigger", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.EventsControllerTriggerResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json(201, operations.EventsControllerTriggerResponse$inboundSchema, { + hdrs: true, + key: "Result", + }), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/triggerBroadcast.ts b/src/funcs/triggerBroadcast.ts new file mode 100644 index 00000000..beabf47b --- /dev/null +++ b/src/funcs/triggerBroadcast.ts @@ -0,0 +1,146 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Broadcast event to all + * + * @remarks + * Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc. + * + * In the future could be used to trigger events to a subset of subscribers based on defined filters. + */ +export async function triggerBroadcast( + client: NovuCore, + request: components.TriggerEventToAllRequestDto, + options?: RequestOptions, +): Promise< + Result< + operations.EventsControllerBroadcastEventToAllResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + components.TriggerEventToAllRequestDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/events/trigger/broadcast")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "EventsController_broadcastEventToAll", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.EventsControllerBroadcastEventToAllResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations.EventsControllerBroadcastEventToAllResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/triggerBulk.ts b/src/funcs/triggerBulk.ts new file mode 100644 index 00000000..b96c8557 --- /dev/null +++ b/src/funcs/triggerBulk.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Bulk trigger event + * + * @remarks + * + * Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API. + * The bulk API is limited to 100 events per request. + */ +export async function triggerBulk( + client: NovuCore, + request: components.BulkTriggerEventDto, + options?: RequestOptions, +): Promise< + Result< + operations.EventsControllerTriggerBulkResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => components.BulkTriggerEventDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/events/trigger/bulk")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "EventsController_triggerBulk", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.EventsControllerTriggerBulkResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json(201, operations.EventsControllerTriggerBulkResponse$inboundSchema, { + hdrs: true, + key: "Result", + }), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/workflowGroupsCreate.ts b/src/funcs/workflowGroupsCreate.ts new file mode 100644 index 00000000..a9a3fa1a --- /dev/null +++ b/src/funcs/workflowGroupsCreate.ts @@ -0,0 +1,145 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Create workflow group + * + * @remarks + * workflow group was previously named notification group + */ +export async function workflowGroupsCreate( + client: NovuCore, + request: components.CreateNotificationGroupRequestDto, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationGroupsControllerCreateNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const parsed = safeParse( + request, + (value) => + components.CreateNotificationGroupRequestDto$outboundSchema.parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload, { explode: true }); + + const path = pathToFunc("/v1/notification-groups")(); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationGroupsController_createNotificationGroup", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "POST", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationGroupsControllerCreateNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 201, + operations + .NotificationGroupsControllerCreateNotificationGroupResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/workflowGroupsDelete.ts b/src/funcs/workflowGroupsDelete.ts new file mode 100644 index 00000000..2828ea51 --- /dev/null +++ b/src/funcs/workflowGroupsDelete.ts @@ -0,0 +1,157 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Delete workflow group + * + * @remarks + * workflow group was previously named notification group + */ +export async function workflowGroupsDelete( + client: NovuCore, + id: string, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationGroupsControllerDeleteNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.NotificationGroupsControllerDeleteNotificationGroupRequest = { + id: id, + }; + + const parsed = safeParse( + input, + (value) => + operations + .NotificationGroupsControllerDeleteNotificationGroupRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + id: encodeSimple("id", payload.id, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/notification-groups/{id}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationGroupsController_deleteNotificationGroup", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "DELETE", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationGroupsControllerDeleteNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .NotificationGroupsControllerDeleteNotificationGroupResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/workflowGroupsList.ts b/src/funcs/workflowGroupsList.ts new file mode 100644 index 00000000..a10cfeab --- /dev/null +++ b/src/funcs/workflowGroupsList.ts @@ -0,0 +1,127 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import * as M from "../lib/matchers.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get workflow groups + * + * @remarks + * workflow group was previously named notification group + */ +export async function workflowGroupsList( + client: NovuCore, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationGroupsControllerListNotificationGroupsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const path = pathToFunc("/v1/notification-groups")(); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationGroupsController_listNotificationGroups", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationGroupsControllerListNotificationGroupsResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .NotificationGroupsControllerListNotificationGroupsResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/workflowGroupsRetrieve.ts b/src/funcs/workflowGroupsRetrieve.ts new file mode 100644 index 00000000..b79ebb53 --- /dev/null +++ b/src/funcs/workflowGroupsRetrieve.ts @@ -0,0 +1,157 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Get workflow group + * + * @remarks + * workflow group was previously named notification group + */ +export async function workflowGroupsRetrieve( + client: NovuCore, + id: string, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationGroupsControllerGetNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.NotificationGroupsControllerGetNotificationGroupRequest = { + id: id, + }; + + const parsed = safeParse( + input, + (value) => + operations + .NotificationGroupsControllerGetNotificationGroupRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = null; + + const pathParams = { + id: encodeSimple("id", payload.id, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/notification-groups/{id}")(pathParams); + + const headers = new Headers({ + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationGroupsController_getNotificationGroup", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "GET", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationGroupsControllerGetNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .NotificationGroupsControllerGetNotificationGroupResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/funcs/workflowGroupsUpdate.ts b/src/funcs/workflowGroupsUpdate.ts new file mode 100644 index 00000000..9737567e --- /dev/null +++ b/src/funcs/workflowGroupsUpdate.ts @@ -0,0 +1,164 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { NovuCore } from "../core.js"; +import { encodeJSON, encodeSimple } from "../lib/encodings.js"; +import * as M from "../lib/matchers.js"; +import { safeParse } from "../lib/schemas.js"; +import { RequestOptions } from "../lib/sdks.js"; +import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js"; +import { pathToFunc } from "../lib/url.js"; +import * as components from "../models/components/index.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import * as operations from "../models/operations/index.js"; +import { Result } from "../types/fp.js"; + +/** + * Update workflow group + * + * @remarks + * workflow group was previously named notification group + */ +export async function workflowGroupsUpdate( + client: NovuCore, + createNotificationGroupRequestDto: + components.CreateNotificationGroupRequestDto, + id: string, + options?: RequestOptions, +): Promise< + Result< + operations.NotificationGroupsControllerUpdateNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + > +> { + const input: + operations.NotificationGroupsControllerUpdateNotificationGroupRequest = { + createNotificationGroupRequestDto: createNotificationGroupRequestDto, + id: id, + }; + + const parsed = safeParse( + input, + (value) => + operations + .NotificationGroupsControllerUpdateNotificationGroupRequest$outboundSchema + .parse(value), + "Input validation failed", + ); + if (!parsed.ok) { + return parsed; + } + const payload = parsed.value; + const body = encodeJSON("body", payload.CreateNotificationGroupRequestDto, { + explode: true, + }); + + const pathParams = { + id: encodeSimple("id", payload.id, { + explode: false, + charEncoding: "percent", + }), + }; + + const path = pathToFunc("/v1/notification-groups/{id}")(pathParams); + + const headers = new Headers({ + "Content-Type": "application/json", + Accept: "application/json", + }); + + const secConfig = await extractSecurity(client._options.apiKey); + const securityInput = secConfig == null ? {} : { apiKey: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + + const context = { + operationID: "NotificationGroupsController_updateNotificationGroup", + oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + + securitySource: client._options.apiKey, + retryConfig: options?.retries + || client._options.retryConfig + || { + strategy: "backoff", + backoff: { + initialInterval: 500, + maxInterval: 30000, + exponent: 1.5, + maxElapsedTime: 3600000, + }, + retryConnectionErrors: true, + } + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"], + }; + + const requestRes = client._createRequest(context, { + security: requestSecurity, + method: "PATCH", + path: path, + headers: headers, + body: body, + timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, + }, options); + if (!requestRes.ok) { + return requestRes; + } + const req = requestRes.value; + + const doResult = await client._do(req, { + context, + errorCodes: ["409", "429", "4XX", "503", "5XX"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, + }); + if (!doResult.ok) { + return doResult; + } + const response = doResult.value; + + const responseFields = { + HttpMeta: { Response: response, Request: req }, + }; + + const [result] = await M.match< + operations.NotificationGroupsControllerUpdateNotificationGroupResponse, + | SDKError + | SDKValidationError + | UnexpectedClientError + | InvalidRequestError + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + >( + M.json( + 200, + operations + .NotificationGroupsControllerUpdateNotificationGroupResponse$inboundSchema, + { hdrs: true, key: "Result" }, + ), + M.fail([409, 429, 503]), + M.fail(["4XX", "5XX"]), + )(response, { extraFields: responseFields }); + if (!result.ok) { + return result; + } + + return result; +} diff --git a/src/hooks/hooks.ts b/src/hooks/hooks.ts new file mode 100644 index 00000000..d1b3396f --- /dev/null +++ b/src/hooks/hooks.ts @@ -0,0 +1,112 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { RequestInput } from "../lib/http.js"; +import { + AfterErrorContext, + AfterErrorHook, + AfterSuccessContext, + AfterSuccessHook, + BeforeCreateRequestContext, + BeforeCreateRequestHook, + BeforeRequestContext, + BeforeRequestHook, + Hooks, + SDKInitHook, + SDKInitOptions, +} from "./types.js"; + +import { initHooks } from "./registration.js"; + +export class SDKHooks implements Hooks { + sdkInitHooks: SDKInitHook[] = []; + beforeCreateRequestHooks: BeforeCreateRequestHook[] = []; + beforeRequestHooks: BeforeRequestHook[] = []; + afterSuccessHooks: AfterSuccessHook[] = []; + afterErrorHooks: AfterErrorHook[] = []; + + constructor() { + initHooks(this); + } + + registerSDKInitHook(hook: SDKInitHook) { + this.sdkInitHooks.push(hook); + } + + registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook) { + this.beforeCreateRequestHooks.push(hook); + } + + registerBeforeRequestHook(hook: BeforeRequestHook) { + this.beforeRequestHooks.push(hook); + } + + registerAfterSuccessHook(hook: AfterSuccessHook) { + this.afterSuccessHooks.push(hook); + } + + registerAfterErrorHook(hook: AfterErrorHook) { + this.afterErrorHooks.push(hook); + } + + sdkInit(opts: SDKInitOptions): SDKInitOptions { + return this.sdkInitHooks.reduce((opts, hook) => hook.sdkInit(opts), opts); + } + + beforeCreateRequest( + hookCtx: BeforeCreateRequestContext, + input: RequestInput, + ): RequestInput { + let inp = input; + + for (const hook of this.beforeCreateRequestHooks) { + inp = hook.beforeCreateRequest(hookCtx, inp); + } + + return inp; + } + + async beforeRequest( + hookCtx: BeforeRequestContext, + request: Request, + ): Promise { + let req = request; + + for (const hook of this.beforeRequestHooks) { + req = await hook.beforeRequest(hookCtx, req); + } + + return req; + } + + async afterSuccess( + hookCtx: AfterSuccessContext, + response: Response, + ): Promise { + let res = response; + + for (const hook of this.afterSuccessHooks) { + res = await hook.afterSuccess(hookCtx, res); + } + + return res; + } + + async afterError( + hookCtx: AfterErrorContext, + response: Response | null, + error: unknown, + ): Promise<{ response: Response | null; error: unknown }> { + let res = response; + let err = error; + + for (const hook of this.afterErrorHooks) { + const result = await hook.afterError(hookCtx, res, err); + res = result.response; + err = result.error; + } + + return { response: res, error: err }; + } +} diff --git a/src/hooks/index.ts b/src/hooks/index.ts new file mode 100644 index 00000000..f60ec7ac --- /dev/null +++ b/src/hooks/index.ts @@ -0,0 +1,6 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export * from "./hooks.js"; +export * from "./types.js"; diff --git a/src/hooks/registration.ts b/src/hooks/registration.ts new file mode 100644 index 00000000..70649734 --- /dev/null +++ b/src/hooks/registration.ts @@ -0,0 +1,14 @@ +import { Hooks } from "./types.js"; + +/* + * This file is only ever generated once on the first generation and then is free to be modified. + * Any hooks you wish to add should be registered in the initHooks function. Feel free to define them + * in this file or in separate files in the hooks folder. + */ + +// @ts-expect-error remove this line when you add your first hook and hooks is used +export function initHooks(hooks: Hooks) { + // Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook + // with an instance of a hook that implements that specific Hook interface + // Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance +} diff --git a/src/hooks/types.ts b/src/hooks/types.ts new file mode 100644 index 00000000..df5237dc --- /dev/null +++ b/src/hooks/types.ts @@ -0,0 +1,102 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { HTTPClient, RequestInput } from "../lib/http.js"; +import { RetryConfig } from "../lib/retries.js"; +import { SecurityState } from "../lib/security.js"; + +export type HookContext = { + operationID: string; + oAuth2Scopes?: string[]; + securitySource?: any | (() => Promise); + retryConfig: RetryConfig; + resolvedSecurity: SecurityState | null; +}; + +export type Awaitable = T | Promise; + +export type SDKInitOptions = { + baseURL: URL | null; + client: HTTPClient; +}; + +export type BeforeCreateRequestContext = HookContext & {}; +export type BeforeRequestContext = HookContext & {}; +export type AfterSuccessContext = HookContext & {}; +export type AfterErrorContext = HookContext & {}; + +/** + * SDKInitHook is called when the SDK is initializing. The + * hook can return a new baseURL and HTTP client to be used by the SDK. + */ +export interface SDKInitHook { + sdkInit: (opts: SDKInitOptions) => SDKInitOptions; +} + +export interface BeforeCreateRequestHook { + /** + * A hook that is called before the SDK creates a `Request` object. The hook + * can modify how a request is constructed since certain modifications, like + * changing the request URL, cannot be done on a request object directly. + */ + beforeCreateRequest: ( + hookCtx: BeforeCreateRequestContext, + input: RequestInput, + ) => RequestInput; +} + +export interface BeforeRequestHook { + /** + * A hook that is called before the SDK sends a request. The hook can + * introduce instrumentation code such as logging, tracing and metrics or + * replace the request before it is sent or throw an error to stop the + * request from being sent. + */ + beforeRequest: ( + hookCtx: BeforeRequestContext, + request: Request, + ) => Awaitable; +} + +export interface AfterSuccessHook { + /** + * A hook that is called after the SDK receives a response. The hook can + * introduce instrumentation code such as logging, tracing and metrics or + * modify the response before it is handled or throw an error to stop the + * response from being handled. + */ + afterSuccess: ( + hookCtx: AfterSuccessContext, + response: Response, + ) => Awaitable; +} + +export interface AfterErrorHook { + /** + * A hook that is called after the SDK encounters an error, or a + * non-successful response. The hook can introduce instrumentation code such + * as logging, tracing and metrics or modify the response or error values. + */ + afterError: ( + hookCtx: AfterErrorContext, + response: Response | null, + error: unknown, + ) => Awaitable<{ + response: Response | null; + error: unknown; + }>; +} + +export interface Hooks { + /** Registers a hook to be used by the SDK for initialization event. */ + registerSDKInitHook(hook: SDKInitHook): void; + /** Registers a hook to be used by the SDK for to modify `Request` construction. */ + registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook): void; + /** Registers a hook to be used by the SDK for the before request event. */ + registerBeforeRequestHook(hook: BeforeRequestHook): void; + /** Registers a hook to be used by the SDK for the after success event. */ + registerAfterSuccessHook(hook: AfterSuccessHook): void; + /** Registers a hook to be used by the SDK for the after error event. */ + registerAfterErrorHook(hook: AfterErrorHook): void; +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..5ddc765e --- /dev/null +++ b/src/index.ts @@ -0,0 +1,7 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export * from "./lib/config.js"; +export * as files from "./lib/files.js"; +export * from "./sdk/sdk.js"; diff --git a/src/lib/base64.ts b/src/lib/base64.ts new file mode 100644 index 00000000..c2d5b389 --- /dev/null +++ b/src/lib/base64.ts @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export function bytesToBase64(u8arr: Uint8Array): string { + return btoa(String.fromCodePoint(...u8arr)); +} + +export function bytesFromBase64(encoded: string): Uint8Array { + return Uint8Array.from(atob(encoded), (c) => c.charCodeAt(0)); +} + +export function stringToBytes(str: string): Uint8Array { + return new TextEncoder().encode(str); +} + +export function stringFromBytes(u8arr: Uint8Array): string { + return new TextDecoder().decode(u8arr); +} + +export function stringToBase64(str: string): string { + return bytesToBase64(stringToBytes(str)); +} + +export function stringFromBase64(b64str: string): string { + return stringFromBytes(bytesFromBase64(b64str)); +} + +export const zodOutbound = z + .instanceof(Uint8Array) + .or(z.string().transform(stringToBytes)); + +export const zodInbound = z + .instanceof(Uint8Array) + .or(z.string().transform(bytesFromBase64)); diff --git a/src/lib/config.ts b/src/lib/config.ts new file mode 100644 index 00000000..b62e3d45 --- /dev/null +++ b/src/lib/config.ts @@ -0,0 +1,61 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { HTTPClient } from "./http.js"; +import { Logger } from "./logger.js"; +import { RetryConfig } from "./retries.js"; +import { Params, pathToFunc } from "./url.js"; + +/** + * Contains the list of servers available to the SDK + */ +export const ServerList = [ + "https://api.novu.co", + "https://eu.api.novu.co", +] as const; + +export type SDKOptions = { + apiKey?: string | (() => Promise); + + httpClient?: HTTPClient; + /** + * Allows overriding the default server used by the SDK + */ + serverIdx?: number; + /** + * Allows overriding the default server URL used by the SDK + */ + serverURL?: string; + /** + * Allows overriding the default retry config used by the SDK + */ + retryConfig?: RetryConfig; + timeoutMs?: number; + debugLogger?: Logger; +}; + +export function serverURLFromOptions(options: SDKOptions): URL | null { + let serverURL = options.serverURL; + + const params: Params = {}; + + if (!serverURL) { + const serverIdx = options.serverIdx ?? 0; + if (serverIdx < 0 || serverIdx >= ServerList.length) { + throw new Error(`Invalid server index ${serverIdx}`); + } + serverURL = ServerList[serverIdx] || ""; + } + + const u = pathToFunc(serverURL)(params); + return new URL(u); +} + +export const SDK_METADATA = { + language: "typescript", + openapiDocVersion: "1.0", + sdkVersion: "0.0.1-alpha.21", + genVersion: "2.461.4", + userAgent: "speakeasy-sdk/typescript 0.0.1-alpha.21 2.461.4 1.0 @novu/api", +} as const; diff --git a/src/lib/dlv.ts b/src/lib/dlv.ts new file mode 100644 index 00000000..e81091f5 --- /dev/null +++ b/src/lib/dlv.ts @@ -0,0 +1,53 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/* +MIT License + +Copyright (c) 2024 Jason Miller (http://jasonformat.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +/** + * @param obj The object to walk + * @param key The key path to walk the object with + * @param def A default value to return if the result is undefined + * + * @example + * dlv(obj, "a.b.c.d") + * @example + * dlv(object, ["a", "b", "c", "d"]) + * @example + * dlv(object, "foo.bar.baz", "Hello, default value!") + */ +export function dlv( + obj: any, + key: string | string[], + def?: T, + p?: number, + undef?: never, +): T | undefined { + key = Array.isArray(key) ? key : key.split("."); + for (p = 0; p < key.length; p++) { + const k = key[p]; + obj = k != null && obj ? obj[k] : undef; + } + return obj === undef ? def : obj; +} diff --git a/src/lib/encodings.ts b/src/lib/encodings.ts new file mode 100644 index 00000000..44fa7284 --- /dev/null +++ b/src/lib/encodings.ts @@ -0,0 +1,449 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { bytesToBase64 } from "./base64.js"; +import { isPlainObject } from "./is-plain-object.js"; + +export class EncodingError extends Error { + constructor(message: string) { + super(message); + this.name = "EncodingError"; + } +} + +export function encodeMatrix( + key: string, + value: unknown, + options?: { explode?: boolean; charEncoding?: "percent" | "none" }, +): string { + let out = ""; + const pairs: [string, unknown][] = options?.explode + ? explode(key, value) + : [[key, value]]; + + const encodeString = (v: string) => { + return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; + }; + const encodeValue = (v: unknown) => encodeString(serializeValue(v)); + + pairs.forEach(([pk, pv]) => { + let tmp = ""; + let encValue = ""; + + if (pv === undefined) { + return; + } else if (Array.isArray(pv)) { + encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(","); + } else if (isPlainObject(pv)) { + encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => { + return `,${encodeString(k)},${encodeValue(v)}`; + }).join(""); + encValue = encValue.slice(1); + } else { + encValue = `${encodeValue(pv)}`; + } + + const keyPrefix = encodeString(pk); + tmp = `${keyPrefix}=${encValue}`; + // trim trailing '=' if value was empty + if (tmp === `${keyPrefix}=`) { + tmp = tmp.slice(0, -1); + } + + // If we end up with the nothing then skip forward + if (!tmp) { + return; + } + + out += `;${tmp}`; + }); + + return out; +} + +export function encodeLabel( + key: string, + value: unknown, + options?: { explode?: boolean; charEncoding?: "percent" | "none" }, +): string { + let out = ""; + const pairs: [string, unknown][] = options?.explode + ? explode(key, value) + : [[key, value]]; + + const encodeString = (v: string) => { + return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; + }; + const encodeValue = (v: unknown) => encodeString(serializeValue(v)); + + pairs.forEach(([pk, pv]) => { + let encValue = ""; + + if (pv === undefined) { + return; + } else if (Array.isArray(pv)) { + encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join("."); + } else if (isPlainObject(pv)) { + encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => { + return `.${encodeString(k)}.${encodeValue(v)}`; + }).join(""); + encValue = encValue.slice(1); + } else { + const k = + options?.explode && isPlainObject(value) ? `${encodeString(pk)}=` : ""; + encValue = `${k}${encodeValue(pv)}`; + } + + out += `.${encValue}`; + }); + + return out; +} + +type FormEncoder = ( + key: string, + value: unknown, + options?: { explode?: boolean; charEncoding?: "percent" | "none" }, +) => string; + +function formEncoder(sep: string): FormEncoder { + return ( + key: string, + value: unknown, + options?: { explode?: boolean; charEncoding?: "percent" | "none" }, + ) => { + let out = ""; + const pairs: [string, unknown][] = options?.explode + ? explode(key, value) + : [[key, value]]; + + const encodeString = (v: string) => { + return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; + }; + + const encodeValue = (v: unknown) => encodeString(serializeValue(v)); + + const encodedSep = encodeString(sep); + + pairs.forEach(([pk, pv]) => { + let tmp = ""; + let encValue = ""; + + if (pv === undefined) { + return; + } else if (Array.isArray(pv)) { + encValue = mapDefined(pv, (v) => `${encodeValue(v)}`).join(encodedSep); + } else if (isPlainObject(pv)) { + encValue = mapDefinedEntries(Object.entries(pv), ([k, v]) => { + return `${encodeString(k)}${encodedSep}${encodeValue(v)}`; + }).join(encodedSep); + } else { + encValue = `${encodeValue(pv)}`; + } + + tmp = `${encodeString(pk)}=${encValue}`; + + // If we end up with the nothing then skip forward + if (!tmp || tmp === "=") { + return; + } + + out += `&${tmp}`; + }); + + return out.slice(1); + }; +} + +export const encodeForm = formEncoder(","); +export const encodeSpaceDelimited = formEncoder(" "); +export const encodePipeDelimited = formEncoder("|"); + +export function encodeBodyForm( + key: string, + value: unknown, + options?: { explode?: boolean; charEncoding?: "percent" | "none" }, +): string { + let out = ""; + const pairs: [string, unknown][] = options?.explode + ? explode(key, value) + : [[key, value]]; + + const encodeString = (v: string) => { + return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; + }; + + const encodeValue = (v: unknown) => encodeString(serializeValue(v)); + + pairs.forEach(([pk, pv]) => { + let tmp = ""; + let encValue = ""; + + if (pv === undefined) { + return; + } else if (Array.isArray(pv)) { + encValue = JSON.stringify(pv, jsonReplacer); + } else if (isPlainObject(pv)) { + encValue = JSON.stringify(pv, jsonReplacer); + } else { + encValue = `${encodeValue(pv)}`; + } + + tmp = `${encodeString(pk)}=${encValue}`; + + // If we end up with the nothing then skip forward + if (!tmp || tmp === "=") { + return; + } + + out += `&${tmp}`; + }); + + return out.slice(1); +} + +export function encodeDeepObject( + key: string, + value: unknown, + options?: { charEncoding?: "percent" | "none" }, +): string { + if (value == null) { + return ""; + } + + if (!isPlainObject(value)) { + throw new EncodingError( + `Value of parameter '${key}' which uses deepObject encoding must be an object`, + ); + } + + return encodeDeepObjectObject(key, value, options); +} + +export function encodeDeepObjectObject( + key: string, + value: unknown, + options?: { charEncoding?: "percent" | "none" }, +): string { + if (value == null) { + return ""; + } + + let out = ""; + + const encodeString = (v: string) => { + return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; + }; + + if (!isPlainObject(value)) { + throw new EncodingError(`Expected parameter '${key}' to be an object.`); + } + + Object.entries(value).forEach(([ck, cv]) => { + if (cv === undefined) { + return; + } + + const pk = `${key}[${ck}]`; + + if (isPlainObject(cv)) { + const objOut = encodeDeepObjectObject(pk, cv, options); + + out += `&${objOut}`; + + return; + } + + const pairs: unknown[] = Array.isArray(cv) ? cv : [cv]; + let encoded = ""; + + encoded = mapDefined(pairs, (v) => { + return `${encodeString(pk)}=${encodeString(serializeValue(v))}`; + }).join("&"); + + out += `&${encoded}`; + }); + + return out.slice(1); +} + +export function encodeJSON( + key: string, + value: unknown, + options?: { explode?: boolean; charEncoding?: "percent" | "none" }, +): string { + if (typeof value === "undefined") { + return ""; + } + + const encodeString = (v: string) => { + return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; + }; + + const encVal = encodeString(JSON.stringify(value, jsonReplacer)); + + return options?.explode ? encVal : `${encodeString(key)}=${encVal}`; +} + +export const encodeSimple = ( + key: string, + value: unknown, + options?: { explode?: boolean; charEncoding?: "percent" | "none" }, +): string => { + let out = ""; + const pairs: [string, unknown][] = options?.explode + ? explode(key, value) + : [[key, value]]; + + const encodeString = (v: string) => { + return options?.charEncoding === "percent" ? encodeURIComponent(v) : v; + }; + const encodeValue = (v: unknown) => encodeString(serializeValue(v)); + + pairs.forEach(([pk, pv]) => { + let tmp = ""; + + if (pv === undefined) { + return; + } else if (Array.isArray(pv)) { + tmp = mapDefined(pv, (v) => `${encodeValue(v)}`).join(","); + } else if (isPlainObject(pv)) { + tmp = mapDefinedEntries(Object.entries(pv), ([k, v]) => { + return `,${encodeString(k)},${encodeValue(v)}`; + }).join(""); + tmp = tmp.slice(1); + } else { + const k = options?.explode && isPlainObject(value) ? `${pk}=` : ""; + tmp = `${k}${encodeValue(pv)}`; + } + + // If we end up with the nothing then skip forward + if (!tmp) { + return; + } + + out += `,${tmp}`; + }); + + return out.slice(1); +}; + +function explode(key: string, value: unknown): [string, unknown][] { + if (Array.isArray(value)) { + return value.map((v) => [key, v]); + } else if (isPlainObject(value)) { + const o = value ?? {}; + return Object.entries(o).map(([k, v]) => [k, v]); + } else { + return [[key, value]]; + } +} + +function serializeValue(value: unknown): string { + if (value === null) { + return "null"; + } else if (typeof value === "undefined") { + return ""; + } else if (value instanceof Date) { + return value.toISOString(); + } else if (value instanceof Uint8Array) { + return bytesToBase64(value); + } else if (typeof value === "object") { + return JSON.stringify(value, jsonReplacer); + } + + return `${value}`; +} + +function jsonReplacer(_: string, value: unknown): unknown { + if (value instanceof Uint8Array) { + return bytesToBase64(value); + } else { + return value; + } +} + +function mapDefined(inp: T[], mapper: (v: T) => R): R[] { + return inp.reduce((acc, v) => { + if (v === undefined) { + return acc; + } + + const m = mapper(v); + if (m === undefined) { + return acc; + } + + acc.push(m); + + return acc; + }, []); +} + +function mapDefinedEntries( + inp: Iterable<[K, V]>, + mapper: (v: [K, V]) => R, +): R[] { + const acc: R[] = []; + for (const [k, v] of inp) { + if (v === undefined) { + continue; + } + + const m = mapper([k, v]); + if (m === undefined) { + continue; + } + + acc.push(m); + } + + return acc; +} + +export function queryJoin(...args: string[]): string { + return args.filter(Boolean).join("&"); +} + +type QueryEncoderOptions = { + explode?: boolean; + charEncoding?: "percent" | "none"; +}; + +type QueryEncoder = ( + key: string, + value: unknown, + options?: QueryEncoderOptions, +) => string; + +type BulkQueryEncoder = ( + values: Record, + options?: QueryEncoderOptions, +) => string; + +export function queryEncoder(f: QueryEncoder): BulkQueryEncoder { + const bulkEncode = function ( + values: Record, + options?: QueryEncoderOptions, + ): string { + const opts: QueryEncoderOptions = { + ...options, + explode: options?.explode ?? true, + charEncoding: options?.charEncoding ?? "percent", + }; + + const encoded = Object.entries(values).map(([key, value]) => { + return f(key, value, opts); + }); + return queryJoin(...encoded); + }; + + return bulkEncode; +} + +export const encodeJSONQuery = queryEncoder(encodeJSON); +export const encodeFormQuery = queryEncoder(encodeForm); +export const encodeSpaceDelimitedQuery = queryEncoder(encodeSpaceDelimited); +export const encodePipeDelimitedQuery = queryEncoder(encodePipeDelimited); +export const encodeDeepObjectQuery = queryEncoder(encodeDeepObject); diff --git a/src/lib/files.ts b/src/lib/files.ts new file mode 100644 index 00000000..19e08041 --- /dev/null +++ b/src/lib/files.ts @@ -0,0 +1,40 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/** + * Consumes a stream and returns a concatenated array buffer. Useful in + * situations where we need to read the whole file because it forms part of a + * larger payload containing other fields, and we can't modify the underlying + * request structure. + */ +export async function readableStreamToArrayBuffer( + readable: ReadableStream, +): Promise { + const reader = readable.getReader(); + const chunks: Uint8Array[] = []; + + let totalLength = 0; + let done = false; + + while (!done) { + const { value, done: doneReading } = await reader.read(); + + if (doneReading) { + done = true; + } else { + chunks.push(value); + totalLength += value.length; + } + } + + const concatenatedChunks = new Uint8Array(totalLength); + let offset = 0; + + for (const chunk of chunks) { + concatenatedChunks.set(chunk, offset); + offset += chunk.length; + } + + return concatenatedChunks.buffer; +} diff --git a/src/lib/http.ts b/src/lib/http.ts new file mode 100644 index 00000000..13cf1fd7 --- /dev/null +++ b/src/lib/http.ts @@ -0,0 +1,323 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export type Fetcher = ( + input: RequestInfo | URL, + init?: RequestInit, +) => Promise; + +export type Awaitable = T | Promise; + +const DEFAULT_FETCHER: Fetcher = (input, init) => { + // If input is a Request and init is undefined, Bun will discard the method, + // headers, body and other options that were set on the request object. + // Node.js and browers would ignore an undefined init value. This check is + // therefore needed for interop with Bun. + if (init == null) { + return fetch(input); + } else { + return fetch(input, init); + } +}; + +export type RequestInput = { + /** + * The URL the request will use. + */ + url: URL; + /** + * Options used to create a [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request). + */ + options?: RequestInit | undefined; +}; + +export interface HTTPClientOptions { + fetcher?: Fetcher; +} + +export type BeforeRequestHook = (req: Request) => Awaitable; +export type RequestErrorHook = (err: unknown, req: Request) => Awaitable; +export type ResponseHook = (res: Response, req: Request) => Awaitable; + +export class HTTPClient { + private fetcher: Fetcher; + private requestHooks: BeforeRequestHook[] = []; + private requestErrorHooks: RequestErrorHook[] = []; + private responseHooks: ResponseHook[] = []; + + constructor(private options: HTTPClientOptions = {}) { + this.fetcher = options.fetcher || DEFAULT_FETCHER; + } + + async request(request: Request): Promise { + let req = request; + for (const hook of this.requestHooks) { + const nextRequest = await hook(req); + if (nextRequest) { + req = nextRequest; + } + } + + try { + const res = await this.fetcher(req); + + for (const hook of this.responseHooks) { + await hook(res, req); + } + + return res; + } catch (err) { + for (const hook of this.requestErrorHooks) { + await hook(err, req); + } + + throw err; + } + } + + /** + * Registers a hook that is called before a request is made. The hook function + * can mutate the request or return a new request. This may be useful to add + * additional information to request such as request IDs and tracing headers. + */ + addHook(hook: "beforeRequest", fn: BeforeRequestHook): this; + /** + * Registers a hook that is called when a request cannot be made due to a + * network error. + */ + addHook(hook: "requestError", fn: RequestErrorHook): this; + /** + * Registers a hook that is called when a response has been received from the + * server. + */ + addHook(hook: "response", fn: ResponseHook): this; + addHook( + ...args: + | [hook: "beforeRequest", fn: BeforeRequestHook] + | [hook: "requestError", fn: RequestErrorHook] + | [hook: "response", fn: ResponseHook] + ) { + if (args[0] === "beforeRequest") { + this.requestHooks.push(args[1]); + } else if (args[0] === "requestError") { + this.requestErrorHooks.push(args[1]); + } else if (args[0] === "response") { + this.responseHooks.push(args[1]); + } else { + throw new Error(`Invalid hook type: ${args[0]}`); + } + return this; + } + + /** Removes a hook that was previously registered with `addHook`. */ + removeHook(hook: "beforeRequest", fn: BeforeRequestHook): this; + /** Removes a hook that was previously registered with `addHook`. */ + removeHook(hook: "requestError", fn: RequestErrorHook): this; + /** Removes a hook that was previously registered with `addHook`. */ + removeHook(hook: "response", fn: ResponseHook): this; + removeHook( + ...args: + | [hook: "beforeRequest", fn: BeforeRequestHook] + | [hook: "requestError", fn: RequestErrorHook] + | [hook: "response", fn: ResponseHook] + ): this { + let target: unknown[]; + if (args[0] === "beforeRequest") { + target = this.requestHooks; + } else if (args[0] === "requestError") { + target = this.requestErrorHooks; + } else if (args[0] === "response") { + target = this.responseHooks; + } else { + throw new Error(`Invalid hook type: ${args[0]}`); + } + + const index = target.findIndex((v) => v === args[1]); + if (index >= 0) { + target.splice(index, 1); + } + + return this; + } + + clone(): HTTPClient { + const child = new HTTPClient(this.options); + child.requestHooks = this.requestHooks.slice(); + child.requestErrorHooks = this.requestErrorHooks.slice(); + child.responseHooks = this.responseHooks.slice(); + + return child; + } +} + +export type StatusCodePredicate = number | string | (number | string)[]; + +// A semicolon surrounded by optional whitespace characters is used to separate +// segments in a media type string. +const mediaParamSeparator = /\s*;\s*/g; + +export function matchContentType(response: Response, pattern: string): boolean { + // `*` is a special case which means anything is acceptable. + if (pattern === "*") { + return true; + } + + let contentType = + response.headers.get("content-type")?.trim() || "application/octet-stream"; + contentType = contentType.toLowerCase(); + + const wantParts = pattern.toLowerCase().trim().split(mediaParamSeparator); + const [wantType = "", ...wantParams] = wantParts; + + if (wantType.split("/").length !== 2) { + return false; + } + + const gotParts = contentType.split(mediaParamSeparator); + const [gotType = "", ...gotParams] = gotParts; + + const [type = "", subtype = ""] = gotType.split("/"); + if (!type || !subtype) { + return false; + } + + if ( + wantType !== "*/*" && + gotType !== wantType && + `${type}/*` !== wantType && + `*/${subtype}` !== wantType + ) { + return false; + } + + if (gotParams.length < wantParams.length) { + return false; + } + + const params = new Set(gotParams); + for (const wantParam of wantParams) { + if (!params.has(wantParam)) { + return false; + } + } + + return true; +} + +const codeRangeRE = new RegExp("^[0-9]xx$", "i"); + +export function matchStatusCode( + response: Response, + codes: StatusCodePredicate, +): boolean { + const actual = `${response.status}`; + const expectedCodes = Array.isArray(codes) ? codes : [codes]; + if (!expectedCodes.length) { + return false; + } + + return expectedCodes.some((ec) => { + const code = `${ec}`; + + if (code === "default") { + return true; + } + + if (!codeRangeRE.test(`${code}`)) { + return code === actual; + } + + const expectFamily = code.charAt(0); + if (!expectFamily) { + throw new Error("Invalid status code range"); + } + + const actualFamily = actual.charAt(0); + if (!actualFamily) { + throw new Error(`Invalid response status code: ${actual}`); + } + + return actualFamily === expectFamily; + }); +} + +export function matchResponse( + response: Response, + code: StatusCodePredicate, + contentTypePattern: string, +): boolean { + return ( + matchStatusCode(response, code) && + matchContentType(response, contentTypePattern) + ); +} + +/** + * Uses various heurisitics to determine if an error is a connection error. + */ +export function isConnectionError(err: unknown): boolean { + if (typeof err !== "object" || err == null) { + return false; + } + + // Covers fetch in Deno as well + const isBrowserErr = + err instanceof TypeError && + err.message.toLowerCase().startsWith("failed to fetch"); + + const isNodeErr = + err instanceof TypeError && + err.message.toLowerCase().startsWith("fetch failed"); + + const isBunErr = "name" in err && err.name === "ConnectionError"; + + const isGenericErr = + "code" in err && + typeof err.code === "string" && + err.code.toLowerCase() === "econnreset"; + + return isBrowserErr || isNodeErr || isGenericErr || isBunErr; +} + +/** + * Uses various heurisitics to determine if an error is a timeout error. + */ +export function isTimeoutError(err: unknown): boolean { + if (typeof err !== "object" || err == null) { + return false; + } + + // Fetch in browser, Node.js, Bun, Deno + const isNative = "name" in err && err.name === "TimeoutError"; + const isLegacyNative = "code" in err && err.code === 23; + + // Node.js HTTP client and Axios + const isGenericErr = + "code" in err && + typeof err.code === "string" && + err.code.toLowerCase() === "econnaborted"; + + return isNative || isLegacyNative || isGenericErr; +} + +/** + * Uses various heurisitics to determine if an error is a abort error. + */ +export function isAbortError(err: unknown): boolean { + if (typeof err !== "object" || err == null) { + return false; + } + + // Fetch in browser, Node.js, Bun, Deno + const isNative = "name" in err && err.name === "AbortError"; + const isLegacyNative = "code" in err && err.code === 20; + + // Node.js HTTP client and Axios + const isGenericErr = + "code" in err && + typeof err.code === "string" && + err.code.toLowerCase() === "econnaborted"; + + return isNative || isLegacyNative || isGenericErr; +} diff --git a/src/lib/is-plain-object.ts b/src/lib/is-plain-object.ts new file mode 100644 index 00000000..61070d3d --- /dev/null +++ b/src/lib/is-plain-object.ts @@ -0,0 +1,43 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/* +MIT License + +Copyright (c) Sindre Sorhus (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +// Taken from https://github.com/sindresorhus/is-plain-obj/blob/97f38e8836f86a642cce98fc6ab3058bc36df181/index.js + +export function isPlainObject(value: unknown): value is object { + if (typeof value !== "object" || value === null) { + return false; + } + + const prototype = Object.getPrototypeOf(value); + return ( + (prototype === null || + prototype === Object.prototype || + Object.getPrototypeOf(prototype) === null) && + !(Symbol.toStringTag in value) && + !(Symbol.iterator in value) + ); +} diff --git a/src/lib/logger.ts b/src/lib/logger.ts new file mode 100644 index 00000000..d181f293 --- /dev/null +++ b/src/lib/logger.ts @@ -0,0 +1,9 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export interface Logger { + group(label?: string): void; + groupEnd(): void; + log(message: any, ...args: any[]): void; +} diff --git a/src/lib/matchers.ts b/src/lib/matchers.ts new file mode 100644 index 00000000..19b46b33 --- /dev/null +++ b/src/lib/matchers.ts @@ -0,0 +1,322 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKError } from "../models/errors/sdkerror.js"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { Result } from "../types/fp.js"; +import { matchResponse, matchStatusCode, StatusCodePredicate } from "./http.js"; +import { isPlainObject } from "./is-plain-object.js"; +import { safeParse } from "./schemas.js"; + +export type Encoding = + | "json" + | "text" + | "bytes" + | "stream" + | "sse" + | "nil" + | "fail"; + +const DEFAULT_CONTENT_TYPES: Record = { + json: "application/json", + text: "text/plain", + bytes: "application/octet-stream", + stream: "application/octet-stream", + sse: "text/event-stream", + nil: "*", + fail: "*", +}; + +type Schema = { parse(raw: unknown): T }; + +type MatchOptions = { + ctype?: string; + hdrs?: boolean; + key?: string; + sseSentinel?: string; +}; + +export type ValueMatcher = MatchOptions & { + enc: Encoding; + codes: StatusCodePredicate; + schema: Schema; +}; + +export type ErrorMatcher = MatchOptions & { + enc: Encoding; + codes: StatusCodePredicate; + schema: Schema; + err: true; +}; + +export type FailMatcher = { + enc: "fail"; + codes: StatusCodePredicate; +}; + +export type Matcher = ValueMatcher | ErrorMatcher | FailMatcher; + +export function jsonErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ErrorMatcher { + return { ...options, err: true, enc: "json", codes, schema }; +} +export function json( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ValueMatcher { + return { ...options, enc: "json", codes, schema }; +} + +export function textErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ErrorMatcher { + return { ...options, err: true, enc: "text", codes, schema }; +} +export function text( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ValueMatcher { + return { ...options, enc: "text", codes, schema }; +} + +export function bytesErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ErrorMatcher { + return { ...options, err: true, enc: "bytes", codes, schema }; +} +export function bytes( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ValueMatcher { + return { ...options, enc: "bytes", codes, schema }; +} + +export function streamErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ErrorMatcher { + return { ...options, err: true, enc: "stream", codes, schema }; +} +export function stream( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ValueMatcher { + return { ...options, enc: "stream", codes, schema }; +} + +export function sseErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ErrorMatcher { + return { ...options, err: true, enc: "sse", codes, schema }; +} +export function sse( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ValueMatcher { + return { ...options, enc: "sse", codes, schema }; +} + +export function nilErr( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ErrorMatcher { + return { ...options, err: true, enc: "nil", codes, schema }; +} +export function nil( + codes: StatusCodePredicate, + schema: Schema, + options?: MatchOptions, +): ValueMatcher { + return { ...options, enc: "nil", codes, schema }; +} + +export function fail(codes: StatusCodePredicate): FailMatcher { + return { enc: "fail", codes }; +} + +export type MatchedValue = Matchers extends Matcher[] + ? T + : never; +export type MatchedError = Matchers extends Matcher[] + ? E + : never; +export type MatchFunc = ( + response: Response, + options?: { resultKey?: string; extraFields?: Record }, +) => Promise<[result: Result, raw: unknown]>; + +export function match( + ...matchers: Array> +): MatchFunc { + return async function matchFunc( + response: Response, + options?: { resultKey?: string; extraFields?: Record }, + ): Promise< + [result: Result, raw: unknown] + > { + let raw: unknown; + let matcher: Matcher | undefined; + for (const match of matchers) { + const { codes } = match; + const ctpattern = "ctype" in match + ? match.ctype + : DEFAULT_CONTENT_TYPES[match.enc]; + if (ctpattern && matchResponse(response, codes, ctpattern)) { + matcher = match; + break; + } else if (!ctpattern && matchStatusCode(response, codes)) { + matcher = match; + break; + } + } + + if (!matcher) { + const responseBody = await response.text(); + return [{ + ok: false, + error: new SDKError( + "Unexpected API response status or content-type", + response, + responseBody, + ), + }, responseBody]; + } + + const encoding = matcher.enc; + switch (encoding) { + case "json": + raw = await response.json(); + break; + case "bytes": + raw = new Uint8Array(await response.arrayBuffer()); + break; + case "stream": + raw = response.body; + break; + case "text": + raw = await response.text(); + break; + case "sse": + raw = response.body; + break; + case "nil": + raw = await discardResponseBody(response); + break; + case "fail": + raw = await response.text(); + break; + default: + encoding satisfies never; + throw new Error(`Unsupported response type: ${encoding}`); + } + + if (matcher.enc === "fail") { + return [{ + ok: false, + error: new SDKError( + "API error occurred", + response, + typeof raw === "string" ? raw : "", + ), + }, raw]; + } + + const resultKey = matcher.key || options?.resultKey; + let data: unknown; + + if ("err" in matcher) { + data = { + ...options?.extraFields, + ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), + ...(isPlainObject(raw) ? raw : null), + }; + } else if (resultKey) { + data = { + ...options?.extraFields, + ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), + [resultKey]: raw, + }; + } else if (matcher.hdrs) { + data = { + ...options?.extraFields, + ...(matcher.hdrs ? { Headers: unpackHeaders(response.headers) } : null), + ...(isPlainObject(raw) ? raw : null), + }; + } else { + data = raw; + } + + if ("err" in matcher) { + const result = safeParse( + data, + (v: unknown) => matcher.schema.parse(v), + "Response validation failed", + ); + return [result.ok ? { ok: false, error: result.value } : result, raw]; + } else { + return [ + safeParse( + data, + (v: unknown) => matcher.schema.parse(v), + "Response validation failed", + ), + raw, + ]; + } + }; +} + +const headerValRE = /, */; +/** + * Iterates over a Headers object and returns an object with all the header + * entries. Values are represented as an array to account for repeated headers. + */ +export function unpackHeaders(headers: Headers): Record { + const out: Record = {}; + + for (const [k, v] of headers.entries()) { + out[k] = v.split(headerValRE); + } + + return out; +} + +/** + * Discards the response body to free up resources. + * + * To learn why this is need, see the undici docs: + * https://undici.nodejs.org/#/?id=garbage-collection + */ +export async function discardResponseBody(res: Response) { + const reader = res.body?.getReader(); + if (reader == null) { + return; + } + + try { + let done = false; + while (!done) { + const res = await reader.read(); + done = res.done; + } + } finally { + reader.releaseLock(); + } +} diff --git a/src/lib/primitives.ts b/src/lib/primitives.ts new file mode 100644 index 00000000..48b28674 --- /dev/null +++ b/src/lib/primitives.ts @@ -0,0 +1,60 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +class InvariantError extends Error { + constructor(message: string) { + super(message); + this.name = "InvariantError"; + } +} + +export function invariant( + condition: unknown, + message: string, +): asserts condition { + if (!condition) { + throw new InvariantError(message); + } +} + +export type ExactPartial = { + [P in keyof T]?: T[P] | undefined; +}; + +export type Remap = { + [k in keyof Inp as Mapping[k] extends string /* if we have a string mapping for this key then use it */ + ? Mapping[k] + : Mapping[k] extends null /* if the mapping is to `null` then drop the key */ + ? never + : k /* otherwise keep the key as-is */]: Inp[k]; +}; + +/** + * Converts or omits an object's keys according to a mapping. + * + * @param inp An object whose keys will be remapped + * @param mappings A mapping of original keys to new keys. If a key is not present in the mapping, it will be left as is. If a key is mapped to `null`, it will be removed in the resulting object. + * @returns A new object with keys remapped or omitted according to the mappings + */ +export function remap< + Inp extends Record, + const Mapping extends { [k in keyof Inp]?: string | null }, +>(inp: Inp, mappings: Mapping): Remap { + let out: any = {}; + + if (!Object.keys(mappings).length) { + out = inp; + return out; + } + + for (const [k, v] of Object.entries(inp)) { + const j = mappings[k]; + if (j === null) { + continue; + } + out[j ?? k] = v; + } + + return out; +} diff --git a/src/lib/retries.ts b/src/lib/retries.ts new file mode 100644 index 00000000..93ebc8de --- /dev/null +++ b/src/lib/retries.ts @@ -0,0 +1,219 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { isConnectionError, isTimeoutError } from "./http.js"; + +export type BackoffStrategy = { + initialInterval: number; + maxInterval: number; + exponent: number; + maxElapsedTime: number; +}; + +const defaultBackoff: BackoffStrategy = { + initialInterval: 500, + maxInterval: 60000, + exponent: 1.5, + maxElapsedTime: 3600000, +}; + +export type RetryConfig = + | { strategy: "none" } + | { + strategy: "backoff"; + backoff?: BackoffStrategy; + retryConnectionErrors?: boolean; + }; + +/** + * PermanentError is an error that is not recoverable. Throwing this error will + * cause a retry loop to terminate. + */ +export class PermanentError extends Error { + /** The underlying cause of the error. */ + override readonly cause: unknown; + + constructor(message: string, options?: { cause?: unknown }) { + let msg = message; + if (options?.cause) { + msg += `: ${options.cause}`; + } + + super(msg, options); + this.name = "PermanentError"; + // In older runtimes, the cause field would not have been assigned through + // the super() call. + if (typeof this.cause === "undefined") { + this.cause = options?.cause; + } + + Object.setPrototypeOf(this, PermanentError.prototype); + } +} + +/** + * TemporaryError is an error is used to signal that an HTTP request can be + * retried as part of a retry loop. If retry attempts are exhausted and this + * error is thrown, the response will be returned to the caller. + */ +export class TemporaryError extends Error { + response: Response; + + constructor(message: string, response: Response) { + super(message); + this.response = response; + this.name = "TemporaryError"; + + Object.setPrototypeOf(this, TemporaryError.prototype); + } +} + +export async function retry( + fetchFn: () => Promise, + options: { + config: RetryConfig; + statusCodes: string[]; + }, +): Promise { + switch (options.config.strategy) { + case "backoff": + return retryBackoff( + wrapFetcher(fetchFn, { + statusCodes: options.statusCodes, + retryConnectionErrors: !!options.config.retryConnectionErrors, + }), + options.config.backoff ?? defaultBackoff, + ); + default: + return await fetchFn(); + } +} + +function wrapFetcher( + fn: () => Promise, + options: { + statusCodes: string[]; + retryConnectionErrors: boolean; + }, +): () => Promise { + return async () => { + try { + const res = await fn(); + if (isRetryableResponse(res, options.statusCodes)) { + throw new TemporaryError( + "Response failed with retryable status code", + res, + ); + } + + return res; + } catch (err: unknown) { + if (err instanceof TemporaryError) { + throw err; + } + + if ( + options.retryConnectionErrors && + (isTimeoutError(err) || isConnectionError(err)) + ) { + throw err; + } + + throw new PermanentError("Permanent error", { cause: err }); + } + }; +} + +const codeRangeRE = new RegExp("^[0-9]xx$", "i"); + +function isRetryableResponse(res: Response, statusCodes: string[]): boolean { + const actual = `${res.status}`; + + return statusCodes.some((code) => { + if (!codeRangeRE.test(code)) { + return code === actual; + } + + const expectFamily = code.charAt(0); + if (!expectFamily) { + throw new Error("Invalid status code range"); + } + + const actualFamily = actual.charAt(0); + if (!actualFamily) { + throw new Error(`Invalid response status code: ${actual}`); + } + + return actualFamily === expectFamily; + }); +} + +async function retryBackoff( + fn: () => Promise, + strategy: BackoffStrategy, +): Promise { + const { maxElapsedTime, initialInterval, exponent, maxInterval } = strategy; + + const start = Date.now(); + let x = 0; + + // eslint-disable-next-line no-constant-condition + while (true) { + try { + const res = await fn(); + return res; + } catch (err: unknown) { + if (err instanceof PermanentError) { + throw err.cause; + } + const elapsed = Date.now() - start; + if (elapsed > maxElapsedTime) { + if (err instanceof TemporaryError) { + return err.response; + } + + throw err; + } + + let retryInterval = 0; + if (err instanceof TemporaryError) { + retryInterval = retryIntervalFromResponse(err.response); + } + + if (retryInterval <= 0) { + retryInterval = + initialInterval * Math.pow(x, exponent) + Math.random() * 1000; + } + + const d = Math.min(retryInterval, maxInterval); + + await delay(d); + x++; + } + } +} + +function retryIntervalFromResponse(res: Response): number { + const retryVal = res.headers.get("retry-after") || ""; + if (!retryVal) { + return 0; + } + + const parsedNumber = Number(retryVal); + if (Number.isInteger(parsedNumber)) { + return parsedNumber * 1000; + } + + const parsedDate = Date.parse(retryVal); + if (Number.isInteger(parsedDate)) { + const deltaMS = parsedDate - Date.now(); + return deltaMS > 0 ? Math.ceil(deltaMS) : 0; + } + + return 0; +} + +async function delay(delay: number): Promise { + return new Promise((resolve) => setTimeout(resolve, delay)); +} diff --git a/src/lib/schemas.ts b/src/lib/schemas.ts new file mode 100644 index 00000000..f3856dcb --- /dev/null +++ b/src/lib/schemas.ts @@ -0,0 +1,86 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { + output, + ZodEffects, + ZodError, + ZodObject, + ZodRawShape, + ZodTypeAny, +} from "zod"; +import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; +import { ERR, OK, Result } from "../types/fp.js"; + +/** + * Utility function that executes some code which may throw a ZodError. It + * intercepts this error and converts it to an SDKValidationError so as to not + * leak Zod implementation details to user code. + */ +export function parse( + rawValue: Inp, + fn: (value: Inp) => Out, + errorMessage: string, +): Out { + try { + return fn(rawValue); + } catch (err) { + if (err instanceof ZodError) { + throw new SDKValidationError(errorMessage, err, rawValue); + } + throw err; + } +} + +/** + * Utility function that executes some code which may result in a ZodError. It + * intercepts this error and converts it to an SDKValidationError so as to not + * leak Zod implementation details to user code. + */ +export function safeParse( + rawValue: Inp, + fn: (value: Inp) => Out, + errorMessage: string, +): Result { + try { + return OK(fn(rawValue)); + } catch (err) { + return ERR(new SDKValidationError(errorMessage, err, rawValue)); + } +} + +export function collectExtraKeys< + Shape extends ZodRawShape, + Catchall extends ZodTypeAny, + K extends string, +>( + obj: ZodObject, + extrasKey: K, +): ZodEffects< + typeof obj, + & output> + & { + [k in K]: Record>; + } +> { + return obj.transform((val) => { + const extras: Record> = {}; + const { shape } = obj; + for (const [key] of Object.entries(val)) { + if (key in shape) { + continue; + } + + const v = val[key]; + if (typeof v === "undefined") { + continue; + } + + extras[key] = v; + delete val[key]; + } + + return { ...val, [extrasKey]: extras }; + }); +} diff --git a/src/lib/sdks.ts b/src/lib/sdks.ts new file mode 100644 index 00000000..2ce720a9 --- /dev/null +++ b/src/lib/sdks.ts @@ -0,0 +1,388 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { SDKHooks } from "../hooks/hooks.js"; +import { HookContext } from "../hooks/types.js"; +import { + ConnectionError, + InvalidRequestError, + RequestAbortedError, + RequestTimeoutError, + UnexpectedClientError, +} from "../models/errors/httpclienterrors.js"; +import { ERR, OK, Result } from "../types/fp.js"; +import { stringToBase64 } from "./base64.js"; +import { SDK_METADATA, SDKOptions, serverURLFromOptions } from "./config.js"; +import { encodeForm } from "./encodings.js"; +import { + HTTPClient, + isAbortError, + isConnectionError, + isTimeoutError, + matchContentType, + matchStatusCode, +} from "./http.js"; +import { Logger } from "./logger.js"; +import { retry, RetryConfig } from "./retries.js"; +import { SecurityState } from "./security.js"; + +export type RequestOptions = { + /** + * Sets a timeout, in milliseconds, on HTTP requests made by an SDK method. If + * `fetchOptions.signal` is set then it will take precedence over this option. + */ + timeoutMs?: number; + /** + * Set or override a retry policy on HTTP calls. + */ + retries?: RetryConfig; + /** + * Specifies the status codes which should be retried using the given retry policy. + */ + retryCodes?: string[]; + /** + * Sets various request options on the `fetch` call made by an SDK method. + * + * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request} + */ + fetchOptions?: Omit; +}; + +type RequestConfig = { + method: string; + path: string; + baseURL?: string | URL; + query?: string; + body?: RequestInit["body"]; + headers?: HeadersInit; + security?: SecurityState | null; + uaHeader?: string; + timeoutMs?: number; +}; + +const gt: unknown = typeof globalThis === "undefined" ? null : globalThis; +const webWorkerLike = typeof gt === "object" + && gt != null + && "importScripts" in gt + && typeof gt["importScripts"] === "function"; +const isBrowserLike = webWorkerLike + || (typeof navigator !== "undefined" && "serviceWorker" in navigator) + || (typeof window === "object" && typeof window.document !== "undefined"); + +export class ClientSDK { + readonly #httpClient: HTTPClient; + readonly #hooks: SDKHooks; + readonly #logger?: Logger | undefined; + protected readonly _baseURL: URL | null; + public readonly _options: SDKOptions & { hooks?: SDKHooks }; + + constructor(options: SDKOptions = {}) { + const opt = options as unknown; + if ( + typeof opt === "object" + && opt != null + && "hooks" in opt + && opt.hooks instanceof SDKHooks + ) { + this.#hooks = opt.hooks; + } else { + this.#hooks = new SDKHooks(); + } + this._options = { ...options, hooks: this.#hooks }; + + const url = serverURLFromOptions(options); + if (url) { + url.pathname = url.pathname.replace(/\/+$/, "") + "/"; + } + const { baseURL, client } = this.#hooks.sdkInit({ + baseURL: url, + client: options.httpClient || new HTTPClient(), + }); + this._baseURL = baseURL; + this.#httpClient = client; + this.#logger = options.debugLogger; + } + + public _createRequest( + context: HookContext, + conf: RequestConfig, + options?: RequestOptions, + ): Result { + const { method, path, query, headers: opHeaders, security } = conf; + + const base = conf.baseURL ?? this._baseURL; + if (!base) { + return ERR(new InvalidRequestError("No base URL provided for operation")); + } + const reqURL = new URL(base); + const inputURL = new URL(path, reqURL); + + if (path) { + reqURL.pathname += inputURL.pathname.replace(/^\/+/, ""); + } + + let finalQuery = query || ""; + + const secQuery: string[] = []; + for (const [k, v] of Object.entries(security?.queryParams || {})) { + secQuery.push(encodeForm(k, v, { charEncoding: "percent" })); + } + if (secQuery.length) { + finalQuery += `&${secQuery.join("&")}`; + } + + if (finalQuery) { + const q = finalQuery.startsWith("&") ? finalQuery.slice(1) : finalQuery; + reqURL.search = `?${q}`; + } + + const headers = new Headers(opHeaders); + + const username = security?.basic.username; + const password = security?.basic.password; + if (username != null || password != null) { + const encoded = stringToBase64( + [username || "", password || ""].join(":"), + ); + headers.set("Authorization", `Basic ${encoded}`); + } + + const securityHeaders = new Headers(security?.headers || {}); + for (const [k, v] of securityHeaders) { + headers.set(k, v); + } + + let cookie = headers.get("cookie") || ""; + for (const [k, v] of Object.entries(security?.cookies || {})) { + cookie += `; ${k}=${v}`; + } + cookie = cookie.startsWith("; ") ? cookie.slice(2) : cookie; + headers.set("cookie", cookie); + + const userHeaders = new Headers(options?.fetchOptions?.headers); + for (const [k, v] of userHeaders) { + headers.set(k, v); + } + + // Only set user agent header in non-browser-like environments since CORS + // policy disallows setting it in browsers e.g. Chrome throws an error. + if (!isBrowserLike) { + headers.set(conf.uaHeader ?? "user-agent", SDK_METADATA.userAgent); + } + + let fetchOptions = options?.fetchOptions; + if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) { + const timeoutSignal = AbortSignal.timeout(conf.timeoutMs); + if (!fetchOptions) { + fetchOptions = { signal: timeoutSignal }; + } else { + fetchOptions.signal = timeoutSignal; + } + } + + if (conf.body instanceof ReadableStream) { + if (!fetchOptions) { + fetchOptions = { + // @ts-expect-error see https://github.com/node-fetch/node-fetch/issues/1769 + duplex: "half", + }; + } else { + // @ts-expect-error see https://github.com/node-fetch/node-fetch/issues/1769 + fetchOptions.duplex = "half"; + } + } + + let input; + try { + input = this.#hooks.beforeCreateRequest(context, { + url: reqURL, + options: { + ...fetchOptions, + body: conf.body ?? null, + headers, + method, + }, + }); + } catch (err: unknown) { + return ERR( + new UnexpectedClientError("Create request hook failed to execute", { + cause: err, + }), + ); + } + + return OK(new Request(input.url, input.options)); + } + + public async _do( + request: Request, + options: { + context: HookContext; + errorCodes: number | string | (number | string)[]; + retryConfig: RetryConfig; + retryCodes: string[]; + }, + ): Promise< + Result< + Response, + | RequestAbortedError + | RequestTimeoutError + | ConnectionError + | UnexpectedClientError + > + > { + const { context, errorCodes } = options; + + return retry( + async () => { + const req = await this.#hooks.beforeRequest(context, request.clone()); + await logRequest(this.#logger, req).catch((e) => + this.#logger?.log("Failed to log request:", e) + ); + + let response = await this.#httpClient.request(req); + + try { + if (matchStatusCode(response, errorCodes)) { + const result = await this.#hooks.afterError( + context, + response, + null, + ); + if (result.error) { + throw result.error; + } + response = result.response || response; + } else { + response = await this.#hooks.afterSuccess(context, response); + } + } finally { + await logResponse(this.#logger, response, req) + .catch(e => this.#logger?.log("Failed to log response:", e)); + } + + return response; + }, + { config: options.retryConfig, statusCodes: options.retryCodes }, + ).then( + (r) => OK(r), + (err) => { + switch (true) { + case isAbortError(err): + return ERR( + new RequestAbortedError("Request aborted by client", { + cause: err, + }), + ); + case isTimeoutError(err): + return ERR( + new RequestTimeoutError("Request timed out", { cause: err }), + ); + case isConnectionError(err): + return ERR( + new ConnectionError("Unable to make request", { cause: err }), + ); + default: + return ERR( + new UnexpectedClientError("Unexpected HTTP client error", { + cause: err, + }), + ); + } + }, + ); + } +} + +const jsonLikeContentTypeRE = /^application\/(?:.{0,100}\+)?json/; +async function logRequest(logger: Logger | undefined, req: Request) { + if (!logger) { + return; + } + + const contentType = req.headers.get("content-type"); + const ct = contentType?.split(";")[0] || ""; + + logger.group(`> Request: ${req.method} ${req.url}`); + + logger.group("Headers:"); + for (const [k, v] of req.headers.entries()) { + logger.log(`${k}: ${v}`); + } + logger.groupEnd(); + + logger.group("Body:"); + switch (true) { + case jsonLikeContentTypeRE.test(ct): + logger.log(await req.clone().json()); + break; + case ct.startsWith("text/"): + logger.log(await req.clone().text()); + break; + case ct === "multipart/form-data": { + const body = await req.clone().formData(); + for (const [k, v] of body) { + const vlabel = v instanceof Blob ? "" : v; + logger.log(`${k}: ${vlabel}`); + } + break; + } + default: + logger.log(`<${contentType}>`); + break; + } + logger.groupEnd(); + + logger.groupEnd(); +} + +async function logResponse( + logger: Logger | undefined, + res: Response, + req: Request, +) { + if (!logger) { + return; + } + + const contentType = res.headers.get("content-type"); + const ct = contentType?.split(";")[0] || ""; + + logger.group(`< Response: ${req.method} ${req.url}`); + logger.log("Status Code:", res.status, res.statusText); + + logger.group("Headers:"); + for (const [k, v] of res.headers.entries()) { + logger.log(`${k}: ${v}`); + } + logger.groupEnd(); + + logger.group("Body:"); + switch (true) { + case matchContentType(res, "application/json") + || jsonLikeContentTypeRE.test(ct): + logger.log(await res.clone().json()); + break; + case matchContentType(res, "text/event-stream"): + logger.log(`<${contentType}>`); + break; + case matchContentType(res, "text/*"): + logger.log(await res.clone().text()); + break; + case matchContentType(res, "multipart/form-data"): { + const body = await res.clone().formData(); + for (const [k, v] of body) { + const vlabel = v instanceof Blob ? "" : v; + logger.log(`${k}: ${vlabel}`); + } + break; + } + default: + logger.log(`<${contentType}>`); + break; + } + logger.groupEnd(); + + logger.groupEnd(); +} diff --git a/src/lib/security.ts b/src/lib/security.ts new file mode 100644 index 00000000..5a45e6d0 --- /dev/null +++ b/src/lib/security.ts @@ -0,0 +1,253 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as components from "../models/components/index.js"; + +type OAuth2PasswordFlow = { + username: string; + password?: string | undefined; + clientID: string; + clientSecret?: string | undefined; + tokenURL: string; +}; + +export enum SecurityErrorCode { + Incomplete = "incomplete", + UnrecognisedSecurityType = "unrecognized_security_type", +} + +export class SecurityError extends Error { + constructor( + public code: SecurityErrorCode, + message: string, + ) { + super(message); + this.name = "SecurityError"; + } + + static incomplete(): SecurityError { + return new SecurityError( + SecurityErrorCode.Incomplete, + "Security requirements not met in order to perform the operation", + ); + } + static unrecognizedType(type: string): SecurityError { + return new SecurityError( + SecurityErrorCode.UnrecognisedSecurityType, + `Unrecognised security type: ${type}`, + ); + } +} + +export type SecurityState = { + basic: { username?: string | undefined; password?: string | undefined }; + headers: Record; + queryParams: Record; + cookies: Record; + oauth2: ({ type: "password" } & OAuth2PasswordFlow) | { type: "none" }; +}; + +type SecurityInputBasic = { + type: "http:basic"; + value: + | { username?: string | undefined; password?: string | undefined } + | null + | undefined; +}; + +type SecurityInputBearer = { + type: "http:bearer"; + value: string | null | undefined; + fieldName: string; +}; + +type SecurityInputAPIKey = { + type: "apiKey:header" | "apiKey:query" | "apiKey:cookie"; + value: string | null | undefined; + fieldName: string; +}; + +type SecurityInputOIDC = { + type: "openIdConnect"; + value: string | null | undefined; + fieldName: string; +}; + +type SecurityInputOAuth2 = { + type: "oauth2"; + value: string | null | undefined; + fieldName: string; +}; + +type SecurityInputOAuth2ClientCredentials = { + type: "oauth2:client_credentials"; + value: + | { clientID?: string | undefined; clientSecret?: string | undefined } + | null + | undefined; +}; + +type SecurityInputOAuth2PasswordCredentials = { + type: "oauth2:password"; + value: + | string + | null + | undefined; + fieldName: string; +}; + +type SecurityInputCustom = { + type: "http:custom"; + value: any | null | undefined; + fieldName: string; +}; + +export type SecurityInput = + | SecurityInputBasic + | SecurityInputBearer + | SecurityInputAPIKey + | SecurityInputOAuth2 + | SecurityInputOAuth2ClientCredentials + | SecurityInputOAuth2PasswordCredentials + | SecurityInputOIDC + | SecurityInputCustom; + +export function resolveSecurity( + ...options: SecurityInput[][] +): SecurityState | null { + const state: SecurityState = { + basic: { username: "", password: "" }, + headers: {}, + queryParams: {}, + cookies: {}, + oauth2: { type: "none" }, + }; + + const option = options.find((opts) => { + return opts.every((o) => { + if (o.value == null) { + return false; + } else if (o.type === "http:basic") { + return o.value.username != null || o.value.password != null; + } else if (o.type === "http:custom") { + return null; + } else if (o.type === "oauth2:password") { + return ( + typeof o.value === "string" && !!o.value + ); + } else if (o.type === "oauth2:client_credentials") { + return o.value.clientID != null || o.value.clientSecret != null; + } else if (typeof o.value === "string") { + return !!o.value; + } else { + throw new Error( + `Unrecognized security type: ${o.type} (value type: ${typeof o + .value})`, + ); + } + }); + }); + if (option == null) { + return null; + } + + option.forEach((spec) => { + if (spec.value == null) { + return; + } + + const { type } = spec; + + switch (type) { + case "apiKey:header": + state.headers[spec.fieldName] = spec.value; + break; + case "apiKey:query": + state.queryParams[spec.fieldName] = spec.value; + break; + case "apiKey:cookie": + state.cookies[spec.fieldName] = spec.value; + break; + case "http:basic": + applyBasic(state, spec); + break; + case "http:custom": + break; + case "http:bearer": + applyBearer(state, spec); + break; + case "oauth2": + applyBearer(state, spec); + break; + case "oauth2:password": + applyBearer(state, spec); + break; + case "oauth2:client_credentials": + break; + case "openIdConnect": + applyBearer(state, spec); + break; + default: + spec satisfies never; + throw SecurityError.unrecognizedType(type); + } + }); + + return state; +} + +function applyBasic( + state: SecurityState, + spec: SecurityInputBasic, +) { + if (spec.value == null) { + return; + } + + state.basic = spec.value; +} + +function applyBearer( + state: SecurityState, + spec: + | SecurityInputBearer + | SecurityInputOAuth2 + | SecurityInputOIDC + | SecurityInputOAuth2PasswordCredentials, +) { + if (typeof spec.value !== "string" || !spec.value) { + return; + } + + let value = spec.value; + if (value.slice(0, 7).toLowerCase() !== "bearer ") { + value = `Bearer ${value}`; + } + + state.headers[spec.fieldName] = value; +} + +export function resolveGlobalSecurity( + security: Partial | null | undefined, +): SecurityState | null { + return resolveSecurity( + [ + { + fieldName: "Authorization", + type: "apiKey:header", + value: security?.apiKey, + }, + ], + ); +} + +export async function extractSecurity< + T extends string | Record, +>(sec: T | (() => Promise) | undefined): Promise { + if (sec == null) { + return; + } + + return typeof sec === "function" ? sec() : sec; +} diff --git a/src/lib/url.ts b/src/lib/url.ts new file mode 100644 index 00000000..6bc6356e --- /dev/null +++ b/src/lib/url.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +const hasOwn = Object.prototype.hasOwnProperty; + +export type Params = Partial>; + +export function pathToFunc( + pathPattern: string, + options?: { charEncoding?: "percent" | "none" }, +): (params?: Params) => string { + const paramRE = /\{([a-zA-Z0-9_]+?)\}/g; + + return function buildURLPath(params: Record = {}): string { + return pathPattern.replace(paramRE, function (_, placeholder) { + if (!hasOwn.call(params, placeholder)) { + throw new Error(`Parameter '${placeholder}' is required`); + } + + const value = params[placeholder]; + if (typeof value !== "string" && typeof value !== "number") { + throw new Error( + `Parameter '${placeholder}' must be a string or number`, + ); + } + + return options?.charEncoding === "percent" + ? encodeURIComponent(`${value}`) + : `${value}`; + }); + }; +} diff --git a/src/models/components/activitiesresponsedto.ts b/src/models/components/activitiesresponsedto.ts new file mode 100644 index 00000000..43be2909 --- /dev/null +++ b/src/models/components/activitiesresponsedto.ts @@ -0,0 +1,78 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type ActivitiesResponseDto = { + hasMore: boolean; + data: Array; + pageSize: number; + page: number; +}; + +/** @internal */ +export const ActivitiesResponseDto$inboundSchema: z.ZodType< + ActivitiesResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + hasMore: z.boolean(), + data: z.array(z.string()), + pageSize: z.number(), + page: z.number(), +}); + +/** @internal */ +export type ActivitiesResponseDto$Outbound = { + hasMore: boolean; + data: Array; + pageSize: number; + page: number; +}; + +/** @internal */ +export const ActivitiesResponseDto$outboundSchema: z.ZodType< + ActivitiesResponseDto$Outbound, + z.ZodTypeDef, + ActivitiesResponseDto +> = z.object({ + hasMore: z.boolean(), + data: z.array(z.string()), + pageSize: z.number(), + page: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ActivitiesResponseDto$ { + /** @deprecated use `ActivitiesResponseDto$inboundSchema` instead. */ + export const inboundSchema = ActivitiesResponseDto$inboundSchema; + /** @deprecated use `ActivitiesResponseDto$outboundSchema` instead. */ + export const outboundSchema = ActivitiesResponseDto$outboundSchema; + /** @deprecated use `ActivitiesResponseDto$Outbound` instead. */ + export type Outbound = ActivitiesResponseDto$Outbound; +} + +export function activitiesResponseDtoToJSON( + activitiesResponseDto: ActivitiesResponseDto, +): string { + return JSON.stringify( + ActivitiesResponseDto$outboundSchema.parse(activitiesResponseDto), + ); +} + +export function activitiesResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ActivitiesResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ActivitiesResponseDto' from JSON`, + ); +} diff --git a/src/models/components/activitygraphstatesresponse.ts b/src/models/components/activitygraphstatesresponse.ts new file mode 100644 index 00000000..f2e00967 --- /dev/null +++ b/src/models/components/activitygraphstatesresponse.ts @@ -0,0 +1,118 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const Channels = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +export type Channels = ClosedEnum; + +export type ActivityGraphStatesResponse = { + id: string; + count: number; + templates: Array; + channels: Array; +}; + +/** @internal */ +export const Channels$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Channels); + +/** @internal */ +export const Channels$outboundSchema: z.ZodNativeEnum = + Channels$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Channels$ { + /** @deprecated use `Channels$inboundSchema` instead. */ + export const inboundSchema = Channels$inboundSchema; + /** @deprecated use `Channels$outboundSchema` instead. */ + export const outboundSchema = Channels$outboundSchema; +} + +/** @internal */ +export const ActivityGraphStatesResponse$inboundSchema: z.ZodType< + ActivityGraphStatesResponse, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string(), + count: z.number(), + templates: z.array(z.string()), + channels: z.array(Channels$inboundSchema), +}).transform((v) => { + return remap$(v, { + "_id": "id", + }); +}); + +/** @internal */ +export type ActivityGraphStatesResponse$Outbound = { + _id: string; + count: number; + templates: Array; + channels: Array; +}; + +/** @internal */ +export const ActivityGraphStatesResponse$outboundSchema: z.ZodType< + ActivityGraphStatesResponse$Outbound, + z.ZodTypeDef, + ActivityGraphStatesResponse +> = z.object({ + id: z.string(), + count: z.number(), + templates: z.array(z.string()), + channels: z.array(Channels$outboundSchema), +}).transform((v) => { + return remap$(v, { + id: "_id", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ActivityGraphStatesResponse$ { + /** @deprecated use `ActivityGraphStatesResponse$inboundSchema` instead. */ + export const inboundSchema = ActivityGraphStatesResponse$inboundSchema; + /** @deprecated use `ActivityGraphStatesResponse$outboundSchema` instead. */ + export const outboundSchema = ActivityGraphStatesResponse$outboundSchema; + /** @deprecated use `ActivityGraphStatesResponse$Outbound` instead. */ + export type Outbound = ActivityGraphStatesResponse$Outbound; +} + +export function activityGraphStatesResponseToJSON( + activityGraphStatesResponse: ActivityGraphStatesResponse, +): string { + return JSON.stringify( + ActivityGraphStatesResponse$outboundSchema.parse( + activityGraphStatesResponse, + ), + ); +} + +export function activityGraphStatesResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ActivityGraphStatesResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ActivityGraphStatesResponse' from JSON`, + ); +} diff --git a/src/models/components/activitynotificationresponsedto.ts b/src/models/components/activitynotificationresponsedto.ts new file mode 100644 index 00000000..522b0579 --- /dev/null +++ b/src/models/components/activitynotificationresponsedto.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + ActivityNotificationSubscriberResponseDto, + ActivityNotificationSubscriberResponseDto$inboundSchema, + ActivityNotificationSubscriberResponseDto$Outbound, + ActivityNotificationSubscriberResponseDto$outboundSchema, +} from "./activitynotificationsubscriberresponsedto.js"; +import { + ActivityNotificationTemplateResponseDto, + ActivityNotificationTemplateResponseDto$inboundSchema, + ActivityNotificationTemplateResponseDto$Outbound, + ActivityNotificationTemplateResponseDto$outboundSchema, +} from "./activitynotificationtemplateresponsedto.js"; + +export const ActivityNotificationResponseDtoChannels = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", + Digest: "digest", + Trigger: "trigger", + Delay: "delay", + Custom: "custom", +} as const; +export type ActivityNotificationResponseDtoChannels = ClosedEnum< + typeof ActivityNotificationResponseDtoChannels +>; + +export type ActivityNotificationResponseDto = { + id?: string | undefined; + environmentId: string; + organizationId: string; + transactionId: string; + createdAt?: string | undefined; + channels?: ActivityNotificationResponseDtoChannels | undefined; + subscriber?: ActivityNotificationSubscriberResponseDto | undefined; + template?: ActivityNotificationTemplateResponseDto | undefined; + jobs?: Array | undefined; +}; + +/** @internal */ +export const ActivityNotificationResponseDtoChannels$inboundSchema: + z.ZodNativeEnum = z + .nativeEnum(ActivityNotificationResponseDtoChannels); + +/** @internal */ +export const ActivityNotificationResponseDtoChannels$outboundSchema: + z.ZodNativeEnum = + ActivityNotificationResponseDtoChannels$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ActivityNotificationResponseDtoChannels$ { + /** @deprecated use `ActivityNotificationResponseDtoChannels$inboundSchema` instead. */ + export const inboundSchema = + ActivityNotificationResponseDtoChannels$inboundSchema; + /** @deprecated use `ActivityNotificationResponseDtoChannels$outboundSchema` instead. */ + export const outboundSchema = + ActivityNotificationResponseDtoChannels$outboundSchema; +} + +/** @internal */ +export const ActivityNotificationResponseDto$inboundSchema: z.ZodType< + ActivityNotificationResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + _environmentId: z.string(), + _organizationId: z.string(), + transactionId: z.string(), + createdAt: z.string().optional(), + channels: ActivityNotificationResponseDtoChannels$inboundSchema.optional(), + subscriber: ActivityNotificationSubscriberResponseDto$inboundSchema + .optional(), + template: ActivityNotificationTemplateResponseDto$inboundSchema.optional(), + jobs: z.array(z.string()).optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_environmentId": "environmentId", + "_organizationId": "organizationId", + }); +}); + +/** @internal */ +export type ActivityNotificationResponseDto$Outbound = { + _id?: string | undefined; + _environmentId: string; + _organizationId: string; + transactionId: string; + createdAt?: string | undefined; + channels?: string | undefined; + subscriber?: ActivityNotificationSubscriberResponseDto$Outbound | undefined; + template?: ActivityNotificationTemplateResponseDto$Outbound | undefined; + jobs?: Array | undefined; +}; + +/** @internal */ +export const ActivityNotificationResponseDto$outboundSchema: z.ZodType< + ActivityNotificationResponseDto$Outbound, + z.ZodTypeDef, + ActivityNotificationResponseDto +> = z.object({ + id: z.string().optional(), + environmentId: z.string(), + organizationId: z.string(), + transactionId: z.string(), + createdAt: z.string().optional(), + channels: ActivityNotificationResponseDtoChannels$outboundSchema.optional(), + subscriber: ActivityNotificationSubscriberResponseDto$outboundSchema + .optional(), + template: ActivityNotificationTemplateResponseDto$outboundSchema.optional(), + jobs: z.array(z.string()).optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + environmentId: "_environmentId", + organizationId: "_organizationId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ActivityNotificationResponseDto$ { + /** @deprecated use `ActivityNotificationResponseDto$inboundSchema` instead. */ + export const inboundSchema = ActivityNotificationResponseDto$inboundSchema; + /** @deprecated use `ActivityNotificationResponseDto$outboundSchema` instead. */ + export const outboundSchema = ActivityNotificationResponseDto$outboundSchema; + /** @deprecated use `ActivityNotificationResponseDto$Outbound` instead. */ + export type Outbound = ActivityNotificationResponseDto$Outbound; +} + +export function activityNotificationResponseDtoToJSON( + activityNotificationResponseDto: ActivityNotificationResponseDto, +): string { + return JSON.stringify( + ActivityNotificationResponseDto$outboundSchema.parse( + activityNotificationResponseDto, + ), + ); +} + +export function activityNotificationResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ActivityNotificationResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ActivityNotificationResponseDto' from JSON`, + ); +} diff --git a/src/models/components/activitynotificationsubscriberresponsedto.ts b/src/models/components/activitynotificationsubscriberresponsedto.ts new file mode 100644 index 00000000..33a6ca03 --- /dev/null +++ b/src/models/components/activitynotificationsubscriberresponsedto.ts @@ -0,0 +1,103 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type ActivityNotificationSubscriberResponseDto = { + firstName?: string | undefined; + id: string; + lastName?: string | undefined; + email?: string | undefined; + phone?: string | undefined; +}; + +/** @internal */ +export const ActivityNotificationSubscriberResponseDto$inboundSchema: z.ZodType< + ActivityNotificationSubscriberResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + firstName: z.string().optional(), + _id: z.string(), + lastName: z.string().optional(), + email: z.string().optional(), + phone: z.string().optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + }); +}); + +/** @internal */ +export type ActivityNotificationSubscriberResponseDto$Outbound = { + firstName?: string | undefined; + _id: string; + lastName?: string | undefined; + email?: string | undefined; + phone?: string | undefined; +}; + +/** @internal */ +export const ActivityNotificationSubscriberResponseDto$outboundSchema: + z.ZodType< + ActivityNotificationSubscriberResponseDto$Outbound, + z.ZodTypeDef, + ActivityNotificationSubscriberResponseDto + > = z.object({ + firstName: z.string().optional(), + id: z.string(), + lastName: z.string().optional(), + email: z.string().optional(), + phone: z.string().optional(), + }).transform((v) => { + return remap$(v, { + id: "_id", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ActivityNotificationSubscriberResponseDto$ { + /** @deprecated use `ActivityNotificationSubscriberResponseDto$inboundSchema` instead. */ + export const inboundSchema = + ActivityNotificationSubscriberResponseDto$inboundSchema; + /** @deprecated use `ActivityNotificationSubscriberResponseDto$outboundSchema` instead. */ + export const outboundSchema = + ActivityNotificationSubscriberResponseDto$outboundSchema; + /** @deprecated use `ActivityNotificationSubscriberResponseDto$Outbound` instead. */ + export type Outbound = ActivityNotificationSubscriberResponseDto$Outbound; +} + +export function activityNotificationSubscriberResponseDtoToJSON( + activityNotificationSubscriberResponseDto: + ActivityNotificationSubscriberResponseDto, +): string { + return JSON.stringify( + ActivityNotificationSubscriberResponseDto$outboundSchema.parse( + activityNotificationSubscriberResponseDto, + ), + ); +} + +export function activityNotificationSubscriberResponseDtoFromJSON( + jsonString: string, +): SafeParseResult< + ActivityNotificationSubscriberResponseDto, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + ActivityNotificationSubscriberResponseDto$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'ActivityNotificationSubscriberResponseDto' from JSON`, + ); +} diff --git a/src/models/components/activitynotificationtemplateresponsedto.ts b/src/models/components/activitynotificationtemplateresponsedto.ts new file mode 100644 index 00000000..83bea08b --- /dev/null +++ b/src/models/components/activitynotificationtemplateresponsedto.ts @@ -0,0 +1,94 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type ActivityNotificationTemplateResponseDto = { + id?: string | undefined; + name: string; + triggers: Array; +}; + +/** @internal */ +export const ActivityNotificationTemplateResponseDto$inboundSchema: z.ZodType< + ActivityNotificationTemplateResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + name: z.string(), + triggers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + "_id": "id", + }); +}); + +/** @internal */ +export type ActivityNotificationTemplateResponseDto$Outbound = { + _id?: string | undefined; + name: string; + triggers: Array; +}; + +/** @internal */ +export const ActivityNotificationTemplateResponseDto$outboundSchema: z.ZodType< + ActivityNotificationTemplateResponseDto$Outbound, + z.ZodTypeDef, + ActivityNotificationTemplateResponseDto +> = z.object({ + id: z.string().optional(), + name: z.string(), + triggers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + id: "_id", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ActivityNotificationTemplateResponseDto$ { + /** @deprecated use `ActivityNotificationTemplateResponseDto$inboundSchema` instead. */ + export const inboundSchema = + ActivityNotificationTemplateResponseDto$inboundSchema; + /** @deprecated use `ActivityNotificationTemplateResponseDto$outboundSchema` instead. */ + export const outboundSchema = + ActivityNotificationTemplateResponseDto$outboundSchema; + /** @deprecated use `ActivityNotificationTemplateResponseDto$Outbound` instead. */ + export type Outbound = ActivityNotificationTemplateResponseDto$Outbound; +} + +export function activityNotificationTemplateResponseDtoToJSON( + activityNotificationTemplateResponseDto: + ActivityNotificationTemplateResponseDto, +): string { + return JSON.stringify( + ActivityNotificationTemplateResponseDto$outboundSchema.parse( + activityNotificationTemplateResponseDto, + ), + ); +} + +export function activityNotificationTemplateResponseDtoFromJSON( + jsonString: string, +): SafeParseResult< + ActivityNotificationTemplateResponseDto, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + ActivityNotificationTemplateResponseDto$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'ActivityNotificationTemplateResponseDto' from JSON`, + ); +} diff --git a/src/models/components/activitystatsresponsedto.ts b/src/models/components/activitystatsresponsedto.ts new file mode 100644 index 00000000..f0ce0e9c --- /dev/null +++ b/src/models/components/activitystatsresponsedto.ts @@ -0,0 +1,70 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type ActivityStatsResponseDto = { + weeklySent: number; + monthlySent: number; +}; + +/** @internal */ +export const ActivityStatsResponseDto$inboundSchema: z.ZodType< + ActivityStatsResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + weeklySent: z.number(), + monthlySent: z.number(), +}); + +/** @internal */ +export type ActivityStatsResponseDto$Outbound = { + weeklySent: number; + monthlySent: number; +}; + +/** @internal */ +export const ActivityStatsResponseDto$outboundSchema: z.ZodType< + ActivityStatsResponseDto$Outbound, + z.ZodTypeDef, + ActivityStatsResponseDto +> = z.object({ + weeklySent: z.number(), + monthlySent: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ActivityStatsResponseDto$ { + /** @deprecated use `ActivityStatsResponseDto$inboundSchema` instead. */ + export const inboundSchema = ActivityStatsResponseDto$inboundSchema; + /** @deprecated use `ActivityStatsResponseDto$outboundSchema` instead. */ + export const outboundSchema = ActivityStatsResponseDto$outboundSchema; + /** @deprecated use `ActivityStatsResponseDto$Outbound` instead. */ + export type Outbound = ActivityStatsResponseDto$Outbound; +} + +export function activityStatsResponseDtoToJSON( + activityStatsResponseDto: ActivityStatsResponseDto, +): string { + return JSON.stringify( + ActivityStatsResponseDto$outboundSchema.parse(activityStatsResponseDto), + ); +} + +export function activityStatsResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ActivityStatsResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ActivityStatsResponseDto' from JSON`, + ); +} diff --git a/src/models/components/addsubscribersrequestdto.ts b/src/models/components/addsubscribersrequestdto.ts new file mode 100644 index 00000000..c03c0c39 --- /dev/null +++ b/src/models/components/addsubscribersrequestdto.ts @@ -0,0 +1,69 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type AddSubscribersRequestDto = { + /** + * List of subscriber identifiers that will be associated to the topic + */ + subscribers: Array; +}; + +/** @internal */ +export const AddSubscribersRequestDto$inboundSchema: z.ZodType< + AddSubscribersRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + subscribers: z.array(z.string()), +}); + +/** @internal */ +export type AddSubscribersRequestDto$Outbound = { + subscribers: Array; +}; + +/** @internal */ +export const AddSubscribersRequestDto$outboundSchema: z.ZodType< + AddSubscribersRequestDto$Outbound, + z.ZodTypeDef, + AddSubscribersRequestDto +> = z.object({ + subscribers: z.array(z.string()), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace AddSubscribersRequestDto$ { + /** @deprecated use `AddSubscribersRequestDto$inboundSchema` instead. */ + export const inboundSchema = AddSubscribersRequestDto$inboundSchema; + /** @deprecated use `AddSubscribersRequestDto$outboundSchema` instead. */ + export const outboundSchema = AddSubscribersRequestDto$outboundSchema; + /** @deprecated use `AddSubscribersRequestDto$Outbound` instead. */ + export type Outbound = AddSubscribersRequestDto$Outbound; +} + +export function addSubscribersRequestDtoToJSON( + addSubscribersRequestDto: AddSubscribersRequestDto, +): string { + return JSON.stringify( + AddSubscribersRequestDto$outboundSchema.parse(addSubscribersRequestDto), + ); +} + +export function addSubscribersRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddSubscribersRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddSubscribersRequestDto' from JSON`, + ); +} diff --git a/src/models/components/apikey.ts b/src/models/components/apikey.ts new file mode 100644 index 00000000..2432c7a1 --- /dev/null +++ b/src/models/components/apikey.ts @@ -0,0 +1,72 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type ApiKey = { + key: string; + userId: string; +}; + +/** @internal */ +export const ApiKey$inboundSchema: z.ZodType = z + .object({ + key: z.string(), + _userId: z.string(), + }).transform((v) => { + return remap$(v, { + "_userId": "userId", + }); + }); + +/** @internal */ +export type ApiKey$Outbound = { + key: string; + _userId: string; +}; + +/** @internal */ +export const ApiKey$outboundSchema: z.ZodType< + ApiKey$Outbound, + z.ZodTypeDef, + ApiKey +> = z.object({ + key: z.string(), + userId: z.string(), +}).transform((v) => { + return remap$(v, { + userId: "_userId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ApiKey$ { + /** @deprecated use `ApiKey$inboundSchema` instead. */ + export const inboundSchema = ApiKey$inboundSchema; + /** @deprecated use `ApiKey$outboundSchema` instead. */ + export const outboundSchema = ApiKey$outboundSchema; + /** @deprecated use `ApiKey$Outbound` instead. */ + export type Outbound = ApiKey$Outbound; +} + +export function apiKeyToJSON(apiKey: ApiKey): string { + return JSON.stringify(ApiKey$outboundSchema.parse(apiKey)); +} + +export function apiKeyFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ApiKey$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ApiKey' from JSON`, + ); +} diff --git a/src/models/components/bulksubscribercreatedto.ts b/src/models/components/bulksubscribercreatedto.ts new file mode 100644 index 00000000..16b49fb2 --- /dev/null +++ b/src/models/components/bulksubscribercreatedto.ts @@ -0,0 +1,66 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type BulkSubscriberCreateDto = { + subscribers: Array; +}; + +/** @internal */ +export const BulkSubscriberCreateDto$inboundSchema: z.ZodType< + BulkSubscriberCreateDto, + z.ZodTypeDef, + unknown +> = z.object({ + subscribers: z.array(z.string()), +}); + +/** @internal */ +export type BulkSubscriberCreateDto$Outbound = { + subscribers: Array; +}; + +/** @internal */ +export const BulkSubscriberCreateDto$outboundSchema: z.ZodType< + BulkSubscriberCreateDto$Outbound, + z.ZodTypeDef, + BulkSubscriberCreateDto +> = z.object({ + subscribers: z.array(z.string()), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace BulkSubscriberCreateDto$ { + /** @deprecated use `BulkSubscriberCreateDto$inboundSchema` instead. */ + export const inboundSchema = BulkSubscriberCreateDto$inboundSchema; + /** @deprecated use `BulkSubscriberCreateDto$outboundSchema` instead. */ + export const outboundSchema = BulkSubscriberCreateDto$outboundSchema; + /** @deprecated use `BulkSubscriberCreateDto$Outbound` instead. */ + export type Outbound = BulkSubscriberCreateDto$Outbound; +} + +export function bulkSubscriberCreateDtoToJSON( + bulkSubscriberCreateDto: BulkSubscriberCreateDto, +): string { + return JSON.stringify( + BulkSubscriberCreateDto$outboundSchema.parse(bulkSubscriberCreateDto), + ); +} + +export function bulkSubscriberCreateDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => BulkSubscriberCreateDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'BulkSubscriberCreateDto' from JSON`, + ); +} diff --git a/src/models/components/bulktriggereventdto.ts b/src/models/components/bulktriggereventdto.ts new file mode 100644 index 00000000..a668f98c --- /dev/null +++ b/src/models/components/bulktriggereventdto.ts @@ -0,0 +1,72 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + TriggerEventRequestDto, + TriggerEventRequestDto$inboundSchema, + TriggerEventRequestDto$Outbound, + TriggerEventRequestDto$outboundSchema, +} from "./triggereventrequestdto.js"; + +export type BulkTriggerEventDto = { + events: Array; +}; + +/** @internal */ +export const BulkTriggerEventDto$inboundSchema: z.ZodType< + BulkTriggerEventDto, + z.ZodTypeDef, + unknown +> = z.object({ + events: z.array(TriggerEventRequestDto$inboundSchema), +}); + +/** @internal */ +export type BulkTriggerEventDto$Outbound = { + events: Array; +}; + +/** @internal */ +export const BulkTriggerEventDto$outboundSchema: z.ZodType< + BulkTriggerEventDto$Outbound, + z.ZodTypeDef, + BulkTriggerEventDto +> = z.object({ + events: z.array(TriggerEventRequestDto$outboundSchema), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace BulkTriggerEventDto$ { + /** @deprecated use `BulkTriggerEventDto$inboundSchema` instead. */ + export const inboundSchema = BulkTriggerEventDto$inboundSchema; + /** @deprecated use `BulkTriggerEventDto$outboundSchema` instead. */ + export const outboundSchema = BulkTriggerEventDto$outboundSchema; + /** @deprecated use `BulkTriggerEventDto$Outbound` instead. */ + export type Outbound = BulkTriggerEventDto$Outbound; +} + +export function bulkTriggerEventDtoToJSON( + bulkTriggerEventDto: BulkTriggerEventDto, +): string { + return JSON.stringify( + BulkTriggerEventDto$outboundSchema.parse(bulkTriggerEventDto), + ); +} + +export function bulkTriggerEventDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => BulkTriggerEventDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'BulkTriggerEventDto' from JSON`, + ); +} diff --git a/src/models/components/channelcredentials.ts b/src/models/components/channelcredentials.ts new file mode 100644 index 00000000..1428a907 --- /dev/null +++ b/src/models/components/channelcredentials.ts @@ -0,0 +1,118 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type ChannelCredentials = { + /** + * Webhook url used by chat app integrations. The webhook should be obtained from the chat app provider. + */ + webhookUrl: string; + /** + * Channel specification for Mattermost chat notifications + */ + channel?: string | undefined; + /** + * Contains an array of the subscriber device tokens for a given provider. Used on Push integrations + */ + deviceTokens?: Array | undefined; + /** + * alert_uid for grafana on-call webhook payload + */ + alertUid?: string | undefined; + /** + * title to be used with grafana on call webhook + */ + title?: string | undefined; + /** + * image_url property fo grafana on call webhook + */ + imageUrl?: string | undefined; + /** + * state property fo grafana on call webhook + */ + state?: string | undefined; + /** + * link_to_upstream_details property fo grafana on call webhook + */ + externalUrl?: string | undefined; +}; + +/** @internal */ +export const ChannelCredentials$inboundSchema: z.ZodType< + ChannelCredentials, + z.ZodTypeDef, + unknown +> = z.object({ + webhookUrl: z.string(), + channel: z.string().optional(), + deviceTokens: z.array(z.string()).optional(), + alertUid: z.string().optional(), + title: z.string().optional(), + imageUrl: z.string().optional(), + state: z.string().optional(), + externalUrl: z.string().optional(), +}); + +/** @internal */ +export type ChannelCredentials$Outbound = { + webhookUrl: string; + channel?: string | undefined; + deviceTokens?: Array | undefined; + alertUid?: string | undefined; + title?: string | undefined; + imageUrl?: string | undefined; + state?: string | undefined; + externalUrl?: string | undefined; +}; + +/** @internal */ +export const ChannelCredentials$outboundSchema: z.ZodType< + ChannelCredentials$Outbound, + z.ZodTypeDef, + ChannelCredentials +> = z.object({ + webhookUrl: z.string(), + channel: z.string().optional(), + deviceTokens: z.array(z.string()).optional(), + alertUid: z.string().optional(), + title: z.string().optional(), + imageUrl: z.string().optional(), + state: z.string().optional(), + externalUrl: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ChannelCredentials$ { + /** @deprecated use `ChannelCredentials$inboundSchema` instead. */ + export const inboundSchema = ChannelCredentials$inboundSchema; + /** @deprecated use `ChannelCredentials$outboundSchema` instead. */ + export const outboundSchema = ChannelCredentials$outboundSchema; + /** @deprecated use `ChannelCredentials$Outbound` instead. */ + export type Outbound = ChannelCredentials$Outbound; +} + +export function channelCredentialsToJSON( + channelCredentials: ChannelCredentials, +): string { + return JSON.stringify( + ChannelCredentials$outboundSchema.parse(channelCredentials), + ); +} + +export function channelCredentialsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ChannelCredentials$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ChannelCredentials' from JSON`, + ); +} diff --git a/src/models/components/channelpreference.ts b/src/models/components/channelpreference.ts new file mode 100644 index 00000000..d637a376 --- /dev/null +++ b/src/models/components/channelpreference.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * The type of channel that is enabled or not + */ +export const ChannelPreferenceType = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +/** + * The type of channel that is enabled or not + */ +export type ChannelPreferenceType = ClosedEnum; + +export type ChannelPreference = { + /** + * The type of channel that is enabled or not + */ + type: ChannelPreferenceType; + /** + * If channel is enabled or not + */ + enabled: boolean; +}; + +/** @internal */ +export const ChannelPreferenceType$inboundSchema: z.ZodNativeEnum< + typeof ChannelPreferenceType +> = z.nativeEnum(ChannelPreferenceType); + +/** @internal */ +export const ChannelPreferenceType$outboundSchema: z.ZodNativeEnum< + typeof ChannelPreferenceType +> = ChannelPreferenceType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ChannelPreferenceType$ { + /** @deprecated use `ChannelPreferenceType$inboundSchema` instead. */ + export const inboundSchema = ChannelPreferenceType$inboundSchema; + /** @deprecated use `ChannelPreferenceType$outboundSchema` instead. */ + export const outboundSchema = ChannelPreferenceType$outboundSchema; +} + +/** @internal */ +export const ChannelPreference$inboundSchema: z.ZodType< + ChannelPreference, + z.ZodTypeDef, + unknown +> = z.object({ + type: ChannelPreferenceType$inboundSchema, + enabled: z.boolean(), +}); + +/** @internal */ +export type ChannelPreference$Outbound = { + type: string; + enabled: boolean; +}; + +/** @internal */ +export const ChannelPreference$outboundSchema: z.ZodType< + ChannelPreference$Outbound, + z.ZodTypeDef, + ChannelPreference +> = z.object({ + type: ChannelPreferenceType$outboundSchema, + enabled: z.boolean(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ChannelPreference$ { + /** @deprecated use `ChannelPreference$inboundSchema` instead. */ + export const inboundSchema = ChannelPreference$inboundSchema; + /** @deprecated use `ChannelPreference$outboundSchema` instead. */ + export const outboundSchema = ChannelPreference$outboundSchema; + /** @deprecated use `ChannelPreference$Outbound` instead. */ + export type Outbound = ChannelPreference$Outbound; +} + +export function channelPreferenceToJSON( + channelPreference: ChannelPreference, +): string { + return JSON.stringify( + ChannelPreference$outboundSchema.parse(channelPreference), + ); +} + +export function channelPreferenceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ChannelPreference$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ChannelPreference' from JSON`, + ); +} diff --git a/src/models/components/channelsettings.ts b/src/models/components/channelsettings.ts new file mode 100644 index 00000000..5be94479 --- /dev/null +++ b/src/models/components/channelsettings.ts @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + ChannelCredentials, + ChannelCredentials$inboundSchema, + ChannelCredentials$Outbound, + ChannelCredentials$outboundSchema, +} from "./channelcredentials.js"; + +/** + * The provider identifier for the credentials + */ +export const ProviderId = { + Slack: "slack", + Discord: "discord", + Msteams: "msteams", + Mattermost: "mattermost", + Ryver: "ryver", + Zulip: "zulip", + GrafanaOnCall: "grafana-on-call", + Getstream: "getstream", + RocketChat: "rocket-chat", + WhatsappBusiness: "whatsapp-business", + Fcm: "fcm", + Apns: "apns", + Expo: "expo", + OneSignal: "one-signal", + Pushpad: "pushpad", + PushWebhook: "push-webhook", + PusherBeams: "pusher-beams", +} as const; +/** + * The provider identifier for the credentials + */ +export type ProviderId = ClosedEnum; + +export type ChannelSettings = { + /** + * The provider identifier for the credentials + */ + providerId: ProviderId; + /** + * The integration identifier + */ + integrationIdentifier?: string | undefined; + /** + * Credentials payload for the specified provider + */ + credentials: ChannelCredentials; + /** + * Id of the integration that is used for this channel + */ + integrationId: string; +}; + +/** @internal */ +export const ProviderId$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(ProviderId); + +/** @internal */ +export const ProviderId$outboundSchema: z.ZodNativeEnum = + ProviderId$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ProviderId$ { + /** @deprecated use `ProviderId$inboundSchema` instead. */ + export const inboundSchema = ProviderId$inboundSchema; + /** @deprecated use `ProviderId$outboundSchema` instead. */ + export const outboundSchema = ProviderId$outboundSchema; +} + +/** @internal */ +export const ChannelSettings$inboundSchema: z.ZodType< + ChannelSettings, + z.ZodTypeDef, + unknown +> = z.object({ + providerId: ProviderId$inboundSchema, + integrationIdentifier: z.string().optional(), + credentials: ChannelCredentials$inboundSchema, + _integrationId: z.string(), +}).transform((v) => { + return remap$(v, { + "_integrationId": "integrationId", + }); +}); + +/** @internal */ +export type ChannelSettings$Outbound = { + providerId: string; + integrationIdentifier?: string | undefined; + credentials: ChannelCredentials$Outbound; + _integrationId: string; +}; + +/** @internal */ +export const ChannelSettings$outboundSchema: z.ZodType< + ChannelSettings$Outbound, + z.ZodTypeDef, + ChannelSettings +> = z.object({ + providerId: ProviderId$outboundSchema, + integrationIdentifier: z.string().optional(), + credentials: ChannelCredentials$outboundSchema, + integrationId: z.string(), +}).transform((v) => { + return remap$(v, { + integrationId: "_integrationId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ChannelSettings$ { + /** @deprecated use `ChannelSettings$inboundSchema` instead. */ + export const inboundSchema = ChannelSettings$inboundSchema; + /** @deprecated use `ChannelSettings$outboundSchema` instead. */ + export const outboundSchema = ChannelSettings$outboundSchema; + /** @deprecated use `ChannelSettings$Outbound` instead. */ + export type Outbound = ChannelSettings$Outbound; +} + +export function channelSettingsToJSON( + channelSettings: ChannelSettings, +): string { + return JSON.stringify(ChannelSettings$outboundSchema.parse(channelSettings)); +} + +export function channelSettingsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ChannelSettings$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ChannelSettings' from JSON`, + ); +} diff --git a/src/models/components/createintegrationrequestdto.ts b/src/models/components/createintegrationrequestdto.ts new file mode 100644 index 00000000..f35347ca --- /dev/null +++ b/src/models/components/createintegrationrequestdto.ts @@ -0,0 +1,158 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + CredentialsDto, + CredentialsDto$inboundSchema, + CredentialsDto$Outbound, + CredentialsDto$outboundSchema, +} from "./credentialsdto.js"; +import { + StepFilter, + StepFilter$inboundSchema, + StepFilter$Outbound, + StepFilter$outboundSchema, +} from "./stepfilter.js"; + +export const CreateIntegrationRequestDtoChannel = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +export type CreateIntegrationRequestDtoChannel = ClosedEnum< + typeof CreateIntegrationRequestDtoChannel +>; + +export type CreateIntegrationRequestDto = { + name?: string | undefined; + identifier?: string | undefined; + environmentId?: string | undefined; + providerId: string; + channel: CreateIntegrationRequestDtoChannel; + credentials?: CredentialsDto | undefined; + /** + * If the integration is active the validation on the credentials field will run + */ + active?: boolean | undefined; + check?: boolean | undefined; + conditions?: Array | undefined; +}; + +/** @internal */ +export const CreateIntegrationRequestDtoChannel$inboundSchema: z.ZodNativeEnum< + typeof CreateIntegrationRequestDtoChannel +> = z.nativeEnum(CreateIntegrationRequestDtoChannel); + +/** @internal */ +export const CreateIntegrationRequestDtoChannel$outboundSchema: z.ZodNativeEnum< + typeof CreateIntegrationRequestDtoChannel +> = CreateIntegrationRequestDtoChannel$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CreateIntegrationRequestDtoChannel$ { + /** @deprecated use `CreateIntegrationRequestDtoChannel$inboundSchema` instead. */ + export const inboundSchema = CreateIntegrationRequestDtoChannel$inboundSchema; + /** @deprecated use `CreateIntegrationRequestDtoChannel$outboundSchema` instead. */ + export const outboundSchema = + CreateIntegrationRequestDtoChannel$outboundSchema; +} + +/** @internal */ +export const CreateIntegrationRequestDto$inboundSchema: z.ZodType< + CreateIntegrationRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string().optional(), + identifier: z.string().optional(), + _environmentId: z.string().optional(), + providerId: z.string(), + channel: CreateIntegrationRequestDtoChannel$inboundSchema, + credentials: CredentialsDto$inboundSchema.optional(), + active: z.boolean().optional(), + check: z.boolean().optional(), + conditions: z.array(StepFilter$inboundSchema).optional(), +}).transform((v) => { + return remap$(v, { + "_environmentId": "environmentId", + }); +}); + +/** @internal */ +export type CreateIntegrationRequestDto$Outbound = { + name?: string | undefined; + identifier?: string | undefined; + _environmentId?: string | undefined; + providerId: string; + channel: string; + credentials?: CredentialsDto$Outbound | undefined; + active?: boolean | undefined; + check?: boolean | undefined; + conditions?: Array | undefined; +}; + +/** @internal */ +export const CreateIntegrationRequestDto$outboundSchema: z.ZodType< + CreateIntegrationRequestDto$Outbound, + z.ZodTypeDef, + CreateIntegrationRequestDto +> = z.object({ + name: z.string().optional(), + identifier: z.string().optional(), + environmentId: z.string().optional(), + providerId: z.string(), + channel: CreateIntegrationRequestDtoChannel$outboundSchema, + credentials: CredentialsDto$outboundSchema.optional(), + active: z.boolean().optional(), + check: z.boolean().optional(), + conditions: z.array(StepFilter$outboundSchema).optional(), +}).transform((v) => { + return remap$(v, { + environmentId: "_environmentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CreateIntegrationRequestDto$ { + /** @deprecated use `CreateIntegrationRequestDto$inboundSchema` instead. */ + export const inboundSchema = CreateIntegrationRequestDto$inboundSchema; + /** @deprecated use `CreateIntegrationRequestDto$outboundSchema` instead. */ + export const outboundSchema = CreateIntegrationRequestDto$outboundSchema; + /** @deprecated use `CreateIntegrationRequestDto$Outbound` instead. */ + export type Outbound = CreateIntegrationRequestDto$Outbound; +} + +export function createIntegrationRequestDtoToJSON( + createIntegrationRequestDto: CreateIntegrationRequestDto, +): string { + return JSON.stringify( + CreateIntegrationRequestDto$outboundSchema.parse( + createIntegrationRequestDto, + ), + ); +} + +export function createIntegrationRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateIntegrationRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateIntegrationRequestDto' from JSON`, + ); +} diff --git a/src/models/components/createnotificationgrouprequestdto.ts b/src/models/components/createnotificationgrouprequestdto.ts new file mode 100644 index 00000000..4deb78b9 --- /dev/null +++ b/src/models/components/createnotificationgrouprequestdto.ts @@ -0,0 +1,69 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type CreateNotificationGroupRequestDto = { + name: string; +}; + +/** @internal */ +export const CreateNotificationGroupRequestDto$inboundSchema: z.ZodType< + CreateNotificationGroupRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string(), +}); + +/** @internal */ +export type CreateNotificationGroupRequestDto$Outbound = { + name: string; +}; + +/** @internal */ +export const CreateNotificationGroupRequestDto$outboundSchema: z.ZodType< + CreateNotificationGroupRequestDto$Outbound, + z.ZodTypeDef, + CreateNotificationGroupRequestDto +> = z.object({ + name: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CreateNotificationGroupRequestDto$ { + /** @deprecated use `CreateNotificationGroupRequestDto$inboundSchema` instead. */ + export const inboundSchema = CreateNotificationGroupRequestDto$inboundSchema; + /** @deprecated use `CreateNotificationGroupRequestDto$outboundSchema` instead. */ + export const outboundSchema = + CreateNotificationGroupRequestDto$outboundSchema; + /** @deprecated use `CreateNotificationGroupRequestDto$Outbound` instead. */ + export type Outbound = CreateNotificationGroupRequestDto$Outbound; +} + +export function createNotificationGroupRequestDtoToJSON( + createNotificationGroupRequestDto: CreateNotificationGroupRequestDto, +): string { + return JSON.stringify( + CreateNotificationGroupRequestDto$outboundSchema.parse( + createNotificationGroupRequestDto, + ), + ); +} + +export function createNotificationGroupRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateNotificationGroupRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateNotificationGroupRequestDto' from JSON`, + ); +} diff --git a/src/models/components/createsubscriberrequestdto.ts b/src/models/components/createsubscriberrequestdto.ts new file mode 100644 index 00000000..180eb6d1 --- /dev/null +++ b/src/models/components/createsubscriberrequestdto.ts @@ -0,0 +1,156 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type CreateSubscriberRequestDtoData = {}; + +export type CreateSubscriberRequestDto = { + /** + * The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems + */ + subscriberId: string; + email?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + phone?: string | undefined; + /** + * An http url to the profile image of your subscriber + */ + avatar?: string | undefined; + locale?: string | undefined; + data?: CreateSubscriberRequestDtoData | undefined; + channels?: Array | undefined; +}; + +/** @internal */ +export const CreateSubscriberRequestDtoData$inboundSchema: z.ZodType< + CreateSubscriberRequestDtoData, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type CreateSubscriberRequestDtoData$Outbound = {}; + +/** @internal */ +export const CreateSubscriberRequestDtoData$outboundSchema: z.ZodType< + CreateSubscriberRequestDtoData$Outbound, + z.ZodTypeDef, + CreateSubscriberRequestDtoData +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CreateSubscriberRequestDtoData$ { + /** @deprecated use `CreateSubscriberRequestDtoData$inboundSchema` instead. */ + export const inboundSchema = CreateSubscriberRequestDtoData$inboundSchema; + /** @deprecated use `CreateSubscriberRequestDtoData$outboundSchema` instead. */ + export const outboundSchema = CreateSubscriberRequestDtoData$outboundSchema; + /** @deprecated use `CreateSubscriberRequestDtoData$Outbound` instead. */ + export type Outbound = CreateSubscriberRequestDtoData$Outbound; +} + +export function createSubscriberRequestDtoDataToJSON( + createSubscriberRequestDtoData: CreateSubscriberRequestDtoData, +): string { + return JSON.stringify( + CreateSubscriberRequestDtoData$outboundSchema.parse( + createSubscriberRequestDtoData, + ), + ); +} + +export function createSubscriberRequestDtoDataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateSubscriberRequestDtoData$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateSubscriberRequestDtoData' from JSON`, + ); +} + +/** @internal */ +export const CreateSubscriberRequestDto$inboundSchema: z.ZodType< + CreateSubscriberRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + subscriberId: z.string(), + email: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + data: z.lazy(() => CreateSubscriberRequestDtoData$inboundSchema).optional(), + channels: z.array(z.string()).optional(), +}); + +/** @internal */ +export type CreateSubscriberRequestDto$Outbound = { + subscriberId: string; + email?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + phone?: string | undefined; + avatar?: string | undefined; + locale?: string | undefined; + data?: CreateSubscriberRequestDtoData$Outbound | undefined; + channels?: Array | undefined; +}; + +/** @internal */ +export const CreateSubscriberRequestDto$outboundSchema: z.ZodType< + CreateSubscriberRequestDto$Outbound, + z.ZodTypeDef, + CreateSubscriberRequestDto +> = z.object({ + subscriberId: z.string(), + email: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + data: z.lazy(() => CreateSubscriberRequestDtoData$outboundSchema).optional(), + channels: z.array(z.string()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CreateSubscriberRequestDto$ { + /** @deprecated use `CreateSubscriberRequestDto$inboundSchema` instead. */ + export const inboundSchema = CreateSubscriberRequestDto$inboundSchema; + /** @deprecated use `CreateSubscriberRequestDto$outboundSchema` instead. */ + export const outboundSchema = CreateSubscriberRequestDto$outboundSchema; + /** @deprecated use `CreateSubscriberRequestDto$Outbound` instead. */ + export type Outbound = CreateSubscriberRequestDto$Outbound; +} + +export function createSubscriberRequestDtoToJSON( + createSubscriberRequestDto: CreateSubscriberRequestDto, +): string { + return JSON.stringify( + CreateSubscriberRequestDto$outboundSchema.parse(createSubscriberRequestDto), + ); +} + +export function createSubscriberRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateSubscriberRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateSubscriberRequestDto' from JSON`, + ); +} diff --git a/src/models/components/createtopicrequestdto.ts b/src/models/components/createtopicrequestdto.ts new file mode 100644 index 00000000..51e26840 --- /dev/null +++ b/src/models/components/createtopicrequestdto.ts @@ -0,0 +1,76 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type CreateTopicRequestDto = { + /** + * User defined custom key and provided by the user that will be an unique identifier for the Topic created. + */ + key: string; + /** + * User defined custom name and provided by the user that will name the Topic created. + */ + name: string; +}; + +/** @internal */ +export const CreateTopicRequestDto$inboundSchema: z.ZodType< + CreateTopicRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + key: z.string(), + name: z.string(), +}); + +/** @internal */ +export type CreateTopicRequestDto$Outbound = { + key: string; + name: string; +}; + +/** @internal */ +export const CreateTopicRequestDto$outboundSchema: z.ZodType< + CreateTopicRequestDto$Outbound, + z.ZodTypeDef, + CreateTopicRequestDto +> = z.object({ + key: z.string(), + name: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CreateTopicRequestDto$ { + /** @deprecated use `CreateTopicRequestDto$inboundSchema` instead. */ + export const inboundSchema = CreateTopicRequestDto$inboundSchema; + /** @deprecated use `CreateTopicRequestDto$outboundSchema` instead. */ + export const outboundSchema = CreateTopicRequestDto$outboundSchema; + /** @deprecated use `CreateTopicRequestDto$Outbound` instead. */ + export type Outbound = CreateTopicRequestDto$Outbound; +} + +export function createTopicRequestDtoToJSON( + createTopicRequestDto: CreateTopicRequestDto, +): string { + return JSON.stringify( + CreateTopicRequestDto$outboundSchema.parse(createTopicRequestDto), + ); +} + +export function createTopicRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateTopicRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateTopicRequestDto' from JSON`, + ); +} diff --git a/src/models/components/createtopicresponsedto.ts b/src/models/components/createtopicresponsedto.ts new file mode 100644 index 00000000..b02673c5 --- /dev/null +++ b/src/models/components/createtopicresponsedto.ts @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type CreateTopicResponseDto = { + /** + * The unique identifier for the Topic created. + */ + id?: string | undefined; + /** + * User defined custom key and provided by the user that will be an unique identifier for the Topic created. + */ + key: string; +}; + +/** @internal */ +export const CreateTopicResponseDto$inboundSchema: z.ZodType< + CreateTopicResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + key: z.string(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + }); +}); + +/** @internal */ +export type CreateTopicResponseDto$Outbound = { + _id?: string | undefined; + key: string; +}; + +/** @internal */ +export const CreateTopicResponseDto$outboundSchema: z.ZodType< + CreateTopicResponseDto$Outbound, + z.ZodTypeDef, + CreateTopicResponseDto +> = z.object({ + id: z.string().optional(), + key: z.string(), +}).transform((v) => { + return remap$(v, { + id: "_id", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CreateTopicResponseDto$ { + /** @deprecated use `CreateTopicResponseDto$inboundSchema` instead. */ + export const inboundSchema = CreateTopicResponseDto$inboundSchema; + /** @deprecated use `CreateTopicResponseDto$outboundSchema` instead. */ + export const outboundSchema = CreateTopicResponseDto$outboundSchema; + /** @deprecated use `CreateTopicResponseDto$Outbound` instead. */ + export type Outbound = CreateTopicResponseDto$Outbound; +} + +export function createTopicResponseDtoToJSON( + createTopicResponseDto: CreateTopicResponseDto, +): string { + return JSON.stringify( + CreateTopicResponseDto$outboundSchema.parse(createTopicResponseDto), + ); +} + +export function createTopicResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateTopicResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateTopicResponseDto' from JSON`, + ); +} diff --git a/src/models/components/credentialsdto.ts b/src/models/components/credentialsdto.ts new file mode 100644 index 00000000..2818b688 --- /dev/null +++ b/src/models/components/credentialsdto.ts @@ -0,0 +1,272 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TlsOptions = {}; + +export type CredentialsDto = { + apiKey?: string | undefined; + user?: string | undefined; + secretKey?: string | undefined; + domain?: string | undefined; + password?: string | undefined; + host?: string | undefined; + port?: string | undefined; + secure?: boolean | undefined; + region?: string | undefined; + accountSid?: string | undefined; + messageProfileId?: string | undefined; + token?: string | undefined; + from?: string | undefined; + senderName?: string | undefined; + projectName?: string | undefined; + applicationId?: string | undefined; + clientId?: string | undefined; + requireTls?: boolean | undefined; + ignoreTls?: boolean | undefined; + tlsOptions?: TlsOptions | undefined; + baseUrl?: string | undefined; + webhookUrl?: string | undefined; + redirectUrl?: string | undefined; + hmac?: boolean | undefined; + serviceAccount?: string | undefined; + ipPoolName?: string | undefined; + apiKeyRequestHeader?: string | undefined; + secretKeyRequestHeader?: string | undefined; + idPath?: string | undefined; + datePath?: string | undefined; + apiToken?: string | undefined; + authenticateByToken?: boolean | undefined; + authenticationTokenKey?: string | undefined; + instanceId?: string | undefined; + alertUid?: string | undefined; + title?: string | undefined; + imageUrl?: string | undefined; + state?: string | undefined; + externalLink?: string | undefined; + channelId?: string | undefined; + phoneNumberIdentification?: string | undefined; + accessKey?: string | undefined; +}; + +/** @internal */ +export const TlsOptions$inboundSchema: z.ZodType< + TlsOptions, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type TlsOptions$Outbound = {}; + +/** @internal */ +export const TlsOptions$outboundSchema: z.ZodType< + TlsOptions$Outbound, + z.ZodTypeDef, + TlsOptions +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TlsOptions$ { + /** @deprecated use `TlsOptions$inboundSchema` instead. */ + export const inboundSchema = TlsOptions$inboundSchema; + /** @deprecated use `TlsOptions$outboundSchema` instead. */ + export const outboundSchema = TlsOptions$outboundSchema; + /** @deprecated use `TlsOptions$Outbound` instead. */ + export type Outbound = TlsOptions$Outbound; +} + +export function tlsOptionsToJSON(tlsOptions: TlsOptions): string { + return JSON.stringify(TlsOptions$outboundSchema.parse(tlsOptions)); +} + +export function tlsOptionsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TlsOptions$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TlsOptions' from JSON`, + ); +} + +/** @internal */ +export const CredentialsDto$inboundSchema: z.ZodType< + CredentialsDto, + z.ZodTypeDef, + unknown +> = z.object({ + apiKey: z.string().optional(), + user: z.string().optional(), + secretKey: z.string().optional(), + domain: z.string().optional(), + password: z.string().optional(), + host: z.string().optional(), + port: z.string().optional(), + secure: z.boolean().optional(), + region: z.string().optional(), + accountSid: z.string().optional(), + messageProfileId: z.string().optional(), + token: z.string().optional(), + from: z.string().optional(), + senderName: z.string().optional(), + projectName: z.string().optional(), + applicationId: z.string().optional(), + clientId: z.string().optional(), + requireTls: z.boolean().optional(), + ignoreTls: z.boolean().optional(), + tlsOptions: z.lazy(() => TlsOptions$inboundSchema).optional(), + baseUrl: z.string().optional(), + webhookUrl: z.string().optional(), + redirectUrl: z.string().optional(), + hmac: z.boolean().optional(), + serviceAccount: z.string().optional(), + ipPoolName: z.string().optional(), + apiKeyRequestHeader: z.string().optional(), + secretKeyRequestHeader: z.string().optional(), + idPath: z.string().optional(), + datePath: z.string().optional(), + apiToken: z.string().optional(), + authenticateByToken: z.boolean().optional(), + authenticationTokenKey: z.string().optional(), + instanceId: z.string().optional(), + alertUid: z.string().optional(), + title: z.string().optional(), + imageUrl: z.string().optional(), + state: z.string().optional(), + externalLink: z.string().optional(), + channelId: z.string().optional(), + phoneNumberIdentification: z.string().optional(), + accessKey: z.string().optional(), +}); + +/** @internal */ +export type CredentialsDto$Outbound = { + apiKey?: string | undefined; + user?: string | undefined; + secretKey?: string | undefined; + domain?: string | undefined; + password?: string | undefined; + host?: string | undefined; + port?: string | undefined; + secure?: boolean | undefined; + region?: string | undefined; + accountSid?: string | undefined; + messageProfileId?: string | undefined; + token?: string | undefined; + from?: string | undefined; + senderName?: string | undefined; + projectName?: string | undefined; + applicationId?: string | undefined; + clientId?: string | undefined; + requireTls?: boolean | undefined; + ignoreTls?: boolean | undefined; + tlsOptions?: TlsOptions$Outbound | undefined; + baseUrl?: string | undefined; + webhookUrl?: string | undefined; + redirectUrl?: string | undefined; + hmac?: boolean | undefined; + serviceAccount?: string | undefined; + ipPoolName?: string | undefined; + apiKeyRequestHeader?: string | undefined; + secretKeyRequestHeader?: string | undefined; + idPath?: string | undefined; + datePath?: string | undefined; + apiToken?: string | undefined; + authenticateByToken?: boolean | undefined; + authenticationTokenKey?: string | undefined; + instanceId?: string | undefined; + alertUid?: string | undefined; + title?: string | undefined; + imageUrl?: string | undefined; + state?: string | undefined; + externalLink?: string | undefined; + channelId?: string | undefined; + phoneNumberIdentification?: string | undefined; + accessKey?: string | undefined; +}; + +/** @internal */ +export const CredentialsDto$outboundSchema: z.ZodType< + CredentialsDto$Outbound, + z.ZodTypeDef, + CredentialsDto +> = z.object({ + apiKey: z.string().optional(), + user: z.string().optional(), + secretKey: z.string().optional(), + domain: z.string().optional(), + password: z.string().optional(), + host: z.string().optional(), + port: z.string().optional(), + secure: z.boolean().optional(), + region: z.string().optional(), + accountSid: z.string().optional(), + messageProfileId: z.string().optional(), + token: z.string().optional(), + from: z.string().optional(), + senderName: z.string().optional(), + projectName: z.string().optional(), + applicationId: z.string().optional(), + clientId: z.string().optional(), + requireTls: z.boolean().optional(), + ignoreTls: z.boolean().optional(), + tlsOptions: z.lazy(() => TlsOptions$outboundSchema).optional(), + baseUrl: z.string().optional(), + webhookUrl: z.string().optional(), + redirectUrl: z.string().optional(), + hmac: z.boolean().optional(), + serviceAccount: z.string().optional(), + ipPoolName: z.string().optional(), + apiKeyRequestHeader: z.string().optional(), + secretKeyRequestHeader: z.string().optional(), + idPath: z.string().optional(), + datePath: z.string().optional(), + apiToken: z.string().optional(), + authenticateByToken: z.boolean().optional(), + authenticationTokenKey: z.string().optional(), + instanceId: z.string().optional(), + alertUid: z.string().optional(), + title: z.string().optional(), + imageUrl: z.string().optional(), + state: z.string().optional(), + externalLink: z.string().optional(), + channelId: z.string().optional(), + phoneNumberIdentification: z.string().optional(), + accessKey: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace CredentialsDto$ { + /** @deprecated use `CredentialsDto$inboundSchema` instead. */ + export const inboundSchema = CredentialsDto$inboundSchema; + /** @deprecated use `CredentialsDto$outboundSchema` instead. */ + export const outboundSchema = CredentialsDto$outboundSchema; + /** @deprecated use `CredentialsDto$Outbound` instead. */ + export type Outbound = CredentialsDto$Outbound; +} + +export function credentialsDtoToJSON(credentialsDto: CredentialsDto): string { + return JSON.stringify(CredentialsDto$outboundSchema.parse(credentialsDto)); +} + +export function credentialsDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CredentialsDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CredentialsDto' from JSON`, + ); +} diff --git a/src/models/components/databooleandto.ts b/src/models/components/databooleandto.ts new file mode 100644 index 00000000..200fb5b0 --- /dev/null +++ b/src/models/components/databooleandto.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type DataBooleanDto = { + data: boolean; +}; + +/** @internal */ +export const DataBooleanDto$inboundSchema: z.ZodType< + DataBooleanDto, + z.ZodTypeDef, + unknown +> = z.object({ + data: z.boolean(), +}); + +/** @internal */ +export type DataBooleanDto$Outbound = { + data: boolean; +}; + +/** @internal */ +export const DataBooleanDto$outboundSchema: z.ZodType< + DataBooleanDto$Outbound, + z.ZodTypeDef, + DataBooleanDto +> = z.object({ + data: z.boolean(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DataBooleanDto$ { + /** @deprecated use `DataBooleanDto$inboundSchema` instead. */ + export const inboundSchema = DataBooleanDto$inboundSchema; + /** @deprecated use `DataBooleanDto$outboundSchema` instead. */ + export const outboundSchema = DataBooleanDto$outboundSchema; + /** @deprecated use `DataBooleanDto$Outbound` instead. */ + export type Outbound = DataBooleanDto$Outbound; +} + +export function dataBooleanDtoToJSON(dataBooleanDto: DataBooleanDto): string { + return JSON.stringify(DataBooleanDto$outboundSchema.parse(dataBooleanDto)); +} + +export function dataBooleanDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DataBooleanDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DataBooleanDto' from JSON`, + ); +} diff --git a/src/models/components/delayregularmetadata.ts b/src/models/components/delayregularmetadata.ts new file mode 100644 index 00000000..7c8631f4 --- /dev/null +++ b/src/models/components/delayregularmetadata.ts @@ -0,0 +1,136 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const DelayRegularMetadataUnit = { + Seconds: "seconds", + Minutes: "minutes", + Hours: "hours", + Days: "days", + Weeks: "weeks", + Months: "months", +} as const; +export type DelayRegularMetadataUnit = ClosedEnum< + typeof DelayRegularMetadataUnit +>; + +export const DelayRegularMetadataType = { + Regular: "regular", +} as const; +export type DelayRegularMetadataType = ClosedEnum< + typeof DelayRegularMetadataType +>; + +export type DelayRegularMetadata = { + amount?: number | undefined; + unit?: DelayRegularMetadataUnit | undefined; + type: DelayRegularMetadataType; +}; + +/** @internal */ +export const DelayRegularMetadataUnit$inboundSchema: z.ZodNativeEnum< + typeof DelayRegularMetadataUnit +> = z.nativeEnum(DelayRegularMetadataUnit); + +/** @internal */ +export const DelayRegularMetadataUnit$outboundSchema: z.ZodNativeEnum< + typeof DelayRegularMetadataUnit +> = DelayRegularMetadataUnit$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DelayRegularMetadataUnit$ { + /** @deprecated use `DelayRegularMetadataUnit$inboundSchema` instead. */ + export const inboundSchema = DelayRegularMetadataUnit$inboundSchema; + /** @deprecated use `DelayRegularMetadataUnit$outboundSchema` instead. */ + export const outboundSchema = DelayRegularMetadataUnit$outboundSchema; +} + +/** @internal */ +export const DelayRegularMetadataType$inboundSchema: z.ZodNativeEnum< + typeof DelayRegularMetadataType +> = z.nativeEnum(DelayRegularMetadataType); + +/** @internal */ +export const DelayRegularMetadataType$outboundSchema: z.ZodNativeEnum< + typeof DelayRegularMetadataType +> = DelayRegularMetadataType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DelayRegularMetadataType$ { + /** @deprecated use `DelayRegularMetadataType$inboundSchema` instead. */ + export const inboundSchema = DelayRegularMetadataType$inboundSchema; + /** @deprecated use `DelayRegularMetadataType$outboundSchema` instead. */ + export const outboundSchema = DelayRegularMetadataType$outboundSchema; +} + +/** @internal */ +export const DelayRegularMetadata$inboundSchema: z.ZodType< + DelayRegularMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.number().optional(), + unit: DelayRegularMetadataUnit$inboundSchema.optional(), + type: DelayRegularMetadataType$inboundSchema, +}); + +/** @internal */ +export type DelayRegularMetadata$Outbound = { + amount?: number | undefined; + unit?: string | undefined; + type: string; +}; + +/** @internal */ +export const DelayRegularMetadata$outboundSchema: z.ZodType< + DelayRegularMetadata$Outbound, + z.ZodTypeDef, + DelayRegularMetadata +> = z.object({ + amount: z.number().optional(), + unit: DelayRegularMetadataUnit$outboundSchema.optional(), + type: DelayRegularMetadataType$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DelayRegularMetadata$ { + /** @deprecated use `DelayRegularMetadata$inboundSchema` instead. */ + export const inboundSchema = DelayRegularMetadata$inboundSchema; + /** @deprecated use `DelayRegularMetadata$outboundSchema` instead. */ + export const outboundSchema = DelayRegularMetadata$outboundSchema; + /** @deprecated use `DelayRegularMetadata$Outbound` instead. */ + export type Outbound = DelayRegularMetadata$Outbound; +} + +export function delayRegularMetadataToJSON( + delayRegularMetadata: DelayRegularMetadata, +): string { + return JSON.stringify( + DelayRegularMetadata$outboundSchema.parse(delayRegularMetadata), + ); +} + +export function delayRegularMetadataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DelayRegularMetadata$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DelayRegularMetadata' from JSON`, + ); +} diff --git a/src/models/components/delayscheduledmetadata.ts b/src/models/components/delayscheduledmetadata.ts new file mode 100644 index 00000000..cd26f256 --- /dev/null +++ b/src/models/components/delayscheduledmetadata.ts @@ -0,0 +1,99 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const DelayScheduledMetadataType = { + Scheduled: "scheduled", +} as const; +export type DelayScheduledMetadataType = ClosedEnum< + typeof DelayScheduledMetadataType +>; + +export type DelayScheduledMetadata = { + type: DelayScheduledMetadataType; + delayPath: string; +}; + +/** @internal */ +export const DelayScheduledMetadataType$inboundSchema: z.ZodNativeEnum< + typeof DelayScheduledMetadataType +> = z.nativeEnum(DelayScheduledMetadataType); + +/** @internal */ +export const DelayScheduledMetadataType$outboundSchema: z.ZodNativeEnum< + typeof DelayScheduledMetadataType +> = DelayScheduledMetadataType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DelayScheduledMetadataType$ { + /** @deprecated use `DelayScheduledMetadataType$inboundSchema` instead. */ + export const inboundSchema = DelayScheduledMetadataType$inboundSchema; + /** @deprecated use `DelayScheduledMetadataType$outboundSchema` instead. */ + export const outboundSchema = DelayScheduledMetadataType$outboundSchema; +} + +/** @internal */ +export const DelayScheduledMetadata$inboundSchema: z.ZodType< + DelayScheduledMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + type: DelayScheduledMetadataType$inboundSchema, + delayPath: z.string(), +}); + +/** @internal */ +export type DelayScheduledMetadata$Outbound = { + type: string; + delayPath: string; +}; + +/** @internal */ +export const DelayScheduledMetadata$outboundSchema: z.ZodType< + DelayScheduledMetadata$Outbound, + z.ZodTypeDef, + DelayScheduledMetadata +> = z.object({ + type: DelayScheduledMetadataType$outboundSchema, + delayPath: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DelayScheduledMetadata$ { + /** @deprecated use `DelayScheduledMetadata$inboundSchema` instead. */ + export const inboundSchema = DelayScheduledMetadata$inboundSchema; + /** @deprecated use `DelayScheduledMetadata$outboundSchema` instead. */ + export const outboundSchema = DelayScheduledMetadata$outboundSchema; + /** @deprecated use `DelayScheduledMetadata$Outbound` instead. */ + export type Outbound = DelayScheduledMetadata$Outbound; +} + +export function delayScheduledMetadataToJSON( + delayScheduledMetadata: DelayScheduledMetadata, +): string { + return JSON.stringify( + DelayScheduledMetadata$outboundSchema.parse(delayScheduledMetadata), + ); +} + +export function delayScheduledMetadataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DelayScheduledMetadata$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DelayScheduledMetadata' from JSON`, + ); +} diff --git a/src/models/components/deletemessageresponsedto.ts b/src/models/components/deletemessageresponsedto.ts new file mode 100644 index 00000000..50e20aed --- /dev/null +++ b/src/models/components/deletemessageresponsedto.ts @@ -0,0 +1,111 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * The status enum for the performed action + */ +export const DeleteMessageResponseDtoStatus = { + Deleted: "deleted", +} as const; +/** + * The status enum for the performed action + */ +export type DeleteMessageResponseDtoStatus = ClosedEnum< + typeof DeleteMessageResponseDtoStatus +>; + +export type DeleteMessageResponseDto = { + /** + * A boolean stating the success of the action + */ + acknowledged: boolean; + /** + * The status enum for the performed action + */ + status: DeleteMessageResponseDtoStatus; +}; + +/** @internal */ +export const DeleteMessageResponseDtoStatus$inboundSchema: z.ZodNativeEnum< + typeof DeleteMessageResponseDtoStatus +> = z.nativeEnum(DeleteMessageResponseDtoStatus); + +/** @internal */ +export const DeleteMessageResponseDtoStatus$outboundSchema: z.ZodNativeEnum< + typeof DeleteMessageResponseDtoStatus +> = DeleteMessageResponseDtoStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DeleteMessageResponseDtoStatus$ { + /** @deprecated use `DeleteMessageResponseDtoStatus$inboundSchema` instead. */ + export const inboundSchema = DeleteMessageResponseDtoStatus$inboundSchema; + /** @deprecated use `DeleteMessageResponseDtoStatus$outboundSchema` instead. */ + export const outboundSchema = DeleteMessageResponseDtoStatus$outboundSchema; +} + +/** @internal */ +export const DeleteMessageResponseDto$inboundSchema: z.ZodType< + DeleteMessageResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + acknowledged: z.boolean(), + status: DeleteMessageResponseDtoStatus$inboundSchema, +}); + +/** @internal */ +export type DeleteMessageResponseDto$Outbound = { + acknowledged: boolean; + status: string; +}; + +/** @internal */ +export const DeleteMessageResponseDto$outboundSchema: z.ZodType< + DeleteMessageResponseDto$Outbound, + z.ZodTypeDef, + DeleteMessageResponseDto +> = z.object({ + acknowledged: z.boolean(), + status: DeleteMessageResponseDtoStatus$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DeleteMessageResponseDto$ { + /** @deprecated use `DeleteMessageResponseDto$inboundSchema` instead. */ + export const inboundSchema = DeleteMessageResponseDto$inboundSchema; + /** @deprecated use `DeleteMessageResponseDto$outboundSchema` instead. */ + export const outboundSchema = DeleteMessageResponseDto$outboundSchema; + /** @deprecated use `DeleteMessageResponseDto$Outbound` instead. */ + export type Outbound = DeleteMessageResponseDto$Outbound; +} + +export function deleteMessageResponseDtoToJSON( + deleteMessageResponseDto: DeleteMessageResponseDto, +): string { + return JSON.stringify( + DeleteMessageResponseDto$outboundSchema.parse(deleteMessageResponseDto), + ); +} + +export function deleteMessageResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteMessageResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteMessageResponseDto' from JSON`, + ); +} diff --git a/src/models/components/deletenotificationgroupresponsedto.ts b/src/models/components/deletenotificationgroupresponsedto.ts new file mode 100644 index 00000000..b75b5c46 --- /dev/null +++ b/src/models/components/deletenotificationgroupresponsedto.ts @@ -0,0 +1,117 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * The status enum for the performed action + */ +export const DeleteNotificationGroupResponseDtoStatus = { + Deleted: "deleted", +} as const; +/** + * The status enum for the performed action + */ +export type DeleteNotificationGroupResponseDtoStatus = ClosedEnum< + typeof DeleteNotificationGroupResponseDtoStatus +>; + +export type DeleteNotificationGroupResponseDto = { + /** + * A boolean stating the success of the action + */ + acknowledged: boolean; + /** + * The status enum for the performed action + */ + status: DeleteNotificationGroupResponseDtoStatus; +}; + +/** @internal */ +export const DeleteNotificationGroupResponseDtoStatus$inboundSchema: + z.ZodNativeEnum = z + .nativeEnum(DeleteNotificationGroupResponseDtoStatus); + +/** @internal */ +export const DeleteNotificationGroupResponseDtoStatus$outboundSchema: + z.ZodNativeEnum = + DeleteNotificationGroupResponseDtoStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DeleteNotificationGroupResponseDtoStatus$ { + /** @deprecated use `DeleteNotificationGroupResponseDtoStatus$inboundSchema` instead. */ + export const inboundSchema = + DeleteNotificationGroupResponseDtoStatus$inboundSchema; + /** @deprecated use `DeleteNotificationGroupResponseDtoStatus$outboundSchema` instead. */ + export const outboundSchema = + DeleteNotificationGroupResponseDtoStatus$outboundSchema; +} + +/** @internal */ +export const DeleteNotificationGroupResponseDto$inboundSchema: z.ZodType< + DeleteNotificationGroupResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + acknowledged: z.boolean(), + status: DeleteNotificationGroupResponseDtoStatus$inboundSchema, +}); + +/** @internal */ +export type DeleteNotificationGroupResponseDto$Outbound = { + acknowledged: boolean; + status: string; +}; + +/** @internal */ +export const DeleteNotificationGroupResponseDto$outboundSchema: z.ZodType< + DeleteNotificationGroupResponseDto$Outbound, + z.ZodTypeDef, + DeleteNotificationGroupResponseDto +> = z.object({ + acknowledged: z.boolean(), + status: DeleteNotificationGroupResponseDtoStatus$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DeleteNotificationGroupResponseDto$ { + /** @deprecated use `DeleteNotificationGroupResponseDto$inboundSchema` instead. */ + export const inboundSchema = DeleteNotificationGroupResponseDto$inboundSchema; + /** @deprecated use `DeleteNotificationGroupResponseDto$outboundSchema` instead. */ + export const outboundSchema = + DeleteNotificationGroupResponseDto$outboundSchema; + /** @deprecated use `DeleteNotificationGroupResponseDto$Outbound` instead. */ + export type Outbound = DeleteNotificationGroupResponseDto$Outbound; +} + +export function deleteNotificationGroupResponseDtoToJSON( + deleteNotificationGroupResponseDto: DeleteNotificationGroupResponseDto, +): string { + return JSON.stringify( + DeleteNotificationGroupResponseDto$outboundSchema.parse( + deleteNotificationGroupResponseDto, + ), + ); +} + +export function deleteNotificationGroupResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + DeleteNotificationGroupResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteNotificationGroupResponseDto' from JSON`, + ); +} diff --git a/src/models/components/deletesubscriberresponsedto.ts b/src/models/components/deletesubscriberresponsedto.ts new file mode 100644 index 00000000..c23af1a8 --- /dev/null +++ b/src/models/components/deletesubscriberresponsedto.ts @@ -0,0 +1,114 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * The status enum for the performed action + */ +export const DeleteSubscriberResponseDtoStatus = { + Deleted: "deleted", +} as const; +/** + * The status enum for the performed action + */ +export type DeleteSubscriberResponseDtoStatus = ClosedEnum< + typeof DeleteSubscriberResponseDtoStatus +>; + +export type DeleteSubscriberResponseDto = { + /** + * A boolean stating the success of the action + */ + acknowledged: boolean; + /** + * The status enum for the performed action + */ + status: DeleteSubscriberResponseDtoStatus; +}; + +/** @internal */ +export const DeleteSubscriberResponseDtoStatus$inboundSchema: z.ZodNativeEnum< + typeof DeleteSubscriberResponseDtoStatus +> = z.nativeEnum(DeleteSubscriberResponseDtoStatus); + +/** @internal */ +export const DeleteSubscriberResponseDtoStatus$outboundSchema: z.ZodNativeEnum< + typeof DeleteSubscriberResponseDtoStatus +> = DeleteSubscriberResponseDtoStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DeleteSubscriberResponseDtoStatus$ { + /** @deprecated use `DeleteSubscriberResponseDtoStatus$inboundSchema` instead. */ + export const inboundSchema = DeleteSubscriberResponseDtoStatus$inboundSchema; + /** @deprecated use `DeleteSubscriberResponseDtoStatus$outboundSchema` instead. */ + export const outboundSchema = + DeleteSubscriberResponseDtoStatus$outboundSchema; +} + +/** @internal */ +export const DeleteSubscriberResponseDto$inboundSchema: z.ZodType< + DeleteSubscriberResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + acknowledged: z.boolean(), + status: DeleteSubscriberResponseDtoStatus$inboundSchema, +}); + +/** @internal */ +export type DeleteSubscriberResponseDto$Outbound = { + acknowledged: boolean; + status: string; +}; + +/** @internal */ +export const DeleteSubscriberResponseDto$outboundSchema: z.ZodType< + DeleteSubscriberResponseDto$Outbound, + z.ZodTypeDef, + DeleteSubscriberResponseDto +> = z.object({ + acknowledged: z.boolean(), + status: DeleteSubscriberResponseDtoStatus$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DeleteSubscriberResponseDto$ { + /** @deprecated use `DeleteSubscriberResponseDto$inboundSchema` instead. */ + export const inboundSchema = DeleteSubscriberResponseDto$inboundSchema; + /** @deprecated use `DeleteSubscriberResponseDto$outboundSchema` instead. */ + export const outboundSchema = DeleteSubscriberResponseDto$outboundSchema; + /** @deprecated use `DeleteSubscriberResponseDto$Outbound` instead. */ + export type Outbound = DeleteSubscriberResponseDto$Outbound; +} + +export function deleteSubscriberResponseDtoToJSON( + deleteSubscriberResponseDto: DeleteSubscriberResponseDto, +): string { + return JSON.stringify( + DeleteSubscriberResponseDto$outboundSchema.parse( + deleteSubscriberResponseDto, + ), + ); +} + +export function deleteSubscriberResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteSubscriberResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteSubscriberResponseDto' from JSON`, + ); +} diff --git a/src/models/components/digestregularmetadata.ts b/src/models/components/digestregularmetadata.ts new file mode 100644 index 00000000..f59bcbc9 --- /dev/null +++ b/src/models/components/digestregularmetadata.ts @@ -0,0 +1,183 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const Unit = { + Seconds: "seconds", + Minutes: "minutes", + Hours: "hours", + Days: "days", + Weeks: "weeks", + Months: "months", +} as const; +export type Unit = ClosedEnum; + +export const DigestRegularMetadataType = { + Regular: "regular", + Backoff: "backoff", +} as const; +export type DigestRegularMetadataType = ClosedEnum< + typeof DigestRegularMetadataType +>; + +export const BackoffUnit = { + Seconds: "seconds", + Minutes: "minutes", + Hours: "hours", + Days: "days", + Weeks: "weeks", + Months: "months", +} as const; +export type BackoffUnit = ClosedEnum; + +export type DigestRegularMetadata = { + amount?: number | undefined; + unit?: Unit | undefined; + digestKey?: string | undefined; + type: DigestRegularMetadataType; + backoff?: boolean | undefined; + backoffAmount?: number | undefined; + backoffUnit?: BackoffUnit | undefined; + updateMode?: boolean | undefined; +}; + +/** @internal */ +export const Unit$inboundSchema: z.ZodNativeEnum = z.nativeEnum( + Unit, +); + +/** @internal */ +export const Unit$outboundSchema: z.ZodNativeEnum = + Unit$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Unit$ { + /** @deprecated use `Unit$inboundSchema` instead. */ + export const inboundSchema = Unit$inboundSchema; + /** @deprecated use `Unit$outboundSchema` instead. */ + export const outboundSchema = Unit$outboundSchema; +} + +/** @internal */ +export const DigestRegularMetadataType$inboundSchema: z.ZodNativeEnum< + typeof DigestRegularMetadataType +> = z.nativeEnum(DigestRegularMetadataType); + +/** @internal */ +export const DigestRegularMetadataType$outboundSchema: z.ZodNativeEnum< + typeof DigestRegularMetadataType +> = DigestRegularMetadataType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DigestRegularMetadataType$ { + /** @deprecated use `DigestRegularMetadataType$inboundSchema` instead. */ + export const inboundSchema = DigestRegularMetadataType$inboundSchema; + /** @deprecated use `DigestRegularMetadataType$outboundSchema` instead. */ + export const outboundSchema = DigestRegularMetadataType$outboundSchema; +} + +/** @internal */ +export const BackoffUnit$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(BackoffUnit); + +/** @internal */ +export const BackoffUnit$outboundSchema: z.ZodNativeEnum = + BackoffUnit$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace BackoffUnit$ { + /** @deprecated use `BackoffUnit$inboundSchema` instead. */ + export const inboundSchema = BackoffUnit$inboundSchema; + /** @deprecated use `BackoffUnit$outboundSchema` instead. */ + export const outboundSchema = BackoffUnit$outboundSchema; +} + +/** @internal */ +export const DigestRegularMetadata$inboundSchema: z.ZodType< + DigestRegularMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.number().optional(), + unit: Unit$inboundSchema.optional(), + digestKey: z.string().optional(), + type: DigestRegularMetadataType$inboundSchema, + backoff: z.boolean().optional(), + backoffAmount: z.number().optional(), + backoffUnit: BackoffUnit$inboundSchema.optional(), + updateMode: z.boolean().optional(), +}); + +/** @internal */ +export type DigestRegularMetadata$Outbound = { + amount?: number | undefined; + unit?: string | undefined; + digestKey?: string | undefined; + type: string; + backoff?: boolean | undefined; + backoffAmount?: number | undefined; + backoffUnit?: string | undefined; + updateMode?: boolean | undefined; +}; + +/** @internal */ +export const DigestRegularMetadata$outboundSchema: z.ZodType< + DigestRegularMetadata$Outbound, + z.ZodTypeDef, + DigestRegularMetadata +> = z.object({ + amount: z.number().optional(), + unit: Unit$outboundSchema.optional(), + digestKey: z.string().optional(), + type: DigestRegularMetadataType$outboundSchema, + backoff: z.boolean().optional(), + backoffAmount: z.number().optional(), + backoffUnit: BackoffUnit$outboundSchema.optional(), + updateMode: z.boolean().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DigestRegularMetadata$ { + /** @deprecated use `DigestRegularMetadata$inboundSchema` instead. */ + export const inboundSchema = DigestRegularMetadata$inboundSchema; + /** @deprecated use `DigestRegularMetadata$outboundSchema` instead. */ + export const outboundSchema = DigestRegularMetadata$outboundSchema; + /** @deprecated use `DigestRegularMetadata$Outbound` instead. */ + export type Outbound = DigestRegularMetadata$Outbound; +} + +export function digestRegularMetadataToJSON( + digestRegularMetadata: DigestRegularMetadata, +): string { + return JSON.stringify( + DigestRegularMetadata$outboundSchema.parse(digestRegularMetadata), + ); +} + +export function digestRegularMetadataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DigestRegularMetadata$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DigestRegularMetadata' from JSON`, + ); +} diff --git a/src/models/components/digesttimedmetadata.ts b/src/models/components/digesttimedmetadata.ts new file mode 100644 index 00000000..05b25a8c --- /dev/null +++ b/src/models/components/digesttimedmetadata.ts @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + TimedConfig, + TimedConfig$inboundSchema, + TimedConfig$Outbound, + TimedConfig$outboundSchema, +} from "./timedconfig.js"; + +export const DigestTimedMetadataUnit = { + Seconds: "seconds", + Minutes: "minutes", + Hours: "hours", + Days: "days", + Weeks: "weeks", + Months: "months", +} as const; +export type DigestTimedMetadataUnit = ClosedEnum< + typeof DigestTimedMetadataUnit +>; + +export const DigestTimedMetadataType = { + Timed: "timed", +} as const; +export type DigestTimedMetadataType = ClosedEnum< + typeof DigestTimedMetadataType +>; + +export type DigestTimedMetadata = { + amount?: number | undefined; + unit?: DigestTimedMetadataUnit | undefined; + digestKey?: string | undefined; + type: DigestTimedMetadataType; + timed?: TimedConfig | undefined; +}; + +/** @internal */ +export const DigestTimedMetadataUnit$inboundSchema: z.ZodNativeEnum< + typeof DigestTimedMetadataUnit +> = z.nativeEnum(DigestTimedMetadataUnit); + +/** @internal */ +export const DigestTimedMetadataUnit$outboundSchema: z.ZodNativeEnum< + typeof DigestTimedMetadataUnit +> = DigestTimedMetadataUnit$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DigestTimedMetadataUnit$ { + /** @deprecated use `DigestTimedMetadataUnit$inboundSchema` instead. */ + export const inboundSchema = DigestTimedMetadataUnit$inboundSchema; + /** @deprecated use `DigestTimedMetadataUnit$outboundSchema` instead. */ + export const outboundSchema = DigestTimedMetadataUnit$outboundSchema; +} + +/** @internal */ +export const DigestTimedMetadataType$inboundSchema: z.ZodNativeEnum< + typeof DigestTimedMetadataType +> = z.nativeEnum(DigestTimedMetadataType); + +/** @internal */ +export const DigestTimedMetadataType$outboundSchema: z.ZodNativeEnum< + typeof DigestTimedMetadataType +> = DigestTimedMetadataType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DigestTimedMetadataType$ { + /** @deprecated use `DigestTimedMetadataType$inboundSchema` instead. */ + export const inboundSchema = DigestTimedMetadataType$inboundSchema; + /** @deprecated use `DigestTimedMetadataType$outboundSchema` instead. */ + export const outboundSchema = DigestTimedMetadataType$outboundSchema; +} + +/** @internal */ +export const DigestTimedMetadata$inboundSchema: z.ZodType< + DigestTimedMetadata, + z.ZodTypeDef, + unknown +> = z.object({ + amount: z.number().optional(), + unit: DigestTimedMetadataUnit$inboundSchema.optional(), + digestKey: z.string().optional(), + type: DigestTimedMetadataType$inboundSchema, + timed: TimedConfig$inboundSchema.optional(), +}); + +/** @internal */ +export type DigestTimedMetadata$Outbound = { + amount?: number | undefined; + unit?: string | undefined; + digestKey?: string | undefined; + type: string; + timed?: TimedConfig$Outbound | undefined; +}; + +/** @internal */ +export const DigestTimedMetadata$outboundSchema: z.ZodType< + DigestTimedMetadata$Outbound, + z.ZodTypeDef, + DigestTimedMetadata +> = z.object({ + amount: z.number().optional(), + unit: DigestTimedMetadataUnit$outboundSchema.optional(), + digestKey: z.string().optional(), + type: DigestTimedMetadataType$outboundSchema, + timed: TimedConfig$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace DigestTimedMetadata$ { + /** @deprecated use `DigestTimedMetadata$inboundSchema` instead. */ + export const inboundSchema = DigestTimedMetadata$inboundSchema; + /** @deprecated use `DigestTimedMetadata$outboundSchema` instead. */ + export const outboundSchema = DigestTimedMetadata$outboundSchema; + /** @deprecated use `DigestTimedMetadata$Outbound` instead. */ + export type Outbound = DigestTimedMetadata$Outbound; +} + +export function digestTimedMetadataToJSON( + digestTimedMetadata: DigestTimedMetadata, +): string { + return JSON.stringify( + DigestTimedMetadata$outboundSchema.parse(digestTimedMetadata), + ); +} + +export function digestTimedMetadataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DigestTimedMetadata$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DigestTimedMetadata' from JSON`, + ); +} diff --git a/src/models/components/emailblock.ts b/src/models/components/emailblock.ts new file mode 100644 index 00000000..1f59f8be --- /dev/null +++ b/src/models/components/emailblock.ts @@ -0,0 +1,108 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + EmailBlockStyles, + EmailBlockStyles$inboundSchema, + EmailBlockStyles$Outbound, + EmailBlockStyles$outboundSchema, +} from "./emailblockstyles.js"; + +export const EmailBlockType = { + Button: "button", + Text: "text", +} as const; +export type EmailBlockType = ClosedEnum; + +export type EmailBlock = { + type: EmailBlockType; + content: string; + url?: string | undefined; + styles?: EmailBlockStyles | undefined; +}; + +/** @internal */ +export const EmailBlockType$inboundSchema: z.ZodNativeEnum< + typeof EmailBlockType +> = z.nativeEnum(EmailBlockType); + +/** @internal */ +export const EmailBlockType$outboundSchema: z.ZodNativeEnum< + typeof EmailBlockType +> = EmailBlockType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EmailBlockType$ { + /** @deprecated use `EmailBlockType$inboundSchema` instead. */ + export const inboundSchema = EmailBlockType$inboundSchema; + /** @deprecated use `EmailBlockType$outboundSchema` instead. */ + export const outboundSchema = EmailBlockType$outboundSchema; +} + +/** @internal */ +export const EmailBlock$inboundSchema: z.ZodType< + EmailBlock, + z.ZodTypeDef, + unknown +> = z.object({ + type: EmailBlockType$inboundSchema, + content: z.string(), + url: z.string().optional(), + styles: EmailBlockStyles$inboundSchema.optional(), +}); + +/** @internal */ +export type EmailBlock$Outbound = { + type: string; + content: string; + url?: string | undefined; + styles?: EmailBlockStyles$Outbound | undefined; +}; + +/** @internal */ +export const EmailBlock$outboundSchema: z.ZodType< + EmailBlock$Outbound, + z.ZodTypeDef, + EmailBlock +> = z.object({ + type: EmailBlockType$outboundSchema, + content: z.string(), + url: z.string().optional(), + styles: EmailBlockStyles$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EmailBlock$ { + /** @deprecated use `EmailBlock$inboundSchema` instead. */ + export const inboundSchema = EmailBlock$inboundSchema; + /** @deprecated use `EmailBlock$outboundSchema` instead. */ + export const outboundSchema = EmailBlock$outboundSchema; + /** @deprecated use `EmailBlock$Outbound` instead. */ + export type Outbound = EmailBlock$Outbound; +} + +export function emailBlockToJSON(emailBlock: EmailBlock): string { + return JSON.stringify(EmailBlock$outboundSchema.parse(emailBlock)); +} + +export function emailBlockFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EmailBlock$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EmailBlock' from JSON`, + ); +} diff --git a/src/models/components/emailblockstyles.ts b/src/models/components/emailblockstyles.ts new file mode 100644 index 00000000..7771a9ba --- /dev/null +++ b/src/models/components/emailblockstyles.ts @@ -0,0 +1,93 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const TextAlign = { + Center: "center", + Left: "left", + Right: "right", +} as const; +export type TextAlign = ClosedEnum; + +export type EmailBlockStyles = { + textAlign: TextAlign; +}; + +/** @internal */ +export const TextAlign$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(TextAlign); + +/** @internal */ +export const TextAlign$outboundSchema: z.ZodNativeEnum = + TextAlign$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TextAlign$ { + /** @deprecated use `TextAlign$inboundSchema` instead. */ + export const inboundSchema = TextAlign$inboundSchema; + /** @deprecated use `TextAlign$outboundSchema` instead. */ + export const outboundSchema = TextAlign$outboundSchema; +} + +/** @internal */ +export const EmailBlockStyles$inboundSchema: z.ZodType< + EmailBlockStyles, + z.ZodTypeDef, + unknown +> = z.object({ + textAlign: TextAlign$inboundSchema, +}); + +/** @internal */ +export type EmailBlockStyles$Outbound = { + textAlign: string; +}; + +/** @internal */ +export const EmailBlockStyles$outboundSchema: z.ZodType< + EmailBlockStyles$Outbound, + z.ZodTypeDef, + EmailBlockStyles +> = z.object({ + textAlign: TextAlign$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EmailBlockStyles$ { + /** @deprecated use `EmailBlockStyles$inboundSchema` instead. */ + export const inboundSchema = EmailBlockStyles$inboundSchema; + /** @deprecated use `EmailBlockStyles$outboundSchema` instead. */ + export const outboundSchema = EmailBlockStyles$outboundSchema; + /** @deprecated use `EmailBlockStyles$Outbound` instead. */ + export type Outbound = EmailBlockStyles$Outbound; +} + +export function emailBlockStylesToJSON( + emailBlockStyles: EmailBlockStyles, +): string { + return JSON.stringify( + EmailBlockStyles$outboundSchema.parse(emailBlockStyles), + ); +} + +export function emailBlockStylesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EmailBlockStyles$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EmailBlockStyles' from JSON`, + ); +} diff --git a/src/models/components/environmentresponsedto.ts b/src/models/components/environmentresponsedto.ts new file mode 100644 index 00000000..34a022ea --- /dev/null +++ b/src/models/components/environmentresponsedto.ts @@ -0,0 +1,103 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EnvironmentResponseDto = { + id?: string | undefined; + name: string; + organizationId: string; + identifier: string; + apiKeys?: Array | undefined; + parentId: string; + slug?: string | undefined; +}; + +/** @internal */ +export const EnvironmentResponseDto$inboundSchema: z.ZodType< + EnvironmentResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + name: z.string(), + _organizationId: z.string(), + identifier: z.string(), + apiKeys: z.array(z.string()).optional(), + _parentId: z.string(), + slug: z.string().optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_organizationId": "organizationId", + "_parentId": "parentId", + }); +}); + +/** @internal */ +export type EnvironmentResponseDto$Outbound = { + _id?: string | undefined; + name: string; + _organizationId: string; + identifier: string; + apiKeys?: Array | undefined; + _parentId: string; + slug?: string | undefined; +}; + +/** @internal */ +export const EnvironmentResponseDto$outboundSchema: z.ZodType< + EnvironmentResponseDto$Outbound, + z.ZodTypeDef, + EnvironmentResponseDto +> = z.object({ + id: z.string().optional(), + name: z.string(), + organizationId: z.string(), + identifier: z.string(), + apiKeys: z.array(z.string()).optional(), + parentId: z.string(), + slug: z.string().optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + organizationId: "_organizationId", + parentId: "_parentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EnvironmentResponseDto$ { + /** @deprecated use `EnvironmentResponseDto$inboundSchema` instead. */ + export const inboundSchema = EnvironmentResponseDto$inboundSchema; + /** @deprecated use `EnvironmentResponseDto$outboundSchema` instead. */ + export const outboundSchema = EnvironmentResponseDto$outboundSchema; + /** @deprecated use `EnvironmentResponseDto$Outbound` instead. */ + export type Outbound = EnvironmentResponseDto$Outbound; +} + +export function environmentResponseDtoToJSON( + environmentResponseDto: EnvironmentResponseDto, +): string { + return JSON.stringify( + EnvironmentResponseDto$outboundSchema.parse(environmentResponseDto), + ); +} + +export function environmentResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EnvironmentResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EnvironmentResponseDto' from JSON`, + ); +} diff --git a/src/models/components/executiondetailsresponsedto.ts b/src/models/components/executiondetailsresponsedto.ts new file mode 100644 index 00000000..4f9059c9 --- /dev/null +++ b/src/models/components/executiondetailsresponsedto.ts @@ -0,0 +1,244 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const Channel = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", + Digest: "digest", + Trigger: "trigger", + Delay: "delay", + Custom: "custom", +} as const; +export type Channel = ClosedEnum; + +export const Source = { + Credentials: "Credentials", + Internal: "Internal", + Payload: "Payload", + Webhook: "Webhook", +} as const; +export type Source = ClosedEnum; + +export const Status = { + Success: "Success", + Warning: "Warning", + Failed: "Failed", + Pending: "Pending", + Queued: "Queued", + ReadConfirmation: "ReadConfirmation", +} as const; +export type Status = ClosedEnum; + +export type ExecutionDetailsResponseDto = { + id?: string | undefined; + organizationId: string; + jobId: string; + environmentId: string; + notificationId: string; + notificationTemplateId: string; + subscriberId: string; + messageId?: string | undefined; + providerId?: string | undefined; + transactionId: string; + channel: Channel; + detail: string; + source: Source; + status: Status; + isTest: boolean; + isRetry: boolean; + createdAt?: string | undefined; +}; + +/** @internal */ +export const Channel$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Channel); + +/** @internal */ +export const Channel$outboundSchema: z.ZodNativeEnum = + Channel$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Channel$ { + /** @deprecated use `Channel$inboundSchema` instead. */ + export const inboundSchema = Channel$inboundSchema; + /** @deprecated use `Channel$outboundSchema` instead. */ + export const outboundSchema = Channel$outboundSchema; +} + +/** @internal */ +export const Source$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Source); + +/** @internal */ +export const Source$outboundSchema: z.ZodNativeEnum = + Source$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Source$ { + /** @deprecated use `Source$inboundSchema` instead. */ + export const inboundSchema = Source$inboundSchema; + /** @deprecated use `Source$outboundSchema` instead. */ + export const outboundSchema = Source$outboundSchema; +} + +/** @internal */ +export const Status$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Status); + +/** @internal */ +export const Status$outboundSchema: z.ZodNativeEnum = + Status$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Status$ { + /** @deprecated use `Status$inboundSchema` instead. */ + export const inboundSchema = Status$inboundSchema; + /** @deprecated use `Status$outboundSchema` instead. */ + export const outboundSchema = Status$outboundSchema; +} + +/** @internal */ +export const ExecutionDetailsResponseDto$inboundSchema: z.ZodType< + ExecutionDetailsResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + _organizationId: z.string(), + _jobId: z.string(), + _environmentId: z.string(), + _notificationId: z.string(), + _notificationTemplateId: z.string(), + _subscriberId: z.string(), + _messageId: z.string().optional(), + providerId: z.string().optional(), + transactionId: z.string(), + channel: Channel$inboundSchema, + detail: z.string(), + source: Source$inboundSchema, + status: Status$inboundSchema, + isTest: z.boolean(), + isRetry: z.boolean(), + createdAt: z.string().optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_organizationId": "organizationId", + "_jobId": "jobId", + "_environmentId": "environmentId", + "_notificationId": "notificationId", + "_notificationTemplateId": "notificationTemplateId", + "_subscriberId": "subscriberId", + "_messageId": "messageId", + }); +}); + +/** @internal */ +export type ExecutionDetailsResponseDto$Outbound = { + _id?: string | undefined; + _organizationId: string; + _jobId: string; + _environmentId: string; + _notificationId: string; + _notificationTemplateId: string; + _subscriberId: string; + _messageId?: string | undefined; + providerId?: string | undefined; + transactionId: string; + channel: string; + detail: string; + source: string; + status: string; + isTest: boolean; + isRetry: boolean; + createdAt?: string | undefined; +}; + +/** @internal */ +export const ExecutionDetailsResponseDto$outboundSchema: z.ZodType< + ExecutionDetailsResponseDto$Outbound, + z.ZodTypeDef, + ExecutionDetailsResponseDto +> = z.object({ + id: z.string().optional(), + organizationId: z.string(), + jobId: z.string(), + environmentId: z.string(), + notificationId: z.string(), + notificationTemplateId: z.string(), + subscriberId: z.string(), + messageId: z.string().optional(), + providerId: z.string().optional(), + transactionId: z.string(), + channel: Channel$outboundSchema, + detail: z.string(), + source: Source$outboundSchema, + status: Status$outboundSchema, + isTest: z.boolean(), + isRetry: z.boolean(), + createdAt: z.string().optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + organizationId: "_organizationId", + jobId: "_jobId", + environmentId: "_environmentId", + notificationId: "_notificationId", + notificationTemplateId: "_notificationTemplateId", + subscriberId: "_subscriberId", + messageId: "_messageId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ExecutionDetailsResponseDto$ { + /** @deprecated use `ExecutionDetailsResponseDto$inboundSchema` instead. */ + export const inboundSchema = ExecutionDetailsResponseDto$inboundSchema; + /** @deprecated use `ExecutionDetailsResponseDto$outboundSchema` instead. */ + export const outboundSchema = ExecutionDetailsResponseDto$outboundSchema; + /** @deprecated use `ExecutionDetailsResponseDto$Outbound` instead. */ + export type Outbound = ExecutionDetailsResponseDto$Outbound; +} + +export function executionDetailsResponseDtoToJSON( + executionDetailsResponseDto: ExecutionDetailsResponseDto, +): string { + return JSON.stringify( + ExecutionDetailsResponseDto$outboundSchema.parse( + executionDetailsResponseDto, + ), + ); +} + +export function executionDetailsResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ExecutionDetailsResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ExecutionDetailsResponseDto' from JSON`, + ); +} diff --git a/src/models/components/feedresponsedto.ts b/src/models/components/feedresponsedto.ts new file mode 100644 index 00000000..dd231d97 --- /dev/null +++ b/src/models/components/feedresponsedto.ts @@ -0,0 +1,80 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type FeedResponseDto = { + totalCount?: number | undefined; + hasMore: boolean; + data: Array; + pageSize: number; + page: number; +}; + +/** @internal */ +export const FeedResponseDto$inboundSchema: z.ZodType< + FeedResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + totalCount: z.number().optional(), + hasMore: z.boolean(), + data: z.array(z.string()), + pageSize: z.number(), + page: z.number(), +}); + +/** @internal */ +export type FeedResponseDto$Outbound = { + totalCount?: number | undefined; + hasMore: boolean; + data: Array; + pageSize: number; + page: number; +}; + +/** @internal */ +export const FeedResponseDto$outboundSchema: z.ZodType< + FeedResponseDto$Outbound, + z.ZodTypeDef, + FeedResponseDto +> = z.object({ + totalCount: z.number().optional(), + hasMore: z.boolean(), + data: z.array(z.string()), + pageSize: z.number(), + page: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace FeedResponseDto$ { + /** @deprecated use `FeedResponseDto$inboundSchema` instead. */ + export const inboundSchema = FeedResponseDto$inboundSchema; + /** @deprecated use `FeedResponseDto$outboundSchema` instead. */ + export const outboundSchema = FeedResponseDto$outboundSchema; + /** @deprecated use `FeedResponseDto$Outbound` instead. */ + export type Outbound = FeedResponseDto$Outbound; +} + +export function feedResponseDtoToJSON( + feedResponseDto: FeedResponseDto, +): string { + return JSON.stringify(FeedResponseDto$outboundSchema.parse(feedResponseDto)); +} + +export function feedResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => FeedResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'FeedResponseDto' from JSON`, + ); +} diff --git a/src/models/components/fieldfilterpart.ts b/src/models/components/fieldfilterpart.ts new file mode 100644 index 00000000..80796872 --- /dev/null +++ b/src/models/components/fieldfilterpart.ts @@ -0,0 +1,137 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const Operator = { + Larger: "LARGER", + Smaller: "SMALLER", + LargerEqual: "LARGER_EQUAL", + SmallerEqual: "SMALLER_EQUAL", + Equal: "EQUAL", + NotEqual: "NOT_EQUAL", + AllIn: "ALL_IN", + AnyIn: "ANY_IN", + NotIn: "NOT_IN", + Between: "BETWEEN", + NotBetween: "NOT_BETWEEN", + Like: "LIKE", + NotLike: "NOT_LIKE", + In: "IN", +} as const; +export type Operator = ClosedEnum; + +export const On = { + Subscriber: "subscriber", + Payload: "payload", +} as const; +export type On = ClosedEnum; + +export type FieldFilterPart = { + field: string; + value: string; + operator: Operator; + on: On; +}; + +/** @internal */ +export const Operator$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Operator); + +/** @internal */ +export const Operator$outboundSchema: z.ZodNativeEnum = + Operator$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Operator$ { + /** @deprecated use `Operator$inboundSchema` instead. */ + export const inboundSchema = Operator$inboundSchema; + /** @deprecated use `Operator$outboundSchema` instead. */ + export const outboundSchema = Operator$outboundSchema; +} + +/** @internal */ +export const On$inboundSchema: z.ZodNativeEnum = z.nativeEnum(On); + +/** @internal */ +export const On$outboundSchema: z.ZodNativeEnum = On$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace On$ { + /** @deprecated use `On$inboundSchema` instead. */ + export const inboundSchema = On$inboundSchema; + /** @deprecated use `On$outboundSchema` instead. */ + export const outboundSchema = On$outboundSchema; +} + +/** @internal */ +export const FieldFilterPart$inboundSchema: z.ZodType< + FieldFilterPart, + z.ZodTypeDef, + unknown +> = z.object({ + field: z.string(), + value: z.string(), + operator: Operator$inboundSchema, + on: On$inboundSchema, +}); + +/** @internal */ +export type FieldFilterPart$Outbound = { + field: string; + value: string; + operator: string; + on: string; +}; + +/** @internal */ +export const FieldFilterPart$outboundSchema: z.ZodType< + FieldFilterPart$Outbound, + z.ZodTypeDef, + FieldFilterPart +> = z.object({ + field: z.string(), + value: z.string(), + operator: Operator$outboundSchema, + on: On$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace FieldFilterPart$ { + /** @deprecated use `FieldFilterPart$inboundSchema` instead. */ + export const inboundSchema = FieldFilterPart$inboundSchema; + /** @deprecated use `FieldFilterPart$outboundSchema` instead. */ + export const outboundSchema = FieldFilterPart$outboundSchema; + /** @deprecated use `FieldFilterPart$Outbound` instead. */ + export type Outbound = FieldFilterPart$Outbound; +} + +export function fieldFilterPartToJSON( + fieldFilterPart: FieldFilterPart, +): string { + return JSON.stringify(FieldFilterPart$outboundSchema.parse(fieldFilterPart)); +} + +export function fieldFilterPartFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => FieldFilterPart$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'FieldFilterPart' from JSON`, + ); +} diff --git a/src/models/components/filtertopicsresponsedto.ts b/src/models/components/filtertopicsresponsedto.ts new file mode 100644 index 00000000..ca44b57f --- /dev/null +++ b/src/models/components/filtertopicsresponsedto.ts @@ -0,0 +1,84 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + TopicDto, + TopicDto$inboundSchema, + TopicDto$Outbound, + TopicDto$outboundSchema, +} from "./topicdto.js"; + +export type FilterTopicsResponseDto = { + data: Array; + page: number; + pageSize: number; + totalCount: number; +}; + +/** @internal */ +export const FilterTopicsResponseDto$inboundSchema: z.ZodType< + FilterTopicsResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + data: z.array(TopicDto$inboundSchema), + page: z.number(), + pageSize: z.number(), + totalCount: z.number(), +}); + +/** @internal */ +export type FilterTopicsResponseDto$Outbound = { + data: Array; + page: number; + pageSize: number; + totalCount: number; +}; + +/** @internal */ +export const FilterTopicsResponseDto$outboundSchema: z.ZodType< + FilterTopicsResponseDto$Outbound, + z.ZodTypeDef, + FilterTopicsResponseDto +> = z.object({ + data: z.array(TopicDto$outboundSchema), + page: z.number(), + pageSize: z.number(), + totalCount: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace FilterTopicsResponseDto$ { + /** @deprecated use `FilterTopicsResponseDto$inboundSchema` instead. */ + export const inboundSchema = FilterTopicsResponseDto$inboundSchema; + /** @deprecated use `FilterTopicsResponseDto$outboundSchema` instead. */ + export const outboundSchema = FilterTopicsResponseDto$outboundSchema; + /** @deprecated use `FilterTopicsResponseDto$Outbound` instead. */ + export type Outbound = FilterTopicsResponseDto$Outbound; +} + +export function filterTopicsResponseDtoToJSON( + filterTopicsResponseDto: FilterTopicsResponseDto, +): string { + return JSON.stringify( + FilterTopicsResponseDto$outboundSchema.parse(filterTopicsResponseDto), + ); +} + +export function filterTopicsResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => FilterTopicsResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'FilterTopicsResponseDto' from JSON`, + ); +} diff --git a/src/models/components/getsubscriberpreferencesresponsedto.ts b/src/models/components/getsubscriberpreferencesresponsedto.ts new file mode 100644 index 00000000..23eaa71f --- /dev/null +++ b/src/models/components/getsubscriberpreferencesresponsedto.ts @@ -0,0 +1,93 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + Preference, + Preference$inboundSchema, + Preference$Outbound, + Preference$outboundSchema, +} from "./preference.js"; +import { + TemplateResponse, + TemplateResponse$inboundSchema, + TemplateResponse$Outbound, + TemplateResponse$outboundSchema, +} from "./templateresponse.js"; + +export type GetSubscriberPreferencesResponseDto = { + /** + * The workflow information and if it is critical or not + */ + template?: TemplateResponse | undefined; + /** + * The preferences of the subscriber regarding the related workflow + */ + preference: Preference; +}; + +/** @internal */ +export const GetSubscriberPreferencesResponseDto$inboundSchema: z.ZodType< + GetSubscriberPreferencesResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + template: TemplateResponse$inboundSchema.optional(), + preference: Preference$inboundSchema, +}); + +/** @internal */ +export type GetSubscriberPreferencesResponseDto$Outbound = { + template?: TemplateResponse$Outbound | undefined; + preference: Preference$Outbound; +}; + +/** @internal */ +export const GetSubscriberPreferencesResponseDto$outboundSchema: z.ZodType< + GetSubscriberPreferencesResponseDto$Outbound, + z.ZodTypeDef, + GetSubscriberPreferencesResponseDto +> = z.object({ + template: TemplateResponse$outboundSchema.optional(), + preference: Preference$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetSubscriberPreferencesResponseDto$ { + /** @deprecated use `GetSubscriberPreferencesResponseDto$inboundSchema` instead. */ + export const inboundSchema = + GetSubscriberPreferencesResponseDto$inboundSchema; + /** @deprecated use `GetSubscriberPreferencesResponseDto$outboundSchema` instead. */ + export const outboundSchema = + GetSubscriberPreferencesResponseDto$outboundSchema; + /** @deprecated use `GetSubscriberPreferencesResponseDto$Outbound` instead. */ + export type Outbound = GetSubscriberPreferencesResponseDto$Outbound; +} + +export function getSubscriberPreferencesResponseDtoToJSON( + getSubscriberPreferencesResponseDto: GetSubscriberPreferencesResponseDto, +): string { + return JSON.stringify( + GetSubscriberPreferencesResponseDto$outboundSchema.parse( + getSubscriberPreferencesResponseDto, + ), + ); +} + +export function getSubscriberPreferencesResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + GetSubscriberPreferencesResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetSubscriberPreferencesResponseDto' from JSON`, + ); +} diff --git a/src/models/components/gettopicresponsedto.ts b/src/models/components/gettopicresponsedto.ts new file mode 100644 index 00000000..d99b61c4 --- /dev/null +++ b/src/models/components/gettopicresponsedto.ts @@ -0,0 +1,99 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type GetTopicResponseDto = { + id?: string | undefined; + organizationId: string; + environmentId: string; + key: string; + name: string; + subscribers: Array; +}; + +/** @internal */ +export const GetTopicResponseDto$inboundSchema: z.ZodType< + GetTopicResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + _organizationId: z.string(), + _environmentId: z.string(), + key: z.string(), + name: z.string(), + subscribers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_organizationId": "organizationId", + "_environmentId": "environmentId", + }); +}); + +/** @internal */ +export type GetTopicResponseDto$Outbound = { + _id?: string | undefined; + _organizationId: string; + _environmentId: string; + key: string; + name: string; + subscribers: Array; +}; + +/** @internal */ +export const GetTopicResponseDto$outboundSchema: z.ZodType< + GetTopicResponseDto$Outbound, + z.ZodTypeDef, + GetTopicResponseDto +> = z.object({ + id: z.string().optional(), + organizationId: z.string(), + environmentId: z.string(), + key: z.string(), + name: z.string(), + subscribers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + id: "_id", + organizationId: "_organizationId", + environmentId: "_environmentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace GetTopicResponseDto$ { + /** @deprecated use `GetTopicResponseDto$inboundSchema` instead. */ + export const inboundSchema = GetTopicResponseDto$inboundSchema; + /** @deprecated use `GetTopicResponseDto$outboundSchema` instead. */ + export const outboundSchema = GetTopicResponseDto$outboundSchema; + /** @deprecated use `GetTopicResponseDto$Outbound` instead. */ + export type Outbound = GetTopicResponseDto$Outbound; +} + +export function getTopicResponseDtoToJSON( + getTopicResponseDto: GetTopicResponseDto, +): string { + return JSON.stringify( + GetTopicResponseDto$outboundSchema.parse(getTopicResponseDto), + ); +} + +export function getTopicResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetTopicResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetTopicResponseDto' from JSON`, + ); +} diff --git a/src/models/components/index.ts b/src/models/components/index.ts new file mode 100644 index 00000000..9d1489e2 --- /dev/null +++ b/src/models/components/index.ts @@ -0,0 +1,85 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export * from "./activitiesresponsedto.js"; +export * from "./activitygraphstatesresponse.js"; +export * from "./activitynotificationresponsedto.js"; +export * from "./activitynotificationsubscriberresponsedto.js"; +export * from "./activitynotificationtemplateresponsedto.js"; +export * from "./activitystatsresponsedto.js"; +export * from "./addsubscribersrequestdto.js"; +export * from "./apikey.js"; +export * from "./bulksubscribercreatedto.js"; +export * from "./bulktriggereventdto.js"; +export * from "./channelcredentials.js"; +export * from "./channelpreference.js"; +export * from "./channelsettings.js"; +export * from "./createintegrationrequestdto.js"; +export * from "./createnotificationgrouprequestdto.js"; +export * from "./createsubscriberrequestdto.js"; +export * from "./createtopicrequestdto.js"; +export * from "./createtopicresponsedto.js"; +export * from "./credentialsdto.js"; +export * from "./databooleandto.js"; +export * from "./delayregularmetadata.js"; +export * from "./delayscheduledmetadata.js"; +export * from "./deletemessageresponsedto.js"; +export * from "./deletenotificationgroupresponsedto.js"; +export * from "./deletesubscriberresponsedto.js"; +export * from "./digestregularmetadata.js"; +export * from "./digesttimedmetadata.js"; +export * from "./emailblock.js"; +export * from "./emailblockstyles.js"; +export * from "./environmentresponsedto.js"; +export * from "./executiondetailsresponsedto.js"; +export * from "./feedresponsedto.js"; +export * from "./fieldfilterpart.js"; +export * from "./filtertopicsresponsedto.js"; +export * from "./getsubscriberpreferencesresponsedto.js"; +export * from "./gettopicresponsedto.js"; +export * from "./integrationresponsedto.js"; +export * from "./markallmessageasrequestdto.js"; +export * from "./markmessageactionasseendto.js"; +export * from "./messageaction.js"; +export * from "./messageactionresult.js"; +export * from "./messagebutton.js"; +export * from "./messagecta.js"; +export * from "./messagectadata.js"; +export * from "./messageentity.js"; +export * from "./messagemarkasrequestdto.js"; +export * from "./messageresponsedto.js"; +export * from "./messagetemplate.js"; +export * from "./notificationgroup.js"; +export * from "./notificationgroupresponsedto.js"; +export * from "./notificationstep.js"; +export * from "./notificationstepvariant.js"; +export * from "./notificationtrigger.js"; +export * from "./notificationtriggervariable.js"; +export * from "./preference.js"; +export * from "./preferencechannels.js"; +export * from "./removesubscribersrequestdto.js"; +export * from "./renametopicrequestdto.js"; +export * from "./renametopicresponsedto.js"; +export * from "./security.js"; +export * from "./stepfilter.js"; +export * from "./subscriberpayloaddto.js"; +export * from "./subscriberresponsedto.js"; +export * from "./templateresponse.js"; +export * from "./tenantpayloaddto.js"; +export * from "./timedconfig.js"; +export * from "./topicdto.js"; +export * from "./topicpayloaddto.js"; +export * from "./topicsubscriberdto.js"; +export * from "./triggereventrequestdto.js"; +export * from "./triggereventresponsedto.js"; +export * from "./triggereventtoallrequestdto.js"; +export * from "./unseencountresponse.js"; +export * from "./updateintegrationrequestdto.js"; +export * from "./updatesubscriberchannelrequestdto.js"; +export * from "./updatesubscriberglobalpreferencesrequestdto.js"; +export * from "./updatesubscriberonlineflagrequestdto.js"; +export * from "./updatesubscriberpreferencerequestdto.js"; +export * from "./updatesubscriberpreferenceresponsedto.js"; +export * from "./updatesubscriberrequestdto.js"; +export * from "./workflowresponse.js"; diff --git a/src/models/components/integrationresponsedto.ts b/src/models/components/integrationresponsedto.ts new file mode 100644 index 00000000..32f14192 --- /dev/null +++ b/src/models/components/integrationresponsedto.ts @@ -0,0 +1,176 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + CredentialsDto, + CredentialsDto$inboundSchema, + CredentialsDto$Outbound, + CredentialsDto$outboundSchema, +} from "./credentialsdto.js"; +import { + StepFilter, + StepFilter$inboundSchema, + StepFilter$Outbound, + StepFilter$outboundSchema, +} from "./stepfilter.js"; + +export const IntegrationResponseDtoChannel = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +export type IntegrationResponseDtoChannel = ClosedEnum< + typeof IntegrationResponseDtoChannel +>; + +export type IntegrationResponseDto = { + id?: string | undefined; + environmentId: string; + organizationId: string; + name: string; + identifier: string; + providerId: string; + channel: IntegrationResponseDtoChannel; + credentials: CredentialsDto; + active: boolean; + deleted: boolean; + deletedAt: string; + deletedBy: string; + primary: boolean; + conditions?: Array | undefined; +}; + +/** @internal */ +export const IntegrationResponseDtoChannel$inboundSchema: z.ZodNativeEnum< + typeof IntegrationResponseDtoChannel +> = z.nativeEnum(IntegrationResponseDtoChannel); + +/** @internal */ +export const IntegrationResponseDtoChannel$outboundSchema: z.ZodNativeEnum< + typeof IntegrationResponseDtoChannel +> = IntegrationResponseDtoChannel$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationResponseDtoChannel$ { + /** @deprecated use `IntegrationResponseDtoChannel$inboundSchema` instead. */ + export const inboundSchema = IntegrationResponseDtoChannel$inboundSchema; + /** @deprecated use `IntegrationResponseDtoChannel$outboundSchema` instead. */ + export const outboundSchema = IntegrationResponseDtoChannel$outboundSchema; +} + +/** @internal */ +export const IntegrationResponseDto$inboundSchema: z.ZodType< + IntegrationResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + _environmentId: z.string(), + _organizationId: z.string(), + name: z.string(), + identifier: z.string(), + providerId: z.string(), + channel: IntegrationResponseDtoChannel$inboundSchema, + credentials: CredentialsDto$inboundSchema, + active: z.boolean(), + deleted: z.boolean(), + deletedAt: z.string(), + deletedBy: z.string(), + primary: z.boolean(), + conditions: z.array(StepFilter$inboundSchema).optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_environmentId": "environmentId", + "_organizationId": "organizationId", + }); +}); + +/** @internal */ +export type IntegrationResponseDto$Outbound = { + _id?: string | undefined; + _environmentId: string; + _organizationId: string; + name: string; + identifier: string; + providerId: string; + channel: string; + credentials: CredentialsDto$Outbound; + active: boolean; + deleted: boolean; + deletedAt: string; + deletedBy: string; + primary: boolean; + conditions?: Array | undefined; +}; + +/** @internal */ +export const IntegrationResponseDto$outboundSchema: z.ZodType< + IntegrationResponseDto$Outbound, + z.ZodTypeDef, + IntegrationResponseDto +> = z.object({ + id: z.string().optional(), + environmentId: z.string(), + organizationId: z.string(), + name: z.string(), + identifier: z.string(), + providerId: z.string(), + channel: IntegrationResponseDtoChannel$outboundSchema, + credentials: CredentialsDto$outboundSchema, + active: z.boolean(), + deleted: z.boolean(), + deletedAt: z.string(), + deletedBy: z.string(), + primary: z.boolean(), + conditions: z.array(StepFilter$outboundSchema).optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + environmentId: "_environmentId", + organizationId: "_organizationId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationResponseDto$ { + /** @deprecated use `IntegrationResponseDto$inboundSchema` instead. */ + export const inboundSchema = IntegrationResponseDto$inboundSchema; + /** @deprecated use `IntegrationResponseDto$outboundSchema` instead. */ + export const outboundSchema = IntegrationResponseDto$outboundSchema; + /** @deprecated use `IntegrationResponseDto$Outbound` instead. */ + export type Outbound = IntegrationResponseDto$Outbound; +} + +export function integrationResponseDtoToJSON( + integrationResponseDto: IntegrationResponseDto, +): string { + return JSON.stringify( + IntegrationResponseDto$outboundSchema.parse(integrationResponseDto), + ); +} + +export function integrationResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => IntegrationResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'IntegrationResponseDto' from JSON`, + ); +} diff --git a/src/models/components/markallmessageasrequestdto.ts b/src/models/components/markallmessageasrequestdto.ts new file mode 100644 index 00000000..1258d034 --- /dev/null +++ b/src/models/components/markallmessageasrequestdto.ts @@ -0,0 +1,163 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * Optional feed identifier or array of feed identifiers + */ +export type FeedIdentifier = string | Array; + +/** + * Mark all subscriber messages as read, unread, seen or unseen + */ +export const MarkAllMessageAsRequestDtoMarkAs = { + Read: "read", + Seen: "seen", + Unread: "unread", + Unseen: "unseen", +} as const; +/** + * Mark all subscriber messages as read, unread, seen or unseen + */ +export type MarkAllMessageAsRequestDtoMarkAs = ClosedEnum< + typeof MarkAllMessageAsRequestDtoMarkAs +>; + +export type MarkAllMessageAsRequestDto = { + /** + * Optional feed identifier or array of feed identifiers + */ + feedIdentifier?: string | Array | undefined; + /** + * Mark all subscriber messages as read, unread, seen or unseen + */ + markAs: MarkAllMessageAsRequestDtoMarkAs; +}; + +/** @internal */ +export const FeedIdentifier$inboundSchema: z.ZodType< + FeedIdentifier, + z.ZodTypeDef, + unknown +> = z.union([z.string(), z.array(z.string())]); + +/** @internal */ +export type FeedIdentifier$Outbound = string | Array; + +/** @internal */ +export const FeedIdentifier$outboundSchema: z.ZodType< + FeedIdentifier$Outbound, + z.ZodTypeDef, + FeedIdentifier +> = z.union([z.string(), z.array(z.string())]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace FeedIdentifier$ { + /** @deprecated use `FeedIdentifier$inboundSchema` instead. */ + export const inboundSchema = FeedIdentifier$inboundSchema; + /** @deprecated use `FeedIdentifier$outboundSchema` instead. */ + export const outboundSchema = FeedIdentifier$outboundSchema; + /** @deprecated use `FeedIdentifier$Outbound` instead. */ + export type Outbound = FeedIdentifier$Outbound; +} + +export function feedIdentifierToJSON(feedIdentifier: FeedIdentifier): string { + return JSON.stringify(FeedIdentifier$outboundSchema.parse(feedIdentifier)); +} + +export function feedIdentifierFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => FeedIdentifier$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'FeedIdentifier' from JSON`, + ); +} + +/** @internal */ +export const MarkAllMessageAsRequestDtoMarkAs$inboundSchema: z.ZodNativeEnum< + typeof MarkAllMessageAsRequestDtoMarkAs +> = z.nativeEnum(MarkAllMessageAsRequestDtoMarkAs); + +/** @internal */ +export const MarkAllMessageAsRequestDtoMarkAs$outboundSchema: z.ZodNativeEnum< + typeof MarkAllMessageAsRequestDtoMarkAs +> = MarkAllMessageAsRequestDtoMarkAs$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MarkAllMessageAsRequestDtoMarkAs$ { + /** @deprecated use `MarkAllMessageAsRequestDtoMarkAs$inboundSchema` instead. */ + export const inboundSchema = MarkAllMessageAsRequestDtoMarkAs$inboundSchema; + /** @deprecated use `MarkAllMessageAsRequestDtoMarkAs$outboundSchema` instead. */ + export const outboundSchema = MarkAllMessageAsRequestDtoMarkAs$outboundSchema; +} + +/** @internal */ +export const MarkAllMessageAsRequestDto$inboundSchema: z.ZodType< + MarkAllMessageAsRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + feedIdentifier: z.union([z.string(), z.array(z.string())]).optional(), + markAs: MarkAllMessageAsRequestDtoMarkAs$inboundSchema, +}); + +/** @internal */ +export type MarkAllMessageAsRequestDto$Outbound = { + feedIdentifier?: string | Array | undefined; + markAs: string; +}; + +/** @internal */ +export const MarkAllMessageAsRequestDto$outboundSchema: z.ZodType< + MarkAllMessageAsRequestDto$Outbound, + z.ZodTypeDef, + MarkAllMessageAsRequestDto +> = z.object({ + feedIdentifier: z.union([z.string(), z.array(z.string())]).optional(), + markAs: MarkAllMessageAsRequestDtoMarkAs$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MarkAllMessageAsRequestDto$ { + /** @deprecated use `MarkAllMessageAsRequestDto$inboundSchema` instead. */ + export const inboundSchema = MarkAllMessageAsRequestDto$inboundSchema; + /** @deprecated use `MarkAllMessageAsRequestDto$outboundSchema` instead. */ + export const outboundSchema = MarkAllMessageAsRequestDto$outboundSchema; + /** @deprecated use `MarkAllMessageAsRequestDto$Outbound` instead. */ + export type Outbound = MarkAllMessageAsRequestDto$Outbound; +} + +export function markAllMessageAsRequestDtoToJSON( + markAllMessageAsRequestDto: MarkAllMessageAsRequestDto, +): string { + return JSON.stringify( + MarkAllMessageAsRequestDto$outboundSchema.parse(markAllMessageAsRequestDto), + ); +} + +export function markAllMessageAsRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MarkAllMessageAsRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MarkAllMessageAsRequestDto' from JSON`, + ); +} diff --git a/src/models/components/markmessageactionasseendto.ts b/src/models/components/markmessageactionasseendto.ts new file mode 100644 index 00000000..4476a8f5 --- /dev/null +++ b/src/models/components/markmessageactionasseendto.ts @@ -0,0 +1,170 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * Message action status + */ +export const MarkMessageActionAsSeenDtoStatus = { + Pending: "pending", + Done: "done", +} as const; +/** + * Message action status + */ +export type MarkMessageActionAsSeenDtoStatus = ClosedEnum< + typeof MarkMessageActionAsSeenDtoStatus +>; + +/** + * Message action payload + */ +export type MarkMessageActionAsSeenDtoPayload = {}; + +export type MarkMessageActionAsSeenDto = { + /** + * Message action status + */ + status: MarkMessageActionAsSeenDtoStatus; + /** + * Message action payload + */ + payload?: MarkMessageActionAsSeenDtoPayload | undefined; +}; + +/** @internal */ +export const MarkMessageActionAsSeenDtoStatus$inboundSchema: z.ZodNativeEnum< + typeof MarkMessageActionAsSeenDtoStatus +> = z.nativeEnum(MarkMessageActionAsSeenDtoStatus); + +/** @internal */ +export const MarkMessageActionAsSeenDtoStatus$outboundSchema: z.ZodNativeEnum< + typeof MarkMessageActionAsSeenDtoStatus +> = MarkMessageActionAsSeenDtoStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MarkMessageActionAsSeenDtoStatus$ { + /** @deprecated use `MarkMessageActionAsSeenDtoStatus$inboundSchema` instead. */ + export const inboundSchema = MarkMessageActionAsSeenDtoStatus$inboundSchema; + /** @deprecated use `MarkMessageActionAsSeenDtoStatus$outboundSchema` instead. */ + export const outboundSchema = MarkMessageActionAsSeenDtoStatus$outboundSchema; +} + +/** @internal */ +export const MarkMessageActionAsSeenDtoPayload$inboundSchema: z.ZodType< + MarkMessageActionAsSeenDtoPayload, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type MarkMessageActionAsSeenDtoPayload$Outbound = {}; + +/** @internal */ +export const MarkMessageActionAsSeenDtoPayload$outboundSchema: z.ZodType< + MarkMessageActionAsSeenDtoPayload$Outbound, + z.ZodTypeDef, + MarkMessageActionAsSeenDtoPayload +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MarkMessageActionAsSeenDtoPayload$ { + /** @deprecated use `MarkMessageActionAsSeenDtoPayload$inboundSchema` instead. */ + export const inboundSchema = MarkMessageActionAsSeenDtoPayload$inboundSchema; + /** @deprecated use `MarkMessageActionAsSeenDtoPayload$outboundSchema` instead. */ + export const outboundSchema = + MarkMessageActionAsSeenDtoPayload$outboundSchema; + /** @deprecated use `MarkMessageActionAsSeenDtoPayload$Outbound` instead. */ + export type Outbound = MarkMessageActionAsSeenDtoPayload$Outbound; +} + +export function markMessageActionAsSeenDtoPayloadToJSON( + markMessageActionAsSeenDtoPayload: MarkMessageActionAsSeenDtoPayload, +): string { + return JSON.stringify( + MarkMessageActionAsSeenDtoPayload$outboundSchema.parse( + markMessageActionAsSeenDtoPayload, + ), + ); +} + +export function markMessageActionAsSeenDtoPayloadFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MarkMessageActionAsSeenDtoPayload$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MarkMessageActionAsSeenDtoPayload' from JSON`, + ); +} + +/** @internal */ +export const MarkMessageActionAsSeenDto$inboundSchema: z.ZodType< + MarkMessageActionAsSeenDto, + z.ZodTypeDef, + unknown +> = z.object({ + status: MarkMessageActionAsSeenDtoStatus$inboundSchema, + payload: z.lazy(() => MarkMessageActionAsSeenDtoPayload$inboundSchema) + .optional(), +}); + +/** @internal */ +export type MarkMessageActionAsSeenDto$Outbound = { + status: string; + payload?: MarkMessageActionAsSeenDtoPayload$Outbound | undefined; +}; + +/** @internal */ +export const MarkMessageActionAsSeenDto$outboundSchema: z.ZodType< + MarkMessageActionAsSeenDto$Outbound, + z.ZodTypeDef, + MarkMessageActionAsSeenDto +> = z.object({ + status: MarkMessageActionAsSeenDtoStatus$outboundSchema, + payload: z.lazy(() => MarkMessageActionAsSeenDtoPayload$outboundSchema) + .optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MarkMessageActionAsSeenDto$ { + /** @deprecated use `MarkMessageActionAsSeenDto$inboundSchema` instead. */ + export const inboundSchema = MarkMessageActionAsSeenDto$inboundSchema; + /** @deprecated use `MarkMessageActionAsSeenDto$outboundSchema` instead. */ + export const outboundSchema = MarkMessageActionAsSeenDto$outboundSchema; + /** @deprecated use `MarkMessageActionAsSeenDto$Outbound` instead. */ + export type Outbound = MarkMessageActionAsSeenDto$Outbound; +} + +export function markMessageActionAsSeenDtoToJSON( + markMessageActionAsSeenDto: MarkMessageActionAsSeenDto, +): string { + return JSON.stringify( + MarkMessageActionAsSeenDto$outboundSchema.parse(markMessageActionAsSeenDto), + ); +} + +export function markMessageActionAsSeenDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MarkMessageActionAsSeenDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MarkMessageActionAsSeenDto' from JSON`, + ); +} diff --git a/src/models/components/messageaction.ts b/src/models/components/messageaction.ts new file mode 100644 index 00000000..9b865fc7 --- /dev/null +++ b/src/models/components/messageaction.ts @@ -0,0 +1,110 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + MessageActionResult, + MessageActionResult$inboundSchema, + MessageActionResult$Outbound, + MessageActionResult$outboundSchema, +} from "./messageactionresult.js"; +import { + MessageButton, + MessageButton$inboundSchema, + MessageButton$Outbound, + MessageButton$outboundSchema, +} from "./messagebutton.js"; + +export const MessageActionStatus = { + Pending: "pending", + Done: "done", +} as const; +export type MessageActionStatus = ClosedEnum; + +export type MessageAction = { + status?: MessageActionStatus | undefined; + buttons?: Array | undefined; + result?: MessageActionResult | undefined; +}; + +/** @internal */ +export const MessageActionStatus$inboundSchema: z.ZodNativeEnum< + typeof MessageActionStatus +> = z.nativeEnum(MessageActionStatus); + +/** @internal */ +export const MessageActionStatus$outboundSchema: z.ZodNativeEnum< + typeof MessageActionStatus +> = MessageActionStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageActionStatus$ { + /** @deprecated use `MessageActionStatus$inboundSchema` instead. */ + export const inboundSchema = MessageActionStatus$inboundSchema; + /** @deprecated use `MessageActionStatus$outboundSchema` instead. */ + export const outboundSchema = MessageActionStatus$outboundSchema; +} + +/** @internal */ +export const MessageAction$inboundSchema: z.ZodType< + MessageAction, + z.ZodTypeDef, + unknown +> = z.object({ + status: MessageActionStatus$inboundSchema.optional(), + buttons: z.array(MessageButton$inboundSchema).optional(), + result: MessageActionResult$inboundSchema.optional(), +}); + +/** @internal */ +export type MessageAction$Outbound = { + status?: string | undefined; + buttons?: Array | undefined; + result?: MessageActionResult$Outbound | undefined; +}; + +/** @internal */ +export const MessageAction$outboundSchema: z.ZodType< + MessageAction$Outbound, + z.ZodTypeDef, + MessageAction +> = z.object({ + status: MessageActionStatus$outboundSchema.optional(), + buttons: z.array(MessageButton$outboundSchema).optional(), + result: MessageActionResult$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageAction$ { + /** @deprecated use `MessageAction$inboundSchema` instead. */ + export const inboundSchema = MessageAction$inboundSchema; + /** @deprecated use `MessageAction$outboundSchema` instead. */ + export const outboundSchema = MessageAction$outboundSchema; + /** @deprecated use `MessageAction$Outbound` instead. */ + export type Outbound = MessageAction$Outbound; +} + +export function messageActionToJSON(messageAction: MessageAction): string { + return JSON.stringify(MessageAction$outboundSchema.parse(messageAction)); +} + +export function messageActionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageAction$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageAction' from JSON`, + ); +} diff --git a/src/models/components/messageactionresult.ts b/src/models/components/messageactionresult.ts new file mode 100644 index 00000000..7a147d51 --- /dev/null +++ b/src/models/components/messageactionresult.ts @@ -0,0 +1,150 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type MessageActionResultPayload = {}; + +export const MessageActionResultType = { + Primary: "primary", + Secondary: "secondary", +} as const; +export type MessageActionResultType = ClosedEnum< + typeof MessageActionResultType +>; + +export type MessageActionResult = { + payload?: MessageActionResultPayload | undefined; + type?: MessageActionResultType | undefined; +}; + +/** @internal */ +export const MessageActionResultPayload$inboundSchema: z.ZodType< + MessageActionResultPayload, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type MessageActionResultPayload$Outbound = {}; + +/** @internal */ +export const MessageActionResultPayload$outboundSchema: z.ZodType< + MessageActionResultPayload$Outbound, + z.ZodTypeDef, + MessageActionResultPayload +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageActionResultPayload$ { + /** @deprecated use `MessageActionResultPayload$inboundSchema` instead. */ + export const inboundSchema = MessageActionResultPayload$inboundSchema; + /** @deprecated use `MessageActionResultPayload$outboundSchema` instead. */ + export const outboundSchema = MessageActionResultPayload$outboundSchema; + /** @deprecated use `MessageActionResultPayload$Outbound` instead. */ + export type Outbound = MessageActionResultPayload$Outbound; +} + +export function messageActionResultPayloadToJSON( + messageActionResultPayload: MessageActionResultPayload, +): string { + return JSON.stringify( + MessageActionResultPayload$outboundSchema.parse(messageActionResultPayload), + ); +} + +export function messageActionResultPayloadFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageActionResultPayload$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageActionResultPayload' from JSON`, + ); +} + +/** @internal */ +export const MessageActionResultType$inboundSchema: z.ZodNativeEnum< + typeof MessageActionResultType +> = z.nativeEnum(MessageActionResultType); + +/** @internal */ +export const MessageActionResultType$outboundSchema: z.ZodNativeEnum< + typeof MessageActionResultType +> = MessageActionResultType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageActionResultType$ { + /** @deprecated use `MessageActionResultType$inboundSchema` instead. */ + export const inboundSchema = MessageActionResultType$inboundSchema; + /** @deprecated use `MessageActionResultType$outboundSchema` instead. */ + export const outboundSchema = MessageActionResultType$outboundSchema; +} + +/** @internal */ +export const MessageActionResult$inboundSchema: z.ZodType< + MessageActionResult, + z.ZodTypeDef, + unknown +> = z.object({ + payload: z.lazy(() => MessageActionResultPayload$inboundSchema).optional(), + type: MessageActionResultType$inboundSchema.optional(), +}); + +/** @internal */ +export type MessageActionResult$Outbound = { + payload?: MessageActionResultPayload$Outbound | undefined; + type?: string | undefined; +}; + +/** @internal */ +export const MessageActionResult$outboundSchema: z.ZodType< + MessageActionResult$Outbound, + z.ZodTypeDef, + MessageActionResult +> = z.object({ + payload: z.lazy(() => MessageActionResultPayload$outboundSchema).optional(), + type: MessageActionResultType$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageActionResult$ { + /** @deprecated use `MessageActionResult$inboundSchema` instead. */ + export const inboundSchema = MessageActionResult$inboundSchema; + /** @deprecated use `MessageActionResult$outboundSchema` instead. */ + export const outboundSchema = MessageActionResult$outboundSchema; + /** @deprecated use `MessageActionResult$Outbound` instead. */ + export type Outbound = MessageActionResult$Outbound; +} + +export function messageActionResultToJSON( + messageActionResult: MessageActionResult, +): string { + return JSON.stringify( + MessageActionResult$outboundSchema.parse(messageActionResult), + ); +} + +export function messageActionResultFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageActionResult$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageActionResult' from JSON`, + ); +} diff --git a/src/models/components/messagebutton.ts b/src/models/components/messagebutton.ts new file mode 100644 index 00000000..443f8b3f --- /dev/null +++ b/src/models/components/messagebutton.ts @@ -0,0 +1,98 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const MessageButtonType = { + Primary: "primary", + Secondary: "secondary", +} as const; +export type MessageButtonType = ClosedEnum; + +export type MessageButton = { + type: MessageButtonType; + content: string; + resultContent?: string | undefined; +}; + +/** @internal */ +export const MessageButtonType$inboundSchema: z.ZodNativeEnum< + typeof MessageButtonType +> = z.nativeEnum(MessageButtonType); + +/** @internal */ +export const MessageButtonType$outboundSchema: z.ZodNativeEnum< + typeof MessageButtonType +> = MessageButtonType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageButtonType$ { + /** @deprecated use `MessageButtonType$inboundSchema` instead. */ + export const inboundSchema = MessageButtonType$inboundSchema; + /** @deprecated use `MessageButtonType$outboundSchema` instead. */ + export const outboundSchema = MessageButtonType$outboundSchema; +} + +/** @internal */ +export const MessageButton$inboundSchema: z.ZodType< + MessageButton, + z.ZodTypeDef, + unknown +> = z.object({ + type: MessageButtonType$inboundSchema, + content: z.string(), + resultContent: z.string().optional(), +}); + +/** @internal */ +export type MessageButton$Outbound = { + type: string; + content: string; + resultContent?: string | undefined; +}; + +/** @internal */ +export const MessageButton$outboundSchema: z.ZodType< + MessageButton$Outbound, + z.ZodTypeDef, + MessageButton +> = z.object({ + type: MessageButtonType$outboundSchema, + content: z.string(), + resultContent: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageButton$ { + /** @deprecated use `MessageButton$inboundSchema` instead. */ + export const inboundSchema = MessageButton$inboundSchema; + /** @deprecated use `MessageButton$outboundSchema` instead. */ + export const outboundSchema = MessageButton$outboundSchema; + /** @deprecated use `MessageButton$Outbound` instead. */ + export type Outbound = MessageButton$Outbound; +} + +export function messageButtonToJSON(messageButton: MessageButton): string { + return JSON.stringify(MessageButton$outboundSchema.parse(messageButton)); +} + +export function messageButtonFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageButton$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageButton' from JSON`, + ); +} diff --git a/src/models/components/messagecta.ts b/src/models/components/messagecta.ts new file mode 100644 index 00000000..6560ba6d --- /dev/null +++ b/src/models/components/messagecta.ts @@ -0,0 +1,109 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + MessageAction, + MessageAction$inboundSchema, + MessageAction$Outbound, + MessageAction$outboundSchema, +} from "./messageaction.js"; +import { + MessageCTAData, + MessageCTAData$inboundSchema, + MessageCTAData$Outbound, + MessageCTAData$outboundSchema, +} from "./messagectadata.js"; + +export const MessageCTAType = { + Redirect: "redirect", +} as const; +export type MessageCTAType = ClosedEnum; + +export type MessageCTA = { + type?: MessageCTAType | undefined; + data: MessageCTAData; + action?: MessageAction | undefined; +}; + +/** @internal */ +export const MessageCTAType$inboundSchema: z.ZodNativeEnum< + typeof MessageCTAType +> = z.nativeEnum(MessageCTAType); + +/** @internal */ +export const MessageCTAType$outboundSchema: z.ZodNativeEnum< + typeof MessageCTAType +> = MessageCTAType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageCTAType$ { + /** @deprecated use `MessageCTAType$inboundSchema` instead. */ + export const inboundSchema = MessageCTAType$inboundSchema; + /** @deprecated use `MessageCTAType$outboundSchema` instead. */ + export const outboundSchema = MessageCTAType$outboundSchema; +} + +/** @internal */ +export const MessageCTA$inboundSchema: z.ZodType< + MessageCTA, + z.ZodTypeDef, + unknown +> = z.object({ + type: MessageCTAType$inboundSchema.optional(), + data: MessageCTAData$inboundSchema, + action: MessageAction$inboundSchema.optional(), +}); + +/** @internal */ +export type MessageCTA$Outbound = { + type?: string | undefined; + data: MessageCTAData$Outbound; + action?: MessageAction$Outbound | undefined; +}; + +/** @internal */ +export const MessageCTA$outboundSchema: z.ZodType< + MessageCTA$Outbound, + z.ZodTypeDef, + MessageCTA +> = z.object({ + type: MessageCTAType$outboundSchema.optional(), + data: MessageCTAData$outboundSchema, + action: MessageAction$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageCTA$ { + /** @deprecated use `MessageCTA$inboundSchema` instead. */ + export const inboundSchema = MessageCTA$inboundSchema; + /** @deprecated use `MessageCTA$outboundSchema` instead. */ + export const outboundSchema = MessageCTA$outboundSchema; + /** @deprecated use `MessageCTA$Outbound` instead. */ + export type Outbound = MessageCTA$Outbound; +} + +export function messageCTAToJSON(messageCTA: MessageCTA): string { + return JSON.stringify(MessageCTA$outboundSchema.parse(messageCTA)); +} + +export function messageCTAFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageCTA$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageCTA' from JSON`, + ); +} diff --git a/src/models/components/messagectadata.ts b/src/models/components/messagectadata.ts new file mode 100644 index 00000000..a5fef65a --- /dev/null +++ b/src/models/components/messagectadata.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type MessageCTAData = { + url?: string | undefined; +}; + +/** @internal */ +export const MessageCTAData$inboundSchema: z.ZodType< + MessageCTAData, + z.ZodTypeDef, + unknown +> = z.object({ + url: z.string().optional(), +}); + +/** @internal */ +export type MessageCTAData$Outbound = { + url?: string | undefined; +}; + +/** @internal */ +export const MessageCTAData$outboundSchema: z.ZodType< + MessageCTAData$Outbound, + z.ZodTypeDef, + MessageCTAData +> = z.object({ + url: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageCTAData$ { + /** @deprecated use `MessageCTAData$inboundSchema` instead. */ + export const inboundSchema = MessageCTAData$inboundSchema; + /** @deprecated use `MessageCTAData$outboundSchema` instead. */ + export const outboundSchema = MessageCTAData$outboundSchema; + /** @deprecated use `MessageCTAData$Outbound` instead. */ + export type Outbound = MessageCTAData$Outbound; +} + +export function messageCTADataToJSON(messageCTAData: MessageCTAData): string { + return JSON.stringify(MessageCTAData$outboundSchema.parse(messageCTAData)); +} + +export function messageCTADataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageCTAData$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageCTAData' from JSON`, + ); +} diff --git a/src/models/components/messageentity.ts b/src/models/components/messageentity.ts new file mode 100644 index 00000000..d65bebd2 --- /dev/null +++ b/src/models/components/messageentity.ts @@ -0,0 +1,54 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type MessageEntity = {}; + +/** @internal */ +export const MessageEntity$inboundSchema: z.ZodType< + MessageEntity, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type MessageEntity$Outbound = {}; + +/** @internal */ +export const MessageEntity$outboundSchema: z.ZodType< + MessageEntity$Outbound, + z.ZodTypeDef, + MessageEntity +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageEntity$ { + /** @deprecated use `MessageEntity$inboundSchema` instead. */ + export const inboundSchema = MessageEntity$inboundSchema; + /** @deprecated use `MessageEntity$outboundSchema` instead. */ + export const outboundSchema = MessageEntity$outboundSchema; + /** @deprecated use `MessageEntity$Outbound` instead. */ + export type Outbound = MessageEntity$Outbound; +} + +export function messageEntityToJSON(messageEntity: MessageEntity): string { + return JSON.stringify(MessageEntity$outboundSchema.parse(messageEntity)); +} + +export function messageEntityFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageEntity$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageEntity' from JSON`, + ); +} diff --git a/src/models/components/messagemarkasrequestdto.ts b/src/models/components/messagemarkasrequestdto.ts new file mode 100644 index 00000000..22b8a38a --- /dev/null +++ b/src/models/components/messagemarkasrequestdto.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type MessageId = string | Array; + +export const MarkAs = { + Read: "read", + Seen: "seen", + Unread: "unread", + Unseen: "unseen", +} as const; +export type MarkAs = ClosedEnum; + +export type MessageMarkAsRequestDto = { + messageId: string | Array; + markAs: MarkAs; +}; + +/** @internal */ +export const MessageId$inboundSchema: z.ZodType< + MessageId, + z.ZodTypeDef, + unknown +> = z.union([z.string(), z.array(z.string())]); + +/** @internal */ +export type MessageId$Outbound = string | Array; + +/** @internal */ +export const MessageId$outboundSchema: z.ZodType< + MessageId$Outbound, + z.ZodTypeDef, + MessageId +> = z.union([z.string(), z.array(z.string())]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageId$ { + /** @deprecated use `MessageId$inboundSchema` instead. */ + export const inboundSchema = MessageId$inboundSchema; + /** @deprecated use `MessageId$outboundSchema` instead. */ + export const outboundSchema = MessageId$outboundSchema; + /** @deprecated use `MessageId$Outbound` instead. */ + export type Outbound = MessageId$Outbound; +} + +export function messageIdToJSON(messageId: MessageId): string { + return JSON.stringify(MessageId$outboundSchema.parse(messageId)); +} + +export function messageIdFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageId$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageId' from JSON`, + ); +} + +/** @internal */ +export const MarkAs$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(MarkAs); + +/** @internal */ +export const MarkAs$outboundSchema: z.ZodNativeEnum = + MarkAs$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MarkAs$ { + /** @deprecated use `MarkAs$inboundSchema` instead. */ + export const inboundSchema = MarkAs$inboundSchema; + /** @deprecated use `MarkAs$outboundSchema` instead. */ + export const outboundSchema = MarkAs$outboundSchema; +} + +/** @internal */ +export const MessageMarkAsRequestDto$inboundSchema: z.ZodType< + MessageMarkAsRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + messageId: z.union([z.string(), z.array(z.string())]), + markAs: MarkAs$inboundSchema, +}); + +/** @internal */ +export type MessageMarkAsRequestDto$Outbound = { + messageId: string | Array; + markAs: string; +}; + +/** @internal */ +export const MessageMarkAsRequestDto$outboundSchema: z.ZodType< + MessageMarkAsRequestDto$Outbound, + z.ZodTypeDef, + MessageMarkAsRequestDto +> = z.object({ + messageId: z.union([z.string(), z.array(z.string())]), + markAs: MarkAs$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageMarkAsRequestDto$ { + /** @deprecated use `MessageMarkAsRequestDto$inboundSchema` instead. */ + export const inboundSchema = MessageMarkAsRequestDto$inboundSchema; + /** @deprecated use `MessageMarkAsRequestDto$outboundSchema` instead. */ + export const outboundSchema = MessageMarkAsRequestDto$outboundSchema; + /** @deprecated use `MessageMarkAsRequestDto$Outbound` instead. */ + export type Outbound = MessageMarkAsRequestDto$Outbound; +} + +export function messageMarkAsRequestDtoToJSON( + messageMarkAsRequestDto: MessageMarkAsRequestDto, +): string { + return JSON.stringify( + MessageMarkAsRequestDto$outboundSchema.parse(messageMarkAsRequestDto), + ); +} + +export function messageMarkAsRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageMarkAsRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageMarkAsRequestDto' from JSON`, + ); +} diff --git a/src/models/components/messageresponsedto.ts b/src/models/components/messageresponsedto.ts new file mode 100644 index 00000000..eae7e2c5 --- /dev/null +++ b/src/models/components/messageresponsedto.ts @@ -0,0 +1,500 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + EmailBlock, + EmailBlock$inboundSchema, + EmailBlock$Outbound, + EmailBlock$outboundSchema, +} from "./emailblock.js"; +import { + MessageCTA, + MessageCTA$inboundSchema, + MessageCTA$Outbound, + MessageCTA$outboundSchema, +} from "./messagecta.js"; +import { + SubscriberResponseDto, + SubscriberResponseDto$inboundSchema, + SubscriberResponseDto$Outbound, + SubscriberResponseDto$outboundSchema, +} from "./subscriberresponsedto.js"; +import { + WorkflowResponse, + WorkflowResponse$inboundSchema, + WorkflowResponse$Outbound, + WorkflowResponse$outboundSchema, +} from "./workflowresponse.js"; + +export type Content = EmailBlock | string; + +export const MessageResponseDtoChannel = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +export type MessageResponseDtoChannel = ClosedEnum< + typeof MessageResponseDtoChannel +>; + +export type FeedId = {}; + +export const MessageResponseDtoStatus = { + Sent: "sent", + Error: "error", + Warning: "warning", +} as const; +export type MessageResponseDtoStatus = ClosedEnum< + typeof MessageResponseDtoStatus +>; + +/** + * The payload that was used to send the notification trigger + */ +export type MessageResponseDtoPayload = {}; + +/** + * Provider specific overrides used when triggering the notification + */ +export type MessageResponseDtoOverrides = {}; + +export type MessageResponseDto = { + id?: string | undefined; + templateId: string; + environmentId: string; + messageTemplateId: string; + organizationId: string; + notificationId: string; + subscriberId: string; + subscriber?: SubscriberResponseDto | undefined; + template?: WorkflowResponse | undefined; + templateIdentifier?: string | undefined; + createdAt: string; + lastSeenDate?: string | undefined; + lastReadDate?: string | undefined; + content: EmailBlock | string; + transactionId: string; + subject?: string | undefined; + channel: MessageResponseDtoChannel; + read: boolean; + seen: boolean; + email?: string | undefined; + phone?: string | undefined; + directWebhookUrl?: string | undefined; + providerId?: string | undefined; + deviceTokens?: Array | undefined; + title?: string | undefined; + cta: MessageCTA; + feedId?: FeedId | null | undefined; + status: MessageResponseDtoStatus; + errorId: string; + errorText: string; + /** + * The payload that was used to send the notification trigger + */ + payload: MessageResponseDtoPayload; + /** + * Provider specific overrides used when triggering the notification + */ + overrides: MessageResponseDtoOverrides; +}; + +/** @internal */ +export const Content$inboundSchema: z.ZodType = + z.union([EmailBlock$inboundSchema, z.string()]); + +/** @internal */ +export type Content$Outbound = EmailBlock$Outbound | string; + +/** @internal */ +export const Content$outboundSchema: z.ZodType< + Content$Outbound, + z.ZodTypeDef, + Content +> = z.union([EmailBlock$outboundSchema, z.string()]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Content$ { + /** @deprecated use `Content$inboundSchema` instead. */ + export const inboundSchema = Content$inboundSchema; + /** @deprecated use `Content$outboundSchema` instead. */ + export const outboundSchema = Content$outboundSchema; + /** @deprecated use `Content$Outbound` instead. */ + export type Outbound = Content$Outbound; +} + +export function contentToJSON(content: Content): string { + return JSON.stringify(Content$outboundSchema.parse(content)); +} + +export function contentFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Content$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Content' from JSON`, + ); +} + +/** @internal */ +export const MessageResponseDtoChannel$inboundSchema: z.ZodNativeEnum< + typeof MessageResponseDtoChannel +> = z.nativeEnum(MessageResponseDtoChannel); + +/** @internal */ +export const MessageResponseDtoChannel$outboundSchema: z.ZodNativeEnum< + typeof MessageResponseDtoChannel +> = MessageResponseDtoChannel$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageResponseDtoChannel$ { + /** @deprecated use `MessageResponseDtoChannel$inboundSchema` instead. */ + export const inboundSchema = MessageResponseDtoChannel$inboundSchema; + /** @deprecated use `MessageResponseDtoChannel$outboundSchema` instead. */ + export const outboundSchema = MessageResponseDtoChannel$outboundSchema; +} + +/** @internal */ +export const FeedId$inboundSchema: z.ZodType = z + .object({}); + +/** @internal */ +export type FeedId$Outbound = {}; + +/** @internal */ +export const FeedId$outboundSchema: z.ZodType< + FeedId$Outbound, + z.ZodTypeDef, + FeedId +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace FeedId$ { + /** @deprecated use `FeedId$inboundSchema` instead. */ + export const inboundSchema = FeedId$inboundSchema; + /** @deprecated use `FeedId$outboundSchema` instead. */ + export const outboundSchema = FeedId$outboundSchema; + /** @deprecated use `FeedId$Outbound` instead. */ + export type Outbound = FeedId$Outbound; +} + +export function feedIdToJSON(feedId: FeedId): string { + return JSON.stringify(FeedId$outboundSchema.parse(feedId)); +} + +export function feedIdFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => FeedId$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'FeedId' from JSON`, + ); +} + +/** @internal */ +export const MessageResponseDtoStatus$inboundSchema: z.ZodNativeEnum< + typeof MessageResponseDtoStatus +> = z.nativeEnum(MessageResponseDtoStatus); + +/** @internal */ +export const MessageResponseDtoStatus$outboundSchema: z.ZodNativeEnum< + typeof MessageResponseDtoStatus +> = MessageResponseDtoStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageResponseDtoStatus$ { + /** @deprecated use `MessageResponseDtoStatus$inboundSchema` instead. */ + export const inboundSchema = MessageResponseDtoStatus$inboundSchema; + /** @deprecated use `MessageResponseDtoStatus$outboundSchema` instead. */ + export const outboundSchema = MessageResponseDtoStatus$outboundSchema; +} + +/** @internal */ +export const MessageResponseDtoPayload$inboundSchema: z.ZodType< + MessageResponseDtoPayload, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type MessageResponseDtoPayload$Outbound = {}; + +/** @internal */ +export const MessageResponseDtoPayload$outboundSchema: z.ZodType< + MessageResponseDtoPayload$Outbound, + z.ZodTypeDef, + MessageResponseDtoPayload +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageResponseDtoPayload$ { + /** @deprecated use `MessageResponseDtoPayload$inboundSchema` instead. */ + export const inboundSchema = MessageResponseDtoPayload$inboundSchema; + /** @deprecated use `MessageResponseDtoPayload$outboundSchema` instead. */ + export const outboundSchema = MessageResponseDtoPayload$outboundSchema; + /** @deprecated use `MessageResponseDtoPayload$Outbound` instead. */ + export type Outbound = MessageResponseDtoPayload$Outbound; +} + +export function messageResponseDtoPayloadToJSON( + messageResponseDtoPayload: MessageResponseDtoPayload, +): string { + return JSON.stringify( + MessageResponseDtoPayload$outboundSchema.parse(messageResponseDtoPayload), + ); +} + +export function messageResponseDtoPayloadFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageResponseDtoPayload$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageResponseDtoPayload' from JSON`, + ); +} + +/** @internal */ +export const MessageResponseDtoOverrides$inboundSchema: z.ZodType< + MessageResponseDtoOverrides, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type MessageResponseDtoOverrides$Outbound = {}; + +/** @internal */ +export const MessageResponseDtoOverrides$outboundSchema: z.ZodType< + MessageResponseDtoOverrides$Outbound, + z.ZodTypeDef, + MessageResponseDtoOverrides +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageResponseDtoOverrides$ { + /** @deprecated use `MessageResponseDtoOverrides$inboundSchema` instead. */ + export const inboundSchema = MessageResponseDtoOverrides$inboundSchema; + /** @deprecated use `MessageResponseDtoOverrides$outboundSchema` instead. */ + export const outboundSchema = MessageResponseDtoOverrides$outboundSchema; + /** @deprecated use `MessageResponseDtoOverrides$Outbound` instead. */ + export type Outbound = MessageResponseDtoOverrides$Outbound; +} + +export function messageResponseDtoOverridesToJSON( + messageResponseDtoOverrides: MessageResponseDtoOverrides, +): string { + return JSON.stringify( + MessageResponseDtoOverrides$outboundSchema.parse( + messageResponseDtoOverrides, + ), + ); +} + +export function messageResponseDtoOverridesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageResponseDtoOverrides$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageResponseDtoOverrides' from JSON`, + ); +} + +/** @internal */ +export const MessageResponseDto$inboundSchema: z.ZodType< + MessageResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + _templateId: z.string(), + _environmentId: z.string(), + _messageTemplateId: z.string(), + _organizationId: z.string(), + _notificationId: z.string(), + _subscriberId: z.string(), + subscriber: SubscriberResponseDto$inboundSchema.optional(), + template: WorkflowResponse$inboundSchema.optional(), + templateIdentifier: z.string().optional(), + createdAt: z.string(), + lastSeenDate: z.string().optional(), + lastReadDate: z.string().optional(), + content: z.union([EmailBlock$inboundSchema, z.string()]), + transactionId: z.string(), + subject: z.string().optional(), + channel: MessageResponseDtoChannel$inboundSchema, + read: z.boolean(), + seen: z.boolean(), + email: z.string().optional(), + phone: z.string().optional(), + directWebhookUrl: z.string().optional(), + providerId: z.string().optional(), + deviceTokens: z.array(z.string()).optional(), + title: z.string().optional(), + cta: MessageCTA$inboundSchema, + _feedId: z.nullable(z.lazy(() => FeedId$inboundSchema)).optional(), + status: MessageResponseDtoStatus$inboundSchema, + errorId: z.string(), + errorText: z.string(), + payload: z.lazy(() => MessageResponseDtoPayload$inboundSchema), + overrides: z.lazy(() => MessageResponseDtoOverrides$inboundSchema), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_templateId": "templateId", + "_environmentId": "environmentId", + "_messageTemplateId": "messageTemplateId", + "_organizationId": "organizationId", + "_notificationId": "notificationId", + "_subscriberId": "subscriberId", + "_feedId": "feedId", + }); +}); + +/** @internal */ +export type MessageResponseDto$Outbound = { + _id?: string | undefined; + _templateId: string; + _environmentId: string; + _messageTemplateId: string; + _organizationId: string; + _notificationId: string; + _subscriberId: string; + subscriber?: SubscriberResponseDto$Outbound | undefined; + template?: WorkflowResponse$Outbound | undefined; + templateIdentifier?: string | undefined; + createdAt: string; + lastSeenDate?: string | undefined; + lastReadDate?: string | undefined; + content: EmailBlock$Outbound | string; + transactionId: string; + subject?: string | undefined; + channel: string; + read: boolean; + seen: boolean; + email?: string | undefined; + phone?: string | undefined; + directWebhookUrl?: string | undefined; + providerId?: string | undefined; + deviceTokens?: Array | undefined; + title?: string | undefined; + cta: MessageCTA$Outbound; + _feedId?: FeedId$Outbound | null | undefined; + status: string; + errorId: string; + errorText: string; + payload: MessageResponseDtoPayload$Outbound; + overrides: MessageResponseDtoOverrides$Outbound; +}; + +/** @internal */ +export const MessageResponseDto$outboundSchema: z.ZodType< + MessageResponseDto$Outbound, + z.ZodTypeDef, + MessageResponseDto +> = z.object({ + id: z.string().optional(), + templateId: z.string(), + environmentId: z.string(), + messageTemplateId: z.string(), + organizationId: z.string(), + notificationId: z.string(), + subscriberId: z.string(), + subscriber: SubscriberResponseDto$outboundSchema.optional(), + template: WorkflowResponse$outboundSchema.optional(), + templateIdentifier: z.string().optional(), + createdAt: z.string(), + lastSeenDate: z.string().optional(), + lastReadDate: z.string().optional(), + content: z.union([EmailBlock$outboundSchema, z.string()]), + transactionId: z.string(), + subject: z.string().optional(), + channel: MessageResponseDtoChannel$outboundSchema, + read: z.boolean(), + seen: z.boolean(), + email: z.string().optional(), + phone: z.string().optional(), + directWebhookUrl: z.string().optional(), + providerId: z.string().optional(), + deviceTokens: z.array(z.string()).optional(), + title: z.string().optional(), + cta: MessageCTA$outboundSchema, + feedId: z.nullable(z.lazy(() => FeedId$outboundSchema)).optional(), + status: MessageResponseDtoStatus$outboundSchema, + errorId: z.string(), + errorText: z.string(), + payload: z.lazy(() => MessageResponseDtoPayload$outboundSchema), + overrides: z.lazy(() => MessageResponseDtoOverrides$outboundSchema), +}).transform((v) => { + return remap$(v, { + id: "_id", + templateId: "_templateId", + environmentId: "_environmentId", + messageTemplateId: "_messageTemplateId", + organizationId: "_organizationId", + notificationId: "_notificationId", + subscriberId: "_subscriberId", + feedId: "_feedId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageResponseDto$ { + /** @deprecated use `MessageResponseDto$inboundSchema` instead. */ + export const inboundSchema = MessageResponseDto$inboundSchema; + /** @deprecated use `MessageResponseDto$outboundSchema` instead. */ + export const outboundSchema = MessageResponseDto$outboundSchema; + /** @deprecated use `MessageResponseDto$Outbound` instead. */ + export type Outbound = MessageResponseDto$Outbound; +} + +export function messageResponseDtoToJSON( + messageResponseDto: MessageResponseDto, +): string { + return JSON.stringify( + MessageResponseDto$outboundSchema.parse(messageResponseDto), + ); +} + +export function messageResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageResponseDto' from JSON`, + ); +} diff --git a/src/models/components/messagetemplate.ts b/src/models/components/messagetemplate.ts new file mode 100644 index 00000000..eff05e96 --- /dev/null +++ b/src/models/components/messagetemplate.ts @@ -0,0 +1,56 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type MessageTemplate = {}; + +/** @internal */ +export const MessageTemplate$inboundSchema: z.ZodType< + MessageTemplate, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type MessageTemplate$Outbound = {}; + +/** @internal */ +export const MessageTemplate$outboundSchema: z.ZodType< + MessageTemplate$Outbound, + z.ZodTypeDef, + MessageTemplate +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessageTemplate$ { + /** @deprecated use `MessageTemplate$inboundSchema` instead. */ + export const inboundSchema = MessageTemplate$inboundSchema; + /** @deprecated use `MessageTemplate$outboundSchema` instead. */ + export const outboundSchema = MessageTemplate$outboundSchema; + /** @deprecated use `MessageTemplate$Outbound` instead. */ + export type Outbound = MessageTemplate$Outbound; +} + +export function messageTemplateToJSON( + messageTemplate: MessageTemplate, +): string { + return JSON.stringify(MessageTemplate$outboundSchema.parse(messageTemplate)); +} + +export function messageTemplateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => MessageTemplate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessageTemplate' from JSON`, + ); +} diff --git a/src/models/components/notificationgroup.ts b/src/models/components/notificationgroup.ts new file mode 100644 index 00000000..dfc602f5 --- /dev/null +++ b/src/models/components/notificationgroup.ts @@ -0,0 +1,97 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationGroup = { + id?: string | undefined; + name: string; + environmentId: string; + organizationId: string; + parentId?: string | undefined; +}; + +/** @internal */ +export const NotificationGroup$inboundSchema: z.ZodType< + NotificationGroup, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + name: z.string(), + _environmentId: z.string(), + _organizationId: z.string(), + _parentId: z.string().optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_environmentId": "environmentId", + "_organizationId": "organizationId", + "_parentId": "parentId", + }); +}); + +/** @internal */ +export type NotificationGroup$Outbound = { + _id?: string | undefined; + name: string; + _environmentId: string; + _organizationId: string; + _parentId?: string | undefined; +}; + +/** @internal */ +export const NotificationGroup$outboundSchema: z.ZodType< + NotificationGroup$Outbound, + z.ZodTypeDef, + NotificationGroup +> = z.object({ + id: z.string().optional(), + name: z.string(), + environmentId: z.string(), + organizationId: z.string(), + parentId: z.string().optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + environmentId: "_environmentId", + organizationId: "_organizationId", + parentId: "_parentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroup$ { + /** @deprecated use `NotificationGroup$inboundSchema` instead. */ + export const inboundSchema = NotificationGroup$inboundSchema; + /** @deprecated use `NotificationGroup$outboundSchema` instead. */ + export const outboundSchema = NotificationGroup$outboundSchema; + /** @deprecated use `NotificationGroup$Outbound` instead. */ + export type Outbound = NotificationGroup$Outbound; +} + +export function notificationGroupToJSON( + notificationGroup: NotificationGroup, +): string { + return JSON.stringify( + NotificationGroup$outboundSchema.parse(notificationGroup), + ); +} + +export function notificationGroupFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationGroup$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationGroup' from JSON`, + ); +} diff --git a/src/models/components/notificationgroupresponsedto.ts b/src/models/components/notificationgroupresponsedto.ts new file mode 100644 index 00000000..39dd84f4 --- /dev/null +++ b/src/models/components/notificationgroupresponsedto.ts @@ -0,0 +1,99 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationGroupResponseDto = { + id?: string | undefined; + name: string; + environmentId: string; + organizationId: string; + parentId?: string | undefined; +}; + +/** @internal */ +export const NotificationGroupResponseDto$inboundSchema: z.ZodType< + NotificationGroupResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + name: z.string(), + _environmentId: z.string(), + _organizationId: z.string(), + _parentId: z.string().optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_environmentId": "environmentId", + "_organizationId": "organizationId", + "_parentId": "parentId", + }); +}); + +/** @internal */ +export type NotificationGroupResponseDto$Outbound = { + _id?: string | undefined; + name: string; + _environmentId: string; + _organizationId: string; + _parentId?: string | undefined; +}; + +/** @internal */ +export const NotificationGroupResponseDto$outboundSchema: z.ZodType< + NotificationGroupResponseDto$Outbound, + z.ZodTypeDef, + NotificationGroupResponseDto +> = z.object({ + id: z.string().optional(), + name: z.string(), + environmentId: z.string(), + organizationId: z.string(), + parentId: z.string().optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + environmentId: "_environmentId", + organizationId: "_organizationId", + parentId: "_parentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupResponseDto$ { + /** @deprecated use `NotificationGroupResponseDto$inboundSchema` instead. */ + export const inboundSchema = NotificationGroupResponseDto$inboundSchema; + /** @deprecated use `NotificationGroupResponseDto$outboundSchema` instead. */ + export const outboundSchema = NotificationGroupResponseDto$outboundSchema; + /** @deprecated use `NotificationGroupResponseDto$Outbound` instead. */ + export type Outbound = NotificationGroupResponseDto$Outbound; +} + +export function notificationGroupResponseDtoToJSON( + notificationGroupResponseDto: NotificationGroupResponseDto, +): string { + return JSON.stringify( + NotificationGroupResponseDto$outboundSchema.parse( + notificationGroupResponseDto, + ), + ); +} + +export function notificationGroupResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationGroupResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupResponseDto' from JSON`, + ); +} diff --git a/src/models/components/notificationstep.ts b/src/models/components/notificationstep.ts new file mode 100644 index 00000000..701311fd --- /dev/null +++ b/src/models/components/notificationstep.ts @@ -0,0 +1,341 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + DelayRegularMetadata, + DelayRegularMetadata$inboundSchema, + DelayRegularMetadata$Outbound, + DelayRegularMetadata$outboundSchema, +} from "./delayregularmetadata.js"; +import { + DelayScheduledMetadata, + DelayScheduledMetadata$inboundSchema, + DelayScheduledMetadata$Outbound, + DelayScheduledMetadata$outboundSchema, +} from "./delayscheduledmetadata.js"; +import { + DigestRegularMetadata, + DigestRegularMetadata$inboundSchema, + DigestRegularMetadata$Outbound, + DigestRegularMetadata$outboundSchema, +} from "./digestregularmetadata.js"; +import { + DigestTimedMetadata, + DigestTimedMetadata$inboundSchema, + DigestTimedMetadata$Outbound, + DigestTimedMetadata$outboundSchema, +} from "./digesttimedmetadata.js"; +import { + MessageTemplate, + MessageTemplate$inboundSchema, + MessageTemplate$Outbound, + MessageTemplate$outboundSchema, +} from "./messagetemplate.js"; +import { + NotificationStepVariant, + NotificationStepVariant$inboundSchema, + NotificationStepVariant$Outbound, + NotificationStepVariant$outboundSchema, +} from "./notificationstepvariant.js"; +import { + StepFilter, + StepFilter$inboundSchema, + StepFilter$Outbound, + StepFilter$outboundSchema, +} from "./stepfilter.js"; + +export type ParentId = {}; + +export type Metadata = + | DelayScheduledMetadata + | DelayRegularMetadata + | DigestTimedMetadata + | DigestRegularMetadata; + +export type ReplyCallback = {}; + +export type NotificationStep = { + id?: string | undefined; + uuid?: string | undefined; + name?: string | undefined; + templateId?: string | undefined; + active?: boolean | undefined; + shouldStopOnFail?: boolean | undefined; + template?: MessageTemplate | undefined; + filters?: Array | undefined; + parentId?: ParentId | undefined; + metadata?: + | DelayScheduledMetadata + | DelayRegularMetadata + | DigestTimedMetadata + | DigestRegularMetadata + | undefined; + replyCallback?: ReplyCallback | undefined; + variants?: NotificationStepVariant | undefined; +}; + +/** @internal */ +export const ParentId$inboundSchema: z.ZodType< + ParentId, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type ParentId$Outbound = {}; + +/** @internal */ +export const ParentId$outboundSchema: z.ZodType< + ParentId$Outbound, + z.ZodTypeDef, + ParentId +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ParentId$ { + /** @deprecated use `ParentId$inboundSchema` instead. */ + export const inboundSchema = ParentId$inboundSchema; + /** @deprecated use `ParentId$outboundSchema` instead. */ + export const outboundSchema = ParentId$outboundSchema; + /** @deprecated use `ParentId$Outbound` instead. */ + export type Outbound = ParentId$Outbound; +} + +export function parentIdToJSON(parentId: ParentId): string { + return JSON.stringify(ParentId$outboundSchema.parse(parentId)); +} + +export function parentIdFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParentId$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParentId' from JSON`, + ); +} + +/** @internal */ +export const Metadata$inboundSchema: z.ZodType< + Metadata, + z.ZodTypeDef, + unknown +> = z.union([ + DelayScheduledMetadata$inboundSchema, + DelayRegularMetadata$inboundSchema, + DigestTimedMetadata$inboundSchema, + DigestRegularMetadata$inboundSchema, +]); + +/** @internal */ +export type Metadata$Outbound = + | DelayScheduledMetadata$Outbound + | DelayRegularMetadata$Outbound + | DigestTimedMetadata$Outbound + | DigestRegularMetadata$Outbound; + +/** @internal */ +export const Metadata$outboundSchema: z.ZodType< + Metadata$Outbound, + z.ZodTypeDef, + Metadata +> = z.union([ + DelayScheduledMetadata$outboundSchema, + DelayRegularMetadata$outboundSchema, + DigestTimedMetadata$outboundSchema, + DigestRegularMetadata$outboundSchema, +]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Metadata$ { + /** @deprecated use `Metadata$inboundSchema` instead. */ + export const inboundSchema = Metadata$inboundSchema; + /** @deprecated use `Metadata$outboundSchema` instead. */ + export const outboundSchema = Metadata$outboundSchema; + /** @deprecated use `Metadata$Outbound` instead. */ + export type Outbound = Metadata$Outbound; +} + +export function metadataToJSON(metadata: Metadata): string { + return JSON.stringify(Metadata$outboundSchema.parse(metadata)); +} + +export function metadataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Metadata$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Metadata' from JSON`, + ); +} + +/** @internal */ +export const ReplyCallback$inboundSchema: z.ZodType< + ReplyCallback, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type ReplyCallback$Outbound = {}; + +/** @internal */ +export const ReplyCallback$outboundSchema: z.ZodType< + ReplyCallback$Outbound, + z.ZodTypeDef, + ReplyCallback +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ReplyCallback$ { + /** @deprecated use `ReplyCallback$inboundSchema` instead. */ + export const inboundSchema = ReplyCallback$inboundSchema; + /** @deprecated use `ReplyCallback$outboundSchema` instead. */ + export const outboundSchema = ReplyCallback$outboundSchema; + /** @deprecated use `ReplyCallback$Outbound` instead. */ + export type Outbound = ReplyCallback$Outbound; +} + +export function replyCallbackToJSON(replyCallback: ReplyCallback): string { + return JSON.stringify(ReplyCallback$outboundSchema.parse(replyCallback)); +} + +export function replyCallbackFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ReplyCallback$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ReplyCallback' from JSON`, + ); +} + +/** @internal */ +export const NotificationStep$inboundSchema: z.ZodType< + NotificationStep, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + uuid: z.string().optional(), + name: z.string().optional(), + _templateId: z.string().optional(), + active: z.boolean().optional(), + shouldStopOnFail: z.boolean().optional(), + template: MessageTemplate$inboundSchema.optional(), + filters: z.array(StepFilter$inboundSchema).optional(), + _parentId: z.lazy(() => ParentId$inboundSchema).optional(), + metadata: z.union([ + DelayScheduledMetadata$inboundSchema, + DelayRegularMetadata$inboundSchema, + DigestTimedMetadata$inboundSchema, + DigestRegularMetadata$inboundSchema, + ]).optional(), + replyCallback: z.lazy(() => ReplyCallback$inboundSchema).optional(), + variants: NotificationStepVariant$inboundSchema.optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_templateId": "templateId", + "_parentId": "parentId", + }); +}); + +/** @internal */ +export type NotificationStep$Outbound = { + _id?: string | undefined; + uuid?: string | undefined; + name?: string | undefined; + _templateId?: string | undefined; + active?: boolean | undefined; + shouldStopOnFail?: boolean | undefined; + template?: MessageTemplate$Outbound | undefined; + filters?: Array | undefined; + _parentId?: ParentId$Outbound | undefined; + metadata?: + | DelayScheduledMetadata$Outbound + | DelayRegularMetadata$Outbound + | DigestTimedMetadata$Outbound + | DigestRegularMetadata$Outbound + | undefined; + replyCallback?: ReplyCallback$Outbound | undefined; + variants?: NotificationStepVariant$Outbound | undefined; +}; + +/** @internal */ +export const NotificationStep$outboundSchema: z.ZodType< + NotificationStep$Outbound, + z.ZodTypeDef, + NotificationStep +> = z.object({ + id: z.string().optional(), + uuid: z.string().optional(), + name: z.string().optional(), + templateId: z.string().optional(), + active: z.boolean().optional(), + shouldStopOnFail: z.boolean().optional(), + template: MessageTemplate$outboundSchema.optional(), + filters: z.array(StepFilter$outboundSchema).optional(), + parentId: z.lazy(() => ParentId$outboundSchema).optional(), + metadata: z.union([ + DelayScheduledMetadata$outboundSchema, + DelayRegularMetadata$outboundSchema, + DigestTimedMetadata$outboundSchema, + DigestRegularMetadata$outboundSchema, + ]).optional(), + replyCallback: z.lazy(() => ReplyCallback$outboundSchema).optional(), + variants: NotificationStepVariant$outboundSchema.optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + templateId: "_templateId", + parentId: "_parentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationStep$ { + /** @deprecated use `NotificationStep$inboundSchema` instead. */ + export const inboundSchema = NotificationStep$inboundSchema; + /** @deprecated use `NotificationStep$outboundSchema` instead. */ + export const outboundSchema = NotificationStep$outboundSchema; + /** @deprecated use `NotificationStep$Outbound` instead. */ + export type Outbound = NotificationStep$Outbound; +} + +export function notificationStepToJSON( + notificationStep: NotificationStep, +): string { + return JSON.stringify( + NotificationStep$outboundSchema.parse(notificationStep), + ); +} + +export function notificationStepFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationStep$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationStep' from JSON`, + ); +} diff --git a/src/models/components/notificationstepvariant.ts b/src/models/components/notificationstepvariant.ts new file mode 100644 index 00000000..630a6ba1 --- /dev/null +++ b/src/models/components/notificationstepvariant.ts @@ -0,0 +1,358 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + DelayRegularMetadata, + DelayRegularMetadata$inboundSchema, + DelayRegularMetadata$Outbound, + DelayRegularMetadata$outboundSchema, +} from "./delayregularmetadata.js"; +import { + DelayScheduledMetadata, + DelayScheduledMetadata$inboundSchema, + DelayScheduledMetadata$Outbound, + DelayScheduledMetadata$outboundSchema, +} from "./delayscheduledmetadata.js"; +import { + DigestRegularMetadata, + DigestRegularMetadata$inboundSchema, + DigestRegularMetadata$Outbound, + DigestRegularMetadata$outboundSchema, +} from "./digestregularmetadata.js"; +import { + DigestTimedMetadata, + DigestTimedMetadata$inboundSchema, + DigestTimedMetadata$Outbound, + DigestTimedMetadata$outboundSchema, +} from "./digesttimedmetadata.js"; +import { + MessageTemplate, + MessageTemplate$inboundSchema, + MessageTemplate$Outbound, + MessageTemplate$outboundSchema, +} from "./messagetemplate.js"; +import { + StepFilter, + StepFilter$inboundSchema, + StepFilter$Outbound, + StepFilter$outboundSchema, +} from "./stepfilter.js"; + +export type NotificationStepVariantParentId = {}; + +export type NotificationStepVariantMetadata = + | DelayScheduledMetadata + | DelayRegularMetadata + | DigestTimedMetadata + | DigestRegularMetadata; + +export type NotificationStepVariantReplyCallback = {}; + +export type NotificationStepVariant = { + id?: string | undefined; + uuid?: string | undefined; + name?: string | undefined; + templateId?: string | undefined; + active?: boolean | undefined; + shouldStopOnFail?: boolean | undefined; + template?: MessageTemplate | undefined; + filters?: Array | undefined; + parentId?: NotificationStepVariantParentId | undefined; + metadata?: + | DelayScheduledMetadata + | DelayRegularMetadata + | DigestTimedMetadata + | DigestRegularMetadata + | undefined; + replyCallback?: NotificationStepVariantReplyCallback | undefined; +}; + +/** @internal */ +export const NotificationStepVariantParentId$inboundSchema: z.ZodType< + NotificationStepVariantParentId, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type NotificationStepVariantParentId$Outbound = {}; + +/** @internal */ +export const NotificationStepVariantParentId$outboundSchema: z.ZodType< + NotificationStepVariantParentId$Outbound, + z.ZodTypeDef, + NotificationStepVariantParentId +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationStepVariantParentId$ { + /** @deprecated use `NotificationStepVariantParentId$inboundSchema` instead. */ + export const inboundSchema = NotificationStepVariantParentId$inboundSchema; + /** @deprecated use `NotificationStepVariantParentId$outboundSchema` instead. */ + export const outboundSchema = NotificationStepVariantParentId$outboundSchema; + /** @deprecated use `NotificationStepVariantParentId$Outbound` instead. */ + export type Outbound = NotificationStepVariantParentId$Outbound; +} + +export function notificationStepVariantParentIdToJSON( + notificationStepVariantParentId: NotificationStepVariantParentId, +): string { + return JSON.stringify( + NotificationStepVariantParentId$outboundSchema.parse( + notificationStepVariantParentId, + ), + ); +} + +export function notificationStepVariantParentIdFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationStepVariantParentId$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationStepVariantParentId' from JSON`, + ); +} + +/** @internal */ +export const NotificationStepVariantMetadata$inboundSchema: z.ZodType< + NotificationStepVariantMetadata, + z.ZodTypeDef, + unknown +> = z.union([ + DelayScheduledMetadata$inboundSchema, + DelayRegularMetadata$inboundSchema, + DigestTimedMetadata$inboundSchema, + DigestRegularMetadata$inboundSchema, +]); + +/** @internal */ +export type NotificationStepVariantMetadata$Outbound = + | DelayScheduledMetadata$Outbound + | DelayRegularMetadata$Outbound + | DigestTimedMetadata$Outbound + | DigestRegularMetadata$Outbound; + +/** @internal */ +export const NotificationStepVariantMetadata$outboundSchema: z.ZodType< + NotificationStepVariantMetadata$Outbound, + z.ZodTypeDef, + NotificationStepVariantMetadata +> = z.union([ + DelayScheduledMetadata$outboundSchema, + DelayRegularMetadata$outboundSchema, + DigestTimedMetadata$outboundSchema, + DigestRegularMetadata$outboundSchema, +]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationStepVariantMetadata$ { + /** @deprecated use `NotificationStepVariantMetadata$inboundSchema` instead. */ + export const inboundSchema = NotificationStepVariantMetadata$inboundSchema; + /** @deprecated use `NotificationStepVariantMetadata$outboundSchema` instead. */ + export const outboundSchema = NotificationStepVariantMetadata$outboundSchema; + /** @deprecated use `NotificationStepVariantMetadata$Outbound` instead. */ + export type Outbound = NotificationStepVariantMetadata$Outbound; +} + +export function notificationStepVariantMetadataToJSON( + notificationStepVariantMetadata: NotificationStepVariantMetadata, +): string { + return JSON.stringify( + NotificationStepVariantMetadata$outboundSchema.parse( + notificationStepVariantMetadata, + ), + ); +} + +export function notificationStepVariantMetadataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationStepVariantMetadata$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationStepVariantMetadata' from JSON`, + ); +} + +/** @internal */ +export const NotificationStepVariantReplyCallback$inboundSchema: z.ZodType< + NotificationStepVariantReplyCallback, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type NotificationStepVariantReplyCallback$Outbound = {}; + +/** @internal */ +export const NotificationStepVariantReplyCallback$outboundSchema: z.ZodType< + NotificationStepVariantReplyCallback$Outbound, + z.ZodTypeDef, + NotificationStepVariantReplyCallback +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationStepVariantReplyCallback$ { + /** @deprecated use `NotificationStepVariantReplyCallback$inboundSchema` instead. */ + export const inboundSchema = + NotificationStepVariantReplyCallback$inboundSchema; + /** @deprecated use `NotificationStepVariantReplyCallback$outboundSchema` instead. */ + export const outboundSchema = + NotificationStepVariantReplyCallback$outboundSchema; + /** @deprecated use `NotificationStepVariantReplyCallback$Outbound` instead. */ + export type Outbound = NotificationStepVariantReplyCallback$Outbound; +} + +export function notificationStepVariantReplyCallbackToJSON( + notificationStepVariantReplyCallback: NotificationStepVariantReplyCallback, +): string { + return JSON.stringify( + NotificationStepVariantReplyCallback$outboundSchema.parse( + notificationStepVariantReplyCallback, + ), + ); +} + +export function notificationStepVariantReplyCallbackFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + NotificationStepVariantReplyCallback$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationStepVariantReplyCallback' from JSON`, + ); +} + +/** @internal */ +export const NotificationStepVariant$inboundSchema: z.ZodType< + NotificationStepVariant, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + uuid: z.string().optional(), + name: z.string().optional(), + _templateId: z.string().optional(), + active: z.boolean().optional(), + shouldStopOnFail: z.boolean().optional(), + template: MessageTemplate$inboundSchema.optional(), + filters: z.array(StepFilter$inboundSchema).optional(), + _parentId: z.lazy(() => NotificationStepVariantParentId$inboundSchema) + .optional(), + metadata: z.union([ + DelayScheduledMetadata$inboundSchema, + DelayRegularMetadata$inboundSchema, + DigestTimedMetadata$inboundSchema, + DigestRegularMetadata$inboundSchema, + ]).optional(), + replyCallback: z.lazy(() => + NotificationStepVariantReplyCallback$inboundSchema + ).optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_templateId": "templateId", + "_parentId": "parentId", + }); +}); + +/** @internal */ +export type NotificationStepVariant$Outbound = { + _id?: string | undefined; + uuid?: string | undefined; + name?: string | undefined; + _templateId?: string | undefined; + active?: boolean | undefined; + shouldStopOnFail?: boolean | undefined; + template?: MessageTemplate$Outbound | undefined; + filters?: Array | undefined; + _parentId?: NotificationStepVariantParentId$Outbound | undefined; + metadata?: + | DelayScheduledMetadata$Outbound + | DelayRegularMetadata$Outbound + | DigestTimedMetadata$Outbound + | DigestRegularMetadata$Outbound + | undefined; + replyCallback?: NotificationStepVariantReplyCallback$Outbound | undefined; +}; + +/** @internal */ +export const NotificationStepVariant$outboundSchema: z.ZodType< + NotificationStepVariant$Outbound, + z.ZodTypeDef, + NotificationStepVariant +> = z.object({ + id: z.string().optional(), + uuid: z.string().optional(), + name: z.string().optional(), + templateId: z.string().optional(), + active: z.boolean().optional(), + shouldStopOnFail: z.boolean().optional(), + template: MessageTemplate$outboundSchema.optional(), + filters: z.array(StepFilter$outboundSchema).optional(), + parentId: z.lazy(() => NotificationStepVariantParentId$outboundSchema) + .optional(), + metadata: z.union([ + DelayScheduledMetadata$outboundSchema, + DelayRegularMetadata$outboundSchema, + DigestTimedMetadata$outboundSchema, + DigestRegularMetadata$outboundSchema, + ]).optional(), + replyCallback: z.lazy(() => + NotificationStepVariantReplyCallback$outboundSchema + ).optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + templateId: "_templateId", + parentId: "_parentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationStepVariant$ { + /** @deprecated use `NotificationStepVariant$inboundSchema` instead. */ + export const inboundSchema = NotificationStepVariant$inboundSchema; + /** @deprecated use `NotificationStepVariant$outboundSchema` instead. */ + export const outboundSchema = NotificationStepVariant$outboundSchema; + /** @deprecated use `NotificationStepVariant$Outbound` instead. */ + export type Outbound = NotificationStepVariant$Outbound; +} + +export function notificationStepVariantToJSON( + notificationStepVariant: NotificationStepVariant, +): string { + return JSON.stringify( + NotificationStepVariant$outboundSchema.parse(notificationStepVariant), + ); +} + +export function notificationStepVariantFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationStepVariant$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationStepVariant' from JSON`, + ); +} diff --git a/src/models/components/notificationtrigger.ts b/src/models/components/notificationtrigger.ts new file mode 100644 index 00000000..60397393 --- /dev/null +++ b/src/models/components/notificationtrigger.ts @@ -0,0 +1,115 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + NotificationTriggerVariable, + NotificationTriggerVariable$inboundSchema, + NotificationTriggerVariable$Outbound, + NotificationTriggerVariable$outboundSchema, +} from "./notificationtriggervariable.js"; + +export const NotificationTriggerType = { + Event: "event", +} as const; +export type NotificationTriggerType = ClosedEnum< + typeof NotificationTriggerType +>; + +export type NotificationTrigger = { + type: NotificationTriggerType; + identifier: string; + variables: Array; + subscriberVariables?: Array | undefined; +}; + +/** @internal */ +export const NotificationTriggerType$inboundSchema: z.ZodNativeEnum< + typeof NotificationTriggerType +> = z.nativeEnum(NotificationTriggerType); + +/** @internal */ +export const NotificationTriggerType$outboundSchema: z.ZodNativeEnum< + typeof NotificationTriggerType +> = NotificationTriggerType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationTriggerType$ { + /** @deprecated use `NotificationTriggerType$inboundSchema` instead. */ + export const inboundSchema = NotificationTriggerType$inboundSchema; + /** @deprecated use `NotificationTriggerType$outboundSchema` instead. */ + export const outboundSchema = NotificationTriggerType$outboundSchema; +} + +/** @internal */ +export const NotificationTrigger$inboundSchema: z.ZodType< + NotificationTrigger, + z.ZodTypeDef, + unknown +> = z.object({ + type: NotificationTriggerType$inboundSchema, + identifier: z.string(), + variables: z.array(NotificationTriggerVariable$inboundSchema), + subscriberVariables: z.array(NotificationTriggerVariable$inboundSchema) + .optional(), +}); + +/** @internal */ +export type NotificationTrigger$Outbound = { + type: string; + identifier: string; + variables: Array; + subscriberVariables?: Array | undefined; +}; + +/** @internal */ +export const NotificationTrigger$outboundSchema: z.ZodType< + NotificationTrigger$Outbound, + z.ZodTypeDef, + NotificationTrigger +> = z.object({ + type: NotificationTriggerType$outboundSchema, + identifier: z.string(), + variables: z.array(NotificationTriggerVariable$outboundSchema), + subscriberVariables: z.array(NotificationTriggerVariable$outboundSchema) + .optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationTrigger$ { + /** @deprecated use `NotificationTrigger$inboundSchema` instead. */ + export const inboundSchema = NotificationTrigger$inboundSchema; + /** @deprecated use `NotificationTrigger$outboundSchema` instead. */ + export const outboundSchema = NotificationTrigger$outboundSchema; + /** @deprecated use `NotificationTrigger$Outbound` instead. */ + export type Outbound = NotificationTrigger$Outbound; +} + +export function notificationTriggerToJSON( + notificationTrigger: NotificationTrigger, +): string { + return JSON.stringify( + NotificationTrigger$outboundSchema.parse(notificationTrigger), + ); +} + +export function notificationTriggerFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationTrigger$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationTrigger' from JSON`, + ); +} diff --git a/src/models/components/notificationtriggervariable.ts b/src/models/components/notificationtriggervariable.ts new file mode 100644 index 00000000..e8961c30 --- /dev/null +++ b/src/models/components/notificationtriggervariable.ts @@ -0,0 +1,68 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationTriggerVariable = { + name: string; +}; + +/** @internal */ +export const NotificationTriggerVariable$inboundSchema: z.ZodType< + NotificationTriggerVariable, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string(), +}); + +/** @internal */ +export type NotificationTriggerVariable$Outbound = { + name: string; +}; + +/** @internal */ +export const NotificationTriggerVariable$outboundSchema: z.ZodType< + NotificationTriggerVariable$Outbound, + z.ZodTypeDef, + NotificationTriggerVariable +> = z.object({ + name: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationTriggerVariable$ { + /** @deprecated use `NotificationTriggerVariable$inboundSchema` instead. */ + export const inboundSchema = NotificationTriggerVariable$inboundSchema; + /** @deprecated use `NotificationTriggerVariable$outboundSchema` instead. */ + export const outboundSchema = NotificationTriggerVariable$outboundSchema; + /** @deprecated use `NotificationTriggerVariable$Outbound` instead. */ + export type Outbound = NotificationTriggerVariable$Outbound; +} + +export function notificationTriggerVariableToJSON( + notificationTriggerVariable: NotificationTriggerVariable, +): string { + return JSON.stringify( + NotificationTriggerVariable$outboundSchema.parse( + notificationTriggerVariable, + ), + ); +} + +export function notificationTriggerVariableFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => NotificationTriggerVariable$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'NotificationTriggerVariable' from JSON`, + ); +} diff --git a/src/models/components/preference.ts b/src/models/components/preference.ts new file mode 100644 index 00000000..bdee77a4 --- /dev/null +++ b/src/models/components/preference.ts @@ -0,0 +1,78 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + PreferenceChannels, + PreferenceChannels$inboundSchema, + PreferenceChannels$Outbound, + PreferenceChannels$outboundSchema, +} from "./preferencechannels.js"; + +export type Preference = { + /** + * Sets if the workflow is fully enabled for all channels or not for the subscriber. + */ + enabled: boolean; + /** + * Subscriber preferences for the different channels regarding this workflow + */ + channels: PreferenceChannels; +}; + +/** @internal */ +export const Preference$inboundSchema: z.ZodType< + Preference, + z.ZodTypeDef, + unknown +> = z.object({ + enabled: z.boolean(), + channels: PreferenceChannels$inboundSchema, +}); + +/** @internal */ +export type Preference$Outbound = { + enabled: boolean; + channels: PreferenceChannels$Outbound; +}; + +/** @internal */ +export const Preference$outboundSchema: z.ZodType< + Preference$Outbound, + z.ZodTypeDef, + Preference +> = z.object({ + enabled: z.boolean(), + channels: PreferenceChannels$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Preference$ { + /** @deprecated use `Preference$inboundSchema` instead. */ + export const inboundSchema = Preference$inboundSchema; + /** @deprecated use `Preference$outboundSchema` instead. */ + export const outboundSchema = Preference$outboundSchema; + /** @deprecated use `Preference$Outbound` instead. */ + export type Outbound = Preference$Outbound; +} + +export function preferenceToJSON(preference: Preference): string { + return JSON.stringify(Preference$outboundSchema.parse(preference)); +} + +export function preferenceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Preference$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Preference' from JSON`, + ); +} diff --git a/src/models/components/preferencechannels.ts b/src/models/components/preferencechannels.ts new file mode 100644 index 00000000..b4022c33 --- /dev/null +++ b/src/models/components/preferencechannels.ts @@ -0,0 +1,91 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type PreferenceChannels = { + email?: boolean | undefined; + sms?: boolean | undefined; + inApp?: boolean | undefined; + chat?: boolean | undefined; + push?: boolean | undefined; +}; + +/** @internal */ +export const PreferenceChannels$inboundSchema: z.ZodType< + PreferenceChannels, + z.ZodTypeDef, + unknown +> = z.object({ + email: z.boolean().optional(), + sms: z.boolean().optional(), + in_app: z.boolean().optional(), + chat: z.boolean().optional(), + push: z.boolean().optional(), +}).transform((v) => { + return remap$(v, { + "in_app": "inApp", + }); +}); + +/** @internal */ +export type PreferenceChannels$Outbound = { + email?: boolean | undefined; + sms?: boolean | undefined; + in_app?: boolean | undefined; + chat?: boolean | undefined; + push?: boolean | undefined; +}; + +/** @internal */ +export const PreferenceChannels$outboundSchema: z.ZodType< + PreferenceChannels$Outbound, + z.ZodTypeDef, + PreferenceChannels +> = z.object({ + email: z.boolean().optional(), + sms: z.boolean().optional(), + inApp: z.boolean().optional(), + chat: z.boolean().optional(), + push: z.boolean().optional(), +}).transform((v) => { + return remap$(v, { + inApp: "in_app", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace PreferenceChannels$ { + /** @deprecated use `PreferenceChannels$inboundSchema` instead. */ + export const inboundSchema = PreferenceChannels$inboundSchema; + /** @deprecated use `PreferenceChannels$outboundSchema` instead. */ + export const outboundSchema = PreferenceChannels$outboundSchema; + /** @deprecated use `PreferenceChannels$Outbound` instead. */ + export type Outbound = PreferenceChannels$Outbound; +} + +export function preferenceChannelsToJSON( + preferenceChannels: PreferenceChannels, +): string { + return JSON.stringify( + PreferenceChannels$outboundSchema.parse(preferenceChannels), + ); +} + +export function preferenceChannelsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PreferenceChannels$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PreferenceChannels' from JSON`, + ); +} diff --git a/src/models/components/removesubscribersrequestdto.ts b/src/models/components/removesubscribersrequestdto.ts new file mode 100644 index 00000000..963a2092 --- /dev/null +++ b/src/models/components/removesubscribersrequestdto.ts @@ -0,0 +1,71 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type RemoveSubscribersRequestDto = { + /** + * List of subscriber identifiers that will be removed to the topic + */ + subscribers: Array; +}; + +/** @internal */ +export const RemoveSubscribersRequestDto$inboundSchema: z.ZodType< + RemoveSubscribersRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + subscribers: z.array(z.string()), +}); + +/** @internal */ +export type RemoveSubscribersRequestDto$Outbound = { + subscribers: Array; +}; + +/** @internal */ +export const RemoveSubscribersRequestDto$outboundSchema: z.ZodType< + RemoveSubscribersRequestDto$Outbound, + z.ZodTypeDef, + RemoveSubscribersRequestDto +> = z.object({ + subscribers: z.array(z.string()), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace RemoveSubscribersRequestDto$ { + /** @deprecated use `RemoveSubscribersRequestDto$inboundSchema` instead. */ + export const inboundSchema = RemoveSubscribersRequestDto$inboundSchema; + /** @deprecated use `RemoveSubscribersRequestDto$outboundSchema` instead. */ + export const outboundSchema = RemoveSubscribersRequestDto$outboundSchema; + /** @deprecated use `RemoveSubscribersRequestDto$Outbound` instead. */ + export type Outbound = RemoveSubscribersRequestDto$Outbound; +} + +export function removeSubscribersRequestDtoToJSON( + removeSubscribersRequestDto: RemoveSubscribersRequestDto, +): string { + return JSON.stringify( + RemoveSubscribersRequestDto$outboundSchema.parse( + removeSubscribersRequestDto, + ), + ); +} + +export function removeSubscribersRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RemoveSubscribersRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RemoveSubscribersRequestDto' from JSON`, + ); +} diff --git a/src/models/components/renametopicrequestdto.ts b/src/models/components/renametopicrequestdto.ts new file mode 100644 index 00000000..fd03c301 --- /dev/null +++ b/src/models/components/renametopicrequestdto.ts @@ -0,0 +1,69 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type RenameTopicRequestDto = { + /** + * User defined custom name and provided by the user to rename the topic. + */ + name: string; +}; + +/** @internal */ +export const RenameTopicRequestDto$inboundSchema: z.ZodType< + RenameTopicRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string(), +}); + +/** @internal */ +export type RenameTopicRequestDto$Outbound = { + name: string; +}; + +/** @internal */ +export const RenameTopicRequestDto$outboundSchema: z.ZodType< + RenameTopicRequestDto$Outbound, + z.ZodTypeDef, + RenameTopicRequestDto +> = z.object({ + name: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace RenameTopicRequestDto$ { + /** @deprecated use `RenameTopicRequestDto$inboundSchema` instead. */ + export const inboundSchema = RenameTopicRequestDto$inboundSchema; + /** @deprecated use `RenameTopicRequestDto$outboundSchema` instead. */ + export const outboundSchema = RenameTopicRequestDto$outboundSchema; + /** @deprecated use `RenameTopicRequestDto$Outbound` instead. */ + export type Outbound = RenameTopicRequestDto$Outbound; +} + +export function renameTopicRequestDtoToJSON( + renameTopicRequestDto: RenameTopicRequestDto, +): string { + return JSON.stringify( + RenameTopicRequestDto$outboundSchema.parse(renameTopicRequestDto), + ); +} + +export function renameTopicRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RenameTopicRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RenameTopicRequestDto' from JSON`, + ); +} diff --git a/src/models/components/renametopicresponsedto.ts b/src/models/components/renametopicresponsedto.ts new file mode 100644 index 00000000..b993443b --- /dev/null +++ b/src/models/components/renametopicresponsedto.ts @@ -0,0 +1,99 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type RenameTopicResponseDto = { + id?: string | undefined; + organizationId: string; + environmentId: string; + key: string; + name: string; + subscribers: Array; +}; + +/** @internal */ +export const RenameTopicResponseDto$inboundSchema: z.ZodType< + RenameTopicResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + _organizationId: z.string(), + _environmentId: z.string(), + key: z.string(), + name: z.string(), + subscribers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_organizationId": "organizationId", + "_environmentId": "environmentId", + }); +}); + +/** @internal */ +export type RenameTopicResponseDto$Outbound = { + _id?: string | undefined; + _organizationId: string; + _environmentId: string; + key: string; + name: string; + subscribers: Array; +}; + +/** @internal */ +export const RenameTopicResponseDto$outboundSchema: z.ZodType< + RenameTopicResponseDto$Outbound, + z.ZodTypeDef, + RenameTopicResponseDto +> = z.object({ + id: z.string().optional(), + organizationId: z.string(), + environmentId: z.string(), + key: z.string(), + name: z.string(), + subscribers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + id: "_id", + organizationId: "_organizationId", + environmentId: "_environmentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace RenameTopicResponseDto$ { + /** @deprecated use `RenameTopicResponseDto$inboundSchema` instead. */ + export const inboundSchema = RenameTopicResponseDto$inboundSchema; + /** @deprecated use `RenameTopicResponseDto$outboundSchema` instead. */ + export const outboundSchema = RenameTopicResponseDto$outboundSchema; + /** @deprecated use `RenameTopicResponseDto$Outbound` instead. */ + export type Outbound = RenameTopicResponseDto$Outbound; +} + +export function renameTopicResponseDtoToJSON( + renameTopicResponseDto: RenameTopicResponseDto, +): string { + return JSON.stringify( + RenameTopicResponseDto$outboundSchema.parse(renameTopicResponseDto), + ); +} + +export function renameTopicResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RenameTopicResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RenameTopicResponseDto' from JSON`, + ); +} diff --git a/src/models/components/security.ts b/src/models/components/security.ts new file mode 100644 index 00000000..8000a90c --- /dev/null +++ b/src/models/components/security.ts @@ -0,0 +1,71 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type Security = { + apiKey: string; +}; + +/** @internal */ +export const Security$inboundSchema: z.ZodType< + Security, + z.ZodTypeDef, + unknown +> = z.object({ + "api-key": z.string(), +}).transform((v) => { + return remap$(v, { + "api-key": "apiKey", + }); +}); + +/** @internal */ +export type Security$Outbound = { + "api-key": string; +}; + +/** @internal */ +export const Security$outboundSchema: z.ZodType< + Security$Outbound, + z.ZodTypeDef, + Security +> = z.object({ + apiKey: z.string(), +}).transform((v) => { + return remap$(v, { + apiKey: "api-key", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Security$ { + /** @deprecated use `Security$inboundSchema` instead. */ + export const inboundSchema = Security$inboundSchema; + /** @deprecated use `Security$outboundSchema` instead. */ + export const outboundSchema = Security$outboundSchema; + /** @deprecated use `Security$Outbound` instead. */ + export type Outbound = Security$Outbound; +} + +export function securityToJSON(security: Security): string { + return JSON.stringify(Security$outboundSchema.parse(security)); +} + +export function securityFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Security$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Security' from JSON`, + ); +} diff --git a/src/models/components/stepfilter.ts b/src/models/components/stepfilter.ts new file mode 100644 index 00000000..4ad0efc6 --- /dev/null +++ b/src/models/components/stepfilter.ts @@ -0,0 +1,140 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + FieldFilterPart, + FieldFilterPart$inboundSchema, + FieldFilterPart$Outbound, + FieldFilterPart$outboundSchema, +} from "./fieldfilterpart.js"; + +export const StepFilterType = { + Boolean: "BOOLEAN", + Text: "TEXT", + Date: "DATE", + Number: "NUMBER", + Statement: "STATEMENT", + List: "LIST", + MultiList: "MULTI_LIST", + Group: "GROUP", +} as const; +export type StepFilterType = ClosedEnum; + +export const Value = { + And: "AND", + Or: "OR", +} as const; +export type Value = ClosedEnum; + +export type StepFilter = { + isNegated: boolean; + type: StepFilterType; + value: Value; + children: Array; +}; + +/** @internal */ +export const StepFilterType$inboundSchema: z.ZodNativeEnum< + typeof StepFilterType +> = z.nativeEnum(StepFilterType); + +/** @internal */ +export const StepFilterType$outboundSchema: z.ZodNativeEnum< + typeof StepFilterType +> = StepFilterType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StepFilterType$ { + /** @deprecated use `StepFilterType$inboundSchema` instead. */ + export const inboundSchema = StepFilterType$inboundSchema; + /** @deprecated use `StepFilterType$outboundSchema` instead. */ + export const outboundSchema = StepFilterType$outboundSchema; +} + +/** @internal */ +export const Value$inboundSchema: z.ZodNativeEnum = z.nativeEnum( + Value, +); + +/** @internal */ +export const Value$outboundSchema: z.ZodNativeEnum = + Value$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Value$ { + /** @deprecated use `Value$inboundSchema` instead. */ + export const inboundSchema = Value$inboundSchema; + /** @deprecated use `Value$outboundSchema` instead. */ + export const outboundSchema = Value$outboundSchema; +} + +/** @internal */ +export const StepFilter$inboundSchema: z.ZodType< + StepFilter, + z.ZodTypeDef, + unknown +> = z.object({ + isNegated: z.boolean(), + type: StepFilterType$inboundSchema, + value: Value$inboundSchema, + children: z.array(FieldFilterPart$inboundSchema), +}); + +/** @internal */ +export type StepFilter$Outbound = { + isNegated: boolean; + type: string; + value: string; + children: Array; +}; + +/** @internal */ +export const StepFilter$outboundSchema: z.ZodType< + StepFilter$Outbound, + z.ZodTypeDef, + StepFilter +> = z.object({ + isNegated: z.boolean(), + type: StepFilterType$outboundSchema, + value: Value$outboundSchema, + children: z.array(FieldFilterPart$outboundSchema), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace StepFilter$ { + /** @deprecated use `StepFilter$inboundSchema` instead. */ + export const inboundSchema = StepFilter$inboundSchema; + /** @deprecated use `StepFilter$outboundSchema` instead. */ + export const outboundSchema = StepFilter$outboundSchema; + /** @deprecated use `StepFilter$Outbound` instead. */ + export type Outbound = StepFilter$Outbound; +} + +export function stepFilterToJSON(stepFilter: StepFilter): string { + return JSON.stringify(StepFilter$outboundSchema.parse(stepFilter)); +} + +export function stepFilterFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => StepFilter$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'StepFilter' from JSON`, + ); +} diff --git a/src/models/components/subscriberpayloaddto.ts b/src/models/components/subscriberpayloaddto.ts new file mode 100644 index 00000000..da926aad --- /dev/null +++ b/src/models/components/subscriberpayloaddto.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type Data = {}; + +export type SubscriberPayloadDto = { + /** + * The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems + */ + subscriberId: string; + email?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + phone?: string | undefined; + /** + * An http url to the profile image of your subscriber + */ + avatar?: string | undefined; + locale?: string | undefined; + data?: Data | undefined; + channels?: Array | undefined; +}; + +/** @internal */ +export const Data$inboundSchema: z.ZodType = z + .object({}); + +/** @internal */ +export type Data$Outbound = {}; + +/** @internal */ +export const Data$outboundSchema: z.ZodType = + z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Data$ { + /** @deprecated use `Data$inboundSchema` instead. */ + export const inboundSchema = Data$inboundSchema; + /** @deprecated use `Data$outboundSchema` instead. */ + export const outboundSchema = Data$outboundSchema; + /** @deprecated use `Data$Outbound` instead. */ + export type Outbound = Data$Outbound; +} + +export function dataToJSON(data: Data): string { + return JSON.stringify(Data$outboundSchema.parse(data)); +} + +export function dataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Data$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Data' from JSON`, + ); +} + +/** @internal */ +export const SubscriberPayloadDto$inboundSchema: z.ZodType< + SubscriberPayloadDto, + z.ZodTypeDef, + unknown +> = z.object({ + subscriberId: z.string(), + email: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + data: z.lazy(() => Data$inboundSchema).optional(), + channels: z.array(z.string()).optional(), +}); + +/** @internal */ +export type SubscriberPayloadDto$Outbound = { + subscriberId: string; + email?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + phone?: string | undefined; + avatar?: string | undefined; + locale?: string | undefined; + data?: Data$Outbound | undefined; + channels?: Array | undefined; +}; + +/** @internal */ +export const SubscriberPayloadDto$outboundSchema: z.ZodType< + SubscriberPayloadDto$Outbound, + z.ZodTypeDef, + SubscriberPayloadDto +> = z.object({ + subscriberId: z.string(), + email: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + data: z.lazy(() => Data$outboundSchema).optional(), + channels: z.array(z.string()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscriberPayloadDto$ { + /** @deprecated use `SubscriberPayloadDto$inboundSchema` instead. */ + export const inboundSchema = SubscriberPayloadDto$inboundSchema; + /** @deprecated use `SubscriberPayloadDto$outboundSchema` instead. */ + export const outboundSchema = SubscriberPayloadDto$outboundSchema; + /** @deprecated use `SubscriberPayloadDto$Outbound` instead. */ + export type Outbound = SubscriberPayloadDto$Outbound; +} + +export function subscriberPayloadDtoToJSON( + subscriberPayloadDto: SubscriberPayloadDto, +): string { + return JSON.stringify( + SubscriberPayloadDto$outboundSchema.parse(subscriberPayloadDto), + ); +} + +export function subscriberPayloadDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => SubscriberPayloadDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'SubscriberPayloadDto' from JSON`, + ); +} diff --git a/src/models/components/subscriberresponsedto.ts b/src/models/components/subscriberresponsedto.ts new file mode 100644 index 00000000..24f069d6 --- /dev/null +++ b/src/models/components/subscriberresponsedto.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + ChannelSettings, + ChannelSettings$inboundSchema, + ChannelSettings$Outbound, + ChannelSettings$outboundSchema, +} from "./channelsettings.js"; + +export type SubscriberResponseDto = { + /** + * The internal id novu generated for your subscriber, this is not the subscriberId matching your query. See `subscriberId` for that + */ + id?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + email?: string | undefined; + phone?: string | undefined; + avatar?: string | undefined; + locale?: string | undefined; + /** + * The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems + */ + subscriberId: string; + /** + * Channels settings for subscriber + */ + channels?: Array | undefined; + /** + * Topics that subscriber belongs to + */ + topics?: Array | undefined; + isOnline?: boolean | undefined; + lastOnlineAt?: string | undefined; + organizationId: string; + environmentId: string; + deleted: boolean; + createdAt: string; + updatedAt: string; + v?: number | undefined; +}; + +/** @internal */ +export const SubscriberResponseDto$inboundSchema: z.ZodType< + SubscriberResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + email: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + subscriberId: z.string(), + channels: z.array(ChannelSettings$inboundSchema).optional(), + topics: z.array(z.string()).optional(), + isOnline: z.boolean().optional(), + lastOnlineAt: z.string().optional(), + _organizationId: z.string(), + _environmentId: z.string(), + deleted: z.boolean(), + createdAt: z.string(), + updatedAt: z.string(), + __v: z.number().optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_organizationId": "organizationId", + "_environmentId": "environmentId", + "__v": "v", + }); +}); + +/** @internal */ +export type SubscriberResponseDto$Outbound = { + _id?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + email?: string | undefined; + phone?: string | undefined; + avatar?: string | undefined; + locale?: string | undefined; + subscriberId: string; + channels?: Array | undefined; + topics?: Array | undefined; + isOnline?: boolean | undefined; + lastOnlineAt?: string | undefined; + _organizationId: string; + _environmentId: string; + deleted: boolean; + createdAt: string; + updatedAt: string; + __v?: number | undefined; +}; + +/** @internal */ +export const SubscriberResponseDto$outboundSchema: z.ZodType< + SubscriberResponseDto$Outbound, + z.ZodTypeDef, + SubscriberResponseDto +> = z.object({ + id: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + email: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + subscriberId: z.string(), + channels: z.array(ChannelSettings$outboundSchema).optional(), + topics: z.array(z.string()).optional(), + isOnline: z.boolean().optional(), + lastOnlineAt: z.string().optional(), + organizationId: z.string(), + environmentId: z.string(), + deleted: z.boolean(), + createdAt: z.string(), + updatedAt: z.string(), + v: z.number().optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + organizationId: "_organizationId", + environmentId: "_environmentId", + v: "__v", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscriberResponseDto$ { + /** @deprecated use `SubscriberResponseDto$inboundSchema` instead. */ + export const inboundSchema = SubscriberResponseDto$inboundSchema; + /** @deprecated use `SubscriberResponseDto$outboundSchema` instead. */ + export const outboundSchema = SubscriberResponseDto$outboundSchema; + /** @deprecated use `SubscriberResponseDto$Outbound` instead. */ + export type Outbound = SubscriberResponseDto$Outbound; +} + +export function subscriberResponseDtoToJSON( + subscriberResponseDto: SubscriberResponseDto, +): string { + return JSON.stringify( + SubscriberResponseDto$outboundSchema.parse(subscriberResponseDto), + ); +} + +export function subscriberResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => SubscriberResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'SubscriberResponseDto' from JSON`, + ); +} diff --git a/src/models/components/templateresponse.ts b/src/models/components/templateresponse.ts new file mode 100644 index 00000000..04894f27 --- /dev/null +++ b/src/models/components/templateresponse.ts @@ -0,0 +1,99 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TemplateResponse = { + /** + * Unique identifier of the workflow + */ + id: string; + /** + * Name of the workflow + */ + name: string; + /** + * Critical templates will always be delivered to the end user and should be hidden from the subscriber preferences screen + */ + critical: boolean; + /** + * Triggers are the events that will trigger the workflow. + */ + triggers: Array; +}; + +/** @internal */ +export const TemplateResponse$inboundSchema: z.ZodType< + TemplateResponse, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string(), + name: z.string(), + critical: z.boolean(), + triggers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + "_id": "id", + }); +}); + +/** @internal */ +export type TemplateResponse$Outbound = { + _id: string; + name: string; + critical: boolean; + triggers: Array; +}; + +/** @internal */ +export const TemplateResponse$outboundSchema: z.ZodType< + TemplateResponse$Outbound, + z.ZodTypeDef, + TemplateResponse +> = z.object({ + id: z.string(), + name: z.string(), + critical: z.boolean(), + triggers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + id: "_id", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TemplateResponse$ { + /** @deprecated use `TemplateResponse$inboundSchema` instead. */ + export const inboundSchema = TemplateResponse$inboundSchema; + /** @deprecated use `TemplateResponse$outboundSchema` instead. */ + export const outboundSchema = TemplateResponse$outboundSchema; + /** @deprecated use `TemplateResponse$Outbound` instead. */ + export type Outbound = TemplateResponse$Outbound; +} + +export function templateResponseToJSON( + templateResponse: TemplateResponse, +): string { + return JSON.stringify( + TemplateResponse$outboundSchema.parse(templateResponse), + ); +} + +export function templateResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TemplateResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TemplateResponse' from JSON`, + ); +} diff --git a/src/models/components/tenantpayloaddto.ts b/src/models/components/tenantpayloaddto.ts new file mode 100644 index 00000000..25a1ac9d --- /dev/null +++ b/src/models/components/tenantpayloaddto.ts @@ -0,0 +1,124 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TenantPayloadDtoData = {}; + +export type TenantPayloadDto = { + identifier?: string | undefined; + name?: string | undefined; + data?: TenantPayloadDtoData | undefined; +}; + +/** @internal */ +export const TenantPayloadDtoData$inboundSchema: z.ZodType< + TenantPayloadDtoData, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type TenantPayloadDtoData$Outbound = {}; + +/** @internal */ +export const TenantPayloadDtoData$outboundSchema: z.ZodType< + TenantPayloadDtoData$Outbound, + z.ZodTypeDef, + TenantPayloadDtoData +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TenantPayloadDtoData$ { + /** @deprecated use `TenantPayloadDtoData$inboundSchema` instead. */ + export const inboundSchema = TenantPayloadDtoData$inboundSchema; + /** @deprecated use `TenantPayloadDtoData$outboundSchema` instead. */ + export const outboundSchema = TenantPayloadDtoData$outboundSchema; + /** @deprecated use `TenantPayloadDtoData$Outbound` instead. */ + export type Outbound = TenantPayloadDtoData$Outbound; +} + +export function tenantPayloadDtoDataToJSON( + tenantPayloadDtoData: TenantPayloadDtoData, +): string { + return JSON.stringify( + TenantPayloadDtoData$outboundSchema.parse(tenantPayloadDtoData), + ); +} + +export function tenantPayloadDtoDataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TenantPayloadDtoData$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TenantPayloadDtoData' from JSON`, + ); +} + +/** @internal */ +export const TenantPayloadDto$inboundSchema: z.ZodType< + TenantPayloadDto, + z.ZodTypeDef, + unknown +> = z.object({ + identifier: z.string().optional(), + name: z.string().optional(), + data: z.lazy(() => TenantPayloadDtoData$inboundSchema).optional(), +}); + +/** @internal */ +export type TenantPayloadDto$Outbound = { + identifier?: string | undefined; + name?: string | undefined; + data?: TenantPayloadDtoData$Outbound | undefined; +}; + +/** @internal */ +export const TenantPayloadDto$outboundSchema: z.ZodType< + TenantPayloadDto$Outbound, + z.ZodTypeDef, + TenantPayloadDto +> = z.object({ + identifier: z.string().optional(), + name: z.string().optional(), + data: z.lazy(() => TenantPayloadDtoData$outboundSchema).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TenantPayloadDto$ { + /** @deprecated use `TenantPayloadDto$inboundSchema` instead. */ + export const inboundSchema = TenantPayloadDto$inboundSchema; + /** @deprecated use `TenantPayloadDto$outboundSchema` instead. */ + export const outboundSchema = TenantPayloadDto$outboundSchema; + /** @deprecated use `TenantPayloadDto$Outbound` instead. */ + export type Outbound = TenantPayloadDto$Outbound; +} + +export function tenantPayloadDtoToJSON( + tenantPayloadDto: TenantPayloadDto, +): string { + return JSON.stringify( + TenantPayloadDto$outboundSchema.parse(tenantPayloadDto), + ); +} + +export function tenantPayloadDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TenantPayloadDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TenantPayloadDto' from JSON`, + ); +} diff --git a/src/models/components/timedconfig.ts b/src/models/components/timedconfig.ts new file mode 100644 index 00000000..15330964 --- /dev/null +++ b/src/models/components/timedconfig.ts @@ -0,0 +1,200 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const WeekDays = { + Monday: "monday", + Tuesday: "tuesday", + Wednesday: "wednesday", + Thursday: "thursday", + Friday: "friday", + Saturday: "saturday", + Sunday: "sunday", +} as const; +export type WeekDays = ClosedEnum; + +export const Ordinal = { + One: "1", + Two: "2", + Three: "3", + Four: "4", + Five: "5", + Last: "last", +} as const; +export type Ordinal = ClosedEnum; + +export const OrdinalValue = { + Day: "day", + Weekday: "weekday", + Weekend: "weekend", + Sunday: "sunday", + Monday: "monday", + Tuesday: "tuesday", + Wednesday: "wednesday", + Thursday: "thursday", + Friday: "friday", + Saturday: "saturday", +} as const; +export type OrdinalValue = ClosedEnum; + +export const MonthlyType = { + Each: "each", + On: "on", +} as const; +export type MonthlyType = ClosedEnum; + +export type TimedConfig = { + atTime?: string | undefined; + weekDays?: Array | undefined; + monthDays?: Array | undefined; + ordinal?: Ordinal | undefined; + ordinalValue?: OrdinalValue | undefined; + monthlyType?: MonthlyType | undefined; +}; + +/** @internal */ +export const WeekDays$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(WeekDays); + +/** @internal */ +export const WeekDays$outboundSchema: z.ZodNativeEnum = + WeekDays$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace WeekDays$ { + /** @deprecated use `WeekDays$inboundSchema` instead. */ + export const inboundSchema = WeekDays$inboundSchema; + /** @deprecated use `WeekDays$outboundSchema` instead. */ + export const outboundSchema = WeekDays$outboundSchema; +} + +/** @internal */ +export const Ordinal$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Ordinal); + +/** @internal */ +export const Ordinal$outboundSchema: z.ZodNativeEnum = + Ordinal$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Ordinal$ { + /** @deprecated use `Ordinal$inboundSchema` instead. */ + export const inboundSchema = Ordinal$inboundSchema; + /** @deprecated use `Ordinal$outboundSchema` instead. */ + export const outboundSchema = Ordinal$outboundSchema; +} + +/** @internal */ +export const OrdinalValue$inboundSchema: z.ZodNativeEnum = + z.nativeEnum(OrdinalValue); + +/** @internal */ +export const OrdinalValue$outboundSchema: z.ZodNativeEnum = + OrdinalValue$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace OrdinalValue$ { + /** @deprecated use `OrdinalValue$inboundSchema` instead. */ + export const inboundSchema = OrdinalValue$inboundSchema; + /** @deprecated use `OrdinalValue$outboundSchema` instead. */ + export const outboundSchema = OrdinalValue$outboundSchema; +} + +/** @internal */ +export const MonthlyType$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(MonthlyType); + +/** @internal */ +export const MonthlyType$outboundSchema: z.ZodNativeEnum = + MonthlyType$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MonthlyType$ { + /** @deprecated use `MonthlyType$inboundSchema` instead. */ + export const inboundSchema = MonthlyType$inboundSchema; + /** @deprecated use `MonthlyType$outboundSchema` instead. */ + export const outboundSchema = MonthlyType$outboundSchema; +} + +/** @internal */ +export const TimedConfig$inboundSchema: z.ZodType< + TimedConfig, + z.ZodTypeDef, + unknown +> = z.object({ + atTime: z.string().optional(), + weekDays: z.array(WeekDays$inboundSchema).optional(), + monthDays: z.array(z.string()).optional(), + ordinal: Ordinal$inboundSchema.optional(), + ordinalValue: OrdinalValue$inboundSchema.optional(), + monthlyType: MonthlyType$inboundSchema.optional(), +}); + +/** @internal */ +export type TimedConfig$Outbound = { + atTime?: string | undefined; + weekDays?: Array | undefined; + monthDays?: Array | undefined; + ordinal?: string | undefined; + ordinalValue?: string | undefined; + monthlyType?: string | undefined; +}; + +/** @internal */ +export const TimedConfig$outboundSchema: z.ZodType< + TimedConfig$Outbound, + z.ZodTypeDef, + TimedConfig +> = z.object({ + atTime: z.string().optional(), + weekDays: z.array(WeekDays$outboundSchema).optional(), + monthDays: z.array(z.string()).optional(), + ordinal: Ordinal$outboundSchema.optional(), + ordinalValue: OrdinalValue$outboundSchema.optional(), + monthlyType: MonthlyType$outboundSchema.optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TimedConfig$ { + /** @deprecated use `TimedConfig$inboundSchema` instead. */ + export const inboundSchema = TimedConfig$inboundSchema; + /** @deprecated use `TimedConfig$outboundSchema` instead. */ + export const outboundSchema = TimedConfig$outboundSchema; + /** @deprecated use `TimedConfig$Outbound` instead. */ + export type Outbound = TimedConfig$Outbound; +} + +export function timedConfigToJSON(timedConfig: TimedConfig): string { + return JSON.stringify(TimedConfig$outboundSchema.parse(timedConfig)); +} + +export function timedConfigFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TimedConfig$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TimedConfig' from JSON`, + ); +} diff --git a/src/models/components/topicdto.ts b/src/models/components/topicdto.ts new file mode 100644 index 00000000..277aa072 --- /dev/null +++ b/src/models/components/topicdto.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicDto = { + id?: string | undefined; + organizationId: string; + environmentId: string; + key: string; + name: string; + subscribers: Array; +}; + +/** @internal */ +export const TopicDto$inboundSchema: z.ZodType< + TopicDto, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + _organizationId: z.string(), + _environmentId: z.string(), + key: z.string(), + name: z.string(), + subscribers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_organizationId": "organizationId", + "_environmentId": "environmentId", + }); +}); + +/** @internal */ +export type TopicDto$Outbound = { + _id?: string | undefined; + _organizationId: string; + _environmentId: string; + key: string; + name: string; + subscribers: Array; +}; + +/** @internal */ +export const TopicDto$outboundSchema: z.ZodType< + TopicDto$Outbound, + z.ZodTypeDef, + TopicDto +> = z.object({ + id: z.string().optional(), + organizationId: z.string(), + environmentId: z.string(), + key: z.string(), + name: z.string(), + subscribers: z.array(z.string()), +}).transform((v) => { + return remap$(v, { + id: "_id", + organizationId: "_organizationId", + environmentId: "_environmentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicDto$ { + /** @deprecated use `TopicDto$inboundSchema` instead. */ + export const inboundSchema = TopicDto$inboundSchema; + /** @deprecated use `TopicDto$outboundSchema` instead. */ + export const outboundSchema = TopicDto$outboundSchema; + /** @deprecated use `TopicDto$Outbound` instead. */ + export type Outbound = TopicDto$Outbound; +} + +export function topicDtoToJSON(topicDto: TopicDto): string { + return JSON.stringify(TopicDto$outboundSchema.parse(topicDto)); +} + +export function topicDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TopicDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicDto' from JSON`, + ); +} diff --git a/src/models/components/topicpayloaddto.ts b/src/models/components/topicpayloaddto.ts new file mode 100644 index 00000000..e23a509b --- /dev/null +++ b/src/models/components/topicpayloaddto.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const Type = { + Subscriber: "Subscriber", + Topic: "Topic", +} as const; +export type Type = ClosedEnum; + +export type TopicPayloadDto = { + topicKey: string; + type: Type; +}; + +/** @internal */ +export const Type$inboundSchema: z.ZodNativeEnum = z.nativeEnum( + Type, +); + +/** @internal */ +export const Type$outboundSchema: z.ZodNativeEnum = + Type$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Type$ { + /** @deprecated use `Type$inboundSchema` instead. */ + export const inboundSchema = Type$inboundSchema; + /** @deprecated use `Type$outboundSchema` instead. */ + export const outboundSchema = Type$outboundSchema; +} + +/** @internal */ +export const TopicPayloadDto$inboundSchema: z.ZodType< + TopicPayloadDto, + z.ZodTypeDef, + unknown +> = z.object({ + topicKey: z.string(), + type: Type$inboundSchema, +}); + +/** @internal */ +export type TopicPayloadDto$Outbound = { + topicKey: string; + type: string; +}; + +/** @internal */ +export const TopicPayloadDto$outboundSchema: z.ZodType< + TopicPayloadDto$Outbound, + z.ZodTypeDef, + TopicPayloadDto +> = z.object({ + topicKey: z.string(), + type: Type$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicPayloadDto$ { + /** @deprecated use `TopicPayloadDto$inboundSchema` instead. */ + export const inboundSchema = TopicPayloadDto$inboundSchema; + /** @deprecated use `TopicPayloadDto$outboundSchema` instead. */ + export const outboundSchema = TopicPayloadDto$outboundSchema; + /** @deprecated use `TopicPayloadDto$Outbound` instead. */ + export type Outbound = TopicPayloadDto$Outbound; +} + +export function topicPayloadDtoToJSON( + topicPayloadDto: TopicPayloadDto, +): string { + return JSON.stringify(TopicPayloadDto$outboundSchema.parse(topicPayloadDto)); +} + +export function topicPayloadDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TopicPayloadDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicPayloadDto' from JSON`, + ); +} diff --git a/src/models/components/topicsubscriberdto.ts b/src/models/components/topicsubscriberdto.ts new file mode 100644 index 00000000..974296fb --- /dev/null +++ b/src/models/components/topicsubscriberdto.ts @@ -0,0 +1,101 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicSubscriberDto = { + organizationId: string; + environmentId: string; + subscriberId: string; + topicId: string; + topicKey: string; + externalSubscriberId: string; +}; + +/** @internal */ +export const TopicSubscriberDto$inboundSchema: z.ZodType< + TopicSubscriberDto, + z.ZodTypeDef, + unknown +> = z.object({ + _organizationId: z.string(), + _environmentId: z.string(), + _subscriberId: z.string(), + _topicId: z.string(), + topicKey: z.string(), + externalSubscriberId: z.string(), +}).transform((v) => { + return remap$(v, { + "_organizationId": "organizationId", + "_environmentId": "environmentId", + "_subscriberId": "subscriberId", + "_topicId": "topicId", + }); +}); + +/** @internal */ +export type TopicSubscriberDto$Outbound = { + _organizationId: string; + _environmentId: string; + _subscriberId: string; + _topicId: string; + topicKey: string; + externalSubscriberId: string; +}; + +/** @internal */ +export const TopicSubscriberDto$outboundSchema: z.ZodType< + TopicSubscriberDto$Outbound, + z.ZodTypeDef, + TopicSubscriberDto +> = z.object({ + organizationId: z.string(), + environmentId: z.string(), + subscriberId: z.string(), + topicId: z.string(), + topicKey: z.string(), + externalSubscriberId: z.string(), +}).transform((v) => { + return remap$(v, { + organizationId: "_organizationId", + environmentId: "_environmentId", + subscriberId: "_subscriberId", + topicId: "_topicId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicSubscriberDto$ { + /** @deprecated use `TopicSubscriberDto$inboundSchema` instead. */ + export const inboundSchema = TopicSubscriberDto$inboundSchema; + /** @deprecated use `TopicSubscriberDto$outboundSchema` instead. */ + export const outboundSchema = TopicSubscriberDto$outboundSchema; + /** @deprecated use `TopicSubscriberDto$Outbound` instead. */ + export type Outbound = TopicSubscriberDto$Outbound; +} + +export function topicSubscriberDtoToJSON( + topicSubscriberDto: TopicSubscriberDto, +): string { + return JSON.stringify( + TopicSubscriberDto$outboundSchema.parse(topicSubscriberDto), + ); +} + +export function topicSubscriberDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TopicSubscriberDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicSubscriberDto' from JSON`, + ); +} diff --git a/src/models/components/triggereventrequestdto.ts b/src/models/components/triggereventrequestdto.ts new file mode 100644 index 00000000..6409a61a --- /dev/null +++ b/src/models/components/triggereventrequestdto.ts @@ -0,0 +1,450 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + SubscriberPayloadDto, + SubscriberPayloadDto$inboundSchema, + SubscriberPayloadDto$Outbound, + SubscriberPayloadDto$outboundSchema, +} from "./subscriberpayloaddto.js"; +import { + TenantPayloadDto, + TenantPayloadDto$inboundSchema, + TenantPayloadDto$Outbound, + TenantPayloadDto$outboundSchema, +} from "./tenantpayloaddto.js"; +import { + TopicPayloadDto, + TopicPayloadDto$inboundSchema, + TopicPayloadDto$Outbound, + TopicPayloadDto$outboundSchema, +} from "./topicpayloaddto.js"; + +/** + * The payload object is used to pass additional custom information that could be used to render the workflow, or perform routing rules based on it. + * + * @remarks + * This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. + */ +export type Payload = {}; + +/** + * This could be used to override provider specific configurations + */ +export type Overrides = {}; + +export type To = TopicPayloadDto | SubscriberPayloadDto | string; + +/** + * It is used to display the Avatar of the provided actor's subscriber id or actor object. + * + * @remarks + * If a new actor object is provided, we will create a new subscriber in our system + */ +export type Actor = SubscriberPayloadDto | string; + +/** + * It is used to specify a tenant context during trigger event. + * + * @remarks + * Existing tenants will be updated with the provided details. + */ +export type Tenant = TenantPayloadDto | string; + +export type Controls = {}; + +export type TriggerEventRequestDto = { + /** + * The trigger identifier of the workflow you wish to send. This identifier can be found on the workflow page. + */ + name: string; + /** + * The payload object is used to pass additional custom information that could be used to render the workflow, or perform routing rules based on it. + * + * @remarks + * This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. + */ + payload?: Payload | undefined; + /** + * This could be used to override provider specific configurations + */ + overrides?: Overrides | undefined; + /** + * The recipients list of people who will receive the notification. + */ + to: Array; + /** + * A unique identifier for this transaction, we will generated a UUID if not provided. + */ + transactionId?: string | undefined; + /** + * It is used to display the Avatar of the provided actor's subscriber id or actor object. + * + * @remarks + * If a new actor object is provided, we will create a new subscriber in our system + */ + actor?: SubscriberPayloadDto | string | undefined; + /** + * It is used to specify a tenant context during trigger event. + * + * @remarks + * Existing tenants will be updated with the provided details. + */ + tenant?: TenantPayloadDto | string | undefined; + bridgeUrl?: string | undefined; + controls?: Controls | undefined; +}; + +/** @internal */ +export const Payload$inboundSchema: z.ZodType = + z.object({}); + +/** @internal */ +export type Payload$Outbound = {}; + +/** @internal */ +export const Payload$outboundSchema: z.ZodType< + Payload$Outbound, + z.ZodTypeDef, + Payload +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Payload$ { + /** @deprecated use `Payload$inboundSchema` instead. */ + export const inboundSchema = Payload$inboundSchema; + /** @deprecated use `Payload$outboundSchema` instead. */ + export const outboundSchema = Payload$outboundSchema; + /** @deprecated use `Payload$Outbound` instead. */ + export type Outbound = Payload$Outbound; +} + +export function payloadToJSON(payload: Payload): string { + return JSON.stringify(Payload$outboundSchema.parse(payload)); +} + +export function payloadFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Payload$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Payload' from JSON`, + ); +} + +/** @internal */ +export const Overrides$inboundSchema: z.ZodType< + Overrides, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type Overrides$Outbound = {}; + +/** @internal */ +export const Overrides$outboundSchema: z.ZodType< + Overrides$Outbound, + z.ZodTypeDef, + Overrides +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Overrides$ { + /** @deprecated use `Overrides$inboundSchema` instead. */ + export const inboundSchema = Overrides$inboundSchema; + /** @deprecated use `Overrides$outboundSchema` instead. */ + export const outboundSchema = Overrides$outboundSchema; + /** @deprecated use `Overrides$Outbound` instead. */ + export type Outbound = Overrides$Outbound; +} + +export function overridesToJSON(overrides: Overrides): string { + return JSON.stringify(Overrides$outboundSchema.parse(overrides)); +} + +export function overridesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Overrides$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Overrides' from JSON`, + ); +} + +/** @internal */ +export const To$inboundSchema: z.ZodType = z.union([ + TopicPayloadDto$inboundSchema, + SubscriberPayloadDto$inboundSchema, + z.string(), +]); + +/** @internal */ +export type To$Outbound = + | TopicPayloadDto$Outbound + | SubscriberPayloadDto$Outbound + | string; + +/** @internal */ +export const To$outboundSchema: z.ZodType = z + .union([ + TopicPayloadDto$outboundSchema, + SubscriberPayloadDto$outboundSchema, + z.string(), + ]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace To$ { + /** @deprecated use `To$inboundSchema` instead. */ + export const inboundSchema = To$inboundSchema; + /** @deprecated use `To$outboundSchema` instead. */ + export const outboundSchema = To$outboundSchema; + /** @deprecated use `To$Outbound` instead. */ + export type Outbound = To$Outbound; +} + +export function toToJSON(to: To): string { + return JSON.stringify(To$outboundSchema.parse(to)); +} + +export function toFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => To$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'To' from JSON`, + ); +} + +/** @internal */ +export const Actor$inboundSchema: z.ZodType = z + .union([SubscriberPayloadDto$inboundSchema, z.string()]); + +/** @internal */ +export type Actor$Outbound = SubscriberPayloadDto$Outbound | string; + +/** @internal */ +export const Actor$outboundSchema: z.ZodType< + Actor$Outbound, + z.ZodTypeDef, + Actor +> = z.union([SubscriberPayloadDto$outboundSchema, z.string()]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Actor$ { + /** @deprecated use `Actor$inboundSchema` instead. */ + export const inboundSchema = Actor$inboundSchema; + /** @deprecated use `Actor$outboundSchema` instead. */ + export const outboundSchema = Actor$outboundSchema; + /** @deprecated use `Actor$Outbound` instead. */ + export type Outbound = Actor$Outbound; +} + +export function actorToJSON(actor: Actor): string { + return JSON.stringify(Actor$outboundSchema.parse(actor)); +} + +export function actorFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Actor$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Actor' from JSON`, + ); +} + +/** @internal */ +export const Tenant$inboundSchema: z.ZodType = z + .union([TenantPayloadDto$inboundSchema, z.string()]); + +/** @internal */ +export type Tenant$Outbound = TenantPayloadDto$Outbound | string; + +/** @internal */ +export const Tenant$outboundSchema: z.ZodType< + Tenant$Outbound, + z.ZodTypeDef, + Tenant +> = z.union([TenantPayloadDto$outboundSchema, z.string()]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Tenant$ { + /** @deprecated use `Tenant$inboundSchema` instead. */ + export const inboundSchema = Tenant$inboundSchema; + /** @deprecated use `Tenant$outboundSchema` instead. */ + export const outboundSchema = Tenant$outboundSchema; + /** @deprecated use `Tenant$Outbound` instead. */ + export type Outbound = Tenant$Outbound; +} + +export function tenantToJSON(tenant: Tenant): string { + return JSON.stringify(Tenant$outboundSchema.parse(tenant)); +} + +export function tenantFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Tenant$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Tenant' from JSON`, + ); +} + +/** @internal */ +export const Controls$inboundSchema: z.ZodType< + Controls, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type Controls$Outbound = {}; + +/** @internal */ +export const Controls$outboundSchema: z.ZodType< + Controls$Outbound, + z.ZodTypeDef, + Controls +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Controls$ { + /** @deprecated use `Controls$inboundSchema` instead. */ + export const inboundSchema = Controls$inboundSchema; + /** @deprecated use `Controls$outboundSchema` instead. */ + export const outboundSchema = Controls$outboundSchema; + /** @deprecated use `Controls$Outbound` instead. */ + export type Outbound = Controls$Outbound; +} + +export function controlsToJSON(controls: Controls): string { + return JSON.stringify(Controls$outboundSchema.parse(controls)); +} + +export function controlsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Controls$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Controls' from JSON`, + ); +} + +/** @internal */ +export const TriggerEventRequestDto$inboundSchema: z.ZodType< + TriggerEventRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string(), + payload: z.lazy(() => Payload$inboundSchema).optional(), + overrides: z.lazy(() => Overrides$inboundSchema).optional(), + to: z.array( + z.union([ + TopicPayloadDto$inboundSchema, + SubscriberPayloadDto$inboundSchema, + z.string(), + ]), + ), + transactionId: z.string().optional(), + actor: z.union([SubscriberPayloadDto$inboundSchema, z.string()]).optional(), + tenant: z.union([TenantPayloadDto$inboundSchema, z.string()]).optional(), + bridgeUrl: z.string().optional(), + controls: z.lazy(() => Controls$inboundSchema).optional(), +}); + +/** @internal */ +export type TriggerEventRequestDto$Outbound = { + name: string; + payload?: Payload$Outbound | undefined; + overrides?: Overrides$Outbound | undefined; + to: Array; + transactionId?: string | undefined; + actor?: SubscriberPayloadDto$Outbound | string | undefined; + tenant?: TenantPayloadDto$Outbound | string | undefined; + bridgeUrl?: string | undefined; + controls?: Controls$Outbound | undefined; +}; + +/** @internal */ +export const TriggerEventRequestDto$outboundSchema: z.ZodType< + TriggerEventRequestDto$Outbound, + z.ZodTypeDef, + TriggerEventRequestDto +> = z.object({ + name: z.string(), + payload: z.lazy(() => Payload$outboundSchema).optional(), + overrides: z.lazy(() => Overrides$outboundSchema).optional(), + to: z.array( + z.union([ + TopicPayloadDto$outboundSchema, + SubscriberPayloadDto$outboundSchema, + z.string(), + ]), + ), + transactionId: z.string().optional(), + actor: z.union([SubscriberPayloadDto$outboundSchema, z.string()]).optional(), + tenant: z.union([TenantPayloadDto$outboundSchema, z.string()]).optional(), + bridgeUrl: z.string().optional(), + controls: z.lazy(() => Controls$outboundSchema).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventRequestDto$ { + /** @deprecated use `TriggerEventRequestDto$inboundSchema` instead. */ + export const inboundSchema = TriggerEventRequestDto$inboundSchema; + /** @deprecated use `TriggerEventRequestDto$outboundSchema` instead. */ + export const outboundSchema = TriggerEventRequestDto$outboundSchema; + /** @deprecated use `TriggerEventRequestDto$Outbound` instead. */ + export type Outbound = TriggerEventRequestDto$Outbound; +} + +export function triggerEventRequestDtoToJSON( + triggerEventRequestDto: TriggerEventRequestDto, +): string { + return JSON.stringify( + TriggerEventRequestDto$outboundSchema.parse(triggerEventRequestDto), + ); +} + +export function triggerEventRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TriggerEventRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TriggerEventRequestDto' from JSON`, + ); +} diff --git a/src/models/components/triggereventresponsedto.ts b/src/models/components/triggereventresponsedto.ts new file mode 100644 index 00000000..e29dd9df --- /dev/null +++ b/src/models/components/triggereventresponsedto.ts @@ -0,0 +1,131 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * Status for trigger + */ +export const TriggerEventResponseDtoStatus = { + Error: "error", + TriggerNotActive: "trigger_not_active", + NoWorkflowActiveStepsDefined: "no_workflow_active_steps_defined", + NoWorkflowStepsDefined: "no_workflow_steps_defined", + Processed: "processed", + SubscriberIdMissing: "subscriber_id_missing", + NoTenantFound: "no_tenant_found", +} as const; +/** + * Status for trigger + */ +export type TriggerEventResponseDtoStatus = ClosedEnum< + typeof TriggerEventResponseDtoStatus +>; + +export type TriggerEventResponseDto = { + /** + * If trigger was acknowledged or not + */ + acknowledged: boolean; + /** + * Status for trigger + */ + status: TriggerEventResponseDtoStatus; + /** + * In case of an error, this field will contain the error message + */ + error?: Array | undefined; + /** + * Transaction id for trigger + */ + transactionId?: string | undefined; +}; + +/** @internal */ +export const TriggerEventResponseDtoStatus$inboundSchema: z.ZodNativeEnum< + typeof TriggerEventResponseDtoStatus +> = z.nativeEnum(TriggerEventResponseDtoStatus); + +/** @internal */ +export const TriggerEventResponseDtoStatus$outboundSchema: z.ZodNativeEnum< + typeof TriggerEventResponseDtoStatus +> = TriggerEventResponseDtoStatus$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventResponseDtoStatus$ { + /** @deprecated use `TriggerEventResponseDtoStatus$inboundSchema` instead. */ + export const inboundSchema = TriggerEventResponseDtoStatus$inboundSchema; + /** @deprecated use `TriggerEventResponseDtoStatus$outboundSchema` instead. */ + export const outboundSchema = TriggerEventResponseDtoStatus$outboundSchema; +} + +/** @internal */ +export const TriggerEventResponseDto$inboundSchema: z.ZodType< + TriggerEventResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + acknowledged: z.boolean(), + status: TriggerEventResponseDtoStatus$inboundSchema, + error: z.array(z.string()).optional(), + transactionId: z.string().optional(), +}); + +/** @internal */ +export type TriggerEventResponseDto$Outbound = { + acknowledged: boolean; + status: string; + error?: Array | undefined; + transactionId?: string | undefined; +}; + +/** @internal */ +export const TriggerEventResponseDto$outboundSchema: z.ZodType< + TriggerEventResponseDto$Outbound, + z.ZodTypeDef, + TriggerEventResponseDto +> = z.object({ + acknowledged: z.boolean(), + status: TriggerEventResponseDtoStatus$outboundSchema, + error: z.array(z.string()).optional(), + transactionId: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventResponseDto$ { + /** @deprecated use `TriggerEventResponseDto$inboundSchema` instead. */ + export const inboundSchema = TriggerEventResponseDto$inboundSchema; + /** @deprecated use `TriggerEventResponseDto$outboundSchema` instead. */ + export const outboundSchema = TriggerEventResponseDto$outboundSchema; + /** @deprecated use `TriggerEventResponseDto$Outbound` instead. */ + export type Outbound = TriggerEventResponseDto$Outbound; +} + +export function triggerEventResponseDtoToJSON( + triggerEventResponseDto: TriggerEventResponseDto, +): string { + return JSON.stringify( + TriggerEventResponseDto$outboundSchema.parse(triggerEventResponseDto), + ); +} + +export function triggerEventResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TriggerEventResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TriggerEventResponseDto' from JSON`, + ); +} diff --git a/src/models/components/triggereventtoallrequestdto.ts b/src/models/components/triggereventtoallrequestdto.ts new file mode 100644 index 00000000..991659bb --- /dev/null +++ b/src/models/components/triggereventtoallrequestdto.ts @@ -0,0 +1,368 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + SubscriberPayloadDto, + SubscriberPayloadDto$inboundSchema, + SubscriberPayloadDto$Outbound, + SubscriberPayloadDto$outboundSchema, +} from "./subscriberpayloaddto.js"; +import { + TenantPayloadDto, + TenantPayloadDto$inboundSchema, + TenantPayloadDto$Outbound, + TenantPayloadDto$outboundSchema, +} from "./tenantpayloaddto.js"; + +/** + * The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. + * + * @remarks + * This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. + */ +export type TriggerEventToAllRequestDtoPayload = {}; + +/** + * This could be used to override provider specific configurations + */ +export type TriggerEventToAllRequestDtoOverrides = {}; + +/** + * It is used to display the Avatar of the provided actor's subscriber id or actor object. + * + * @remarks + * If a new actor object is provided, we will create a new subscriber in our system + */ +export type TriggerEventToAllRequestDtoActor = SubscriberPayloadDto | string; + +/** + * It is used to specify a tenant context during trigger event. + * + * @remarks + * If a new tenant object is provided, we will create a new tenant. + */ +export type TriggerEventToAllRequestDtoTenant = TenantPayloadDto | string; + +export type TriggerEventToAllRequestDto = { + /** + * The trigger identifier associated for the template you wish to send. This identifier can be found on the template page. + */ + name: string; + /** + * The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. + * + * @remarks + * This data will also be available when fetching the notifications feed from the API to display certain parts of the UI. + */ + payload: TriggerEventToAllRequestDtoPayload; + /** + * This could be used to override provider specific configurations + */ + overrides?: TriggerEventToAllRequestDtoOverrides | undefined; + /** + * A unique identifier for this transaction, we will generated a UUID if not provided. + */ + transactionId?: string | undefined; + /** + * It is used to display the Avatar of the provided actor's subscriber id or actor object. + * + * @remarks + * If a new actor object is provided, we will create a new subscriber in our system + */ + actor?: SubscriberPayloadDto | string | undefined; + /** + * It is used to specify a tenant context during trigger event. + * + * @remarks + * If a new tenant object is provided, we will create a new tenant. + */ + tenant?: TenantPayloadDto | string | undefined; +}; + +/** @internal */ +export const TriggerEventToAllRequestDtoPayload$inboundSchema: z.ZodType< + TriggerEventToAllRequestDtoPayload, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type TriggerEventToAllRequestDtoPayload$Outbound = {}; + +/** @internal */ +export const TriggerEventToAllRequestDtoPayload$outboundSchema: z.ZodType< + TriggerEventToAllRequestDtoPayload$Outbound, + z.ZodTypeDef, + TriggerEventToAllRequestDtoPayload +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventToAllRequestDtoPayload$ { + /** @deprecated use `TriggerEventToAllRequestDtoPayload$inboundSchema` instead. */ + export const inboundSchema = TriggerEventToAllRequestDtoPayload$inboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoPayload$outboundSchema` instead. */ + export const outboundSchema = + TriggerEventToAllRequestDtoPayload$outboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoPayload$Outbound` instead. */ + export type Outbound = TriggerEventToAllRequestDtoPayload$Outbound; +} + +export function triggerEventToAllRequestDtoPayloadToJSON( + triggerEventToAllRequestDtoPayload: TriggerEventToAllRequestDtoPayload, +): string { + return JSON.stringify( + TriggerEventToAllRequestDtoPayload$outboundSchema.parse( + triggerEventToAllRequestDtoPayload, + ), + ); +} + +export function triggerEventToAllRequestDtoPayloadFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TriggerEventToAllRequestDtoPayload$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TriggerEventToAllRequestDtoPayload' from JSON`, + ); +} + +/** @internal */ +export const TriggerEventToAllRequestDtoOverrides$inboundSchema: z.ZodType< + TriggerEventToAllRequestDtoOverrides, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type TriggerEventToAllRequestDtoOverrides$Outbound = {}; + +/** @internal */ +export const TriggerEventToAllRequestDtoOverrides$outboundSchema: z.ZodType< + TriggerEventToAllRequestDtoOverrides$Outbound, + z.ZodTypeDef, + TriggerEventToAllRequestDtoOverrides +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventToAllRequestDtoOverrides$ { + /** @deprecated use `TriggerEventToAllRequestDtoOverrides$inboundSchema` instead. */ + export const inboundSchema = + TriggerEventToAllRequestDtoOverrides$inboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoOverrides$outboundSchema` instead. */ + export const outboundSchema = + TriggerEventToAllRequestDtoOverrides$outboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoOverrides$Outbound` instead. */ + export type Outbound = TriggerEventToAllRequestDtoOverrides$Outbound; +} + +export function triggerEventToAllRequestDtoOverridesToJSON( + triggerEventToAllRequestDtoOverrides: TriggerEventToAllRequestDtoOverrides, +): string { + return JSON.stringify( + TriggerEventToAllRequestDtoOverrides$outboundSchema.parse( + triggerEventToAllRequestDtoOverrides, + ), + ); +} + +export function triggerEventToAllRequestDtoOverridesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TriggerEventToAllRequestDtoOverrides$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TriggerEventToAllRequestDtoOverrides' from JSON`, + ); +} + +/** @internal */ +export const TriggerEventToAllRequestDtoActor$inboundSchema: z.ZodType< + TriggerEventToAllRequestDtoActor, + z.ZodTypeDef, + unknown +> = z.union([SubscriberPayloadDto$inboundSchema, z.string()]); + +/** @internal */ +export type TriggerEventToAllRequestDtoActor$Outbound = + | SubscriberPayloadDto$Outbound + | string; + +/** @internal */ +export const TriggerEventToAllRequestDtoActor$outboundSchema: z.ZodType< + TriggerEventToAllRequestDtoActor$Outbound, + z.ZodTypeDef, + TriggerEventToAllRequestDtoActor +> = z.union([SubscriberPayloadDto$outboundSchema, z.string()]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventToAllRequestDtoActor$ { + /** @deprecated use `TriggerEventToAllRequestDtoActor$inboundSchema` instead. */ + export const inboundSchema = TriggerEventToAllRequestDtoActor$inboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoActor$outboundSchema` instead. */ + export const outboundSchema = TriggerEventToAllRequestDtoActor$outboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoActor$Outbound` instead. */ + export type Outbound = TriggerEventToAllRequestDtoActor$Outbound; +} + +export function triggerEventToAllRequestDtoActorToJSON( + triggerEventToAllRequestDtoActor: TriggerEventToAllRequestDtoActor, +): string { + return JSON.stringify( + TriggerEventToAllRequestDtoActor$outboundSchema.parse( + triggerEventToAllRequestDtoActor, + ), + ); +} + +export function triggerEventToAllRequestDtoActorFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TriggerEventToAllRequestDtoActor$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TriggerEventToAllRequestDtoActor' from JSON`, + ); +} + +/** @internal */ +export const TriggerEventToAllRequestDtoTenant$inboundSchema: z.ZodType< + TriggerEventToAllRequestDtoTenant, + z.ZodTypeDef, + unknown +> = z.union([TenantPayloadDto$inboundSchema, z.string()]); + +/** @internal */ +export type TriggerEventToAllRequestDtoTenant$Outbound = + | TenantPayloadDto$Outbound + | string; + +/** @internal */ +export const TriggerEventToAllRequestDtoTenant$outboundSchema: z.ZodType< + TriggerEventToAllRequestDtoTenant$Outbound, + z.ZodTypeDef, + TriggerEventToAllRequestDtoTenant +> = z.union([TenantPayloadDto$outboundSchema, z.string()]); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventToAllRequestDtoTenant$ { + /** @deprecated use `TriggerEventToAllRequestDtoTenant$inboundSchema` instead. */ + export const inboundSchema = TriggerEventToAllRequestDtoTenant$inboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoTenant$outboundSchema` instead. */ + export const outboundSchema = + TriggerEventToAllRequestDtoTenant$outboundSchema; + /** @deprecated use `TriggerEventToAllRequestDtoTenant$Outbound` instead. */ + export type Outbound = TriggerEventToAllRequestDtoTenant$Outbound; +} + +export function triggerEventToAllRequestDtoTenantToJSON( + triggerEventToAllRequestDtoTenant: TriggerEventToAllRequestDtoTenant, +): string { + return JSON.stringify( + TriggerEventToAllRequestDtoTenant$outboundSchema.parse( + triggerEventToAllRequestDtoTenant, + ), + ); +} + +export function triggerEventToAllRequestDtoTenantFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TriggerEventToAllRequestDtoTenant$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TriggerEventToAllRequestDtoTenant' from JSON`, + ); +} + +/** @internal */ +export const TriggerEventToAllRequestDto$inboundSchema: z.ZodType< + TriggerEventToAllRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string(), + payload: z.lazy(() => TriggerEventToAllRequestDtoPayload$inboundSchema), + overrides: z.lazy(() => TriggerEventToAllRequestDtoOverrides$inboundSchema) + .optional(), + transactionId: z.string().optional(), + actor: z.union([SubscriberPayloadDto$inboundSchema, z.string()]).optional(), + tenant: z.union([TenantPayloadDto$inboundSchema, z.string()]).optional(), +}); + +/** @internal */ +export type TriggerEventToAllRequestDto$Outbound = { + name: string; + payload: TriggerEventToAllRequestDtoPayload$Outbound; + overrides?: TriggerEventToAllRequestDtoOverrides$Outbound | undefined; + transactionId?: string | undefined; + actor?: SubscriberPayloadDto$Outbound | string | undefined; + tenant?: TenantPayloadDto$Outbound | string | undefined; +}; + +/** @internal */ +export const TriggerEventToAllRequestDto$outboundSchema: z.ZodType< + TriggerEventToAllRequestDto$Outbound, + z.ZodTypeDef, + TriggerEventToAllRequestDto +> = z.object({ + name: z.string(), + payload: z.lazy(() => TriggerEventToAllRequestDtoPayload$outboundSchema), + overrides: z.lazy(() => TriggerEventToAllRequestDtoOverrides$outboundSchema) + .optional(), + transactionId: z.string().optional(), + actor: z.union([SubscriberPayloadDto$outboundSchema, z.string()]).optional(), + tenant: z.union([TenantPayloadDto$outboundSchema, z.string()]).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TriggerEventToAllRequestDto$ { + /** @deprecated use `TriggerEventToAllRequestDto$inboundSchema` instead. */ + export const inboundSchema = TriggerEventToAllRequestDto$inboundSchema; + /** @deprecated use `TriggerEventToAllRequestDto$outboundSchema` instead. */ + export const outboundSchema = TriggerEventToAllRequestDto$outboundSchema; + /** @deprecated use `TriggerEventToAllRequestDto$Outbound` instead. */ + export type Outbound = TriggerEventToAllRequestDto$Outbound; +} + +export function triggerEventToAllRequestDtoToJSON( + triggerEventToAllRequestDto: TriggerEventToAllRequestDto, +): string { + return JSON.stringify( + TriggerEventToAllRequestDto$outboundSchema.parse( + triggerEventToAllRequestDto, + ), + ); +} + +export function triggerEventToAllRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TriggerEventToAllRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TriggerEventToAllRequestDto' from JSON`, + ); +} diff --git a/src/models/components/unseencountresponse.ts b/src/models/components/unseencountresponse.ts new file mode 100644 index 00000000..9964517e --- /dev/null +++ b/src/models/components/unseencountresponse.ts @@ -0,0 +1,66 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type UnseenCountResponse = { + count: number; +}; + +/** @internal */ +export const UnseenCountResponse$inboundSchema: z.ZodType< + UnseenCountResponse, + z.ZodTypeDef, + unknown +> = z.object({ + count: z.number(), +}); + +/** @internal */ +export type UnseenCountResponse$Outbound = { + count: number; +}; + +/** @internal */ +export const UnseenCountResponse$outboundSchema: z.ZodType< + UnseenCountResponse$Outbound, + z.ZodTypeDef, + UnseenCountResponse +> = z.object({ + count: z.number(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UnseenCountResponse$ { + /** @deprecated use `UnseenCountResponse$inboundSchema` instead. */ + export const inboundSchema = UnseenCountResponse$inboundSchema; + /** @deprecated use `UnseenCountResponse$outboundSchema` instead. */ + export const outboundSchema = UnseenCountResponse$outboundSchema; + /** @deprecated use `UnseenCountResponse$Outbound` instead. */ + export type Outbound = UnseenCountResponse$Outbound; +} + +export function unseenCountResponseToJSON( + unseenCountResponse: UnseenCountResponse, +): string { + return JSON.stringify( + UnseenCountResponse$outboundSchema.parse(unseenCountResponse), + ); +} + +export function unseenCountResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UnseenCountResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UnseenCountResponse' from JSON`, + ); +} diff --git a/src/models/components/updateintegrationrequestdto.ts b/src/models/components/updateintegrationrequestdto.ts new file mode 100644 index 00000000..690ac742 --- /dev/null +++ b/src/models/components/updateintegrationrequestdto.ts @@ -0,0 +1,123 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + CredentialsDto, + CredentialsDto$inboundSchema, + CredentialsDto$Outbound, + CredentialsDto$outboundSchema, +} from "./credentialsdto.js"; +import { + StepFilter, + StepFilter$inboundSchema, + StepFilter$Outbound, + StepFilter$outboundSchema, +} from "./stepfilter.js"; + +export type UpdateIntegrationRequestDto = { + name?: string | undefined; + identifier?: string | undefined; + environmentId?: string | undefined; + /** + * If the integration is active the validation on the credentials field will run + */ + active?: boolean | undefined; + credentials?: CredentialsDto | undefined; + /** + * If true, the Novu branding will be removed from the Inbox component + */ + removeNovuBranding?: boolean | undefined; + check?: boolean | undefined; + conditions?: Array | undefined; +}; + +/** @internal */ +export const UpdateIntegrationRequestDto$inboundSchema: z.ZodType< + UpdateIntegrationRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + name: z.string().optional(), + identifier: z.string().optional(), + _environmentId: z.string().optional(), + active: z.boolean().optional(), + credentials: CredentialsDto$inboundSchema.optional(), + removeNovuBranding: z.boolean().optional(), + check: z.boolean().optional(), + conditions: z.array(StepFilter$inboundSchema).optional(), +}).transform((v) => { + return remap$(v, { + "_environmentId": "environmentId", + }); +}); + +/** @internal */ +export type UpdateIntegrationRequestDto$Outbound = { + name?: string | undefined; + identifier?: string | undefined; + _environmentId?: string | undefined; + active?: boolean | undefined; + credentials?: CredentialsDto$Outbound | undefined; + removeNovuBranding?: boolean | undefined; + check?: boolean | undefined; + conditions?: Array | undefined; +}; + +/** @internal */ +export const UpdateIntegrationRequestDto$outboundSchema: z.ZodType< + UpdateIntegrationRequestDto$Outbound, + z.ZodTypeDef, + UpdateIntegrationRequestDto +> = z.object({ + name: z.string().optional(), + identifier: z.string().optional(), + environmentId: z.string().optional(), + active: z.boolean().optional(), + credentials: CredentialsDto$outboundSchema.optional(), + removeNovuBranding: z.boolean().optional(), + check: z.boolean().optional(), + conditions: z.array(StepFilter$outboundSchema).optional(), +}).transform((v) => { + return remap$(v, { + environmentId: "_environmentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateIntegrationRequestDto$ { + /** @deprecated use `UpdateIntegrationRequestDto$inboundSchema` instead. */ + export const inboundSchema = UpdateIntegrationRequestDto$inboundSchema; + /** @deprecated use `UpdateIntegrationRequestDto$outboundSchema` instead. */ + export const outboundSchema = UpdateIntegrationRequestDto$outboundSchema; + /** @deprecated use `UpdateIntegrationRequestDto$Outbound` instead. */ + export type Outbound = UpdateIntegrationRequestDto$Outbound; +} + +export function updateIntegrationRequestDtoToJSON( + updateIntegrationRequestDto: UpdateIntegrationRequestDto, +): string { + return JSON.stringify( + UpdateIntegrationRequestDto$outboundSchema.parse( + updateIntegrationRequestDto, + ), + ); +} + +export function updateIntegrationRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateIntegrationRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateIntegrationRequestDto' from JSON`, + ); +} diff --git a/src/models/components/updatesubscriberchannelrequestdto.ts b/src/models/components/updatesubscriberchannelrequestdto.ts new file mode 100644 index 00000000..92418867 --- /dev/null +++ b/src/models/components/updatesubscriberchannelrequestdto.ts @@ -0,0 +1,145 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + ChannelCredentials, + ChannelCredentials$inboundSchema, + ChannelCredentials$Outbound, + ChannelCredentials$outboundSchema, +} from "./channelcredentials.js"; + +/** + * The provider identifier for the credentials + */ +export const UpdateSubscriberChannelRequestDtoProviderId = { + Slack: "slack", + Discord: "discord", + Msteams: "msteams", + Mattermost: "mattermost", + Ryver: "ryver", + Zulip: "zulip", + GrafanaOnCall: "grafana-on-call", + Getstream: "getstream", + RocketChat: "rocket-chat", + WhatsappBusiness: "whatsapp-business", + Fcm: "fcm", + Apns: "apns", + Expo: "expo", + OneSignal: "one-signal", + Pushpad: "pushpad", + PushWebhook: "push-webhook", + PusherBeams: "pusher-beams", +} as const; +/** + * The provider identifier for the credentials + */ +export type UpdateSubscriberChannelRequestDtoProviderId = ClosedEnum< + typeof UpdateSubscriberChannelRequestDtoProviderId +>; + +export type UpdateSubscriberChannelRequestDto = { + /** + * The provider identifier for the credentials + */ + providerId: UpdateSubscriberChannelRequestDtoProviderId; + /** + * The integration identifier + */ + integrationIdentifier?: string | undefined; + /** + * Credentials payload for the specified provider + */ + credentials: ChannelCredentials; +}; + +/** @internal */ +export const UpdateSubscriberChannelRequestDtoProviderId$inboundSchema: + z.ZodNativeEnum = z + .nativeEnum(UpdateSubscriberChannelRequestDtoProviderId); + +/** @internal */ +export const UpdateSubscriberChannelRequestDtoProviderId$outboundSchema: + z.ZodNativeEnum = + UpdateSubscriberChannelRequestDtoProviderId$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberChannelRequestDtoProviderId$ { + /** @deprecated use `UpdateSubscriberChannelRequestDtoProviderId$inboundSchema` instead. */ + export const inboundSchema = + UpdateSubscriberChannelRequestDtoProviderId$inboundSchema; + /** @deprecated use `UpdateSubscriberChannelRequestDtoProviderId$outboundSchema` instead. */ + export const outboundSchema = + UpdateSubscriberChannelRequestDtoProviderId$outboundSchema; +} + +/** @internal */ +export const UpdateSubscriberChannelRequestDto$inboundSchema: z.ZodType< + UpdateSubscriberChannelRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + providerId: UpdateSubscriberChannelRequestDtoProviderId$inboundSchema, + integrationIdentifier: z.string().optional(), + credentials: ChannelCredentials$inboundSchema, +}); + +/** @internal */ +export type UpdateSubscriberChannelRequestDto$Outbound = { + providerId: string; + integrationIdentifier?: string | undefined; + credentials: ChannelCredentials$Outbound; +}; + +/** @internal */ +export const UpdateSubscriberChannelRequestDto$outboundSchema: z.ZodType< + UpdateSubscriberChannelRequestDto$Outbound, + z.ZodTypeDef, + UpdateSubscriberChannelRequestDto +> = z.object({ + providerId: UpdateSubscriberChannelRequestDtoProviderId$outboundSchema, + integrationIdentifier: z.string().optional(), + credentials: ChannelCredentials$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberChannelRequestDto$ { + /** @deprecated use `UpdateSubscriberChannelRequestDto$inboundSchema` instead. */ + export const inboundSchema = UpdateSubscriberChannelRequestDto$inboundSchema; + /** @deprecated use `UpdateSubscriberChannelRequestDto$outboundSchema` instead. */ + export const outboundSchema = + UpdateSubscriberChannelRequestDto$outboundSchema; + /** @deprecated use `UpdateSubscriberChannelRequestDto$Outbound` instead. */ + export type Outbound = UpdateSubscriberChannelRequestDto$Outbound; +} + +export function updateSubscriberChannelRequestDtoToJSON( + updateSubscriberChannelRequestDto: UpdateSubscriberChannelRequestDto, +): string { + return JSON.stringify( + UpdateSubscriberChannelRequestDto$outboundSchema.parse( + updateSubscriberChannelRequestDto, + ), + ); +} + +export function updateSubscriberChannelRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateSubscriberChannelRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateSubscriberChannelRequestDto' from JSON`, + ); +} diff --git a/src/models/components/updatesubscriberglobalpreferencesrequestdto.ts b/src/models/components/updatesubscriberglobalpreferencesrequestdto.ts new file mode 100644 index 00000000..b00510e0 --- /dev/null +++ b/src/models/components/updatesubscriberglobalpreferencesrequestdto.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + ChannelPreference, + ChannelPreference$inboundSchema, + ChannelPreference$Outbound, + ChannelPreference$outboundSchema, +} from "./channelpreference.js"; + +export type UpdateSubscriberGlobalPreferencesRequestDto = { + /** + * Enable or disable the subscriber global preferences. + */ + enabled?: boolean | undefined; + /** + * The subscriber global preferences for every ChannelTypeEnum. + */ + preferences?: Array | undefined; +}; + +/** @internal */ +export const UpdateSubscriberGlobalPreferencesRequestDto$inboundSchema: + z.ZodType< + UpdateSubscriberGlobalPreferencesRequestDto, + z.ZodTypeDef, + unknown + > = z.object({ + enabled: z.boolean().optional(), + preferences: z.array(ChannelPreference$inboundSchema).optional(), + }); + +/** @internal */ +export type UpdateSubscriberGlobalPreferencesRequestDto$Outbound = { + enabled?: boolean | undefined; + preferences?: Array | undefined; +}; + +/** @internal */ +export const UpdateSubscriberGlobalPreferencesRequestDto$outboundSchema: + z.ZodType< + UpdateSubscriberGlobalPreferencesRequestDto$Outbound, + z.ZodTypeDef, + UpdateSubscriberGlobalPreferencesRequestDto + > = z.object({ + enabled: z.boolean().optional(), + preferences: z.array(ChannelPreference$outboundSchema).optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberGlobalPreferencesRequestDto$ { + /** @deprecated use `UpdateSubscriberGlobalPreferencesRequestDto$inboundSchema` instead. */ + export const inboundSchema = + UpdateSubscriberGlobalPreferencesRequestDto$inboundSchema; + /** @deprecated use `UpdateSubscriberGlobalPreferencesRequestDto$outboundSchema` instead. */ + export const outboundSchema = + UpdateSubscriberGlobalPreferencesRequestDto$outboundSchema; + /** @deprecated use `UpdateSubscriberGlobalPreferencesRequestDto$Outbound` instead. */ + export type Outbound = UpdateSubscriberGlobalPreferencesRequestDto$Outbound; +} + +export function updateSubscriberGlobalPreferencesRequestDtoToJSON( + updateSubscriberGlobalPreferencesRequestDto: + UpdateSubscriberGlobalPreferencesRequestDto, +): string { + return JSON.stringify( + UpdateSubscriberGlobalPreferencesRequestDto$outboundSchema.parse( + updateSubscriberGlobalPreferencesRequestDto, + ), + ); +} + +export function updateSubscriberGlobalPreferencesRequestDtoFromJSON( + jsonString: string, +): SafeParseResult< + UpdateSubscriberGlobalPreferencesRequestDto, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + UpdateSubscriberGlobalPreferencesRequestDto$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'UpdateSubscriberGlobalPreferencesRequestDto' from JSON`, + ); +} diff --git a/src/models/components/updatesubscriberonlineflagrequestdto.ts b/src/models/components/updatesubscriberonlineflagrequestdto.ts new file mode 100644 index 00000000..5e3da370 --- /dev/null +++ b/src/models/components/updatesubscriberonlineflagrequestdto.ts @@ -0,0 +1,71 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type UpdateSubscriberOnlineFlagRequestDto = { + isOnline: boolean; +}; + +/** @internal */ +export const UpdateSubscriberOnlineFlagRequestDto$inboundSchema: z.ZodType< + UpdateSubscriberOnlineFlagRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + isOnline: z.boolean(), +}); + +/** @internal */ +export type UpdateSubscriberOnlineFlagRequestDto$Outbound = { + isOnline: boolean; +}; + +/** @internal */ +export const UpdateSubscriberOnlineFlagRequestDto$outboundSchema: z.ZodType< + UpdateSubscriberOnlineFlagRequestDto$Outbound, + z.ZodTypeDef, + UpdateSubscriberOnlineFlagRequestDto +> = z.object({ + isOnline: z.boolean(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberOnlineFlagRequestDto$ { + /** @deprecated use `UpdateSubscriberOnlineFlagRequestDto$inboundSchema` instead. */ + export const inboundSchema = + UpdateSubscriberOnlineFlagRequestDto$inboundSchema; + /** @deprecated use `UpdateSubscriberOnlineFlagRequestDto$outboundSchema` instead. */ + export const outboundSchema = + UpdateSubscriberOnlineFlagRequestDto$outboundSchema; + /** @deprecated use `UpdateSubscriberOnlineFlagRequestDto$Outbound` instead. */ + export type Outbound = UpdateSubscriberOnlineFlagRequestDto$Outbound; +} + +export function updateSubscriberOnlineFlagRequestDtoToJSON( + updateSubscriberOnlineFlagRequestDto: UpdateSubscriberOnlineFlagRequestDto, +): string { + return JSON.stringify( + UpdateSubscriberOnlineFlagRequestDto$outboundSchema.parse( + updateSubscriberOnlineFlagRequestDto, + ), + ); +} + +export function updateSubscriberOnlineFlagRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + UpdateSubscriberOnlineFlagRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateSubscriberOnlineFlagRequestDto' from JSON`, + ); +} diff --git a/src/models/components/updatesubscriberpreferencerequestdto.ts b/src/models/components/updatesubscriberpreferencerequestdto.ts new file mode 100644 index 00000000..4ae4866e --- /dev/null +++ b/src/models/components/updatesubscriberpreferencerequestdto.ts @@ -0,0 +1,87 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + ChannelPreference, + ChannelPreference$inboundSchema, + ChannelPreference$Outbound, + ChannelPreference$outboundSchema, +} from "./channelpreference.js"; + +export type UpdateSubscriberPreferenceRequestDto = { + /** + * The subscriber preferences for every ChannelTypeEnum for the workflow assigned. + */ + channel?: ChannelPreference | undefined; + /** + * Sets if the workflow is fully enabled for all channels or not for the subscriber. + */ + enabled?: boolean | undefined; +}; + +/** @internal */ +export const UpdateSubscriberPreferenceRequestDto$inboundSchema: z.ZodType< + UpdateSubscriberPreferenceRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + channel: ChannelPreference$inboundSchema.optional(), + enabled: z.boolean().optional(), +}); + +/** @internal */ +export type UpdateSubscriberPreferenceRequestDto$Outbound = { + channel?: ChannelPreference$Outbound | undefined; + enabled?: boolean | undefined; +}; + +/** @internal */ +export const UpdateSubscriberPreferenceRequestDto$outboundSchema: z.ZodType< + UpdateSubscriberPreferenceRequestDto$Outbound, + z.ZodTypeDef, + UpdateSubscriberPreferenceRequestDto +> = z.object({ + channel: ChannelPreference$outboundSchema.optional(), + enabled: z.boolean().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberPreferenceRequestDto$ { + /** @deprecated use `UpdateSubscriberPreferenceRequestDto$inboundSchema` instead. */ + export const inboundSchema = + UpdateSubscriberPreferenceRequestDto$inboundSchema; + /** @deprecated use `UpdateSubscriberPreferenceRequestDto$outboundSchema` instead. */ + export const outboundSchema = + UpdateSubscriberPreferenceRequestDto$outboundSchema; + /** @deprecated use `UpdateSubscriberPreferenceRequestDto$Outbound` instead. */ + export type Outbound = UpdateSubscriberPreferenceRequestDto$Outbound; +} + +export function updateSubscriberPreferenceRequestDtoToJSON( + updateSubscriberPreferenceRequestDto: UpdateSubscriberPreferenceRequestDto, +): string { + return JSON.stringify( + UpdateSubscriberPreferenceRequestDto$outboundSchema.parse( + updateSubscriberPreferenceRequestDto, + ), + ); +} + +export function updateSubscriberPreferenceRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + UpdateSubscriberPreferenceRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateSubscriberPreferenceRequestDto' from JSON`, + ); +} diff --git a/src/models/components/updatesubscriberpreferenceresponsedto.ts b/src/models/components/updatesubscriberpreferenceresponsedto.ts new file mode 100644 index 00000000..c0185123 --- /dev/null +++ b/src/models/components/updatesubscriberpreferenceresponsedto.ts @@ -0,0 +1,93 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + Preference, + Preference$inboundSchema, + Preference$Outbound, + Preference$outboundSchema, +} from "./preference.js"; +import { + TemplateResponse, + TemplateResponse$inboundSchema, + TemplateResponse$Outbound, + TemplateResponse$outboundSchema, +} from "./templateresponse.js"; + +export type UpdateSubscriberPreferenceResponseDto = { + /** + * The workflow information and if it is critical or not + */ + template: TemplateResponse; + /** + * The preferences of the subscriber regarding the related workflow + */ + preference: Preference; +}; + +/** @internal */ +export const UpdateSubscriberPreferenceResponseDto$inboundSchema: z.ZodType< + UpdateSubscriberPreferenceResponseDto, + z.ZodTypeDef, + unknown +> = z.object({ + template: TemplateResponse$inboundSchema, + preference: Preference$inboundSchema, +}); + +/** @internal */ +export type UpdateSubscriberPreferenceResponseDto$Outbound = { + template: TemplateResponse$Outbound; + preference: Preference$Outbound; +}; + +/** @internal */ +export const UpdateSubscriberPreferenceResponseDto$outboundSchema: z.ZodType< + UpdateSubscriberPreferenceResponseDto$Outbound, + z.ZodTypeDef, + UpdateSubscriberPreferenceResponseDto +> = z.object({ + template: TemplateResponse$outboundSchema, + preference: Preference$outboundSchema, +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberPreferenceResponseDto$ { + /** @deprecated use `UpdateSubscriberPreferenceResponseDto$inboundSchema` instead. */ + export const inboundSchema = + UpdateSubscriberPreferenceResponseDto$inboundSchema; + /** @deprecated use `UpdateSubscriberPreferenceResponseDto$outboundSchema` instead. */ + export const outboundSchema = + UpdateSubscriberPreferenceResponseDto$outboundSchema; + /** @deprecated use `UpdateSubscriberPreferenceResponseDto$Outbound` instead. */ + export type Outbound = UpdateSubscriberPreferenceResponseDto$Outbound; +} + +export function updateSubscriberPreferenceResponseDtoToJSON( + updateSubscriberPreferenceResponseDto: UpdateSubscriberPreferenceResponseDto, +): string { + return JSON.stringify( + UpdateSubscriberPreferenceResponseDto$outboundSchema.parse( + updateSubscriberPreferenceResponseDto, + ), + ); +} + +export function updateSubscriberPreferenceResponseDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + UpdateSubscriberPreferenceResponseDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateSubscriberPreferenceResponseDto' from JSON`, + ); +} diff --git a/src/models/components/updatesubscriberrequestdto.ts b/src/models/components/updatesubscriberrequestdto.ts new file mode 100644 index 00000000..bd97d519 --- /dev/null +++ b/src/models/components/updatesubscriberrequestdto.ts @@ -0,0 +1,146 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type UpdateSubscriberRequestDtoData = {}; + +export type UpdateSubscriberRequestDto = { + email?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + phone?: string | undefined; + avatar?: string | undefined; + locale?: string | undefined; + data?: UpdateSubscriberRequestDtoData | undefined; + channels?: Array | undefined; +}; + +/** @internal */ +export const UpdateSubscriberRequestDtoData$inboundSchema: z.ZodType< + UpdateSubscriberRequestDtoData, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type UpdateSubscriberRequestDtoData$Outbound = {}; + +/** @internal */ +export const UpdateSubscriberRequestDtoData$outboundSchema: z.ZodType< + UpdateSubscriberRequestDtoData$Outbound, + z.ZodTypeDef, + UpdateSubscriberRequestDtoData +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberRequestDtoData$ { + /** @deprecated use `UpdateSubscriberRequestDtoData$inboundSchema` instead. */ + export const inboundSchema = UpdateSubscriberRequestDtoData$inboundSchema; + /** @deprecated use `UpdateSubscriberRequestDtoData$outboundSchema` instead. */ + export const outboundSchema = UpdateSubscriberRequestDtoData$outboundSchema; + /** @deprecated use `UpdateSubscriberRequestDtoData$Outbound` instead. */ + export type Outbound = UpdateSubscriberRequestDtoData$Outbound; +} + +export function updateSubscriberRequestDtoDataToJSON( + updateSubscriberRequestDtoData: UpdateSubscriberRequestDtoData, +): string { + return JSON.stringify( + UpdateSubscriberRequestDtoData$outboundSchema.parse( + updateSubscriberRequestDtoData, + ), + ); +} + +export function updateSubscriberRequestDtoDataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateSubscriberRequestDtoData$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateSubscriberRequestDtoData' from JSON`, + ); +} + +/** @internal */ +export const UpdateSubscriberRequestDto$inboundSchema: z.ZodType< + UpdateSubscriberRequestDto, + z.ZodTypeDef, + unknown +> = z.object({ + email: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + data: z.lazy(() => UpdateSubscriberRequestDtoData$inboundSchema).optional(), + channels: z.array(z.string()).optional(), +}); + +/** @internal */ +export type UpdateSubscriberRequestDto$Outbound = { + email?: string | undefined; + firstName?: string | undefined; + lastName?: string | undefined; + phone?: string | undefined; + avatar?: string | undefined; + locale?: string | undefined; + data?: UpdateSubscriberRequestDtoData$Outbound | undefined; + channels?: Array | undefined; +}; + +/** @internal */ +export const UpdateSubscriberRequestDto$outboundSchema: z.ZodType< + UpdateSubscriberRequestDto$Outbound, + z.ZodTypeDef, + UpdateSubscriberRequestDto +> = z.object({ + email: z.string().optional(), + firstName: z.string().optional(), + lastName: z.string().optional(), + phone: z.string().optional(), + avatar: z.string().optional(), + locale: z.string().optional(), + data: z.lazy(() => UpdateSubscriberRequestDtoData$outboundSchema).optional(), + channels: z.array(z.string()).optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace UpdateSubscriberRequestDto$ { + /** @deprecated use `UpdateSubscriberRequestDto$inboundSchema` instead. */ + export const inboundSchema = UpdateSubscriberRequestDto$inboundSchema; + /** @deprecated use `UpdateSubscriberRequestDto$outboundSchema` instead. */ + export const outboundSchema = UpdateSubscriberRequestDto$outboundSchema; + /** @deprecated use `UpdateSubscriberRequestDto$Outbound` instead. */ + export type Outbound = UpdateSubscriberRequestDto$Outbound; +} + +export function updateSubscriberRequestDtoToJSON( + updateSubscriberRequestDto: UpdateSubscriberRequestDto, +): string { + return JSON.stringify( + UpdateSubscriberRequestDto$outboundSchema.parse(updateSubscriberRequestDto), + ); +} + +export function updateSubscriberRequestDtoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateSubscriberRequestDto$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateSubscriberRequestDto' from JSON`, + ); +} diff --git a/src/models/components/workflowresponse.ts b/src/models/components/workflowresponse.ts new file mode 100644 index 00000000..45f31bdd --- /dev/null +++ b/src/models/components/workflowresponse.ts @@ -0,0 +1,293 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; +import { + NotificationGroup, + NotificationGroup$inboundSchema, + NotificationGroup$Outbound, + NotificationGroup$outboundSchema, +} from "./notificationgroup.js"; +import { + NotificationStep, + NotificationStep$inboundSchema, + NotificationStep$Outbound, + NotificationStep$outboundSchema, +} from "./notificationstep.js"; +import { + NotificationTrigger, + NotificationTrigger$inboundSchema, + NotificationTrigger$Outbound, + NotificationTrigger$outboundSchema, +} from "./notificationtrigger.js"; +import { + PreferenceChannels, + PreferenceChannels$inboundSchema, + PreferenceChannels$Outbound, + PreferenceChannels$outboundSchema, +} from "./preferencechannels.js"; + +export type WorkflowResponseData = {}; + +export type WorkflowIntegrationStatus = {}; + +export type WorkflowResponse = { + id?: string | undefined; + name: string; + description: string; + active: boolean; + draft: boolean; + preferenceSettings: PreferenceChannels; + critical: boolean; + tags: Array; + steps: Array; + organizationId: string; + creatorId: string; + environmentId: string; + triggers: Array; + notificationGroupId: string; + parentId?: string | undefined; + deleted: boolean; + deletedAt: string; + deletedBy: string; + notificationGroup?: NotificationGroup | undefined; + data?: WorkflowResponseData | undefined; + workflowIntegrationStatus?: WorkflowIntegrationStatus | undefined; +}; + +/** @internal */ +export const WorkflowResponseData$inboundSchema: z.ZodType< + WorkflowResponseData, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type WorkflowResponseData$Outbound = {}; + +/** @internal */ +export const WorkflowResponseData$outboundSchema: z.ZodType< + WorkflowResponseData$Outbound, + z.ZodTypeDef, + WorkflowResponseData +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace WorkflowResponseData$ { + /** @deprecated use `WorkflowResponseData$inboundSchema` instead. */ + export const inboundSchema = WorkflowResponseData$inboundSchema; + /** @deprecated use `WorkflowResponseData$outboundSchema` instead. */ + export const outboundSchema = WorkflowResponseData$outboundSchema; + /** @deprecated use `WorkflowResponseData$Outbound` instead. */ + export type Outbound = WorkflowResponseData$Outbound; +} + +export function workflowResponseDataToJSON( + workflowResponseData: WorkflowResponseData, +): string { + return JSON.stringify( + WorkflowResponseData$outboundSchema.parse(workflowResponseData), + ); +} + +export function workflowResponseDataFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WorkflowResponseData$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WorkflowResponseData' from JSON`, + ); +} + +/** @internal */ +export const WorkflowIntegrationStatus$inboundSchema: z.ZodType< + WorkflowIntegrationStatus, + z.ZodTypeDef, + unknown +> = z.object({}); + +/** @internal */ +export type WorkflowIntegrationStatus$Outbound = {}; + +/** @internal */ +export const WorkflowIntegrationStatus$outboundSchema: z.ZodType< + WorkflowIntegrationStatus$Outbound, + z.ZodTypeDef, + WorkflowIntegrationStatus +> = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace WorkflowIntegrationStatus$ { + /** @deprecated use `WorkflowIntegrationStatus$inboundSchema` instead. */ + export const inboundSchema = WorkflowIntegrationStatus$inboundSchema; + /** @deprecated use `WorkflowIntegrationStatus$outboundSchema` instead. */ + export const outboundSchema = WorkflowIntegrationStatus$outboundSchema; + /** @deprecated use `WorkflowIntegrationStatus$Outbound` instead. */ + export type Outbound = WorkflowIntegrationStatus$Outbound; +} + +export function workflowIntegrationStatusToJSON( + workflowIntegrationStatus: WorkflowIntegrationStatus, +): string { + return JSON.stringify( + WorkflowIntegrationStatus$outboundSchema.parse(workflowIntegrationStatus), + ); +} + +export function workflowIntegrationStatusFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WorkflowIntegrationStatus$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WorkflowIntegrationStatus' from JSON`, + ); +} + +/** @internal */ +export const WorkflowResponse$inboundSchema: z.ZodType< + WorkflowResponse, + z.ZodTypeDef, + unknown +> = z.object({ + _id: z.string().optional(), + name: z.string(), + description: z.string(), + active: z.boolean(), + draft: z.boolean(), + preferenceSettings: PreferenceChannels$inboundSchema, + critical: z.boolean(), + tags: z.array(z.string()), + steps: z.array(NotificationStep$inboundSchema), + _organizationId: z.string(), + _creatorId: z.string(), + _environmentId: z.string(), + triggers: z.array(NotificationTrigger$inboundSchema), + _notificationGroupId: z.string(), + _parentId: z.string().optional(), + deleted: z.boolean(), + deletedAt: z.string(), + deletedBy: z.string(), + notificationGroup: NotificationGroup$inboundSchema.optional(), + data: z.lazy(() => WorkflowResponseData$inboundSchema).optional(), + workflowIntegrationStatus: z.lazy(() => + WorkflowIntegrationStatus$inboundSchema + ).optional(), +}).transform((v) => { + return remap$(v, { + "_id": "id", + "_organizationId": "organizationId", + "_creatorId": "creatorId", + "_environmentId": "environmentId", + "_notificationGroupId": "notificationGroupId", + "_parentId": "parentId", + }); +}); + +/** @internal */ +export type WorkflowResponse$Outbound = { + _id?: string | undefined; + name: string; + description: string; + active: boolean; + draft: boolean; + preferenceSettings: PreferenceChannels$Outbound; + critical: boolean; + tags: Array; + steps: Array; + _organizationId: string; + _creatorId: string; + _environmentId: string; + triggers: Array; + _notificationGroupId: string; + _parentId?: string | undefined; + deleted: boolean; + deletedAt: string; + deletedBy: string; + notificationGroup?: NotificationGroup$Outbound | undefined; + data?: WorkflowResponseData$Outbound | undefined; + workflowIntegrationStatus?: WorkflowIntegrationStatus$Outbound | undefined; +}; + +/** @internal */ +export const WorkflowResponse$outboundSchema: z.ZodType< + WorkflowResponse$Outbound, + z.ZodTypeDef, + WorkflowResponse +> = z.object({ + id: z.string().optional(), + name: z.string(), + description: z.string(), + active: z.boolean(), + draft: z.boolean(), + preferenceSettings: PreferenceChannels$outboundSchema, + critical: z.boolean(), + tags: z.array(z.string()), + steps: z.array(NotificationStep$outboundSchema), + organizationId: z.string(), + creatorId: z.string(), + environmentId: z.string(), + triggers: z.array(NotificationTrigger$outboundSchema), + notificationGroupId: z.string(), + parentId: z.string().optional(), + deleted: z.boolean(), + deletedAt: z.string(), + deletedBy: z.string(), + notificationGroup: NotificationGroup$outboundSchema.optional(), + data: z.lazy(() => WorkflowResponseData$outboundSchema).optional(), + workflowIntegrationStatus: z.lazy(() => + WorkflowIntegrationStatus$outboundSchema + ).optional(), +}).transform((v) => { + return remap$(v, { + id: "_id", + organizationId: "_organizationId", + creatorId: "_creatorId", + environmentId: "_environmentId", + notificationGroupId: "_notificationGroupId", + parentId: "_parentId", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace WorkflowResponse$ { + /** @deprecated use `WorkflowResponse$inboundSchema` instead. */ + export const inboundSchema = WorkflowResponse$inboundSchema; + /** @deprecated use `WorkflowResponse$outboundSchema` instead. */ + export const outboundSchema = WorkflowResponse$outboundSchema; + /** @deprecated use `WorkflowResponse$Outbound` instead. */ + export type Outbound = WorkflowResponse$Outbound; +} + +export function workflowResponseToJSON( + workflowResponse: WorkflowResponse, +): string { + return JSON.stringify( + WorkflowResponse$outboundSchema.parse(workflowResponse), + ); +} + +export function workflowResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WorkflowResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WorkflowResponse' from JSON`, + ); +} diff --git a/src/models/errors/httpclienterrors.ts b/src/models/errors/httpclienterrors.ts new file mode 100644 index 00000000..b34f6121 --- /dev/null +++ b/src/models/errors/httpclienterrors.ts @@ -0,0 +1,62 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/** + * Base class for all HTTP errors. + */ +export class HTTPClientError extends Error { + /** The underlying cause of the error. */ + override readonly cause: unknown; + override name = "HTTPClientError"; + constructor(message: string, opts?: { cause?: unknown }) { + let msg = message; + if (opts?.cause) { + msg += `: ${opts.cause}`; + } + + super(msg, opts); + // In older runtimes, the cause field would not have been assigned through + // the super() call. + if (typeof this.cause === "undefined") { + this.cause = opts?.cause; + } + } +} + +/** + * An error to capture unrecognised or unexpected errors when making HTTP calls. + */ +export class UnexpectedClientError extends HTTPClientError { + override name = "UnexpectedClientError"; +} + +/** + * An error that is raised when any inputs used to create a request are invalid. + */ +export class InvalidRequestError extends HTTPClientError { + override name = "InvalidRequestError"; +} + +/** + * An error that is raised when a HTTP request was aborted by the client error. + */ +export class RequestAbortedError extends HTTPClientError { + override readonly name = "RequestAbortedError"; +} + +/** + * An error that is raised when a HTTP request timed out due to an AbortSignal + * signal timeout. + */ +export class RequestTimeoutError extends HTTPClientError { + override readonly name = "RequestTimeoutError"; +} + +/** + * An error that is raised when a HTTP client is unable to make a request to + * a server. + */ +export class ConnectionError extends HTTPClientError { + override readonly name = "ConnectionError"; +} diff --git a/src/models/errors/index.ts b/src/models/errors/index.ts new file mode 100644 index 00000000..900ee9d5 --- /dev/null +++ b/src/models/errors/index.ts @@ -0,0 +1,7 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export * from "./httpclienterrors.js"; +export * from "./sdkerror.js"; +export * from "./sdkvalidationerror.js"; diff --git a/src/models/errors/sdkerror.ts b/src/models/errors/sdkerror.ts new file mode 100644 index 00000000..001f4659 --- /dev/null +++ b/src/models/errors/sdkerror.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export class SDKError extends Error { + public readonly statusCode: number; + public readonly contentType: string; + + constructor( + message: string, + public readonly rawResponse: Response, + public readonly body: string = "", + ) { + const statusCode = rawResponse.status; + const contentType = rawResponse.headers.get("content-type") || ""; + const bodyString = body.length > 0 ? `\n${body}` : ""; + + super( + `${message}: Status ${statusCode} Content-Type ${contentType} Body ${bodyString}`, + ); + + this.statusCode = statusCode; + this.contentType = contentType; + + this.name = "SDKError"; + } +} diff --git a/src/models/errors/sdkvalidationerror.ts b/src/models/errors/sdkvalidationerror.ts new file mode 100644 index 00000000..16929b9e --- /dev/null +++ b/src/models/errors/sdkvalidationerror.ts @@ -0,0 +1,97 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export class SDKValidationError extends Error { + /** + * The raw value that failed validation. + */ + public readonly rawValue: unknown; + + /** + * The raw message that failed validation. + */ + public readonly rawMessage: unknown; + + constructor(message: string, cause: unknown, rawValue: unknown) { + super(`${message}: ${cause}`); + this.name = "SDKValidationError"; + this.cause = cause; + this.rawValue = rawValue; + this.rawMessage = message; + } + + /** + * Return a pretty-formatted error message if the underlying validation error + * is a ZodError or some other recognized error type, otherwise return the + * default error message. + */ + public pretty(): string { + if (this.cause instanceof z.ZodError) { + return `${this.rawMessage}\n${formatZodError(this.cause)}`; + } else { + return this.toString(); + } + } +} + +export function formatZodError(err: z.ZodError, level = 0): string { + let pre = " ".repeat(level); + pre = level > 0 ? `│${pre}` : pre; + pre += " ".repeat(level); + + let message = ""; + const append = (str: string) => (message += `\n${pre}${str}`); + + const len = err.issues.length; + const headline = len === 1 ? `${len} issue found` : `${len} issues found`; + + if (len) { + append(`┌ ${headline}:`); + } + + for (const issue of err.issues) { + let path = issue.path.join("."); + path = path ? `.${path}` : ""; + append(`│ • [${path}]: ${issue.message} (${issue.code})`); + switch (issue.code) { + case "invalid_literal": + case "invalid_type": { + append(`│ Want: ${issue.expected}`); + append(`│ Got: ${issue.received}`); + break; + } + case "unrecognized_keys": { + append(`│ Keys: ${issue.keys.join(", ")}`); + break; + } + case "invalid_enum_value": { + append(`│ Allowed: ${issue.options.join(", ")}`); + append(`│ Got: ${issue.received}`); + break; + } + case "invalid_union_discriminator": { + append(`│ Allowed: ${issue.options.join(", ")}`); + break; + } + case "invalid_union": { + const len = issue.unionErrors.length; + append( + `│ ✖︎ Attemped to deserialize into one of ${len} union members:`, + ); + issue.unionErrors.forEach((err, i) => { + append(`│ ✖︎ Member ${i + 1} of ${len}`); + append(`${formatZodError(err, level + 1)}`); + }); + } + } + } + + if (err.issues.length) { + append(`└─*`); + } + + return message.slice(1); +} diff --git a/src/models/operations/environmentscontrollerv1getcurrentenvironment.ts b/src/models/operations/environmentscontrollerv1getcurrentenvironment.ts new file mode 100644 index 00000000..a80d8b06 --- /dev/null +++ b/src/models/operations/environmentscontrollerv1getcurrentenvironment.ts @@ -0,0 +1,96 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EnvironmentsControllerV1GetCurrentEnvironmentResponse = { + headers: { [k: string]: Array }; + result: components.EnvironmentResponseDto; +}; + +/** @internal */ +export const EnvironmentsControllerV1GetCurrentEnvironmentResponse$inboundSchema: + z.ZodType< + EnvironmentsControllerV1GetCurrentEnvironmentResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.EnvironmentResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type EnvironmentsControllerV1GetCurrentEnvironmentResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.EnvironmentResponseDto$Outbound; +}; + +/** @internal */ +export const EnvironmentsControllerV1GetCurrentEnvironmentResponse$outboundSchema: + z.ZodType< + EnvironmentsControllerV1GetCurrentEnvironmentResponse$Outbound, + z.ZodTypeDef, + EnvironmentsControllerV1GetCurrentEnvironmentResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.EnvironmentResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EnvironmentsControllerV1GetCurrentEnvironmentResponse$ { + /** @deprecated use `EnvironmentsControllerV1GetCurrentEnvironmentResponse$inboundSchema` instead. */ + export const inboundSchema = + EnvironmentsControllerV1GetCurrentEnvironmentResponse$inboundSchema; + /** @deprecated use `EnvironmentsControllerV1GetCurrentEnvironmentResponse$outboundSchema` instead. */ + export const outboundSchema = + EnvironmentsControllerV1GetCurrentEnvironmentResponse$outboundSchema; + /** @deprecated use `EnvironmentsControllerV1GetCurrentEnvironmentResponse$Outbound` instead. */ + export type Outbound = + EnvironmentsControllerV1GetCurrentEnvironmentResponse$Outbound; +} + +export function environmentsControllerV1GetCurrentEnvironmentResponseToJSON( + environmentsControllerV1GetCurrentEnvironmentResponse: + EnvironmentsControllerV1GetCurrentEnvironmentResponse, +): string { + return JSON.stringify( + EnvironmentsControllerV1GetCurrentEnvironmentResponse$outboundSchema.parse( + environmentsControllerV1GetCurrentEnvironmentResponse, + ), + ); +} + +export function environmentsControllerV1GetCurrentEnvironmentResponseFromJSON( + jsonString: string, +): SafeParseResult< + EnvironmentsControllerV1GetCurrentEnvironmentResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + EnvironmentsControllerV1GetCurrentEnvironmentResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'EnvironmentsControllerV1GetCurrentEnvironmentResponse' from JSON`, + ); +} diff --git a/src/models/operations/environmentscontrollerv1listmyenvironments.ts b/src/models/operations/environmentscontrollerv1listmyenvironments.ts new file mode 100644 index 00000000..c2892d2f --- /dev/null +++ b/src/models/operations/environmentscontrollerv1listmyenvironments.ts @@ -0,0 +1,96 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EnvironmentsControllerV1ListMyEnvironmentsResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const EnvironmentsControllerV1ListMyEnvironmentsResponse$inboundSchema: + z.ZodType< + EnvironmentsControllerV1ListMyEnvironmentsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.EnvironmentResponseDto$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type EnvironmentsControllerV1ListMyEnvironmentsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const EnvironmentsControllerV1ListMyEnvironmentsResponse$outboundSchema: + z.ZodType< + EnvironmentsControllerV1ListMyEnvironmentsResponse$Outbound, + z.ZodTypeDef, + EnvironmentsControllerV1ListMyEnvironmentsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.EnvironmentResponseDto$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EnvironmentsControllerV1ListMyEnvironmentsResponse$ { + /** @deprecated use `EnvironmentsControllerV1ListMyEnvironmentsResponse$inboundSchema` instead. */ + export const inboundSchema = + EnvironmentsControllerV1ListMyEnvironmentsResponse$inboundSchema; + /** @deprecated use `EnvironmentsControllerV1ListMyEnvironmentsResponse$outboundSchema` instead. */ + export const outboundSchema = + EnvironmentsControllerV1ListMyEnvironmentsResponse$outboundSchema; + /** @deprecated use `EnvironmentsControllerV1ListMyEnvironmentsResponse$Outbound` instead. */ + export type Outbound = + EnvironmentsControllerV1ListMyEnvironmentsResponse$Outbound; +} + +export function environmentsControllerV1ListMyEnvironmentsResponseToJSON( + environmentsControllerV1ListMyEnvironmentsResponse: + EnvironmentsControllerV1ListMyEnvironmentsResponse, +): string { + return JSON.stringify( + EnvironmentsControllerV1ListMyEnvironmentsResponse$outboundSchema.parse( + environmentsControllerV1ListMyEnvironmentsResponse, + ), + ); +} + +export function environmentsControllerV1ListMyEnvironmentsResponseFromJSON( + jsonString: string, +): SafeParseResult< + EnvironmentsControllerV1ListMyEnvironmentsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + EnvironmentsControllerV1ListMyEnvironmentsResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'EnvironmentsControllerV1ListMyEnvironmentsResponse' from JSON`, + ); +} diff --git a/src/models/operations/environmentscontrollerv1listorganizationapikeys.ts b/src/models/operations/environmentscontrollerv1listorganizationapikeys.ts new file mode 100644 index 00000000..d34a04cf --- /dev/null +++ b/src/models/operations/environmentscontrollerv1listorganizationapikeys.ts @@ -0,0 +1,94 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EnvironmentsControllerV1ListOrganizationApiKeysResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const EnvironmentsControllerV1ListOrganizationApiKeysResponse$inboundSchema: + z.ZodType< + EnvironmentsControllerV1ListOrganizationApiKeysResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.ApiKey$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type EnvironmentsControllerV1ListOrganizationApiKeysResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const EnvironmentsControllerV1ListOrganizationApiKeysResponse$outboundSchema: + z.ZodType< + EnvironmentsControllerV1ListOrganizationApiKeysResponse$Outbound, + z.ZodTypeDef, + EnvironmentsControllerV1ListOrganizationApiKeysResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.ApiKey$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EnvironmentsControllerV1ListOrganizationApiKeysResponse$ { + /** @deprecated use `EnvironmentsControllerV1ListOrganizationApiKeysResponse$inboundSchema` instead. */ + export const inboundSchema = + EnvironmentsControllerV1ListOrganizationApiKeysResponse$inboundSchema; + /** @deprecated use `EnvironmentsControllerV1ListOrganizationApiKeysResponse$outboundSchema` instead. */ + export const outboundSchema = + EnvironmentsControllerV1ListOrganizationApiKeysResponse$outboundSchema; + /** @deprecated use `EnvironmentsControllerV1ListOrganizationApiKeysResponse$Outbound` instead. */ + export type Outbound = + EnvironmentsControllerV1ListOrganizationApiKeysResponse$Outbound; +} + +export function environmentsControllerV1ListOrganizationApiKeysResponseToJSON( + environmentsControllerV1ListOrganizationApiKeysResponse: + EnvironmentsControllerV1ListOrganizationApiKeysResponse, +): string { + return JSON.stringify( + EnvironmentsControllerV1ListOrganizationApiKeysResponse$outboundSchema + .parse(environmentsControllerV1ListOrganizationApiKeysResponse), + ); +} + +export function environmentsControllerV1ListOrganizationApiKeysResponseFromJSON( + jsonString: string, +): SafeParseResult< + EnvironmentsControllerV1ListOrganizationApiKeysResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + EnvironmentsControllerV1ListOrganizationApiKeysResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'EnvironmentsControllerV1ListOrganizationApiKeysResponse' from JSON`, + ); +} diff --git a/src/models/operations/eventscontrollerbroadcasteventtoall.ts b/src/models/operations/eventscontrollerbroadcasteventtoall.ts new file mode 100644 index 00000000..fe501917 --- /dev/null +++ b/src/models/operations/eventscontrollerbroadcasteventtoall.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EventsControllerBroadcastEventToAllResponse = { + headers: { [k: string]: Array }; + result: components.TriggerEventResponseDto; +}; + +/** @internal */ +export const EventsControllerBroadcastEventToAllResponse$inboundSchema: + z.ZodType< + EventsControllerBroadcastEventToAllResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.TriggerEventResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type EventsControllerBroadcastEventToAllResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.TriggerEventResponseDto$Outbound; +}; + +/** @internal */ +export const EventsControllerBroadcastEventToAllResponse$outboundSchema: + z.ZodType< + EventsControllerBroadcastEventToAllResponse$Outbound, + z.ZodTypeDef, + EventsControllerBroadcastEventToAllResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.TriggerEventResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EventsControllerBroadcastEventToAllResponse$ { + /** @deprecated use `EventsControllerBroadcastEventToAllResponse$inboundSchema` instead. */ + export const inboundSchema = + EventsControllerBroadcastEventToAllResponse$inboundSchema; + /** @deprecated use `EventsControllerBroadcastEventToAllResponse$outboundSchema` instead. */ + export const outboundSchema = + EventsControllerBroadcastEventToAllResponse$outboundSchema; + /** @deprecated use `EventsControllerBroadcastEventToAllResponse$Outbound` instead. */ + export type Outbound = EventsControllerBroadcastEventToAllResponse$Outbound; +} + +export function eventsControllerBroadcastEventToAllResponseToJSON( + eventsControllerBroadcastEventToAllResponse: + EventsControllerBroadcastEventToAllResponse, +): string { + return JSON.stringify( + EventsControllerBroadcastEventToAllResponse$outboundSchema.parse( + eventsControllerBroadcastEventToAllResponse, + ), + ); +} + +export function eventsControllerBroadcastEventToAllResponseFromJSON( + jsonString: string, +): SafeParseResult< + EventsControllerBroadcastEventToAllResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + EventsControllerBroadcastEventToAllResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'EventsControllerBroadcastEventToAllResponse' from JSON`, + ); +} diff --git a/src/models/operations/eventscontrollercancel.ts b/src/models/operations/eventscontrollercancel.ts new file mode 100644 index 00000000..1eed1469 --- /dev/null +++ b/src/models/operations/eventscontrollercancel.ts @@ -0,0 +1,144 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EventsControllerCancelRequest = { + transactionId: string; +}; + +export type EventsControllerCancelResponse = { + headers: { [k: string]: Array }; + result: components.DataBooleanDto; +}; + +/** @internal */ +export const EventsControllerCancelRequest$inboundSchema: z.ZodType< + EventsControllerCancelRequest, + z.ZodTypeDef, + unknown +> = z.object({ + transactionId: z.string(), +}); + +/** @internal */ +export type EventsControllerCancelRequest$Outbound = { + transactionId: string; +}; + +/** @internal */ +export const EventsControllerCancelRequest$outboundSchema: z.ZodType< + EventsControllerCancelRequest$Outbound, + z.ZodTypeDef, + EventsControllerCancelRequest +> = z.object({ + transactionId: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EventsControllerCancelRequest$ { + /** @deprecated use `EventsControllerCancelRequest$inboundSchema` instead. */ + export const inboundSchema = EventsControllerCancelRequest$inboundSchema; + /** @deprecated use `EventsControllerCancelRequest$outboundSchema` instead. */ + export const outboundSchema = EventsControllerCancelRequest$outboundSchema; + /** @deprecated use `EventsControllerCancelRequest$Outbound` instead. */ + export type Outbound = EventsControllerCancelRequest$Outbound; +} + +export function eventsControllerCancelRequestToJSON( + eventsControllerCancelRequest: EventsControllerCancelRequest, +): string { + return JSON.stringify( + EventsControllerCancelRequest$outboundSchema.parse( + eventsControllerCancelRequest, + ), + ); +} + +export function eventsControllerCancelRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EventsControllerCancelRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EventsControllerCancelRequest' from JSON`, + ); +} + +/** @internal */ +export const EventsControllerCancelResponse$inboundSchema: z.ZodType< + EventsControllerCancelResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.DataBooleanDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type EventsControllerCancelResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.DataBooleanDto$Outbound; +}; + +/** @internal */ +export const EventsControllerCancelResponse$outboundSchema: z.ZodType< + EventsControllerCancelResponse$Outbound, + z.ZodTypeDef, + EventsControllerCancelResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.DataBooleanDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EventsControllerCancelResponse$ { + /** @deprecated use `EventsControllerCancelResponse$inboundSchema` instead. */ + export const inboundSchema = EventsControllerCancelResponse$inboundSchema; + /** @deprecated use `EventsControllerCancelResponse$outboundSchema` instead. */ + export const outboundSchema = EventsControllerCancelResponse$outboundSchema; + /** @deprecated use `EventsControllerCancelResponse$Outbound` instead. */ + export type Outbound = EventsControllerCancelResponse$Outbound; +} + +export function eventsControllerCancelResponseToJSON( + eventsControllerCancelResponse: EventsControllerCancelResponse, +): string { + return JSON.stringify( + EventsControllerCancelResponse$outboundSchema.parse( + eventsControllerCancelResponse, + ), + ); +} + +export function eventsControllerCancelResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EventsControllerCancelResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EventsControllerCancelResponse' from JSON`, + ); +} diff --git a/src/models/operations/eventscontrollertrigger.ts b/src/models/operations/eventscontrollertrigger.ts new file mode 100644 index 00000000..25a5fcaa --- /dev/null +++ b/src/models/operations/eventscontrollertrigger.ts @@ -0,0 +1,84 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EventsControllerTriggerResponse = { + headers: { [k: string]: Array }; + result: components.TriggerEventResponseDto; +}; + +/** @internal */ +export const EventsControllerTriggerResponse$inboundSchema: z.ZodType< + EventsControllerTriggerResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.TriggerEventResponseDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type EventsControllerTriggerResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.TriggerEventResponseDto$Outbound; +}; + +/** @internal */ +export const EventsControllerTriggerResponse$outboundSchema: z.ZodType< + EventsControllerTriggerResponse$Outbound, + z.ZodTypeDef, + EventsControllerTriggerResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.TriggerEventResponseDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EventsControllerTriggerResponse$ { + /** @deprecated use `EventsControllerTriggerResponse$inboundSchema` instead. */ + export const inboundSchema = EventsControllerTriggerResponse$inboundSchema; + /** @deprecated use `EventsControllerTriggerResponse$outboundSchema` instead. */ + export const outboundSchema = EventsControllerTriggerResponse$outboundSchema; + /** @deprecated use `EventsControllerTriggerResponse$Outbound` instead. */ + export type Outbound = EventsControllerTriggerResponse$Outbound; +} + +export function eventsControllerTriggerResponseToJSON( + eventsControllerTriggerResponse: EventsControllerTriggerResponse, +): string { + return JSON.stringify( + EventsControllerTriggerResponse$outboundSchema.parse( + eventsControllerTriggerResponse, + ), + ); +} + +export function eventsControllerTriggerResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => EventsControllerTriggerResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EventsControllerTriggerResponse' from JSON`, + ); +} diff --git a/src/models/operations/eventscontrollertriggerbulk.ts b/src/models/operations/eventscontrollertriggerbulk.ts new file mode 100644 index 00000000..45aa1492 --- /dev/null +++ b/src/models/operations/eventscontrollertriggerbulk.ts @@ -0,0 +1,87 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type EventsControllerTriggerBulkResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const EventsControllerTriggerBulkResponse$inboundSchema: z.ZodType< + EventsControllerTriggerBulkResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.TriggerEventResponseDto$inboundSchema), +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type EventsControllerTriggerBulkResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const EventsControllerTriggerBulkResponse$outboundSchema: z.ZodType< + EventsControllerTriggerBulkResponse$Outbound, + z.ZodTypeDef, + EventsControllerTriggerBulkResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.TriggerEventResponseDto$outboundSchema), +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace EventsControllerTriggerBulkResponse$ { + /** @deprecated use `EventsControllerTriggerBulkResponse$inboundSchema` instead. */ + export const inboundSchema = + EventsControllerTriggerBulkResponse$inboundSchema; + /** @deprecated use `EventsControllerTriggerBulkResponse$outboundSchema` instead. */ + export const outboundSchema = + EventsControllerTriggerBulkResponse$outboundSchema; + /** @deprecated use `EventsControllerTriggerBulkResponse$Outbound` instead. */ + export type Outbound = EventsControllerTriggerBulkResponse$Outbound; +} + +export function eventsControllerTriggerBulkResponseToJSON( + eventsControllerTriggerBulkResponse: EventsControllerTriggerBulkResponse, +): string { + return JSON.stringify( + EventsControllerTriggerBulkResponse$outboundSchema.parse( + eventsControllerTriggerBulkResponse, + ), + ); +} + +export function eventsControllerTriggerBulkResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + EventsControllerTriggerBulkResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'EventsControllerTriggerBulkResponse' from JSON`, + ); +} diff --git a/src/models/operations/executiondetailscontrollergetexecutiondetailsfornotification.ts b/src/models/operations/executiondetailscontrollergetexecutiondetailsfornotification.ts new file mode 100644 index 00000000..75dbbf34 --- /dev/null +++ b/src/models/operations/executiondetailscontrollergetexecutiondetailsfornotification.ts @@ -0,0 +1,176 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest = + { + notificationId: string; + subscriberId: string; + }; + +export type ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse = + { + headers: { [k: string]: Array }; + result: Array; + }; + +/** @internal */ +export const ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$inboundSchema: + z.ZodType< + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest, + z.ZodTypeDef, + unknown + > = z.object({ + notificationId: z.string(), + subscriberId: z.string(), + }); + +/** @internal */ +export type ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$Outbound = + { + notificationId: string; + subscriberId: string; + }; + +/** @internal */ +export const ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$outboundSchema: + z.ZodType< + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$Outbound, + z.ZodTypeDef, + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest + > = z.object({ + notificationId: z.string(), + subscriberId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$ { + /** @deprecated use `ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$inboundSchema` instead. */ + export const inboundSchema = + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$inboundSchema; + /** @deprecated use `ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$outboundSchema` instead. */ + export const outboundSchema = + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$outboundSchema; + /** @deprecated use `ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$Outbound` instead. */ + export type Outbound = + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$Outbound; +} + +export function executionDetailsControllerGetExecutionDetailsForNotificationRequestToJSON( + executionDetailsControllerGetExecutionDetailsForNotificationRequest: + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest, +): string { + return JSON.stringify( + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$outboundSchema + .parse( + executionDetailsControllerGetExecutionDetailsForNotificationRequest, + ), + ); +} + +export function executionDetailsControllerGetExecutionDetailsForNotificationRequestFromJSON( + jsonString: string, +): SafeParseResult< + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'ExecutionDetailsControllerGetExecutionDetailsForNotificationRequest' from JSON`, + ); +} + +/** @internal */ +export const ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$inboundSchema: + z.ZodType< + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.ExecutionDetailsResponseDto$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: Array; + }; + +/** @internal */ +export const ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$outboundSchema: + z.ZodType< + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$Outbound, + z.ZodTypeDef, + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.ExecutionDetailsResponseDto$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$ { + /** @deprecated use `ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$inboundSchema` instead. */ + export const inboundSchema = + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$inboundSchema; + /** @deprecated use `ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$outboundSchema` instead. */ + export const outboundSchema = + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$outboundSchema; + /** @deprecated use `ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$Outbound` instead. */ + export type Outbound = + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$Outbound; +} + +export function executionDetailsControllerGetExecutionDetailsForNotificationResponseToJSON( + executionDetailsControllerGetExecutionDetailsForNotificationResponse: + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse, +): string { + return JSON.stringify( + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$outboundSchema + .parse( + executionDetailsControllerGetExecutionDetailsForNotificationResponse, + ), + ); +} + +export function executionDetailsControllerGetExecutionDetailsForNotificationResponseFromJSON( + jsonString: string, +): SafeParseResult< + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse' from JSON`, + ); +} diff --git a/src/models/operations/index.ts b/src/models/operations/index.ts new file mode 100644 index 00000000..5d8c728f --- /dev/null +++ b/src/models/operations/index.ts @@ -0,0 +1,60 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export * from "./environmentscontrollerv1getcurrentenvironment.js"; +export * from "./environmentscontrollerv1listmyenvironments.js"; +export * from "./environmentscontrollerv1listorganizationapikeys.js"; +export * from "./eventscontrollerbroadcasteventtoall.js"; +export * from "./eventscontrollercancel.js"; +export * from "./eventscontrollertrigger.js"; +export * from "./eventscontrollertriggerbulk.js"; +export * from "./executiondetailscontrollergetexecutiondetailsfornotification.js"; +export * from "./integrationscontrollercreateintegration.js"; +export * from "./integrationscontrollergetactiveintegrations.js"; +export * from "./integrationscontrollergetwebhooksupportstatus.js"; +export * from "./integrationscontrollerlistintegrations.js"; +export * from "./integrationscontrollerremoveintegration.js"; +export * from "./integrationscontrollersetintegrationasprimary.js"; +export * from "./integrationscontrollerupdateintegrationbyid.js"; +export * from "./messagescontrollerdeletemessage.js"; +export * from "./messagescontrollerdeletemessagesbytransactionid.js"; +export * from "./messagescontrollergetmessages.js"; +export * from "./notificationgroupscontrollercreatenotificationgroup.js"; +export * from "./notificationgroupscontrollerdeletenotificationgroup.js"; +export * from "./notificationgroupscontrollergetnotificationgroup.js"; +export * from "./notificationgroupscontrollerlistnotificationgroups.js"; +export * from "./notificationgroupscontrollerupdatenotificationgroup.js"; +export * from "./notificationscontrollergetactivitygraphstats.js"; +export * from "./notificationscontrollergetactivitystats.js"; +export * from "./notificationscontrollergetnotification.js"; +export * from "./notificationscontrollerlistnotifications.js"; +export * from "./subscriberscontrollerbulkcreatesubscribers.js"; +export * from "./subscriberscontrollerchataccessoauth.js"; +export * from "./subscriberscontrollerchatoauthcallback.js"; +export * from "./subscriberscontrollercreatesubscriber.js"; +export * from "./subscriberscontrollerdeletesubscribercredentials.js"; +export * from "./subscriberscontrollergetnotificationsfeed.js"; +export * from "./subscriberscontrollergetsubscriber.js"; +export * from "./subscriberscontrollergetsubscriberpreferencebylevel.js"; +export * from "./subscriberscontrollergetunseencount.js"; +export * from "./subscriberscontrollerlistsubscriberpreferences.js"; +export * from "./subscriberscontrollerlistsubscribers.js"; +export * from "./subscriberscontrollermarkactionasseen.js"; +export * from "./subscriberscontrollermarkallunreadasread.js"; +export * from "./subscriberscontrollermarkmessagesas.js"; +export * from "./subscriberscontrollermodifysubscriberchannel.js"; +export * from "./subscriberscontrollerremovesubscriber.js"; +export * from "./subscriberscontrollerupdatesubscriber.js"; +export * from "./subscriberscontrollerupdatesubscriberchannel.js"; +export * from "./subscriberscontrollerupdatesubscriberglobalpreferences.js"; +export * from "./subscriberscontrollerupdatesubscriberonlineflag.js"; +export * from "./subscriberscontrollerupdatesubscriberpreference.js"; +export * from "./topicscontrolleraddsubscribers.js"; +export * from "./topicscontrollercreatetopic.js"; +export * from "./topicscontrollerdeletetopic.js"; +export * from "./topicscontrollergettopic.js"; +export * from "./topicscontrollergettopicsubscriber.js"; +export * from "./topicscontrollerlisttopics.js"; +export * from "./topicscontrollerremovesubscribers.js"; +export * from "./topicscontrollerrenametopic.js"; diff --git a/src/models/operations/integrationscontrollercreateintegration.ts b/src/models/operations/integrationscontrollercreateintegration.ts new file mode 100644 index 00000000..8e603d05 --- /dev/null +++ b/src/models/operations/integrationscontrollercreateintegration.ts @@ -0,0 +1,96 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type IntegrationsControllerCreateIntegrationResponse = { + headers: { [k: string]: Array }; + result: components.IntegrationResponseDto; +}; + +/** @internal */ +export const IntegrationsControllerCreateIntegrationResponse$inboundSchema: + z.ZodType< + IntegrationsControllerCreateIntegrationResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.IntegrationResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type IntegrationsControllerCreateIntegrationResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.IntegrationResponseDto$Outbound; +}; + +/** @internal */ +export const IntegrationsControllerCreateIntegrationResponse$outboundSchema: + z.ZodType< + IntegrationsControllerCreateIntegrationResponse$Outbound, + z.ZodTypeDef, + IntegrationsControllerCreateIntegrationResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.IntegrationResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerCreateIntegrationResponse$ { + /** @deprecated use `IntegrationsControllerCreateIntegrationResponse$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerCreateIntegrationResponse$inboundSchema; + /** @deprecated use `IntegrationsControllerCreateIntegrationResponse$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerCreateIntegrationResponse$outboundSchema; + /** @deprecated use `IntegrationsControllerCreateIntegrationResponse$Outbound` instead. */ + export type Outbound = + IntegrationsControllerCreateIntegrationResponse$Outbound; +} + +export function integrationsControllerCreateIntegrationResponseToJSON( + integrationsControllerCreateIntegrationResponse: + IntegrationsControllerCreateIntegrationResponse, +): string { + return JSON.stringify( + IntegrationsControllerCreateIntegrationResponse$outboundSchema.parse( + integrationsControllerCreateIntegrationResponse, + ), + ); +} + +export function integrationsControllerCreateIntegrationResponseFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerCreateIntegrationResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerCreateIntegrationResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerCreateIntegrationResponse' from JSON`, + ); +} diff --git a/src/models/operations/integrationscontrollergetactiveintegrations.ts b/src/models/operations/integrationscontrollergetactiveintegrations.ts new file mode 100644 index 00000000..44eab8ee --- /dev/null +++ b/src/models/operations/integrationscontrollergetactiveintegrations.ts @@ -0,0 +1,96 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type IntegrationsControllerGetActiveIntegrationsResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const IntegrationsControllerGetActiveIntegrationsResponse$inboundSchema: + z.ZodType< + IntegrationsControllerGetActiveIntegrationsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.IntegrationResponseDto$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type IntegrationsControllerGetActiveIntegrationsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const IntegrationsControllerGetActiveIntegrationsResponse$outboundSchema: + z.ZodType< + IntegrationsControllerGetActiveIntegrationsResponse$Outbound, + z.ZodTypeDef, + IntegrationsControllerGetActiveIntegrationsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.IntegrationResponseDto$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerGetActiveIntegrationsResponse$ { + /** @deprecated use `IntegrationsControllerGetActiveIntegrationsResponse$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerGetActiveIntegrationsResponse$inboundSchema; + /** @deprecated use `IntegrationsControllerGetActiveIntegrationsResponse$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerGetActiveIntegrationsResponse$outboundSchema; + /** @deprecated use `IntegrationsControllerGetActiveIntegrationsResponse$Outbound` instead. */ + export type Outbound = + IntegrationsControllerGetActiveIntegrationsResponse$Outbound; +} + +export function integrationsControllerGetActiveIntegrationsResponseToJSON( + integrationsControllerGetActiveIntegrationsResponse: + IntegrationsControllerGetActiveIntegrationsResponse, +): string { + return JSON.stringify( + IntegrationsControllerGetActiveIntegrationsResponse$outboundSchema.parse( + integrationsControllerGetActiveIntegrationsResponse, + ), + ); +} + +export function integrationsControllerGetActiveIntegrationsResponseFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerGetActiveIntegrationsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerGetActiveIntegrationsResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerGetActiveIntegrationsResponse' from JSON`, + ); +} diff --git a/src/models/operations/integrationscontrollergetwebhooksupportstatus.ts b/src/models/operations/integrationscontrollergetwebhooksupportstatus.ts new file mode 100644 index 00000000..326ed208 --- /dev/null +++ b/src/models/operations/integrationscontrollergetwebhooksupportstatus.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type IntegrationsControllerGetWebhookSupportStatusRequest = { + providerOrIntegrationId: string; +}; + +export type IntegrationsControllerGetWebhookSupportStatusResponse = { + headers: { [k: string]: Array }; + result: boolean; +}; + +/** @internal */ +export const IntegrationsControllerGetWebhookSupportStatusRequest$inboundSchema: + z.ZodType< + IntegrationsControllerGetWebhookSupportStatusRequest, + z.ZodTypeDef, + unknown + > = z.object({ + providerOrIntegrationId: z.string(), + }); + +/** @internal */ +export type IntegrationsControllerGetWebhookSupportStatusRequest$Outbound = { + providerOrIntegrationId: string; +}; + +/** @internal */ +export const IntegrationsControllerGetWebhookSupportStatusRequest$outboundSchema: + z.ZodType< + IntegrationsControllerGetWebhookSupportStatusRequest$Outbound, + z.ZodTypeDef, + IntegrationsControllerGetWebhookSupportStatusRequest + > = z.object({ + providerOrIntegrationId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerGetWebhookSupportStatusRequest$ { + /** @deprecated use `IntegrationsControllerGetWebhookSupportStatusRequest$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerGetWebhookSupportStatusRequest$inboundSchema; + /** @deprecated use `IntegrationsControllerGetWebhookSupportStatusRequest$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerGetWebhookSupportStatusRequest$outboundSchema; + /** @deprecated use `IntegrationsControllerGetWebhookSupportStatusRequest$Outbound` instead. */ + export type Outbound = + IntegrationsControllerGetWebhookSupportStatusRequest$Outbound; +} + +export function integrationsControllerGetWebhookSupportStatusRequestToJSON( + integrationsControllerGetWebhookSupportStatusRequest: + IntegrationsControllerGetWebhookSupportStatusRequest, +): string { + return JSON.stringify( + IntegrationsControllerGetWebhookSupportStatusRequest$outboundSchema.parse( + integrationsControllerGetWebhookSupportStatusRequest, + ), + ); +} + +export function integrationsControllerGetWebhookSupportStatusRequestFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerGetWebhookSupportStatusRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerGetWebhookSupportStatusRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerGetWebhookSupportStatusRequest' from JSON`, + ); +} + +/** @internal */ +export const IntegrationsControllerGetWebhookSupportStatusResponse$inboundSchema: + z.ZodType< + IntegrationsControllerGetWebhookSupportStatusResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.boolean(), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type IntegrationsControllerGetWebhookSupportStatusResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: boolean; +}; + +/** @internal */ +export const IntegrationsControllerGetWebhookSupportStatusResponse$outboundSchema: + z.ZodType< + IntegrationsControllerGetWebhookSupportStatusResponse$Outbound, + z.ZodTypeDef, + IntegrationsControllerGetWebhookSupportStatusResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.boolean(), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerGetWebhookSupportStatusResponse$ { + /** @deprecated use `IntegrationsControllerGetWebhookSupportStatusResponse$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerGetWebhookSupportStatusResponse$inboundSchema; + /** @deprecated use `IntegrationsControllerGetWebhookSupportStatusResponse$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerGetWebhookSupportStatusResponse$outboundSchema; + /** @deprecated use `IntegrationsControllerGetWebhookSupportStatusResponse$Outbound` instead. */ + export type Outbound = + IntegrationsControllerGetWebhookSupportStatusResponse$Outbound; +} + +export function integrationsControllerGetWebhookSupportStatusResponseToJSON( + integrationsControllerGetWebhookSupportStatusResponse: + IntegrationsControllerGetWebhookSupportStatusResponse, +): string { + return JSON.stringify( + IntegrationsControllerGetWebhookSupportStatusResponse$outboundSchema.parse( + integrationsControllerGetWebhookSupportStatusResponse, + ), + ); +} + +export function integrationsControllerGetWebhookSupportStatusResponseFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerGetWebhookSupportStatusResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerGetWebhookSupportStatusResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerGetWebhookSupportStatusResponse' from JSON`, + ); +} diff --git a/src/models/operations/integrationscontrollerlistintegrations.ts b/src/models/operations/integrationscontrollerlistintegrations.ts new file mode 100644 index 00000000..6b0b65f9 --- /dev/null +++ b/src/models/operations/integrationscontrollerlistintegrations.ts @@ -0,0 +1,96 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type IntegrationsControllerListIntegrationsResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const IntegrationsControllerListIntegrationsResponse$inboundSchema: + z.ZodType< + IntegrationsControllerListIntegrationsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.IntegrationResponseDto$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type IntegrationsControllerListIntegrationsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const IntegrationsControllerListIntegrationsResponse$outboundSchema: + z.ZodType< + IntegrationsControllerListIntegrationsResponse$Outbound, + z.ZodTypeDef, + IntegrationsControllerListIntegrationsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.IntegrationResponseDto$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerListIntegrationsResponse$ { + /** @deprecated use `IntegrationsControllerListIntegrationsResponse$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerListIntegrationsResponse$inboundSchema; + /** @deprecated use `IntegrationsControllerListIntegrationsResponse$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerListIntegrationsResponse$outboundSchema; + /** @deprecated use `IntegrationsControllerListIntegrationsResponse$Outbound` instead. */ + export type Outbound = + IntegrationsControllerListIntegrationsResponse$Outbound; +} + +export function integrationsControllerListIntegrationsResponseToJSON( + integrationsControllerListIntegrationsResponse: + IntegrationsControllerListIntegrationsResponse, +): string { + return JSON.stringify( + IntegrationsControllerListIntegrationsResponse$outboundSchema.parse( + integrationsControllerListIntegrationsResponse, + ), + ); +} + +export function integrationsControllerListIntegrationsResponseFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerListIntegrationsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerListIntegrationsResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerListIntegrationsResponse' from JSON`, + ); +} diff --git a/src/models/operations/integrationscontrollerremoveintegration.ts b/src/models/operations/integrationscontrollerremoveintegration.ts new file mode 100644 index 00000000..bcdec774 --- /dev/null +++ b/src/models/operations/integrationscontrollerremoveintegration.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type IntegrationsControllerRemoveIntegrationRequest = { + integrationId: string; +}; + +export type IntegrationsControllerRemoveIntegrationResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const IntegrationsControllerRemoveIntegrationRequest$inboundSchema: + z.ZodType< + IntegrationsControllerRemoveIntegrationRequest, + z.ZodTypeDef, + unknown + > = z.object({ + integrationId: z.string(), + }); + +/** @internal */ +export type IntegrationsControllerRemoveIntegrationRequest$Outbound = { + integrationId: string; +}; + +/** @internal */ +export const IntegrationsControllerRemoveIntegrationRequest$outboundSchema: + z.ZodType< + IntegrationsControllerRemoveIntegrationRequest$Outbound, + z.ZodTypeDef, + IntegrationsControllerRemoveIntegrationRequest + > = z.object({ + integrationId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerRemoveIntegrationRequest$ { + /** @deprecated use `IntegrationsControllerRemoveIntegrationRequest$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerRemoveIntegrationRequest$inboundSchema; + /** @deprecated use `IntegrationsControllerRemoveIntegrationRequest$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerRemoveIntegrationRequest$outboundSchema; + /** @deprecated use `IntegrationsControllerRemoveIntegrationRequest$Outbound` instead. */ + export type Outbound = + IntegrationsControllerRemoveIntegrationRequest$Outbound; +} + +export function integrationsControllerRemoveIntegrationRequestToJSON( + integrationsControllerRemoveIntegrationRequest: + IntegrationsControllerRemoveIntegrationRequest, +): string { + return JSON.stringify( + IntegrationsControllerRemoveIntegrationRequest$outboundSchema.parse( + integrationsControllerRemoveIntegrationRequest, + ), + ); +} + +export function integrationsControllerRemoveIntegrationRequestFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerRemoveIntegrationRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerRemoveIntegrationRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerRemoveIntegrationRequest' from JSON`, + ); +} + +/** @internal */ +export const IntegrationsControllerRemoveIntegrationResponse$inboundSchema: + z.ZodType< + IntegrationsControllerRemoveIntegrationResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.IntegrationResponseDto$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type IntegrationsControllerRemoveIntegrationResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const IntegrationsControllerRemoveIntegrationResponse$outboundSchema: + z.ZodType< + IntegrationsControllerRemoveIntegrationResponse$Outbound, + z.ZodTypeDef, + IntegrationsControllerRemoveIntegrationResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.IntegrationResponseDto$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerRemoveIntegrationResponse$ { + /** @deprecated use `IntegrationsControllerRemoveIntegrationResponse$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerRemoveIntegrationResponse$inboundSchema; + /** @deprecated use `IntegrationsControllerRemoveIntegrationResponse$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerRemoveIntegrationResponse$outboundSchema; + /** @deprecated use `IntegrationsControllerRemoveIntegrationResponse$Outbound` instead. */ + export type Outbound = + IntegrationsControllerRemoveIntegrationResponse$Outbound; +} + +export function integrationsControllerRemoveIntegrationResponseToJSON( + integrationsControllerRemoveIntegrationResponse: + IntegrationsControllerRemoveIntegrationResponse, +): string { + return JSON.stringify( + IntegrationsControllerRemoveIntegrationResponse$outboundSchema.parse( + integrationsControllerRemoveIntegrationResponse, + ), + ); +} + +export function integrationsControllerRemoveIntegrationResponseFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerRemoveIntegrationResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerRemoveIntegrationResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerRemoveIntegrationResponse' from JSON`, + ); +} diff --git a/src/models/operations/integrationscontrollersetintegrationasprimary.ts b/src/models/operations/integrationscontrollersetintegrationasprimary.ts new file mode 100644 index 00000000..454f8440 --- /dev/null +++ b/src/models/operations/integrationscontrollersetintegrationasprimary.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type IntegrationsControllerSetIntegrationAsPrimaryRequest = { + integrationId: string; +}; + +export type IntegrationsControllerSetIntegrationAsPrimaryResponse = { + headers: { [k: string]: Array }; + result: components.IntegrationResponseDto; +}; + +/** @internal */ +export const IntegrationsControllerSetIntegrationAsPrimaryRequest$inboundSchema: + z.ZodType< + IntegrationsControllerSetIntegrationAsPrimaryRequest, + z.ZodTypeDef, + unknown + > = z.object({ + integrationId: z.string(), + }); + +/** @internal */ +export type IntegrationsControllerSetIntegrationAsPrimaryRequest$Outbound = { + integrationId: string; +}; + +/** @internal */ +export const IntegrationsControllerSetIntegrationAsPrimaryRequest$outboundSchema: + z.ZodType< + IntegrationsControllerSetIntegrationAsPrimaryRequest$Outbound, + z.ZodTypeDef, + IntegrationsControllerSetIntegrationAsPrimaryRequest + > = z.object({ + integrationId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerSetIntegrationAsPrimaryRequest$ { + /** @deprecated use `IntegrationsControllerSetIntegrationAsPrimaryRequest$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerSetIntegrationAsPrimaryRequest$inboundSchema; + /** @deprecated use `IntegrationsControllerSetIntegrationAsPrimaryRequest$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerSetIntegrationAsPrimaryRequest$outboundSchema; + /** @deprecated use `IntegrationsControllerSetIntegrationAsPrimaryRequest$Outbound` instead. */ + export type Outbound = + IntegrationsControllerSetIntegrationAsPrimaryRequest$Outbound; +} + +export function integrationsControllerSetIntegrationAsPrimaryRequestToJSON( + integrationsControllerSetIntegrationAsPrimaryRequest: + IntegrationsControllerSetIntegrationAsPrimaryRequest, +): string { + return JSON.stringify( + IntegrationsControllerSetIntegrationAsPrimaryRequest$outboundSchema.parse( + integrationsControllerSetIntegrationAsPrimaryRequest, + ), + ); +} + +export function integrationsControllerSetIntegrationAsPrimaryRequestFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerSetIntegrationAsPrimaryRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerSetIntegrationAsPrimaryRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerSetIntegrationAsPrimaryRequest' from JSON`, + ); +} + +/** @internal */ +export const IntegrationsControllerSetIntegrationAsPrimaryResponse$inboundSchema: + z.ZodType< + IntegrationsControllerSetIntegrationAsPrimaryResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.IntegrationResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type IntegrationsControllerSetIntegrationAsPrimaryResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.IntegrationResponseDto$Outbound; +}; + +/** @internal */ +export const IntegrationsControllerSetIntegrationAsPrimaryResponse$outboundSchema: + z.ZodType< + IntegrationsControllerSetIntegrationAsPrimaryResponse$Outbound, + z.ZodTypeDef, + IntegrationsControllerSetIntegrationAsPrimaryResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.IntegrationResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerSetIntegrationAsPrimaryResponse$ { + /** @deprecated use `IntegrationsControllerSetIntegrationAsPrimaryResponse$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerSetIntegrationAsPrimaryResponse$inboundSchema; + /** @deprecated use `IntegrationsControllerSetIntegrationAsPrimaryResponse$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerSetIntegrationAsPrimaryResponse$outboundSchema; + /** @deprecated use `IntegrationsControllerSetIntegrationAsPrimaryResponse$Outbound` instead. */ + export type Outbound = + IntegrationsControllerSetIntegrationAsPrimaryResponse$Outbound; +} + +export function integrationsControllerSetIntegrationAsPrimaryResponseToJSON( + integrationsControllerSetIntegrationAsPrimaryResponse: + IntegrationsControllerSetIntegrationAsPrimaryResponse, +): string { + return JSON.stringify( + IntegrationsControllerSetIntegrationAsPrimaryResponse$outboundSchema.parse( + integrationsControllerSetIntegrationAsPrimaryResponse, + ), + ); +} + +export function integrationsControllerSetIntegrationAsPrimaryResponseFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerSetIntegrationAsPrimaryResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerSetIntegrationAsPrimaryResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerSetIntegrationAsPrimaryResponse' from JSON`, + ); +} diff --git a/src/models/operations/integrationscontrollerupdateintegrationbyid.ts b/src/models/operations/integrationscontrollerupdateintegrationbyid.ts new file mode 100644 index 00000000..f3bd1193 --- /dev/null +++ b/src/models/operations/integrationscontrollerupdateintegrationbyid.ts @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type IntegrationsControllerUpdateIntegrationByIdRequest = { + integrationId: string; + updateIntegrationRequestDto: components.UpdateIntegrationRequestDto; +}; + +export type IntegrationsControllerUpdateIntegrationByIdResponse = { + headers: { [k: string]: Array }; + result: components.IntegrationResponseDto; +}; + +/** @internal */ +export const IntegrationsControllerUpdateIntegrationByIdRequest$inboundSchema: + z.ZodType< + IntegrationsControllerUpdateIntegrationByIdRequest, + z.ZodTypeDef, + unknown + > = z.object({ + integrationId: z.string(), + UpdateIntegrationRequestDto: + components.UpdateIntegrationRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "UpdateIntegrationRequestDto": "updateIntegrationRequestDto", + }); + }); + +/** @internal */ +export type IntegrationsControllerUpdateIntegrationByIdRequest$Outbound = { + integrationId: string; + UpdateIntegrationRequestDto: components.UpdateIntegrationRequestDto$Outbound; +}; + +/** @internal */ +export const IntegrationsControllerUpdateIntegrationByIdRequest$outboundSchema: + z.ZodType< + IntegrationsControllerUpdateIntegrationByIdRequest$Outbound, + z.ZodTypeDef, + IntegrationsControllerUpdateIntegrationByIdRequest + > = z.object({ + integrationId: z.string(), + updateIntegrationRequestDto: + components.UpdateIntegrationRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + updateIntegrationRequestDto: "UpdateIntegrationRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerUpdateIntegrationByIdRequest$ { + /** @deprecated use `IntegrationsControllerUpdateIntegrationByIdRequest$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerUpdateIntegrationByIdRequest$inboundSchema; + /** @deprecated use `IntegrationsControllerUpdateIntegrationByIdRequest$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerUpdateIntegrationByIdRequest$outboundSchema; + /** @deprecated use `IntegrationsControllerUpdateIntegrationByIdRequest$Outbound` instead. */ + export type Outbound = + IntegrationsControllerUpdateIntegrationByIdRequest$Outbound; +} + +export function integrationsControllerUpdateIntegrationByIdRequestToJSON( + integrationsControllerUpdateIntegrationByIdRequest: + IntegrationsControllerUpdateIntegrationByIdRequest, +): string { + return JSON.stringify( + IntegrationsControllerUpdateIntegrationByIdRequest$outboundSchema.parse( + integrationsControllerUpdateIntegrationByIdRequest, + ), + ); +} + +export function integrationsControllerUpdateIntegrationByIdRequestFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerUpdateIntegrationByIdRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerUpdateIntegrationByIdRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerUpdateIntegrationByIdRequest' from JSON`, + ); +} + +/** @internal */ +export const IntegrationsControllerUpdateIntegrationByIdResponse$inboundSchema: + z.ZodType< + IntegrationsControllerUpdateIntegrationByIdResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.IntegrationResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type IntegrationsControllerUpdateIntegrationByIdResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.IntegrationResponseDto$Outbound; +}; + +/** @internal */ +export const IntegrationsControllerUpdateIntegrationByIdResponse$outboundSchema: + z.ZodType< + IntegrationsControllerUpdateIntegrationByIdResponse$Outbound, + z.ZodTypeDef, + IntegrationsControllerUpdateIntegrationByIdResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.IntegrationResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace IntegrationsControllerUpdateIntegrationByIdResponse$ { + /** @deprecated use `IntegrationsControllerUpdateIntegrationByIdResponse$inboundSchema` instead. */ + export const inboundSchema = + IntegrationsControllerUpdateIntegrationByIdResponse$inboundSchema; + /** @deprecated use `IntegrationsControllerUpdateIntegrationByIdResponse$outboundSchema` instead. */ + export const outboundSchema = + IntegrationsControllerUpdateIntegrationByIdResponse$outboundSchema; + /** @deprecated use `IntegrationsControllerUpdateIntegrationByIdResponse$Outbound` instead. */ + export type Outbound = + IntegrationsControllerUpdateIntegrationByIdResponse$Outbound; +} + +export function integrationsControllerUpdateIntegrationByIdResponseToJSON( + integrationsControllerUpdateIntegrationByIdResponse: + IntegrationsControllerUpdateIntegrationByIdResponse, +): string { + return JSON.stringify( + IntegrationsControllerUpdateIntegrationByIdResponse$outboundSchema.parse( + integrationsControllerUpdateIntegrationByIdResponse, + ), + ); +} + +export function integrationsControllerUpdateIntegrationByIdResponseFromJSON( + jsonString: string, +): SafeParseResult< + IntegrationsControllerUpdateIntegrationByIdResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + IntegrationsControllerUpdateIntegrationByIdResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'IntegrationsControllerUpdateIntegrationByIdResponse' from JSON`, + ); +} diff --git a/src/models/operations/messagescontrollerdeletemessage.ts b/src/models/operations/messagescontrollerdeletemessage.ts new file mode 100644 index 00000000..fc4b81d6 --- /dev/null +++ b/src/models/operations/messagescontrollerdeletemessage.ts @@ -0,0 +1,157 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type MessagesControllerDeleteMessageRequest = { + messageId: string; +}; + +export type MessagesControllerDeleteMessageResponse = { + headers: { [k: string]: Array }; + result: components.DeleteMessageResponseDto; +}; + +/** @internal */ +export const MessagesControllerDeleteMessageRequest$inboundSchema: z.ZodType< + MessagesControllerDeleteMessageRequest, + z.ZodTypeDef, + unknown +> = z.object({ + messageId: z.string(), +}); + +/** @internal */ +export type MessagesControllerDeleteMessageRequest$Outbound = { + messageId: string; +}; + +/** @internal */ +export const MessagesControllerDeleteMessageRequest$outboundSchema: z.ZodType< + MessagesControllerDeleteMessageRequest$Outbound, + z.ZodTypeDef, + MessagesControllerDeleteMessageRequest +> = z.object({ + messageId: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessagesControllerDeleteMessageRequest$ { + /** @deprecated use `MessagesControllerDeleteMessageRequest$inboundSchema` instead. */ + export const inboundSchema = + MessagesControllerDeleteMessageRequest$inboundSchema; + /** @deprecated use `MessagesControllerDeleteMessageRequest$outboundSchema` instead. */ + export const outboundSchema = + MessagesControllerDeleteMessageRequest$outboundSchema; + /** @deprecated use `MessagesControllerDeleteMessageRequest$Outbound` instead. */ + export type Outbound = MessagesControllerDeleteMessageRequest$Outbound; +} + +export function messagesControllerDeleteMessageRequestToJSON( + messagesControllerDeleteMessageRequest: + MessagesControllerDeleteMessageRequest, +): string { + return JSON.stringify( + MessagesControllerDeleteMessageRequest$outboundSchema.parse( + messagesControllerDeleteMessageRequest, + ), + ); +} + +export function messagesControllerDeleteMessageRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + MessagesControllerDeleteMessageRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessagesControllerDeleteMessageRequest' from JSON`, + ); +} + +/** @internal */ +export const MessagesControllerDeleteMessageResponse$inboundSchema: z.ZodType< + MessagesControllerDeleteMessageResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.DeleteMessageResponseDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type MessagesControllerDeleteMessageResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.DeleteMessageResponseDto$Outbound; +}; + +/** @internal */ +export const MessagesControllerDeleteMessageResponse$outboundSchema: z.ZodType< + MessagesControllerDeleteMessageResponse$Outbound, + z.ZodTypeDef, + MessagesControllerDeleteMessageResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.DeleteMessageResponseDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessagesControllerDeleteMessageResponse$ { + /** @deprecated use `MessagesControllerDeleteMessageResponse$inboundSchema` instead. */ + export const inboundSchema = + MessagesControllerDeleteMessageResponse$inboundSchema; + /** @deprecated use `MessagesControllerDeleteMessageResponse$outboundSchema` instead. */ + export const outboundSchema = + MessagesControllerDeleteMessageResponse$outboundSchema; + /** @deprecated use `MessagesControllerDeleteMessageResponse$Outbound` instead. */ + export type Outbound = MessagesControllerDeleteMessageResponse$Outbound; +} + +export function messagesControllerDeleteMessageResponseToJSON( + messagesControllerDeleteMessageResponse: + MessagesControllerDeleteMessageResponse, +): string { + return JSON.stringify( + MessagesControllerDeleteMessageResponse$outboundSchema.parse( + messagesControllerDeleteMessageResponse, + ), + ); +} + +export function messagesControllerDeleteMessageResponseFromJSON( + jsonString: string, +): SafeParseResult< + MessagesControllerDeleteMessageResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + MessagesControllerDeleteMessageResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'MessagesControllerDeleteMessageResponse' from JSON`, + ); +} diff --git a/src/models/operations/messagescontrollerdeletemessagesbytransactionid.ts b/src/models/operations/messagescontrollerdeletemessagesbytransactionid.ts new file mode 100644 index 00000000..57a6607c --- /dev/null +++ b/src/models/operations/messagescontrollerdeletemessagesbytransactionid.ts @@ -0,0 +1,202 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * The channel of the message to be deleted + */ +export const QueryParamChannel = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +/** + * The channel of the message to be deleted + */ +export type QueryParamChannel = ClosedEnum; + +export type MessagesControllerDeleteMessagesByTransactionIdRequest = { + /** + * The channel of the message to be deleted + */ + channel?: QueryParamChannel | undefined; + transactionId: string; +}; + +export type MessagesControllerDeleteMessagesByTransactionIdResponse = { + headers: { [k: string]: Array }; +}; + +/** @internal */ +export const QueryParamChannel$inboundSchema: z.ZodNativeEnum< + typeof QueryParamChannel +> = z.nativeEnum(QueryParamChannel); + +/** @internal */ +export const QueryParamChannel$outboundSchema: z.ZodNativeEnum< + typeof QueryParamChannel +> = QueryParamChannel$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace QueryParamChannel$ { + /** @deprecated use `QueryParamChannel$inboundSchema` instead. */ + export const inboundSchema = QueryParamChannel$inboundSchema; + /** @deprecated use `QueryParamChannel$outboundSchema` instead. */ + export const outboundSchema = QueryParamChannel$outboundSchema; +} + +/** @internal */ +export const MessagesControllerDeleteMessagesByTransactionIdRequest$inboundSchema: + z.ZodType< + MessagesControllerDeleteMessagesByTransactionIdRequest, + z.ZodTypeDef, + unknown + > = z.object({ + channel: QueryParamChannel$inboundSchema.optional(), + transactionId: z.string(), + }); + +/** @internal */ +export type MessagesControllerDeleteMessagesByTransactionIdRequest$Outbound = { + channel?: string | undefined; + transactionId: string; +}; + +/** @internal */ +export const MessagesControllerDeleteMessagesByTransactionIdRequest$outboundSchema: + z.ZodType< + MessagesControllerDeleteMessagesByTransactionIdRequest$Outbound, + z.ZodTypeDef, + MessagesControllerDeleteMessagesByTransactionIdRequest + > = z.object({ + channel: QueryParamChannel$outboundSchema.optional(), + transactionId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessagesControllerDeleteMessagesByTransactionIdRequest$ { + /** @deprecated use `MessagesControllerDeleteMessagesByTransactionIdRequest$inboundSchema` instead. */ + export const inboundSchema = + MessagesControllerDeleteMessagesByTransactionIdRequest$inboundSchema; + /** @deprecated use `MessagesControllerDeleteMessagesByTransactionIdRequest$outboundSchema` instead. */ + export const outboundSchema = + MessagesControllerDeleteMessagesByTransactionIdRequest$outboundSchema; + /** @deprecated use `MessagesControllerDeleteMessagesByTransactionIdRequest$Outbound` instead. */ + export type Outbound = + MessagesControllerDeleteMessagesByTransactionIdRequest$Outbound; +} + +export function messagesControllerDeleteMessagesByTransactionIdRequestToJSON( + messagesControllerDeleteMessagesByTransactionIdRequest: + MessagesControllerDeleteMessagesByTransactionIdRequest, +): string { + return JSON.stringify( + MessagesControllerDeleteMessagesByTransactionIdRequest$outboundSchema.parse( + messagesControllerDeleteMessagesByTransactionIdRequest, + ), + ); +} + +export function messagesControllerDeleteMessagesByTransactionIdRequestFromJSON( + jsonString: string, +): SafeParseResult< + MessagesControllerDeleteMessagesByTransactionIdRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + MessagesControllerDeleteMessagesByTransactionIdRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'MessagesControllerDeleteMessagesByTransactionIdRequest' from JSON`, + ); +} + +/** @internal */ +export const MessagesControllerDeleteMessagesByTransactionIdResponse$inboundSchema: + z.ZodType< + MessagesControllerDeleteMessagesByTransactionIdResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + }); + }); + +/** @internal */ +export type MessagesControllerDeleteMessagesByTransactionIdResponse$Outbound = { + Headers: { [k: string]: Array }; +}; + +/** @internal */ +export const MessagesControllerDeleteMessagesByTransactionIdResponse$outboundSchema: + z.ZodType< + MessagesControllerDeleteMessagesByTransactionIdResponse$Outbound, + z.ZodTypeDef, + MessagesControllerDeleteMessagesByTransactionIdResponse + > = z.object({ + headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessagesControllerDeleteMessagesByTransactionIdResponse$ { + /** @deprecated use `MessagesControllerDeleteMessagesByTransactionIdResponse$inboundSchema` instead. */ + export const inboundSchema = + MessagesControllerDeleteMessagesByTransactionIdResponse$inboundSchema; + /** @deprecated use `MessagesControllerDeleteMessagesByTransactionIdResponse$outboundSchema` instead. */ + export const outboundSchema = + MessagesControllerDeleteMessagesByTransactionIdResponse$outboundSchema; + /** @deprecated use `MessagesControllerDeleteMessagesByTransactionIdResponse$Outbound` instead. */ + export type Outbound = + MessagesControllerDeleteMessagesByTransactionIdResponse$Outbound; +} + +export function messagesControllerDeleteMessagesByTransactionIdResponseToJSON( + messagesControllerDeleteMessagesByTransactionIdResponse: + MessagesControllerDeleteMessagesByTransactionIdResponse, +): string { + return JSON.stringify( + MessagesControllerDeleteMessagesByTransactionIdResponse$outboundSchema + .parse(messagesControllerDeleteMessagesByTransactionIdResponse), + ); +} + +export function messagesControllerDeleteMessagesByTransactionIdResponseFromJSON( + jsonString: string, +): SafeParseResult< + MessagesControllerDeleteMessagesByTransactionIdResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + MessagesControllerDeleteMessagesByTransactionIdResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'MessagesControllerDeleteMessagesByTransactionIdResponse' from JSON`, + ); +} diff --git a/src/models/operations/messagescontrollergetmessages.ts b/src/models/operations/messagescontrollergetmessages.ts new file mode 100644 index 00000000..4b0ab8e2 --- /dev/null +++ b/src/models/operations/messagescontrollergetmessages.ts @@ -0,0 +1,195 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const Channel = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +export type Channel = ClosedEnum; + +export type MessagesControllerGetMessagesRequest = { + channel?: Channel | undefined; + subscriberId?: string | undefined; + transactionId?: Array | undefined; + page?: number | undefined; + limit?: number | undefined; +}; + +export type MessagesControllerGetMessagesResponse = { + headers: { [k: string]: Array }; + result: components.ActivitiesResponseDto; +}; + +/** @internal */ +export const Channel$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Channel); + +/** @internal */ +export const Channel$outboundSchema: z.ZodNativeEnum = + Channel$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Channel$ { + /** @deprecated use `Channel$inboundSchema` instead. */ + export const inboundSchema = Channel$inboundSchema; + /** @deprecated use `Channel$outboundSchema` instead. */ + export const outboundSchema = Channel$outboundSchema; +} + +/** @internal */ +export const MessagesControllerGetMessagesRequest$inboundSchema: z.ZodType< + MessagesControllerGetMessagesRequest, + z.ZodTypeDef, + unknown +> = z.object({ + channel: Channel$inboundSchema.optional(), + subscriberId: z.string().optional(), + transactionId: z.array(z.string()).optional(), + page: z.number().default(0), + limit: z.number().default(10), +}); + +/** @internal */ +export type MessagesControllerGetMessagesRequest$Outbound = { + channel?: string | undefined; + subscriberId?: string | undefined; + transactionId?: Array | undefined; + page: number; + limit: number; +}; + +/** @internal */ +export const MessagesControllerGetMessagesRequest$outboundSchema: z.ZodType< + MessagesControllerGetMessagesRequest$Outbound, + z.ZodTypeDef, + MessagesControllerGetMessagesRequest +> = z.object({ + channel: Channel$outboundSchema.optional(), + subscriberId: z.string().optional(), + transactionId: z.array(z.string()).optional(), + page: z.number().default(0), + limit: z.number().default(10), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessagesControllerGetMessagesRequest$ { + /** @deprecated use `MessagesControllerGetMessagesRequest$inboundSchema` instead. */ + export const inboundSchema = + MessagesControllerGetMessagesRequest$inboundSchema; + /** @deprecated use `MessagesControllerGetMessagesRequest$outboundSchema` instead. */ + export const outboundSchema = + MessagesControllerGetMessagesRequest$outboundSchema; + /** @deprecated use `MessagesControllerGetMessagesRequest$Outbound` instead. */ + export type Outbound = MessagesControllerGetMessagesRequest$Outbound; +} + +export function messagesControllerGetMessagesRequestToJSON( + messagesControllerGetMessagesRequest: MessagesControllerGetMessagesRequest, +): string { + return JSON.stringify( + MessagesControllerGetMessagesRequest$outboundSchema.parse( + messagesControllerGetMessagesRequest, + ), + ); +} + +export function messagesControllerGetMessagesRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + MessagesControllerGetMessagesRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessagesControllerGetMessagesRequest' from JSON`, + ); +} + +/** @internal */ +export const MessagesControllerGetMessagesResponse$inboundSchema: z.ZodType< + MessagesControllerGetMessagesResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.ActivitiesResponseDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type MessagesControllerGetMessagesResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.ActivitiesResponseDto$Outbound; +}; + +/** @internal */ +export const MessagesControllerGetMessagesResponse$outboundSchema: z.ZodType< + MessagesControllerGetMessagesResponse$Outbound, + z.ZodTypeDef, + MessagesControllerGetMessagesResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.ActivitiesResponseDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace MessagesControllerGetMessagesResponse$ { + /** @deprecated use `MessagesControllerGetMessagesResponse$inboundSchema` instead. */ + export const inboundSchema = + MessagesControllerGetMessagesResponse$inboundSchema; + /** @deprecated use `MessagesControllerGetMessagesResponse$outboundSchema` instead. */ + export const outboundSchema = + MessagesControllerGetMessagesResponse$outboundSchema; + /** @deprecated use `MessagesControllerGetMessagesResponse$Outbound` instead. */ + export type Outbound = MessagesControllerGetMessagesResponse$Outbound; +} + +export function messagesControllerGetMessagesResponseToJSON( + messagesControllerGetMessagesResponse: MessagesControllerGetMessagesResponse, +): string { + return JSON.stringify( + MessagesControllerGetMessagesResponse$outboundSchema.parse( + messagesControllerGetMessagesResponse, + ), + ); +} + +export function messagesControllerGetMessagesResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + MessagesControllerGetMessagesResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'MessagesControllerGetMessagesResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationgroupscontrollercreatenotificationgroup.ts b/src/models/operations/notificationgroupscontrollercreatenotificationgroup.ts new file mode 100644 index 00000000..df21b7d2 --- /dev/null +++ b/src/models/operations/notificationgroupscontrollercreatenotificationgroup.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationGroupsControllerCreateNotificationGroupResponse = { + headers: { [k: string]: Array }; + result: components.NotificationGroupResponseDto; +}; + +/** @internal */ +export const NotificationGroupsControllerCreateNotificationGroupResponse$inboundSchema: + z.ZodType< + NotificationGroupsControllerCreateNotificationGroupResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.NotificationGroupResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationGroupsControllerCreateNotificationGroupResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: components.NotificationGroupResponseDto$Outbound; + }; + +/** @internal */ +export const NotificationGroupsControllerCreateNotificationGroupResponse$outboundSchema: + z.ZodType< + NotificationGroupsControllerCreateNotificationGroupResponse$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerCreateNotificationGroupResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.NotificationGroupResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerCreateNotificationGroupResponse$ { + /** @deprecated use `NotificationGroupsControllerCreateNotificationGroupResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerCreateNotificationGroupResponse$inboundSchema; + /** @deprecated use `NotificationGroupsControllerCreateNotificationGroupResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerCreateNotificationGroupResponse$outboundSchema; + /** @deprecated use `NotificationGroupsControllerCreateNotificationGroupResponse$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerCreateNotificationGroupResponse$Outbound; +} + +export function notificationGroupsControllerCreateNotificationGroupResponseToJSON( + notificationGroupsControllerCreateNotificationGroupResponse: + NotificationGroupsControllerCreateNotificationGroupResponse, +): string { + return JSON.stringify( + NotificationGroupsControllerCreateNotificationGroupResponse$outboundSchema + .parse(notificationGroupsControllerCreateNotificationGroupResponse), + ); +} + +export function notificationGroupsControllerCreateNotificationGroupResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerCreateNotificationGroupResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerCreateNotificationGroupResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerCreateNotificationGroupResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationgroupscontrollerdeletenotificationgroup.ts b/src/models/operations/notificationgroupscontrollerdeletenotificationgroup.ts new file mode 100644 index 00000000..505fb746 --- /dev/null +++ b/src/models/operations/notificationgroupscontrollerdeletenotificationgroup.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationGroupsControllerDeleteNotificationGroupRequest = { + id: string; +}; + +export type NotificationGroupsControllerDeleteNotificationGroupResponse = { + headers: { [k: string]: Array }; + result: components.DeleteNotificationGroupResponseDto; +}; + +/** @internal */ +export const NotificationGroupsControllerDeleteNotificationGroupRequest$inboundSchema: + z.ZodType< + NotificationGroupsControllerDeleteNotificationGroupRequest, + z.ZodTypeDef, + unknown + > = z.object({ + id: z.string(), + }); + +/** @internal */ +export type NotificationGroupsControllerDeleteNotificationGroupRequest$Outbound = + { + id: string; + }; + +/** @internal */ +export const NotificationGroupsControllerDeleteNotificationGroupRequest$outboundSchema: + z.ZodType< + NotificationGroupsControllerDeleteNotificationGroupRequest$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerDeleteNotificationGroupRequest + > = z.object({ + id: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerDeleteNotificationGroupRequest$ { + /** @deprecated use `NotificationGroupsControllerDeleteNotificationGroupRequest$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerDeleteNotificationGroupRequest$inboundSchema; + /** @deprecated use `NotificationGroupsControllerDeleteNotificationGroupRequest$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerDeleteNotificationGroupRequest$outboundSchema; + /** @deprecated use `NotificationGroupsControllerDeleteNotificationGroupRequest$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerDeleteNotificationGroupRequest$Outbound; +} + +export function notificationGroupsControllerDeleteNotificationGroupRequestToJSON( + notificationGroupsControllerDeleteNotificationGroupRequest: + NotificationGroupsControllerDeleteNotificationGroupRequest, +): string { + return JSON.stringify( + NotificationGroupsControllerDeleteNotificationGroupRequest$outboundSchema + .parse(notificationGroupsControllerDeleteNotificationGroupRequest), + ); +} + +export function notificationGroupsControllerDeleteNotificationGroupRequestFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerDeleteNotificationGroupRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerDeleteNotificationGroupRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerDeleteNotificationGroupRequest' from JSON`, + ); +} + +/** @internal */ +export const NotificationGroupsControllerDeleteNotificationGroupResponse$inboundSchema: + z.ZodType< + NotificationGroupsControllerDeleteNotificationGroupResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.DeleteNotificationGroupResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationGroupsControllerDeleteNotificationGroupResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: components.DeleteNotificationGroupResponseDto$Outbound; + }; + +/** @internal */ +export const NotificationGroupsControllerDeleteNotificationGroupResponse$outboundSchema: + z.ZodType< + NotificationGroupsControllerDeleteNotificationGroupResponse$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerDeleteNotificationGroupResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.DeleteNotificationGroupResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerDeleteNotificationGroupResponse$ { + /** @deprecated use `NotificationGroupsControllerDeleteNotificationGroupResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerDeleteNotificationGroupResponse$inboundSchema; + /** @deprecated use `NotificationGroupsControllerDeleteNotificationGroupResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerDeleteNotificationGroupResponse$outboundSchema; + /** @deprecated use `NotificationGroupsControllerDeleteNotificationGroupResponse$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerDeleteNotificationGroupResponse$Outbound; +} + +export function notificationGroupsControllerDeleteNotificationGroupResponseToJSON( + notificationGroupsControllerDeleteNotificationGroupResponse: + NotificationGroupsControllerDeleteNotificationGroupResponse, +): string { + return JSON.stringify( + NotificationGroupsControllerDeleteNotificationGroupResponse$outboundSchema + .parse(notificationGroupsControllerDeleteNotificationGroupResponse), + ); +} + +export function notificationGroupsControllerDeleteNotificationGroupResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerDeleteNotificationGroupResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerDeleteNotificationGroupResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerDeleteNotificationGroupResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationgroupscontrollergetnotificationgroup.ts b/src/models/operations/notificationgroupscontrollergetnotificationgroup.ts new file mode 100644 index 00000000..8f66a911 --- /dev/null +++ b/src/models/operations/notificationgroupscontrollergetnotificationgroup.ts @@ -0,0 +1,165 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationGroupsControllerGetNotificationGroupRequest = { + id: string; +}; + +export type NotificationGroupsControllerGetNotificationGroupResponse = { + headers: { [k: string]: Array }; + result: components.NotificationGroupResponseDto; +}; + +/** @internal */ +export const NotificationGroupsControllerGetNotificationGroupRequest$inboundSchema: + z.ZodType< + NotificationGroupsControllerGetNotificationGroupRequest, + z.ZodTypeDef, + unknown + > = z.object({ + id: z.string(), + }); + +/** @internal */ +export type NotificationGroupsControllerGetNotificationGroupRequest$Outbound = { + id: string; +}; + +/** @internal */ +export const NotificationGroupsControllerGetNotificationGroupRequest$outboundSchema: + z.ZodType< + NotificationGroupsControllerGetNotificationGroupRequest$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerGetNotificationGroupRequest + > = z.object({ + id: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerGetNotificationGroupRequest$ { + /** @deprecated use `NotificationGroupsControllerGetNotificationGroupRequest$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerGetNotificationGroupRequest$inboundSchema; + /** @deprecated use `NotificationGroupsControllerGetNotificationGroupRequest$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerGetNotificationGroupRequest$outboundSchema; + /** @deprecated use `NotificationGroupsControllerGetNotificationGroupRequest$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerGetNotificationGroupRequest$Outbound; +} + +export function notificationGroupsControllerGetNotificationGroupRequestToJSON( + notificationGroupsControllerGetNotificationGroupRequest: + NotificationGroupsControllerGetNotificationGroupRequest, +): string { + return JSON.stringify( + NotificationGroupsControllerGetNotificationGroupRequest$outboundSchema + .parse(notificationGroupsControllerGetNotificationGroupRequest), + ); +} + +export function notificationGroupsControllerGetNotificationGroupRequestFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerGetNotificationGroupRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerGetNotificationGroupRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerGetNotificationGroupRequest' from JSON`, + ); +} + +/** @internal */ +export const NotificationGroupsControllerGetNotificationGroupResponse$inboundSchema: + z.ZodType< + NotificationGroupsControllerGetNotificationGroupResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.NotificationGroupResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationGroupsControllerGetNotificationGroupResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: components.NotificationGroupResponseDto$Outbound; + }; + +/** @internal */ +export const NotificationGroupsControllerGetNotificationGroupResponse$outboundSchema: + z.ZodType< + NotificationGroupsControllerGetNotificationGroupResponse$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerGetNotificationGroupResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.NotificationGroupResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerGetNotificationGroupResponse$ { + /** @deprecated use `NotificationGroupsControllerGetNotificationGroupResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerGetNotificationGroupResponse$inboundSchema; + /** @deprecated use `NotificationGroupsControllerGetNotificationGroupResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerGetNotificationGroupResponse$outboundSchema; + /** @deprecated use `NotificationGroupsControllerGetNotificationGroupResponse$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerGetNotificationGroupResponse$Outbound; +} + +export function notificationGroupsControllerGetNotificationGroupResponseToJSON( + notificationGroupsControllerGetNotificationGroupResponse: + NotificationGroupsControllerGetNotificationGroupResponse, +): string { + return JSON.stringify( + NotificationGroupsControllerGetNotificationGroupResponse$outboundSchema + .parse(notificationGroupsControllerGetNotificationGroupResponse), + ); +} + +export function notificationGroupsControllerGetNotificationGroupResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerGetNotificationGroupResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerGetNotificationGroupResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerGetNotificationGroupResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationgroupscontrollerlistnotificationgroups.ts b/src/models/operations/notificationgroupscontrollerlistnotificationgroups.ts new file mode 100644 index 00000000..6c51dad2 --- /dev/null +++ b/src/models/operations/notificationgroupscontrollerlistnotificationgroups.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationGroupsControllerListNotificationGroupsResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const NotificationGroupsControllerListNotificationGroupsResponse$inboundSchema: + z.ZodType< + NotificationGroupsControllerListNotificationGroupsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.NotificationGroupResponseDto$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationGroupsControllerListNotificationGroupsResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: Array; + }; + +/** @internal */ +export const NotificationGroupsControllerListNotificationGroupsResponse$outboundSchema: + z.ZodType< + NotificationGroupsControllerListNotificationGroupsResponse$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerListNotificationGroupsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.NotificationGroupResponseDto$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerListNotificationGroupsResponse$ { + /** @deprecated use `NotificationGroupsControllerListNotificationGroupsResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerListNotificationGroupsResponse$inboundSchema; + /** @deprecated use `NotificationGroupsControllerListNotificationGroupsResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerListNotificationGroupsResponse$outboundSchema; + /** @deprecated use `NotificationGroupsControllerListNotificationGroupsResponse$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerListNotificationGroupsResponse$Outbound; +} + +export function notificationGroupsControllerListNotificationGroupsResponseToJSON( + notificationGroupsControllerListNotificationGroupsResponse: + NotificationGroupsControllerListNotificationGroupsResponse, +): string { + return JSON.stringify( + NotificationGroupsControllerListNotificationGroupsResponse$outboundSchema + .parse(notificationGroupsControllerListNotificationGroupsResponse), + ); +} + +export function notificationGroupsControllerListNotificationGroupsResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerListNotificationGroupsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerListNotificationGroupsResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerListNotificationGroupsResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationgroupscontrollerupdatenotificationgroup.ts b/src/models/operations/notificationgroupscontrollerupdatenotificationgroup.ts new file mode 100644 index 00000000..5a7b80d0 --- /dev/null +++ b/src/models/operations/notificationgroupscontrollerupdatenotificationgroup.ts @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationGroupsControllerUpdateNotificationGroupRequest = { + id: string; + createNotificationGroupRequestDto: + components.CreateNotificationGroupRequestDto; +}; + +export type NotificationGroupsControllerUpdateNotificationGroupResponse = { + headers: { [k: string]: Array }; + result: components.NotificationGroupResponseDto; +}; + +/** @internal */ +export const NotificationGroupsControllerUpdateNotificationGroupRequest$inboundSchema: + z.ZodType< + NotificationGroupsControllerUpdateNotificationGroupRequest, + z.ZodTypeDef, + unknown + > = z.object({ + id: z.string(), + CreateNotificationGroupRequestDto: + components.CreateNotificationGroupRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "CreateNotificationGroupRequestDto": "createNotificationGroupRequestDto", + }); + }); + +/** @internal */ +export type NotificationGroupsControllerUpdateNotificationGroupRequest$Outbound = + { + id: string; + CreateNotificationGroupRequestDto: + components.CreateNotificationGroupRequestDto$Outbound; + }; + +/** @internal */ +export const NotificationGroupsControllerUpdateNotificationGroupRequest$outboundSchema: + z.ZodType< + NotificationGroupsControllerUpdateNotificationGroupRequest$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerUpdateNotificationGroupRequest + > = z.object({ + id: z.string(), + createNotificationGroupRequestDto: + components.CreateNotificationGroupRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + createNotificationGroupRequestDto: "CreateNotificationGroupRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerUpdateNotificationGroupRequest$ { + /** @deprecated use `NotificationGroupsControllerUpdateNotificationGroupRequest$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerUpdateNotificationGroupRequest$inboundSchema; + /** @deprecated use `NotificationGroupsControllerUpdateNotificationGroupRequest$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerUpdateNotificationGroupRequest$outboundSchema; + /** @deprecated use `NotificationGroupsControllerUpdateNotificationGroupRequest$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerUpdateNotificationGroupRequest$Outbound; +} + +export function notificationGroupsControllerUpdateNotificationGroupRequestToJSON( + notificationGroupsControllerUpdateNotificationGroupRequest: + NotificationGroupsControllerUpdateNotificationGroupRequest, +): string { + return JSON.stringify( + NotificationGroupsControllerUpdateNotificationGroupRequest$outboundSchema + .parse(notificationGroupsControllerUpdateNotificationGroupRequest), + ); +} + +export function notificationGroupsControllerUpdateNotificationGroupRequestFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerUpdateNotificationGroupRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerUpdateNotificationGroupRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerUpdateNotificationGroupRequest' from JSON`, + ); +} + +/** @internal */ +export const NotificationGroupsControllerUpdateNotificationGroupResponse$inboundSchema: + z.ZodType< + NotificationGroupsControllerUpdateNotificationGroupResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.NotificationGroupResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationGroupsControllerUpdateNotificationGroupResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: components.NotificationGroupResponseDto$Outbound; + }; + +/** @internal */ +export const NotificationGroupsControllerUpdateNotificationGroupResponse$outboundSchema: + z.ZodType< + NotificationGroupsControllerUpdateNotificationGroupResponse$Outbound, + z.ZodTypeDef, + NotificationGroupsControllerUpdateNotificationGroupResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.NotificationGroupResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationGroupsControllerUpdateNotificationGroupResponse$ { + /** @deprecated use `NotificationGroupsControllerUpdateNotificationGroupResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationGroupsControllerUpdateNotificationGroupResponse$inboundSchema; + /** @deprecated use `NotificationGroupsControllerUpdateNotificationGroupResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationGroupsControllerUpdateNotificationGroupResponse$outboundSchema; + /** @deprecated use `NotificationGroupsControllerUpdateNotificationGroupResponse$Outbound` instead. */ + export type Outbound = + NotificationGroupsControllerUpdateNotificationGroupResponse$Outbound; +} + +export function notificationGroupsControllerUpdateNotificationGroupResponseToJSON( + notificationGroupsControllerUpdateNotificationGroupResponse: + NotificationGroupsControllerUpdateNotificationGroupResponse, +): string { + return JSON.stringify( + NotificationGroupsControllerUpdateNotificationGroupResponse$outboundSchema + .parse(notificationGroupsControllerUpdateNotificationGroupResponse), + ); +} + +export function notificationGroupsControllerUpdateNotificationGroupResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationGroupsControllerUpdateNotificationGroupResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationGroupsControllerUpdateNotificationGroupResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'NotificationGroupsControllerUpdateNotificationGroupResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationscontrollergetactivitygraphstats.ts b/src/models/operations/notificationscontrollergetactivitygraphstats.ts new file mode 100644 index 00000000..e392a033 --- /dev/null +++ b/src/models/operations/notificationscontrollergetactivitygraphstats.ts @@ -0,0 +1,168 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationsControllerGetActivityGraphStatsRequest = { + days?: number | undefined; +}; + +export type NotificationsControllerGetActivityGraphStatsResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const NotificationsControllerGetActivityGraphStatsRequest$inboundSchema: + z.ZodType< + NotificationsControllerGetActivityGraphStatsRequest, + z.ZodTypeDef, + unknown + > = z.object({ + days: z.number().optional(), + }); + +/** @internal */ +export type NotificationsControllerGetActivityGraphStatsRequest$Outbound = { + days?: number | undefined; +}; + +/** @internal */ +export const NotificationsControllerGetActivityGraphStatsRequest$outboundSchema: + z.ZodType< + NotificationsControllerGetActivityGraphStatsRequest$Outbound, + z.ZodTypeDef, + NotificationsControllerGetActivityGraphStatsRequest + > = z.object({ + days: z.number().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationsControllerGetActivityGraphStatsRequest$ { + /** @deprecated use `NotificationsControllerGetActivityGraphStatsRequest$inboundSchema` instead. */ + export const inboundSchema = + NotificationsControllerGetActivityGraphStatsRequest$inboundSchema; + /** @deprecated use `NotificationsControllerGetActivityGraphStatsRequest$outboundSchema` instead. */ + export const outboundSchema = + NotificationsControllerGetActivityGraphStatsRequest$outboundSchema; + /** @deprecated use `NotificationsControllerGetActivityGraphStatsRequest$Outbound` instead. */ + export type Outbound = + NotificationsControllerGetActivityGraphStatsRequest$Outbound; +} + +export function notificationsControllerGetActivityGraphStatsRequestToJSON( + notificationsControllerGetActivityGraphStatsRequest: + NotificationsControllerGetActivityGraphStatsRequest, +): string { + return JSON.stringify( + NotificationsControllerGetActivityGraphStatsRequest$outboundSchema.parse( + notificationsControllerGetActivityGraphStatsRequest, + ), + ); +} + +export function notificationsControllerGetActivityGraphStatsRequestFromJSON( + jsonString: string, +): SafeParseResult< + NotificationsControllerGetActivityGraphStatsRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationsControllerGetActivityGraphStatsRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'NotificationsControllerGetActivityGraphStatsRequest' from JSON`, + ); +} + +/** @internal */ +export const NotificationsControllerGetActivityGraphStatsResponse$inboundSchema: + z.ZodType< + NotificationsControllerGetActivityGraphStatsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.ActivityGraphStatesResponse$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationsControllerGetActivityGraphStatsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const NotificationsControllerGetActivityGraphStatsResponse$outboundSchema: + z.ZodType< + NotificationsControllerGetActivityGraphStatsResponse$Outbound, + z.ZodTypeDef, + NotificationsControllerGetActivityGraphStatsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.ActivityGraphStatesResponse$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationsControllerGetActivityGraphStatsResponse$ { + /** @deprecated use `NotificationsControllerGetActivityGraphStatsResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationsControllerGetActivityGraphStatsResponse$inboundSchema; + /** @deprecated use `NotificationsControllerGetActivityGraphStatsResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationsControllerGetActivityGraphStatsResponse$outboundSchema; + /** @deprecated use `NotificationsControllerGetActivityGraphStatsResponse$Outbound` instead. */ + export type Outbound = + NotificationsControllerGetActivityGraphStatsResponse$Outbound; +} + +export function notificationsControllerGetActivityGraphStatsResponseToJSON( + notificationsControllerGetActivityGraphStatsResponse: + NotificationsControllerGetActivityGraphStatsResponse, +): string { + return JSON.stringify( + NotificationsControllerGetActivityGraphStatsResponse$outboundSchema.parse( + notificationsControllerGetActivityGraphStatsResponse, + ), + ); +} + +export function notificationsControllerGetActivityGraphStatsResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationsControllerGetActivityGraphStatsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationsControllerGetActivityGraphStatsResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'NotificationsControllerGetActivityGraphStatsResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationscontrollergetactivitystats.ts b/src/models/operations/notificationscontrollergetactivitystats.ts new file mode 100644 index 00000000..49af179c --- /dev/null +++ b/src/models/operations/notificationscontrollergetactivitystats.ts @@ -0,0 +1,96 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationsControllerGetActivityStatsResponse = { + headers: { [k: string]: Array }; + result: components.ActivityStatsResponseDto; +}; + +/** @internal */ +export const NotificationsControllerGetActivityStatsResponse$inboundSchema: + z.ZodType< + NotificationsControllerGetActivityStatsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.ActivityStatsResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationsControllerGetActivityStatsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.ActivityStatsResponseDto$Outbound; +}; + +/** @internal */ +export const NotificationsControllerGetActivityStatsResponse$outboundSchema: + z.ZodType< + NotificationsControllerGetActivityStatsResponse$Outbound, + z.ZodTypeDef, + NotificationsControllerGetActivityStatsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.ActivityStatsResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationsControllerGetActivityStatsResponse$ { + /** @deprecated use `NotificationsControllerGetActivityStatsResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationsControllerGetActivityStatsResponse$inboundSchema; + /** @deprecated use `NotificationsControllerGetActivityStatsResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationsControllerGetActivityStatsResponse$outboundSchema; + /** @deprecated use `NotificationsControllerGetActivityStatsResponse$Outbound` instead. */ + export type Outbound = + NotificationsControllerGetActivityStatsResponse$Outbound; +} + +export function notificationsControllerGetActivityStatsResponseToJSON( + notificationsControllerGetActivityStatsResponse: + NotificationsControllerGetActivityStatsResponse, +): string { + return JSON.stringify( + NotificationsControllerGetActivityStatsResponse$outboundSchema.parse( + notificationsControllerGetActivityStatsResponse, + ), + ); +} + +export function notificationsControllerGetActivityStatsResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationsControllerGetActivityStatsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationsControllerGetActivityStatsResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'NotificationsControllerGetActivityStatsResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationscontrollergetnotification.ts b/src/models/operations/notificationscontrollergetnotification.ts new file mode 100644 index 00000000..12ae293d --- /dev/null +++ b/src/models/operations/notificationscontrollergetnotification.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type NotificationsControllerGetNotificationRequest = { + notificationId: string; +}; + +export type NotificationsControllerGetNotificationResponse = { + headers: { [k: string]: Array }; + result: components.ActivityNotificationResponseDto; +}; + +/** @internal */ +export const NotificationsControllerGetNotificationRequest$inboundSchema: + z.ZodType< + NotificationsControllerGetNotificationRequest, + z.ZodTypeDef, + unknown + > = z.object({ + notificationId: z.string(), + }); + +/** @internal */ +export type NotificationsControllerGetNotificationRequest$Outbound = { + notificationId: string; +}; + +/** @internal */ +export const NotificationsControllerGetNotificationRequest$outboundSchema: + z.ZodType< + NotificationsControllerGetNotificationRequest$Outbound, + z.ZodTypeDef, + NotificationsControllerGetNotificationRequest + > = z.object({ + notificationId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationsControllerGetNotificationRequest$ { + /** @deprecated use `NotificationsControllerGetNotificationRequest$inboundSchema` instead. */ + export const inboundSchema = + NotificationsControllerGetNotificationRequest$inboundSchema; + /** @deprecated use `NotificationsControllerGetNotificationRequest$outboundSchema` instead. */ + export const outboundSchema = + NotificationsControllerGetNotificationRequest$outboundSchema; + /** @deprecated use `NotificationsControllerGetNotificationRequest$Outbound` instead. */ + export type Outbound = NotificationsControllerGetNotificationRequest$Outbound; +} + +export function notificationsControllerGetNotificationRequestToJSON( + notificationsControllerGetNotificationRequest: + NotificationsControllerGetNotificationRequest, +): string { + return JSON.stringify( + NotificationsControllerGetNotificationRequest$outboundSchema.parse( + notificationsControllerGetNotificationRequest, + ), + ); +} + +export function notificationsControllerGetNotificationRequestFromJSON( + jsonString: string, +): SafeParseResult< + NotificationsControllerGetNotificationRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationsControllerGetNotificationRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'NotificationsControllerGetNotificationRequest' from JSON`, + ); +} + +/** @internal */ +export const NotificationsControllerGetNotificationResponse$inboundSchema: + z.ZodType< + NotificationsControllerGetNotificationResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.ActivityNotificationResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationsControllerGetNotificationResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.ActivityNotificationResponseDto$Outbound; +}; + +/** @internal */ +export const NotificationsControllerGetNotificationResponse$outboundSchema: + z.ZodType< + NotificationsControllerGetNotificationResponse$Outbound, + z.ZodTypeDef, + NotificationsControllerGetNotificationResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.ActivityNotificationResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationsControllerGetNotificationResponse$ { + /** @deprecated use `NotificationsControllerGetNotificationResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationsControllerGetNotificationResponse$inboundSchema; + /** @deprecated use `NotificationsControllerGetNotificationResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationsControllerGetNotificationResponse$outboundSchema; + /** @deprecated use `NotificationsControllerGetNotificationResponse$Outbound` instead. */ + export type Outbound = + NotificationsControllerGetNotificationResponse$Outbound; +} + +export function notificationsControllerGetNotificationResponseToJSON( + notificationsControllerGetNotificationResponse: + NotificationsControllerGetNotificationResponse, +): string { + return JSON.stringify( + NotificationsControllerGetNotificationResponse$outboundSchema.parse( + notificationsControllerGetNotificationResponse, + ), + ); +} + +export function notificationsControllerGetNotificationResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationsControllerGetNotificationResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationsControllerGetNotificationResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'NotificationsControllerGetNotificationResponse' from JSON`, + ); +} diff --git a/src/models/operations/notificationscontrollerlistnotifications.ts b/src/models/operations/notificationscontrollerlistnotifications.ts new file mode 100644 index 00000000..3643a26d --- /dev/null +++ b/src/models/operations/notificationscontrollerlistnotifications.ts @@ -0,0 +1,224 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export const Channels = { + InApp: "in_app", + Email: "email", + Sms: "sms", + Chat: "chat", + Push: "push", +} as const; +export type Channels = ClosedEnum; + +export type NotificationsControllerListNotificationsRequest = { + channels: Array; + templates: Array; + emails: Array; + /** + * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. + */ + search: string; + subscriberIds: Array; + page?: number | undefined; + transactionId?: string | undefined; +}; + +export type NotificationsControllerListNotificationsResponse = { + headers: { [k: string]: Array }; + result: components.ActivitiesResponseDto; +}; + +/** @internal */ +export const Channels$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Channels); + +/** @internal */ +export const Channels$outboundSchema: z.ZodNativeEnum = + Channels$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Channels$ { + /** @deprecated use `Channels$inboundSchema` instead. */ + export const inboundSchema = Channels$inboundSchema; + /** @deprecated use `Channels$outboundSchema` instead. */ + export const outboundSchema = Channels$outboundSchema; +} + +/** @internal */ +export const NotificationsControllerListNotificationsRequest$inboundSchema: + z.ZodType< + NotificationsControllerListNotificationsRequest, + z.ZodTypeDef, + unknown + > = z.object({ + channels: z.array(Channels$inboundSchema), + templates: z.array(z.string()), + emails: z.array(z.string()), + search: z.string(), + subscriberIds: z.array(z.string()), + page: z.number().default(0), + transactionId: z.string().optional(), + }); + +/** @internal */ +export type NotificationsControllerListNotificationsRequest$Outbound = { + channels: Array; + templates: Array; + emails: Array; + search: string; + subscriberIds: Array; + page: number; + transactionId?: string | undefined; +}; + +/** @internal */ +export const NotificationsControllerListNotificationsRequest$outboundSchema: + z.ZodType< + NotificationsControllerListNotificationsRequest$Outbound, + z.ZodTypeDef, + NotificationsControllerListNotificationsRequest + > = z.object({ + channels: z.array(Channels$outboundSchema), + templates: z.array(z.string()), + emails: z.array(z.string()), + search: z.string(), + subscriberIds: z.array(z.string()), + page: z.number().default(0), + transactionId: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationsControllerListNotificationsRequest$ { + /** @deprecated use `NotificationsControllerListNotificationsRequest$inboundSchema` instead. */ + export const inboundSchema = + NotificationsControllerListNotificationsRequest$inboundSchema; + /** @deprecated use `NotificationsControllerListNotificationsRequest$outboundSchema` instead. */ + export const outboundSchema = + NotificationsControllerListNotificationsRequest$outboundSchema; + /** @deprecated use `NotificationsControllerListNotificationsRequest$Outbound` instead. */ + export type Outbound = + NotificationsControllerListNotificationsRequest$Outbound; +} + +export function notificationsControllerListNotificationsRequestToJSON( + notificationsControllerListNotificationsRequest: + NotificationsControllerListNotificationsRequest, +): string { + return JSON.stringify( + NotificationsControllerListNotificationsRequest$outboundSchema.parse( + notificationsControllerListNotificationsRequest, + ), + ); +} + +export function notificationsControllerListNotificationsRequestFromJSON( + jsonString: string, +): SafeParseResult< + NotificationsControllerListNotificationsRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationsControllerListNotificationsRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'NotificationsControllerListNotificationsRequest' from JSON`, + ); +} + +/** @internal */ +export const NotificationsControllerListNotificationsResponse$inboundSchema: + z.ZodType< + NotificationsControllerListNotificationsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.ActivitiesResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type NotificationsControllerListNotificationsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.ActivitiesResponseDto$Outbound; +}; + +/** @internal */ +export const NotificationsControllerListNotificationsResponse$outboundSchema: + z.ZodType< + NotificationsControllerListNotificationsResponse$Outbound, + z.ZodTypeDef, + NotificationsControllerListNotificationsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.ActivitiesResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace NotificationsControllerListNotificationsResponse$ { + /** @deprecated use `NotificationsControllerListNotificationsResponse$inboundSchema` instead. */ + export const inboundSchema = + NotificationsControllerListNotificationsResponse$inboundSchema; + /** @deprecated use `NotificationsControllerListNotificationsResponse$outboundSchema` instead. */ + export const outboundSchema = + NotificationsControllerListNotificationsResponse$outboundSchema; + /** @deprecated use `NotificationsControllerListNotificationsResponse$Outbound` instead. */ + export type Outbound = + NotificationsControllerListNotificationsResponse$Outbound; +} + +export function notificationsControllerListNotificationsResponseToJSON( + notificationsControllerListNotificationsResponse: + NotificationsControllerListNotificationsResponse, +): string { + return JSON.stringify( + NotificationsControllerListNotificationsResponse$outboundSchema.parse( + notificationsControllerListNotificationsResponse, + ), + ); +} + +export function notificationsControllerListNotificationsResponseFromJSON( + jsonString: string, +): SafeParseResult< + NotificationsControllerListNotificationsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + NotificationsControllerListNotificationsResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'NotificationsControllerListNotificationsResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerbulkcreatesubscribers.ts b/src/models/operations/subscriberscontrollerbulkcreatesubscribers.ts new file mode 100644 index 00000000..bf66b66f --- /dev/null +++ b/src/models/operations/subscriberscontrollerbulkcreatesubscribers.ts @@ -0,0 +1,89 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerBulkCreateSubscribersResponse = { + headers: { [k: string]: Array }; +}; + +/** @internal */ +export const SubscribersControllerBulkCreateSubscribersResponse$inboundSchema: + z.ZodType< + SubscribersControllerBulkCreateSubscribersResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + }); + }); + +/** @internal */ +export type SubscribersControllerBulkCreateSubscribersResponse$Outbound = { + Headers: { [k: string]: Array }; +}; + +/** @internal */ +export const SubscribersControllerBulkCreateSubscribersResponse$outboundSchema: + z.ZodType< + SubscribersControllerBulkCreateSubscribersResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerBulkCreateSubscribersResponse + > = z.object({ + headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerBulkCreateSubscribersResponse$ { + /** @deprecated use `SubscribersControllerBulkCreateSubscribersResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerBulkCreateSubscribersResponse$inboundSchema; + /** @deprecated use `SubscribersControllerBulkCreateSubscribersResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerBulkCreateSubscribersResponse$outboundSchema; + /** @deprecated use `SubscribersControllerBulkCreateSubscribersResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerBulkCreateSubscribersResponse$Outbound; +} + +export function subscribersControllerBulkCreateSubscribersResponseToJSON( + subscribersControllerBulkCreateSubscribersResponse: + SubscribersControllerBulkCreateSubscribersResponse, +): string { + return JSON.stringify( + SubscribersControllerBulkCreateSubscribersResponse$outboundSchema.parse( + subscribersControllerBulkCreateSubscribersResponse, + ), + ); +} + +export function subscribersControllerBulkCreateSubscribersResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerBulkCreateSubscribersResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerBulkCreateSubscribersResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerBulkCreateSubscribersResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerchataccessoauth.ts b/src/models/operations/subscriberscontrollerchataccessoauth.ts new file mode 100644 index 00000000..384465b7 --- /dev/null +++ b/src/models/operations/subscriberscontrollerchataccessoauth.ts @@ -0,0 +1,175 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerChatAccessOauthRequest = { + subscriberId: string; + providerId?: any | undefined; + hmacHash: string; + environmentId: string; + integrationIdentifier?: string | undefined; +}; + +export type SubscribersControllerChatAccessOauthResponse = { + headers: { [k: string]: Array }; +}; + +/** @internal */ +export const SubscribersControllerChatAccessOauthRequest$inboundSchema: + z.ZodType< + SubscribersControllerChatAccessOauthRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + providerId: z.any().optional(), + hmacHash: z.string(), + environmentId: z.string(), + integrationIdentifier: z.string().optional(), + }); + +/** @internal */ +export type SubscribersControllerChatAccessOauthRequest$Outbound = { + subscriberId: string; + providerId?: any | undefined; + hmacHash: string; + environmentId: string; + integrationIdentifier?: string | undefined; +}; + +/** @internal */ +export const SubscribersControllerChatAccessOauthRequest$outboundSchema: + z.ZodType< + SubscribersControllerChatAccessOauthRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerChatAccessOauthRequest + > = z.object({ + subscriberId: z.string(), + providerId: z.any().optional(), + hmacHash: z.string(), + environmentId: z.string(), + integrationIdentifier: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerChatAccessOauthRequest$ { + /** @deprecated use `SubscribersControllerChatAccessOauthRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerChatAccessOauthRequest$inboundSchema; + /** @deprecated use `SubscribersControllerChatAccessOauthRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerChatAccessOauthRequest$outboundSchema; + /** @deprecated use `SubscribersControllerChatAccessOauthRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerChatAccessOauthRequest$Outbound; +} + +export function subscribersControllerChatAccessOauthRequestToJSON( + subscribersControllerChatAccessOauthRequest: + SubscribersControllerChatAccessOauthRequest, +): string { + return JSON.stringify( + SubscribersControllerChatAccessOauthRequest$outboundSchema.parse( + subscribersControllerChatAccessOauthRequest, + ), + ); +} + +export function subscribersControllerChatAccessOauthRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerChatAccessOauthRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerChatAccessOauthRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerChatAccessOauthRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerChatAccessOauthResponse$inboundSchema: + z.ZodType< + SubscribersControllerChatAccessOauthResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + }); + }); + +/** @internal */ +export type SubscribersControllerChatAccessOauthResponse$Outbound = { + Headers: { [k: string]: Array }; +}; + +/** @internal */ +export const SubscribersControllerChatAccessOauthResponse$outboundSchema: + z.ZodType< + SubscribersControllerChatAccessOauthResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerChatAccessOauthResponse + > = z.object({ + headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerChatAccessOauthResponse$ { + /** @deprecated use `SubscribersControllerChatAccessOauthResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerChatAccessOauthResponse$inboundSchema; + /** @deprecated use `SubscribersControllerChatAccessOauthResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerChatAccessOauthResponse$outboundSchema; + /** @deprecated use `SubscribersControllerChatAccessOauthResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerChatAccessOauthResponse$Outbound; +} + +export function subscribersControllerChatAccessOauthResponseToJSON( + subscribersControllerChatAccessOauthResponse: + SubscribersControllerChatAccessOauthResponse, +): string { + return JSON.stringify( + SubscribersControllerChatAccessOauthResponse$outboundSchema.parse( + subscribersControllerChatAccessOauthResponse, + ), + ); +} + +export function subscribersControllerChatAccessOauthResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerChatAccessOauthResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerChatAccessOauthResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerChatAccessOauthResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerchatoauthcallback.ts b/src/models/operations/subscriberscontrollerchatoauthcallback.ts new file mode 100644 index 00000000..8f1b742e --- /dev/null +++ b/src/models/operations/subscriberscontrollerchatoauthcallback.ts @@ -0,0 +1,254 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerChatOauthCallbackRequest = { + subscriberId: string; + providerId?: any | undefined; + code: string; + hmacHash: string; + environmentId: string; + integrationIdentifier?: string | undefined; +}; + +export type SubscribersControllerChatOauthCallbackResponseBody = {}; + +export type SubscribersControllerChatOauthCallbackResponse = { + headers: { [k: string]: Array }; + result: SubscribersControllerChatOauthCallbackResponseBody; +}; + +/** @internal */ +export const SubscribersControllerChatOauthCallbackRequest$inboundSchema: + z.ZodType< + SubscribersControllerChatOauthCallbackRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + providerId: z.any().optional(), + code: z.string(), + hmacHash: z.string(), + environmentId: z.string(), + integrationIdentifier: z.string().optional(), + }); + +/** @internal */ +export type SubscribersControllerChatOauthCallbackRequest$Outbound = { + subscriberId: string; + providerId?: any | undefined; + code: string; + hmacHash: string; + environmentId: string; + integrationIdentifier?: string | undefined; +}; + +/** @internal */ +export const SubscribersControllerChatOauthCallbackRequest$outboundSchema: + z.ZodType< + SubscribersControllerChatOauthCallbackRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerChatOauthCallbackRequest + > = z.object({ + subscriberId: z.string(), + providerId: z.any().optional(), + code: z.string(), + hmacHash: z.string(), + environmentId: z.string(), + integrationIdentifier: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerChatOauthCallbackRequest$ { + /** @deprecated use `SubscribersControllerChatOauthCallbackRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerChatOauthCallbackRequest$inboundSchema; + /** @deprecated use `SubscribersControllerChatOauthCallbackRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerChatOauthCallbackRequest$outboundSchema; + /** @deprecated use `SubscribersControllerChatOauthCallbackRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerChatOauthCallbackRequest$Outbound; +} + +export function subscribersControllerChatOauthCallbackRequestToJSON( + subscribersControllerChatOauthCallbackRequest: + SubscribersControllerChatOauthCallbackRequest, +): string { + return JSON.stringify( + SubscribersControllerChatOauthCallbackRequest$outboundSchema.parse( + subscribersControllerChatOauthCallbackRequest, + ), + ); +} + +export function subscribersControllerChatOauthCallbackRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerChatOauthCallbackRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerChatOauthCallbackRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerChatOauthCallbackRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerChatOauthCallbackResponseBody$inboundSchema: + z.ZodType< + SubscribersControllerChatOauthCallbackResponseBody, + z.ZodTypeDef, + unknown + > = z.object({}); + +/** @internal */ +export type SubscribersControllerChatOauthCallbackResponseBody$Outbound = {}; + +/** @internal */ +export const SubscribersControllerChatOauthCallbackResponseBody$outboundSchema: + z.ZodType< + SubscribersControllerChatOauthCallbackResponseBody$Outbound, + z.ZodTypeDef, + SubscribersControllerChatOauthCallbackResponseBody + > = z.object({}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerChatOauthCallbackResponseBody$ { + /** @deprecated use `SubscribersControllerChatOauthCallbackResponseBody$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerChatOauthCallbackResponseBody$inboundSchema; + /** @deprecated use `SubscribersControllerChatOauthCallbackResponseBody$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerChatOauthCallbackResponseBody$outboundSchema; + /** @deprecated use `SubscribersControllerChatOauthCallbackResponseBody$Outbound` instead. */ + export type Outbound = + SubscribersControllerChatOauthCallbackResponseBody$Outbound; +} + +export function subscribersControllerChatOauthCallbackResponseBodyToJSON( + subscribersControllerChatOauthCallbackResponseBody: + SubscribersControllerChatOauthCallbackResponseBody, +): string { + return JSON.stringify( + SubscribersControllerChatOauthCallbackResponseBody$outboundSchema.parse( + subscribersControllerChatOauthCallbackResponseBody, + ), + ); +} + +export function subscribersControllerChatOauthCallbackResponseBodyFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerChatOauthCallbackResponseBody, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerChatOauthCallbackResponseBody$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerChatOauthCallbackResponseBody' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerChatOauthCallbackResponse$inboundSchema: + z.ZodType< + SubscribersControllerChatOauthCallbackResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.lazy(() => + SubscribersControllerChatOauthCallbackResponseBody$inboundSchema + ), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerChatOauthCallbackResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: SubscribersControllerChatOauthCallbackResponseBody$Outbound; +}; + +/** @internal */ +export const SubscribersControllerChatOauthCallbackResponse$outboundSchema: + z.ZodType< + SubscribersControllerChatOauthCallbackResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerChatOauthCallbackResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.lazy(() => + SubscribersControllerChatOauthCallbackResponseBody$outboundSchema + ), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerChatOauthCallbackResponse$ { + /** @deprecated use `SubscribersControllerChatOauthCallbackResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerChatOauthCallbackResponse$inboundSchema; + /** @deprecated use `SubscribersControllerChatOauthCallbackResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerChatOauthCallbackResponse$outboundSchema; + /** @deprecated use `SubscribersControllerChatOauthCallbackResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerChatOauthCallbackResponse$Outbound; +} + +export function subscribersControllerChatOauthCallbackResponseToJSON( + subscribersControllerChatOauthCallbackResponse: + SubscribersControllerChatOauthCallbackResponse, +): string { + return JSON.stringify( + SubscribersControllerChatOauthCallbackResponse$outboundSchema.parse( + subscribersControllerChatOauthCallbackResponse, + ), + ); +} + +export function subscribersControllerChatOauthCallbackResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerChatOauthCallbackResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerChatOauthCallbackResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerChatOauthCallbackResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollercreatesubscriber.ts b/src/models/operations/subscriberscontrollercreatesubscriber.ts new file mode 100644 index 00000000..b2565f10 --- /dev/null +++ b/src/models/operations/subscriberscontrollercreatesubscriber.ts @@ -0,0 +1,95 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerCreateSubscriberResponse = { + headers: { [k: string]: Array }; + result: components.SubscriberResponseDto; +}; + +/** @internal */ +export const SubscribersControllerCreateSubscriberResponse$inboundSchema: + z.ZodType< + SubscribersControllerCreateSubscriberResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.SubscriberResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerCreateSubscriberResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.SubscriberResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerCreateSubscriberResponse$outboundSchema: + z.ZodType< + SubscribersControllerCreateSubscriberResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerCreateSubscriberResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.SubscriberResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerCreateSubscriberResponse$ { + /** @deprecated use `SubscribersControllerCreateSubscriberResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerCreateSubscriberResponse$inboundSchema; + /** @deprecated use `SubscribersControllerCreateSubscriberResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerCreateSubscriberResponse$outboundSchema; + /** @deprecated use `SubscribersControllerCreateSubscriberResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerCreateSubscriberResponse$Outbound; +} + +export function subscribersControllerCreateSubscriberResponseToJSON( + subscribersControllerCreateSubscriberResponse: + SubscribersControllerCreateSubscriberResponse, +): string { + return JSON.stringify( + SubscribersControllerCreateSubscriberResponse$outboundSchema.parse( + subscribersControllerCreateSubscriberResponse, + ), + ); +} + +export function subscribersControllerCreateSubscriberResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerCreateSubscriberResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerCreateSubscriberResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerCreateSubscriberResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerdeletesubscribercredentials.ts b/src/models/operations/subscriberscontrollerdeletesubscribercredentials.ts new file mode 100644 index 00000000..b8f06c77 --- /dev/null +++ b/src/models/operations/subscriberscontrollerdeletesubscribercredentials.ts @@ -0,0 +1,162 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerDeleteSubscriberCredentialsRequest = { + subscriberId: string; + providerId: string; +}; + +export type SubscribersControllerDeleteSubscriberCredentialsResponse = { + headers: { [k: string]: Array }; +}; + +/** @internal */ +export const SubscribersControllerDeleteSubscriberCredentialsRequest$inboundSchema: + z.ZodType< + SubscribersControllerDeleteSubscriberCredentialsRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + providerId: z.string(), + }); + +/** @internal */ +export type SubscribersControllerDeleteSubscriberCredentialsRequest$Outbound = { + subscriberId: string; + providerId: string; +}; + +/** @internal */ +export const SubscribersControllerDeleteSubscriberCredentialsRequest$outboundSchema: + z.ZodType< + SubscribersControllerDeleteSubscriberCredentialsRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerDeleteSubscriberCredentialsRequest + > = z.object({ + subscriberId: z.string(), + providerId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerDeleteSubscriberCredentialsRequest$ { + /** @deprecated use `SubscribersControllerDeleteSubscriberCredentialsRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerDeleteSubscriberCredentialsRequest$inboundSchema; + /** @deprecated use `SubscribersControllerDeleteSubscriberCredentialsRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerDeleteSubscriberCredentialsRequest$outboundSchema; + /** @deprecated use `SubscribersControllerDeleteSubscriberCredentialsRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerDeleteSubscriberCredentialsRequest$Outbound; +} + +export function subscribersControllerDeleteSubscriberCredentialsRequestToJSON( + subscribersControllerDeleteSubscriberCredentialsRequest: + SubscribersControllerDeleteSubscriberCredentialsRequest, +): string { + return JSON.stringify( + SubscribersControllerDeleteSubscriberCredentialsRequest$outboundSchema + .parse(subscribersControllerDeleteSubscriberCredentialsRequest), + ); +} + +export function subscribersControllerDeleteSubscriberCredentialsRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerDeleteSubscriberCredentialsRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerDeleteSubscriberCredentialsRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerDeleteSubscriberCredentialsRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerDeleteSubscriberCredentialsResponse$inboundSchema: + z.ZodType< + SubscribersControllerDeleteSubscriberCredentialsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + }); + }); + +/** @internal */ +export type SubscribersControllerDeleteSubscriberCredentialsResponse$Outbound = + { + Headers: { [k: string]: Array }; + }; + +/** @internal */ +export const SubscribersControllerDeleteSubscriberCredentialsResponse$outboundSchema: + z.ZodType< + SubscribersControllerDeleteSubscriberCredentialsResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerDeleteSubscriberCredentialsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerDeleteSubscriberCredentialsResponse$ { + /** @deprecated use `SubscribersControllerDeleteSubscriberCredentialsResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerDeleteSubscriberCredentialsResponse$inboundSchema; + /** @deprecated use `SubscribersControllerDeleteSubscriberCredentialsResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerDeleteSubscriberCredentialsResponse$outboundSchema; + /** @deprecated use `SubscribersControllerDeleteSubscriberCredentialsResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerDeleteSubscriberCredentialsResponse$Outbound; +} + +export function subscribersControllerDeleteSubscriberCredentialsResponseToJSON( + subscribersControllerDeleteSubscriberCredentialsResponse: + SubscribersControllerDeleteSubscriberCredentialsResponse, +): string { + return JSON.stringify( + SubscribersControllerDeleteSubscriberCredentialsResponse$outboundSchema + .parse(subscribersControllerDeleteSubscriberCredentialsResponse), + ); +} + +export function subscribersControllerDeleteSubscriberCredentialsResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerDeleteSubscriberCredentialsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerDeleteSubscriberCredentialsResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerDeleteSubscriberCredentialsResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollergetnotificationsfeed.ts b/src/models/operations/subscriberscontrollergetnotificationsfeed.ts new file mode 100644 index 00000000..8775dc61 --- /dev/null +++ b/src/models/operations/subscriberscontrollergetnotificationsfeed.ts @@ -0,0 +1,288 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerGetNotificationsFeedRequest = { + subscriberId: string; + page?: number | undefined; + limit?: number | undefined; + read?: boolean | undefined; + seen?: boolean | undefined; + /** + * Base64 encoded string of the partial payload JSON object + */ + payload?: string | undefined; +}; + +export type SubscribersControllerGetNotificationsFeedResponseBody = { + /** + * The current page of the paginated response + */ + page: number; + /** + * Does the list have more items to fetch + */ + hasMore: boolean; + /** + * Number of items on each page + */ + pageSize: number; + data: Array; +}; + +export type SubscribersControllerGetNotificationsFeedResponse = { + headers: { [k: string]: Array }; + result: SubscribersControllerGetNotificationsFeedResponseBody; +}; + +/** @internal */ +export const SubscribersControllerGetNotificationsFeedRequest$inboundSchema: + z.ZodType< + SubscribersControllerGetNotificationsFeedRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + page: z.number().optional(), + limit: z.number().default(10), + read: z.boolean().optional(), + seen: z.boolean().optional(), + payload: z.string().optional(), + }); + +/** @internal */ +export type SubscribersControllerGetNotificationsFeedRequest$Outbound = { + subscriberId: string; + page?: number | undefined; + limit: number; + read?: boolean | undefined; + seen?: boolean | undefined; + payload?: string | undefined; +}; + +/** @internal */ +export const SubscribersControllerGetNotificationsFeedRequest$outboundSchema: + z.ZodType< + SubscribersControllerGetNotificationsFeedRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerGetNotificationsFeedRequest + > = z.object({ + subscriberId: z.string(), + page: z.number().optional(), + limit: z.number().default(10), + read: z.boolean().optional(), + seen: z.boolean().optional(), + payload: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetNotificationsFeedRequest$ { + /** @deprecated use `SubscribersControllerGetNotificationsFeedRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetNotificationsFeedRequest$inboundSchema; + /** @deprecated use `SubscribersControllerGetNotificationsFeedRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetNotificationsFeedRequest$outboundSchema; + /** @deprecated use `SubscribersControllerGetNotificationsFeedRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerGetNotificationsFeedRequest$Outbound; +} + +export function subscribersControllerGetNotificationsFeedRequestToJSON( + subscribersControllerGetNotificationsFeedRequest: + SubscribersControllerGetNotificationsFeedRequest, +): string { + return JSON.stringify( + SubscribersControllerGetNotificationsFeedRequest$outboundSchema.parse( + subscribersControllerGetNotificationsFeedRequest, + ), + ); +} + +export function subscribersControllerGetNotificationsFeedRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetNotificationsFeedRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetNotificationsFeedRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerGetNotificationsFeedRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerGetNotificationsFeedResponseBody$inboundSchema: + z.ZodType< + SubscribersControllerGetNotificationsFeedResponseBody, + z.ZodTypeDef, + unknown + > = z.object({ + page: z.number(), + hasMore: z.boolean(), + pageSize: z.number(), + data: z.array(components.FeedResponseDto$inboundSchema), + }); + +/** @internal */ +export type SubscribersControllerGetNotificationsFeedResponseBody$Outbound = { + page: number; + hasMore: boolean; + pageSize: number; + data: Array; +}; + +/** @internal */ +export const SubscribersControllerGetNotificationsFeedResponseBody$outboundSchema: + z.ZodType< + SubscribersControllerGetNotificationsFeedResponseBody$Outbound, + z.ZodTypeDef, + SubscribersControllerGetNotificationsFeedResponseBody + > = z.object({ + page: z.number(), + hasMore: z.boolean(), + pageSize: z.number(), + data: z.array(components.FeedResponseDto$outboundSchema), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetNotificationsFeedResponseBody$ { + /** @deprecated use `SubscribersControllerGetNotificationsFeedResponseBody$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetNotificationsFeedResponseBody$inboundSchema; + /** @deprecated use `SubscribersControllerGetNotificationsFeedResponseBody$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetNotificationsFeedResponseBody$outboundSchema; + /** @deprecated use `SubscribersControllerGetNotificationsFeedResponseBody$Outbound` instead. */ + export type Outbound = + SubscribersControllerGetNotificationsFeedResponseBody$Outbound; +} + +export function subscribersControllerGetNotificationsFeedResponseBodyToJSON( + subscribersControllerGetNotificationsFeedResponseBody: + SubscribersControllerGetNotificationsFeedResponseBody, +): string { + return JSON.stringify( + SubscribersControllerGetNotificationsFeedResponseBody$outboundSchema.parse( + subscribersControllerGetNotificationsFeedResponseBody, + ), + ); +} + +export function subscribersControllerGetNotificationsFeedResponseBodyFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetNotificationsFeedResponseBody, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetNotificationsFeedResponseBody$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerGetNotificationsFeedResponseBody' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerGetNotificationsFeedResponse$inboundSchema: + z.ZodType< + SubscribersControllerGetNotificationsFeedResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.lazy(() => + SubscribersControllerGetNotificationsFeedResponseBody$inboundSchema + ), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerGetNotificationsFeedResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: SubscribersControllerGetNotificationsFeedResponseBody$Outbound; +}; + +/** @internal */ +export const SubscribersControllerGetNotificationsFeedResponse$outboundSchema: + z.ZodType< + SubscribersControllerGetNotificationsFeedResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerGetNotificationsFeedResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.lazy(() => + SubscribersControllerGetNotificationsFeedResponseBody$outboundSchema + ), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetNotificationsFeedResponse$ { + /** @deprecated use `SubscribersControllerGetNotificationsFeedResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetNotificationsFeedResponse$inboundSchema; + /** @deprecated use `SubscribersControllerGetNotificationsFeedResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetNotificationsFeedResponse$outboundSchema; + /** @deprecated use `SubscribersControllerGetNotificationsFeedResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerGetNotificationsFeedResponse$Outbound; +} + +export function subscribersControllerGetNotificationsFeedResponseToJSON( + subscribersControllerGetNotificationsFeedResponse: + SubscribersControllerGetNotificationsFeedResponse, +): string { + return JSON.stringify( + SubscribersControllerGetNotificationsFeedResponse$outboundSchema.parse( + subscribersControllerGetNotificationsFeedResponse, + ), + ); +} + +export function subscribersControllerGetNotificationsFeedResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetNotificationsFeedResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetNotificationsFeedResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerGetNotificationsFeedResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollergetsubscriber.ts b/src/models/operations/subscriberscontrollergetsubscriber.ts new file mode 100644 index 00000000..f82b76ad --- /dev/null +++ b/src/models/operations/subscriberscontrollergetsubscriber.ts @@ -0,0 +1,169 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerGetSubscriberRequest = { + subscriberId: string; + /** + * Includes the topics associated with the subscriber + */ + includeTopics?: string | undefined; +}; + +export type SubscribersControllerGetSubscriberResponse = { + headers: { [k: string]: Array }; + result: components.SubscriberResponseDto; +}; + +/** @internal */ +export const SubscribersControllerGetSubscriberRequest$inboundSchema: z.ZodType< + SubscribersControllerGetSubscriberRequest, + z.ZodTypeDef, + unknown +> = z.object({ + subscriberId: z.string(), + includeTopics: z.string().optional(), +}); + +/** @internal */ +export type SubscribersControllerGetSubscriberRequest$Outbound = { + subscriberId: string; + includeTopics?: string | undefined; +}; + +/** @internal */ +export const SubscribersControllerGetSubscriberRequest$outboundSchema: + z.ZodType< + SubscribersControllerGetSubscriberRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerGetSubscriberRequest + > = z.object({ + subscriberId: z.string(), + includeTopics: z.string().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetSubscriberRequest$ { + /** @deprecated use `SubscribersControllerGetSubscriberRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetSubscriberRequest$inboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetSubscriberRequest$outboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerGetSubscriberRequest$Outbound; +} + +export function subscribersControllerGetSubscriberRequestToJSON( + subscribersControllerGetSubscriberRequest: + SubscribersControllerGetSubscriberRequest, +): string { + return JSON.stringify( + SubscribersControllerGetSubscriberRequest$outboundSchema.parse( + subscribersControllerGetSubscriberRequest, + ), + ); +} + +export function subscribersControllerGetSubscriberRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetSubscriberRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetSubscriberRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerGetSubscriberRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerGetSubscriberResponse$inboundSchema: + z.ZodType = + z.object({ + Headers: z.record(z.array(z.string())), + Result: components.SubscriberResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerGetSubscriberResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.SubscriberResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerGetSubscriberResponse$outboundSchema: + z.ZodType< + SubscribersControllerGetSubscriberResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerGetSubscriberResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.SubscriberResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetSubscriberResponse$ { + /** @deprecated use `SubscribersControllerGetSubscriberResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetSubscriberResponse$inboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetSubscriberResponse$outboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerGetSubscriberResponse$Outbound; +} + +export function subscribersControllerGetSubscriberResponseToJSON( + subscribersControllerGetSubscriberResponse: + SubscribersControllerGetSubscriberResponse, +): string { + return JSON.stringify( + SubscribersControllerGetSubscriberResponse$outboundSchema.parse( + subscribersControllerGetSubscriberResponse, + ), + ); +} + +export function subscribersControllerGetSubscriberResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetSubscriberResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetSubscriberResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerGetSubscriberResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollergetsubscriberpreferencebylevel.ts b/src/models/operations/subscriberscontrollergetsubscriberpreferencebylevel.ts new file mode 100644 index 00000000..bb683d78 --- /dev/null +++ b/src/models/operations/subscriberscontrollergetsubscriberpreferencebylevel.ts @@ -0,0 +1,216 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +/** + * the preferences level to be retrieved (template / global) + */ +export const Parameter = { + Global: "global", + Template: "template", +} as const; +/** + * the preferences level to be retrieved (template / global) + */ +export type Parameter = ClosedEnum; + +export type SubscribersControllerGetSubscriberPreferenceByLevelRequest = { + /** + * A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true + */ + includeInactiveChannels?: boolean | undefined; + /** + * the preferences level to be retrieved (template / global) + */ + parameter: Parameter; + subscriberId: string; +}; + +export type SubscribersControllerGetSubscriberPreferenceByLevelResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const Parameter$inboundSchema: z.ZodNativeEnum = z + .nativeEnum(Parameter); + +/** @internal */ +export const Parameter$outboundSchema: z.ZodNativeEnum = + Parameter$inboundSchema; + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace Parameter$ { + /** @deprecated use `Parameter$inboundSchema` instead. */ + export const inboundSchema = Parameter$inboundSchema; + /** @deprecated use `Parameter$outboundSchema` instead. */ + export const outboundSchema = Parameter$outboundSchema; +} + +/** @internal */ +export const SubscribersControllerGetSubscriberPreferenceByLevelRequest$inboundSchema: + z.ZodType< + SubscribersControllerGetSubscriberPreferenceByLevelRequest, + z.ZodTypeDef, + unknown + > = z.object({ + includeInactiveChannels: z.boolean().optional(), + parameter: Parameter$inboundSchema, + subscriberId: z.string(), + }); + +/** @internal */ +export type SubscribersControllerGetSubscriberPreferenceByLevelRequest$Outbound = + { + includeInactiveChannels?: boolean | undefined; + parameter: string; + subscriberId: string; + }; + +/** @internal */ +export const SubscribersControllerGetSubscriberPreferenceByLevelRequest$outboundSchema: + z.ZodType< + SubscribersControllerGetSubscriberPreferenceByLevelRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerGetSubscriberPreferenceByLevelRequest + > = z.object({ + includeInactiveChannels: z.boolean().optional(), + parameter: Parameter$outboundSchema, + subscriberId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetSubscriberPreferenceByLevelRequest$ { + /** @deprecated use `SubscribersControllerGetSubscriberPreferenceByLevelRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetSubscriberPreferenceByLevelRequest$inboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberPreferenceByLevelRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetSubscriberPreferenceByLevelRequest$outboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberPreferenceByLevelRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerGetSubscriberPreferenceByLevelRequest$Outbound; +} + +export function subscribersControllerGetSubscriberPreferenceByLevelRequestToJSON( + subscribersControllerGetSubscriberPreferenceByLevelRequest: + SubscribersControllerGetSubscriberPreferenceByLevelRequest, +): string { + return JSON.stringify( + SubscribersControllerGetSubscriberPreferenceByLevelRequest$outboundSchema + .parse(subscribersControllerGetSubscriberPreferenceByLevelRequest), + ); +} + +export function subscribersControllerGetSubscriberPreferenceByLevelRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetSubscriberPreferenceByLevelRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetSubscriberPreferenceByLevelRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerGetSubscriberPreferenceByLevelRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerGetSubscriberPreferenceByLevelResponse$inboundSchema: + z.ZodType< + SubscribersControllerGetSubscriberPreferenceByLevelResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array( + components.GetSubscriberPreferencesResponseDto$inboundSchema, + ), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerGetSubscriberPreferenceByLevelResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: Array; + }; + +/** @internal */ +export const SubscribersControllerGetSubscriberPreferenceByLevelResponse$outboundSchema: + z.ZodType< + SubscribersControllerGetSubscriberPreferenceByLevelResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerGetSubscriberPreferenceByLevelResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array( + components.GetSubscriberPreferencesResponseDto$outboundSchema, + ), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetSubscriberPreferenceByLevelResponse$ { + /** @deprecated use `SubscribersControllerGetSubscriberPreferenceByLevelResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetSubscriberPreferenceByLevelResponse$inboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberPreferenceByLevelResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetSubscriberPreferenceByLevelResponse$outboundSchema; + /** @deprecated use `SubscribersControllerGetSubscriberPreferenceByLevelResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerGetSubscriberPreferenceByLevelResponse$Outbound; +} + +export function subscribersControllerGetSubscriberPreferenceByLevelResponseToJSON( + subscribersControllerGetSubscriberPreferenceByLevelResponse: + SubscribersControllerGetSubscriberPreferenceByLevelResponse, +): string { + return JSON.stringify( + SubscribersControllerGetSubscriberPreferenceByLevelResponse$outboundSchema + .parse(subscribersControllerGetSubscriberPreferenceByLevelResponse), + ); +} + +export function subscribersControllerGetSubscriberPreferenceByLevelResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetSubscriberPreferenceByLevelResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetSubscriberPreferenceByLevelResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerGetSubscriberPreferenceByLevelResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollergetunseencount.ts b/src/models/operations/subscriberscontrollergetunseencount.ts new file mode 100644 index 00000000..00f9dbd6 --- /dev/null +++ b/src/models/operations/subscriberscontrollergetunseencount.ts @@ -0,0 +1,171 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerGetUnseenCountRequest = { + seen: boolean; + subscriberId: string; + limit: number; +}; + +export type SubscribersControllerGetUnseenCountResponse = { + headers: { [k: string]: Array }; + result: components.UnseenCountResponse; +}; + +/** @internal */ +export const SubscribersControllerGetUnseenCountRequest$inboundSchema: + z.ZodType = + z.object({ + seen: z.boolean(), + subscriberId: z.string(), + limit: z.number(), + }); + +/** @internal */ +export type SubscribersControllerGetUnseenCountRequest$Outbound = { + seen: boolean; + subscriberId: string; + limit: number; +}; + +/** @internal */ +export const SubscribersControllerGetUnseenCountRequest$outboundSchema: + z.ZodType< + SubscribersControllerGetUnseenCountRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerGetUnseenCountRequest + > = z.object({ + seen: z.boolean(), + subscriberId: z.string(), + limit: z.number(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetUnseenCountRequest$ { + /** @deprecated use `SubscribersControllerGetUnseenCountRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetUnseenCountRequest$inboundSchema; + /** @deprecated use `SubscribersControllerGetUnseenCountRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetUnseenCountRequest$outboundSchema; + /** @deprecated use `SubscribersControllerGetUnseenCountRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerGetUnseenCountRequest$Outbound; +} + +export function subscribersControllerGetUnseenCountRequestToJSON( + subscribersControllerGetUnseenCountRequest: + SubscribersControllerGetUnseenCountRequest, +): string { + return JSON.stringify( + SubscribersControllerGetUnseenCountRequest$outboundSchema.parse( + subscribersControllerGetUnseenCountRequest, + ), + ); +} + +export function subscribersControllerGetUnseenCountRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetUnseenCountRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetUnseenCountRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerGetUnseenCountRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerGetUnseenCountResponse$inboundSchema: + z.ZodType< + SubscribersControllerGetUnseenCountResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.UnseenCountResponse$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerGetUnseenCountResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.UnseenCountResponse$Outbound; +}; + +/** @internal */ +export const SubscribersControllerGetUnseenCountResponse$outboundSchema: + z.ZodType< + SubscribersControllerGetUnseenCountResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerGetUnseenCountResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.UnseenCountResponse$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerGetUnseenCountResponse$ { + /** @deprecated use `SubscribersControllerGetUnseenCountResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerGetUnseenCountResponse$inboundSchema; + /** @deprecated use `SubscribersControllerGetUnseenCountResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerGetUnseenCountResponse$outboundSchema; + /** @deprecated use `SubscribersControllerGetUnseenCountResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerGetUnseenCountResponse$Outbound; +} + +export function subscribersControllerGetUnseenCountResponseToJSON( + subscribersControllerGetUnseenCountResponse: + SubscribersControllerGetUnseenCountResponse, +): string { + return JSON.stringify( + SubscribersControllerGetUnseenCountResponse$outboundSchema.parse( + subscribersControllerGetUnseenCountResponse, + ), + ); +} + +export function subscribersControllerGetUnseenCountResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerGetUnseenCountResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerGetUnseenCountResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerGetUnseenCountResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerlistsubscriberpreferences.ts b/src/models/operations/subscriberscontrollerlistsubscriberpreferences.ts new file mode 100644 index 00000000..b59385b5 --- /dev/null +++ b/src/models/operations/subscriberscontrollerlistsubscriberpreferences.ts @@ -0,0 +1,178 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerListSubscriberPreferencesRequest = { + subscriberId: string; + /** + * A flag which specifies if the inactive workflow channels should be included in the retrieved preferences. Default is true + */ + includeInactiveChannels?: boolean | undefined; +}; + +export type SubscribersControllerListSubscriberPreferencesResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const SubscribersControllerListSubscriberPreferencesRequest$inboundSchema: + z.ZodType< + SubscribersControllerListSubscriberPreferencesRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + includeInactiveChannels: z.boolean().optional(), + }); + +/** @internal */ +export type SubscribersControllerListSubscriberPreferencesRequest$Outbound = { + subscriberId: string; + includeInactiveChannels?: boolean | undefined; +}; + +/** @internal */ +export const SubscribersControllerListSubscriberPreferencesRequest$outboundSchema: + z.ZodType< + SubscribersControllerListSubscriberPreferencesRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerListSubscriberPreferencesRequest + > = z.object({ + subscriberId: z.string(), + includeInactiveChannels: z.boolean().optional(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerListSubscriberPreferencesRequest$ { + /** @deprecated use `SubscribersControllerListSubscriberPreferencesRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerListSubscriberPreferencesRequest$inboundSchema; + /** @deprecated use `SubscribersControllerListSubscriberPreferencesRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerListSubscriberPreferencesRequest$outboundSchema; + /** @deprecated use `SubscribersControllerListSubscriberPreferencesRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerListSubscriberPreferencesRequest$Outbound; +} + +export function subscribersControllerListSubscriberPreferencesRequestToJSON( + subscribersControllerListSubscriberPreferencesRequest: + SubscribersControllerListSubscriberPreferencesRequest, +): string { + return JSON.stringify( + SubscribersControllerListSubscriberPreferencesRequest$outboundSchema.parse( + subscribersControllerListSubscriberPreferencesRequest, + ), + ); +} + +export function subscribersControllerListSubscriberPreferencesRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerListSubscriberPreferencesRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerListSubscriberPreferencesRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerListSubscriberPreferencesRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerListSubscriberPreferencesResponse$inboundSchema: + z.ZodType< + SubscribersControllerListSubscriberPreferencesResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array( + components.UpdateSubscriberPreferenceResponseDto$inboundSchema, + ), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerListSubscriberPreferencesResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const SubscribersControllerListSubscriberPreferencesResponse$outboundSchema: + z.ZodType< + SubscribersControllerListSubscriberPreferencesResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerListSubscriberPreferencesResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array( + components.UpdateSubscriberPreferenceResponseDto$outboundSchema, + ), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerListSubscriberPreferencesResponse$ { + /** @deprecated use `SubscribersControllerListSubscriberPreferencesResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerListSubscriberPreferencesResponse$inboundSchema; + /** @deprecated use `SubscribersControllerListSubscriberPreferencesResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerListSubscriberPreferencesResponse$outboundSchema; + /** @deprecated use `SubscribersControllerListSubscriberPreferencesResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerListSubscriberPreferencesResponse$Outbound; +} + +export function subscribersControllerListSubscriberPreferencesResponseToJSON( + subscribersControllerListSubscriberPreferencesResponse: + SubscribersControllerListSubscriberPreferencesResponse, +): string { + return JSON.stringify( + SubscribersControllerListSubscriberPreferencesResponse$outboundSchema.parse( + subscribersControllerListSubscriberPreferencesResponse, + ), + ); +} + +export function subscribersControllerListSubscriberPreferencesResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerListSubscriberPreferencesResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerListSubscriberPreferencesResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerListSubscriberPreferencesResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerlistsubscribers.ts b/src/models/operations/subscriberscontrollerlistsubscribers.ts new file mode 100644 index 00000000..0da6264b --- /dev/null +++ b/src/models/operations/subscriberscontrollerlistsubscribers.ts @@ -0,0 +1,267 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerListSubscribersRequest = { + page?: number | undefined; + limit?: number | undefined; +}; + +export type SubscribersControllerListSubscribersResponseBody = { + /** + * The current page of the paginated response + */ + page: number; + /** + * Does the list have more items to fetch + */ + hasMore: boolean; + /** + * Number of items on each page + */ + pageSize: number; + data: Array; +}; + +export type SubscribersControllerListSubscribersResponse = { + headers: { [k: string]: Array }; + result: SubscribersControllerListSubscribersResponseBody; +}; + +/** @internal */ +export const SubscribersControllerListSubscribersRequest$inboundSchema: + z.ZodType< + SubscribersControllerListSubscribersRequest, + z.ZodTypeDef, + unknown + > = z.object({ + page: z.number().optional(), + limit: z.number().default(10), + }); + +/** @internal */ +export type SubscribersControllerListSubscribersRequest$Outbound = { + page?: number | undefined; + limit: number; +}; + +/** @internal */ +export const SubscribersControllerListSubscribersRequest$outboundSchema: + z.ZodType< + SubscribersControllerListSubscribersRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerListSubscribersRequest + > = z.object({ + page: z.number().optional(), + limit: z.number().default(10), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerListSubscribersRequest$ { + /** @deprecated use `SubscribersControllerListSubscribersRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerListSubscribersRequest$inboundSchema; + /** @deprecated use `SubscribersControllerListSubscribersRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerListSubscribersRequest$outboundSchema; + /** @deprecated use `SubscribersControllerListSubscribersRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerListSubscribersRequest$Outbound; +} + +export function subscribersControllerListSubscribersRequestToJSON( + subscribersControllerListSubscribersRequest: + SubscribersControllerListSubscribersRequest, +): string { + return JSON.stringify( + SubscribersControllerListSubscribersRequest$outboundSchema.parse( + subscribersControllerListSubscribersRequest, + ), + ); +} + +export function subscribersControllerListSubscribersRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerListSubscribersRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerListSubscribersRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerListSubscribersRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerListSubscribersResponseBody$inboundSchema: + z.ZodType< + SubscribersControllerListSubscribersResponseBody, + z.ZodTypeDef, + unknown + > = z.object({ + page: z.number(), + hasMore: z.boolean(), + pageSize: z.number(), + data: z.array(components.SubscriberResponseDto$inboundSchema), + }); + +/** @internal */ +export type SubscribersControllerListSubscribersResponseBody$Outbound = { + page: number; + hasMore: boolean; + pageSize: number; + data: Array; +}; + +/** @internal */ +export const SubscribersControllerListSubscribersResponseBody$outboundSchema: + z.ZodType< + SubscribersControllerListSubscribersResponseBody$Outbound, + z.ZodTypeDef, + SubscribersControllerListSubscribersResponseBody + > = z.object({ + page: z.number(), + hasMore: z.boolean(), + pageSize: z.number(), + data: z.array(components.SubscriberResponseDto$outboundSchema), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerListSubscribersResponseBody$ { + /** @deprecated use `SubscribersControllerListSubscribersResponseBody$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerListSubscribersResponseBody$inboundSchema; + /** @deprecated use `SubscribersControllerListSubscribersResponseBody$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerListSubscribersResponseBody$outboundSchema; + /** @deprecated use `SubscribersControllerListSubscribersResponseBody$Outbound` instead. */ + export type Outbound = + SubscribersControllerListSubscribersResponseBody$Outbound; +} + +export function subscribersControllerListSubscribersResponseBodyToJSON( + subscribersControllerListSubscribersResponseBody: + SubscribersControllerListSubscribersResponseBody, +): string { + return JSON.stringify( + SubscribersControllerListSubscribersResponseBody$outboundSchema.parse( + subscribersControllerListSubscribersResponseBody, + ), + ); +} + +export function subscribersControllerListSubscribersResponseBodyFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerListSubscribersResponseBody, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerListSubscribersResponseBody$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerListSubscribersResponseBody' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerListSubscribersResponse$inboundSchema: + z.ZodType< + SubscribersControllerListSubscribersResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.lazy(() => + SubscribersControllerListSubscribersResponseBody$inboundSchema + ), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerListSubscribersResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: SubscribersControllerListSubscribersResponseBody$Outbound; +}; + +/** @internal */ +export const SubscribersControllerListSubscribersResponse$outboundSchema: + z.ZodType< + SubscribersControllerListSubscribersResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerListSubscribersResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.lazy(() => + SubscribersControllerListSubscribersResponseBody$outboundSchema + ), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerListSubscribersResponse$ { + /** @deprecated use `SubscribersControllerListSubscribersResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerListSubscribersResponse$inboundSchema; + /** @deprecated use `SubscribersControllerListSubscribersResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerListSubscribersResponse$outboundSchema; + /** @deprecated use `SubscribersControllerListSubscribersResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerListSubscribersResponse$Outbound; +} + +export function subscribersControllerListSubscribersResponseToJSON( + subscribersControllerListSubscribersResponse: + SubscribersControllerListSubscribersResponse, +): string { + return JSON.stringify( + SubscribersControllerListSubscribersResponse$outboundSchema.parse( + subscribersControllerListSubscribersResponse, + ), + ); +} + +export function subscribersControllerListSubscribersResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerListSubscribersResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerListSubscribersResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerListSubscribersResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollermarkactionasseen.ts b/src/models/operations/subscriberscontrollermarkactionasseen.ts new file mode 100644 index 00000000..92e6a715 --- /dev/null +++ b/src/models/operations/subscriberscontrollermarkactionasseen.ts @@ -0,0 +1,188 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerMarkActionAsSeenRequest = { + messageId: string; + type?: any | undefined; + subscriberId: string; + markMessageActionAsSeenDto: components.MarkMessageActionAsSeenDto; +}; + +export type SubscribersControllerMarkActionAsSeenResponse = { + headers: { [k: string]: Array }; + result: components.MessageResponseDto; +}; + +/** @internal */ +export const SubscribersControllerMarkActionAsSeenRequest$inboundSchema: + z.ZodType< + SubscribersControllerMarkActionAsSeenRequest, + z.ZodTypeDef, + unknown + > = z.object({ + messageId: z.string(), + type: z.any().optional(), + subscriberId: z.string(), + MarkMessageActionAsSeenDto: + components.MarkMessageActionAsSeenDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "MarkMessageActionAsSeenDto": "markMessageActionAsSeenDto", + }); + }); + +/** @internal */ +export type SubscribersControllerMarkActionAsSeenRequest$Outbound = { + messageId: string; + type?: any | undefined; + subscriberId: string; + MarkMessageActionAsSeenDto: components.MarkMessageActionAsSeenDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerMarkActionAsSeenRequest$outboundSchema: + z.ZodType< + SubscribersControllerMarkActionAsSeenRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerMarkActionAsSeenRequest + > = z.object({ + messageId: z.string(), + type: z.any().optional(), + subscriberId: z.string(), + markMessageActionAsSeenDto: + components.MarkMessageActionAsSeenDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + markMessageActionAsSeenDto: "MarkMessageActionAsSeenDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerMarkActionAsSeenRequest$ { + /** @deprecated use `SubscribersControllerMarkActionAsSeenRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerMarkActionAsSeenRequest$inboundSchema; + /** @deprecated use `SubscribersControllerMarkActionAsSeenRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerMarkActionAsSeenRequest$outboundSchema; + /** @deprecated use `SubscribersControllerMarkActionAsSeenRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerMarkActionAsSeenRequest$Outbound; +} + +export function subscribersControllerMarkActionAsSeenRequestToJSON( + subscribersControllerMarkActionAsSeenRequest: + SubscribersControllerMarkActionAsSeenRequest, +): string { + return JSON.stringify( + SubscribersControllerMarkActionAsSeenRequest$outboundSchema.parse( + subscribersControllerMarkActionAsSeenRequest, + ), + ); +} + +export function subscribersControllerMarkActionAsSeenRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerMarkActionAsSeenRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerMarkActionAsSeenRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerMarkActionAsSeenRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerMarkActionAsSeenResponse$inboundSchema: + z.ZodType< + SubscribersControllerMarkActionAsSeenResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.MessageResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerMarkActionAsSeenResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.MessageResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerMarkActionAsSeenResponse$outboundSchema: + z.ZodType< + SubscribersControllerMarkActionAsSeenResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerMarkActionAsSeenResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.MessageResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerMarkActionAsSeenResponse$ { + /** @deprecated use `SubscribersControllerMarkActionAsSeenResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerMarkActionAsSeenResponse$inboundSchema; + /** @deprecated use `SubscribersControllerMarkActionAsSeenResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerMarkActionAsSeenResponse$outboundSchema; + /** @deprecated use `SubscribersControllerMarkActionAsSeenResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerMarkActionAsSeenResponse$Outbound; +} + +export function subscribersControllerMarkActionAsSeenResponseToJSON( + subscribersControllerMarkActionAsSeenResponse: + SubscribersControllerMarkActionAsSeenResponse, +): string { + return JSON.stringify( + SubscribersControllerMarkActionAsSeenResponse$outboundSchema.parse( + subscribersControllerMarkActionAsSeenResponse, + ), + ); +} + +export function subscribersControllerMarkActionAsSeenResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerMarkActionAsSeenResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerMarkActionAsSeenResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerMarkActionAsSeenResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollermarkallunreadasread.ts b/src/models/operations/subscriberscontrollermarkallunreadasread.ts new file mode 100644 index 00000000..8207c829 --- /dev/null +++ b/src/models/operations/subscriberscontrollermarkallunreadasread.ts @@ -0,0 +1,182 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerMarkAllUnreadAsReadRequest = { + subscriberId: string; + markAllMessageAsRequestDto: components.MarkAllMessageAsRequestDto; +}; + +export type SubscribersControllerMarkAllUnreadAsReadResponse = { + headers: { [k: string]: Array }; + result: number; +}; + +/** @internal */ +export const SubscribersControllerMarkAllUnreadAsReadRequest$inboundSchema: + z.ZodType< + SubscribersControllerMarkAllUnreadAsReadRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + MarkAllMessageAsRequestDto: + components.MarkAllMessageAsRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "MarkAllMessageAsRequestDto": "markAllMessageAsRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerMarkAllUnreadAsReadRequest$Outbound = { + subscriberId: string; + MarkAllMessageAsRequestDto: components.MarkAllMessageAsRequestDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerMarkAllUnreadAsReadRequest$outboundSchema: + z.ZodType< + SubscribersControllerMarkAllUnreadAsReadRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerMarkAllUnreadAsReadRequest + > = z.object({ + subscriberId: z.string(), + markAllMessageAsRequestDto: + components.MarkAllMessageAsRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + markAllMessageAsRequestDto: "MarkAllMessageAsRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerMarkAllUnreadAsReadRequest$ { + /** @deprecated use `SubscribersControllerMarkAllUnreadAsReadRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerMarkAllUnreadAsReadRequest$inboundSchema; + /** @deprecated use `SubscribersControllerMarkAllUnreadAsReadRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerMarkAllUnreadAsReadRequest$outboundSchema; + /** @deprecated use `SubscribersControllerMarkAllUnreadAsReadRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerMarkAllUnreadAsReadRequest$Outbound; +} + +export function subscribersControllerMarkAllUnreadAsReadRequestToJSON( + subscribersControllerMarkAllUnreadAsReadRequest: + SubscribersControllerMarkAllUnreadAsReadRequest, +): string { + return JSON.stringify( + SubscribersControllerMarkAllUnreadAsReadRequest$outboundSchema.parse( + subscribersControllerMarkAllUnreadAsReadRequest, + ), + ); +} + +export function subscribersControllerMarkAllUnreadAsReadRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerMarkAllUnreadAsReadRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerMarkAllUnreadAsReadRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerMarkAllUnreadAsReadRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerMarkAllUnreadAsReadResponse$inboundSchema: + z.ZodType< + SubscribersControllerMarkAllUnreadAsReadResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.number(), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerMarkAllUnreadAsReadResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: number; +}; + +/** @internal */ +export const SubscribersControllerMarkAllUnreadAsReadResponse$outboundSchema: + z.ZodType< + SubscribersControllerMarkAllUnreadAsReadResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerMarkAllUnreadAsReadResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.number(), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerMarkAllUnreadAsReadResponse$ { + /** @deprecated use `SubscribersControllerMarkAllUnreadAsReadResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerMarkAllUnreadAsReadResponse$inboundSchema; + /** @deprecated use `SubscribersControllerMarkAllUnreadAsReadResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerMarkAllUnreadAsReadResponse$outboundSchema; + /** @deprecated use `SubscribersControllerMarkAllUnreadAsReadResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerMarkAllUnreadAsReadResponse$Outbound; +} + +export function subscribersControllerMarkAllUnreadAsReadResponseToJSON( + subscribersControllerMarkAllUnreadAsReadResponse: + SubscribersControllerMarkAllUnreadAsReadResponse, +): string { + return JSON.stringify( + SubscribersControllerMarkAllUnreadAsReadResponse$outboundSchema.parse( + subscribersControllerMarkAllUnreadAsReadResponse, + ), + ); +} + +export function subscribersControllerMarkAllUnreadAsReadResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerMarkAllUnreadAsReadResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerMarkAllUnreadAsReadResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerMarkAllUnreadAsReadResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollermarkmessagesas.ts b/src/models/operations/subscriberscontrollermarkmessagesas.ts new file mode 100644 index 00000000..7b27932e --- /dev/null +++ b/src/models/operations/subscriberscontrollermarkmessagesas.ts @@ -0,0 +1,175 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerMarkMessagesAsRequest = { + subscriberId: string; + messageMarkAsRequestDto: components.MessageMarkAsRequestDto; +}; + +export type SubscribersControllerMarkMessagesAsResponse = { + headers: { [k: string]: Array }; + result: Array; +}; + +/** @internal */ +export const SubscribersControllerMarkMessagesAsRequest$inboundSchema: + z.ZodType = + z.object({ + subscriberId: z.string(), + MessageMarkAsRequestDto: components.MessageMarkAsRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "MessageMarkAsRequestDto": "messageMarkAsRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerMarkMessagesAsRequest$Outbound = { + subscriberId: string; + MessageMarkAsRequestDto: components.MessageMarkAsRequestDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerMarkMessagesAsRequest$outboundSchema: + z.ZodType< + SubscribersControllerMarkMessagesAsRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerMarkMessagesAsRequest + > = z.object({ + subscriberId: z.string(), + messageMarkAsRequestDto: components.MessageMarkAsRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + messageMarkAsRequestDto: "MessageMarkAsRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerMarkMessagesAsRequest$ { + /** @deprecated use `SubscribersControllerMarkMessagesAsRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerMarkMessagesAsRequest$inboundSchema; + /** @deprecated use `SubscribersControllerMarkMessagesAsRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerMarkMessagesAsRequest$outboundSchema; + /** @deprecated use `SubscribersControllerMarkMessagesAsRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerMarkMessagesAsRequest$Outbound; +} + +export function subscribersControllerMarkMessagesAsRequestToJSON( + subscribersControllerMarkMessagesAsRequest: + SubscribersControllerMarkMessagesAsRequest, +): string { + return JSON.stringify( + SubscribersControllerMarkMessagesAsRequest$outboundSchema.parse( + subscribersControllerMarkMessagesAsRequest, + ), + ); +} + +export function subscribersControllerMarkMessagesAsRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerMarkMessagesAsRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerMarkMessagesAsRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerMarkMessagesAsRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerMarkMessagesAsResponse$inboundSchema: + z.ZodType< + SubscribersControllerMarkMessagesAsResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: z.array(components.MessageEntity$inboundSchema), + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerMarkMessagesAsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: Array; +}; + +/** @internal */ +export const SubscribersControllerMarkMessagesAsResponse$outboundSchema: + z.ZodType< + SubscribersControllerMarkMessagesAsResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerMarkMessagesAsResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: z.array(components.MessageEntity$outboundSchema), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerMarkMessagesAsResponse$ { + /** @deprecated use `SubscribersControllerMarkMessagesAsResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerMarkMessagesAsResponse$inboundSchema; + /** @deprecated use `SubscribersControllerMarkMessagesAsResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerMarkMessagesAsResponse$outboundSchema; + /** @deprecated use `SubscribersControllerMarkMessagesAsResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerMarkMessagesAsResponse$Outbound; +} + +export function subscribersControllerMarkMessagesAsResponseToJSON( + subscribersControllerMarkMessagesAsResponse: + SubscribersControllerMarkMessagesAsResponse, +): string { + return JSON.stringify( + SubscribersControllerMarkMessagesAsResponse$outboundSchema.parse( + subscribersControllerMarkMessagesAsResponse, + ), + ); +} + +export function subscribersControllerMarkMessagesAsResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerMarkMessagesAsResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerMarkMessagesAsResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerMarkMessagesAsResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollermodifysubscriberchannel.ts b/src/models/operations/subscriberscontrollermodifysubscriberchannel.ts new file mode 100644 index 00000000..86746e6a --- /dev/null +++ b/src/models/operations/subscriberscontrollermodifysubscriberchannel.ts @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerModifySubscriberChannelRequest = { + subscriberId: string; + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto; +}; + +export type SubscribersControllerModifySubscriberChannelResponse = { + headers: { [k: string]: Array }; + result: components.SubscriberResponseDto; +}; + +/** @internal */ +export const SubscribersControllerModifySubscriberChannelRequest$inboundSchema: + z.ZodType< + SubscribersControllerModifySubscriberChannelRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + UpdateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "UpdateSubscriberChannelRequestDto": "updateSubscriberChannelRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerModifySubscriberChannelRequest$Outbound = { + subscriberId: string; + UpdateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerModifySubscriberChannelRequest$outboundSchema: + z.ZodType< + SubscribersControllerModifySubscriberChannelRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerModifySubscriberChannelRequest + > = z.object({ + subscriberId: z.string(), + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + updateSubscriberChannelRequestDto: "UpdateSubscriberChannelRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerModifySubscriberChannelRequest$ { + /** @deprecated use `SubscribersControllerModifySubscriberChannelRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerModifySubscriberChannelRequest$inboundSchema; + /** @deprecated use `SubscribersControllerModifySubscriberChannelRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerModifySubscriberChannelRequest$outboundSchema; + /** @deprecated use `SubscribersControllerModifySubscriberChannelRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerModifySubscriberChannelRequest$Outbound; +} + +export function subscribersControllerModifySubscriberChannelRequestToJSON( + subscribersControllerModifySubscriberChannelRequest: + SubscribersControllerModifySubscriberChannelRequest, +): string { + return JSON.stringify( + SubscribersControllerModifySubscriberChannelRequest$outboundSchema.parse( + subscribersControllerModifySubscriberChannelRequest, + ), + ); +} + +export function subscribersControllerModifySubscriberChannelRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerModifySubscriberChannelRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerModifySubscriberChannelRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerModifySubscriberChannelRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerModifySubscriberChannelResponse$inboundSchema: + z.ZodType< + SubscribersControllerModifySubscriberChannelResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.SubscriberResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerModifySubscriberChannelResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.SubscriberResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerModifySubscriberChannelResponse$outboundSchema: + z.ZodType< + SubscribersControllerModifySubscriberChannelResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerModifySubscriberChannelResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.SubscriberResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerModifySubscriberChannelResponse$ { + /** @deprecated use `SubscribersControllerModifySubscriberChannelResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerModifySubscriberChannelResponse$inboundSchema; + /** @deprecated use `SubscribersControllerModifySubscriberChannelResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerModifySubscriberChannelResponse$outboundSchema; + /** @deprecated use `SubscribersControllerModifySubscriberChannelResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerModifySubscriberChannelResponse$Outbound; +} + +export function subscribersControllerModifySubscriberChannelResponseToJSON( + subscribersControllerModifySubscriberChannelResponse: + SubscribersControllerModifySubscriberChannelResponse, +): string { + return JSON.stringify( + SubscribersControllerModifySubscriberChannelResponse$outboundSchema.parse( + subscribersControllerModifySubscriberChannelResponse, + ), + ); +} + +export function subscribersControllerModifySubscriberChannelResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerModifySubscriberChannelResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerModifySubscriberChannelResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerModifySubscriberChannelResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerremovesubscriber.ts b/src/models/operations/subscriberscontrollerremovesubscriber.ts new file mode 100644 index 00000000..13a1fa1c --- /dev/null +++ b/src/models/operations/subscriberscontrollerremovesubscriber.ts @@ -0,0 +1,166 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerRemoveSubscriberRequest = { + subscriberId: string; +}; + +export type SubscribersControllerRemoveSubscriberResponse = { + headers: { [k: string]: Array }; + result: components.DeleteSubscriberResponseDto; +}; + +/** @internal */ +export const SubscribersControllerRemoveSubscriberRequest$inboundSchema: + z.ZodType< + SubscribersControllerRemoveSubscriberRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + }); + +/** @internal */ +export type SubscribersControllerRemoveSubscriberRequest$Outbound = { + subscriberId: string; +}; + +/** @internal */ +export const SubscribersControllerRemoveSubscriberRequest$outboundSchema: + z.ZodType< + SubscribersControllerRemoveSubscriberRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerRemoveSubscriberRequest + > = z.object({ + subscriberId: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerRemoveSubscriberRequest$ { + /** @deprecated use `SubscribersControllerRemoveSubscriberRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerRemoveSubscriberRequest$inboundSchema; + /** @deprecated use `SubscribersControllerRemoveSubscriberRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerRemoveSubscriberRequest$outboundSchema; + /** @deprecated use `SubscribersControllerRemoveSubscriberRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerRemoveSubscriberRequest$Outbound; +} + +export function subscribersControllerRemoveSubscriberRequestToJSON( + subscribersControllerRemoveSubscriberRequest: + SubscribersControllerRemoveSubscriberRequest, +): string { + return JSON.stringify( + SubscribersControllerRemoveSubscriberRequest$outboundSchema.parse( + subscribersControllerRemoveSubscriberRequest, + ), + ); +} + +export function subscribersControllerRemoveSubscriberRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerRemoveSubscriberRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerRemoveSubscriberRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerRemoveSubscriberRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerRemoveSubscriberResponse$inboundSchema: + z.ZodType< + SubscribersControllerRemoveSubscriberResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.DeleteSubscriberResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerRemoveSubscriberResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.DeleteSubscriberResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerRemoveSubscriberResponse$outboundSchema: + z.ZodType< + SubscribersControllerRemoveSubscriberResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerRemoveSubscriberResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.DeleteSubscriberResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerRemoveSubscriberResponse$ { + /** @deprecated use `SubscribersControllerRemoveSubscriberResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerRemoveSubscriberResponse$inboundSchema; + /** @deprecated use `SubscribersControllerRemoveSubscriberResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerRemoveSubscriberResponse$outboundSchema; + /** @deprecated use `SubscribersControllerRemoveSubscriberResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerRemoveSubscriberResponse$Outbound; +} + +export function subscribersControllerRemoveSubscriberResponseToJSON( + subscribersControllerRemoveSubscriberResponse: + SubscribersControllerRemoveSubscriberResponse, +): string { + return JSON.stringify( + SubscribersControllerRemoveSubscriberResponse$outboundSchema.parse( + subscribersControllerRemoveSubscriberResponse, + ), + ); +} + +export function subscribersControllerRemoveSubscriberResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerRemoveSubscriberResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerRemoveSubscriberResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerRemoveSubscriberResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerupdatesubscriber.ts b/src/models/operations/subscriberscontrollerupdatesubscriber.ts new file mode 100644 index 00000000..204dc193 --- /dev/null +++ b/src/models/operations/subscriberscontrollerupdatesubscriber.ts @@ -0,0 +1,180 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerUpdateSubscriberRequest = { + subscriberId: string; + updateSubscriberRequestDto: components.UpdateSubscriberRequestDto; +}; + +export type SubscribersControllerUpdateSubscriberResponse = { + headers: { [k: string]: Array }; + result: components.SubscriberResponseDto; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberRequest$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + UpdateSubscriberRequestDto: + components.UpdateSubscriberRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "UpdateSubscriberRequestDto": "updateSubscriberRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberRequest$Outbound = { + subscriberId: string; + UpdateSubscriberRequestDto: components.UpdateSubscriberRequestDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberRequest$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberRequest + > = z.object({ + subscriberId: z.string(), + updateSubscriberRequestDto: + components.UpdateSubscriberRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + updateSubscriberRequestDto: "UpdateSubscriberRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberRequest$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberRequest$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberRequest$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberRequest$Outbound` instead. */ + export type Outbound = SubscribersControllerUpdateSubscriberRequest$Outbound; +} + +export function subscribersControllerUpdateSubscriberRequestToJSON( + subscribersControllerUpdateSubscriberRequest: + SubscribersControllerUpdateSubscriberRequest, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberRequest$outboundSchema.parse( + subscribersControllerUpdateSubscriberRequest, + ), + ); +} + +export function subscribersControllerUpdateSubscriberRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerUpdateSubscriberRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerUpdateSubscriberResponse$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.SubscriberResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.SubscriberResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberResponse$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.SubscriberResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberResponse$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberResponse$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberResponse$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberResponse$Outbound` instead. */ + export type Outbound = SubscribersControllerUpdateSubscriberResponse$Outbound; +} + +export function subscribersControllerUpdateSubscriberResponseToJSON( + subscribersControllerUpdateSubscriberResponse: + SubscribersControllerUpdateSubscriberResponse, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberResponse$outboundSchema.parse( + subscribersControllerUpdateSubscriberResponse, + ), + ); +} + +export function subscribersControllerUpdateSubscriberResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerUpdateSubscriberResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerupdatesubscriberchannel.ts b/src/models/operations/subscriberscontrollerupdatesubscriberchannel.ts new file mode 100644 index 00000000..df9e40d7 --- /dev/null +++ b/src/models/operations/subscriberscontrollerupdatesubscriberchannel.ts @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerUpdateSubscriberChannelRequest = { + subscriberId: string; + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto; +}; + +export type SubscribersControllerUpdateSubscriberChannelResponse = { + headers: { [k: string]: Array }; + result: components.SubscriberResponseDto; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberChannelRequest$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberChannelRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + UpdateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "UpdateSubscriberChannelRequestDto": "updateSubscriberChannelRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberChannelRequest$Outbound = { + subscriberId: string; + UpdateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberChannelRequest$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberChannelRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberChannelRequest + > = z.object({ + subscriberId: z.string(), + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + updateSubscriberChannelRequestDto: "UpdateSubscriberChannelRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberChannelRequest$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberChannelRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberChannelRequest$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberChannelRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberChannelRequest$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberChannelRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberChannelRequest$Outbound; +} + +export function subscribersControllerUpdateSubscriberChannelRequestToJSON( + subscribersControllerUpdateSubscriberChannelRequest: + SubscribersControllerUpdateSubscriberChannelRequest, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberChannelRequest$outboundSchema.parse( + subscribersControllerUpdateSubscriberChannelRequest, + ), + ); +} + +export function subscribersControllerUpdateSubscriberChannelRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberChannelRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberChannelRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerUpdateSubscriberChannelRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerUpdateSubscriberChannelResponse$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberChannelResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.SubscriberResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberChannelResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.SubscriberResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberChannelResponse$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberChannelResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberChannelResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.SubscriberResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberChannelResponse$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberChannelResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberChannelResponse$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberChannelResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberChannelResponse$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberChannelResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberChannelResponse$Outbound; +} + +export function subscribersControllerUpdateSubscriberChannelResponseToJSON( + subscribersControllerUpdateSubscriberChannelResponse: + SubscribersControllerUpdateSubscriberChannelResponse, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberChannelResponse$outboundSchema.parse( + subscribersControllerUpdateSubscriberChannelResponse, + ), + ); +} + +export function subscribersControllerUpdateSubscriberChannelResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberChannelResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberChannelResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'SubscribersControllerUpdateSubscriberChannelResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerupdatesubscriberglobalpreferences.ts b/src/models/operations/subscriberscontrollerupdatesubscriberglobalpreferences.ts new file mode 100644 index 00000000..7499d408 --- /dev/null +++ b/src/models/operations/subscriberscontrollerupdatesubscriberglobalpreferences.ts @@ -0,0 +1,184 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerUpdateSubscriberGlobalPreferencesRequest = { + subscriberId: string; + updateSubscriberGlobalPreferencesRequestDto: + components.UpdateSubscriberGlobalPreferencesRequestDto; +}; + +export type SubscribersControllerUpdateSubscriberGlobalPreferencesResponse = { + headers: { [k: string]: Array }; + result: components.UpdateSubscriberPreferenceResponseDto; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + UpdateSubscriberGlobalPreferencesRequestDto: + components.UpdateSubscriberGlobalPreferencesRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "UpdateSubscriberGlobalPreferencesRequestDto": + "updateSubscriberGlobalPreferencesRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$Outbound = + { + subscriberId: string; + UpdateSubscriberGlobalPreferencesRequestDto: + components.UpdateSubscriberGlobalPreferencesRequestDto$Outbound; + }; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest + > = z.object({ + subscriberId: z.string(), + updateSubscriberGlobalPreferencesRequestDto: + components.UpdateSubscriberGlobalPreferencesRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + updateSubscriberGlobalPreferencesRequestDto: + "UpdateSubscriberGlobalPreferencesRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$Outbound; +} + +export function subscribersControllerUpdateSubscriberGlobalPreferencesRequestToJSON( + subscribersControllerUpdateSubscriberGlobalPreferencesRequest: + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$outboundSchema + .parse(subscribersControllerUpdateSubscriberGlobalPreferencesRequest), + ); +} + +export function subscribersControllerUpdateSubscriberGlobalPreferencesRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberGlobalPreferencesRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerUpdateSubscriberGlobalPreferencesRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.UpdateSubscriberPreferenceResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$Outbound = + { + Headers: { [k: string]: Array }; + Result: components.UpdateSubscriberPreferenceResponseDto$Outbound; + }; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.UpdateSubscriberPreferenceResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$Outbound; +} + +export function subscribersControllerUpdateSubscriberGlobalPreferencesResponseToJSON( + subscribersControllerUpdateSubscriberGlobalPreferencesResponse: + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$outboundSchema + .parse(subscribersControllerUpdateSubscriberGlobalPreferencesResponse), + ); +} + +export function subscribersControllerUpdateSubscriberGlobalPreferencesResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberGlobalPreferencesResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerUpdateSubscriberGlobalPreferencesResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerupdatesubscriberonlineflag.ts b/src/models/operations/subscriberscontrollerupdatesubscriberonlineflag.ts new file mode 100644 index 00000000..fcd33653 --- /dev/null +++ b/src/models/operations/subscriberscontrollerupdatesubscriberonlineflag.ts @@ -0,0 +1,183 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerUpdateSubscriberOnlineFlagRequest = { + subscriberId: string; + updateSubscriberOnlineFlagRequestDto: + components.UpdateSubscriberOnlineFlagRequestDto; +}; + +export type SubscribersControllerUpdateSubscriberOnlineFlagResponse = { + headers: { [k: string]: Array }; + result: components.SubscriberResponseDto; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberOnlineFlagRequest$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberOnlineFlagRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + UpdateSubscriberOnlineFlagRequestDto: + components.UpdateSubscriberOnlineFlagRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "UpdateSubscriberOnlineFlagRequestDto": + "updateSubscriberOnlineFlagRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberOnlineFlagRequest$Outbound = { + subscriberId: string; + UpdateSubscriberOnlineFlagRequestDto: + components.UpdateSubscriberOnlineFlagRequestDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberOnlineFlagRequest$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberOnlineFlagRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberOnlineFlagRequest + > = z.object({ + subscriberId: z.string(), + updateSubscriberOnlineFlagRequestDto: + components.UpdateSubscriberOnlineFlagRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + updateSubscriberOnlineFlagRequestDto: + "UpdateSubscriberOnlineFlagRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberOnlineFlagRequest$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberOnlineFlagRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberOnlineFlagRequest$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberOnlineFlagRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberOnlineFlagRequest$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberOnlineFlagRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberOnlineFlagRequest$Outbound; +} + +export function subscribersControllerUpdateSubscriberOnlineFlagRequestToJSON( + subscribersControllerUpdateSubscriberOnlineFlagRequest: + SubscribersControllerUpdateSubscriberOnlineFlagRequest, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberOnlineFlagRequest$outboundSchema.parse( + subscribersControllerUpdateSubscriberOnlineFlagRequest, + ), + ); +} + +export function subscribersControllerUpdateSubscriberOnlineFlagRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberOnlineFlagRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberOnlineFlagRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerUpdateSubscriberOnlineFlagRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerUpdateSubscriberOnlineFlagResponse$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberOnlineFlagResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.SubscriberResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberOnlineFlagResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.SubscriberResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberOnlineFlagResponse$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberOnlineFlagResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberOnlineFlagResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.SubscriberResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberOnlineFlagResponse$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberOnlineFlagResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberOnlineFlagResponse$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberOnlineFlagResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberOnlineFlagResponse$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberOnlineFlagResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberOnlineFlagResponse$Outbound; +} + +export function subscribersControllerUpdateSubscriberOnlineFlagResponseToJSON( + subscribersControllerUpdateSubscriberOnlineFlagResponse: + SubscribersControllerUpdateSubscriberOnlineFlagResponse, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberOnlineFlagResponse$outboundSchema + .parse(subscribersControllerUpdateSubscriberOnlineFlagResponse), + ); +} + +export function subscribersControllerUpdateSubscriberOnlineFlagResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberOnlineFlagResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberOnlineFlagResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerUpdateSubscriberOnlineFlagResponse' from JSON`, + ); +} diff --git a/src/models/operations/subscriberscontrollerupdatesubscriberpreference.ts b/src/models/operations/subscriberscontrollerupdatesubscriberpreference.ts new file mode 100644 index 00000000..8e1c86cf --- /dev/null +++ b/src/models/operations/subscriberscontrollerupdatesubscriberpreference.ts @@ -0,0 +1,187 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type SubscribersControllerUpdateSubscriberPreferenceRequest = { + subscriberId: string; + parameter: string; + updateSubscriberPreferenceRequestDto: + components.UpdateSubscriberPreferenceRequestDto; +}; + +export type SubscribersControllerUpdateSubscriberPreferenceResponse = { + headers: { [k: string]: Array }; + result: components.UpdateSubscriberPreferenceResponseDto; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberPreferenceRequest$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberPreferenceRequest, + z.ZodTypeDef, + unknown + > = z.object({ + subscriberId: z.string(), + parameter: z.string(), + UpdateSubscriberPreferenceRequestDto: + components.UpdateSubscriberPreferenceRequestDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "UpdateSubscriberPreferenceRequestDto": + "updateSubscriberPreferenceRequestDto", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberPreferenceRequest$Outbound = { + subscriberId: string; + parameter: string; + UpdateSubscriberPreferenceRequestDto: + components.UpdateSubscriberPreferenceRequestDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberPreferenceRequest$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberPreferenceRequest$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberPreferenceRequest + > = z.object({ + subscriberId: z.string(), + parameter: z.string(), + updateSubscriberPreferenceRequestDto: + components.UpdateSubscriberPreferenceRequestDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + updateSubscriberPreferenceRequestDto: + "UpdateSubscriberPreferenceRequestDto", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberPreferenceRequest$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberPreferenceRequest$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberPreferenceRequest$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberPreferenceRequest$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberPreferenceRequest$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberPreferenceRequest$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberPreferenceRequest$Outbound; +} + +export function subscribersControllerUpdateSubscriberPreferenceRequestToJSON( + subscribersControllerUpdateSubscriberPreferenceRequest: + SubscribersControllerUpdateSubscriberPreferenceRequest, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberPreferenceRequest$outboundSchema.parse( + subscribersControllerUpdateSubscriberPreferenceRequest, + ), + ); +} + +export function subscribersControllerUpdateSubscriberPreferenceRequestFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberPreferenceRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberPreferenceRequest$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerUpdateSubscriberPreferenceRequest' from JSON`, + ); +} + +/** @internal */ +export const SubscribersControllerUpdateSubscriberPreferenceResponse$inboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberPreferenceResponse, + z.ZodTypeDef, + unknown + > = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.UpdateSubscriberPreferenceResponseDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type SubscribersControllerUpdateSubscriberPreferenceResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.UpdateSubscriberPreferenceResponseDto$Outbound; +}; + +/** @internal */ +export const SubscribersControllerUpdateSubscriberPreferenceResponse$outboundSchema: + z.ZodType< + SubscribersControllerUpdateSubscriberPreferenceResponse$Outbound, + z.ZodTypeDef, + SubscribersControllerUpdateSubscriberPreferenceResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.UpdateSubscriberPreferenceResponseDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace SubscribersControllerUpdateSubscriberPreferenceResponse$ { + /** @deprecated use `SubscribersControllerUpdateSubscriberPreferenceResponse$inboundSchema` instead. */ + export const inboundSchema = + SubscribersControllerUpdateSubscriberPreferenceResponse$inboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberPreferenceResponse$outboundSchema` instead. */ + export const outboundSchema = + SubscribersControllerUpdateSubscriberPreferenceResponse$outboundSchema; + /** @deprecated use `SubscribersControllerUpdateSubscriberPreferenceResponse$Outbound` instead. */ + export type Outbound = + SubscribersControllerUpdateSubscriberPreferenceResponse$Outbound; +} + +export function subscribersControllerUpdateSubscriberPreferenceResponseToJSON( + subscribersControllerUpdateSubscriberPreferenceResponse: + SubscribersControllerUpdateSubscriberPreferenceResponse, +): string { + return JSON.stringify( + SubscribersControllerUpdateSubscriberPreferenceResponse$outboundSchema + .parse(subscribersControllerUpdateSubscriberPreferenceResponse), + ); +} + +export function subscribersControllerUpdateSubscriberPreferenceResponseFromJSON( + jsonString: string, +): SafeParseResult< + SubscribersControllerUpdateSubscriberPreferenceResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + SubscribersControllerUpdateSubscriberPreferenceResponse$inboundSchema + .parse(JSON.parse(x)), + `Failed to parse 'SubscribersControllerUpdateSubscriberPreferenceResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrolleraddsubscribers.ts b/src/models/operations/topicscontrolleraddsubscribers.ts new file mode 100644 index 00000000..080fc60a --- /dev/null +++ b/src/models/operations/topicscontrolleraddsubscribers.ts @@ -0,0 +1,160 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerAddSubscribersRequest = { + /** + * The topic key + */ + topicKey: string; + addSubscribersRequestDto: components.AddSubscribersRequestDto; +}; + +export type TopicsControllerAddSubscribersResponse = { + headers: { [k: string]: Array }; +}; + +/** @internal */ +export const TopicsControllerAddSubscribersRequest$inboundSchema: z.ZodType< + TopicsControllerAddSubscribersRequest, + z.ZodTypeDef, + unknown +> = z.object({ + topicKey: z.string(), + AddSubscribersRequestDto: components.AddSubscribersRequestDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "AddSubscribersRequestDto": "addSubscribersRequestDto", + }); +}); + +/** @internal */ +export type TopicsControllerAddSubscribersRequest$Outbound = { + topicKey: string; + AddSubscribersRequestDto: components.AddSubscribersRequestDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerAddSubscribersRequest$outboundSchema: z.ZodType< + TopicsControllerAddSubscribersRequest$Outbound, + z.ZodTypeDef, + TopicsControllerAddSubscribersRequest +> = z.object({ + topicKey: z.string(), + addSubscribersRequestDto: components.AddSubscribersRequestDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + addSubscribersRequestDto: "AddSubscribersRequestDto", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerAddSubscribersRequest$ { + /** @deprecated use `TopicsControllerAddSubscribersRequest$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerAddSubscribersRequest$inboundSchema; + /** @deprecated use `TopicsControllerAddSubscribersRequest$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerAddSubscribersRequest$outboundSchema; + /** @deprecated use `TopicsControllerAddSubscribersRequest$Outbound` instead. */ + export type Outbound = TopicsControllerAddSubscribersRequest$Outbound; +} + +export function topicsControllerAddSubscribersRequestToJSON( + topicsControllerAddSubscribersRequest: TopicsControllerAddSubscribersRequest, +): string { + return JSON.stringify( + TopicsControllerAddSubscribersRequest$outboundSchema.parse( + topicsControllerAddSubscribersRequest, + ), + ); +} + +export function topicsControllerAddSubscribersRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerAddSubscribersRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerAddSubscribersRequest' from JSON`, + ); +} + +/** @internal */ +export const TopicsControllerAddSubscribersResponse$inboundSchema: z.ZodType< + TopicsControllerAddSubscribersResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + }); +}); + +/** @internal */ +export type TopicsControllerAddSubscribersResponse$Outbound = { + Headers: { [k: string]: Array }; +}; + +/** @internal */ +export const TopicsControllerAddSubscribersResponse$outboundSchema: z.ZodType< + TopicsControllerAddSubscribersResponse$Outbound, + z.ZodTypeDef, + TopicsControllerAddSubscribersResponse +> = z.object({ + headers: z.record(z.array(z.string())), +}).transform((v) => { + return remap$(v, { + headers: "Headers", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerAddSubscribersResponse$ { + /** @deprecated use `TopicsControllerAddSubscribersResponse$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerAddSubscribersResponse$inboundSchema; + /** @deprecated use `TopicsControllerAddSubscribersResponse$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerAddSubscribersResponse$outboundSchema; + /** @deprecated use `TopicsControllerAddSubscribersResponse$Outbound` instead. */ + export type Outbound = TopicsControllerAddSubscribersResponse$Outbound; +} + +export function topicsControllerAddSubscribersResponseToJSON( + topicsControllerAddSubscribersResponse: + TopicsControllerAddSubscribersResponse, +): string { + return JSON.stringify( + TopicsControllerAddSubscribersResponse$outboundSchema.parse( + topicsControllerAddSubscribersResponse, + ), + ); +} + +export function topicsControllerAddSubscribersResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerAddSubscribersResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerAddSubscribersResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrollercreatetopic.ts b/src/models/operations/topicscontrollercreatetopic.ts new file mode 100644 index 00000000..e26599ab --- /dev/null +++ b/src/models/operations/topicscontrollercreatetopic.ts @@ -0,0 +1,87 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerCreateTopicResponse = { + headers: { [k: string]: Array }; + result: components.CreateTopicResponseDto; +}; + +/** @internal */ +export const TopicsControllerCreateTopicResponse$inboundSchema: z.ZodType< + TopicsControllerCreateTopicResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.CreateTopicResponseDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type TopicsControllerCreateTopicResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.CreateTopicResponseDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerCreateTopicResponse$outboundSchema: z.ZodType< + TopicsControllerCreateTopicResponse$Outbound, + z.ZodTypeDef, + TopicsControllerCreateTopicResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.CreateTopicResponseDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerCreateTopicResponse$ { + /** @deprecated use `TopicsControllerCreateTopicResponse$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerCreateTopicResponse$inboundSchema; + /** @deprecated use `TopicsControllerCreateTopicResponse$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerCreateTopicResponse$outboundSchema; + /** @deprecated use `TopicsControllerCreateTopicResponse$Outbound` instead. */ + export type Outbound = TopicsControllerCreateTopicResponse$Outbound; +} + +export function topicsControllerCreateTopicResponseToJSON( + topicsControllerCreateTopicResponse: TopicsControllerCreateTopicResponse, +): string { + return JSON.stringify( + TopicsControllerCreateTopicResponse$outboundSchema.parse( + topicsControllerCreateTopicResponse, + ), + ); +} + +export function topicsControllerCreateTopicResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerCreateTopicResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerCreateTopicResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrollerdeletetopic.ts b/src/models/operations/topicscontrollerdeletetopic.ts new file mode 100644 index 00000000..7e2f2e0a --- /dev/null +++ b/src/models/operations/topicscontrollerdeletetopic.ts @@ -0,0 +1,145 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerDeleteTopicRequest = { + /** + * The topic key + */ + topicKey: string; +}; + +export type TopicsControllerDeleteTopicResponse = { + headers: { [k: string]: Array }; +}; + +/** @internal */ +export const TopicsControllerDeleteTopicRequest$inboundSchema: z.ZodType< + TopicsControllerDeleteTopicRequest, + z.ZodTypeDef, + unknown +> = z.object({ + topicKey: z.string(), +}); + +/** @internal */ +export type TopicsControllerDeleteTopicRequest$Outbound = { + topicKey: string; +}; + +/** @internal */ +export const TopicsControllerDeleteTopicRequest$outboundSchema: z.ZodType< + TopicsControllerDeleteTopicRequest$Outbound, + z.ZodTypeDef, + TopicsControllerDeleteTopicRequest +> = z.object({ + topicKey: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerDeleteTopicRequest$ { + /** @deprecated use `TopicsControllerDeleteTopicRequest$inboundSchema` instead. */ + export const inboundSchema = TopicsControllerDeleteTopicRequest$inboundSchema; + /** @deprecated use `TopicsControllerDeleteTopicRequest$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerDeleteTopicRequest$outboundSchema; + /** @deprecated use `TopicsControllerDeleteTopicRequest$Outbound` instead. */ + export type Outbound = TopicsControllerDeleteTopicRequest$Outbound; +} + +export function topicsControllerDeleteTopicRequestToJSON( + topicsControllerDeleteTopicRequest: TopicsControllerDeleteTopicRequest, +): string { + return JSON.stringify( + TopicsControllerDeleteTopicRequest$outboundSchema.parse( + topicsControllerDeleteTopicRequest, + ), + ); +} + +export function topicsControllerDeleteTopicRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerDeleteTopicRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerDeleteTopicRequest' from JSON`, + ); +} + +/** @internal */ +export const TopicsControllerDeleteTopicResponse$inboundSchema: z.ZodType< + TopicsControllerDeleteTopicResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + }); +}); + +/** @internal */ +export type TopicsControllerDeleteTopicResponse$Outbound = { + Headers: { [k: string]: Array }; +}; + +/** @internal */ +export const TopicsControllerDeleteTopicResponse$outboundSchema: z.ZodType< + TopicsControllerDeleteTopicResponse$Outbound, + z.ZodTypeDef, + TopicsControllerDeleteTopicResponse +> = z.object({ + headers: z.record(z.array(z.string())), +}).transform((v) => { + return remap$(v, { + headers: "Headers", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerDeleteTopicResponse$ { + /** @deprecated use `TopicsControllerDeleteTopicResponse$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerDeleteTopicResponse$inboundSchema; + /** @deprecated use `TopicsControllerDeleteTopicResponse$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerDeleteTopicResponse$outboundSchema; + /** @deprecated use `TopicsControllerDeleteTopicResponse$Outbound` instead. */ + export type Outbound = TopicsControllerDeleteTopicResponse$Outbound; +} + +export function topicsControllerDeleteTopicResponseToJSON( + topicsControllerDeleteTopicResponse: TopicsControllerDeleteTopicResponse, +): string { + return JSON.stringify( + TopicsControllerDeleteTopicResponse$outboundSchema.parse( + topicsControllerDeleteTopicResponse, + ), + ); +} + +export function topicsControllerDeleteTopicResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerDeleteTopicResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerDeleteTopicResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrollergettopic.ts b/src/models/operations/topicscontrollergettopic.ts new file mode 100644 index 00000000..017b4120 --- /dev/null +++ b/src/models/operations/topicscontrollergettopic.ts @@ -0,0 +1,147 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerGetTopicRequest = { + /** + * The topic key + */ + topicKey: string; +}; + +export type TopicsControllerGetTopicResponse = { + headers: { [k: string]: Array }; + result: components.GetTopicResponseDto; +}; + +/** @internal */ +export const TopicsControllerGetTopicRequest$inboundSchema: z.ZodType< + TopicsControllerGetTopicRequest, + z.ZodTypeDef, + unknown +> = z.object({ + topicKey: z.string(), +}); + +/** @internal */ +export type TopicsControllerGetTopicRequest$Outbound = { + topicKey: string; +}; + +/** @internal */ +export const TopicsControllerGetTopicRequest$outboundSchema: z.ZodType< + TopicsControllerGetTopicRequest$Outbound, + z.ZodTypeDef, + TopicsControllerGetTopicRequest +> = z.object({ + topicKey: z.string(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerGetTopicRequest$ { + /** @deprecated use `TopicsControllerGetTopicRequest$inboundSchema` instead. */ + export const inboundSchema = TopicsControllerGetTopicRequest$inboundSchema; + /** @deprecated use `TopicsControllerGetTopicRequest$outboundSchema` instead. */ + export const outboundSchema = TopicsControllerGetTopicRequest$outboundSchema; + /** @deprecated use `TopicsControllerGetTopicRequest$Outbound` instead. */ + export type Outbound = TopicsControllerGetTopicRequest$Outbound; +} + +export function topicsControllerGetTopicRequestToJSON( + topicsControllerGetTopicRequest: TopicsControllerGetTopicRequest, +): string { + return JSON.stringify( + TopicsControllerGetTopicRequest$outboundSchema.parse( + topicsControllerGetTopicRequest, + ), + ); +} + +export function topicsControllerGetTopicRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TopicsControllerGetTopicRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerGetTopicRequest' from JSON`, + ); +} + +/** @internal */ +export const TopicsControllerGetTopicResponse$inboundSchema: z.ZodType< + TopicsControllerGetTopicResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.GetTopicResponseDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type TopicsControllerGetTopicResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.GetTopicResponseDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerGetTopicResponse$outboundSchema: z.ZodType< + TopicsControllerGetTopicResponse$Outbound, + z.ZodTypeDef, + TopicsControllerGetTopicResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.GetTopicResponseDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerGetTopicResponse$ { + /** @deprecated use `TopicsControllerGetTopicResponse$inboundSchema` instead. */ + export const inboundSchema = TopicsControllerGetTopicResponse$inboundSchema; + /** @deprecated use `TopicsControllerGetTopicResponse$outboundSchema` instead. */ + export const outboundSchema = TopicsControllerGetTopicResponse$outboundSchema; + /** @deprecated use `TopicsControllerGetTopicResponse$Outbound` instead. */ + export type Outbound = TopicsControllerGetTopicResponse$Outbound; +} + +export function topicsControllerGetTopicResponseToJSON( + topicsControllerGetTopicResponse: TopicsControllerGetTopicResponse, +): string { + return JSON.stringify( + TopicsControllerGetTopicResponse$outboundSchema.parse( + topicsControllerGetTopicResponse, + ), + ); +} + +export function topicsControllerGetTopicResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TopicsControllerGetTopicResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerGetTopicResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrollergettopicsubscriber.ts b/src/models/operations/topicscontrollergettopicsubscriber.ts new file mode 100644 index 00000000..d9fd3fac --- /dev/null +++ b/src/models/operations/topicscontrollergettopicsubscriber.ts @@ -0,0 +1,172 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerGetTopicSubscriberRequest = { + /** + * The external subscriber id + */ + externalSubscriberId: string; + /** + * The topic key + */ + topicKey: string; +}; + +export type TopicsControllerGetTopicSubscriberResponse = { + headers: { [k: string]: Array }; + result: components.TopicSubscriberDto; +}; + +/** @internal */ +export const TopicsControllerGetTopicSubscriberRequest$inboundSchema: z.ZodType< + TopicsControllerGetTopicSubscriberRequest, + z.ZodTypeDef, + unknown +> = z.object({ + externalSubscriberId: z.string(), + topicKey: z.string(), +}); + +/** @internal */ +export type TopicsControllerGetTopicSubscriberRequest$Outbound = { + externalSubscriberId: string; + topicKey: string; +}; + +/** @internal */ +export const TopicsControllerGetTopicSubscriberRequest$outboundSchema: + z.ZodType< + TopicsControllerGetTopicSubscriberRequest$Outbound, + z.ZodTypeDef, + TopicsControllerGetTopicSubscriberRequest + > = z.object({ + externalSubscriberId: z.string(), + topicKey: z.string(), + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerGetTopicSubscriberRequest$ { + /** @deprecated use `TopicsControllerGetTopicSubscriberRequest$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerGetTopicSubscriberRequest$inboundSchema; + /** @deprecated use `TopicsControllerGetTopicSubscriberRequest$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerGetTopicSubscriberRequest$outboundSchema; + /** @deprecated use `TopicsControllerGetTopicSubscriberRequest$Outbound` instead. */ + export type Outbound = TopicsControllerGetTopicSubscriberRequest$Outbound; +} + +export function topicsControllerGetTopicSubscriberRequestToJSON( + topicsControllerGetTopicSubscriberRequest: + TopicsControllerGetTopicSubscriberRequest, +): string { + return JSON.stringify( + TopicsControllerGetTopicSubscriberRequest$outboundSchema.parse( + topicsControllerGetTopicSubscriberRequest, + ), + ); +} + +export function topicsControllerGetTopicSubscriberRequestFromJSON( + jsonString: string, +): SafeParseResult< + TopicsControllerGetTopicSubscriberRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + TopicsControllerGetTopicSubscriberRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'TopicsControllerGetTopicSubscriberRequest' from JSON`, + ); +} + +/** @internal */ +export const TopicsControllerGetTopicSubscriberResponse$inboundSchema: + z.ZodType = + z.object({ + Headers: z.record(z.array(z.string())), + Result: components.TopicSubscriberDto$inboundSchema, + }).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); + }); + +/** @internal */ +export type TopicsControllerGetTopicSubscriberResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.TopicSubscriberDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerGetTopicSubscriberResponse$outboundSchema: + z.ZodType< + TopicsControllerGetTopicSubscriberResponse$Outbound, + z.ZodTypeDef, + TopicsControllerGetTopicSubscriberResponse + > = z.object({ + headers: z.record(z.array(z.string())), + result: components.TopicSubscriberDto$outboundSchema, + }).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerGetTopicSubscriberResponse$ { + /** @deprecated use `TopicsControllerGetTopicSubscriberResponse$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerGetTopicSubscriberResponse$inboundSchema; + /** @deprecated use `TopicsControllerGetTopicSubscriberResponse$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerGetTopicSubscriberResponse$outboundSchema; + /** @deprecated use `TopicsControllerGetTopicSubscriberResponse$Outbound` instead. */ + export type Outbound = TopicsControllerGetTopicSubscriberResponse$Outbound; +} + +export function topicsControllerGetTopicSubscriberResponseToJSON( + topicsControllerGetTopicSubscriberResponse: + TopicsControllerGetTopicSubscriberResponse, +): string { + return JSON.stringify( + TopicsControllerGetTopicSubscriberResponse$outboundSchema.parse( + topicsControllerGetTopicSubscriberResponse, + ), + ); +} + +export function topicsControllerGetTopicSubscriberResponseFromJSON( + jsonString: string, +): SafeParseResult< + TopicsControllerGetTopicSubscriberResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + TopicsControllerGetTopicSubscriberResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'TopicsControllerGetTopicSubscriberResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrollerlisttopics.ts b/src/models/operations/topicscontrollerlisttopics.ts new file mode 100644 index 00000000..f98fe53f --- /dev/null +++ b/src/models/operations/topicscontrollerlisttopics.ts @@ -0,0 +1,164 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerListTopicsRequest = { + /** + * Number of page for the pagination + */ + page?: number | undefined; + /** + * Size of page for the pagination + */ + pageSize?: number | undefined; + /** + * Topic key + */ + key?: string | undefined; +}; + +export type TopicsControllerListTopicsResponse = { + headers: { [k: string]: Array }; + result: components.FilterTopicsResponseDto; +}; + +/** @internal */ +export const TopicsControllerListTopicsRequest$inboundSchema: z.ZodType< + TopicsControllerListTopicsRequest, + z.ZodTypeDef, + unknown +> = z.object({ + page: z.number().default(0), + pageSize: z.number().default(10), + key: z.string().optional(), +}); + +/** @internal */ +export type TopicsControllerListTopicsRequest$Outbound = { + page: number; + pageSize: number; + key?: string | undefined; +}; + +/** @internal */ +export const TopicsControllerListTopicsRequest$outboundSchema: z.ZodType< + TopicsControllerListTopicsRequest$Outbound, + z.ZodTypeDef, + TopicsControllerListTopicsRequest +> = z.object({ + page: z.number().default(0), + pageSize: z.number().default(10), + key: z.string().optional(), +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerListTopicsRequest$ { + /** @deprecated use `TopicsControllerListTopicsRequest$inboundSchema` instead. */ + export const inboundSchema = TopicsControllerListTopicsRequest$inboundSchema; + /** @deprecated use `TopicsControllerListTopicsRequest$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerListTopicsRequest$outboundSchema; + /** @deprecated use `TopicsControllerListTopicsRequest$Outbound` instead. */ + export type Outbound = TopicsControllerListTopicsRequest$Outbound; +} + +export function topicsControllerListTopicsRequestToJSON( + topicsControllerListTopicsRequest: TopicsControllerListTopicsRequest, +): string { + return JSON.stringify( + TopicsControllerListTopicsRequest$outboundSchema.parse( + topicsControllerListTopicsRequest, + ), + ); +} + +export function topicsControllerListTopicsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TopicsControllerListTopicsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerListTopicsRequest' from JSON`, + ); +} + +/** @internal */ +export const TopicsControllerListTopicsResponse$inboundSchema: z.ZodType< + TopicsControllerListTopicsResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.FilterTopicsResponseDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type TopicsControllerListTopicsResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.FilterTopicsResponseDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerListTopicsResponse$outboundSchema: z.ZodType< + TopicsControllerListTopicsResponse$Outbound, + z.ZodTypeDef, + TopicsControllerListTopicsResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.FilterTopicsResponseDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerListTopicsResponse$ { + /** @deprecated use `TopicsControllerListTopicsResponse$inboundSchema` instead. */ + export const inboundSchema = TopicsControllerListTopicsResponse$inboundSchema; + /** @deprecated use `TopicsControllerListTopicsResponse$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerListTopicsResponse$outboundSchema; + /** @deprecated use `TopicsControllerListTopicsResponse$Outbound` instead. */ + export type Outbound = TopicsControllerListTopicsResponse$Outbound; +} + +export function topicsControllerListTopicsResponseToJSON( + topicsControllerListTopicsResponse: TopicsControllerListTopicsResponse, +): string { + return JSON.stringify( + TopicsControllerListTopicsResponse$outboundSchema.parse( + topicsControllerListTopicsResponse, + ), + ); +} + +export function topicsControllerListTopicsResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerListTopicsResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerListTopicsResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrollerremovesubscribers.ts b/src/models/operations/topicscontrollerremovesubscribers.ts new file mode 100644 index 00000000..8d84aadf --- /dev/null +++ b/src/models/operations/topicscontrollerremovesubscribers.ts @@ -0,0 +1,174 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerRemoveSubscribersRequest = { + /** + * The topic key + */ + topicKey: string; + removeSubscribersRequestDto: components.RemoveSubscribersRequestDto; +}; + +export type TopicsControllerRemoveSubscribersResponse = { + headers: { [k: string]: Array }; +}; + +/** @internal */ +export const TopicsControllerRemoveSubscribersRequest$inboundSchema: z.ZodType< + TopicsControllerRemoveSubscribersRequest, + z.ZodTypeDef, + unknown +> = z.object({ + topicKey: z.string(), + RemoveSubscribersRequestDto: + components.RemoveSubscribersRequestDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "RemoveSubscribersRequestDto": "removeSubscribersRequestDto", + }); +}); + +/** @internal */ +export type TopicsControllerRemoveSubscribersRequest$Outbound = { + topicKey: string; + RemoveSubscribersRequestDto: components.RemoveSubscribersRequestDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerRemoveSubscribersRequest$outboundSchema: z.ZodType< + TopicsControllerRemoveSubscribersRequest$Outbound, + z.ZodTypeDef, + TopicsControllerRemoveSubscribersRequest +> = z.object({ + topicKey: z.string(), + removeSubscribersRequestDto: + components.RemoveSubscribersRequestDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + removeSubscribersRequestDto: "RemoveSubscribersRequestDto", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerRemoveSubscribersRequest$ { + /** @deprecated use `TopicsControllerRemoveSubscribersRequest$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerRemoveSubscribersRequest$inboundSchema; + /** @deprecated use `TopicsControllerRemoveSubscribersRequest$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerRemoveSubscribersRequest$outboundSchema; + /** @deprecated use `TopicsControllerRemoveSubscribersRequest$Outbound` instead. */ + export type Outbound = TopicsControllerRemoveSubscribersRequest$Outbound; +} + +export function topicsControllerRemoveSubscribersRequestToJSON( + topicsControllerRemoveSubscribersRequest: + TopicsControllerRemoveSubscribersRequest, +): string { + return JSON.stringify( + TopicsControllerRemoveSubscribersRequest$outboundSchema.parse( + topicsControllerRemoveSubscribersRequest, + ), + ); +} + +export function topicsControllerRemoveSubscribersRequestFromJSON( + jsonString: string, +): SafeParseResult< + TopicsControllerRemoveSubscribersRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + TopicsControllerRemoveSubscribersRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'TopicsControllerRemoveSubscribersRequest' from JSON`, + ); +} + +/** @internal */ +export const TopicsControllerRemoveSubscribersResponse$inboundSchema: z.ZodType< + TopicsControllerRemoveSubscribersResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + }); +}); + +/** @internal */ +export type TopicsControllerRemoveSubscribersResponse$Outbound = { + Headers: { [k: string]: Array }; +}; + +/** @internal */ +export const TopicsControllerRemoveSubscribersResponse$outboundSchema: + z.ZodType< + TopicsControllerRemoveSubscribersResponse$Outbound, + z.ZodTypeDef, + TopicsControllerRemoveSubscribersResponse + > = z.object({ + headers: z.record(z.array(z.string())), + }).transform((v) => { + return remap$(v, { + headers: "Headers", + }); + }); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerRemoveSubscribersResponse$ { + /** @deprecated use `TopicsControllerRemoveSubscribersResponse$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerRemoveSubscribersResponse$inboundSchema; + /** @deprecated use `TopicsControllerRemoveSubscribersResponse$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerRemoveSubscribersResponse$outboundSchema; + /** @deprecated use `TopicsControllerRemoveSubscribersResponse$Outbound` instead. */ + export type Outbound = TopicsControllerRemoveSubscribersResponse$Outbound; +} + +export function topicsControllerRemoveSubscribersResponseToJSON( + topicsControllerRemoveSubscribersResponse: + TopicsControllerRemoveSubscribersResponse, +): string { + return JSON.stringify( + TopicsControllerRemoveSubscribersResponse$outboundSchema.parse( + topicsControllerRemoveSubscribersResponse, + ), + ); +} + +export function topicsControllerRemoveSubscribersResponseFromJSON( + jsonString: string, +): SafeParseResult< + TopicsControllerRemoveSubscribersResponse, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + TopicsControllerRemoveSubscribersResponse$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'TopicsControllerRemoveSubscribersResponse' from JSON`, + ); +} diff --git a/src/models/operations/topicscontrollerrenametopic.ts b/src/models/operations/topicscontrollerrenametopic.ts new file mode 100644 index 00000000..3f033892 --- /dev/null +++ b/src/models/operations/topicscontrollerrenametopic.ts @@ -0,0 +1,164 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; +import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; + +export type TopicsControllerRenameTopicRequest = { + /** + * The topic key + */ + topicKey: string; + renameTopicRequestDto: components.RenameTopicRequestDto; +}; + +export type TopicsControllerRenameTopicResponse = { + headers: { [k: string]: Array }; + result: components.RenameTopicResponseDto; +}; + +/** @internal */ +export const TopicsControllerRenameTopicRequest$inboundSchema: z.ZodType< + TopicsControllerRenameTopicRequest, + z.ZodTypeDef, + unknown +> = z.object({ + topicKey: z.string(), + RenameTopicRequestDto: components.RenameTopicRequestDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "RenameTopicRequestDto": "renameTopicRequestDto", + }); +}); + +/** @internal */ +export type TopicsControllerRenameTopicRequest$Outbound = { + topicKey: string; + RenameTopicRequestDto: components.RenameTopicRequestDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerRenameTopicRequest$outboundSchema: z.ZodType< + TopicsControllerRenameTopicRequest$Outbound, + z.ZodTypeDef, + TopicsControllerRenameTopicRequest +> = z.object({ + topicKey: z.string(), + renameTopicRequestDto: components.RenameTopicRequestDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + renameTopicRequestDto: "RenameTopicRequestDto", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerRenameTopicRequest$ { + /** @deprecated use `TopicsControllerRenameTopicRequest$inboundSchema` instead. */ + export const inboundSchema = TopicsControllerRenameTopicRequest$inboundSchema; + /** @deprecated use `TopicsControllerRenameTopicRequest$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerRenameTopicRequest$outboundSchema; + /** @deprecated use `TopicsControllerRenameTopicRequest$Outbound` instead. */ + export type Outbound = TopicsControllerRenameTopicRequest$Outbound; +} + +export function topicsControllerRenameTopicRequestToJSON( + topicsControllerRenameTopicRequest: TopicsControllerRenameTopicRequest, +): string { + return JSON.stringify( + TopicsControllerRenameTopicRequest$outboundSchema.parse( + topicsControllerRenameTopicRequest, + ), + ); +} + +export function topicsControllerRenameTopicRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerRenameTopicRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerRenameTopicRequest' from JSON`, + ); +} + +/** @internal */ +export const TopicsControllerRenameTopicResponse$inboundSchema: z.ZodType< + TopicsControllerRenameTopicResponse, + z.ZodTypeDef, + unknown +> = z.object({ + Headers: z.record(z.array(z.string())), + Result: components.RenameTopicResponseDto$inboundSchema, +}).transform((v) => { + return remap$(v, { + "Headers": "headers", + "Result": "result", + }); +}); + +/** @internal */ +export type TopicsControllerRenameTopicResponse$Outbound = { + Headers: { [k: string]: Array }; + Result: components.RenameTopicResponseDto$Outbound; +}; + +/** @internal */ +export const TopicsControllerRenameTopicResponse$outboundSchema: z.ZodType< + TopicsControllerRenameTopicResponse$Outbound, + z.ZodTypeDef, + TopicsControllerRenameTopicResponse +> = z.object({ + headers: z.record(z.array(z.string())), + result: components.RenameTopicResponseDto$outboundSchema, +}).transform((v) => { + return remap$(v, { + headers: "Headers", + result: "Result", + }); +}); + +/** + * @internal + * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. + */ +export namespace TopicsControllerRenameTopicResponse$ { + /** @deprecated use `TopicsControllerRenameTopicResponse$inboundSchema` instead. */ + export const inboundSchema = + TopicsControllerRenameTopicResponse$inboundSchema; + /** @deprecated use `TopicsControllerRenameTopicResponse$outboundSchema` instead. */ + export const outboundSchema = + TopicsControllerRenameTopicResponse$outboundSchema; + /** @deprecated use `TopicsControllerRenameTopicResponse$Outbound` instead. */ + export type Outbound = TopicsControllerRenameTopicResponse$Outbound; +} + +export function topicsControllerRenameTopicResponseToJSON( + topicsControllerRenameTopicResponse: TopicsControllerRenameTopicResponse, +): string { + return JSON.stringify( + TopicsControllerRenameTopicResponse$outboundSchema.parse( + topicsControllerRenameTopicResponse, + ), + ); +} + +export function topicsControllerRenameTopicResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + TopicsControllerRenameTopicResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TopicsControllerRenameTopicResponse' from JSON`, + ); +} diff --git a/src/sdk/apikeys.ts b/src/sdk/apikeys.ts new file mode 100644 index 00000000..62daa88c --- /dev/null +++ b/src/sdk/apikeys.ts @@ -0,0 +1,24 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { environmentsApiKeysList } from "../funcs/environmentsApiKeysList.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class ApiKeys extends ClientSDK { + /** + * Get api keys + */ + async list( + options?: RequestOptions, + ): Promise< + operations.EnvironmentsControllerV1ListOrganizationApiKeysResponse + > { + return unwrapAsync(environmentsApiKeysList( + this, + options, + )); + } +} diff --git a/src/sdk/authentication.ts b/src/sdk/authentication.ts new file mode 100644 index 00000000..992a9625 --- /dev/null +++ b/src/sdk/authentication.ts @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { subscribersAuthenticationChatAccessOauth } from "../funcs/subscribersAuthenticationChatAccessOauth.js"; +import { subscribersAuthenticationChatAccessOauthCallBack } from "../funcs/subscribersAuthenticationChatAccessOauthCallBack.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Authentication extends ClientSDK { + /** + * Handle providers oauth redirect + */ + async chatAccessOauthCallBack( + request: operations.SubscribersControllerChatOauthCallbackRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersAuthenticationChatAccessOauthCallBack( + this, + request, + options, + )); + } + + /** + * Handle chat oauth + */ + async chatAccessOauth( + request: operations.SubscribersControllerChatAccessOauthRequest, + options?: RequestOptions, + ): Promise< + operations.SubscribersControllerChatAccessOauthResponse | undefined + > { + return unwrapAsync(subscribersAuthenticationChatAccessOauth( + this, + request, + options, + )); + } +} diff --git a/src/sdk/credentials.ts b/src/sdk/credentials.ts new file mode 100644 index 00000000..2ac9307f --- /dev/null +++ b/src/sdk/credentials.ts @@ -0,0 +1,77 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { subscribersCredentialsAppend } from "../funcs/subscribersCredentialsAppend.js"; +import { subscribersCredentialsDelete } from "../funcs/subscribersCredentialsDelete.js"; +import { subscribersCredentialsUpdate } from "../funcs/subscribersCredentialsUpdate.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Credentials extends ClientSDK { + /** + * Update subscriber credentials + * + * @remarks + * Subscriber credentials associated to the delivery methods such as slack and push tokens. + */ + async update( + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto, + subscriberId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersCredentialsUpdate( + this, + updateSubscriberChannelRequestDto, + subscriberId, + options, + )); + } + + /** + * Modify subscriber credentials + * + * @remarks + * Subscriber credentials associated to the delivery methods such as slack and push tokens. + * + * This endpoint appends provided credentials and deviceTokens to the existing ones. + */ + async append( + updateSubscriberChannelRequestDto: + components.UpdateSubscriberChannelRequestDto, + subscriberId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersCredentialsAppend( + this, + updateSubscriberChannelRequestDto, + subscriberId, + options, + )); + } + + /** + * Delete subscriber credentials by providerId + * + * @remarks + * Delete subscriber credentials such as slack and expo tokens. + */ + async delete( + subscriberId: string, + providerId: string, + options?: RequestOptions, + ): Promise< + | operations.SubscribersControllerDeleteSubscriberCredentialsResponse + | undefined + > { + return unwrapAsync(subscribersCredentialsDelete( + this, + subscriberId, + providerId, + options, + )); + } +} diff --git a/src/sdk/environments.ts b/src/sdk/environments.ts new file mode 100644 index 00000000..ba0cf44f --- /dev/null +++ b/src/sdk/environments.ts @@ -0,0 +1,41 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { environmentsList } from "../funcs/environmentsList.js"; +import { environmentsRetrieve } from "../funcs/environmentsRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; +import { ApiKeys } from "./apikeys.js"; + +export class Environments extends ClientSDK { + private _apiKeys?: ApiKeys; + get apiKeys(): ApiKeys { + return (this._apiKeys ??= new ApiKeys(this._options)); + } + + /** + * Get current environment + */ + async retrieve( + options?: RequestOptions, + ): Promise { + return unwrapAsync(environmentsRetrieve( + this, + options, + )); + } + + /** + * Get environments + */ + async list( + options?: RequestOptions, + ): Promise { + return unwrapAsync(environmentsList( + this, + options, + )); + } +} diff --git a/src/sdk/executiondetails.ts b/src/sdk/executiondetails.ts new file mode 100644 index 00000000..ab136faa --- /dev/null +++ b/src/sdk/executiondetails.ts @@ -0,0 +1,28 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { executionDetailsRetrieve } from "../funcs/executionDetailsRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class ExecutionDetails extends ClientSDK { + /** + * Get execution details + */ + async retrieve( + notificationId: string, + subscriberId: string, + options?: RequestOptions, + ): Promise< + operations.ExecutionDetailsControllerGetExecutionDetailsForNotificationResponse + > { + return unwrapAsync(executionDetailsRetrieve( + this, + notificationId, + subscriberId, + options, + )); + } +} diff --git a/src/sdk/index.ts b/src/sdk/index.ts new file mode 100644 index 00000000..ecac2264 --- /dev/null +++ b/src/sdk/index.ts @@ -0,0 +1,5 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export * from "./sdk.js"; diff --git a/src/sdk/integrations.ts b/src/sdk/integrations.ts new file mode 100644 index 00000000..11dfece3 --- /dev/null +++ b/src/sdk/integrations.ts @@ -0,0 +1,113 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { integrationsCreate } from "../funcs/integrationsCreate.js"; +import { integrationsDelete } from "../funcs/integrationsDelete.js"; +import { integrationsList } from "../funcs/integrationsList.js"; +import { integrationsListActive } from "../funcs/integrationsListActive.js"; +import { integrationsSetAsPrimary } from "../funcs/integrationsSetAsPrimary.js"; +import { integrationsUpdate } from "../funcs/integrationsUpdate.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; +import { Webhooks } from "./webhooks.js"; + +export class Integrations extends ClientSDK { + private _webhooks?: Webhooks; + get webhooks(): Webhooks { + return (this._webhooks ??= new Webhooks(this._options)); + } + + /** + * Get integrations + * + * @remarks + * Return all the integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change + */ + async list( + options?: RequestOptions, + ): Promise { + return unwrapAsync(integrationsList( + this, + options, + )); + } + + /** + * Create integration + * + * @remarks + * Create an integration for the current environment the user is based on the API key provided + */ + async create( + request: components.CreateIntegrationRequestDto, + options?: RequestOptions, + ): Promise { + return unwrapAsync(integrationsCreate( + this, + request, + options, + )); + } + + /** + * Get active integrations + * + * @remarks + * Return all the active integrations the user has created for that organization. Review v.0.17.0 changelog for a breaking change + */ + async listActive( + options?: RequestOptions, + ): Promise { + return unwrapAsync(integrationsListActive( + this, + options, + )); + } + + /** + * Update integration + */ + async update( + updateIntegrationRequestDto: components.UpdateIntegrationRequestDto, + integrationId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(integrationsUpdate( + this, + updateIntegrationRequestDto, + integrationId, + options, + )); + } + + /** + * Delete integration + */ + async delete( + integrationId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(integrationsDelete( + this, + integrationId, + options, + )); + } + + /** + * Set integration as primary + */ + async setAsPrimary( + integrationId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(integrationsSetAsPrimary( + this, + integrationId, + options, + )); + } +} diff --git a/src/sdk/messages.ts b/src/sdk/messages.ts new file mode 100644 index 00000000..bc23e83e --- /dev/null +++ b/src/sdk/messages.ts @@ -0,0 +1,68 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { messagesDelete } from "../funcs/messagesDelete.js"; +import { messagesDeleteByTransactionId } from "../funcs/messagesDeleteByTransactionId.js"; +import { messagesRetrieve } from "../funcs/messagesRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Messages extends ClientSDK { + /** + * Get messages + * + * @remarks + * Returns a list of messages, could paginate using the `page` query parameter + */ + async retrieve( + request: operations.MessagesControllerGetMessagesRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(messagesRetrieve( + this, + request, + options, + )); + } + + /** + * Delete message + * + * @remarks + * Deletes a message entity from the Novu platform + */ + async delete( + messageId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(messagesDelete( + this, + messageId, + options, + )); + } + + /** + * Delete messages by transactionId + * + * @remarks + * Deletes messages entity from the Novu platform using TransactionId of message + */ + async deleteByTransactionId( + transactionId: string, + channel?: operations.QueryParamChannel | undefined, + options?: RequestOptions, + ): Promise< + | operations.MessagesControllerDeleteMessagesByTransactionIdResponse + | undefined + > { + return unwrapAsync(messagesDeleteByTransactionId( + this, + transactionId, + channel, + options, + )); + } +} diff --git a/src/sdk/notifications.ts b/src/sdk/notifications.ts new file mode 100644 index 00000000..bbfe0d85 --- /dev/null +++ b/src/sdk/notifications.ts @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { notificationsList } from "../funcs/notificationsList.js"; +import { notificationsRetrieve } from "../funcs/notificationsRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; +import { Stats } from "./stats.js"; + +export class Notifications extends ClientSDK { + private _stats?: Stats; + get stats(): Stats { + return (this._stats ??= new Stats(this._options)); + } + + /** + * Get notifications + */ + async list( + request: operations.NotificationsControllerListNotificationsRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(notificationsList( + this, + request, + options, + )); + } + + /** + * Get notification + */ + async retrieve( + notificationId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(notificationsRetrieve( + this, + notificationId, + options, + )); + } +} diff --git a/src/sdk/novumessages.ts b/src/sdk/novumessages.ts new file mode 100644 index 00000000..b8eb5333 --- /dev/null +++ b/src/sdk/novumessages.ts @@ -0,0 +1,59 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { subscribersMessagesMarkAll } from "../funcs/subscribersMessagesMarkAll.js"; +import { subscribersMessagesMarkAllAs } from "../funcs/subscribersMessagesMarkAllAs.js"; +import { subscribersMessagesUpdateAsSeen } from "../funcs/subscribersMessagesUpdateAsSeen.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class NovuMessages extends ClientSDK { + /** + * Mark a subscriber messages as seen, read, unseen or unread + */ + async markAllAs( + messageMarkAsRequestDto: components.MessageMarkAsRequestDto, + subscriberId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersMessagesMarkAllAs( + this, + messageMarkAsRequestDto, + subscriberId, + options, + )); + } + + /** + * Marks all the subscriber messages as read, unread, seen or unseen. Optionally you can pass feed id (or array) to mark messages of a particular feed. + */ + async markAll( + markAllMessageAsRequestDto: components.MarkAllMessageAsRequestDto, + subscriberId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersMessagesMarkAll( + this, + markAllMessageAsRequestDto, + subscriberId, + options, + )); + } + + /** + * Mark message action as seen + */ + async updateAsSeen( + request: operations.SubscribersControllerMarkActionAsSeenRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersMessagesUpdateAsSeen( + this, + request, + options, + )); + } +} diff --git a/src/sdk/novunotifications.ts b/src/sdk/novunotifications.ts new file mode 100644 index 00000000..32e3be09 --- /dev/null +++ b/src/sdk/novunotifications.ts @@ -0,0 +1,39 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { subscribersNotificationsRetrieve } from "../funcs/subscribersNotificationsRetrieve.js"; +import { subscribersNotificationsUnseenCount } from "../funcs/subscribersNotificationsUnseenCount.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class NovuNotifications extends ClientSDK { + /** + * Get in-app notification feed for a particular subscriber + */ + async retrieve( + request: operations.SubscribersControllerGetNotificationsFeedRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersNotificationsRetrieve( + this, + request, + options, + )); + } + + /** + * Get the unseen in-app notifications count for subscribers feed + */ + async unseenCount( + request: operations.SubscribersControllerGetUnseenCountRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersNotificationsUnseenCount( + this, + request, + options, + )); + } +} diff --git a/src/sdk/novusubscribers.ts b/src/sdk/novusubscribers.ts new file mode 100644 index 00000000..b78fb169 --- /dev/null +++ b/src/sdk/novusubscribers.ts @@ -0,0 +1,70 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { topicsSubscribersAssign } from "../funcs/topicsSubscribersAssign.js"; +import { topicsSubscribersDelete } from "../funcs/topicsSubscribersDelete.js"; +import { topicsSubscribersRetrieve } from "../funcs/topicsSubscribersRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class NovuSubscribers extends ClientSDK { + /** + * Subscribers addition + * + * @remarks + * Add subscribers to a topic by key + */ + async assign( + addSubscribersRequestDto: components.AddSubscribersRequestDto, + topicKey: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsSubscribersAssign( + this, + addSubscribersRequestDto, + topicKey, + options, + )); + } + + /** + * Check topic subscriber + * + * @remarks + * Check if a subscriber belongs to a certain topic + */ + async retrieve( + externalSubscriberId: string, + topicKey: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsSubscribersRetrieve( + this, + externalSubscriberId, + topicKey, + options, + )); + } + + /** + * Subscribers removal + * + * @remarks + * Remove subscribers from a topic + */ + async delete( + removeSubscribersRequestDto: components.RemoveSubscribersRequestDto, + topicKey: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsSubscribersDelete( + this, + removeSubscribersRequestDto, + topicKey, + options, + )); + } +} diff --git a/src/sdk/preferences.ts b/src/sdk/preferences.ts new file mode 100644 index 00000000..1b089387 --- /dev/null +++ b/src/sdk/preferences.ts @@ -0,0 +1,84 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { subscribersPreferencesList } from "../funcs/subscribersPreferencesList.js"; +import { subscribersPreferencesRetrieveByLevel } from "../funcs/subscribersPreferencesRetrieveByLevel.js"; +import { subscribersPreferencesUpdate } from "../funcs/subscribersPreferencesUpdate.js"; +import { subscribersPreferencesUpdateGlobal } from "../funcs/subscribersPreferencesUpdateGlobal.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Preferences extends ClientSDK { + /** + * Get subscriber preferences + */ + async list( + subscriberId: string, + includeInactiveChannels?: boolean | undefined, + options?: RequestOptions, + ): Promise< + operations.SubscribersControllerListSubscriberPreferencesResponse + > { + return unwrapAsync(subscribersPreferencesList( + this, + subscriberId, + includeInactiveChannels, + options, + )); + } + + /** + * Update subscriber global preferences + */ + async updateGlobal( + updateSubscriberGlobalPreferencesRequestDto: + components.UpdateSubscriberGlobalPreferencesRequestDto, + subscriberId: string, + options?: RequestOptions, + ): Promise< + operations.SubscribersControllerUpdateSubscriberGlobalPreferencesResponse + > { + return unwrapAsync(subscribersPreferencesUpdateGlobal( + this, + updateSubscriberGlobalPreferencesRequestDto, + subscriberId, + options, + )); + } + + /** + * Get subscriber preferences by level + */ + async retrieveByLevel( + request: + operations.SubscribersControllerGetSubscriberPreferenceByLevelRequest, + options?: RequestOptions, + ): Promise< + operations.SubscribersControllerGetSubscriberPreferenceByLevelResponse + > { + return unwrapAsync(subscribersPreferencesRetrieveByLevel( + this, + request, + options, + )); + } + + /** + * Update subscriber preference + */ + async update( + request: operations.SubscribersControllerUpdateSubscriberPreferenceRequest, + options?: RequestOptions, + ): Promise< + operations.SubscribersControllerUpdateSubscriberPreferenceResponse + > { + return unwrapAsync(subscribersPreferencesUpdate( + this, + request, + options, + )); + } +} diff --git a/src/sdk/properties.ts b/src/sdk/properties.ts new file mode 100644 index 00000000..f2e4bed0 --- /dev/null +++ b/src/sdk/properties.ts @@ -0,0 +1,33 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { subscribersPropertiesUpdateOnlineFlag } from "../funcs/subscribersPropertiesUpdateOnlineFlag.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Properties extends ClientSDK { + /** + * Update subscriber online status + * + * @remarks + * Used to update the subscriber isOnline flag. + */ + async updateOnlineFlag( + updateSubscriberOnlineFlagRequestDto: + components.UpdateSubscriberOnlineFlagRequestDto, + subscriberId: string, + options?: RequestOptions, + ): Promise< + operations.SubscribersControllerUpdateSubscriberOnlineFlagResponse + > { + return unwrapAsync(subscribersPropertiesUpdateOnlineFlag( + this, + updateSubscriberOnlineFlagRequestDto, + subscriberId, + options, + )); + } +} diff --git a/src/sdk/sdk.ts b/src/sdk/sdk.ts new file mode 100644 index 00000000..91eb14be --- /dev/null +++ b/src/sdk/sdk.ts @@ -0,0 +1,139 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { cancelByTransactionId } from "../funcs/cancelByTransactionId.js"; +import { trigger } from "../funcs/trigger.js"; +import { triggerBroadcast } from "../funcs/triggerBroadcast.js"; +import { triggerBulk } from "../funcs/triggerBulk.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; +import { Environments } from "./environments.js"; +import { ExecutionDetails } from "./executiondetails.js"; +import { Integrations } from "./integrations.js"; +import { Messages } from "./messages.js"; +import { Notifications } from "./notifications.js"; +import { Subscribers } from "./subscribers.js"; +import { Topics } from "./topics.js"; +import { WorkflowGroups } from "./workflowgroups.js"; + +export class Novu extends ClientSDK { + private _environments?: Environments; + get environments(): Environments { + return (this._environments ??= new Environments(this._options)); + } + + private _executionDetails?: ExecutionDetails; + get executionDetails(): ExecutionDetails { + return (this._executionDetails ??= new ExecutionDetails(this._options)); + } + + private _notifications?: Notifications; + get notifications(): Notifications { + return (this._notifications ??= new Notifications(this._options)); + } + + private _workflowGroups?: WorkflowGroups; + get workflowGroups(): WorkflowGroups { + return (this._workflowGroups ??= new WorkflowGroups(this._options)); + } + + private _integrations?: Integrations; + get integrations(): Integrations { + return (this._integrations ??= new Integrations(this._options)); + } + + private _subscribers?: Subscribers; + get subscribers(): Subscribers { + return (this._subscribers ??= new Subscribers(this._options)); + } + + private _messages?: Messages; + get messages(): Messages { + return (this._messages ??= new Messages(this._options)); + } + + private _topics?: Topics; + get topics(): Topics { + return (this._topics ??= new Topics(this._options)); + } + + /** + * Trigger event + * + * @remarks + * + * Trigger event is the main (and only) way to send notifications to subscribers. + * The trigger identifier is used to match the particular workflow associated with it. + * Additional information can be passed according the body interface below. + */ + async trigger( + request: components.TriggerEventRequestDto, + options?: RequestOptions, + ): Promise { + return unwrapAsync(trigger( + this, + request, + options, + )); + } + + /** + * Bulk trigger event + * + * @remarks + * + * Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API. + * The bulk API is limited to 100 events per request. + */ + async triggerBulk( + request: components.BulkTriggerEventDto, + options?: RequestOptions, + ): Promise { + return unwrapAsync(triggerBulk( + this, + request, + options, + )); + } + + /** + * Broadcast event to all + * + * @remarks + * Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc. + * + * In the future could be used to trigger events to a subset of subscribers based on defined filters. + */ + async triggerBroadcast( + request: components.TriggerEventToAllRequestDto, + options?: RequestOptions, + ): Promise { + return unwrapAsync(triggerBroadcast( + this, + request, + options, + )); + } + + /** + * Cancel triggered event + * + * @remarks + * + * Using a previously generated transactionId during the event trigger, + * will cancel any active or pending workflows. This is useful to cancel active digests, delays etc... + */ + async cancelByTransactionId( + transactionId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(cancelByTransactionId( + this, + transactionId, + options, + )); + } +} diff --git a/src/sdk/stats.ts b/src/sdk/stats.ts new file mode 100644 index 00000000..dd2e3d8e --- /dev/null +++ b/src/sdk/stats.ts @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { notificationsStatsGraph } from "../funcs/notificationsStatsGraph.js"; +import { notificationsStatsRetrieve } from "../funcs/notificationsStatsRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Stats extends ClientSDK { + /** + * Get notification statistics + */ + async retrieve( + options?: RequestOptions, + ): Promise { + return unwrapAsync(notificationsStatsRetrieve( + this, + options, + )); + } + + /** + * Get notification graph statistics + */ + async graph( + days?: number | undefined, + options?: RequestOptions, + ): Promise { + return unwrapAsync(notificationsStatsGraph( + this, + days, + options, + )); + } +} diff --git a/src/sdk/subscribers.ts b/src/sdk/subscribers.ts new file mode 100644 index 00000000..c0865190 --- /dev/null +++ b/src/sdk/subscribers.ts @@ -0,0 +1,167 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { subscribersCreate } from "../funcs/subscribersCreate.js"; +import { subscribersCreateBulk } from "../funcs/subscribersCreateBulk.js"; +import { subscribersDelete } from "../funcs/subscribersDelete.js"; +import { subscribersList } from "../funcs/subscribersList.js"; +import { subscribersRetrieve } from "../funcs/subscribersRetrieve.js"; +import { subscribersUpdate } from "../funcs/subscribersUpdate.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; +import { PageIterator, unwrapResultIterator } from "../types/operations.js"; +import { Authentication } from "./authentication.js"; +import { Credentials } from "./credentials.js"; +import { NovuMessages } from "./novumessages.js"; +import { NovuNotifications } from "./novunotifications.js"; +import { Preferences } from "./preferences.js"; +import { Properties } from "./properties.js"; + +export class Subscribers extends ClientSDK { + private _credentials?: Credentials; + get credentials(): Credentials { + return (this._credentials ??= new Credentials(this._options)); + } + + private _properties?: Properties; + get properties(): Properties { + return (this._properties ??= new Properties(this._options)); + } + + private _preferences?: Preferences; + get preferences(): Preferences { + return (this._preferences ??= new Preferences(this._options)); + } + + private _notifications?: NovuNotifications; + get notifications(): NovuNotifications { + return (this._notifications ??= new NovuNotifications(this._options)); + } + + private _messages?: NovuMessages; + get messages(): NovuMessages { + return (this._messages ??= new NovuMessages(this._options)); + } + + private _authentication?: Authentication; + get authentication(): Authentication { + return (this._authentication ??= new Authentication(this._options)); + } + + /** + * Get subscribers + * + * @remarks + * Returns a list of subscribers, could paginated using the `page` and `limit` query parameter + */ + async list( + page?: number | undefined, + limit?: number | undefined, + options?: RequestOptions, + ): Promise< + PageIterator + > { + return unwrapResultIterator(subscribersList( + this, + page, + limit, + options, + )); + } + + /** + * Create subscriber + * + * @remarks + * Creates a subscriber entity, in the Novu platform. The subscriber will be later used to receive notifications, and access notification feeds. Communication credentials such as email, phone number, and 3 rd party credentials i.e slack tokens could be later associated to this entity. + */ + async create( + request: components.CreateSubscriberRequestDto, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersCreate( + this, + request, + options, + )); + } + + /** + * Get subscriber + * + * @remarks + * Get subscriber by your internal id used to identify the subscriber + */ + async retrieve( + subscriberId: string, + includeTopics?: string | undefined, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersRetrieve( + this, + subscriberId, + includeTopics, + options, + )); + } + + /** + * Update subscriber + * + * @remarks + * Used to update the subscriber entity with new information + */ + async update( + updateSubscriberRequestDto: components.UpdateSubscriberRequestDto, + subscriberId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersUpdate( + this, + updateSubscriberRequestDto, + subscriberId, + options, + )); + } + + /** + * Delete subscriber + * + * @remarks + * Deletes a subscriber entity from the Novu platform + */ + async delete( + subscriberId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(subscribersDelete( + this, + subscriberId, + options, + )); + } + + /** + * Bulk create subscribers + * + * @remarks + * + * Using this endpoint you can create multiple subscribers at once, to avoid multiple calls to the API. + * The bulk API is limited to 500 subscribers per request. + */ + async createBulk( + request: components.BulkSubscriberCreateDto, + options?: RequestOptions, + ): Promise< + operations.SubscribersControllerBulkCreateSubscribersResponse | undefined + > { + return unwrapAsync(subscribersCreateBulk( + this, + request, + options, + )); + } +} diff --git a/src/sdk/topics.ts b/src/sdk/topics.ts new file mode 100644 index 00000000..1c6c17c3 --- /dev/null +++ b/src/sdk/topics.ts @@ -0,0 +1,108 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { topicsCreate } from "../funcs/topicsCreate.js"; +import { topicsDelete } from "../funcs/topicsDelete.js"; +import { topicsList } from "../funcs/topicsList.js"; +import { topicsRename } from "../funcs/topicsRename.js"; +import { topicsRetrieve } from "../funcs/topicsRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; +import { NovuSubscribers } from "./novusubscribers.js"; + +export class Topics extends ClientSDK { + private _subscribers?: NovuSubscribers; + get subscribers(): NovuSubscribers { + return (this._subscribers ??= new NovuSubscribers(this._options)); + } + + /** + * Topic creation + * + * @remarks + * Create a topic + */ + async create( + request: components.CreateTopicRequestDto, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsCreate( + this, + request, + options, + )); + } + + /** + * Filter topics + * + * @remarks + * Returns a list of topics that can be paginated using the `page` query parameter and filtered by the topic key with the `key` query parameter + */ + async list( + request: operations.TopicsControllerListTopicsRequest, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsList( + this, + request, + options, + )); + } + + /** + * Delete topic + * + * @remarks + * Delete a topic by its topic key if it has no subscribers + */ + async delete( + topicKey: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsDelete( + this, + topicKey, + options, + )); + } + + /** + * Get topic + * + * @remarks + * Get a topic by its topic key + */ + async retrieve( + topicKey: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsRetrieve( + this, + topicKey, + options, + )); + } + + /** + * Rename a topic + * + * @remarks + * Rename a topic by providing a new name + */ + async rename( + renameTopicRequestDto: components.RenameTopicRequestDto, + topicKey: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(topicsRename( + this, + renameTopicRequestDto, + topicKey, + options, + )); + } +} diff --git a/src/sdk/webhooks.ts b/src/sdk/webhooks.ts new file mode 100644 index 00000000..563aae20 --- /dev/null +++ b/src/sdk/webhooks.ts @@ -0,0 +1,27 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { integrationsWebhooksRetrieve } from "../funcs/integrationsWebhooksRetrieve.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class Webhooks extends ClientSDK { + /** + * Get webhook support status for provider + * + * @remarks + * Return the status of the webhook for this provider, if it is supported or if it is not based on a boolean value + */ + async retrieve( + providerOrIntegrationId: string, + options?: RequestOptions, + ): Promise { + return unwrapAsync(integrationsWebhooksRetrieve( + this, + providerOrIntegrationId, + options, + )); + } +} diff --git a/src/sdk/workflowgroups.ts b/src/sdk/workflowgroups.ts new file mode 100644 index 00000000..6bb5d9c1 --- /dev/null +++ b/src/sdk/workflowgroups.ts @@ -0,0 +1,111 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { workflowGroupsCreate } from "../funcs/workflowGroupsCreate.js"; +import { workflowGroupsDelete } from "../funcs/workflowGroupsDelete.js"; +import { workflowGroupsList } from "../funcs/workflowGroupsList.js"; +import { workflowGroupsRetrieve } from "../funcs/workflowGroupsRetrieve.js"; +import { workflowGroupsUpdate } from "../funcs/workflowGroupsUpdate.js"; +import { ClientSDK, RequestOptions } from "../lib/sdks.js"; +import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; +import { unwrapAsync } from "../types/fp.js"; + +export class WorkflowGroups extends ClientSDK { + /** + * Create workflow group + * + * @remarks + * workflow group was previously named notification group + */ + async create( + request: components.CreateNotificationGroupRequestDto, + options?: RequestOptions, + ): Promise< + operations.NotificationGroupsControllerCreateNotificationGroupResponse + > { + return unwrapAsync(workflowGroupsCreate( + this, + request, + options, + )); + } + + /** + * Get workflow groups + * + * @remarks + * workflow group was previously named notification group + */ + async list( + options?: RequestOptions, + ): Promise< + operations.NotificationGroupsControllerListNotificationGroupsResponse + > { + return unwrapAsync(workflowGroupsList( + this, + options, + )); + } + + /** + * Get workflow group + * + * @remarks + * workflow group was previously named notification group + */ + async retrieve( + id: string, + options?: RequestOptions, + ): Promise< + operations.NotificationGroupsControllerGetNotificationGroupResponse + > { + return unwrapAsync(workflowGroupsRetrieve( + this, + id, + options, + )); + } + + /** + * Update workflow group + * + * @remarks + * workflow group was previously named notification group + */ + async update( + createNotificationGroupRequestDto: + components.CreateNotificationGroupRequestDto, + id: string, + options?: RequestOptions, + ): Promise< + operations.NotificationGroupsControllerUpdateNotificationGroupResponse + > { + return unwrapAsync(workflowGroupsUpdate( + this, + createNotificationGroupRequestDto, + id, + options, + )); + } + + /** + * Delete workflow group + * + * @remarks + * workflow group was previously named notification group + */ + async delete( + id: string, + options?: RequestOptions, + ): Promise< + operations.NotificationGroupsControllerDeleteNotificationGroupResponse + > { + return unwrapAsync(workflowGroupsDelete( + this, + id, + options, + )); + } +} diff --git a/src/types/blobs.ts b/src/types/blobs.ts new file mode 100644 index 00000000..4ce84602 --- /dev/null +++ b/src/types/blobs.ts @@ -0,0 +1,31 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export const blobLikeSchema: z.ZodType = + z.custom(isBlobLike, { + message: "expected a Blob, File or Blob-like object", + fatal: true, + }); + +export function isBlobLike(val: unknown): val is Blob { + if (val instanceof Blob) { + return true; + } + + if (typeof val !== "object" || val == null || !(Symbol.toStringTag in val)) { + return false; + } + + const name = val[Symbol.toStringTag]; + if (typeof name !== "string") { + return false; + } + if (name !== "Blob" && name !== "File") { + return false; + } + + return "stream" in val && typeof val.stream === "function"; +} diff --git a/src/types/constdatetime.ts b/src/types/constdatetime.ts new file mode 100644 index 00000000..c0a4409c --- /dev/null +++ b/src/types/constdatetime.ts @@ -0,0 +1,15 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import * as z from "zod"; + +export function constDateTime( + val: string, +): z.ZodType { + return z.custom((v) => { + return ( + typeof v === "string" && new Date(v).getTime() === new Date(val).getTime() + ); + }, `Value must be equivelant to ${val}`); +} diff --git a/src/types/enums.ts b/src/types/enums.ts new file mode 100644 index 00000000..6fb6d910 --- /dev/null +++ b/src/types/enums.ts @@ -0,0 +1,16 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +declare const __brand: unique symbol; +export type Unrecognized = T & { [__brand]: "unrecognized" }; + +export function catchUnrecognizedEnum(value: T): Unrecognized { + return value as Unrecognized; +} + +type Prettify = { [K in keyof T]: T[K] } & {}; +export type ClosedEnum = T[keyof T]; +export type OpenEnum = + | Prettify + | Unrecognized; diff --git a/src/types/fp.ts b/src/types/fp.ts new file mode 100644 index 00000000..ccbe51ea --- /dev/null +++ b/src/types/fp.ts @@ -0,0 +1,50 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +/** + * A monad that captures the result of a function call or an error if it was not + * successful. Railway programming, enabled by this type, can be a nicer + * alternative to traditional exception throwing because it allows functions to + * declare all _known_ errors with static types and then check for them + * exhaustively in application code. Thrown exception have a type of `unknown` + * and break out of regular control flow of programs making them harder to + * inspect and more verbose work with due to try-catch blocks. + */ +export type Result = + | { ok: true; value: T; error?: never } + | { ok: false; value?: never; error: E }; + +export function OK(value: V): Result { + return { ok: true, value }; +} + +export function ERR(error: E): Result { + return { ok: false, error }; +} + +/** + * unwrap is a convenience function for extracting a value from a result or + * throwing if there was an error. + */ +export function unwrap(r: Result): T { + if (!r.ok) { + throw r.error; + } + return r.value; +} + +/** + * unwrapAsync is a convenience function for resolving a value from a Promise + * of a result or rejecting if an error occurred. + */ +export async function unwrapAsync( + pr: Promise>, +): Promise { + const r = await pr; + if (!r.ok) { + throw r.error; + } + + return r.value; +} diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 00000000..e124e817 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,11 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export { blobLikeSchema, isBlobLike } from "./blobs.js"; +export { catchUnrecognizedEnum } from "./enums.js"; +export type { ClosedEnum, OpenEnum, Unrecognized } from "./enums.js"; +export type { Result } from "./fp.js"; +export type { PageIterator, Paginator } from "./operations.js"; +export { createPageIterator } from "./operations.js"; +export { RFCDate } from "./rfcdate.js"; diff --git a/src/types/operations.ts b/src/types/operations.ts new file mode 100644 index 00000000..0952f6f4 --- /dev/null +++ b/src/types/operations.ts @@ -0,0 +1,99 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +import { Result } from "./fp.js"; + +export type Paginator = () => Promise }> | null; + +export type PageIterator = V & { + next: Paginator; + [Symbol.asyncIterator]: () => AsyncIterableIterator; +}; + +export function createPageIterator( + page: V & { next: Paginator }, + halt: (v: V) => boolean, +): { + [Symbol.asyncIterator]: () => AsyncIterableIterator; +} { + return { + [Symbol.asyncIterator]: async function* paginator() { + yield page; + if (halt(page)) { + return; + } + + let p: typeof page | null = page; + for (p = await p.next(); p != null; p = await p.next()) { + yield p; + if (halt(p)) { + return; + } + } + }, + }; +} + +/** + * This utility create a special iterator that yields a single value and + * terminates. It is useful in paginated SDK functions that have early return + * paths when things go wrong. + */ +export function haltIterator(v: V): PageIterator { + return { + ...v, + next: () => null, + [Symbol.asyncIterator]: async function* paginator() { + yield v; + }, + }; +} + +/** + * Converts an async iterator of `Result` into an async iterator of `V`. + * When error results occur, the underlying error value is thrown. + */ +export async function unwrapResultIterator( + iteratorPromise: Promise>>, +): Promise> { + const resultIter = await iteratorPromise; + + if (!resultIter.ok) { + throw resultIter.error; + } + + return { + ...resultIter.value, + next: unwrapPaginator(resultIter.next), + [Symbol.asyncIterator]: async function* paginator() { + for await (const page of resultIter) { + if (!page.ok) { + throw page.error; + } + yield page.value; + } + }, + }; +} + +function unwrapPaginator( + paginator: Paginator>, +): Paginator { + return () => { + const nextResult = paginator(); + if (nextResult == null) { + return null; + } + return nextResult.then((res) => { + if (!res.ok) { + throw res.error; + } + const out = { + ...res.value, + next: unwrapPaginator(res.next), + }; + return out; + }); + }; +} diff --git a/src/types/rfcdate.ts b/src/types/rfcdate.ts new file mode 100644 index 00000000..c79b3f53 --- /dev/null +++ b/src/types/rfcdate.ts @@ -0,0 +1,54 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +const dateRE = /^\d{4}-\d{2}-\d{2}$/; + +export class RFCDate { + private serialized: string; + + /** + * Creates a new RFCDate instance using today's date. + */ + static today(): RFCDate { + return new RFCDate(new Date()); + } + + /** + * Creates a new RFCDate instance using the provided input. + * If a string is used then in must be in the format YYYY-MM-DD. + * + * @param date A Date object or a date string in YYYY-MM-DD format + * @example + * new RFCDate("2022-01-01") + * @example + * new RFCDate(new Date()) + */ + constructor(date: Date | string) { + if (typeof date === "string" && !dateRE.test(date)) { + throw new RangeError( + "RFCDate: date strings must be in the format YYYY-MM-DD: " + date, + ); + } + + const value = new Date(date); + if (isNaN(+value)) { + throw new RangeError("RFCDate: invalid date provided: " + date); + } + + this.serialized = value.toISOString().slice(0, "YYYY-MM-DD".length); + if (!dateRE.test(this.serialized)) { + throw new TypeError( + `RFCDate: failed to build valid date with given value: ${date} serialized to ${this.serialized}`, + ); + } + } + + toJSON(): string { + return this.toString(); + } + + toString(): string { + return this.serialized; + } +} diff --git a/src/types/streams.ts b/src/types/streams.ts new file mode 100644 index 00000000..a0163e7a --- /dev/null +++ b/src/types/streams.ts @@ -0,0 +1,21 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export function isReadableStream( + val: unknown, +): val is ReadableStream { + if (typeof val !== "object" || val === null) { + return false; + } + + // Check for the presence of methods specific to ReadableStream + const stream = val as ReadableStream; + + // ReadableStream has methods like getReader, cancel, and tee + return ( + typeof stream.getReader === "function" && + typeof stream.cancel === "function" && + typeof stream.tee === "function" + ); +}