/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { tenantsDelete } from "../funcs/tenantsDelete.js"; import { tenantsGet } from "../funcs/tenantsGet.js"; import { tenantsGetPortalUrl } from "../funcs/tenantsGetPortalUrl.js"; import { tenantsGetToken } from "../funcs/tenantsGetToken.js"; import { tenantsList } from "../funcs/tenantsList.js"; import { tenantsUpsert } from "../funcs/tenantsUpsert.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"; export class Tenants extends ClientSDK { /** * List Tenants * * @remarks * List all tenants with cursor-based pagination. * * **Requirements:** This endpoint requires Redis with RediSearch module (e.g., `redis/redis-stack-server`). * If RediSearch is not available, this endpoint returns `501 Not Implemented`. * * When authenticated with a Tenant JWT, returns only the authenticated tenant. Pagination is not used in this case. */ async list( request: operations.ListTenantsRequest, options?: RequestOptions, ): Promise> { return unwrapResultIterator(tenantsList( this, request, options, )); } /** * Create or Update Tenant * * @remarks * Idempotently creates or updates a tenant. Required before associating destinations. */ async upsert( tenantId: string, body?: components.TenantUpsert | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(tenantsUpsert( this, tenantId, body, options, )); } /** * Get Tenant * * @remarks * Retrieves details for a specific tenant. */ async get( tenantId: string, options?: RequestOptions, ): Promise { return unwrapAsync(tenantsGet( this, tenantId, options, )); } /** * Delete Tenant * * @remarks * Deletes the tenant and all associated destinations. */ async delete( tenantId: string, options?: RequestOptions, ): Promise { return unwrapAsync(tenantsDelete( this, tenantId, options, )); } /** * Get Portal Redirect URL * * @remarks * Returns a redirect URL containing a JWT to authenticate the user with the portal. Requires Admin API Key. */ async getPortalUrl( tenantId: string, theme?: operations.Theme | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(tenantsGetPortalUrl( this, tenantId, theme, options, )); } /** * Get Tenant JWT Token * * @remarks * Returns a JWT token scoped to the tenant for safe browser API calls. Requires Admin API Key. */ async getToken( tenantId: string, options?: RequestOptions, ): Promise { return unwrapAsync(tenantsGetToken( this, tenantId, options, )); } }