@commercelayer/sdk 4.29.0 → 4.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/api.d.ts +3 -2
- package/lib/cjs/api.js +4 -1
- package/lib/cjs/client.d.ts +5 -1
- package/lib/cjs/client.js +22 -3
- package/lib/cjs/commercelayer.d.ts +3 -2
- package/lib/cjs/commercelayer.js +2 -1
- package/lib/cjs/error.d.ts +1 -0
- package/lib/cjs/error.js +1 -2
- package/lib/cjs/interceptor.d.ts +1 -1
- package/lib/cjs/jsonapi.js +4 -1
- package/lib/cjs/model.d.ts +1 -0
- package/lib/cjs/resources/coupons.d.ts +8 -0
- package/lib/cjs/resources/coupons.js +4 -0
- package/lib/cjs/resources/customers.d.ts +1 -0
- package/lib/cjs/resources/external_promotions.d.ts +3 -0
- package/lib/cjs/resources/external_promotions.js +4 -0
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +3 -0
- package/lib/cjs/resources/fixed_amount_promotions.js +4 -0
- package/lib/cjs/resources/fixed_price_promotions.d.ts +8 -8
- package/lib/cjs/resources/fixed_price_promotions.js +4 -4
- package/lib/cjs/resources/free_gift_promotions.d.ts +8 -8
- package/lib/cjs/resources/free_gift_promotions.js +4 -4
- package/lib/cjs/resources/free_shipping_promotions.d.ts +3 -0
- package/lib/cjs/resources/free_shipping_promotions.js +4 -0
- package/lib/cjs/resources/imports.d.ts +0 -3
- package/lib/cjs/resources/inventory_models.d.ts +3 -0
- package/lib/cjs/resources/line_items.d.ts +5 -0
- package/lib/cjs/resources/line_items.js +4 -0
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +3 -0
- package/lib/cjs/resources/orders.d.ts +1 -0
- package/lib/cjs/resources/parcels.d.ts +3 -3
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +8 -8
- package/lib/cjs/resources/percentage_discount_promotions.js +4 -4
- package/lib/cjs/resources/promotions.d.ts +3 -0
- package/lib/cjs/resources/promotions.js +4 -0
- package/lib/cjs/resources/satispay_payments.d.ts +4 -0
- package/lib/cjs/resources/shipping_methods.d.ts +6 -0
- package/lib/cjs/resources/skus.d.ts +3 -0
- package/lib/cjs/resources/skus.js +4 -0
- package/lib/cjs/resources/stock_items.d.ts +3 -0
- package/lib/cjs/resources/stock_items.js +4 -0
- package/lib/cjs/resources/stock_reservations.d.ts +33 -0
- package/lib/cjs/resources/stock_reservations.js +32 -0
- package/lib/cjs/resources/stripe_payments.d.ts +1 -0
- package/lib/cjs/util.d.ts +1 -0
- package/lib/esm/api.d.ts +3 -2
- package/lib/esm/api.js +2 -0
- package/lib/esm/client.d.ts +5 -1
- package/lib/esm/client.js +22 -3
- package/lib/esm/commercelayer.d.ts +3 -2
- package/lib/esm/commercelayer.js +2 -1
- package/lib/esm/error.d.ts +1 -0
- package/lib/esm/interceptor.d.ts +1 -1
- package/lib/esm/jsonapi.js +4 -1
- package/lib/esm/model.d.ts +1 -0
- package/lib/esm/resources/coupons.d.ts +8 -0
- package/lib/esm/resources/coupons.js +4 -0
- package/lib/esm/resources/customers.d.ts +1 -0
- package/lib/esm/resources/external_promotions.d.ts +3 -0
- package/lib/esm/resources/external_promotions.js +4 -0
- package/lib/esm/resources/fixed_amount_promotions.d.ts +3 -0
- package/lib/esm/resources/fixed_amount_promotions.js +4 -0
- package/lib/esm/resources/fixed_price_promotions.d.ts +8 -8
- package/lib/esm/resources/fixed_price_promotions.js +4 -4
- package/lib/esm/resources/free_gift_promotions.d.ts +8 -8
- package/lib/esm/resources/free_gift_promotions.js +4 -4
- package/lib/esm/resources/free_shipping_promotions.d.ts +3 -0
- package/lib/esm/resources/free_shipping_promotions.js +4 -0
- package/lib/esm/resources/imports.d.ts +0 -3
- package/lib/esm/resources/inventory_models.d.ts +3 -0
- package/lib/esm/resources/line_items.d.ts +5 -0
- package/lib/esm/resources/line_items.js +4 -0
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +3 -0
- package/lib/esm/resources/orders.d.ts +1 -0
- package/lib/esm/resources/parcels.d.ts +3 -3
- package/lib/esm/resources/percentage_discount_promotions.d.ts +8 -8
- package/lib/esm/resources/percentage_discount_promotions.js +4 -4
- package/lib/esm/resources/promotions.d.ts +3 -0
- package/lib/esm/resources/promotions.js +4 -0
- package/lib/esm/resources/satispay_payments.d.ts +4 -0
- package/lib/esm/resources/shipping_methods.d.ts +6 -0
- package/lib/esm/resources/skus.d.ts +3 -0
- package/lib/esm/resources/skus.js +4 -0
- package/lib/esm/resources/stock_items.d.ts +3 -0
- package/lib/esm/resources/stock_items.js +4 -0
- package/lib/esm/resources/stock_reservations.d.ts +33 -0
- package/lib/esm/resources/stock_reservations.js +30 -0
- package/lib/esm/resources/stripe_payments.d.ts +1 -0
- package/lib/esm/util.d.ts +1 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
package/lib/cjs/api.d.ts
CHANGED
@@ -102,6 +102,7 @@ export { default as Skus } from './resources/skus';
|
|
102
102
|
export { default as StockItems } from './resources/stock_items';
|
103
103
|
export { default as StockLineItems } from './resources/stock_line_items';
|
104
104
|
export { default as StockLocations } from './resources/stock_locations';
|
105
|
+
export { default as StockReservations } from './resources/stock_reservations';
|
105
106
|
export { default as StockTransfers } from './resources/stock_transfers';
|
106
107
|
export { default as StripeGateways } from './resources/stripe_gateways';
|
107
108
|
export { default as StripePayments } from './resources/stripe_payments';
|
@@ -115,8 +116,8 @@ export { default as Transactions } from './resources/transactions';
|
|
115
116
|
export { default as Voids } from './resources/voids';
|
116
117
|
export { default as Webhooks } from './resources/webhooks';
|
117
118
|
export { default as WireTransfers } from './resources/wire_transfers';
|
118
|
-
export type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'event_callbacks' | 'events' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'geocoders' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_factories' | 'order_subscription_items' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'recurring_order_copies' | 'refunds' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers';
|
119
|
-
export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "axerve_gateways", "axerve_payments", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "coupon_codes_promotion_rules", "coupon_recipients", "coupons", "customer_addresses", "customer_groups", "customer_password_resets", "customer_payment_sources", "customer_subscriptions", "customers", "delivery_lead_times", "event_callbacks", "events", "exports", "external_gateways", "external_payments", "external_promotions", "external_tax_calculators", "fixed_amount_promotions", "fixed_price_promotions", "free_gift_promotions", "free_shipping_promotions", "geocoders", "gift_card_recipients", "gift_cards", "google_geocoders", "imports", "in_stock_subscriptions", "inventory_models", "inventory_return_locations", "inventory_stock_locations", "klarna_gateways", "klarna_payments", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_factories", "order_subscription_items", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_frequency_tiers", "price_lists", "price_tiers", "price_volume_tiers", "prices", "promotion_rules", "promotions", "recurring_order_copies", "refunds", "return_line_items", "returns", "satispay_gateways", "satispay_payments", "shipments", "shipping_categories", "shipping_method_tiers", "shipping_methods", "shipping_weight_tiers", "shipping_zones", "sku_list_items", "sku_list_promotion_rules", "sku_lists", "sku_options", "skus", "stock_items", "stock_line_items", "stock_locations", "stock_transfers", "stripe_gateways", "stripe_payments", "subscription_models", "tags", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "voids", "webhooks", "wire_transfers"];
|
119
|
+
export type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'axerve_gateways' | 'axerve_payments' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | 'cleanups' | 'coupon_codes_promotion_rules' | 'coupon_recipients' | 'coupons' | 'customer_addresses' | 'customer_groups' | 'customer_password_resets' | 'customer_payment_sources' | 'customer_subscriptions' | 'customers' | 'delivery_lead_times' | 'event_callbacks' | 'events' | 'exports' | 'external_gateways' | 'external_payments' | 'external_promotions' | 'external_tax_calculators' | 'fixed_amount_promotions' | 'fixed_price_promotions' | 'free_gift_promotions' | 'free_shipping_promotions' | 'geocoders' | 'gift_card_recipients' | 'gift_cards' | 'google_geocoders' | 'imports' | 'in_stock_subscriptions' | 'inventory_models' | 'inventory_return_locations' | 'inventory_stock_locations' | 'klarna_gateways' | 'klarna_payments' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_factories' | 'order_subscription_items' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_frequency_tiers' | 'price_lists' | 'price_tiers' | 'price_volume_tiers' | 'prices' | 'promotion_rules' | 'promotions' | 'recurring_order_copies' | 'refunds' | 'return_line_items' | 'returns' | 'satispay_gateways' | 'satispay_payments' | 'shipments' | 'shipping_categories' | 'shipping_method_tiers' | 'shipping_methods' | 'shipping_weight_tiers' | 'shipping_zones' | 'sku_list_items' | 'sku_list_promotion_rules' | 'sku_lists' | 'sku_options' | 'skus' | 'stock_items' | 'stock_line_items' | 'stock_locations' | 'stock_reservations' | 'stock_transfers' | 'stripe_gateways' | 'stripe_payments' | 'subscription_models' | 'tags' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers';
|
120
|
+
export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "axerve_gateways", "axerve_payments", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "cleanups", "coupon_codes_promotion_rules", "coupon_recipients", "coupons", "customer_addresses", "customer_groups", "customer_password_resets", "customer_payment_sources", "customer_subscriptions", "customers", "delivery_lead_times", "event_callbacks", "events", "exports", "external_gateways", "external_payments", "external_promotions", "external_tax_calculators", "fixed_amount_promotions", "fixed_price_promotions", "free_gift_promotions", "free_shipping_promotions", "geocoders", "gift_card_recipients", "gift_cards", "google_geocoders", "imports", "in_stock_subscriptions", "inventory_models", "inventory_return_locations", "inventory_stock_locations", "klarna_gateways", "klarna_payments", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_factories", "order_subscription_items", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_frequency_tiers", "price_lists", "price_tiers", "price_volume_tiers", "prices", "promotion_rules", "promotions", "recurring_order_copies", "refunds", "return_line_items", "returns", "satispay_gateways", "satispay_payments", "shipments", "shipping_categories", "shipping_method_tiers", "shipping_methods", "shipping_weight_tiers", "shipping_zones", "sku_list_items", "sku_list_promotion_rules", "sku_lists", "sku_options", "skus", "stock_items", "stock_line_items", "stock_locations", "stock_reservations", "stock_transfers", "stripe_gateways", "stripe_payments", "subscription_models", "tags", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "voids", "webhooks", "wire_transfers"];
|
120
121
|
export type RetrievableResourceType = ResourceTypeLock;
|
121
122
|
export type RetrievableResource = {
|
122
123
|
type: RetrievableResourceType;
|
package/lib/cjs/api.js
CHANGED
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
exports.InventoryStockLocations = exports.InventoryReturnLocations = exports.InventoryModels = exports.InStockSubscriptions = exports.Imports = exports.GoogleGeocoders = exports.GiftCards = exports.GiftCardRecipients = exports.Geocoders = exports.FreeShippingPromotions = exports.FreeGiftPromotions = exports.FixedPricePromotions = exports.FixedAmountPromotions = exports.ExternalTaxCalculators = exports.ExternalPromotions = exports.ExternalPayments = exports.ExternalGateways = exports.Exports = exports.Events = exports.EventCallbacks = exports.DeliveryLeadTimes = exports.Customers = exports.CustomerSubscriptions = exports.CustomerPaymentSources = exports.CustomerPasswordResets = exports.CustomerGroups = exports.CustomerAddresses = exports.Coupons = exports.CouponRecipients = exports.CouponCodesPromotionRules = exports.Cleanups = exports.CheckoutComPayments = exports.CheckoutComGateways = exports.CarrierAccounts = exports.Captures = exports.Bundles = exports.BraintreePayments = exports.BraintreeGateways = exports.BingGeocoders = exports.BillingInfoValidationRules = exports.AxervePayments = exports.AxerveGateways = exports.AvalaraAccounts = exports.Authorizations = exports.Attachments = exports.Applications = exports.AdyenPayments = exports.AdyenGateways = exports.Adjustments = exports.Addresses = void 0;
|
7
7
|
exports.StockLineItems = exports.StockItems = exports.Skus = exports.SkuOptions = exports.SkuLists = exports.SkuListPromotionRules = exports.SkuListItems = exports.ShippingZones = exports.ShippingWeightTiers = exports.ShippingMethods = exports.ShippingMethodTiers = exports.ShippingCategories = exports.Shipments = exports.SatispayPayments = exports.SatispayGateways = exports.Returns = exports.ReturnLineItems = exports.Refunds = exports.RecurringOrderCopies = exports.Promotions = exports.PromotionRules = exports.Prices = exports.PriceVolumeTiers = exports.PriceTiers = exports.PriceLists = exports.PriceFrequencyTiers = exports.PercentageDiscountPromotions = exports.PaypalPayments = exports.PaypalGateways = exports.PaymentMethods = exports.PaymentGateways = exports.Parcels = exports.ParcelLineItems = exports.Packages = exports.Organizations = exports.Orders = exports.OrderValidationRules = exports.OrderSubscriptions = exports.OrderSubscriptionItems = exports.OrderFactories = exports.OrderCopies = exports.OrderAmountPromotionRules = exports.Merchants = exports.Markets = exports.ManualTaxCalculators = exports.ManualGateways = exports.LineItems = exports.LineItemOptions = exports.KlarnaPayments = exports.KlarnaGateways = void 0;
|
8
|
-
exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Transactions = exports.TaxjarAccounts = exports.TaxRules = exports.TaxCategories = exports.TaxCalculators = exports.Tags = exports.SubscriptionModels = exports.StripePayments = exports.StripeGateways = exports.StockTransfers = exports.StockLocations = void 0;
|
8
|
+
exports.resourceList = exports.WireTransfers = exports.Webhooks = exports.Voids = exports.Transactions = exports.TaxjarAccounts = exports.TaxRules = exports.TaxCategories = exports.TaxCalculators = exports.Tags = exports.SubscriptionModels = exports.StripePayments = exports.StripeGateways = exports.StockTransfers = exports.StockReservations = exports.StockLocations = void 0;
|
9
9
|
// ##__API_RESOURCES_START__##
|
10
10
|
// ##__API_RESOURCES_TEMPLATE:: export { default as ##__RESOURCE_CLASS__## } from './resources/##__RESOURCE_TYPE__##'
|
11
11
|
/**
|
@@ -213,6 +213,8 @@ var stock_line_items_1 = require("./resources/stock_line_items");
|
|
213
213
|
Object.defineProperty(exports, "StockLineItems", { enumerable: true, get: function () { return __importDefault(stock_line_items_1).default; } });
|
214
214
|
var stock_locations_1 = require("./resources/stock_locations");
|
215
215
|
Object.defineProperty(exports, "StockLocations", { enumerable: true, get: function () { return __importDefault(stock_locations_1).default; } });
|
216
|
+
var stock_reservations_1 = require("./resources/stock_reservations");
|
217
|
+
Object.defineProperty(exports, "StockReservations", { enumerable: true, get: function () { return __importDefault(stock_reservations_1).default; } });
|
216
218
|
var stock_transfers_1 = require("./resources/stock_transfers");
|
217
219
|
Object.defineProperty(exports, "StockTransfers", { enumerable: true, get: function () { return __importDefault(stock_transfers_1).default; } });
|
218
220
|
var stripe_gateways_1 = require("./resources/stripe_gateways");
|
@@ -343,6 +345,7 @@ exports.resourceList = [
|
|
343
345
|
'stock_items',
|
344
346
|
'stock_line_items',
|
345
347
|
'stock_locations',
|
348
|
+
'stock_reservations',
|
346
349
|
'stock_transfers',
|
347
350
|
'stripe_gateways',
|
348
351
|
'stripe_payments',
|
package/lib/cjs/client.d.ts
CHANGED
@@ -5,12 +5,15 @@ import type { InterceptorManager } from './interceptor';
|
|
5
5
|
import type { Agent as HttpAgent } from 'http';
|
6
6
|
import type { Agent as HttpsAgent } from 'https';
|
7
7
|
type ProxyConfig = AxiosProxyConfig | false;
|
8
|
+
type RequestParams = Record<string, string | number | boolean>;
|
9
|
+
type RequestHeaders = Record<string, string>;
|
8
10
|
type RequestConfig = {
|
9
11
|
timeout?: number;
|
10
|
-
params?:
|
12
|
+
params?: RequestParams;
|
11
13
|
httpAgent?: HttpAgent;
|
12
14
|
httpsAgent?: HttpsAgent;
|
13
15
|
proxy?: ProxyConfig;
|
16
|
+
headers?: RequestHeaders;
|
14
17
|
};
|
15
18
|
type ApiClientInitConfig = {
|
16
19
|
organization: string;
|
@@ -26,6 +29,7 @@ declare class ApiClient {
|
|
26
29
|
private constructor();
|
27
30
|
config(config: ApiClientConfig): void;
|
28
31
|
request(method: Method, path: string, body?: any, options?: ApiClientConfig): Promise<any>;
|
32
|
+
private customHeaders;
|
29
33
|
}
|
30
34
|
export default ApiClient;
|
31
35
|
export type { ApiClientInitConfig, ApiClientConfig, RequestConfig };
|
package/lib/cjs/client.js
CHANGED
@@ -31,8 +31,11 @@ const handleError = (error) => {
|
|
31
31
|
const apiError = new error_1.ApiError(sdkError);
|
32
32
|
apiError.type = error_1.ErrorType.RESPONSE;
|
33
33
|
apiError.status = error.response.status;
|
34
|
+
apiError.statusText = error.response.statusText;
|
34
35
|
apiError.code = String(apiError.status);
|
35
36
|
apiError.errors = error.response.data.errors;
|
37
|
+
if (!apiError.message && apiError.statusText)
|
38
|
+
apiError.message = apiError.statusText;
|
36
39
|
sdkError = apiError;
|
37
40
|
}
|
38
41
|
else if (error.request) {
|
@@ -71,13 +74,16 @@ class ApiClient {
|
|
71
74
|
httpAgent: options.httpAgent,
|
72
75
|
httpsAgent: options.httpsAgent,
|
73
76
|
};
|
77
|
+
// Set custom headers
|
78
|
+
const customHeaders = this.customHeaders(options.headers);
|
74
79
|
const axiosOptions = {
|
75
80
|
baseURL: this.baseUrl,
|
76
81
|
timeout: config_1.default.client.timeout,
|
77
82
|
headers: {
|
83
|
+
...customHeaders,
|
78
84
|
'Accept': 'application/vnd.api+json',
|
79
85
|
'Content-Type': 'application/vnd.api+json',
|
80
|
-
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
86
|
+
'Authorization': 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f")
|
81
87
|
},
|
82
88
|
...axiosConfig
|
83
89
|
};
|
@@ -104,6 +110,8 @@ class ApiClient {
|
|
104
110
|
__classPrivateFieldSet(this, _ApiClient_accessToken, config.accessToken, "f");
|
105
111
|
def.headers.common.Authorization = 'Bearer ' + __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
106
112
|
}
|
113
|
+
if (config.headers)
|
114
|
+
def.headers.common = this.customHeaders(config.headers);
|
107
115
|
}
|
108
116
|
async request(method, path, body, options) {
|
109
117
|
debug('request %s %s, %O, %O', method, path, body || {}, options || {});
|
@@ -112,8 +120,10 @@ class ApiClient {
|
|
112
120
|
// Runtime request parameters
|
113
121
|
const baseUrl = (options === null || options === void 0 ? void 0 : options.organization) ? baseURL(options.organization, options.domain) : undefined;
|
114
122
|
const accessToken = (options === null || options === void 0 ? void 0 : options.accessToken) || __classPrivateFieldGet(this, _ApiClient_accessToken, "f");
|
115
|
-
const headers =
|
116
|
-
|
123
|
+
const headers = this.customHeaders(options === null || options === void 0 ? void 0 : options.headers);
|
124
|
+
if (accessToken)
|
125
|
+
headers.Authorization = 'Bearer ' + accessToken;
|
126
|
+
const requestParams = { method, baseURL: baseUrl, url, data, ...options, headers };
|
117
127
|
debug('request params: %O', requestParams);
|
118
128
|
// const start = Date.now()
|
119
129
|
return __classPrivateFieldGet(this, _ApiClient_client, "f").request(requestParams)
|
@@ -121,6 +131,15 @@ class ApiClient {
|
|
121
131
|
.catch(error => handleError(error));
|
122
132
|
// .finally(() => console.log(`<<-- ${method} ${path} ${Date.now() - start}`))
|
123
133
|
}
|
134
|
+
customHeaders(headers) {
|
135
|
+
const customHeaders = {};
|
136
|
+
if (headers) {
|
137
|
+
for (const [name, value] of Object.entries(headers))
|
138
|
+
if (!['accept', 'content-type', 'authorization'].includes(name.toLowerCase()))
|
139
|
+
customHeaders[name] = value;
|
140
|
+
}
|
141
|
+
return customHeaders;
|
142
|
+
}
|
124
143
|
}
|
125
144
|
_ApiClient_accessToken = new WeakMap(), _ApiClient_client = new WeakMap();
|
126
145
|
exports.default = ApiClient;
|
@@ -2,7 +2,7 @@ import * as api from './api';
|
|
2
2
|
import type { ApiError } from './error';
|
3
3
|
import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor';
|
4
4
|
import { type ResourcesInitConfig } from './resource';
|
5
|
-
declare const OPEN_API_SCHEMA_VERSION = "4.
|
5
|
+
declare const OPEN_API_SCHEMA_VERSION = "4.8.0";
|
6
6
|
export { OPEN_API_SCHEMA_VERSION };
|
7
7
|
type SdkConfig = Record<string, unknown>;
|
8
8
|
type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig;
|
@@ -10,7 +10,7 @@ type CommerceLayerConfig = Partial<CommerceLayerInitConfig>;
|
|
10
10
|
declare class CommerceLayerClient {
|
11
11
|
#private;
|
12
12
|
static get openApiSchemaVersion(): string;
|
13
|
-
readonly openApiSchemaVersion = "4.
|
13
|
+
readonly openApiSchemaVersion = "4.8.0";
|
14
14
|
addresses: api.Addresses;
|
15
15
|
adjustments: api.Adjustments;
|
16
16
|
adyen_gateways: api.AdyenGateways;
|
@@ -112,6 +112,7 @@ declare class CommerceLayerClient {
|
|
112
112
|
stock_items: api.StockItems;
|
113
113
|
stock_line_items: api.StockLineItems;
|
114
114
|
stock_locations: api.StockLocations;
|
115
|
+
stock_reservations: api.StockReservations;
|
115
116
|
stock_transfers: api.StockTransfers;
|
116
117
|
stripe_gateways: api.StripeGateways;
|
117
118
|
stripe_payments: api.StripePayments;
|
package/lib/cjs/commercelayer.js
CHANGED
@@ -45,7 +45,7 @@ const resource_1 = __importDefault(require("./resource"));
|
|
45
45
|
const debug_1 = __importDefault(require("./debug"));
|
46
46
|
const debug = (0, debug_1.default)('commercelayer');
|
47
47
|
// Autogenerated schema version number, do not remove this line
|
48
|
-
const OPEN_API_SCHEMA_VERSION = '4.
|
48
|
+
const OPEN_API_SCHEMA_VERSION = '4.8.0';
|
49
49
|
exports.OPEN_API_SCHEMA_VERSION = OPEN_API_SCHEMA_VERSION;
|
50
50
|
class CommerceLayerClient {
|
51
51
|
static get openApiSchemaVersion() { return OPEN_API_SCHEMA_VERSION; }
|
@@ -160,6 +160,7 @@ class CommerceLayerClient {
|
|
160
160
|
this.stock_items = new api.StockItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
161
161
|
this.stock_line_items = new api.StockLineItems(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
162
162
|
this.stock_locations = new api.StockLocations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
163
|
+
this.stock_reservations = new api.StockReservations(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
163
164
|
this.stock_transfers = new api.StockTransfers(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
164
165
|
this.stripe_gateways = new api.StripeGateways(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
165
166
|
this.stripe_payments = new api.StripePayments(__classPrivateFieldGet(this, _CommerceLayerClient_adapter, "f"));
|
package/lib/cjs/error.d.ts
CHANGED
package/lib/cjs/error.js
CHANGED
@@ -8,8 +8,7 @@ var ErrorType;
|
|
8
8
|
ErrorType["RESPONSE"] = "response";
|
9
9
|
ErrorType["GENERIC"] = "generic";
|
10
10
|
ErrorType["CANCEL"] = "cancel";
|
11
|
-
})(ErrorType || (ErrorType = {}));
|
12
|
-
exports.ErrorType = ErrorType;
|
11
|
+
})(ErrorType || (exports.ErrorType = ErrorType = {}));
|
13
12
|
class SdkError extends Error {
|
14
13
|
static isSdkError(error) {
|
15
14
|
return error && [SdkError.NAME, ApiError.NAME].includes(error.name) && Object.values(ErrorType).includes(error.type);
|
package/lib/cjs/interceptor.d.ts
CHANGED
@@ -7,7 +7,7 @@ type RequestObj = AxiosRequestConfig;
|
|
7
7
|
type RequestInterceptor = (request: RequestObj) => RequestObj | Promise<RequestObj>;
|
8
8
|
type ResponseObj = AxiosResponse;
|
9
9
|
type ResponseInterceptor = (response: ResponseObj) => ResponseObj;
|
10
|
-
type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-count' | 'x-ratelimit-period';
|
10
|
+
type ApiHeadersList = 'x-ratelimit-limit' | 'x-ratelimit-count' | 'x-ratelimit-period' | 'x-ratelimit-interval' | 'x-ratelimit-remaining';
|
11
11
|
type ApiHeaders = {
|
12
12
|
[key in ApiHeadersList]: string | number | boolean;
|
13
13
|
};
|
package/lib/cjs/jsonapi.js
CHANGED
@@ -64,7 +64,10 @@ const normalize = (resource) => {
|
|
64
64
|
if (['type', 'id'].includes(field))
|
65
65
|
continue;
|
66
66
|
const value = resource[field];
|
67
|
-
if (value && (0, common_1.isResourceType)(value) && value.id === null) {
|
67
|
+
if (Array.isArray(value) && (value.length === 1) && (0, common_1.isResourceType)(value[0]) && (value[0].id === null)) {
|
68
|
+
relationships[field] = { data: [] };
|
69
|
+
}
|
70
|
+
else if (value && (0, common_1.isResourceType)(value) && (value.id === null)) {
|
68
71
|
relationships[field] = { data: null };
|
69
72
|
}
|
70
73
|
else if (value && ((0, common_1.isResourceId)(value) || (Array.isArray(value) && (0, common_1.isResourceId)(value[0])))) {
|
package/lib/cjs/model.d.ts
CHANGED
@@ -102,6 +102,7 @@ export type { Sku, SkuCreate, SkuUpdate } from './resources/skus';
|
|
102
102
|
export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items';
|
103
103
|
export type { StockLineItem } from './resources/stock_line_items';
|
104
104
|
export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations';
|
105
|
+
export type { StockReservation } from './resources/stock_reservations';
|
105
106
|
export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers';
|
106
107
|
export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways';
|
107
108
|
export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments';
|
@@ -2,6 +2,7 @@ import { ApiResource } from '../resource';
|
|
2
2
|
import type { Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
3
3
|
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
4
4
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
5
|
+
import type { CouponRecipient, CouponRecipientType } from './coupon_recipients';
|
5
6
|
import type { Event } from './events';
|
6
7
|
import type { Tag, TagType } from './tags';
|
7
8
|
type CouponType = 'coupons';
|
@@ -11,6 +12,9 @@ type CouponRel = ResourceRel & {
|
|
11
12
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
12
13
|
type: CouponCodesPromotionRuleType;
|
13
14
|
};
|
15
|
+
type CouponRecipientRel = ResourceRel & {
|
16
|
+
type: CouponRecipientType;
|
17
|
+
};
|
14
18
|
type TagRel = ResourceRel & {
|
15
19
|
type: TagType;
|
16
20
|
};
|
@@ -22,6 +26,7 @@ interface Coupon extends Resource {
|
|
22
26
|
usage_count?: number | null;
|
23
27
|
recipient_email?: string | null;
|
24
28
|
promotion_rule?: CouponCodesPromotionRule | null;
|
29
|
+
coupon_recipient?: CouponRecipient | null;
|
25
30
|
events?: Event[] | null;
|
26
31
|
tags?: Tag[] | null;
|
27
32
|
}
|
@@ -31,6 +36,7 @@ interface CouponCreate extends ResourceCreate {
|
|
31
36
|
usage_limit?: number | null;
|
32
37
|
recipient_email?: string | null;
|
33
38
|
promotion_rule: CouponCodesPromotionRuleRel;
|
39
|
+
coupon_recipient?: CouponRecipientRel | null;
|
34
40
|
tags?: TagRel[] | null;
|
35
41
|
}
|
36
42
|
interface CouponUpdate extends ResourceUpdate {
|
@@ -39,6 +45,7 @@ interface CouponUpdate extends ResourceUpdate {
|
|
39
45
|
usage_limit?: number | null;
|
40
46
|
recipient_email?: string | null;
|
41
47
|
promotion_rule?: CouponCodesPromotionRuleRel | null;
|
48
|
+
coupon_recipient?: CouponRecipientRel | null;
|
42
49
|
tags?: TagRel[] | null;
|
43
50
|
}
|
44
51
|
declare class Coupons extends ApiResource<Coupon> {
|
@@ -47,6 +54,7 @@ declare class Coupons extends ApiResource<Coupon> {
|
|
47
54
|
update(resource: CouponUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Coupon>;
|
48
55
|
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
49
56
|
promotion_rule(couponId: string | Coupon, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
57
|
+
coupon_recipient(couponId: string | Coupon, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponRecipient>;
|
50
58
|
events(couponId: string | Coupon, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
51
59
|
tags(couponId: string | Coupon, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
52
60
|
isCoupon(resource: any): resource is Coupon;
|
@@ -15,6 +15,10 @@ class Coupons extends resource_1.ApiResource {
|
|
15
15
|
const _couponId = couponId.id || couponId;
|
16
16
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `coupons/${_couponId}/promotion_rule`, params, options);
|
17
17
|
}
|
18
|
+
async coupon_recipient(couponId, params, options) {
|
19
|
+
const _couponId = couponId.id || couponId;
|
20
|
+
return this.resources.fetch({ type: 'coupon_recipients' }, `coupons/${_couponId}/coupon_recipient`, params, options);
|
21
|
+
}
|
18
22
|
async events(couponId, params, options) {
|
19
23
|
const _couponId = couponId.id || couponId;
|
20
24
|
return this.resources.fetch({ type: 'events' }, `coupons/${_couponId}/events`, params, options);
|
@@ -27,6 +27,7 @@ interface Customer extends Resource {
|
|
27
27
|
email: string;
|
28
28
|
status: 'prospect' | 'acquired' | 'repeat';
|
29
29
|
has_password?: boolean | null;
|
30
|
+
total_orders_count?: number | null;
|
30
31
|
customer_group?: CustomerGroup | null;
|
31
32
|
customer_addresses?: CustomerAddress[] | null;
|
32
33
|
customer_payment_sources?: CustomerPaymentSource[] | null;
|
@@ -6,6 +6,7 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
|
|
6
6
|
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
|
+
import type { SkuList } from './sku_lists';
|
9
10
|
import type { Attachment } from './attachments';
|
10
11
|
import type { Event } from './events';
|
11
12
|
import type { Tag, TagType } from './tags';
|
@@ -47,6 +48,7 @@ interface ExternalPromotion extends Resource {
|
|
47
48
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
48
49
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
49
50
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
51
|
+
sku_list?: SkuList | null;
|
50
52
|
attachments?: Attachment[] | null;
|
51
53
|
events?: Event[] | null;
|
52
54
|
tags?: Tag[] | null;
|
@@ -88,6 +90,7 @@ declare class ExternalPromotions extends ApiResource<ExternalPromotion> {
|
|
88
90
|
order_amount_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
89
91
|
sku_list_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
90
92
|
coupon_codes_promotion_rule(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
93
|
+
sku_list(externalPromotionId: string | ExternalPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
91
94
|
attachments(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
92
95
|
events(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
93
96
|
tags(externalPromotionId: string | ExternalPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -27,6 +27,10 @@ class ExternalPromotions extends resource_1.ApiResource {
|
|
27
27
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `external_promotions/${_externalPromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async sku_list(externalPromotionId, params, options) {
|
31
|
+
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
32
|
+
return this.resources.fetch({ type: 'sku_lists' }, `external_promotions/${_externalPromotionId}/sku_list`, params, options);
|
33
|
+
}
|
30
34
|
async attachments(externalPromotionId, params, options) {
|
31
35
|
const _externalPromotionId = externalPromotionId.id || externalPromotionId;
|
32
36
|
return this.resources.fetch({ type: 'attachments' }, `external_promotions/${_externalPromotionId}/attachments`, params, options);
|
@@ -6,6 +6,7 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
|
|
6
6
|
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
|
+
import type { SkuList } from './sku_lists';
|
9
10
|
import type { Attachment } from './attachments';
|
10
11
|
import type { Event } from './events';
|
11
12
|
import type { Tag, TagType } from './tags';
|
@@ -48,6 +49,7 @@ interface FixedAmountPromotion extends Resource {
|
|
48
49
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
49
50
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
50
51
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
52
|
+
sku_list?: SkuList | null;
|
51
53
|
attachments?: Attachment[] | null;
|
52
54
|
events?: Event[] | null;
|
53
55
|
tags?: Tag[] | null;
|
@@ -89,6 +91,7 @@ declare class FixedAmountPromotions extends ApiResource<FixedAmountPromotion> {
|
|
89
91
|
order_amount_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
90
92
|
sku_list_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
91
93
|
coupon_codes_promotion_rule(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
94
|
+
sku_list(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
92
95
|
attachments(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
93
96
|
events(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
94
97
|
tags(fixedAmountPromotionId: string | FixedAmountPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
@@ -27,6 +27,10 @@ class FixedAmountPromotions extends resource_1.ApiResource {
|
|
27
27
|
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async sku_list(fixedAmountPromotionId, params, options) {
|
31
|
+
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
32
|
+
return this.resources.fetch({ type: 'sku_lists' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/sku_list`, params, options);
|
33
|
+
}
|
30
34
|
async attachments(fixedAmountPromotionId, params, options) {
|
31
35
|
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
|
32
36
|
return this.resources.fetch({ type: 'attachments' }, `fixed_amount_promotions/${_fixedAmountPromotionId}/attachments`, params, options);
|
@@ -6,10 +6,10 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
|
|
6
6
|
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
9
10
|
import type { Attachment } from './attachments';
|
10
11
|
import type { Event } from './events';
|
11
12
|
import type { Tag, TagType } from './tags';
|
12
|
-
import type { SkuList, SkuListType } from './sku_lists';
|
13
13
|
import type { Sku } from './skus';
|
14
14
|
type FixedPricePromotionType = 'fixed_price_promotions';
|
15
15
|
type FixedPricePromotionRel = ResourceRel & {
|
@@ -30,12 +30,12 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
30
30
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
31
31
|
type: CouponCodesPromotionRuleType;
|
32
32
|
};
|
33
|
-
type TagRel = ResourceRel & {
|
34
|
-
type: TagType;
|
35
|
-
};
|
36
33
|
type SkuListRel = ResourceRel & {
|
37
34
|
type: SkuListType;
|
38
35
|
};
|
36
|
+
type TagRel = ResourceRel & {
|
37
|
+
type: TagType;
|
38
|
+
};
|
39
39
|
interface FixedPricePromotion extends Resource {
|
40
40
|
readonly type: FixedPricePromotionType;
|
41
41
|
name: string;
|
@@ -53,10 +53,10 @@ interface FixedPricePromotion extends Resource {
|
|
53
53
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
54
54
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
55
55
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
56
|
+
sku_list?: SkuList | null;
|
56
57
|
attachments?: Attachment[] | null;
|
57
58
|
events?: Event[] | null;
|
58
59
|
tags?: Tag[] | null;
|
59
|
-
sku_list?: SkuList | null;
|
60
60
|
skus?: Sku[] | null;
|
61
61
|
}
|
62
62
|
interface FixedPricePromotionCreate extends ResourceCreate {
|
@@ -71,8 +71,8 @@ interface FixedPricePromotionCreate extends ResourceCreate {
|
|
71
71
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
72
72
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
73
73
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
74
|
-
tags?: TagRel[] | null;
|
75
74
|
sku_list: SkuListRel;
|
75
|
+
tags?: TagRel[] | null;
|
76
76
|
}
|
77
77
|
interface FixedPricePromotionUpdate extends ResourceUpdate {
|
78
78
|
name?: string | null;
|
@@ -86,8 +86,8 @@ interface FixedPricePromotionUpdate extends ResourceUpdate {
|
|
86
86
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
87
87
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
88
88
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
89
|
-
tags?: TagRel[] | null;
|
90
89
|
sku_list?: SkuListRel | null;
|
90
|
+
tags?: TagRel[] | null;
|
91
91
|
}
|
92
92
|
declare class FixedPricePromotions extends ApiResource<FixedPricePromotion> {
|
93
93
|
static readonly TYPE: FixedPricePromotionType;
|
@@ -98,10 +98,10 @@ declare class FixedPricePromotions extends ApiResource<FixedPricePromotion> {
|
|
98
98
|
order_amount_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
99
99
|
sku_list_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
100
100
|
coupon_codes_promotion_rule(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
101
|
+
sku_list(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
101
102
|
attachments(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
102
103
|
events(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
103
104
|
tags(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
104
|
-
sku_list(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
105
105
|
skus(fixedPricePromotionId: string | FixedPricePromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
106
106
|
isFixedPricePromotion(resource: any): resource is FixedPricePromotion;
|
107
107
|
relationship(id: string | ResourceId | null): FixedPricePromotionRel;
|
@@ -27,6 +27,10 @@ class FixedPricePromotions extends resource_1.ApiResource {
|
|
27
27
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `fixed_price_promotions/${_fixedPricePromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async sku_list(fixedPricePromotionId, params, options) {
|
31
|
+
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
32
|
+
return this.resources.fetch({ type: 'sku_lists' }, `fixed_price_promotions/${_fixedPricePromotionId}/sku_list`, params, options);
|
33
|
+
}
|
30
34
|
async attachments(fixedPricePromotionId, params, options) {
|
31
35
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
32
36
|
return this.resources.fetch({ type: 'attachments' }, `fixed_price_promotions/${_fixedPricePromotionId}/attachments`, params, options);
|
@@ -39,10 +43,6 @@ class FixedPricePromotions extends resource_1.ApiResource {
|
|
39
43
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
40
44
|
return this.resources.fetch({ type: 'tags' }, `fixed_price_promotions/${_fixedPricePromotionId}/tags`, params, options);
|
41
45
|
}
|
42
|
-
async sku_list(fixedPricePromotionId, params, options) {
|
43
|
-
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
44
|
-
return this.resources.fetch({ type: 'sku_lists' }, `fixed_price_promotions/${_fixedPricePromotionId}/sku_list`, params, options);
|
45
|
-
}
|
46
46
|
async skus(fixedPricePromotionId, params, options) {
|
47
47
|
const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId;
|
48
48
|
return this.resources.fetch({ type: 'skus' }, `fixed_price_promotions/${_fixedPricePromotionId}/skus`, params, options);
|
@@ -6,10 +6,10 @@ import type { PromotionRule, PromotionRuleType } from './promotion_rules';
|
|
6
6
|
import type { OrderAmountPromotionRule, OrderAmountPromotionRuleType } from './order_amount_promotion_rules';
|
7
7
|
import type { SkuListPromotionRule, SkuListPromotionRuleType } from './sku_list_promotion_rules';
|
8
8
|
import type { CouponCodesPromotionRule, CouponCodesPromotionRuleType } from './coupon_codes_promotion_rules';
|
9
|
+
import type { SkuList, SkuListType } from './sku_lists';
|
9
10
|
import type { Attachment } from './attachments';
|
10
11
|
import type { Event } from './events';
|
11
12
|
import type { Tag, TagType } from './tags';
|
12
|
-
import type { SkuList, SkuListType } from './sku_lists';
|
13
13
|
import type { Sku } from './skus';
|
14
14
|
type FreeGiftPromotionType = 'free_gift_promotions';
|
15
15
|
type FreeGiftPromotionRel = ResourceRel & {
|
@@ -30,12 +30,12 @@ type SkuListPromotionRuleRel = ResourceRel & {
|
|
30
30
|
type CouponCodesPromotionRuleRel = ResourceRel & {
|
31
31
|
type: CouponCodesPromotionRuleType;
|
32
32
|
};
|
33
|
-
type TagRel = ResourceRel & {
|
34
|
-
type: TagType;
|
35
|
-
};
|
36
33
|
type SkuListRel = ResourceRel & {
|
37
34
|
type: SkuListType;
|
38
35
|
};
|
36
|
+
type TagRel = ResourceRel & {
|
37
|
+
type: TagType;
|
38
|
+
};
|
39
39
|
interface FreeGiftPromotion extends Resource {
|
40
40
|
readonly type: FreeGiftPromotionType;
|
41
41
|
name: string;
|
@@ -51,10 +51,10 @@ interface FreeGiftPromotion extends Resource {
|
|
51
51
|
order_amount_promotion_rule?: OrderAmountPromotionRule | null;
|
52
52
|
sku_list_promotion_rule?: SkuListPromotionRule | null;
|
53
53
|
coupon_codes_promotion_rule?: CouponCodesPromotionRule | null;
|
54
|
+
sku_list?: SkuList | null;
|
54
55
|
attachments?: Attachment[] | null;
|
55
56
|
events?: Event[] | null;
|
56
57
|
tags?: Tag[] | null;
|
57
|
-
sku_list?: SkuList | null;
|
58
58
|
skus?: Sku[] | null;
|
59
59
|
}
|
60
60
|
interface FreeGiftPromotionCreate extends ResourceCreate {
|
@@ -69,8 +69,8 @@ interface FreeGiftPromotionCreate extends ResourceCreate {
|
|
69
69
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
70
70
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
71
71
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
72
|
-
tags?: TagRel[] | null;
|
73
72
|
sku_list: SkuListRel;
|
73
|
+
tags?: TagRel[] | null;
|
74
74
|
}
|
75
75
|
interface FreeGiftPromotionUpdate extends ResourceUpdate {
|
76
76
|
name?: string | null;
|
@@ -84,8 +84,8 @@ interface FreeGiftPromotionUpdate extends ResourceUpdate {
|
|
84
84
|
order_amount_promotion_rule?: OrderAmountPromotionRuleRel | null;
|
85
85
|
sku_list_promotion_rule?: SkuListPromotionRuleRel | null;
|
86
86
|
coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel | null;
|
87
|
-
tags?: TagRel[] | null;
|
88
87
|
sku_list?: SkuListRel | null;
|
88
|
+
tags?: TagRel[] | null;
|
89
89
|
}
|
90
90
|
declare class FreeGiftPromotions extends ApiResource<FreeGiftPromotion> {
|
91
91
|
static readonly TYPE: FreeGiftPromotionType;
|
@@ -96,10 +96,10 @@ declare class FreeGiftPromotions extends ApiResource<FreeGiftPromotion> {
|
|
96
96
|
order_amount_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<OrderAmountPromotionRule>;
|
97
97
|
sku_list_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuListPromotionRule>;
|
98
98
|
coupon_codes_promotion_rule(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<CouponCodesPromotionRule>;
|
99
|
+
sku_list(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
99
100
|
attachments(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Attachment>>;
|
100
101
|
events(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Event>>;
|
101
102
|
tags(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Tag>>;
|
102
|
-
sku_list(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<SkuList>;
|
103
103
|
skus(freeGiftPromotionId: string | FreeGiftPromotion, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<Sku>>;
|
104
104
|
isFreeGiftPromotion(resource: any): resource is FreeGiftPromotion;
|
105
105
|
relationship(id: string | ResourceId | null): FreeGiftPromotionRel;
|
@@ -27,6 +27,10 @@ class FreeGiftPromotions extends resource_1.ApiResource {
|
|
27
27
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
28
28
|
return this.resources.fetch({ type: 'coupon_codes_promotion_rules' }, `free_gift_promotions/${_freeGiftPromotionId}/coupon_codes_promotion_rule`, params, options);
|
29
29
|
}
|
30
|
+
async sku_list(freeGiftPromotionId, params, options) {
|
31
|
+
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
32
|
+
return this.resources.fetch({ type: 'sku_lists' }, `free_gift_promotions/${_freeGiftPromotionId}/sku_list`, params, options);
|
33
|
+
}
|
30
34
|
async attachments(freeGiftPromotionId, params, options) {
|
31
35
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
32
36
|
return this.resources.fetch({ type: 'attachments' }, `free_gift_promotions/${_freeGiftPromotionId}/attachments`, params, options);
|
@@ -39,10 +43,6 @@ class FreeGiftPromotions extends resource_1.ApiResource {
|
|
39
43
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
40
44
|
return this.resources.fetch({ type: 'tags' }, `free_gift_promotions/${_freeGiftPromotionId}/tags`, params, options);
|
41
45
|
}
|
42
|
-
async sku_list(freeGiftPromotionId, params, options) {
|
43
|
-
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
44
|
-
return this.resources.fetch({ type: 'sku_lists' }, `free_gift_promotions/${_freeGiftPromotionId}/sku_list`, params, options);
|
45
|
-
}
|
46
46
|
async skus(freeGiftPromotionId, params, options) {
|
47
47
|
const _freeGiftPromotionId = freeGiftPromotionId.id || freeGiftPromotionId;
|
48
48
|
return this.resources.fetch({ type: 'skus' }, `free_gift_promotions/${_freeGiftPromotionId}/skus`, params, options);
|