Skip to main content

Class: ThemesService

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:235

Extends​

  • BaseService

Constructors​

Constructor​

new ThemesService(client): ThemesService

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:12

Parameters​

client​

TanqoryClient

Returns​

ThemesService

Inherited from​

BaseService.constructor

Properties​

client​

protected client: TanqoryClient

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:10

Inherited from​

BaseService.client

Methods​

activate()​

activate(storeId, themeId): Promise<ActivateThemeResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:323

Activate a theme (make it live) Endpoint: PUT /stores/:storeId/themes/:themeId/activate (unified themes module)

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<ActivateThemeResponse>


addTemplate()​

addTemplate(storeId, themeId, data): Promise<AddTemplateResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:798

Add a new custom template/page to a theme

Parameters​

storeId​

string

themeId​

string

data​

AddTemplateInput

Returns​

Promise<AddTemplateResponse>


buildQuery()​

protected buildQuery(options?): Record<string, any>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:26

Build query parameters

Parameters​

options?​

ListOptions

Returns​

Record<string, any>

Inherited from​

BaseService.buildQuery


createPreviewToken()​

createPreviewToken(storeId, themeId, options?): Promise<{ expiresAt: string; id: string; previewUrl: string; token: string; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:427

Create a preview token for testing unpublished theme changes on live storefront

Parameters​

storeId​

string

themeId​

string

options?​
expiresInHours?​

number

Returns​

Promise<{ expiresAt: string; id: string; previewUrl: string; token: string; }>


deactivate()​

deactivate(storeId, themeId): Promise<StoreThemeResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:333

Deactivate a theme

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<StoreThemeResponse>


delete()​

delete(storeId, themeId): Promise<void>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:373

Uninstall a theme from store

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<void>


deleteFile()​

deleteFile(storeId, themeId, filePath): Promise<{ message?: string; success: boolean; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:567

Delete a file

Parameters​

storeId​

string

themeId​

string

filePath​

string

Returns​

Promise<{ message?: string; success: boolean; }>


deleteTemplate()​

deleteTemplate(storeId, themeId, templateId): Promise<{ message?: string; success: boolean; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:829

Delete a custom template (system templates cannot be deleted)

Parameters​

storeId​

string

themeId​

string

templateId​

string

Returns​

Promise<{ message?: string; success: boolean; }>


download()​

download(storeId, themeId): Promise<Response>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:504

Download theme as a file Returns raw file response for browser download

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<Response>


duplicate()​

duplicate(storeId, themeId): Promise<StoreThemeResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:493

Duplicate theme (create a copy)

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<StoreThemeResponse>


generateIdempotencyKey()​

protected generateIdempotencyKey(prefix): string

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:19

Generate idempotency key

Parameters​

prefix​

string

Returns​

string

Inherited from​

BaseService.generateIdempotencyKey


getAsset()​

getAsset(themeFolderName, assetPath): Promise<string>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:593

Get theme asset (CSS, JS, images) Uses Assets CDN endpoint: GET /:themeFolderName/*path

Dedicated CDN service for theme assets, served from the Tanqory CDN

Parameters​

themeFolderName​

string

Theme folder name (e.g., 'tanqory-starter-theme')

assetPath​

string

Path within theme (e.g., 'assets/css/styles.css')

Returns​

Promise<string>

Asset content as string


getAssetURL()​

getAssetURL(themeFolderName, assetPath): string

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:644

Get asset URL for embedding in HTML Returns the full CDN URL for use in templates

Parameters​

themeFolderName​

string

Theme folder name

assetPath​

string

Path within theme

Returns​

string

Full CDN URL


getCssAssetList()​

getCssAssetList(themeSlug): Promise<CssAssetListResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:764

Get list of CSS asset files for a theme Used by Theme Builder to load theme styles

Parameters​

themeSlug​

string

Returns​

Promise<CssAssetListResponse>


getExportMimeType()​

protected getExportMimeType(format): string

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/base.ts:45

Get MIME type for export format

Parameters​

format​

string

Returns​

string

Inherited from​

BaseService.getExportMimeType


getFile()​

getFile(storeId, themeId, filePath): Promise<ThemeFile>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:541

Get file content by path

Parameters​

storeId​

string

themeId​

string

filePath​

string

Returns​

Promise<ThemeFile>


getFileTree()​

getFileTree(storeId, themeId): Promise<ThemeFileTree>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:534

Get theme file tree structure Used by Theme Code Editor to show file explorer

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<ThemeFileTree>


getParsedTemplate()​

getParsedTemplate(themeSlug, templateId): Promise<ParsedTemplateResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:690

Get parsed template with default sections Used by Theme Builder to load template structure

Parameters​

themeSlug​

string

templateId​

string

Returns​

Promise<ParsedTemplateResponse>


getPreviewUrl()​

getPreviewUrl(storeId, themeId): Promise<{ url: string; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:483

Get theme preview URL

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<{ url: string; }>

Deprecated​

Use createPreviewToken() instead for secure preview URLs


getRenderedSection()​

getRenderedSection(themeSlug, sectionId, options?): Promise<RenderedSectionResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:705

Get rendered section content Used by Theme Builder to preview sections

NOTE: Caching is disabled for this endpoint because the same path with different settings should return different rendered HTML. The query parameters (including settings) are not included in cache key.

Parameters​

themeSlug​

string

sectionId​

string

options?​

GetRenderedSectionOptions

Returns​

Promise<RenderedSectionResponse>


getRevision()​

getRevision(storeId, themeId, revisionId): Promise<StoreThemeRevision>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:394

Get specific revision

Parameters​

storeId​

string

themeId​

string

revisionId​

string

Returns​

Promise<StoreThemeRevision>


getSectionTanq()​

getSectionTanq(themeFolderName, sectionId): Promise<string>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:610

Get section .tanq file content Uses Assets CDN endpoint: GET /:themeFolderName/sections/:sectionId

Parameters​

themeFolderName​

string

Theme folder name

sectionId​

string

Section ID (without .tanq extension)

Returns​

Promise<string>

Section .tanq content


getSnippetTanq()​

getSnippetTanq(themeFolderName, snippetId): Promise<string>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:627

Get snippet .tanq file content Uses Assets CDN endpoint: GET /:themeFolderName/snippets/:snippetId

Parameters​

themeFolderName​

string

Theme folder name

snippetId​

string

Snippet ID (without .tanq extension)

Returns​

Promise<string>

Snippet .tanq content


getStoreCssAssetList()​

getStoreCssAssetList(storeId, storeThemeId): Promise<StoreCssAssetListResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:771

Get list of CSS assets for an installed store theme (with CDN URLs)

Parameters​

storeId​

string

storeThemeId​

string

Returns​

Promise<StoreCssAssetListResponse>


getStoreTheme()​

getStoreTheme(storeId, themeId): Promise<StoreThemeDetailResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:288

Get store theme details

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<StoreThemeDetailResponse>


getStoreThemeEditorData()​

getStoreThemeEditorData(storeId, themeId): Promise<StoreThemeEditorDataResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:300

Get store theme data for Editor from NORMALIZED TABLES This is the NEW preferred method - returns templates, sectionSchemas, etc. from normalized tables instead of JSON columns

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<StoreThemeEditorDataResponse>


install()​

install(storeId, data): Promise<InstallThemeResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:313

Install a theme to store

Parameters​

storeId​

string

data​

InstallThemeInput

Returns​

Promise<InstallThemeResponse>


list()​

list(query?): Promise<PaginatedMarketplaceThemesResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:244

List themes from marketplace Endpoint: GET /themes (unified themes module)

Parameters​

query?​

ListMarketplaceThemesQuery

Returns​

Promise<PaginatedMarketplaceThemesResponse>


listAvailableThemes()​

listAvailableThemes(): Promise<{ themes: string[]; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:653

List all available themes Uses Assets CDN endpoint: GET /themes

Returns​

Promise<{ themes: string[]; }>


listPreviewTokens()​

listPreviewTokens(storeId, themeId): Promise<object[]>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:448

List all preview tokens for a theme

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<object[]>


listRevisions()​

listRevisions(storeId, themeId): Promise<StoreThemeRevision[]>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:384

List theme revisions

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<StoreThemeRevision[]>


listStoreThemes()​

listStoreThemes(storeId, query?, options?): Promise<StoreThemeResponse[]>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:274

List themes installed in a store

Parameters​

storeId​

string

query?​

ListStoreThemesQuery

options?​
useCache?​

boolean

Set to false to bypass cache (useful after mutations)

Returns​

Promise<StoreThemeResponse[]>


listTemplates()​

listTemplates(storeId, themeId): Promise<ListTemplatesResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:788

List all templates in a theme

Parameters​

storeId​

string

themeId​

string

Returns​

Promise<ListTemplatesResponse>


listThemeAssets()​

listThemeAssets(themeFolderName, subPath?): Promise<{ files: string[]; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:669

List assets in a theme directory Uses Assets CDN endpoint: GET /:themeFolderName/list

Parameters​

themeFolderName​

string

Theme folder name

subPath?​

string

Optional subdirectory (e.g., 'sections', 'assets/css')

Returns​

Promise<{ files: string[]; }>


publish()​

publish(storeId, themeId, data): Promise<PublishThemeResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:358

Publish theme (create revision and make live)

Parameters​

storeId​

string

themeId​

string

data​

PublishThemeInput

Returns​

Promise<PublishThemeResponse>


rename()​

rename(storeId, themeId, name): Promise<StoreThemeResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:518

Rename a theme (update displayName)

Parameters​

storeId​

string

themeId​

string

name​

string

Returns​

Promise<StoreThemeResponse>


renameTemplate()​

renameTemplate(storeId, themeId, templateId, displayName): Promise<{ message?: string; success: boolean; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:813

Rename a template (update displayName)

Parameters​

storeId​

string

themeId​

string

templateId​

string

displayName​

string

Returns​

Promise<{ message?: string; success: boolean; }>


restoreRevision()​

restoreRevision(storeId, themeId, data): Promise<RestoreRevisionResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:408

Restore a previous revision

Parameters​

storeId​

string

themeId​

string

data​

RestoreRevisionInput

Returns​

Promise<RestoreRevisionResponse>


retrieve()​

retrieve(id): Promise<MarketplaceThemeDetailResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:254

Get theme details from marketplace Endpoint: GET /themes/:id (unified themes module)

Parameters​

id​

string

Returns​

Promise<MarketplaceThemeDetailResponse>


revokePreviewToken()​

revokePreviewToken(storeId, themeId, tokenId): Promise<{ message: string; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:468

Revoke (delete) a preview token

Parameters​

storeId​

string

themeId​

string

tokenId​

string

Returns​

Promise<{ message: string; }>


sync()​

sync(): Promise<SyncThemesResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:262

Sync themes from directory (Admin only) Endpoint: POST /themes/sync (unified themes module)

Returns​

Promise<SyncThemesResponse>


updateFile()​

updateFile(storeId, themeId, filePath, content): Promise<{ message?: string; success: boolean; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:551

Update/create file content

Parameters​

storeId​

string

themeId​

string

filePath​

string

content​

string

Returns​

Promise<{ message?: string; success: boolean; }>


updateSettings()​

updateSettings(storeId, themeId, data): Promise<StoreThemeResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/themes.ts:343

Update theme settings (templates and global settings)

Parameters​

storeId​

string

themeId​

string

data​

UpdateThemeSettingsInput

Returns​

Promise<StoreThemeResponse>