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.

92 lines (91 loc) 3.59 kB
import * as Options from '../options'; import { BaseService } from '../infrastructure'; import { Customer, CustomerInvite, MetaField, MetaFieldUpdateCreate } from '../interfaces'; export declare class Customers extends BaseService { constructor(shopDomain: string, accessToken: string); /** * Get a count of all customers */ count(): Promise<number>; /** * Get a list of all customers * @param options Options for filtering the results. */ list(options?: Options.DateOptions & Options.FieldOptions & Options.ListOptions): Promise<Customer[]>; /** * Searches for customers that match a supplied query. * @param options Options for searching customers */ search(options?: Options.CustomerSearchOptions & Options.FieldOptions & Options.BasicListOptions): Promise<Customer[]>; /** * Get a single customer * @param id The customer's id. * @param options Options for filtering the results. */ get(id: number, options?: Options.FieldOptions): Promise<Customer>; /** * Creates a customer. * @param customer The customer being created. * @param options Options for creating the customer. */ create(customer: Partial<Customer>): Promise<Customer>; /** * Updates a customer with the given id. * @param id The customer's id. * @param customer The updated customer. */ update(id: number, customer: Partial<Customer>): Promise<Customer>; /** * Deletes a customer with the given id. * @param id The customer's id. */ delete(id: number): Promise<undefined>; /** * Generate an account activation URL for a customer whose account is not yet enabled * @param id The customer's ids */ createActivationUrl(id: number): Promise<string>; /** * Sends an account invite to a customer. * @param invite Optional invitation to send */ invite(invite?: CustomerInvite): Promise<CustomerInvite>; /** * Gets a list of up to 250 metafields from the given customer. * @param id The customer's id. * @param options Options for filtering the results. */ listMetafields(customerId: number, options?: Options.MetafieldListOptions): Promise<Partial<MetaField>[]>; /** * Returns the number of metafields belonging to the given customer. * @param id The customer's id. */ countMetafields(customerId: number): Promise<number>; /** * Gets the metafield with the given id from an customer. * @param customerId The customer's id. * @param id The metafield's id. */ getMetafield(customerId: number, id: number): Promise<Partial<MetaField>>; /** * Creates a metafield for the given customer. * @param customerId The customer's id. * @param id The metafield's id. * @param metafield Options for the metafield */ createMetafield(customerId: number, metafield: Partial<MetaFieldUpdateCreate>): Promise<Partial<MetaField>>; /** * Updates a metafield for the given customer * @param customerId The customer's id. * @param id The metafield's id. * @param metafield Options for the metafield */ updateMetafield(customerId: number, id: number, metafield?: Partial<MetaFieldUpdateCreate>): Promise<Partial<MetaField>>; /** * Deletes the metafield with the given id from an customer. * @param customerId The customer's id. * @param id The metafield's id. */ deleteMetafield(customerId: number, id: number): Promise<undefined>; } export default Customers;