Skip to main content

Class: BlogsService

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:36

Extends​

  • BaseService

Constructors​

Constructor​

new BlogsService(client): BlogsService

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

Parameters​

client​

TanqoryClient

Returns​

BlogsService

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​

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


bulkDeleteArticles()​

bulkDeleteArticles(storeId, data): Promise<{ deleted: number; failed: number; success: boolean; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:180

Bulk delete multiple articles

Parameters​

storeId​

string

data​
ids​

string[]

Returns​

Promise<{ deleted: number; failed: number; success: boolean; }>


bulkDeleteBlogs()​

bulkDeleteBlogs(storeId, data): Promise<{ deleted: number; failed: number; success: boolean; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:88

Bulk delete multiple blogs

Parameters​

storeId​

string

data​
ids​

string[]

Returns​

Promise<{ deleted: number; failed: number; success: boolean; }>


bulkUpdateArticles()​

bulkUpdateArticles(storeId, data): Promise<{ failed: number; success: boolean; updated: number; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:194

Bulk update multiple articles (e.g., publish/unpublish, move to another blog)

Parameters​

storeId​

string

data​
ids​

string[]

updates​

{ blogId?: string; isPublished?: boolean; }

updates.blogId?​

string

updates.isPublished?​

boolean

Returns​

Promise<{ failed: number; success: boolean; updated: number; }>


createArticle()​

createArticle(storeId, data): Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:137

Create a new article

Parameters​

storeId​

string

data​
author?​

string

blogId​

string

content?​

string

excerpt?​

string

featuredImage?​

{ alt?: string; height?: number; url: string; width?: number; }

featuredImage.alt?​

string

featuredImage.height?​

number

featuredImage.url​

string

featuredImage.width?​

number

handle?​

string

isPublished​

boolean

metafields?​

object[]

seo?​

{ description?: string; keywords?: string[]; title?: string; }

seo.description?​

string

seo.keywords?​

string[]

seo.title?​

string

tags?​

string[]

templateSuffix?​

string

title​

string

Returns​

Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>


createBlog()​

createBlog(storeId, data): Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:67

Create a new blog

Parameters​

storeId​

string

data​
commentPolicy​

"NONE" | "MODERATED" | "AUTO_PUBLISH"

description?​

string

handle?​

string

metafields?​

object[]

seo?​

{ description?: string; keywords?: string[]; title?: string; }

seo.description?​

string

seo.keywords?​

string[]

seo.title?​

string

templateSuffix?​

string

title​

string

Returns​

Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>


createBlogArticle()​

createBlogArticle(storeId, blogId, data): Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:144

Create article in a specific blog

Parameters​

storeId​

string

blogId​

string

data​

Omit<CreateArticleInput, "blogId">

Returns​

Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>


deleteArticle()​

deleteArticle(storeId, articleId): Promise<DeletedResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:170

Delete an article

Parameters​

storeId​

string

articleId​

string

Returns​

Promise<DeletedResponse>


deleteBlog()​

deleteBlog(storeId, blogId): Promise<DeletedResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:81

Delete a blog (cascade deletes all articles)

Parameters​

storeId​

string

blogId​

string

Returns​

Promise<DeletedResponse>


duplicateArticle()​

duplicateArticle(storeId, articleId): Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:226

Duplicate an article

Parameters​

storeId​

string

articleId​

string

Returns​

Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>


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


getArticleTagSuggestions()​

getArticleTagSuggestions(storeId, search?): Promise<string[]>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:266

Get article tag suggestions for autocomplete Tags are aggregated from all articles in the store and cached server-side

Parameters​

storeId​

string

string

Returns​

Promise<string[]>


getArticleTagSuggestionsPaginated()​

getArticleTagSuggestionsPaginated(storeId, params?): Promise<{ limit: number; page: number; tags: string[]; total: number; totalPages: number; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:275

Get paginated article tag suggestions for "View all" feature

Parameters​

storeId​

string

params?​
limit?​

number

page?​

number

search?​

string

Returns​

Promise<{ limit: number; page: number; tags: string[]; total: number; totalPages: number; }>


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


listArticles()​

listArticles(storeId, params?): Promise<ListArticlesResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:106

List all articles (optionally filter by blogId)

Parameters​

storeId​

string

params?​
author?​

string

blogId?​

string

isPublished?​

unknown

limit?​

number

page?​

number

search?​

string

sortBy?​

"createdAt" | "updatedAt" | "title" | "handle" | "author" | "publishedAt"

sortOrder?​

"asc" | "desc"

tag?​

string

Returns​

Promise<ListArticlesResponse>


listBlogArticles()​

listBlogArticles(storeId, blogId, params?): Promise<ListArticlesResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:115

List articles for a specific blog

Parameters​

storeId​

string

blogId​

string

params?​

Omit<ListArticlesParams, "blogId">

Returns​

Promise<ListArticlesResponse>


listBlogs()​

listBlogs(storeId, params?): Promise<ListBlogsResponse>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:44

List all blogs with filtering and pagination

Parameters​

storeId​

string

params?​
limit?​

number

page?​

number

search?​

string

sortBy?​

"createdAt" | "updatedAt" | "title" | "handle"

sortOrder?​

"asc" | "desc"

Returns​

Promise<ListBlogsResponse>


moveArticle()​

moveArticle(storeId, articleId, newBlogId): Promise<{ failed: number; success: boolean; updated: number; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:247

Move article to another blog

Parameters​

storeId​

string

articleId​

string

newBlogId​

string

Returns​

Promise<{ failed: number; success: boolean; updated: number; }>


publishArticle()​

publishArticle(storeId, articleId): Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:212

Publish an article

Parameters​

storeId​

string

articleId​

string

Returns​

Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>


retrieveArticle()​

retrieveArticle(storeId, articleId): Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:130

Get article by ID

Parameters​

storeId​

string

articleId​

string

Returns​

Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>


retrieveBlog()​

retrieveBlog(storeId, blogId): Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:53

Get blog by ID

Parameters​

storeId​

string

blogId​

string

Returns​

Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>


retrieveBlogByHandle()​

retrieveBlogByHandle(storeId, handle): Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:60

Get blog by handle (URL slug)

Parameters​

storeId​

string

handle​

string

Returns​

Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>


unpublishArticle()​

unpublishArticle(storeId, articleId): Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:219

Unpublish an article (hide from storefront)

Parameters​

storeId​

string

articleId​

string

Returns​

Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>


updateArticle()​

updateArticle(storeId, articleId, data): Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:157

Update an existing article

Parameters​

storeId​

string

articleId​

string

data​
author?​

string

content?​

string

excerpt?​

string

featuredImage?​

{ alt?: string; height?: number; url: string; width?: number; }

featuredImage.alt?​

string

featuredImage.height?​

number

featuredImage.url​

string

featuredImage.width?​

number

handle?​

string

isPublished?​

boolean

metafields?​

object[]

seo?​

{ description?: string; keywords?: string[]; title?: string; }

seo.description?​

string

seo.keywords?​

string[]

seo.title?​

string

tags?​

string[]

templateSuffix?​

string

title?​

string

Returns​

Promise<{ author?: string; authorId?: string; blog?: { handle: string; id: string; title: string; }; blogId: string; content?: string; createdAt: Date; excerpt?: string; featuredImage?: { alt?: string; height?: number; url: string; width?: number; }; handle: string; id: string; isPublished: boolean; publishedAt?: Date; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; tags?: string[]; templateSuffix?: string; title: string; updatedAt: Date; }>


updateBlog()​

updateBlog(storeId, blogId, data): Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>

Defined in: tanqory-platform-packages/packages/api/sdk/src/services/blogs.ts:74

Update an existing blog

Parameters​

storeId​

string

blogId​

string

data​
commentPolicy?​

"NONE" | "MODERATED" | "AUTO_PUBLISH"

description?​

string

handle?​

string

metafields?​

object[]

seo?​

{ description?: string; keywords?: string[]; title?: string; }

seo.description?​

string

seo.keywords?​

string[]

seo.title?​

string

templateSuffix?​

string

title?​

string

Returns​

Promise<{ articlesCount?: number; commentPolicy: "NONE" | "MODERATED" | "AUTO_PUBLISH"; createdAt: Date; description?: string; handle: string; id: string; seo?: { description?: string; keywords?: string[]; title?: string; }; storeId: string; templateSuffix?: string; title: string; updatedAt: Date; }>