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.85 kB
import * as Options from '../options'; import { BaseService } from '../infrastructure'; import { Page, MetaField, MetaFieldUpdateCreate } from '../interfaces'; /** * A service for manipulating Shopify pages. */ export declare class Pages extends BaseService { constructor(shopDomain: string, accessToken: string); /** * Creates a new page. * @param page The page being created. */ create(page: Partial<Page>): Promise<Page>; /** * Retrieves a single page by its ID. * @param id Id of the page to retrieve. * @param options Options for filtering the result. */ get(id: number, options?: Options.PageGetOptions): Promise<Partial<Page>>; /** * Updates a page with the given id. * @param id Id of the page being updated. * @param page The updated page. */ update(id: number, page: Partial<Page>): Promise<Page>; /** * Retrieve a list of all pages. * @param options Options for filtering the results. */ list(options?: Options.PageListOptions): Promise<Partial<Page>[]>; /** * Retrieves a page count. */ count(options?: Options.PageCountOptions): Promise<number>; /** * Deletes a page with the given id. * @param id Id of the page being deleted. */ delete(id: number): Promise<undefined>; /** * Gets a list of up to 250 metafields from the given page. * @param id The page's id. * @param options Options for filtering the results. */ listMetafields(pageId: number, options?: Options.MetafieldListOptions): Promise<Partial<MetaField>[]>; /** * Returns the number of metafields belonging to the given page. * @param id The page's id. */ countMetafields(pageId: number): Promise<number>; /** * Gets the metafield with the given id from an page. * @param pageId The page's id. * @param id The metafield's id. */ getMetafield(pageId: number, id: number): Promise<Partial<MetaField>>; /** * Creates a metafield for the given page. * @param pageId The page's id. * @param id The metafield's id. * @param metafield Options for the metafield */ createMetafield(pageId: number, metafield: Partial<MetaFieldUpdateCreate>): Promise<Partial<MetaField>>; /** * Updates a metafield for the given page * @param pageId The page's id. * @param id The metafield's id. * @param metafield Options for the metafield */ updateMetafield(pageId: number, id: number, metafield?: Partial<MetaFieldUpdateCreate>): Promise<Partial<MetaField>>; /** * Deletes the metafield with the given id from an page. * @param pageId The page's id. * @param id The metafield's id. */ deleteMetafield(pageId: number, id: number): Promise<undefined>; } export default Page;