/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { topicsCreate } from "../funcs/topicsCreate.js"; import { topicsDelete } from "../funcs/topicsDelete.js"; import { topicsGet } from "../funcs/topicsGet.js"; import { topicsList } from "../funcs/topicsList.js"; import { topicsUpdate } from "../funcs/topicsUpdate.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"; import { Subscriptions } from "./subscriptions.js"; export class Topics extends ClientSDK { private _subscriptions?: Subscriptions; get subscriptions(): Subscriptions { return (this._subscriptions ??= new Subscriptions(this._options)); } private _subscribers?: NovuSubscribers; get subscribers(): NovuSubscribers { return (this._subscribers ??= new NovuSubscribers(this._options)); } /** * List all topics * * @remarks * This api returns a paginated list of topics. * Topics can be filtered by **key**, **name**, or **includeCursor** to paginate through the list. * Checkout all available filters in the query section. */ async list( request: operations.TopicsControllerListTopicsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(topicsList( this, request, options, )); } /** * Create a topic * * @remarks * Creates a new topic if it does not exist, or updates an existing topic if it already exists. Use ?failIfExists=true to prevent updates. */ async create( createUpdateTopicRequestDto: components.CreateUpdateTopicRequestDto, failIfExists?: boolean | undefined, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(topicsCreate( this, createUpdateTopicRequestDto, failIfExists, idempotencyKey, options, )); } /** * Retrieve a topic * * @remarks * Retrieve a topic by its unique key identifier **topicKey** */ async get( topicKey: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(topicsGet( this, topicKey, idempotencyKey, options, )); } /** * Update a topic * * @remarks * Update a topic name by its unique key identifier **topicKey** */ async update( updateTopicRequestDto: components.UpdateTopicRequestDto, topicKey: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(topicsUpdate( this, updateTopicRequestDto, topicKey, idempotencyKey, options, )); } /** * Delete a topic * * @remarks * Delete a topic by its unique key identifier **topicKey**. * This action is irreversible and will remove all subscriptions to the topic. */ async delete( topicKey: string, idempotencyKey?: string | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(topicsDelete( this, topicKey, idempotencyKey, options, )); } }