/** * Klaviyo API * The Klaviyo REST API. Please visit https://developers.klaviyo.com for more details. * * Contact: developers@klaviyo.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import { AxiosResponse } from "axios"; import { GetTemplateResponse } from '../model/getTemplateResponse'; import { GetTemplateResponseCollection } from '../model/getTemplateResponseCollection'; import { GetUniversalContentResponse } from '../model/getUniversalContentResponse'; import { GetUniversalContentResponseCollection } from '../model/getUniversalContentResponseCollection'; import { PatchTemplateResponse } from '../model/patchTemplateResponse'; import { PatchUniversalContentResponse } from '../model/patchUniversalContentResponse'; import { PostTemplateResponse } from '../model/postTemplateResponse'; import { PostUniversalContentResponse } from '../model/postUniversalContentResponse'; import { TemplateCloneQuery } from '../model/templateCloneQuery'; import { TemplateCreateQuery } from '../model/templateCreateQuery'; import { TemplateRenderQuery } from '../model/templateRenderQuery'; import { TemplateUpdateQuery } from '../model/templateUpdateQuery'; import { UniversalContentCreateQuery } from '../model/universalContentCreateQuery'; import { UniversalContentPartialUpdateQuery } from '../model/universalContentPartialUpdateQuery'; import { Session } from './apis'; export declare class TemplatesApi { session: Session; protected _basePath: string; protected _defaultHeaders: any; protected _useQuerystring: boolean; constructor(session: Session); set useQuerystring(value: boolean); set basePath(basePath: string); set defaultHeaders(defaultHeaders: any); get defaultHeaders(): any; get basePath(): string; /** * Create a clone of a template with the given template ID. If there are 1,000 or more templates in an account, cloning will fail as there is a limit of 1,000 templates that can be created via the API.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:write` * @summary Clone Template * @param templateCloneQuery */ cloneTemplate(templateCloneQuery: TemplateCloneQuery): Promise<{ response: AxiosResponse; body: PostTemplateResponse; }>; /** * Create a new custom HTML template. If there are 1,000 or more templates in an account, creation will fail as there is a limit of 1,000 templates that can be created via the API. Request specific fields using [sparse fieldsets](https://developers.klaviyo.com/en/reference/api_overview#sparse-fieldsets).

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:write` * @summary Create Template * @param templateCreateQuery */ createTemplate(templateCreateQuery: TemplateCreateQuery): Promise<{ response: AxiosResponse; body: PostTemplateResponse; }>; /** * Create universal content. Only text blocks, which can include text or HTML, are supported at this time.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:write` * @summary Create Universal Content * @param universalContentCreateQuery Create a template universal content */ createUniversalContent(universalContentCreateQuery: UniversalContentCreateQuery): Promise<{ response: AxiosResponse; body: PostUniversalContentResponse; }>; /** * Delete a template with the given template ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:write` * @summary Delete Template * @param id The ID of template */ deleteTemplate(id: string): Promise<{ response: AxiosResponse; body?: any; }>; /** * Delete the universal content with the given ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:write` * @summary Delete Universal Content * @param id The ID of the template universal content */ deleteUniversalContent(id: string): Promise<{ response: AxiosResponse; body?: any; }>; /** * Get all universal content in an account.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:read` * @summary Get All Universal Content * @param fieldsTemplateUniversalContent For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#sparse-fieldsets* @param filter For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`id`: `any`, `equals`<br>`name`: `any`, `equals`<br>`created`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`updated`: `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`definition.content_type`: `equals`<br>`definition.type`: `equals`* @param pageCursor For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#pagination* @param pageSize Default: 20. Min: 1. Max: 100.* @param sort For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#sorting */ getAllUniversalContent(options?: { fieldsTemplateUniversalContent?: Array<'name' | 'definition' | 'definition.content_type' | 'definition.type' | 'definition.data' | 'definition.data.content' | 'definition.data.display_options' | 'definition.data.display_options.show_on' | 'definition.data.display_options.visible_check' | 'definition.data.display_options.content_repeat' | 'definition.data.display_options.content_repeat.repeat_for' | 'definition.data.display_options.content_repeat.item_alias' | 'definition.data.styles' | 'definition.data.styles.background_color' | 'definition.data.styles.block_background_color' | 'definition.data.styles.block_border_color' | 'definition.data.styles.block_border_style' | 'definition.data.styles.block_border_width' | 'definition.data.styles.block_padding_bottom' | 'definition.data.styles.block_padding_left' | 'definition.data.styles.block_padding_right' | 'definition.data.styles.block_padding_top' | 'definition.data.styles.color' | 'definition.data.styles.extra_css_class' | 'definition.data.styles.font_family' | 'definition.data.styles.font_size' | 'definition.data.styles.font_style' | 'definition.data.styles.font_weight' | 'definition.data.styles.inner_padding_bottom' | 'definition.data.styles.inner_padding_left' | 'definition.data.styles.inner_padding_right' | 'definition.data.styles.inner_padding_top' | 'definition.data.styles.letter_spacing' | 'definition.data.styles.line_height' | 'definition.data.styles.mobile_stretch_content' | 'definition.data.styles.text_align' | 'definition.data.styles.text_decoration' | 'definition.data.styles.text_table_layout' | 'created' | 'updated' | 'screenshot_status' | 'screenshot_url'>; filter?: string; pageCursor?: string; pageSize?: number; sort?: 'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'updated' | '-updated'; }): Promise<{ response: AxiosResponse; body: GetUniversalContentResponseCollection; }>; /** * Get a template with the given template ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:read` * @summary Get Template * @param id The ID of template * @param fieldsTemplate For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#sparse-fieldsets */ getTemplate(id: string, options?: { fieldsTemplate?: Array<'name' | 'editor_type' | 'html' | 'text' | 'amp' | 'created' | 'updated'>; }): Promise<{ response: AxiosResponse; body: GetTemplateResponse; }>; /** * Get all templates in an account. Filter to request a subset of all templates. Templates can be sorted by the following fields, in ascending and descending order: `id`, `name`, `created`, `updated` Returns a maximum of 10 results per page.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:read` * @summary Get Templates * @param fieldsTemplate For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#sparse-fieldsets* @param filter For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#filtering<br>Allowed field(s)/operator(s):<br>`id`: `any`, `equals`<br>`name`: `any`, `equals`<br>`created`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`<br>`updated`: `equals`, `greater-or-equal`, `greater-than`, `less-or-equal`, `less-than`* @param pageCursor For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#pagination* @param sort For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#sorting */ getTemplates(options?: { fieldsTemplate?: Array<'name' | 'editor_type' | 'html' | 'text' | 'amp' | 'created' | 'updated'>; filter?: string; pageCursor?: string; sort?: 'created' | '-created' | 'id' | '-id' | 'name' | '-name' | 'updated' | '-updated'; }): Promise<{ response: AxiosResponse; body: GetTemplateResponseCollection; }>; /** * Get the universal content with the given ID.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:read` * @summary Get Universal Content * @param id The ID of the universal content * @param fieldsTemplateUniversalContent For more information please visit https://developers.klaviyo.com/en/v2025-04-15/reference/api-overview#sparse-fieldsets */ getUniversalContent(id: string, options?: { fieldsTemplateUniversalContent?: Array<'name' | 'definition' | 'definition.content_type' | 'definition.type' | 'definition.data' | 'definition.data.content' | 'definition.data.display_options' | 'definition.data.display_options.show_on' | 'definition.data.display_options.visible_check' | 'definition.data.display_options.content_repeat' | 'definition.data.display_options.content_repeat.repeat_for' | 'definition.data.display_options.content_repeat.item_alias' | 'definition.data.styles' | 'definition.data.styles.background_color' | 'definition.data.styles.block_background_color' | 'definition.data.styles.block_border_color' | 'definition.data.styles.block_border_style' | 'definition.data.styles.block_border_width' | 'definition.data.styles.block_padding_bottom' | 'definition.data.styles.block_padding_left' | 'definition.data.styles.block_padding_right' | 'definition.data.styles.block_padding_top' | 'definition.data.styles.color' | 'definition.data.styles.extra_css_class' | 'definition.data.styles.font_family' | 'definition.data.styles.font_size' | 'definition.data.styles.font_style' | 'definition.data.styles.font_weight' | 'definition.data.styles.inner_padding_bottom' | 'definition.data.styles.inner_padding_left' | 'definition.data.styles.inner_padding_right' | 'definition.data.styles.inner_padding_top' | 'definition.data.styles.letter_spacing' | 'definition.data.styles.line_height' | 'definition.data.styles.mobile_stretch_content' | 'definition.data.styles.text_align' | 'definition.data.styles.text_decoration' | 'definition.data.styles.text_table_layout' | 'created' | 'updated' | 'screenshot_status' | 'screenshot_url'>; }): Promise<{ response: AxiosResponse; body: GetUniversalContentResponse; }>; /** * Render a template with the given template ID and context attribute. Returns the AMP, HTML, and plain text versions of the email template. **Request body parameters** (nested under `attributes`): * `return_fields`: Request specific fields using [sparse fieldsets](https://developers.klaviyo.com/en/reference/api_overview#sparse-fieldsets). * `context`: This is the context your email template will be rendered with. You must pass in a `context` object as a JSON object. Email templates are rendered with contexts in a similar manner to Django templates. Nested template variables can be referenced via dot notation. Template variables without corresponding `context` values are treated as `FALSE` and output nothing. Ex. `{ \"name\" : \"George Washington\", \"state\" : \"VA\" }`

*Rate limits*:
Burst: `3/s`
Steady: `60/m` **Scopes:** `templates:read` * @summary Render Template * @param templateRenderQuery */ renderTemplate(templateRenderQuery: TemplateRenderQuery): Promise<{ response: AxiosResponse; body: PostTemplateResponse; }>; /** * Update a template with the given template ID. Does not currently update drag & drop templates.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:write` * @summary Update Template * @param id The ID of template* @param templateUpdateQuery */ updateTemplate(id: string, templateUpdateQuery: TemplateUpdateQuery): Promise<{ response: AxiosResponse; body: PatchTemplateResponse; }>; /** * Update universal content. The `definition` field can only be updated for text blocks at this time.

*Rate limits*:
Burst: `10/s`
Steady: `150/m` **Scopes:** `templates:write` * @summary Update Universal Content * @param id The ID of the template universal content* @param universalContentPartialUpdateQuery Update a universal content by ID */ updateUniversalContent(id: string, universalContentPartialUpdateQuery: UniversalContentPartialUpdateQuery): Promise<{ response: AxiosResponse; body: PatchUniversalContentResponse; }>; } export interface TemplatesApi { /** * Alias of {@link TemplatesApi.cloneTemplate} * * @deprecated Use {@link TemplatesApi.cloneTemplate} instead */ createTemplateClone: typeof TemplatesApi.prototype.cloneTemplate; } export interface TemplatesApi { /** * Alias of {@link TemplatesApi.createUniversalContent} * * @deprecated Use {@link TemplatesApi.createUniversalContent} instead */ createTemplateUniversalContent: typeof TemplatesApi.prototype.createUniversalContent; } export interface TemplatesApi { /** * Alias of {@link TemplatesApi.deleteUniversalContent} * * @deprecated Use {@link TemplatesApi.deleteUniversalContent} instead */ deleteTemplateUniversalContent: typeof TemplatesApi.prototype.deleteUniversalContent; } export interface TemplatesApi { /** * Alias of {@link TemplatesApi.getAllUniversalContent} * * @deprecated Use {@link TemplatesApi.getAllUniversalContent} instead */ getTemplateUniversalContent: typeof TemplatesApi.prototype.getAllUniversalContent; } export interface TemplatesApi { /** * Alias of {@link TemplatesApi.renderTemplate} * * @deprecated Use {@link TemplatesApi.renderTemplate} instead */ createTemplateRender: typeof TemplatesApi.prototype.renderTemplate; } export interface TemplatesApi { /** * Alias of {@link TemplatesApi.updateUniversalContent} * * @deprecated Use {@link TemplatesApi.updateUniversalContent} instead */ updateTemplateUniversalContent: typeof TemplatesApi.prototype.updateUniversalContent; }