shopify-api-node
Version:
Shopify API bindings for Node.js
1,751 lines (1,658 loc) • 95.8 kB
TypeScript
// Type definitions for shopify-api-node
// Project: shopify-api-node
// Definitions by: Rich Buggy <rich@buggy.id.au>
import { Hooks, Agents } from 'got';
/*~ This is the module template file for class modules.
*~ You should rename it to index.d.ts and place it in a folder with the same name as the module.
*~ For example, if you were writing a file for "super-greeter", this
*~ file should be 'super-greeter/index.d.ts'
*/
/*~ Note that ES6 modules cannot directly export class objects.
*~ This file should be imported using the CommonJS-style:
*~ import x = require('someLibrary');
*~
*~ Refer to the documentation to understand common
*~ workarounds for this limitation of ES6 modules.
*/
/*~ This declaration specifies that the class constructor function
*~ is the exported object from the file
*/
export = Shopify;
/*~ Write your module's methods and properties in this class */
declare class Shopify {
constructor(
config: Shopify.IPublicShopifyConfig | Shopify.IPrivateShopifyConfig
);
callLimits: Shopify.ICallLimits;
callGraphqlLimits: Shopify.ICallGraphqlLimits;
accessScope: {
list: () => Promise<Shopify.IAccessScope[]>;
};
apiPermission: {
delete: () => Promise<void>;
};
// abandonedCheckouts
applicationCharge: {
activate: (id: number, params?: any) => Promise<Shopify.IApplicationCharge>;
create: (
params: Shopify.ICreateApplicationCharge
) => Promise<Shopify.IApplicationCharge>;
get: (id: number, params?: any) => Promise<Shopify.IApplicationCharge>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IApplicationCharge>>;
};
applicationCredit: {
create: (
params: Shopify.ICreateApplicationCredit
) => Promise<Shopify.IApplicationCredit>;
get: (id: number, params?: any) => Promise<Shopify.IApplicationCredit>;
list: (params?: any) => Promise<Shopify.IApplicationCredit[]>;
};
article: {
authors: () => Promise<string[]>;
count: (blogId: number, params?: any) => Promise<number>;
create: (
blogId: number,
params: Shopify.ICreateArticle
) => Promise<Shopify.IArticle>;
delete: (blogId: number, id: number) => Promise<void>;
get: (
blogId: number,
id: number,
params?: any
) => Promise<Shopify.IArticle>;
list: (
blogId: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IArticle>>;
tags: (blogId?: number, params?: any) => Promise<string[]>;
update: (
blogId: number,
id: number,
params: Shopify.IUpdateArticle
) => Promise<Shopify.IArticle>;
};
asset: {
create: (themeId: number, params: any) => Promise<Shopify.IAsset>;
delete: (themeId: number, params: any) => Promise<void>;
get: (themeId: number, params?: any) => Promise<Shopify.IAsset>;
list: (themeId: number, params?: any) => Promise<Shopify.IAsset[]>;
update: (
themeId: number,
params: Shopify.IUpdateAsset
) => Promise<Shopify.IAsset>;
};
balance: {
list: () => Promise<Shopify.IBalance[]>;
transactions: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IBalanceTransaction>>;
};
blog: {
count: () => Promise<number>;
create: (params: Shopify.ICreateBlog) => Promise<Shopify.IBlog>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IBlog>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IBlog>>;
update: (id: number, params: any) => Promise<Shopify.IBlog>;
};
cancellationRequest: {
create: (
fulfillmentOrderId: number,
message?: string
) => Promise<Shopify.IFulfillmentOrder>;
accept: (
fulfillmentOrderId: number,
message?: string
) => Promise<Shopify.IFulfillmentOrder>;
reject: (
fulfillmentOrderId: number,
message?: string
) => Promise<Shopify.IFulfillmentOrder>;
};
carrierService: {
create: (
params: Shopify.ICreateCarrierService
) => Promise<Shopify.ICarrierService>;
delete: (id: number) => Promise<void>;
get: (id: number) => Promise<Shopify.ICarrierService>;
list: () => Promise<Shopify.ICarrierService[]>;
update: (
id: number,
params: Shopify.IUpdateCarrierService
) => Promise<Shopify.ICarrierService>;
};
checkout: {
complete: (token: string) => Promise<any>;
count: (params?: any) => Promise<number>;
create: (params?: any) => Promise<Shopify.ICheckout>;
get: (token: string) => Promise<Shopify.ICheckout>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ICheckout>>;
shippingRates: (token: string) => Promise<any>;
update: (token: any, params: any) => Promise<Shopify.ICheckout>;
};
collect: {
count: (params?: any) => Promise<number>;
create: (params: Shopify.ICreateCollect) => Promise<Shopify.ICollect>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.ICollect>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.ICollect>>;
};
collection: {
get: (id: number, params?: any) => Promise<Shopify.ICollection>;
products: (
id: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IProduct>>;
};
collectionListing: {
get: (id: number, params?: any) => Promise<Shopify.ICollectionListing>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ICollectionListing>>;
productIds: (id: number, params?: any) => Promise<any>;
};
comment: {
approve: (id: number) => Promise<Shopify.IComment>;
count: (params?: any) => Promise<number>;
create: (params: Shopify.ICreateComment) => Promise<Shopify.IComment>;
get: (id: number, params?: any) => Promise<Shopify.IComment>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IComment>>;
notSpam: (id: number) => Promise<Shopify.IComment>;
remove: (id: number) => Promise<Shopify.IComment>;
restore: (id: number) => Promise<Shopify.IComment>;
spam: (id: number) => Promise<Shopify.IComment>;
update: (
id: number,
params: Shopify.IUpdateComment
) => Promise<Shopify.IComment>;
};
country: {
count: () => Promise<number>;
create: (params: Shopify.ICreateCountry) => Promise<Shopify.ICountry>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.ICountry>;
list: (params?: any) => Promise<Shopify.ICountry[]>;
update: (
id: number,
params: Shopify.IUpdateCountry
) => Promise<Shopify.ICountry>;
};
currency: {
list: () => Promise<Shopify.ICurrency[]>;
};
customCollection: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.ICustomCollection>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.ICustomCollection>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ICustomCollection>>;
update: (id: number, params: any) => Promise<Shopify.ICustomCollection>;
};
customer: {
accountActivationUrl: (id: number) => Promise<any>;
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.ICustomer>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.ICustomer>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ICustomer>>;
search: (
params: any
) => Promise<Shopify.IPaginatedResult<Shopify.ICustomer>>;
sendInvite: (
id: number,
params?: Shopify.ICustomerSendInvite
) => Promise<Shopify.ICustomerSendInvite>;
update: (id: number, params: any) => Promise<Shopify.ICustomer>;
orders: (id: number, params?: any) => Promise<Shopify.IOrder[]>;
};
customerAddress: {
create: (
customerId: number,
params: any
) => Promise<Shopify.ICustomerAddress>;
default: (
customerId: number,
id: number
) => Promise<Shopify.ICustomerAddress>;
delete: (customerId: number, id: number) => Promise<void>;
get: (customerId: number, id: number) => Promise<Shopify.ICustomerAddress>;
list: (
customerId: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ICustomerAddress>>;
set: (customerId: number, params: any) => Promise<any>;
update: (
customerId: number,
id: number,
params: any
) => Promise<Shopify.ICustomerAddress>;
};
customerSavedSearch: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.ICustomerSavedSearch>;
customers: (id: number, params?: any) => Promise<any>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.ICustomerSavedSearch>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ICustomerSavedSearch>>;
update: (id: number, params: any) => Promise<Shopify.ICustomerSavedSearch>;
};
deprecatedApiCall: {
list: () => Promise<Shopify.IDeprecatedApiCall[]>;
};
discountCode: {
create: (
priceRuleId: number,
params: any
) => Promise<Shopify.IDiscountCode>;
delete: (priceRuleId: number, id: number) => Promise<void>;
get: (priceRuleId: number, id: number) => Promise<Shopify.IDiscountCode>;
list: (
priceRuleId: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IDiscountCode>>;
lookup: (params: any) => Promise<Shopify.IDiscountCode>;
update: (
priceRuleId: number,
id: number,
params?: any
) => Promise<Shopify.IDiscountCode>;
};
discountCodeCreationJob: {
create: (
priceRuleId: number,
params: any[]
) => Promise<Shopify.IDiscountCodeCreation>;
discountCodes: (priceRuleId: number, id: number) => Promise<any[]>;
get: (
priceRuleId: number,
id: number
) => Promise<Shopify.IDiscountCodeCreation>;
};
dispute: {
get: (id: number) => Promise<Shopify.IDispute>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IDispute>>;
};
disputeEvidence: {
get: (disputeId: number) => Promise<Shopify.IDisputeEvidence>;
update: (
disputeId: number,
params: Shopify.IUpdateDisputeEvidence
) => Promise<Shopify.IDisputeEvidence>;
};
disputeFileUpload: {
create: (
disputeId: number,
params: Shopify.ICreateDisputeFileUpload
) => Promise<Shopify.IDisputeFileUpload>;
delete: (id: number) => Promise<void>;
};
draftOrder: {
complete: (id: number, params?: any) => Promise<Shopify.IDraftOrder>;
count: () => Promise<number>;
create: (params: any) => Promise<Shopify.IDraftOrder>;
delete: (id: number) => Promise<void>;
get: (id: number) => Promise<Shopify.IDraftOrder>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IDraftOrder>>;
sendInvoice: (id: number, params?: any) => Promise<any>;
update: (id: number, params?: any) => Promise<Shopify.IDraftOrder>;
};
event: {
count: (params?: any) => Promise<number>;
get: (id: number, params?: any) => Promise<Shopify.IEvent>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IEvent>>;
};
fulfillment: {
cancel: (orderId: number, id: number) => Promise<Shopify.IFulfillment>;
cancelV2: (id: number) => Promise<Shopify.IFulfillment>;
complete: (orderId: number, id: number) => Promise<Shopify.IFulfillment>;
count: (orderId: number, params?: any) => Promise<number>;
create: (orderId: number, params: any) => Promise<Shopify.IFulfillment>;
createV2: (params: any) => Promise<Shopify.IFulfillment>;
get: (
orderId: number,
id: number,
params?: any
) => Promise<Shopify.IFulfillment>;
list: (
orderId: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IFulfillment>>;
open: (orderId: number, id: number) => Promise<Shopify.IFulfillment>;
update: (
orderId: number,
id: number,
params: any
) => Promise<Shopify.IFulfillment>;
updateTracking: (id: number, params: any) => Promise<Shopify.IFulfillment>;
};
fulfillmentEvent: {
create: (
orderId: number,
fulfillmentId: number,
params: any
) => Promise<Shopify.IFulfillmentEvent>;
delete: (
orderId: number,
fulfillmentId: number,
id: number
) => Promise<void>;
get: (
orderId: number,
fulfillmentId: number,
id: number
) => Promise<Shopify.IFulfillmentEvent>;
list: (
orderId: number,
fulfillmentId: number,
params?: any
) => Promise<Shopify.IFulfillmentEvent[]>;
update: (
orderId: number,
fulfillmentId: number,
id: number,
params: any
) => Promise<Shopify.IFulfillmentEvent>;
};
fulfillmentOrder: {
cancel: (id: number) => Promise<Shopify.IFulfillmentOrder>;
close: (id: number, message?: string) => Promise<Shopify.IFulfillmentOrder>;
fulfillments: (
id: number
) => Promise<Shopify.IPaginatedResult<Shopify.IFulfillment>>;
get: (id: number) => Promise<Shopify.IFulfillmentOrder>;
hold: (
id: number,
params: Shopify.IFulfillmentHold
) => Promise<Shopify.IFulfillmentOrder>;
list: (params?: any) => Promise<Shopify.IFulfillmentOrder[]>;
locationsForMove: (id: number) => Promise<Shopify.ILocationForMove[]>;
move: (
id: number,
locationId: number
) => Promise<Shopify.IFulfillmentOrder>;
releaseHold: (id: number) => Promise<Shopify.IFulfillmentOrder>;
reschedule: (
id: number,
deadline: string
) => Promise<Shopify.IFulfillmentOrder>;
setFulfillmentOrdersDeadline: (
params: Shopify.ISetFulfillmentOrdersDeadline
) => Promise<void>;
};
fulfillmentRequest: {
accept: (
fulfillmentOrderId: number,
message?: string
) => Promise<Shopify.IFulfillmentOrder>;
create: (
fulfillmentOrderId: number,
params: Shopify.ICreateFulfillmentRequest
) => Promise<Shopify.IFulfillmentOrder>;
reject: (
fulfillmentOrderId: number,
message?: string
) => Promise<Shopify.IFulfillmentOrder>;
};
fulfillmentService: {
create: (params: any) => Promise<Shopify.IFulfillmentService>;
delete: (id: number) => Promise<void>;
get: (id: number) => Promise<Shopify.IFulfillmentService>;
list: (params?: any) => Promise<Shopify.IFulfillmentService[]>;
update: (id: number, params: any) => Promise<Shopify.IFulfillmentService>;
};
giftCard: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.IGiftCard>;
disable: (id: number) => Promise<any>;
get: (id: number) => Promise<Shopify.IGiftCard>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IGiftCard>>;
search: (
params: any
) => Promise<Shopify.IPaginatedResult<Shopify.IGiftCard>>;
update: (id: number, params: any) => Promise<Shopify.IGiftCard>;
};
giftCardAdjustment: {
create: (
giftCardId: number,
params: any
) => Promise<Shopify.IGiftCardAdjustment>;
get: (
giftCardId: number,
id: number
) => Promise<Shopify.IGiftCardAdjustment>;
list: (giftCardId: number) => Promise<Shopify.IGiftCardAdjustment[]>;
};
graphql: (data: string, variables?: any) => Promise<any>;
inventoryItem: {
get: (id: number) => Promise<Shopify.IInventoryItem>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IInventoryItem>>;
update: (id: number, params: any) => Promise<Shopify.IInventoryItem>;
};
inventoryLevel: {
adjust: (params: any) => Promise<Shopify.IInventoryLevel>;
connect: (params: any) => Promise<Shopify.IInventoryLevel>;
delete: (params: any) => Promise<void>;
list: (
params: any
) => Promise<Shopify.IPaginatedResult<Shopify.IInventoryLevel>>;
set: (params: any) => Promise<Shopify.IInventoryLevel>;
};
location: {
count: () => Promise<number>;
get: (id: number) => Promise<Shopify.ILocation>;
inventoryLevels: (
id: number,
params?: any
) => Promise<Shopify.IInventoryLevel[]>;
list: () => Promise<Shopify.IPaginatedResult<Shopify.ILocation>>;
};
marketingEvent: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.IMarketingEvent>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IMarketingEvent>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IMarketingEvent>>;
update: (id: number, params: any) => Promise<Shopify.IMarketingEvent>;
engagements: (id: number, params: any) => Promise<any>;
};
metafield: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.IMetafield>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IMetafield>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IMetafield>>;
update: (id: number, params: any) => Promise<Shopify.IMetafield>;
};
on(
event: 'callLimits',
callback: (limits: Shopify.ICallLimits) => void
): Shopify;
on(
event: 'callGraphqlLimits',
callback: (limits: Shopify.ICallGraphqlLimits) => void
): Shopify;
order: {
cancel: (id: number, params?: any) => Promise<Shopify.IOrder>;
close: (id: number) => Promise<Shopify.IOrder>;
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.IOrder>;
delete: (id: number) => Promise<any>;
fulfillmentOrders: (id: number) => Promise<Shopify.IFulfillmentOrder[]>;
get: (id: number, params?: any) => Promise<Shopify.IOrder>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IOrder>>;
open: (id: number) => Promise<Shopify.IOrder>;
update: (id: number, params: any) => Promise<Shopify.IOrder>;
};
orderRisk: {
create: (orderId: number, params: any) => Promise<Shopify.IOrderRisk>;
delete: (orderId: number, id: number) => Promise<void>;
get: (orderId: number, id: number) => Promise<Shopify.IOrderRisk>;
list: (
orderId: number
) => Promise<Shopify.IPaginatedResult<Shopify.IOrderRisk>>;
update: (
orderId: number,
id: number,
params: any
) => Promise<Shopify.IOrderRisk>;
};
page: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.IPage>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IPage>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IPage>>;
update: (id: number, params: any) => Promise<Shopify.IPage>;
};
payment: {
count: (checkoutToken: string) => Promise<number>;
create: (checkoutToken: string, params: any) => Promise<any>;
get: (checkoutToken: string, id: number) => Promise<any>;
list: (checkoutToken?: string) => Promise<any>;
};
payout: {
get: (id: number) => Promise<Shopify.IPayout>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IPayout>>;
};
policy: {
list: (params?: any) => Promise<Shopify.IPolicy[]>;
};
priceRule: {
create: (params: any) => Promise<Shopify.IPriceRule>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IPriceRule>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IPriceRule>>;
update: (id: number, params: any) => Promise<Shopify.IPriceRule>;
};
product: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.IProduct>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IProduct>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IProduct>>;
update: (id: number, params: any) => Promise<Shopify.IProduct>;
};
productImage: {
count: (productId: number, params?: any) => Promise<number>;
create: (productId: number, params: any) => Promise<Shopify.IProductImage>;
delete: (productId: number, id: number) => Promise<void>;
get: (
productId: number,
id: number,
params?: any
) => Promise<Shopify.IProductImage>;
list: (productId: number, params?: any) => Promise<Shopify.IProductImage[]>;
update: (
productId: number,
id: number,
params: any
) => Promise<Shopify.IProductImage>;
};
productListing: {
count: () => Promise<number>;
create: (
productId: number,
params: any
) => Promise<Shopify.IProductListing>;
delete: (productId: number) => Promise<void>;
get: (productId: number) => Promise<Shopify.IProductListing>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IProductListing>>;
productIds: (params?: any) => Promise<any>;
};
productResourceFeedback: {
create: (
productId: number,
params: any
) => Promise<Shopify.IResourceFeedback>;
list: (
productId: number,
params?: any
) => Promise<Shopify.IResourceFeedback[]>;
};
productVariant: {
count: (productId: number) => Promise<number>;
create: (
productId: number,
params: any
) => Promise<Shopify.IProductVariant>;
delete: (productId: number, id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IProductVariant>;
list: (
productId: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IProductVariant>>;
update: (id: number, params: any) => Promise<Shopify.IProductVariant>;
};
province: {
count: (countryId: number, params?: any) => Promise<number>;
get: (
countryId: number,
id: number,
params?: any
) => Promise<Shopify.IProvince>;
list: (countryId: number, params?: any) => Promise<Shopify.IProvince[]>;
update: (
countryId: number,
id: number,
params: any
) => Promise<Shopify.IProvince>;
};
recurringApplicationCharge: {
activate: (
id: number,
params: any
) => Promise<Shopify.IRecurringApplicationCharge>;
create: (
params: Shopify.ICreateRecurringApplicationCharge
) => Promise<Shopify.IRecurringApplicationCharge>;
delete: (id: number) => Promise<void>;
get: (
id: number,
params?: any
) => Promise<Shopify.IRecurringApplicationCharge>;
list: (params?: any) => Promise<Shopify.IRecurringApplicationCharge[]>;
customize: (
id: number,
params: any
) => Promise<Shopify.IRecurringApplicationCharge>;
};
redirect: {
count: (params?: any) => Promise<number>;
create: (params: Shopify.ICreateRedirect) => Promise<Shopify.IRedirect>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IRedirect>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IRedirect>>;
update: (
id: number,
params: Shopify.IUpdateRedirect
) => Promise<Shopify.IRedirect>;
};
refund: {
calculate: (orderId: number, params: any) => Promise<any>;
create: (orderId: number, params: any) => Promise<Shopify.IRefund>;
get: (
orderId: number,
id: number,
params?: any
) => Promise<Shopify.IRefund>;
list: (
orderId: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IRefund>>;
};
report: {
create: (params: any) => Promise<Shopify.IReport>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IReport>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IReport>>;
update: (id: number, params: any) => Promise<Shopify.IReport>;
};
resourceFeedback: {
create: (params: any) => Promise<Shopify.IResourceFeedback>;
list: () => Promise<Shopify.IResourceFeedback[]>;
};
scriptTag: {
count: (params?: any) => Promise<number>;
create: (params: Shopify.ICreateScriptTag) => Promise<Shopify.IScriptTag>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IScriptTag>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.IScriptTag>>;
update: (
id: number,
params: Shopify.IUpdateScriptTag
) => Promise<Shopify.IScriptTag>;
};
shippingZone: {
list: (params?: any) => Promise<Shopify.IShippingZone[]>;
};
shop: {
get: (params?: any) => Promise<Shopify.IShop>;
};
smartCollection: {
count: (params?: any) => Promise<number>;
create: (params: any) => Promise<Shopify.ISmartCollection>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.ISmartCollection>;
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ISmartCollection>>;
order: (id: number, params: any) => Promise<void>;
products: (id: number, params: any) => Promise<Shopify.IProduct>;
update: (id: number, params: any) => Promise<Shopify.ISmartCollection>;
};
storefrontAccessToken: {
create: (params: any) => Promise<Shopify.IStorefrontAccessToken>;
delete: (id: number) => Promise<void>;
list: () => Promise<Shopify.IStorefrontAccessToken[]>;
};
tenderTransaction: {
list: (
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ITenderTransaction>>;
};
theme: {
create: (params: any) => Promise<Shopify.ITheme>;
delete: (id: number) => Promise<void>;
get: (id: number, params: any) => Promise<Shopify.ITheme>;
list: (params?: any) => Promise<Shopify.ITheme[]>;
update: (id: number, params: any) => Promise<Shopify.ITheme>;
};
transaction: {
count: (orderId: number) => Promise<number>;
create: (orderId: number, params: any) => Promise<Shopify.ITransaction>;
get: (
orderId: number,
id: number,
params?: any
) => Promise<Shopify.ITransaction>;
list: (
orderId: number,
params?: any
) => Promise<Shopify.IPaginatedResult<Shopify.ITransaction>>;
};
usageCharge: {
create: (
recurringApplicationChargeId: number,
params: Shopify.ICreateUsageCharge
) => Promise<Shopify.IUsageCharge>;
get: (
recurringApplicationChargeId: number,
id: number,
params?: any
) => Promise<Shopify.IUsageCharge>;
list: (
recurringApplicationChargeId: number,
params?: any
) => Promise<Shopify.IUsageCharge[]>;
};
user: {
current: () => Promise<Shopify.IUser>;
get: (id: number) => Promise<Shopify.IUser>;
list: () => Promise<Shopify.IPaginatedResult<Shopify.IUser>>;
};
webhook: {
count: (params?: any) => Promise<number>;
create: (params: Shopify.ICreateWebhook) => Promise<Shopify.IWebhook>;
delete: (id: number) => Promise<void>;
get: (id: number, params?: any) => Promise<Shopify.IWebhook>;
list: (params?: any) => Promise<Shopify.IPaginatedResult<Shopify.IWebhook>>;
update: (
id: number,
params: Shopify.IUpdateWebhook
) => Promise<Shopify.IWebhook>;
};
}
/*~ If you want to expose types from your module as well, you can
*~ place them in this block.
*/
declare namespace Shopify {
export interface IAutoLimit {
bucketSize: number;
calls: number;
interval: number;
}
export interface IPublicShopifyConfig {
accessToken: string;
apiVersion?: string;
autoLimit?: boolean | IAutoLimit;
maxRetries?: number;
presentmentPrices?: boolean;
shopName: string;
timeout?: number;
hooks?: Hooks;
agent?: Agents;
}
export interface IPrivateShopifyConfig {
apiKey: string;
apiVersion?: string;
autoLimit?: boolean | IAutoLimit;
maxRetries?: number;
password: string;
presentmentPrices?: boolean;
shopName: string;
timeout?: number;
hooks?: Hooks;
agent?: Agents;
}
export interface ICallLimits {
remaining: number;
current: number;
max: number;
}
export interface ICallGraphqlLimits {
actualQueryCost: number;
current: number;
max: number;
remaining: number;
requestedQueryCost: number;
restoreRate: number;
}
interface IAccessScope {
handle: string;
}
interface ICheckout {
abandoned_checkout_url: string;
applied_discount?: ICheckoutDiscount;
billing_address?: ICustomerAddress;
buyer_accepts_marketing: boolean;
cancel_reason?: 'customer' | 'fraud' | 'inventory' | 'other' | null;
cart_token: string;
closed_at: string | null;
completed_at: string | null;
created_at: string;
currency: string;
customer: ICustomer;
customer_id: number;
customer_locale: string;
discount_code?: string;
discount_codes?: ICheckoutDiscount[];
device_id: number | null;
email: string;
gateway: string | null;
gift_cards?: ICheckoutGiftCard;
id: number;
landing_site: string;
line_items: ICheckoutLineItem[];
location_id: number | null; // In API response but not documented
note: string | null;
note_attributes: any[];
order?: ICheckoutOrder;
payment_due: string;
payment_url?: string;
phone: string | null;
presentment_currency: string;
referring_site: string;
request_details?: ICheckoutRequestDetails;
requires_shipping?: boolean;
reservation_time?: number;
reservation_time_left?: number;
shipping_address: ICustomerAddress;
shipping_lines: ICheckoutShippingLine[];
shipping_rates?: ICheckoutShippingRate[];
shipping_rate?: ICheckoutShippingRate[];
source_indentifier: string | null;
source_name: string | null;
source_url: string | null;
subtotal_price: string;
tax_lines: ICheckoutTaxLine[];
taxes_included: boolean;
token: string;
total_discounts: string;
total_line_items_price: string;
total_price: string;
total_tax: string;
total_weight: number;
updated_at: string;
user_id: number | null; // In API response but not documented
web_url?: string;
}
interface ICheckoutLineItem {
applied_discounts: any[];
compare_at_price: string | null;
destination_location_id: number;
discount_codes: any[];
fulfillment_service: 'api' | 'custom' | 'legacy' | 'manual';
fulfillment_status?: 'fulfilled' | 'partial' | null;
gift_card: boolean;
grams: number;
key: string;
line_price: string;
name: string;
origin_location_id: number;
price: string;
product_id: number;
properties: any | null;
quantity: number;
requires_shipping: boolean;
sku: string;
taxable: boolean;
tax_lines: ICheckoutTaxLine[];
title: string;
variant_id: number;
variant_title: string;
vendor: string;
}
interface ICheckoutShippingLine {
api_client_id: number | null;
applied_discounts: any[];
carrier_identifier: any | null;
carrier_service_id: number | null;
code: string;
delivery_category: any | null;
id: string;
markup: string;
phone: string | null;
price: string;
requested_fulfillment_service_id: number | null;
source: string;
tax_lines: any[];
title: string;
validation_context: any | null;
}
interface ICheckoutTaxLine {
compare_at: number;
position: number;
price: string;
rate: number;
source: string;
title: string;
zone: string;
}
type ApplicationChargeStatus =
| 'accepted'
| 'active'
| 'declined'
| 'expired'
| 'pending';
interface IApplicationCharge {
confirmation_url: string;
created_at: string;
id: number;
name: string;
price: string;
return_url: string;
status: ApplicationChargeStatus;
test: boolean | null;
updated_at: string;
}
interface ICreateApplicationCharge {
name: string;
price: string;
return_url: string;
status: ApplicationChargeStatus;
test?: true;
}
interface IApplicationCredit {
amount: string;
description: string;
id: number;
test: boolean | null;
}
interface ICreateApplicationCredit {
description: string;
amount: string;
test?: true;
}
interface IArticle {
author: string;
blog_id: number;
body_html: string;
created_at: string;
id: number;
handle: string;
image: IImage;
metafields: IObjectMetafield[];
published: boolean;
published_at: string;
summary_html: string | null;
tags: string;
template_suffix: string | null;
title: string;
updated_at: string;
user_id: number;
}
interface ICreateArticle {
author?: string;
body_html?: string;
handle?: string;
image?: ICreateArticleImage;
metafields?: ICreateObjectMetafield[];
published?: boolean;
published_at?: string;
summary_html?: string | null;
tags?: string;
template_suffix?: string | null;
title?: string;
user_id?: number;
}
interface IUpdateArticle {
author?: string;
body_html?: string;
handle?: string;
image?: ICreateArticleImage;
metafields?: ICreateObjectMetafield[];
published?: boolean;
published_at?: string;
summary_html?: string | null;
tags?: string;
template_suffix?: string | null;
title?: string;
user_id?: number;
}
interface IImage {
created_at: string;
height: number;
src: string;
updated_at?: string;
width: number;
alt: string | null;
}
interface ICreateArticleImage {
attachment?: string;
src?: string;
alt?: string;
}
interface IObjectMetafield {
key: string;
namespace: string;
value: string | number;
value_type: 'string' | 'integer';
description: string | null;
}
interface ICreateObjectMetafield {
key: string;
namespace: string;
value: string | number;
value_type: 'string' | 'integer';
description?: string | null;
}
interface IAsset {
attachment?: string;
checksum: string;
content_type: string;
created_at: string;
key: string;
public_url: string;
size: number;
source_key: string;
src: string;
theme_id: number;
updated_at: string;
value?: string;
}
interface IUpdateAsset {
attachment?: string;
key: string;
source_key?: string;
src?: string;
value?: string;
}
type BalanceTransactionType =
| 'charge'
| 'refund'
| 'dispute'
| 'reserve'
| 'adjustment'
| 'credit'
| 'debit'
| 'payout'
| 'payout_failure'
| 'payout_cancellation';
type BalanceTransactionSourceType =
| 'charge'
| 'refund'
| 'dispute'
| 'reserve'
| 'adjustment'
| 'payout';
interface IBalanceTransaction {
id: number;
type: BalanceTransactionType;
test: boolean;
payout_id: number;
payout_status: string;
currency: string;
amount: string;
fee: string;
net: string;
source_id: number;
source_type: BalanceTransactionSourceType;
source_order_transaction_id: number | null;
source_order_id: number | null;
processed_at: string;
}
interface IBalance {
currency: string;
amount: string;
}
interface IBlog {
commentable: 'moderate' | 'no' | 'yes';
created_at: string;
feedburner: string | null;
feedburner_location: string | null;
handle: string;
id: number;
metafield: IObjectMetafield[];
tags: string;
template_suffix: string | null;
title: string;
updated_at: string;
}
interface ICreateBlog {
commentable?: 'moderate' | 'no' | 'yes';
feedburner?: string | null;
feedburner_location?: string | null;
handle?: string;
metafield?: ICreateObjectMetafield[];
tags?: string;
template_suffix?: string | null;
title: string;
}
interface ICarrierService {
id: number;
active: boolean;
callback_url: string;
carrier_service_type: string; // I think this could be restricted to "api" or "legacy"
name: string;
service_discovery: boolean;
format: 'json' | 'xml';
}
interface ICreateCarrierService {
active?: boolean;
callback_url: string;
carrier_service_type?: string;
name: string;
service_discovery: boolean;
format?: 'json' | 'xml';
}
interface IUpdateCarrierService {
active?: boolean;
callback_url?: string;
carrier_service_type?: string;
name?: string;
service_discovery?: boolean;
format?: 'json' | 'xml';
}
interface ICheckoutDiscount {
amount: string;
applicable: boolean;
description: string;
non_applicable_reason: string;
title: string;
value: string;
value_type: 'fixed_amount' | 'percentage';
}
interface ICheckoutGiftCard {
amount_used: string;
balance: string;
id: string;
last_characters: string;
}
interface ICheckoutShippingRateCheckout {
subtotal_price: string;
total_price: string;
total_tax: string;
}
interface ICheckoutShippingRate {
checkout: ICheckoutShippingRateCheckout;
delivery_range: string[];
handle: string;
price: string;
requires_phone: boolean;
title: string;
}
interface ICheckoutOrder {
id: number;
name: string;
status_url: string;
}
interface ICheckoutRequestDetails {
accept_language: string;
ip_address: string;
user_agent: string;
}
interface ICollect {
collection_id: number;
created_at: string;
featured: boolean;
id: number;
position: number;
product_id: number;
sort_value: string;
updated_at: string;
}
interface ICreateCollect {
collection_id: number;
featured?: boolean;
position?: number;
product_id: number;
sort_value?: string;
}
interface ICollection {
admin_graphql_api_id: string;
body_html: string;
collection_type: string;
handle: string;
id: number;
image: IImage;
products_count: number;
published_at: string;
published_scope: string;
sort_order: string;
template_suffix: string | null;
title: string;
updated_at: string;
}
type CollectionListingSortOrder =
| 'alpha-asc'
| 'alpha-desc'
| 'best-selling'
| 'created'
| 'created-desc'
| 'manual'
| 'price-asc'
| 'price-desc';
interface ICollectionListingImage extends IImage {
position: number;
product_it: number;
variant_ids: number[];
}
interface ICollectionListing {
collection_id: number;
body_html: string;
default_product_image: ICollectionListingImage;
image: IImage;
handle: string;
published_at: string;
title: string;
sort_order: CollectionListingSortOrder;
updated_at: string;
}
type CommentStatus = 'published' | 'removed' | 'spam' | 'unapproved';
interface IComment {
article_id: number;
author: string;
blog_id: number;
body: string;
body_html: string;
created_at: string;
email: string;
id: number;
ip: string;
published_at: string;
status: CommentStatus;
updated_at: string;
user_agent: string;
}
interface ICreateComment {
article_id?: number;
author: string;
blog_id?: number;
body?: string;
body_html?: string;
email: string;
ip?: string;
published_at?: string;
status?: CommentStatus;
user_agent?: string;
}
interface IUpdateComment {
article_id?: number;
author?: string;
blog_id?: number;
body?: string;
body_html?: string;
email?: string;
ip?: string;
published_at?: string;
status?: CommentStatus;
user_agent?: string;
}
interface ICountry {
code: string;
id: number;
name: string;
provinces: IProvince[];
tax: number;
tax_name: string;
}
interface ICreateCountry {
code: string;
name?: string;
tax?: number;
tax_name?: string;
}
interface IUpdateCountry {
code?: string;
name?: string;
tax?: number;
tax_name?: string;
}
interface ICurrencyExchangeAdjustment {
id: number;
adjustment: string;
original_amount: string;
final_amount: string;
currency: string;
}
interface ICurrency {
currency: string;
rate_updated_at: string;
enabled: boolean;
}
type CustomerCollectionSortOrder =
| 'alpha-asc'
| 'alpha-desc'
| 'best-selling'
| 'created'
| 'created-desc'
| 'manual'
| 'price-asc'
| 'price-desc';
interface ICustomCollection {
body_html: string | null;
handle: string;
image: IImage;
id: number;
metafield?: IObjectMetafield; // From https://help.shopify.com/api/reference/customcollection but not visible in test API call
published?: string; // From https://help.shopify.com/api/reference/customcollection but not visible in test API call
published_at: string;
published_scope: string;
sort_order: CustomerCollectionSortOrder;
template_suffix: string | null;
title: string;
updated_at: string;
}
type CustomerState = 'declined' | 'disabled' | 'enabled' | 'invited';
interface IEmailMarketingConsent {
state: string;
opt_in_level: string | null;
consent_updated_at: string;
}
interface ICustomer {
accepts_marketing?: boolean;
email_marketing_consent?: IEmailMarketingConsent;
addresses?: ICustomerAddress[];
created_at: string;
currency: string;
default_address: ICustomerAddress;
email: string;
first_name: string;
id: number;
last_name: string;
metafield?: IObjectMetafield; // From https://help.shopify.com/api/reference/customer but not visible in test API call
phone: string;
multipass_identifier: string | null;
last_order_id: number | null;
last_order_name: string | null;
note: string | null;
orders_count: number;
state: CustomerState;
tags: string;
tax_exempt: boolean;
total_spent: string;
updated_at: string;
verified_email: boolean;
}
interface ICustomerAddress {
address1: string;
address2?: string;
city: string;
company: string | null;
country: string;
country_code: string;
country_name: string;
customer_id: number;
default: boolean;
first_name: string;
id: number;
last_name: string;
latitude: number | null;
longitude: number | null;
name: string;
phone: string | null;
province: string | null;
province_code: string | null;
zip: string;
}
interface ICustomerSavedSearch {
created_at: string;
id: number;
name: string;
query: string;
updated_at: string;
}
interface ICustomerSendInvite {
to: string;
from: string;
bcc: string[];
subject: string;
custom_message: string;
}
interface IDeprecatedApiCall {
api_type: string;
description: string;
documentation_url: string;
endpoint: string;
graphql_schema_name: string | null;
last_call_at: string;
migration_deadline: string;
version: string;
}
type AllocationMethod = 'across' | 'each' | 'one';
type TargetSelection = 'all' | 'entitled' | 'explicit';
type TargetType = 'line_item' | 'shipping_line';
type DiscountApplicationType = 'manual' | 'script' | 'discount_code';
type ValueType = 'fixed_amount' | 'percentage';
interface IDiscountApplication {
allocation_method: AllocationMethod;
code: string;
description: string;
target_selection: TargetSelection;
target_type: TargetType;
title: string;
type: DiscountApplicationType;
value: string;
value_type: ValueType;
}
interface IDiscountAllocation {
amount: string;
amount_set: IMoneySet;
discount_application_index: number;
}
interface IDiscountCode {
created_at: string;
id: number;
code: string;
price_rule_id: number;
updated_at: string;
usage_count: number;
}
interface IDiscountCodeCreation {
codes_count: number;
completed_at: string;
created_at: string;
failed_count: number;
id: number;
imported_count: number;
price_rule_id: number;
started_at: string;
status: string;
updated_at: string;
}
type DisputeReason =
| 'bank_not_process'
| 'credit_not_processed'
| 'customer_initiated'
| 'debit_not_authorized'
| 'duplicate'
| 'fraudulent'
| 'general'
| 'incorrect_account_details'
| 'insufficient_funds'
| 'product_not_received'
| 'product_unacceptable'
| 'subscription_cancelled'
| 'unrecognized'
| 'credit_not_processed';
type DisputeStatus =
| 'needs_response'
| 'under_review'
| 'charge_refunded'
| 'accepted'
| 'won'
| 'lost';
interface IDispute {
id: number;
order_id: number;
type: 'inquiry' | 'chargeback';
currency: string;
amount: string;
reason: DisputeReason;
network_reason_code: number;
status: DisputeStatus;
evidence_due_by: string;
evidence_sent_on: string;
finalized_on: string;
}
interface IDisputeEvidenceAddress {
address1: string;
address2: string;
city: string;
country: string;
country_code: string;
id: number;
province: string;
province_code: string;
zip: string;
}
interface IDisputeEvidenceFulfillment {
shipping_carrier: number;
shipping_date: string;
shipping_tracking_number: string;
}
interface IDisputeEvidenceFiles {
cancellation_policy_file_id: number | null;
customer_communication_file_id: number | null;
customer_signature_file_id: number | null;
refund_policy_file_id: number | null;
service_documentation_file_id: number | null;
shipping_documentation_file_id: number | null;
uncategorized_file_id: number | null;
}
interface IDisputeEvidence {
access_activity_log: string | null;
billing_address: IDisputeEvidenceAddress;
cancellation_policy_disclosure: string | null;
cancellation_rebuttal: string | null;
created_at: string;
customer_email_address: string;
customer_first_name: string;
customer_last_name: string;
dispute_evidence_files: IDisputeEvidenceFiles;
fulfillments: IDisputeEvidenceFulfillment[];
id: number;
payments_dispute_id: number;
product_description: string;
refund_policy_disclosure: string | null;
refund_refusal_explanation: string | null;
shipping_address: IDisputeEvidenceAddress;
submitted_by_merchant_on: string | null;
uncategorized_text: string;
updated_at: string;
}
interface IUpdateDisputeEvidence {
refund_refusal_explanation: string;
}
type DisputeFileUploadDisputeEvidenceType =
| 'cancellation_policy_file'
| 'customer_communication_file'
| 'customer_signature_file'
| 'refund_policy_file'
| 'service_documentation_file'
| 'shipping_documentation_file'
| 'uncategorized_file';
interface IDisputeFileUpload {
created_at: string;
dispute_evidence_id: number;
dispute_evidence_type: DisputeFileUploadDisputeEvidenceType;
file_size: number;
file_type: string;
filename: string;
id: number;
original_filename: string;
shop_id: number;
updated_at: string;
url: string;
}
interface ICreateDisputeFileUpload {
document_type: DisputeFileUploadDisputeEvidenceType;
filename: string;
mimetype: string;
data: string;
}
interface IDraftOrderNoteAttribute {
name: string;
value: string;
}
type DraftOrderDiscountValueType = 'fixed_amount' | 'percentage';
interface IDraftOrderDiscount {
amount: string;
description: string;
non_applicable_reason: string;
title: string;
value: string;
value_type: DraftOrderDiscountValueType;
}
type DraftOrderLineItemFulfullmentService =
| 'api'
| 'custom'
| 'legacy'
| 'manual';
type DraftOrderLineItemFulfullmentStatus = 'fulfilled' | 'partial';
interface IDraftOrderLineItem {
applied_discount: IDraftOrderDiscount | null;
discount_codes: any[];
fulfillment_service: DraftOrderLineItemFulfullmentService;
fulfillment_status?: DraftOrderLineItemFulfullmentStatus | null;
gift_card: boolean;
grams: number;
key: string;
id: number;
line_price: string;
name: string;
origin_location_id: number;
price: string;
product_id: number;
properties: any | null;
quantity: number;
requires_shipping: boolean;
sku: string;
taxable: boolean;
tax_lines: ICheckoutTaxLine[];
title: string;
variant_id: number;
variant_title: string;
vendor: string;
}
interface IDraftOrder {
applied_discount: IDraftOrderDiscount | null;
billing_address: ICustomerAddress;
completed_at: string | null;
created_at: string;
currency: string;
customer: ICustomer | null;
email: string;
id: number;
invoice_sent_at: string | null;
invoice_url: string;
line_items: IDraftOrderLineItem[];
name: string;
note: string;
note_attributes: IDraftOrderNoteAttribute[];
order_id: number | null;
shipping_address: ICustomerAddress;
shipping_line: string;
status: string;
subtotal_price: string;
tags: string;
tax_exempt: boolean;
tax_lines: string;
taxes_included: boolean;
total_tax: string;
total_price: string;
updated_at: string;
}
interface IEvent {
arguments: any[];
author: string;
body: string | null;
created_at: string;
id: number;
description: string;
path: string;
message: string;
subject_id: number;
subject_type:
| 'Article'
| 'Blog'
| 'Collection'
| 'Comment'
| 'Order'
| 'Page'
| 'Product'
| 'ApiPermission';
verb: string;
}
type IFulfillmentStatus =
| 'cancelled'
| 'error'
| 'failure'