// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import { APIPromise } from '../core/api-promise'; import { buildHeaders } from '../internal/headers'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; export class Templates extends APIResource { /** * Create a new template */ create(body: TemplateCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/templates', { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Get a specific template */ retrieve(id: number, options?: RequestOptions): APIPromise { return this._client.get(path`/templates/${id}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Update a template */ update(id: number, body: TemplateUpdateParams, options?: RequestOptions): APIPromise { return this._client.put(path`/templates/${id}`, { body, ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } /** * Get all templates */ list(options?: RequestOptions): APIPromise { return this._client.get('/templates', options); } /** * Delete a template */ delete(id: number, options?: RequestOptions): APIPromise { return this._client.delete(path`/templates/${id}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } export interface TemplateInput { body: string; name: string; is_default?: boolean; type?: 'campaign' | 'tx'; } export interface TemplateListResponse { data?: Array; } export namespace TemplateListResponse { export interface Data { id?: number; body?: string; created_at?: string; is_default?: boolean; name?: string; type?: 'campaign' | 'tx'; updated_at?: string; } } export interface TemplateCreateParams { body: string; name: string; is_default?: boolean; type?: 'campaign' | 'tx'; } export interface TemplateUpdateParams { body: string; name: string; is_default?: boolean; type?: 'campaign' | 'tx'; } export declare namespace Templates { export { type TemplateInput as TemplateInput, type TemplateListResponse as TemplateListResponse, type TemplateCreateParams as TemplateCreateParams, type TemplateUpdateParams as TemplateUpdateParams, }; }