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.

48 lines (47 loc) 1.43 kB
import { BaseService } from '../infrastructure'; /** * A service for manage Shopify shop's theme. */ export class Themes extends BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, 'themes'); } /** * Creates a theme by providing the public URL of a ZIP file that contains the theme. * @param themes The theme being created. */ create(theme) { return this.createRequest('POST', `.json`, '', { theme }); } /** * Gets a tsingle hemes with the given id. * @param id Id of the theme to retrieve. * @param options Options for filtering the result. */ get(id, options) { return this.createRequest('GET', `${id}.json`, '', options); } /** * Updates an existing theme. * @param id Id of the themes being updated. * @param themes The updated theme. */ update(id, themes) { return this.createRequest('PUT', `${id}.json`, 'themes', { themes }); } /** * Gets a list of all themes on the shop. * @param options Options for filtering the results. */ list(options) { return this.createRequest('GET', `.json`, 'themes', options); } /** * Deletes the themes with the given id. * @param id Id of the theme being deleted. */ delete(id) { return this.createRequest('DELETE', `${id}.json`); } } export default Themes;