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.

44 lines (43 loc) 1.38 kB
import { BaseService } from '../infrastructure'; /** * A service for manipulating Shopify's CarrierService API. */ export class CarrierServices extends BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, "carrier_services"); } /** * Creates a new Carrier Service. */ create(carrierService) { return this.createRequest("POST", ".json", "carrier_service", { carrier_service: carrierService }); } /** * Updates a new Carrier Service. */ update(id, carrierService) { return this.createRequest("PUT", `${id}.json`, "carrier_service", { carrier_service: carrierService }); } /** * Gets a carrier service with the given id. * @param id The id of the carrier servuce to get. */ get(id) { return this.createRequest("GET", `${id}.json`, "carrier_service"); } /** * Deletes a carrier service with the given id. * @param id The id of the carrier service to delete. * @return Promise<{}> returns an empty object on success */ delete(id) { return this.createRequest("DELETE", `${id}.json`, "carrier_service"); } /** * Retrieves a list of carrier services for the shop. */ list() { return this.createRequest("GET", `.json`, "carrier_service"); } } export default CarrierServices;