/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { cancel } from "../funcs/cancel.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 { Activity } from "./activity.js"; import { ChannelConnections } from "./channelconnections.js"; import { ChannelEndpoints } from "./channelendpoints.js"; import { Contexts } from "./contexts.js"; import { Domains } from "./domains.js"; import { Environments } from "./environments.js"; import { EnvironmentVariables } from "./environmentvariables.js"; import { Integrations } from "./integrations.js"; import { Layouts } from "./layouts.js"; import { Messages } from "./messages.js"; import { Notifications } from "./notifications.js"; import { Subscribers } from "./subscribers.js"; import { Topics } from "./topics.js"; import { Translations } from "./translations.js"; import { Workflows } from "./workflows.js"; export class Novu extends ClientSDK { private _contexts?: Contexts; get contexts(): Contexts { return (this._contexts ??= new Contexts(this._options)); } private _environments?: Environments; get environments(): Environments { return (this._environments ??= new Environments(this._options)); } private _activity?: Activity; get activity(): Activity { return (this._activity ??= new Activity(this._options)); } private _layouts?: Layouts; get layouts(): Layouts { return (this._layouts ??= new Layouts(this._options)); } private _subscribers?: Subscribers; get subscribers(): Subscribers { return (this._subscribers ??= new Subscribers(this._options)); } private _topics?: Topics; get topics(): Topics { return (this._topics ??= new Topics(this._options)); } private _translations?: Translations; get translations(): Translations { return (this._translations ??= new Translations(this._options)); } private _workflows?: Workflows; get workflows(): Workflows { return (this._workflows ??= new Workflows(this._options)); } private _channelConnections?: ChannelConnections; get channelConnections(): ChannelConnections { return (this._channelConnections ??= new ChannelConnections(this._options)); } private _channelEndpoints?: ChannelEndpoints; get channelEndpoints(): ChannelEndpoints { return (this._channelEndpoints ??= new ChannelEndpoints(this._options)); } private _domains?: Domains; get domains(): Domains { return (this._domains ??= new Domains(this._options)); } private _environmentVariables?: EnvironmentVariables; get environmentVariables(): EnvironmentVariables { return (this._environmentVariables ??= new EnvironmentVariables( this._options, )); } private _integrations?: Integrations; get integrations(): Integrations { return (this._integrations ??= new Integrations(this._options)); } private _messages?: Messages; get messages(): Messages { return (this._messages ??= new Messages(this._options)); } private _notifications?: Notifications; get notifications(): Notifications { return (this._notifications ??= new Notifications(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. Maximum number of recipients can be 100. Additional information can be passed according the body interface below. * To prevent duplicate triggers, you can optionally pass a **transactionId** in the request body. If the same **transactionId** is used again, the trigger will be ignored. The retention period depends on your billing tier. */ async trigger( triggerEventRequestDto: components.TriggerEventRequestDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(trigger( this, triggerEventRequestDto, idempotencyKey, 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 cancel( transactionId: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(cancel( this, transactionId, idempotencyKey, 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( triggerEventToAllRequestDto: components.TriggerEventToAllRequestDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(triggerBroadcast( this, triggerEventToAllRequestDto, idempotencyKey, 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( bulkTriggerEventDto: components.BulkTriggerEventDto, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(triggerBulk( this, bulkTriggerEventDto, idempotencyKey, options, )); } }