/** * Custom domain certificate operations for Managed Runtime. * * Certificates are organization-scoped and can be associated with environments * via the `certificate_id` field on target create/update/clone operations. * * @module operations/mrt/certificate */ import type { AuthStrategy } from '../../auth/types.js'; import type { components } from '../../clients/mrt.js'; export type MrtCertificate = components['schemas']['CertificateBase']; export type MrtCertificateListCreate = components['schemas']['CertificateListCreate']; export interface ListCertificatesOptions { organizationSlug: string; limit?: number; offset?: number; ordering?: string; search?: string; /** When true, return only customer-managed certificates. */ customOnly?: boolean; origin?: string; } export interface ListCertificatesResult { count: number; next: string | null; previous: string | null; certificates: MrtCertificateListCreate[]; } /** * Lists certificates for an organization. * * @param options - List options for filtering and pagination * @param options.organizationSlug - The organization slug to list certificates for * @param options.limit - Maximum number of results to return (optional) * @param options.offset - Number of results to skip (optional) * @param options.ordering - Field to order results by (optional) * @param options.search - Search query to filter results (optional) * @param options.customOnly - When true, return only customer-managed certificates (optional) * @param options.origin - Custom API origin (optional, defaults to DEFAULT_MRT_ORIGIN) * @param auth - Authentication strategy (ApiKeyStrategy) * @returns A paginated list result containing certificate count, pagination links, and certificate data * @throws Error if the API request fails * * @example * ```typescript * import {ApiKeyStrategy} from '@salesforce/b2c-tooling-sdk/auth'; * import {listCertificates} from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const result = await listCertificates({ * organizationSlug: 'my-org', * limit: 10, * customOnly: true, * }, auth); * * console.log(`Found ${result.count} certificates`); * ``` */ export declare function listCertificates(options: ListCertificatesOptions, auth: AuthStrategy): Promise; export interface GetCertificateOptions { organizationSlug: string; certId: number; origin?: string; } /** * Retrieves a certificate by ID. * * @param options - Options including organizationSlug and certId * @param auth - Authentication strategy * @returns The certificate details * @throws Error if the request fails */ export declare function getCertificate(options: GetCertificateOptions, auth: AuthStrategy): Promise; export interface CreateCertificateOptions { organizationSlug: string; /** * The domain for the certificate (e.g. shop.example.com). */ domainName: string; origin?: string; } /** * Creates a certificate for a domain in an organization. * * @param options - Create options with organization slug and domain name * @param auth - Authentication strategy * @returns A promise that resolves to the created certificate * @throws Error if the request fails (e.g., invalid domain, duplicate certificate) * * @example * ```typescript * import {ApiKeyStrategy} from '@salesforce/b2c-tooling-sdk/auth'; * import {createCertificate} from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const cert = await createCertificate({ * organizationSlug: 'my-org', * domainName: 'shop.example.com', * }, auth); * ``` */ export declare function createCertificate(options: CreateCertificateOptions, auth: AuthStrategy): Promise; export interface DeleteCertificateOptions { organizationSlug: string; certId: number; origin?: string; } /** * Deletes a certificate from an organization. * * @param options - Delete options including organization slug and certificate ID * @param auth - Authentication strategy (ApiKeyStrategy) * @throws {Error} If the request fails or certificate cannot be deleted */ export declare function deleteCertificate(options: DeleteCertificateOptions, auth: AuthStrategy): Promise; export interface RestartCertificateValidationOptions { organizationSlug: string; certId: number; origin?: string; } /** * Restarts validation for a certificate. Only works for certificates that have * not yet been validated. * * @param options - Configuration options * @param options.organizationSlug - The organization slug * @param options.certId - The certificate ID * @param options.origin - Optional MRT API origin URL * @param auth - Authentication strategy (ApiKeyStrategy) * @returns The restarted certificate object * @throws Error if the request fails * * @example * ```typescript * import {ApiKeyStrategy} from '@salesforce/b2c-tooling-sdk/auth'; * import {restartCertificateValidation} from '@salesforce/b2c-tooling-sdk/operations/mrt'; * * const auth = new ApiKeyStrategy(process.env.MRT_API_KEY!, 'Authorization'); * * const cert = await restartCertificateValidation({ * organizationSlug: 'my-org', * certId: 12345, * }, auth); * ``` */ export declare function restartCertificateValidation(options: RestartCertificateValidationOptions, auth: AuthStrategy): Promise;