UNPKG

shopify-admin-api

Version:

Shopify Admin API is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.

79 lines (78 loc) 2.93 kB
import * as Options from '../options'; import { BaseService } from '../infrastructure'; import { Blog, MetaField, MetaFieldUpdateCreate } from '../interfaces'; /** * A service for manipulating a Shopify shop's blogs. For manipulating a blog's posts, use the Articles class instead. */ export declare class Blogs extends BaseService { constructor(shopDomain: string, accessToken: string); /** * Creates a new blog. * @param blog The Blog being created. */ create(blog: Partial<Blog>): Promise<Blog>; /** * Gets a blog with the given id. * @param id Id of the blog to retrieve. * @param options Options for filtering the result. */ get(id: number, options?: Options.BlogGetOptions): Promise<Blog>; /** * Updates the blog with the given id. * @param id Id of the blog being updated. * @param blog The updated blog. */ update(id: number, blog: Partial<Blog>): Promise<Blog>; /** * Gets a list of all blogs on the shop. * @param options Options for filtering the results. */ list(options?: Options.BlogListOptions): Promise<Blog[]>; /** * Gets a count of all blogs on the shop. */ count(options?: Options.BlogCountOptions): Promise<number>; /** * Deletes the blog with the given id. * @param id Id of the blog being deleted. */ delete(id: number): Promise<undefined>; /** * Gets a list of up to 250 metafields from the given blog. * @param id The blog's id. * @param options Options for filtering the results. */ listMetafields(blogId: number, options?: Options.MetafieldListOptions): Promise<Partial<MetaField>[]>; /** * Returns the number of metafields belonging to the given blog. * @param id The blog's id. */ countMetafields(blogId: number): Promise<number>; /** * Gets the metafield with the given id from an blog. * @param blogId The blog's id. * @param id The metafield's id. */ getMetafield(blogId: number, id: number): Promise<Partial<MetaField>>; /** * Creates a metafield for the given blog. * @param blogId The blog's id. * @param id The metafield's id. * @param metafield Options for the metafield */ createMetafield(blogId: number, metafield: Partial<MetaFieldUpdateCreate>): Promise<Partial<MetaField>>; /** * Updates a metafield for the given blog * @param blogId The blog's id. * @param id The metafield's id. * @param metafield Options for the metafield */ updateMetafield(blogId: number, id: number, metafield?: Partial<MetaFieldUpdateCreate>): Promise<Partial<MetaField>>; /** * Deletes the metafield with the given id from an blog. * @param blogId The blog's id. * @param id The metafield's id. */ deleteMetafield(blogId: number, id: number): Promise<undefined>; } export default Blogs;