diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..c03e6017 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# [4.1.0](https://github.com/commercelayer/commercelayer-sdk/compare/v4.0.0...v4.1.0) (2022-01-12) + + +### Bug Fixes + +* **release:** add branch sdk4 to github action ([823a351](https://github.com/commercelayer/commercelayer-sdk/commit/823a351eb196a75b3003092e567710ab09df70c8)) +* **release:** add maintenance branches definition ([ed69350](https://github.com/commercelayer/commercelayer-sdk/commit/ed6935095c36d8012b1db4f0acbfbe26c3b87f0e)) +* **release:** add package.json to github ([6dda730](https://github.com/commercelayer/commercelayer-sdk/commit/6dda730091b915ec968cc724be5fb4c0945c1674)) +* **release:** change branch name ([f888f65](https://github.com/commercelayer/commercelayer-sdk/commit/f888f65809b19176b5e970c9c074e995b0faa68b)) +* **release:** change release branches ([ee77604](https://github.com/commercelayer/commercelayer-sdk/commit/ee77604944235dc0d64c4cf2701f7eee9270b9c5)) +* **release:** disable dryRun ([5d64040](https://github.com/commercelayer/commercelayer-sdk/commit/5d64040734aeda8890531e730b4a9e7d33ed2e79)) +* **release:** fix branch name ([55ce932](https://github.com/commercelayer/commercelayer-sdk/commit/55ce93249018955252678e49d5d087da785a4706)) +* **release:** fix github release action ([4cab8f6](https://github.com/commercelayer/commercelayer-sdk/commit/4cab8f65f13268bd94a2240b81953d2c4acd9020)) +* **release:** fix package version ([2dc6e03](https://github.com/commercelayer/commercelayer-sdk/commit/2dc6e035312fe490481651455e13a636979689af)) +* **release:** fix prerelease prefix ([70ff26a](https://github.com/commercelayer/commercelayer-sdk/commit/70ff26abb03d4366245afab729d00fe0759bae48)) +* **release:** fix release github action ([df9ca3e](https://github.com/commercelayer/commercelayer-sdk/commit/df9ca3ecd167bdbf18f46fcb211e855ae52adef3)) +* **release:** fix tag version ([06c78c2](https://github.com/commercelayer/commercelayer-sdk/commit/06c78c24a8ac929cc34794f09b9f8736e33b9c6d)) +* **release:** semantic-release dependencies ([975e81c](https://github.com/commercelayer/commercelayer-sdk/commit/975e81cec81bb928a5f008b1e2d13f163d0a66c4)) +* **release:** test prerelease ([0c724cf](https://github.com/commercelayer/commercelayer-sdk/commit/0c724cf1109b1f649c5904e50803c0a1bf3818d8)) +* **release:** test release ([89cb141](https://github.com/commercelayer/commercelayer-sdk/commit/89cb14158ff27594406a01a0dffb40e5bbf85044)) + + +### Features + +* **release:** test new feature ([70ac6dd](https://github.com/commercelayer/commercelayer-sdk/commit/70ac6dd47390bcdf652d88ab3a78f07fb1eb5ba8)) diff --git a/lib/cjs/api.d.ts b/lib/cjs/api.d.ts new file mode 100644 index 00000000..cf3e40ba --- /dev/null +++ b/lib/cjs/api.d.ts @@ -0,0 +1,101 @@ +/** + * ©2022 Commerce Layer Inc. + * OpenAPI schema, version 2.7.6 + **/ +export { default as Addresses } from './resources/addresses'; +export { default as Adjustments } from './resources/adjustments'; +export { default as AdyenGateways } from './resources/adyen_gateways'; +export { default as AdyenPayments } from './resources/adyen_payments'; +export { default as Applications } from './resources/application'; +export { default as Attachments } from './resources/attachments'; +export { default as Authorizations } from './resources/authorizations'; +export { default as AvalaraAccounts } from './resources/avalara_accounts'; +export { default as BillingInfoValidationRules } from './resources/billing_info_validation_rules'; +export { default as BingGeocoders } from './resources/bing_geocoders'; +export { default as BraintreeGateways } from './resources/braintree_gateways'; +export { default as BraintreePayments } from './resources/braintree_payments'; +export { default as Bundles } from './resources/bundles'; +export { default as Captures } from './resources/captures'; +export { default as CarrierAccounts } from './resources/carrier_accounts'; +export { default as CheckoutComGateways } from './resources/checkout_com_gateways'; +export { default as CheckoutComPayments } from './resources/checkout_com_payments'; +export { default as CouponCodesPromotionRules } from './resources/coupon_codes_promotion_rules'; +export { default as CouponRecipients } from './resources/coupon_recipients'; +export { default as Coupons } from './resources/coupons'; +export { default as CustomerAddresses } from './resources/customer_addresses'; +export { default as CustomerGroups } from './resources/customer_groups'; +export { default as CustomerPasswordResets } from './resources/customer_password_resets'; +export { default as CustomerPaymentSources } from './resources/customer_payment_sources'; +export { default as CustomerSubscriptions } from './resources/customer_subscriptions'; +export { default as Customers } from './resources/customers'; +export { default as DeliveryLeadTimes } from './resources/delivery_lead_times'; +export { default as EventCallbacks } from './resources/event_callbacks'; +export { default as ExternalGateways } from './resources/external_gateways'; +export { default as ExternalPayments } from './resources/external_payments'; +export { default as ExternalPromotions } from './resources/external_promotions'; +export { default as ExternalTaxCalculators } from './resources/external_tax_calculators'; +export { default as FixedAmountPromotions } from './resources/fixed_amount_promotions'; +export { default as FixedPricePromotions } from './resources/fixed_price_promotions'; +export { default as FreeGiftPromotions } from './resources/free_gift_promotions'; +export { default as FreeShippingPromotions } from './resources/free_shipping_promotions'; +export { default as Geocoders } from './resources/geocoders'; +export { default as GiftCardRecipients } from './resources/gift_card_recipients'; +export { default as GiftCards } from './resources/gift_cards'; +export { default as GoogleGeocoders } from './resources/google_geocoders'; +export { default as Imports } from './resources/imports'; +export { default as InStockSubscriptions } from './resources/in_stock_subscriptions'; +export { default as InventoryModels } from './resources/inventory_models'; +export { default as InventoryReturnLocations } from './resources/inventory_return_locations'; +export { default as InventoryStockLocations } from './resources/inventory_stock_locations'; +export { default as LineItemOptions } from './resources/line_item_options'; +export { default as LineItems } from './resources/line_items'; +export { default as ManualGateways } from './resources/manual_gateways'; +export { default as ManualTaxCalculators } from './resources/manual_tax_calculators'; +export { default as Markets } from './resources/markets'; +export { default as Merchants } from './resources/merchants'; +export { default as OrderAmountPromotionRules } from './resources/order_amount_promotion_rules'; +export { default as OrderCopies } from './resources/order_copies'; +export { default as OrderSubscriptions } from './resources/order_subscriptions'; +export { default as OrderValidationRules } from './resources/order_validation_rules'; +export { default as Orders } from './resources/orders'; +export { default as Organizations } from './resources/organization'; +export { default as Packages } from './resources/packages'; +export { default as ParcelLineItems } from './resources/parcel_line_items'; +export { default as Parcels } from './resources/parcels'; +export { default as PaymentGateways } from './resources/payment_gateways'; +export { default as PaymentMethods } from './resources/payment_methods'; +export { default as PaypalGateways } from './resources/paypal_gateways'; +export { default as PaypalPayments } from './resources/paypal_payments'; +export { default as PercentageDiscountPromotions } from './resources/percentage_discount_promotions'; +export { default as PriceLists } from './resources/price_lists'; +export { default as Prices } from './resources/prices'; +export { default as PromotionRules } from './resources/promotion_rules'; +export { default as Promotions } from './resources/promotions'; +export { default as Refunds } from './resources/refunds'; +export { default as ReturnLineItems } from './resources/return_line_items'; +export { default as Returns } from './resources/returns'; +export { default as Shipments } from './resources/shipments'; +export { default as ShippingCategories } from './resources/shipping_categories'; +export { default as ShippingMethods } from './resources/shipping_methods'; +export { default as ShippingZones } from './resources/shipping_zones'; +export { default as SkuListItems } from './resources/sku_list_items'; +export { default as SkuListPromotionRules } from './resources/sku_list_promotion_rules'; +export { default as SkuLists } from './resources/sku_lists'; +export { default as SkuOptions } from './resources/sku_options'; +export { default as Skus } from './resources/skus'; +export { default as StockItems } from './resources/stock_items'; +export { default as StockLineItems } from './resources/stock_line_items'; +export { default as StockLocations } from './resources/stock_locations'; +export { default as StockTransfers } from './resources/stock_transfers'; +export { default as StripeGateways } from './resources/stripe_gateways'; +export { default as StripePayments } from './resources/stripe_payments'; +export { default as TaxCalculators } from './resources/tax_calculators'; +export { default as TaxCategories } from './resources/tax_categories'; +export { default as TaxRules } from './resources/tax_rules'; +export { default as TaxjarAccounts } from './resources/taxjar_accounts'; +export { default as Transactions } from './resources/transactions'; +export { default as Voids } from './resources/voids'; +export { default as Webhooks } from './resources/webhooks'; +export { default as WireTransfers } from './resources/wire_transfers'; +export declare type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | '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' | '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' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_lists' | 'prices' | 'promotion_rules' | 'promotions' | 'refunds' | 'return_line_items' | 'returns' | 'shipments' | 'shipping_categories' | 'shipping_methods' | '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' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers'; +export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "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", "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", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_lists", "prices", "promotion_rules", "promotions", "refunds", "return_line_items", "returns", "shipments", "shipping_categories", "shipping_methods", "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", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "voids", "webhooks", "wire_transfers"]; diff --git a/lib/cjs/api.js b/lib/cjs/api.js new file mode 100644 index 00000000..04a0be19 --- /dev/null +++ b/lib/cjs/api.js @@ -0,0 +1 @@ +"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Markets=exports.ManualTaxCalculators=exports.ManualGateways=exports.LineItems=exports.LineItemOptions=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.EventCallbacks=exports.DeliveryLeadTimes=exports.Customers=exports.CustomerSubscriptions=exports.CustomerPaymentSources=exports.CustomerPasswordResets=exports.CustomerGroups=exports.CustomerAddresses=exports.Coupons=exports.CouponRecipients=exports.CouponCodesPromotionRules=exports.CheckoutComPayments=exports.CheckoutComGateways=exports.CarrierAccounts=exports.Captures=exports.Bundles=exports.BraintreePayments=exports.BraintreeGateways=exports.BingGeocoders=exports.BillingInfoValidationRules=exports.AvalaraAccounts=exports.Authorizations=exports.Attachments=exports.Applications=exports.AdyenPayments=exports.AdyenGateways=exports.Adjustments=exports.Addresses=void 0,exports.resourceList=exports.WireTransfers=exports.Webhooks=exports.Voids=exports.Transactions=exports.TaxjarAccounts=exports.TaxRules=exports.TaxCategories=exports.TaxCalculators=exports.StripePayments=exports.StripeGateways=exports.StockTransfers=exports.StockLocations=exports.StockLineItems=exports.StockItems=exports.Skus=exports.SkuOptions=exports.SkuLists=exports.SkuListPromotionRules=exports.SkuListItems=exports.ShippingZones=exports.ShippingMethods=exports.ShippingCategories=exports.Shipments=exports.Returns=exports.ReturnLineItems=exports.Refunds=exports.Promotions=exports.PromotionRules=exports.Prices=exports.PriceLists=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.OrderCopies=exports.OrderAmountPromotionRules=exports.Merchants=void 0;var addresses_1=require("./resources/addresses");Object.defineProperty(exports,"Addresses",{enumerable:!0,get:function(){return __importDefault(addresses_1).default}});var adjustments_1=require("./resources/adjustments");Object.defineProperty(exports,"Adjustments",{enumerable:!0,get:function(){return __importDefault(adjustments_1).default}});var adyen_gateways_1=require("./resources/adyen_gateways");Object.defineProperty(exports,"AdyenGateways",{enumerable:!0,get:function(){return __importDefault(adyen_gateways_1).default}});var adyen_payments_1=require("./resources/adyen_payments");Object.defineProperty(exports,"AdyenPayments",{enumerable:!0,get:function(){return __importDefault(adyen_payments_1).default}});var application_1=require("./resources/application");Object.defineProperty(exports,"Applications",{enumerable:!0,get:function(){return __importDefault(application_1).default}});var attachments_1=require("./resources/attachments");Object.defineProperty(exports,"Attachments",{enumerable:!0,get:function(){return __importDefault(attachments_1).default}});var authorizations_1=require("./resources/authorizations");Object.defineProperty(exports,"Authorizations",{enumerable:!0,get:function(){return __importDefault(authorizations_1).default}});var avalara_accounts_1=require("./resources/avalara_accounts");Object.defineProperty(exports,"AvalaraAccounts",{enumerable:!0,get:function(){return __importDefault(avalara_accounts_1).default}});var billing_info_validation_rules_1=require("./resources/billing_info_validation_rules");Object.defineProperty(exports,"BillingInfoValidationRules",{enumerable:!0,get:function(){return __importDefault(billing_info_validation_rules_1).default}});var bing_geocoders_1=require("./resources/bing_geocoders");Object.defineProperty(exports,"BingGeocoders",{enumerable:!0,get:function(){return __importDefault(bing_geocoders_1).default}});var braintree_gateways_1=require("./resources/braintree_gateways");Object.defineProperty(exports,"BraintreeGateways",{enumerable:!0,get:function(){return __importDefault(braintree_gateways_1).default}});var braintree_payments_1=require("./resources/braintree_payments");Object.defineProperty(exports,"BraintreePayments",{enumerable:!0,get:function(){return __importDefault(braintree_payments_1).default}});var bundles_1=require("./resources/bundles");Object.defineProperty(exports,"Bundles",{enumerable:!0,get:function(){return __importDefault(bundles_1).default}});var captures_1=require("./resources/captures");Object.defineProperty(exports,"Captures",{enumerable:!0,get:function(){return __importDefault(captures_1).default}});var carrier_accounts_1=require("./resources/carrier_accounts");Object.defineProperty(exports,"CarrierAccounts",{enumerable:!0,get:function(){return __importDefault(carrier_accounts_1).default}});var checkout_com_gateways_1=require("./resources/checkout_com_gateways");Object.defineProperty(exports,"CheckoutComGateways",{enumerable:!0,get:function(){return __importDefault(checkout_com_gateways_1).default}});var checkout_com_payments_1=require("./resources/checkout_com_payments");Object.defineProperty(exports,"CheckoutComPayments",{enumerable:!0,get:function(){return __importDefault(checkout_com_payments_1).default}});var coupon_codes_promotion_rules_1=require("./resources/coupon_codes_promotion_rules");Object.defineProperty(exports,"CouponCodesPromotionRules",{enumerable:!0,get:function(){return __importDefault(coupon_codes_promotion_rules_1).default}});var coupon_recipients_1=require("./resources/coupon_recipients");Object.defineProperty(exports,"CouponRecipients",{enumerable:!0,get:function(){return __importDefault(coupon_recipients_1).default}});var coupons_1=require("./resources/coupons");Object.defineProperty(exports,"Coupons",{enumerable:!0,get:function(){return __importDefault(coupons_1).default}});var customer_addresses_1=require("./resources/customer_addresses");Object.defineProperty(exports,"CustomerAddresses",{enumerable:!0,get:function(){return __importDefault(customer_addresses_1).default}});var customer_groups_1=require("./resources/customer_groups");Object.defineProperty(exports,"CustomerGroups",{enumerable:!0,get:function(){return __importDefault(customer_groups_1).default}});var customer_password_resets_1=require("./resources/customer_password_resets");Object.defineProperty(exports,"CustomerPasswordResets",{enumerable:!0,get:function(){return __importDefault(customer_password_resets_1).default}});var customer_payment_sources_1=require("./resources/customer_payment_sources");Object.defineProperty(exports,"CustomerPaymentSources",{enumerable:!0,get:function(){return __importDefault(customer_payment_sources_1).default}});var customer_subscriptions_1=require("./resources/customer_subscriptions");Object.defineProperty(exports,"CustomerSubscriptions",{enumerable:!0,get:function(){return __importDefault(customer_subscriptions_1).default}});var customers_1=require("./resources/customers");Object.defineProperty(exports,"Customers",{enumerable:!0,get:function(){return __importDefault(customers_1).default}});var delivery_lead_times_1=require("./resources/delivery_lead_times");Object.defineProperty(exports,"DeliveryLeadTimes",{enumerable:!0,get:function(){return __importDefault(delivery_lead_times_1).default}});var event_callbacks_1=require("./resources/event_callbacks");Object.defineProperty(exports,"EventCallbacks",{enumerable:!0,get:function(){return __importDefault(event_callbacks_1).default}});var external_gateways_1=require("./resources/external_gateways");Object.defineProperty(exports,"ExternalGateways",{enumerable:!0,get:function(){return __importDefault(external_gateways_1).default}});var external_payments_1=require("./resources/external_payments");Object.defineProperty(exports,"ExternalPayments",{enumerable:!0,get:function(){return __importDefault(external_payments_1).default}});var external_promotions_1=require("./resources/external_promotions");Object.defineProperty(exports,"ExternalPromotions",{enumerable:!0,get:function(){return __importDefault(external_promotions_1).default}});var external_tax_calculators_1=require("./resources/external_tax_calculators");Object.defineProperty(exports,"ExternalTaxCalculators",{enumerable:!0,get:function(){return __importDefault(external_tax_calculators_1).default}});var fixed_amount_promotions_1=require("./resources/fixed_amount_promotions");Object.defineProperty(exports,"FixedAmountPromotions",{enumerable:!0,get:function(){return __importDefault(fixed_amount_promotions_1).default}});var fixed_price_promotions_1=require("./resources/fixed_price_promotions");Object.defineProperty(exports,"FixedPricePromotions",{enumerable:!0,get:function(){return __importDefault(fixed_price_promotions_1).default}});var free_gift_promotions_1=require("./resources/free_gift_promotions");Object.defineProperty(exports,"FreeGiftPromotions",{enumerable:!0,get:function(){return __importDefault(free_gift_promotions_1).default}});var free_shipping_promotions_1=require("./resources/free_shipping_promotions");Object.defineProperty(exports,"FreeShippingPromotions",{enumerable:!0,get:function(){return __importDefault(free_shipping_promotions_1).default}});var geocoders_1=require("./resources/geocoders");Object.defineProperty(exports,"Geocoders",{enumerable:!0,get:function(){return __importDefault(geocoders_1).default}});var gift_card_recipients_1=require("./resources/gift_card_recipients");Object.defineProperty(exports,"GiftCardRecipients",{enumerable:!0,get:function(){return __importDefault(gift_card_recipients_1).default}});var gift_cards_1=require("./resources/gift_cards");Object.defineProperty(exports,"GiftCards",{enumerable:!0,get:function(){return __importDefault(gift_cards_1).default}});var google_geocoders_1=require("./resources/google_geocoders");Object.defineProperty(exports,"GoogleGeocoders",{enumerable:!0,get:function(){return __importDefault(google_geocoders_1).default}});var imports_1=require("./resources/imports");Object.defineProperty(exports,"Imports",{enumerable:!0,get:function(){return __importDefault(imports_1).default}});var in_stock_subscriptions_1=require("./resources/in_stock_subscriptions");Object.defineProperty(exports,"InStockSubscriptions",{enumerable:!0,get:function(){return __importDefault(in_stock_subscriptions_1).default}});var inventory_models_1=require("./resources/inventory_models");Object.defineProperty(exports,"InventoryModels",{enumerable:!0,get:function(){return __importDefault(inventory_models_1).default}});var inventory_return_locations_1=require("./resources/inventory_return_locations");Object.defineProperty(exports,"InventoryReturnLocations",{enumerable:!0,get:function(){return __importDefault(inventory_return_locations_1).default}});var inventory_stock_locations_1=require("./resources/inventory_stock_locations");Object.defineProperty(exports,"InventoryStockLocations",{enumerable:!0,get:function(){return __importDefault(inventory_stock_locations_1).default}});var line_item_options_1=require("./resources/line_item_options");Object.defineProperty(exports,"LineItemOptions",{enumerable:!0,get:function(){return __importDefault(line_item_options_1).default}});var line_items_1=require("./resources/line_items");Object.defineProperty(exports,"LineItems",{enumerable:!0,get:function(){return __importDefault(line_items_1).default}});var manual_gateways_1=require("./resources/manual_gateways");Object.defineProperty(exports,"ManualGateways",{enumerable:!0,get:function(){return __importDefault(manual_gateways_1).default}});var manual_tax_calculators_1=require("./resources/manual_tax_calculators");Object.defineProperty(exports,"ManualTaxCalculators",{enumerable:!0,get:function(){return __importDefault(manual_tax_calculators_1).default}});var markets_1=require("./resources/markets");Object.defineProperty(exports,"Markets",{enumerable:!0,get:function(){return __importDefault(markets_1).default}});var merchants_1=require("./resources/merchants");Object.defineProperty(exports,"Merchants",{enumerable:!0,get:function(){return __importDefault(merchants_1).default}});var order_amount_promotion_rules_1=require("./resources/order_amount_promotion_rules");Object.defineProperty(exports,"OrderAmountPromotionRules",{enumerable:!0,get:function(){return __importDefault(order_amount_promotion_rules_1).default}});var order_copies_1=require("./resources/order_copies");Object.defineProperty(exports,"OrderCopies",{enumerable:!0,get:function(){return __importDefault(order_copies_1).default}});var order_subscriptions_1=require("./resources/order_subscriptions");Object.defineProperty(exports,"OrderSubscriptions",{enumerable:!0,get:function(){return __importDefault(order_subscriptions_1).default}});var order_validation_rules_1=require("./resources/order_validation_rules");Object.defineProperty(exports,"OrderValidationRules",{enumerable:!0,get:function(){return __importDefault(order_validation_rules_1).default}});var orders_1=require("./resources/orders");Object.defineProperty(exports,"Orders",{enumerable:!0,get:function(){return __importDefault(orders_1).default}});var organization_1=require("./resources/organization");Object.defineProperty(exports,"Organizations",{enumerable:!0,get:function(){return __importDefault(organization_1).default}});var packages_1=require("./resources/packages");Object.defineProperty(exports,"Packages",{enumerable:!0,get:function(){return __importDefault(packages_1).default}});var parcel_line_items_1=require("./resources/parcel_line_items");Object.defineProperty(exports,"ParcelLineItems",{enumerable:!0,get:function(){return __importDefault(parcel_line_items_1).default}});var parcels_1=require("./resources/parcels");Object.defineProperty(exports,"Parcels",{enumerable:!0,get:function(){return __importDefault(parcels_1).default}});var payment_gateways_1=require("./resources/payment_gateways");Object.defineProperty(exports,"PaymentGateways",{enumerable:!0,get:function(){return __importDefault(payment_gateways_1).default}});var payment_methods_1=require("./resources/payment_methods");Object.defineProperty(exports,"PaymentMethods",{enumerable:!0,get:function(){return __importDefault(payment_methods_1).default}});var paypal_gateways_1=require("./resources/paypal_gateways");Object.defineProperty(exports,"PaypalGateways",{enumerable:!0,get:function(){return __importDefault(paypal_gateways_1).default}});var paypal_payments_1=require("./resources/paypal_payments");Object.defineProperty(exports,"PaypalPayments",{enumerable:!0,get:function(){return __importDefault(paypal_payments_1).default}});var percentage_discount_promotions_1=require("./resources/percentage_discount_promotions");Object.defineProperty(exports,"PercentageDiscountPromotions",{enumerable:!0,get:function(){return __importDefault(percentage_discount_promotions_1).default}});var price_lists_1=require("./resources/price_lists");Object.defineProperty(exports,"PriceLists",{enumerable:!0,get:function(){return __importDefault(price_lists_1).default}});var prices_1=require("./resources/prices");Object.defineProperty(exports,"Prices",{enumerable:!0,get:function(){return __importDefault(prices_1).default}});var promotion_rules_1=require("./resources/promotion_rules");Object.defineProperty(exports,"PromotionRules",{enumerable:!0,get:function(){return __importDefault(promotion_rules_1).default}});var promotions_1=require("./resources/promotions");Object.defineProperty(exports,"Promotions",{enumerable:!0,get:function(){return __importDefault(promotions_1).default}});var refunds_1=require("./resources/refunds");Object.defineProperty(exports,"Refunds",{enumerable:!0,get:function(){return __importDefault(refunds_1).default}});var return_line_items_1=require("./resources/return_line_items");Object.defineProperty(exports,"ReturnLineItems",{enumerable:!0,get:function(){return __importDefault(return_line_items_1).default}});var returns_1=require("./resources/returns");Object.defineProperty(exports,"Returns",{enumerable:!0,get:function(){return __importDefault(returns_1).default}});var shipments_1=require("./resources/shipments");Object.defineProperty(exports,"Shipments",{enumerable:!0,get:function(){return __importDefault(shipments_1).default}});var shipping_categories_1=require("./resources/shipping_categories");Object.defineProperty(exports,"ShippingCategories",{enumerable:!0,get:function(){return __importDefault(shipping_categories_1).default}});var shipping_methods_1=require("./resources/shipping_methods");Object.defineProperty(exports,"ShippingMethods",{enumerable:!0,get:function(){return __importDefault(shipping_methods_1).default}});var shipping_zones_1=require("./resources/shipping_zones");Object.defineProperty(exports,"ShippingZones",{enumerable:!0,get:function(){return __importDefault(shipping_zones_1).default}});var sku_list_items_1=require("./resources/sku_list_items");Object.defineProperty(exports,"SkuListItems",{enumerable:!0,get:function(){return __importDefault(sku_list_items_1).default}});var sku_list_promotion_rules_1=require("./resources/sku_list_promotion_rules");Object.defineProperty(exports,"SkuListPromotionRules",{enumerable:!0,get:function(){return __importDefault(sku_list_promotion_rules_1).default}});var sku_lists_1=require("./resources/sku_lists");Object.defineProperty(exports,"SkuLists",{enumerable:!0,get:function(){return __importDefault(sku_lists_1).default}});var sku_options_1=require("./resources/sku_options");Object.defineProperty(exports,"SkuOptions",{enumerable:!0,get:function(){return __importDefault(sku_options_1).default}});var skus_1=require("./resources/skus");Object.defineProperty(exports,"Skus",{enumerable:!0,get:function(){return __importDefault(skus_1).default}});var stock_items_1=require("./resources/stock_items");Object.defineProperty(exports,"StockItems",{enumerable:!0,get:function(){return __importDefault(stock_items_1).default}});var stock_line_items_1=require("./resources/stock_line_items");Object.defineProperty(exports,"StockLineItems",{enumerable:!0,get:function(){return __importDefault(stock_line_items_1).default}});var stock_locations_1=require("./resources/stock_locations");Object.defineProperty(exports,"StockLocations",{enumerable:!0,get:function(){return __importDefault(stock_locations_1).default}});var stock_transfers_1=require("./resources/stock_transfers");Object.defineProperty(exports,"StockTransfers",{enumerable:!0,get:function(){return __importDefault(stock_transfers_1).default}});var stripe_gateways_1=require("./resources/stripe_gateways");Object.defineProperty(exports,"StripeGateways",{enumerable:!0,get:function(){return __importDefault(stripe_gateways_1).default}});var stripe_payments_1=require("./resources/stripe_payments");Object.defineProperty(exports,"StripePayments",{enumerable:!0,get:function(){return __importDefault(stripe_payments_1).default}});var tax_calculators_1=require("./resources/tax_calculators");Object.defineProperty(exports,"TaxCalculators",{enumerable:!0,get:function(){return __importDefault(tax_calculators_1).default}});var tax_categories_1=require("./resources/tax_categories");Object.defineProperty(exports,"TaxCategories",{enumerable:!0,get:function(){return __importDefault(tax_categories_1).default}});var tax_rules_1=require("./resources/tax_rules");Object.defineProperty(exports,"TaxRules",{enumerable:!0,get:function(){return __importDefault(tax_rules_1).default}});var taxjar_accounts_1=require("./resources/taxjar_accounts");Object.defineProperty(exports,"TaxjarAccounts",{enumerable:!0,get:function(){return __importDefault(taxjar_accounts_1).default}});var transactions_1=require("./resources/transactions");Object.defineProperty(exports,"Transactions",{enumerable:!0,get:function(){return __importDefault(transactions_1).default}});var voids_1=require("./resources/voids");Object.defineProperty(exports,"Voids",{enumerable:!0,get:function(){return __importDefault(voids_1).default}});var webhooks_1=require("./resources/webhooks");Object.defineProperty(exports,"Webhooks",{enumerable:!0,get:function(){return __importDefault(webhooks_1).default}});var wire_transfers_1=require("./resources/wire_transfers");Object.defineProperty(exports,"WireTransfers",{enumerable:!0,get:function(){return __importDefault(wire_transfers_1).default}}),exports.resourceList=["addresses","adjustments","adyen_gateways","adyen_payments","application","attachments","authorizations","avalara_accounts","billing_info_validation_rules","bing_geocoders","braintree_gateways","braintree_payments","bundles","captures","carrier_accounts","checkout_com_gateways","checkout_com_payments","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","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","line_item_options","line_items","manual_gateways","manual_tax_calculators","markets","merchants","order_amount_promotion_rules","order_copies","order_subscriptions","order_validation_rules","orders","organization","packages","parcel_line_items","parcels","payment_gateways","payment_methods","paypal_gateways","paypal_payments","percentage_discount_promotions","price_lists","prices","promotion_rules","promotions","refunds","return_line_items","returns","shipments","shipping_categories","shipping_methods","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","tax_calculators","tax_categories","tax_rules","taxjar_accounts","transactions","voids","webhooks","wire_transfers"]; \ No newline at end of file diff --git a/lib/cjs/client.d.ts b/lib/cjs/client.d.ts new file mode 100644 index 00000000..f3c56a5e --- /dev/null +++ b/lib/cjs/client.d.ts @@ -0,0 +1,26 @@ +import { Method } from 'axios'; +import type { DocWithData as JSONApiDocument, ResourceObject as JSONApiResource } from 'jsonapi-typescript'; +import type { InterceptorManager } from './interceptor'; +declare type RequestConfig = { + timeout?: number; + params?: { + [key: string]: string | number | boolean; + }; +}; +declare type ApiClientInitConfig = { + organization: string; + domain?: string; + accessToken: string; +} & RequestConfig; +declare type ApiClientConfig = Partial; +declare class ApiClient { + #private; + static create(options: ApiClientInitConfig): ApiClient; + baseUrl: string; + interceptors: InterceptorManager; + private constructor(); + config(config: ApiClientConfig): void; + request(method: Method, path: string, body?: JSONApiResource, options?: ApiClientConfig): Promise; +} +export default ApiClient; +export { ApiClientInitConfig, ApiClientConfig, RequestConfig }; diff --git a/lib/cjs/client.js b/lib/cjs/client.js new file mode 100644 index 00000000..dc110f9a --- /dev/null +++ b/lib/cjs/client.js @@ -0,0 +1 @@ +"use strict";var __classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(t,e,r,i,o){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},__importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}},_ApiClient_accessToken,_ApiClient_client;Object.defineProperty(exports,"__esModule",{value:!0});const axios_1=__importDefault(require("axios")),error_1=require("./error"),config_1=__importDefault(require("./config")),debug_1=__importDefault(require("./debug")),debug=(0,debug_1.default)(),baseURL=(t,e)=>`https://${t.toLowerCase()}.${e||config_1.default.default.domain}/api`,handleError=t=>{let e=new error_1.SdkError({message:t.message,type:error_1.ErrorType.GENERIC});if(axios_1.default.isAxiosError(t))if(t.response){const r=new error_1.ApiError(e);r.type=error_1.ErrorType.RESPONSE,r.status=t.response.status,r.code=String(r.status),r.errors=t.response.data.errors,e=r}else t.request?(e.type=error_1.ErrorType.REQUEST,e.request=t.request):e.type=error_1.ErrorType.CLIENT;else axios_1.default.isCancel(t)?e.type=error_1.ErrorType.CANCEL:e.source=t;throw e};class ApiClient{constructor(e){_ApiClient_accessToken.set(this,void 0),_ApiClient_client.set(this,void 0),debug("new client instance %O",e),this.baseUrl=baseURL(e.organization,e.domain),__classPrivateFieldSet(this,_ApiClient_accessToken,e.accessToken,"f");const r={timeout:e.timeout||config_1.default.client.timeout},i=Object.assign({baseURL:this.baseUrl,timeout:config_1.default.client.timeout,headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json",Authorization:"Bearer "+__classPrivateFieldGet(this,_ApiClient_accessToken,"f")}},r);debug("axios options: %O",i),__classPrivateFieldSet(this,_ApiClient_client,axios_1.default.create(i),"f"),this.interceptors=__classPrivateFieldGet(this,_ApiClient_client,"f").interceptors}static create(e){if(!(e==null?void 0:e.organization))throw new Error("Undefined 'organization' parameter");if(!(e==null?void 0:e.accessToken))throw new Error("Undefined 'accessToken' parameter");return new ApiClient(e)}config(e){debug("config %o",e);const r=__classPrivateFieldGet(this,_ApiClient_client,"f").defaults;e.timeout&&(r.timeout=e.timeout),e.organization&&(this.baseUrl=baseURL(e.organization,e.domain)),e.accessToken&&(__classPrivateFieldSet(this,_ApiClient_accessToken,e.accessToken,"f"),r.headers.common.Authorization="Bearer "+__classPrivateFieldGet(this,_ApiClient_accessToken,"f"))}async request(e,r,i,o){debug("request %s %s, %O, %O",e,r,i||{},o||{});const c=i?{data:i}:void 0,u=r,d=(o==null?void 0:o.organization)?baseURL(o.organization,o.domain):void 0,s=(o==null?void 0:o.accessToken)||__classPrivateFieldGet(this,_ApiClient_accessToken,"f"),l=s?{Authorization:"Bearer "+s}:void 0,n=Object.assign({method:e,baseURL:d,url:u,data:c,headers:l},o);return debug("request params: %O",n),__classPrivateFieldGet(this,_ApiClient_client,"f").request(n).then(a=>a.data).catch(a=>handleError(a))}}_ApiClient_accessToken=new WeakMap,_ApiClient_client=new WeakMap,exports.default=ApiClient; \ No newline at end of file diff --git a/lib/cjs/commercelayer.d.ts b/lib/cjs/commercelayer.d.ts new file mode 100644 index 00000000..8643cba8 --- /dev/null +++ b/lib/cjs/commercelayer.d.ts @@ -0,0 +1,120 @@ +import * as api from './api'; +import { ApiError } from './error'; +import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor'; +import { ResourcesConfig, ResourcesInitConfig } from './resource'; +declare type SdkConfig = {}; +declare type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig; +declare type CommerceLayerConfig = SdkConfig & ResourcesConfig; +declare class CommerceLayerClient { + #private; + static get openApiSchemaVersion(): string; + addresses: api.Addresses; + adjustments: api.Adjustments; + adyen_gateways: api.AdyenGateways; + adyen_payments: api.AdyenPayments; + application: api.Applications; + attachments: api.Attachments; + authorizations: api.Authorizations; + avalara_accounts: api.AvalaraAccounts; + billing_info_validation_rules: api.BillingInfoValidationRules; + bing_geocoders: api.BingGeocoders; + braintree_gateways: api.BraintreeGateways; + braintree_payments: api.BraintreePayments; + bundles: api.Bundles; + captures: api.Captures; + carrier_accounts: api.CarrierAccounts; + checkout_com_gateways: api.CheckoutComGateways; + checkout_com_payments: api.CheckoutComPayments; + coupon_codes_promotion_rules: api.CouponCodesPromotionRules; + coupon_recipients: api.CouponRecipients; + coupons: api.Coupons; + customer_addresses: api.CustomerAddresses; + customer_groups: api.CustomerGroups; + customer_password_resets: api.CustomerPasswordResets; + customer_payment_sources: api.CustomerPaymentSources; + customer_subscriptions: api.CustomerSubscriptions; + customers: api.Customers; + delivery_lead_times: api.DeliveryLeadTimes; + event_callbacks: api.EventCallbacks; + external_gateways: api.ExternalGateways; + external_payments: api.ExternalPayments; + external_promotions: api.ExternalPromotions; + external_tax_calculators: api.ExternalTaxCalculators; + fixed_amount_promotions: api.FixedAmountPromotions; + fixed_price_promotions: api.FixedPricePromotions; + free_gift_promotions: api.FreeGiftPromotions; + free_shipping_promotions: api.FreeShippingPromotions; + geocoders: api.Geocoders; + gift_card_recipients: api.GiftCardRecipients; + gift_cards: api.GiftCards; + google_geocoders: api.GoogleGeocoders; + imports: api.Imports; + in_stock_subscriptions: api.InStockSubscriptions; + inventory_models: api.InventoryModels; + inventory_return_locations: api.InventoryReturnLocations; + inventory_stock_locations: api.InventoryStockLocations; + line_item_options: api.LineItemOptions; + line_items: api.LineItems; + manual_gateways: api.ManualGateways; + manual_tax_calculators: api.ManualTaxCalculators; + markets: api.Markets; + merchants: api.Merchants; + order_amount_promotion_rules: api.OrderAmountPromotionRules; + order_copies: api.OrderCopies; + order_subscriptions: api.OrderSubscriptions; + order_validation_rules: api.OrderValidationRules; + orders: api.Orders; + organization: api.Organizations; + packages: api.Packages; + parcel_line_items: api.ParcelLineItems; + parcels: api.Parcels; + payment_gateways: api.PaymentGateways; + payment_methods: api.PaymentMethods; + paypal_gateways: api.PaypalGateways; + paypal_payments: api.PaypalPayments; + percentage_discount_promotions: api.PercentageDiscountPromotions; + price_lists: api.PriceLists; + prices: api.Prices; + promotion_rules: api.PromotionRules; + promotions: api.Promotions; + refunds: api.Refunds; + return_line_items: api.ReturnLineItems; + returns: api.Returns; + shipments: api.Shipments; + shipping_categories: api.ShippingCategories; + shipping_methods: api.ShippingMethods; + shipping_zones: api.ShippingZones; + sku_list_items: api.SkuListItems; + sku_list_promotion_rules: api.SkuListPromotionRules; + sku_lists: api.SkuLists; + sku_options: api.SkuOptions; + skus: api.Skus; + stock_items: api.StockItems; + stock_line_items: api.StockLineItems; + stock_locations: api.StockLocations; + stock_transfers: api.StockTransfers; + stripe_gateways: api.StripeGateways; + stripe_payments: api.StripePayments; + tax_calculators: api.TaxCalculators; + tax_categories: api.TaxCategories; + tax_rules: api.TaxRules; + taxjar_accounts: api.TaxjarAccounts; + transactions: api.Transactions; + voids: api.Voids; + webhooks: api.Webhooks; + wire_transfers: api.WireTransfers; + constructor(config: CommerceLayerInitConfig); + get currentOrganization(): string; + private localConfig; + config(config: CommerceLayerConfig): void; + resources(): readonly string[]; + isApiError(error: any): error is ApiError; + addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number; + addResponseInterceptor(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number; + removeInterceptor(type: InterceptorType, id: number): void; + addRawResponseReader(): RawResponseReader; + removeRawResponseReader(reader: number | RawResponseReader): void; +} +declare const CommerceLayer: (config: CommerceLayerInitConfig) => CommerceLayerClient; +export default CommerceLayer; +export type { CommerceLayerClient, CommerceLayerConfig, CommerceLayerInitConfig }; diff --git a/lib/cjs/commercelayer.js b/lib/cjs/commercelayer.js new file mode 100644 index 00000000..8c36f356 --- /dev/null +++ b/lib/cjs/commercelayer.js @@ -0,0 +1 @@ +"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,s,i){i===void 0&&(i=s),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[s]}})}:function(e,t,s,i){i===void 0&&(i=s),e[i]=t[s]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var s in e)s!=="default"&&Object.prototype.hasOwnProperty.call(e,s)&&__createBinding(t,e,s);return __setModuleDefault(t,e),t},__classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(e,t,s,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(e,s):n?n.value=s:t.set(e,s),s},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(e,t,s,i){if(s==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?i:s==="a"?i.call(e):i?i.value:t.get(e)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},_CommerceLayerClient_adapter,_CommerceLayerClient_organization;Object.defineProperty(exports,"__esModule",{value:!0});const api=__importStar(require("./api")),static_1=require("./static"),resource_1=__importDefault(require("./resource")),debug_1=__importDefault(require("./debug")),debug=(0,debug_1.default)(),OPEN_API_SCHEMA_VERSION="2.7.6";class CommerceLayerClient{constructor(t){_CommerceLayerClient_adapter.set(this,void 0),_CommerceLayerClient_organization.set(this,void 0),debug("new commercelayer instance %O",t),__classPrivateFieldSet(this,_CommerceLayerClient_adapter,new resource_1.default(t),"f"),__classPrivateFieldSet(this,_CommerceLayerClient_organization,t.organization,"f"),this.addresses=new api.Addresses(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adjustments=new api.Adjustments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adyen_gateways=new api.AdyenGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.adyen_payments=new api.AdyenPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.application=new api.Applications(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.attachments=new api.Attachments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.authorizations=new api.Authorizations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.avalara_accounts=new api.AvalaraAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.billing_info_validation_rules=new api.BillingInfoValidationRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.bing_geocoders=new api.BingGeocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.braintree_gateways=new api.BraintreeGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.braintree_payments=new api.BraintreePayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.bundles=new api.Bundles(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.captures=new api.Captures(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.carrier_accounts=new api.CarrierAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.checkout_com_gateways=new api.CheckoutComGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.checkout_com_payments=new api.CheckoutComPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupon_codes_promotion_rules=new api.CouponCodesPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupon_recipients=new api.CouponRecipients(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.coupons=new api.Coupons(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_addresses=new api.CustomerAddresses(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_groups=new api.CustomerGroups(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_password_resets=new api.CustomerPasswordResets(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_payment_sources=new api.CustomerPaymentSources(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customer_subscriptions=new api.CustomerSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.customers=new api.Customers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.delivery_lead_times=new api.DeliveryLeadTimes(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.event_callbacks=new api.EventCallbacks(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_gateways=new api.ExternalGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_payments=new api.ExternalPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_promotions=new api.ExternalPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.external_tax_calculators=new api.ExternalTaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.fixed_amount_promotions=new api.FixedAmountPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.fixed_price_promotions=new api.FixedPricePromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.free_gift_promotions=new api.FreeGiftPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.free_shipping_promotions=new api.FreeShippingPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.geocoders=new api.Geocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.gift_card_recipients=new api.GiftCardRecipients(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.gift_cards=new api.GiftCards(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.google_geocoders=new api.GoogleGeocoders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.imports=new api.Imports(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.in_stock_subscriptions=new api.InStockSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_models=new api.InventoryModels(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_return_locations=new api.InventoryReturnLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.inventory_stock_locations=new api.InventoryStockLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.line_item_options=new api.LineItemOptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.line_items=new api.LineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.manual_gateways=new api.ManualGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.manual_tax_calculators=new api.ManualTaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.markets=new api.Markets(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.merchants=new api.Merchants(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_amount_promotion_rules=new api.OrderAmountPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_copies=new api.OrderCopies(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_subscriptions=new api.OrderSubscriptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.order_validation_rules=new api.OrderValidationRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.orders=new api.Orders(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.organization=new api.Organizations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.packages=new api.Packages(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.parcel_line_items=new api.ParcelLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.parcels=new api.Parcels(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.payment_gateways=new api.PaymentGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.payment_methods=new api.PaymentMethods(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.paypal_gateways=new api.PaypalGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.paypal_payments=new api.PaypalPayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.percentage_discount_promotions=new api.PercentageDiscountPromotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.price_lists=new api.PriceLists(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.prices=new api.Prices(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.promotion_rules=new api.PromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.promotions=new api.Promotions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.refunds=new api.Refunds(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.return_line_items=new api.ReturnLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.returns=new api.Returns(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipments=new api.Shipments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_categories=new api.ShippingCategories(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_methods=new api.ShippingMethods(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.shipping_zones=new api.ShippingZones(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_list_items=new api.SkuListItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_list_promotion_rules=new api.SkuListPromotionRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_lists=new api.SkuLists(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.sku_options=new api.SkuOptions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.skus=new api.Skus(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_items=new api.StockItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_line_items=new api.StockLineItems(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_locations=new api.StockLocations(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stock_transfers=new api.StockTransfers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stripe_gateways=new api.StripeGateways(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.stripe_payments=new api.StripePayments(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_calculators=new api.TaxCalculators(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_categories=new api.TaxCategories(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.tax_rules=new api.TaxRules(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.taxjar_accounts=new api.TaxjarAccounts(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.transactions=new api.Transactions(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.voids=new api.Voids(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.webhooks=new api.Webhooks(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f")),this.wire_transfers=new api.WireTransfers(__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f"))}static get openApiSchemaVersion(){return OPEN_API_SCHEMA_VERSION}get currentOrganization(){return __classPrivateFieldGet(this,_CommerceLayerClient_organization,"f")}localConfig(t){t.organization&&__classPrivateFieldSet(this,_CommerceLayerClient_organization,t.organization,"f")}config(t){debug("config %o",t),this.localConfig(t),__classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").config(t)}resources(){return static_1.CommerceLayerStatic.resources()}isApiError(t){return static_1.CommerceLayerStatic.isApiError(t)}addRequestInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors.request.use(t,s)}addResponseInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors.response.use(t,s)}removeInterceptor(t,s){return __classPrivateFieldGet(this,_CommerceLayerClient_adapter,"f").interceptors[t].eject(s)}addRawResponseReader(){const t={id:void 0,rawResponse:void 0};function s(n){return t.rawResponse=n==null?void 0:n.data,n}const i=this.addResponseInterceptor(s);return t.id=i,t}removeRawResponseReader(t){const s=typeof t=="number"?t:t.id;if(s)return this.removeInterceptor("response",s)}}_CommerceLayerClient_adapter=new WeakMap,_CommerceLayerClient_organization=new WeakMap;const CommerceLayer=e=>new CommerceLayerClient(e);exports.default=CommerceLayer; \ No newline at end of file diff --git a/lib/cjs/common.d.ts b/lib/cjs/common.d.ts new file mode 100644 index 00000000..23d49d3c --- /dev/null +++ b/lib/cjs/common.d.ts @@ -0,0 +1,4 @@ +import type { ResourceId, ResourceType } from './resource'; +declare const isResourceId: (resource: any) => resource is ResourceId; +declare const isResourceType: (resource: any) => resource is ResourceType; +export { isResourceId, isResourceType }; diff --git a/lib/cjs/common.js b/lib/cjs/common.js new file mode 100644 index 00000000..2f942cec --- /dev/null +++ b/lib/cjs/common.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isResourceType=exports.isResourceId=void 0;const api_1=require("./api"),isResourceId=e=>e&&e.type&&e.id&&api_1.resourceList.includes(e.type);exports.isResourceId=isResourceId;const isResourceType=e=>e&&typeof e.type!="undefined"&&e.type&&api_1.resourceList.includes(e.type);exports.isResourceType=isResourceType; \ No newline at end of file diff --git a/lib/cjs/config.d.ts b/lib/cjs/config.d.ts new file mode 100644 index 00000000..b43508b5 --- /dev/null +++ b/lib/cjs/config.d.ts @@ -0,0 +1,11 @@ +declare const config: { + readonly default: { + readonly domain: "commercelayer.io"; + readonly pageNumber: 1; + readonly pageSize: 10; + }; + readonly client: { + readonly timeout: 15000; + }; +}; +export default config; diff --git a/lib/cjs/config.js b/lib/cjs/config.js new file mode 100644 index 00000000..61cc8c1b --- /dev/null +++ b/lib/cjs/config.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const config={default:{domain:"commercelayer.io",pageNumber:1,pageSize:10},client:{timeout:15e3}};exports.default=config; \ No newline at end of file diff --git a/lib/cjs/debug.d.ts b/lib/cjs/debug.d.ts new file mode 100644 index 00000000..3f77907a --- /dev/null +++ b/lib/cjs/debug.d.ts @@ -0,0 +1,3 @@ +declare type Debugger = (pattern: string, ...args: any[]) => void; +declare const debug: (namespace?: string | undefined) => Debugger; +export default debug; diff --git a/lib/cjs/debug.js b/lib/cjs/debug.js new file mode 100644 index 00000000..cb73dbf5 --- /dev/null +++ b/lib/cjs/debug.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const debuggerFunction=(e,...r)=>{};let debuggerFactory=e=>debuggerFunction;try{const e=require("debug");e&&typeof e=="function"&&(debuggerFactory=e)}catch{}const debugPrefix="clsdk",caller=()=>{const e=new Error;Error.prepareStackTrace=(c,t)=>t;const r=e.stack;return Error.prepareStackTrace=void 0,(r[2].getFileName()||"/").replace(/^.*[\\/]/,"").replace(".ts","")},debug=e=>debuggerFactory(`${debugPrefix}:${e||caller()}`);exports.default=debug; \ No newline at end of file diff --git a/lib/cjs/error.d.ts b/lib/cjs/error.d.ts new file mode 100644 index 00000000..5dce3c3f --- /dev/null +++ b/lib/cjs/error.d.ts @@ -0,0 +1,26 @@ +declare enum ErrorType { + CLIENT = "client", + REQUEST = "request", + RESPONSE = "response", + GENERIC = "generic", + CANCEL = "cancel" +} +declare class SdkError extends Error { + static isSdkError(error: any): error is ApiError; + type: string; + code?: string; + source?: Error; + request?: any; + constructor(error: { + message: string; + type?: ErrorType; + }); +} +declare class ApiError extends SdkError { + static isApiError(error: any): error is ApiError; + errors: any[]; + status?: number; + constructor(error: SdkError); + first(): any; +} +export { SdkError, ApiError, ErrorType }; diff --git a/lib/cjs/error.js b/lib/cjs/error.js new file mode 100644 index 00000000..4f956a4a --- /dev/null +++ b/lib/cjs/error.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ErrorType=exports.ApiError=exports.SdkError=void 0;var ErrorType;(function(e){e.CLIENT="client",e.REQUEST="request",e.RESPONSE="response",e.GENERIC="generic",e.CANCEL="cancel"})(ErrorType||(ErrorType={})),exports.ErrorType=ErrorType;class SdkError extends Error{constructor(r){super(r.message);this.name=this.constructor.name,this.type=r.type||ErrorType.GENERIC}static isSdkError(r){return r&&["SdkError","ApiError"].includes(r.name)&&Object.values(ErrorType).includes(r.type)}}exports.SdkError=SdkError;class ApiError extends SdkError{constructor(r){super(Object.assign(Object.assign({},r),{type:ErrorType.RESPONSE}));this.errors=[],this.name=this.constructor.name}static isApiError(r){return SdkError.isSdkError(r)&&r.name==="ApiError"&&r.type===ErrorType.RESPONSE}first(){var r;return((r=this.errors)===null||r===void 0?void 0:r.length)>0?this.errors[0]:void 0}}exports.ApiError=ApiError; \ No newline at end of file diff --git a/lib/cjs/index.d.ts b/lib/cjs/index.d.ts new file mode 100644 index 00000000..7944d63a --- /dev/null +++ b/lib/cjs/index.d.ts @@ -0,0 +1,7 @@ +export { default } from './commercelayer'; +export type { CommerceLayerClient } from './commercelayer'; +export { CommerceLayerStatic } from './static'; +export type { QueryParamsRetrieve, QueryParamsList, QueryParams } from './query'; +export * from './model'; +export type { RequestObj, ResponseObj, ErrorObj } from './interceptor'; +export type { SdkError, ApiError, ErrorType } from './error'; diff --git a/lib/cjs/index.js b/lib/cjs/index.js new file mode 100644 index 00000000..4187cdfd --- /dev/null +++ b/lib/cjs/index.js @@ -0,0 +1 @@ +"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,o,t,r){r===void 0&&(r=t),Object.defineProperty(e,r,{enumerable:!0,get:function(){return o[t]}})}:function(e,o,t,r){r===void 0&&(r=t),e[r]=o[t]}),__exportStar=this&&this.__exportStar||function(e,o){for(var t in e)t!=="default"&&!Object.prototype.hasOwnProperty.call(o,t)&&__createBinding(o,e,t)},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommerceLayerStatic=exports.default=void 0;var commercelayer_1=require("./commercelayer");Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return __importDefault(commercelayer_1).default}});var static_1=require("./static");Object.defineProperty(exports,"CommerceLayerStatic",{enumerable:!0,get:function(){return static_1.CommerceLayerStatic}}),__exportStar(require("./model"),exports); \ No newline at end of file diff --git a/lib/cjs/interceptor.d.ts b/lib/cjs/interceptor.d.ts new file mode 100644 index 00000000..7852a408 --- /dev/null +++ b/lib/cjs/interceptor.d.ts @@ -0,0 +1,19 @@ +import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from "axios"; +declare type InterceptorManager = { + request: AxiosInterceptorManager; + response: AxiosInterceptorManager; +}; +declare type RequestObj = AxiosRequestConfig; +declare type RequestInterceptor = (request: RequestObj) => RequestObj | Promise; +declare type ResponseObj = AxiosResponse; +declare type ResponseInterceptor = (response: ResponseObj) => ResponseObj; +declare type ErrorObj = AxiosError; +declare type ErrorInterceptor = (error: ErrorObj) => ErrorObj; +declare type InterceptorType = 'request' | 'response'; +export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType }; +export type { RequestObj, ResponseObj, ErrorObj }; +declare type RawResponseReader = { + id: number | undefined; + rawResponse: ResponseObj | undefined; +}; +export type { RawResponseReader }; diff --git a/lib/cjs/interceptor.js b/lib/cjs/interceptor.js new file mode 100644 index 00000000..f5d60537 --- /dev/null +++ b/lib/cjs/interceptor.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}); \ No newline at end of file diff --git a/lib/cjs/jsonapi.d.ts b/lib/cjs/jsonapi.d.ts new file mode 100644 index 00000000..34c090d5 --- /dev/null +++ b/lib/cjs/jsonapi.d.ts @@ -0,0 +1,5 @@ +import { DocWithData, ResourceObject } from 'jsonapi-typescript'; +import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource'; +declare const denormalize: (response: DocWithData) => R | R[]; +declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject; +export { denormalize, normalize }; diff --git a/lib/cjs/jsonapi.js b/lib/cjs/jsonapi.js new file mode 100644 index 00000000..5f3722bf --- /dev/null +++ b/lib/cjs/jsonapi.js @@ -0,0 +1 @@ +"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalize=exports.denormalize=void 0;const common_1=require("./common"),debug_1=__importDefault(require("./debug")),debug=(0,debug_1.default)(),denormalize=r=>{let t;r.links&&delete r.links;const e=r.data,i=r.included;return Array.isArray(e)?t=e.map(o=>denormalizeResource(o,i)):t=denormalizeResource(e,i),t};exports.denormalize=denormalize;const findIncluded=(r,t=[])=>t.find(e=>r.id===e.id&&r.type===e.type)||r,denormalizeResource=(r,t)=>{debug("denormalize resource: %O, %o",r,t||{});const e=Object.assign({id:r.id,type:r.type},r.attributes);return r.relationships&&Object.keys(r.relationships).forEach(i=>{const o=r.relationships[i].data;o?Array.isArray(o)?e[i]=o.map(s=>denormalizeResource(findIncluded(s,t),t)):e[i]=denormalizeResource(findIncluded(o,t),t):o===null&&(e[i]=null)}),debug("denormalized resource: %O",e),e},normalize=r=>{debug("normalize resource: %O",r);const t={},e={};for(const o in r){if(["type","id"].includes(o))continue;const s=r[o];s&&((0,common_1.isResourceId)(s)||Array.isArray(s)&&(0,common_1.isResourceId)(s[0]))?e[o]={data:s}:t[o]=s}const i={type:r.type,attributes:t,relationships:e};return(0,common_1.isResourceId)(r)&&(i.id=r.id),debug("normalized resource: %O",i),i};exports.normalize=normalize; \ No newline at end of file diff --git a/lib/cjs/model.d.ts b/lib/cjs/model.d.ts new file mode 100644 index 00000000..23718bcc --- /dev/null +++ b/lib/cjs/model.d.ts @@ -0,0 +1,99 @@ +/** + * ©2022 Commerce Layer Inc. + * OpenAPI schema, version 2.7.6 + **/ +export type { Address, AddressCreate, AddressUpdate } from './resources/addresses'; +export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments'; +export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways'; +export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments'; +export type { Application } from './resources/application'; +export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments'; +export type { Authorization, AuthorizationUpdate } from './resources/authorizations'; +export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts'; +export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules'; +export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders'; +export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways'; +export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments'; +export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles'; +export type { Capture, CaptureUpdate } from './resources/captures'; +export type { CarrierAccount } from './resources/carrier_accounts'; +export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways'; +export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments'; +export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules'; +export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients'; +export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons'; +export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses'; +export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups'; +export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets'; +export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources'; +export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions'; +export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers'; +export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times'; +export type { EventCallback } from './resources/event_callbacks'; +export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways'; +export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments'; +export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions'; +export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators'; +export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions'; +export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions'; +export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions'; +export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions'; +export type { Geocoder } from './resources/geocoders'; +export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients'; +export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards'; +export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders'; +export type { Import, ImportCreate } from './resources/imports'; +export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions'; +export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models'; +export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations'; +export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations'; +export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options'; +export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items'; +export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways'; +export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators'; +export type { Market, MarketCreate, MarketUpdate } from './resources/markets'; +export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants'; +export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules'; +export type { OrderCopy, OrderCopyCreate } from './resources/order_copies'; +export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions'; +export type { OrderValidationRule } from './resources/order_validation_rules'; +export type { Order, OrderCreate, OrderUpdate } from './resources/orders'; +export type { Organization } from './resources/organization'; +export type { Package, PackageCreate, PackageUpdate } from './resources/packages'; +export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items'; +export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels'; +export type { PaymentGateway } from './resources/payment_gateways'; +export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods'; +export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways'; +export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments'; +export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions'; +export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists'; +export type { Price, PriceCreate, PriceUpdate } from './resources/prices'; +export type { PromotionRule } from './resources/promotion_rules'; +export type { Promotion } from './resources/promotions'; +export type { Refund } from './resources/refunds'; +export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items'; +export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns'; +export type { Shipment, ShipmentUpdate } from './resources/shipments'; +export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories'; +export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods'; +export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones'; +export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items'; +export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules'; +export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists'; +export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options'; +export type { Sku, SkuCreate, SkuUpdate } from './resources/skus'; +export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items'; +export type { StockLineItem } from './resources/stock_line_items'; +export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations'; +export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers'; +export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways'; +export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments'; +export type { TaxCalculator } from './resources/tax_calculators'; +export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories'; +export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules'; +export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts'; +export type { Transaction } from './resources/transactions'; +export type { Void } from './resources/voids'; +export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks'; +export type { WireTransfer, WireTransferCreate, WireTransferUpdate } from './resources/wire_transfers'; diff --git a/lib/cjs/model.js b/lib/cjs/model.js new file mode 100644 index 00000000..f5d60537 --- /dev/null +++ b/lib/cjs/model.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}); \ No newline at end of file diff --git a/lib/cjs/query.d.ts b/lib/cjs/query.d.ts new file mode 100644 index 00000000..fae0d09e --- /dev/null +++ b/lib/cjs/query.d.ts @@ -0,0 +1,23 @@ +import { ResourceType } from "./resource"; +interface QueryParamsRetrieve { + include?: string[]; + fields?: string[] | { + [key: string]: string[]; + }; +} +interface QueryParamsList extends QueryParamsRetrieve { + sort?: string[] | { + [key: string]: 'asc' | 'desc'; + }; + filters?: { + [key: string]: string | number | boolean; + }; + pageNumber?: number; + pageSize?: number; +} +declare type QueryParams = QueryParamsRetrieve | QueryParamsList; +export { QueryParamsRetrieve, QueryParamsList, QueryParams }; +declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined, res: ResourceType) => { + [key: string]: string; +}; +export { generateQueryStringParams }; diff --git a/lib/cjs/query.js b/lib/cjs/query.js new file mode 100644 index 00000000..b16191d5 --- /dev/null +++ b/lib/cjs/query.js @@ -0,0 +1 @@ +"use strict";var __importDefault=this&&this.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateQueryStringParams=void 0;const debug_1=__importDefault(require("./debug")),debug=(0,debug_1.default)(),isParamsList=r=>r.filters||r.pageNumber||r.pageSize||r.sort,generateQueryStringParams=(r,s)=>{debug("generate query string params: %O, %O",r,s);const e={};return r&&(r.include&&(e.include=r.include.join(",")),r.fields&&(Array.isArray(r.fields)&&(r.fields={[s.type]:r.fields}),Object.entries(r.fields).forEach(([t,i])=>{e[`fields[${t}]`]=i.join(",")})),isParamsList(r)&&(r.sort&&(Array.isArray(r.sort)?e.sort=r.sort.join(","):e.sort=Object.entries(r.sort).map(([t,i])=>`${i==="desc"?"-":""}${t}`).join(",")),r.pageNumber&&(e["page[number]"]=String(r.pageNumber)),r.pageSize&&(e["page[size]"]=String(r.pageSize)),r.filters&&Object.entries(r.filters).forEach(([t,i])=>{e[`filter[q][${t}]`]=String(i)})),debug("query string params: %O",e)),e};exports.generateQueryStringParams=generateQueryStringParams; \ No newline at end of file diff --git a/lib/cjs/resource.d.ts b/lib/cjs/resource.d.ts new file mode 100644 index 00000000..40b5cd32 --- /dev/null +++ b/lib/cjs/resource.d.ts @@ -0,0 +1,71 @@ +import { ApiClientInitConfig } from './client'; +import { QueryParamsRetrieve, QueryParamsList } from './query'; +import { ResourceTypeLock } from './api'; +import { InterceptorManager } from './interceptor'; +import { Value as JSONValue } from 'json-typescript'; +declare type Metadata = { + [key: string]: JSONValue; +}; +interface ResourceType { + readonly type: ResourceTypeLock; +} +interface ResourceId extends ResourceType { + readonly id: string; +} +interface Resource extends ResourceId { + reference?: string; + reference_origin?: string; + metadata?: Metadata; + readonly created_at: string; + readonly updated_at: string; +} +interface ResourceCreate { + reference?: string; + reference_origin?: string; + metadata?: Metadata; +} +interface ResourceUpdate { + readonly id: string; + reference?: string; + reference_origin?: string; + metadata?: Metadata; +} +declare type ListMeta = { + readonly pageCount: number; + readonly recordCount: number; + readonly currentPage: number; + readonly recordsPerPage: number; +}; +declare class ListResponse extends Array { + readonly meta: ListMeta; + constructor(meta: ListMeta, data: Array); + first(): R | undefined; + last(): R | undefined; + get(index: number): R | undefined; +} +export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse }; +declare type ResourceAdapterConfig = {}; +declare type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig; +declare type ResourcesConfig = Partial; +declare class ResourceAdapter { + #private; + constructor(config: ResourcesInitConfig); + get interceptors(): InterceptorManager; + private localConfig; + config(config: ResourcesConfig): void; + singleton(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + list(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(resource: ResourceId, options?: ResourcesConfig): Promise; +} +declare abstract class ApiResource { + static readonly TYPE: ResourceTypeLock; + protected resources: ResourceAdapter; + constructor(adapter: ResourceAdapter); + abstract relationship(id: string | ResourceId): ResourceId; + abstract type(): string; +} +export default ResourceAdapter; +export { ApiResource, ResourcesConfig, ResourcesInitConfig }; diff --git a/lib/cjs/resource.js b/lib/cjs/resource.js new file mode 100644 index 00000000..c89df787 --- /dev/null +++ b/lib/cjs/resource.js @@ -0,0 +1 @@ +"use strict";var __classPrivateFieldSet=this&&this.__classPrivateFieldSet||function(a,e,r,t,s){if(t==="m")throw new TypeError("Private method is not writable");if(t==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?a!==e||!s:!e.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t==="a"?s.call(a,r):s?s.value=r:e.set(a,r),r},__classPrivateFieldGet=this&&this.__classPrivateFieldGet||function(a,e,r,t){if(r==="a"&&!t)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?a!==e||!t:!e.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?t:r==="a"?t.call(a):t?t.value:e.get(a)},__importDefault=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},_ResourceAdapter_client,_ResourceAdapter_config;Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiResource=void 0;const client_1=__importDefault(require("./client")),jsonapi_1=require("./jsonapi"),query_1=require("./query"),config_1=__importDefault(require("./config")),debug_1=__importDefault(require("./debug")),debug=(0,debug_1.default)();class ListResponse extends Array{constructor(e,r){super(...r||[]);this.meta=e}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(e){return this.length&&e>=0?this[e]:void 0}}class ResourceAdapter{constructor(e){_ResourceAdapter_client.set(this,void 0),_ResourceAdapter_config.set(this,{}),__classPrivateFieldSet(this,_ResourceAdapter_client,client_1.default.create(e),"f"),this.localConfig(e)}get interceptors(){return __classPrivateFieldGet(this,_ResourceAdapter_client,"f").interceptors}localConfig(e){}config(e){debug("config %o",e),this.localConfig(e),__classPrivateFieldGet(this,_ResourceAdapter_client,"f").config(e)}async singleton(e,r,t){debug("singleton: %o, %O, %O",e,r||{},t||{});const s=(0,query_1.generateQueryStringParams)(r,e);(t==null?void 0:t.params)&&Object.assign(s,t==null?void 0:t.params);const i=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("get",`${e.type}`,void 0,Object.assign(Object.assign({},t),{params:s}));return(0,jsonapi_1.denormalize)(i)}async retrieve(e,r,t){debug("retrieve: %o, %O, %O",e,r||{},t||{});const s=(0,query_1.generateQueryStringParams)(r,e);(t==null?void 0:t.params)&&Object.assign(s,t==null?void 0:t.params);const i=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("get",`${e.type}/${e.id}`,void 0,Object.assign(Object.assign({},t),{params:s}));return(0,jsonapi_1.denormalize)(i)}async list(e,r,t){var s,i;debug("list: %o, %O, %O",e,r||{},t||{});const n=(0,query_1.generateQueryStringParams)(r,e);(t==null?void 0:t.params)&&Object.assign(n,t==null?void 0:t.params);const o=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("get",`${e.type}`,void 0,Object.assign(Object.assign({},t),{params:n})),c=(0,jsonapi_1.denormalize)(o),u={pageCount:Number((s=o.meta)===null||s===void 0?void 0:s.page_count),recordCount:Number((i=o.meta)===null||i===void 0?void 0:i.record_count),currentPage:(r==null?void 0:r.pageNumber)||config_1.default.default.pageNumber,recordsPerPage:(r==null?void 0:r.pageSize)||config_1.default.default.pageSize};return new ListResponse(u,c)}async create(e,r,t){debug("create: %o, %O, %O",e,r||{},t||{});const s=(0,query_1.generateQueryStringParams)(r,e);(t==null?void 0:t.params)&&Object.assign(s,t==null?void 0:t.params);const i=(0,jsonapi_1.normalize)(e),n=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("post",e.type,i,Object.assign(Object.assign({},t),{params:s}));return(0,jsonapi_1.denormalize)(n)}async update(e,r,t){debug("update: %o, %O, %O",e,r||{},t||{});const s=(0,query_1.generateQueryStringParams)(r,e);(t==null?void 0:t.params)&&Object.assign(s,t==null?void 0:t.params);const i=(0,jsonapi_1.normalize)(e),n=await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("patch",`${e.type}/${e.id}`,i,Object.assign(Object.assign({},t),{params:s}));return(0,jsonapi_1.denormalize)(n)}async delete(e,r){debug("delete: %o, %O",e,r||{}),await __classPrivateFieldGet(this,_ResourceAdapter_client,"f").request("delete",`${e.type}/${e.id}`,void 0,r)}}_ResourceAdapter_client=new WeakMap,_ResourceAdapter_config=new WeakMap;class ApiResource{constructor(e){debug("new resource instance: %s",this.type()),this.resources=e}}exports.ApiResource=ApiResource,exports.default=ResourceAdapter; \ No newline at end of file diff --git a/lib/cjs/resources/addresses.d.ts b/lib/cjs/resources/addresses.d.ts new file mode 100644 index 00000000..f07bb887 --- /dev/null +++ b/lib/cjs/resources/addresses.d.ts @@ -0,0 +1,87 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Geocoder } from './geocoders'; +declare type AddressRel = ResourceId & { + type: typeof Addresses.TYPE; +}; +declare type GeocoderRel = ResourceId & { + type: 'geocoders'; +}; +interface Address extends Resource { + business?: boolean; + first_name?: string; + last_name?: string; + company?: string; + full_name?: string; + line_1?: string; + line_2?: string; + city?: string; + zip_code?: string; + state_code?: string; + country_code?: string; + phone?: string; + full_address?: string; + name?: string; + email?: string; + notes?: string; + lat?: number; + lng?: number; + is_localized?: boolean; + is_geocoded?: boolean; + provider_name?: string; + map_url?: string; + static_map_url?: string; + billing_info?: string; + geocoder?: Geocoder; +} +interface AddressCreate extends ResourceCreate { + business?: boolean; + first_name?: string; + last_name?: string; + company?: string; + line_1: string; + line_2?: string; + city: string; + zip_code?: string; + state_code: string; + country_code: string; + phone: string; + email?: string; + notes?: string; + lat?: number; + lng?: number; + billing_info?: string; + geocoder?: GeocoderRel; +} +interface AddressUpdate extends ResourceUpdate { + business?: boolean; + first_name?: string; + last_name?: string; + company?: string; + line_1?: string; + line_2?: string; + city?: string; + zip_code?: string; + state_code?: string; + country_code?: string; + phone?: string; + email?: string; + notes?: string; + lat?: number; + lng?: number; + billing_info?: string; + geocoder?: GeocoderRel; +} +declare class Addresses extends ApiResource { + static readonly TYPE: 'addresses'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise
; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise
; + update(resource: AddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise
; + delete(id: string, options?: ResourcesConfig): Promise; + isAddress(resource: any): resource is Address; + relationship(id: string | ResourceId): AddressRel; + type(): string; +} +export default Addresses; +export { Address, AddressCreate, AddressUpdate }; diff --git a/lib/cjs/resources/addresses.js b/lib/cjs/resources/addresses.js new file mode 100644 index 00000000..31124b6f --- /dev/null +++ b/lib/cjs/resources/addresses.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Addresses extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Addresses.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Addresses.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Addresses.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Addresses.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Addresses.TYPE,id:e},t)}isAddress(e){return e.type&&e.type===Addresses.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Addresses.TYPE}:{id:e.id,type:Addresses.TYPE}}type(){return Addresses.TYPE}}Addresses.TYPE="addresses",exports.default=Addresses; \ No newline at end of file diff --git a/lib/cjs/resources/adjustments.d.ts b/lib/cjs/resources/adjustments.d.ts new file mode 100644 index 00000000..2bbee20c --- /dev/null +++ b/lib/cjs/resources/adjustments.d.ts @@ -0,0 +1,35 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +declare type AdjustmentRel = ResourceId & { + type: typeof Adjustments.TYPE; +}; +interface Adjustment extends Resource { + name?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; +} +interface AdjustmentCreate extends ResourceCreate { + name: string; + currency_code: string; + amount_cents: number; +} +interface AdjustmentUpdate extends ResourceUpdate { + name?: string; + currency_code?: string; + amount_cents?: number; +} +declare class Adjustments extends ApiResource { + static readonly TYPE: 'adjustments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AdjustmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AdjustmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAdjustment(resource: any): resource is Adjustment; + relationship(id: string | ResourceId): AdjustmentRel; + type(): string; +} +export default Adjustments; +export { Adjustment, AdjustmentCreate, AdjustmentUpdate }; diff --git a/lib/cjs/resources/adjustments.js b/lib/cjs/resources/adjustments.js new file mode 100644 index 00000000..a0a624fc --- /dev/null +++ b/lib/cjs/resources/adjustments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Adjustments extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Adjustments.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:Adjustments.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:Adjustments.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:Adjustments.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:Adjustments.TYPE,id:e},r)}isAdjustment(e){return e.type&&e.type===Adjustments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Adjustments.TYPE}:{id:e.id,type:Adjustments.TYPE}}type(){return Adjustments.TYPE}}Adjustments.TYPE="adjustments",exports.default=Adjustments; \ No newline at end of file diff --git a/lib/cjs/resources/adyen_gateways.d.ts b/lib/cjs/resources/adyen_gateways.d.ts new file mode 100644 index 00000000..ebb41cef --- /dev/null +++ b/lib/cjs/resources/adyen_gateways.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { AdyenPayment } from './adyen_payments'; +declare type AdyenGatewayRel = ResourceId & { + type: typeof AdyenGateways.TYPE; +}; +declare type AdyenPaymentRel = ResourceId & { + type: 'adyen_payments'; +}; +interface AdyenGateway extends Resource { + name?: string; + live_url_prefix?: string; + payment_methods?: PaymentMethod[]; + adyen_payments?: AdyenPayment[]; +} +interface AdyenGatewayCreate extends ResourceCreate { + name: string; + merchant_account: string; + api_key: string; + public_key?: string; + live_url_prefix: string; + adyen_payments?: AdyenPaymentRel[]; +} +interface AdyenGatewayUpdate extends ResourceUpdate { + name?: string; + merchant_account?: string; + api_key?: string; + public_key?: string; + live_url_prefix?: string; + adyen_payments?: AdyenPaymentRel[]; +} +declare class AdyenGateways extends ApiResource { + static readonly TYPE: 'adyen_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AdyenGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AdyenGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAdyenGateway(resource: any): resource is AdyenGateway; + relationship(id: string | ResourceId): AdyenGatewayRel; + type(): string; +} +export default AdyenGateways; +export { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate }; diff --git a/lib/cjs/resources/adyen_gateways.js b/lib/cjs/resources/adyen_gateways.js new file mode 100644 index 00000000..a6efef2f --- /dev/null +++ b/lib/cjs/resources/adyen_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class AdyenGateways extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:AdyenGateways.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:AdyenGateways.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:AdyenGateways.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:AdyenGateways.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:AdyenGateways.TYPE,id:e},r)}isAdyenGateway(e){return e.type&&e.type===AdyenGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:AdyenGateways.TYPE}:{id:e.id,type:AdyenGateways.TYPE}}type(){return AdyenGateways.TYPE}}AdyenGateways.TYPE="adyen_gateways",exports.default=AdyenGateways; \ No newline at end of file diff --git a/lib/cjs/resources/adyen_payments.d.ts b/lib/cjs/resources/adyen_payments.d.ts new file mode 100644 index 00000000..94c49d2c --- /dev/null +++ b/lib/cjs/resources/adyen_payments.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type AdyenPaymentRel = ResourceId & { + type: typeof AdyenPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface AdyenPayment extends Resource { + public_key?: string; + payment_methods?: object; + payment_request_data?: object; + payment_request_details?: object; + payment_response?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface AdyenPaymentCreate extends ResourceCreate { + order: OrderRel; +} +interface AdyenPaymentUpdate extends ResourceUpdate { + payment_request_data?: object; + payment_request_details?: object; + payment_response?: object; + _details?: boolean; + order?: OrderRel; +} +declare class AdyenPayments extends ApiResource { + static readonly TYPE: 'adyen_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AdyenPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AdyenPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAdyenPayment(resource: any): resource is AdyenPayment; + relationship(id: string | ResourceId): AdyenPaymentRel; + type(): string; +} +export default AdyenPayments; +export { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate }; diff --git a/lib/cjs/resources/adyen_payments.js b/lib/cjs/resources/adyen_payments.js new file mode 100644 index 00000000..8af3d16b --- /dev/null +++ b/lib/cjs/resources/adyen_payments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class AdyenPayments extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:AdyenPayments.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:AdyenPayments.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:AdyenPayments.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:AdyenPayments.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:AdyenPayments.TYPE,id:e},r)}isAdyenPayment(e){return e.type&&e.type===AdyenPayments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:AdyenPayments.TYPE}:{id:e.id,type:AdyenPayments.TYPE}}type(){return AdyenPayments.TYPE}}AdyenPayments.TYPE="adyen_payments",exports.default=AdyenPayments; \ No newline at end of file diff --git a/lib/cjs/resources/application.d.ts b/lib/cjs/resources/application.d.ts new file mode 100644 index 00000000..814876eb --- /dev/null +++ b/lib/cjs/resources/application.d.ts @@ -0,0 +1,21 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsRetrieve } from '../query'; +declare type ApplicationRel = ResourceId & { + type: typeof Applications.TYPE; +}; +interface Application extends Resource { + name?: string; + kind?: string; + public_access?: string; + redirect_uri?: string; + scopes?: string; +} +declare class Applications extends ApiResource { + static readonly TYPE: 'application'; + retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isApplication(resource: any): resource is Application; + relationship(id: string | ResourceId): ApplicationRel; + type(): string; +} +export default Applications; +export { Application }; diff --git a/lib/cjs/resources/application.js b/lib/cjs/resources/application.js new file mode 100644 index 00000000..11a52b88 --- /dev/null +++ b/lib/cjs/resources/application.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Applications extends resource_1.ApiResource{async retrieve(e,r){return this.resources.singleton({type:Applications.TYPE},e,r)}isApplication(e){return e.type&&e.type===Applications.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Applications.TYPE}:{id:e.id,type:Applications.TYPE}}type(){return Applications.TYPE}}Applications.TYPE="application",exports.default=Applications; \ No newline at end of file diff --git a/lib/cjs/resources/attachments.d.ts b/lib/cjs/resources/attachments.d.ts new file mode 100644 index 00000000..894fd4b5 --- /dev/null +++ b/lib/cjs/resources/attachments.d.ts @@ -0,0 +1,156 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Bundle } from './bundles'; +import { CarrierAccount } from './carrier_accounts'; +import { CustomerGroup } from './customer_groups'; +import { Customer } from './customers'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { Geocoder } from './geocoders'; +import { GiftCardRecipient } from './gift_card_recipients'; +import { GiftCard } from './gift_cards'; +import { InventoryModel } from './inventory_models'; +import { Market } from './markets'; +import { Merchant } from './merchants'; +import { BillingInfoValidationRule } from './billing_info_validation_rules'; +import { Order } from './orders'; +import { Package } from './packages'; +import { Parcel } from './parcels'; +import { PaymentMethod } from './payment_methods'; +import { PriceList } from './price_lists'; +import { Price } from './prices'; +import { Promotion } from './promotions'; +import { Return } from './returns'; +import { Shipment } from './shipments'; +import { ShippingCategory } from './shipping_categories'; +import { ShippingMethod } from './shipping_methods'; +import { ShippingZone } from './shipping_zones'; +import { SkuOption } from './sku_options'; +import { Sku } from './skus'; +import { StockItem } from './stock_items'; +import { StockLocation } from './stock_locations'; +import { TaxCalculator } from './tax_calculators'; +import { TaxCategory } from './tax_categories'; +declare type AttachmentRel = ResourceId & { + type: typeof Attachments.TYPE; +}; +declare type BundleRel = ResourceId & { + type: 'bundles'; +}; +declare type CarrierAccountRel = ResourceId & { + type: 'carrier_accounts'; +}; +declare type CustomerGroupRel = ResourceId & { + type: 'customer_groups'; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type DeliveryLeadTimeRel = ResourceId & { + type: 'delivery_lead_times'; +}; +declare type GeocoderRel = ResourceId & { + type: 'geocoders'; +}; +declare type GiftCardRecipientRel = ResourceId & { + type: 'gift_card_recipients'; +}; +declare type GiftCardRel = ResourceId & { + type: 'gift_cards'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type MerchantRel = ResourceId & { + type: 'merchants'; +}; +declare type BillingInfoValidationRuleRel = ResourceId & { + type: 'billing_info_validation_rules'; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +declare type PackageRel = ResourceId & { + type: 'packages'; +}; +declare type ParcelRel = ResourceId & { + type: 'parcels'; +}; +declare type PaymentMethodRel = ResourceId & { + type: 'payment_methods'; +}; +declare type PriceListRel = ResourceId & { + type: 'price_lists'; +}; +declare type PriceRel = ResourceId & { + type: 'prices'; +}; +declare type PromotionRel = ResourceId & { + type: 'promotions'; +}; +declare type ReturnRel = ResourceId & { + type: 'returns'; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type ShippingCategoryRel = ResourceId & { + type: 'shipping_categories'; +}; +declare type ShippingMethodRel = ResourceId & { + type: 'shipping_methods'; +}; +declare type ShippingZoneRel = ResourceId & { + type: 'shipping_zones'; +}; +declare type SkuOptionRel = ResourceId & { + type: 'sku_options'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +declare type StockItemRel = ResourceId & { + type: 'stock_items'; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type TaxCalculatorRel = ResourceId & { + type: 'tax_calculators'; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface Attachment extends Resource { + name?: string; + description?: string; + url?: string; + attachable?: Bundle | CarrierAccount | CustomerGroup | Customer | DeliveryLeadTime | Geocoder | GiftCardRecipient | GiftCard | InventoryModel | Market | Merchant | BillingInfoValidationRule | Order | Package | Parcel | PaymentMethod | PriceList | Price | Promotion | Return | Shipment | ShippingCategory | ShippingMethod | ShippingZone | SkuOption | Sku | StockItem | StockLocation | TaxCalculator | TaxCategory; +} +interface AttachmentCreate extends ResourceCreate { + name: string; + description?: string; + url?: string; + attachable: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | TaxCalculatorRel | TaxCategoryRel; +} +interface AttachmentUpdate extends ResourceUpdate { + name?: string; + description?: string; + url?: string; + attachable?: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | TaxCalculatorRel | TaxCategoryRel; +} +declare class Attachments extends ApiResource { + static readonly TYPE: 'attachments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AttachmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AttachmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAttachment(resource: any): resource is Attachment; + relationship(id: string | ResourceId): AttachmentRel; + type(): string; +} +export default Attachments; +export { Attachment, AttachmentCreate, AttachmentUpdate }; diff --git a/lib/cjs/resources/attachments.js b/lib/cjs/resources/attachments.js new file mode 100644 index 00000000..0fc5a7b3 --- /dev/null +++ b/lib/cjs/resources/attachments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Attachments extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Attachments.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:Attachments.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:Attachments.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:Attachments.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:Attachments.TYPE,id:e},r)}isAttachment(e){return e.type&&e.type===Attachments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Attachments.TYPE}:{id:e.id,type:Attachments.TYPE}}type(){return Attachments.TYPE}}Attachments.TYPE="attachments",exports.default=Attachments; \ No newline at end of file diff --git a/lib/cjs/resources/authorizations.d.ts b/lib/cjs/resources/authorizations.d.ts new file mode 100644 index 00000000..bb7ab435 --- /dev/null +++ b/lib/cjs/resources/authorizations.d.ts @@ -0,0 +1,54 @@ +import { ApiResource, Resource, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Capture } from './captures'; +import { Void } from './voids'; +declare type AuthorizationRel = ResourceId & { + type: typeof Authorizations.TYPE; +}; +interface Authorization extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + cvv_code?: string; + cvv_message?: string; + avs_code?: string; + avs_message?: string; + fraud_review?: string; + capture_amount_cents?: number; + capture_amount_float?: number; + formatted_capture_amount?: string; + capture_balance_cents?: number; + capture_balance_float?: number; + formatted_capture_balance?: string; + void_balance_cents?: number; + void_balance_float?: number; + formatted_void_balance?: string; + order?: Order; + captures?: Capture[]; + voids?: Void[]; +} +interface AuthorizationUpdate extends ResourceUpdate { + _capture?: boolean; + _capture_amount_cents?: number; + _void?: boolean; +} +declare class Authorizations extends ApiResource { + static readonly TYPE: 'authorizations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AuthorizationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isAuthorization(resource: any): resource is Authorization; + relationship(id: string | ResourceId): AuthorizationRel; + type(): string; +} +export default Authorizations; +export { Authorization, AuthorizationUpdate }; diff --git a/lib/cjs/resources/authorizations.js b/lib/cjs/resources/authorizations.js new file mode 100644 index 00000000..d7199fc8 --- /dev/null +++ b/lib/cjs/resources/authorizations.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Authorizations extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Authorizations.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:Authorizations.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:Authorizations.TYPE}),r,t)}isAuthorization(e){return e.type&&e.type===Authorizations.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Authorizations.TYPE}:{id:e.id,type:Authorizations.TYPE}}type(){return Authorizations.TYPE}}Authorizations.TYPE="authorizations",exports.default=Authorizations; \ No newline at end of file diff --git a/lib/cjs/resources/avalara_accounts.d.ts b/lib/cjs/resources/avalara_accounts.d.ts new file mode 100644 index 00000000..1f6debf7 --- /dev/null +++ b/lib/cjs/resources/avalara_accounts.d.ts @@ -0,0 +1,49 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type AvalaraAccountRel = ResourceId & { + type: typeof AvalaraAccounts.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface AvalaraAccount extends Resource { + name?: string; + username?: string; + company_code?: string; + ddp?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface AvalaraAccountCreate extends ResourceCreate { + name: string; + username: string; + password: string; + company_code: string; + ddp?: string; + tax_categories?: TaxCategoryRel[]; +} +interface AvalaraAccountUpdate extends ResourceUpdate { + name?: string; + username?: string; + password?: string; + company_code?: string; + ddp?: string; + tax_categories?: TaxCategoryRel[]; +} +declare class AvalaraAccounts extends ApiResource { + static readonly TYPE: 'avalara_accounts'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AvalaraAccountCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AvalaraAccountUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAvalaraAccount(resource: any): resource is AvalaraAccount; + relationship(id: string | ResourceId): AvalaraAccountRel; + type(): string; +} +export default AvalaraAccounts; +export { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate }; diff --git a/lib/cjs/resources/avalara_accounts.js b/lib/cjs/resources/avalara_accounts.js new file mode 100644 index 00000000..e765a7d6 --- /dev/null +++ b/lib/cjs/resources/avalara_accounts.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class AvalaraAccounts extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:AvalaraAccounts.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:AvalaraAccounts.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:AvalaraAccounts.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:AvalaraAccounts.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:AvalaraAccounts.TYPE,id:e},t)}isAvalaraAccount(e){return e.type&&e.type===AvalaraAccounts.TYPE}relationship(e){return typeof e=="string"?{id:e,type:AvalaraAccounts.TYPE}:{id:e.id,type:AvalaraAccounts.TYPE}}type(){return AvalaraAccounts.TYPE}}AvalaraAccounts.TYPE="avalara_accounts",exports.default=AvalaraAccounts; \ No newline at end of file diff --git a/lib/cjs/resources/billing_info_validation_rules.d.ts b/lib/cjs/resources/billing_info_validation_rules.d.ts new file mode 100644 index 00000000..2c3410e0 --- /dev/null +++ b/lib/cjs/resources/billing_info_validation_rules.d.ts @@ -0,0 +1,31 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +declare type BillingInfoValidationRuleRel = ResourceId & { + type: typeof BillingInfoValidationRules.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +interface BillingInfoValidationRule extends Resource { + market?: Market; +} +interface BillingInfoValidationRuleCreate extends ResourceCreate { + market: MarketRel; +} +interface BillingInfoValidationRuleUpdate extends ResourceUpdate { + market?: MarketRel; +} +declare class BillingInfoValidationRules extends ApiResource { + static readonly TYPE: 'billing_info_validation_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BillingInfoValidationRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BillingInfoValidationRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBillingInfoValidationRule(resource: any): resource is BillingInfoValidationRule; + relationship(id: string | ResourceId): BillingInfoValidationRuleRel; + type(): string; +} +export default BillingInfoValidationRules; +export { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate }; diff --git a/lib/cjs/resources/billing_info_validation_rules.js b/lib/cjs/resources/billing_info_validation_rules.js new file mode 100644 index 00000000..0b8a1633 --- /dev/null +++ b/lib/cjs/resources/billing_info_validation_rules.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class BillingInfoValidationRules extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:BillingInfoValidationRules.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:BillingInfoValidationRules.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:BillingInfoValidationRules.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:BillingInfoValidationRules.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:BillingInfoValidationRules.TYPE,id:e},r)}isBillingInfoValidationRule(e){return e.type&&e.type===BillingInfoValidationRules.TYPE}relationship(e){return typeof e=="string"?{id:e,type:BillingInfoValidationRules.TYPE}:{id:e.id,type:BillingInfoValidationRules.TYPE}}type(){return BillingInfoValidationRules.TYPE}}BillingInfoValidationRules.TYPE="billing_info_validation_rules",exports.default=BillingInfoValidationRules; \ No newline at end of file diff --git a/lib/cjs/resources/bing_geocoders.d.ts b/lib/cjs/resources/bing_geocoders.d.ts new file mode 100644 index 00000000..cf0c71f5 --- /dev/null +++ b/lib/cjs/resources/bing_geocoders.d.ts @@ -0,0 +1,33 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type BingGeocoderRel = ResourceId & { + type: typeof BingGeocoders.TYPE; +}; +interface BingGeocoder extends Resource { + name?: string; + addresses?: Address[]; + attachments?: Attachment[]; +} +interface BingGeocoderCreate extends ResourceCreate { + name: string; + key: string; +} +interface BingGeocoderUpdate extends ResourceUpdate { + name?: string; + key?: string; +} +declare class BingGeocoders extends ApiResource { + static readonly TYPE: 'bing_geocoders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BingGeocoderCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BingGeocoderUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBingGeocoder(resource: any): resource is BingGeocoder; + relationship(id: string | ResourceId): BingGeocoderRel; + type(): string; +} +export default BingGeocoders; +export { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate }; diff --git a/lib/cjs/resources/bing_geocoders.js b/lib/cjs/resources/bing_geocoders.js new file mode 100644 index 00000000..da234fc0 --- /dev/null +++ b/lib/cjs/resources/bing_geocoders.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class BingGeocoders extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:BingGeocoders.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:BingGeocoders.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:BingGeocoders.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:BingGeocoders.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:BingGeocoders.TYPE,id:e},t)}isBingGeocoder(e){return e.type&&e.type===BingGeocoders.TYPE}relationship(e){return typeof e=="string"?{id:e,type:BingGeocoders.TYPE}:{id:e.id,type:BingGeocoders.TYPE}}type(){return BingGeocoders.TYPE}}BingGeocoders.TYPE="bing_geocoders",exports.default=BingGeocoders; \ No newline at end of file diff --git a/lib/cjs/resources/braintree_gateways.d.ts b/lib/cjs/resources/braintree_gateways.d.ts new file mode 100644 index 00000000..e63ed61e --- /dev/null +++ b/lib/cjs/resources/braintree_gateways.d.ts @@ -0,0 +1,54 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { BraintreePayment } from './braintree_payments'; +declare type BraintreeGatewayRel = ResourceId & { + type: typeof BraintreeGateways.TYPE; +}; +declare type BraintreePaymentRel = ResourceId & { + type: 'braintree_payments'; +}; +interface BraintreeGateway extends Resource { + name?: string; + descriptor_name?: string; + descriptor_phone?: string; + descriptor_url?: string; + webhook_endpoint_url?: string; + payment_methods?: PaymentMethod[]; + braintree_payments?: BraintreePayment[]; +} +interface BraintreeGatewayCreate extends ResourceCreate { + name: string; + merchant_account_id: string; + merchant_id: string; + public_key: string; + private_key: string; + descriptor_name?: string; + descriptor_phone?: string; + descriptor_url?: string; + braintree_payments?: BraintreePaymentRel[]; +} +interface BraintreeGatewayUpdate extends ResourceUpdate { + name?: string; + merchant_account_id?: string; + merchant_id?: string; + public_key?: string; + private_key?: string; + descriptor_name?: string; + descriptor_phone?: string; + descriptor_url?: string; + braintree_payments?: BraintreePaymentRel[]; +} +declare class BraintreeGateways extends ApiResource { + static readonly TYPE: 'braintree_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BraintreeGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BraintreeGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBraintreeGateway(resource: any): resource is BraintreeGateway; + relationship(id: string | ResourceId): BraintreeGatewayRel; + type(): string; +} +export default BraintreeGateways; +export { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate }; diff --git a/lib/cjs/resources/braintree_gateways.js b/lib/cjs/resources/braintree_gateways.js new file mode 100644 index 00000000..ca4a2a1a --- /dev/null +++ b/lib/cjs/resources/braintree_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class BraintreeGateways extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:BraintreeGateways.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:BraintreeGateways.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:BraintreeGateways.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:BraintreeGateways.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:BraintreeGateways.TYPE,id:e},s)}isBraintreeGateway(e){return e.type&&e.type===BraintreeGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:BraintreeGateways.TYPE}:{id:e.id,type:BraintreeGateways.TYPE}}type(){return BraintreeGateways.TYPE}}BraintreeGateways.TYPE="braintree_gateways",exports.default=BraintreeGateways; \ No newline at end of file diff --git a/lib/cjs/resources/braintree_payments.d.ts b/lib/cjs/resources/braintree_payments.d.ts new file mode 100644 index 00000000..f527a12d --- /dev/null +++ b/lib/cjs/resources/braintree_payments.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type BraintreePaymentRel = ResourceId & { + type: typeof BraintreePayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface BraintreePayment extends Resource { + client_token?: string; + payment_method_nonce?: string; + payment_id?: string; + local?: boolean; + options?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface BraintreePaymentCreate extends ResourceCreate { + payment_id?: string; + local?: boolean; + options?: object; + order: OrderRel; +} +interface BraintreePaymentUpdate extends ResourceUpdate { + payment_method_nonce?: string; + payment_id?: string; + local?: boolean; + options?: object; + order?: OrderRel; +} +declare class BraintreePayments extends ApiResource { + static readonly TYPE: 'braintree_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BraintreePaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BraintreePaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBraintreePayment(resource: any): resource is BraintreePayment; + relationship(id: string | ResourceId): BraintreePaymentRel; + type(): string; +} +export default BraintreePayments; +export { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate }; diff --git a/lib/cjs/resources/braintree_payments.js b/lib/cjs/resources/braintree_payments.js new file mode 100644 index 00000000..570b75f9 --- /dev/null +++ b/lib/cjs/resources/braintree_payments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class BraintreePayments extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:BraintreePayments.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:BraintreePayments.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:BraintreePayments.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:BraintreePayments.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:BraintreePayments.TYPE,id:e},s)}isBraintreePayment(e){return e.type&&e.type===BraintreePayments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:BraintreePayments.TYPE}:{id:e.id,type:BraintreePayments.TYPE}}type(){return BraintreePayments.TYPE}}BraintreePayments.TYPE="braintree_payments",exports.default=BraintreePayments; \ No newline at end of file diff --git a/lib/cjs/resources/bundles.d.ts b/lib/cjs/resources/bundles.d.ts new file mode 100644 index 00000000..d7badaf5 --- /dev/null +++ b/lib/cjs/resources/bundles.d.ts @@ -0,0 +1,65 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type BundleRel = ResourceId & { + type: typeof Bundles.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface Bundle extends Resource { + code?: string; + name?: string; + description?: string; + image_url?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + compare_at_amount_cents?: number; + compare_at_amount_float?: number; + formatted_compare_at_amount?: string; + skus_count?: number; + market?: Market; + sku_list?: SkuList; + skus?: Sku[]; + attachments?: Attachment[]; +} +interface BundleCreate extends ResourceCreate { + code: string; + name: string; + description?: string; + image_url?: string; + price_amount_cents: number; + compare_at_amount_cents: number; + _compute_compare_at_amount?: boolean; + market?: MarketRel; + sku_list: SkuListRel; +} +interface BundleUpdate extends ResourceUpdate { + code?: string; + name?: string; + description?: string; + image_url?: string; + price_amount_cents?: number; + compare_at_amount_cents?: number; + _compute_compare_at_amount?: boolean; +} +declare class Bundles extends ApiResource { + static readonly TYPE: 'bundles'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BundleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BundleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBundle(resource: any): resource is Bundle; + relationship(id: string | ResourceId): BundleRel; + type(): string; +} +export default Bundles; +export { Bundle, BundleCreate, BundleUpdate }; diff --git a/lib/cjs/resources/bundles.js b/lib/cjs/resources/bundles.js new file mode 100644 index 00000000..64d3e3cf --- /dev/null +++ b/lib/cjs/resources/bundles.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Bundles extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Bundles.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Bundles.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Bundles.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Bundles.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Bundles.TYPE,id:e},t)}isBundle(e){return e.type&&e.type===Bundles.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Bundles.TYPE}:{id:e.id,type:Bundles.TYPE}}type(){return Bundles.TYPE}}Bundles.TYPE="bundles",exports.default=Bundles; \ No newline at end of file diff --git a/lib/cjs/resources/captures.d.ts b/lib/cjs/resources/captures.d.ts new file mode 100644 index 00000000..369ab109 --- /dev/null +++ b/lib/cjs/resources/captures.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Authorization } from './authorizations'; +import { Refund } from './refunds'; +declare type CaptureRel = ResourceId & { + type: typeof Captures.TYPE; +}; +interface Capture extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + refund_amount_cents?: number; + refund_amount_float?: number; + formatted_refund_amount?: string; + refund_balance_cents?: number; + refund_balance_float?: number; + formatted_refund_balance?: string; + order?: Order; + reference_authorization?: Authorization; + refunds?: Refund[]; +} +interface CaptureUpdate extends ResourceUpdate { + _refund?: boolean; + _refund_amount_cents?: number; +} +declare class Captures extends ApiResource { + static readonly TYPE: 'captures'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CaptureUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isCapture(resource: any): resource is Capture; + relationship(id: string | ResourceId): CaptureRel; + type(): string; +} +export default Captures; +export { Capture, CaptureUpdate }; diff --git a/lib/cjs/resources/captures.js b/lib/cjs/resources/captures.js new file mode 100644 index 00000000..e1a95ac1 --- /dev/null +++ b/lib/cjs/resources/captures.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Captures extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Captures.TYPE},e,t)}async retrieve(e,t,r){return this.resources.retrieve({type:Captures.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Captures.TYPE}),t,r)}isCapture(e){return e.type&&e.type===Captures.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Captures.TYPE}:{id:e.id,type:Captures.TYPE}}type(){return Captures.TYPE}}Captures.TYPE="captures",exports.default=Captures; \ No newline at end of file diff --git a/lib/cjs/resources/carrier_accounts.d.ts b/lib/cjs/resources/carrier_accounts.d.ts new file mode 100644 index 00000000..6f09fcbd --- /dev/null +++ b/lib/cjs/resources/carrier_accounts.d.ts @@ -0,0 +1,24 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type CarrierAccountRel = ResourceId & { + type: typeof CarrierAccounts.TYPE; +}; +interface CarrierAccount extends Resource { + name?: string; + easypost_type?: string; + easypost_id?: string; + market?: Market; + attachments?: Attachment[]; +} +declare class CarrierAccounts extends ApiResource { + static readonly TYPE: 'carrier_accounts'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isCarrierAccount(resource: any): resource is CarrierAccount; + relationship(id: string | ResourceId): CarrierAccountRel; + type(): string; +} +export default CarrierAccounts; +export { CarrierAccount }; diff --git a/lib/cjs/resources/carrier_accounts.js b/lib/cjs/resources/carrier_accounts.js new file mode 100644 index 00000000..f00fa85e --- /dev/null +++ b/lib/cjs/resources/carrier_accounts.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CarrierAccounts extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:CarrierAccounts.TYPE},e,t)}async retrieve(e,t,r){return this.resources.retrieve({type:CarrierAccounts.TYPE,id:e},t,r)}isCarrierAccount(e){return e.type&&e.type===CarrierAccounts.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CarrierAccounts.TYPE}:{id:e.id,type:CarrierAccounts.TYPE}}type(){return CarrierAccounts.TYPE}}CarrierAccounts.TYPE="carrier_accounts",exports.default=CarrierAccounts; \ No newline at end of file diff --git a/lib/cjs/resources/checkout_com_gateways.d.ts b/lib/cjs/resources/checkout_com_gateways.d.ts new file mode 100644 index 00000000..a288407a --- /dev/null +++ b/lib/cjs/resources/checkout_com_gateways.d.ts @@ -0,0 +1,43 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { CheckoutComPayment } from './checkout_com_payments'; +declare type CheckoutComGatewayRel = ResourceId & { + type: typeof CheckoutComGateways.TYPE; +}; +declare type CheckoutComPaymentRel = ResourceId & { + type: 'checkout_com_payments'; +}; +interface CheckoutComGateway extends Resource { + name?: string; + webhook_endpoint_id?: string; + webhook_endpoint_secret?: string; + webhook_endpoint_url?: string; + payment_methods?: PaymentMethod[]; + checkout_com_payments?: CheckoutComPayment[]; +} +interface CheckoutComGatewayCreate extends ResourceCreate { + name: string; + secret_key: string; + public_key: string; + checkout_com_payments?: CheckoutComPaymentRel[]; +} +interface CheckoutComGatewayUpdate extends ResourceUpdate { + name?: string; + secret_key?: string; + public_key?: string; + checkout_com_payments?: CheckoutComPaymentRel[]; +} +declare class CheckoutComGateways extends ApiResource { + static readonly TYPE: 'checkout_com_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CheckoutComGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CheckoutComGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCheckoutComGateway(resource: any): resource is CheckoutComGateway; + relationship(id: string | ResourceId): CheckoutComGatewayRel; + type(): string; +} +export default CheckoutComGateways; +export { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate }; diff --git a/lib/cjs/resources/checkout_com_gateways.js b/lib/cjs/resources/checkout_com_gateways.js new file mode 100644 index 00000000..0008c364 --- /dev/null +++ b/lib/cjs/resources/checkout_com_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CheckoutComGateways extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:CheckoutComGateways.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:CheckoutComGateways.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:CheckoutComGateways.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:CheckoutComGateways.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:CheckoutComGateways.TYPE,id:e},r)}isCheckoutComGateway(e){return e.type&&e.type===CheckoutComGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CheckoutComGateways.TYPE}:{id:e.id,type:CheckoutComGateways.TYPE}}type(){return CheckoutComGateways.TYPE}}CheckoutComGateways.TYPE="checkout_com_gateways",exports.default=CheckoutComGateways; \ No newline at end of file diff --git a/lib/cjs/resources/checkout_com_payments.d.ts b/lib/cjs/resources/checkout_com_payments.d.ts new file mode 100644 index 00000000..0d8da1fb --- /dev/null +++ b/lib/cjs/resources/checkout_com_payments.d.ts @@ -0,0 +1,48 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type CheckoutComPaymentRel = ResourceId & { + type: typeof CheckoutComPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface CheckoutComPayment extends Resource { + payment_type?: string; + token?: string; + session_id?: string; + source_id?: string; + customer_token?: string; + redirect_uri?: string; + payment_response?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface CheckoutComPaymentCreate extends ResourceCreate { + payment_type: string; + token: string; + session_id?: string; + order: OrderRel; +} +interface CheckoutComPaymentUpdate extends ResourceUpdate { + payment_type?: string; + token?: string; + session_id?: string; + _details?: boolean; + _refresh?: boolean; + order?: OrderRel; +} +declare class CheckoutComPayments extends ApiResource { + static readonly TYPE: 'checkout_com_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CheckoutComPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CheckoutComPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCheckoutComPayment(resource: any): resource is CheckoutComPayment; + relationship(id: string | ResourceId): CheckoutComPaymentRel; + type(): string; +} +export default CheckoutComPayments; +export { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate }; diff --git a/lib/cjs/resources/checkout_com_payments.js b/lib/cjs/resources/checkout_com_payments.js new file mode 100644 index 00000000..32b395dd --- /dev/null +++ b/lib/cjs/resources/checkout_com_payments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CheckoutComPayments extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:CheckoutComPayments.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:CheckoutComPayments.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:CheckoutComPayments.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:CheckoutComPayments.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:CheckoutComPayments.TYPE,id:e},r)}isCheckoutComPayment(e){return e.type&&e.type===CheckoutComPayments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CheckoutComPayments.TYPE}:{id:e.id,type:CheckoutComPayments.TYPE}}type(){return CheckoutComPayments.TYPE}}CheckoutComPayments.TYPE="checkout_com_payments",exports.default=CheckoutComPayments; \ No newline at end of file diff --git a/lib/cjs/resources/coupon_codes_promotion_rules.d.ts b/lib/cjs/resources/coupon_codes_promotion_rules.d.ts new file mode 100644 index 00000000..c143dbf7 --- /dev/null +++ b/lib/cjs/resources/coupon_codes_promotion_rules.d.ts @@ -0,0 +1,58 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +import { Coupon } from './coupons'; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: typeof CouponCodesPromotionRules.TYPE; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeGiftPromotionRel = ResourceId & { + type: 'free_gift_promotions'; +}; +declare type FixedPricePromotionRel = ResourceId & { + type: 'fixed_price_promotions'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +declare type CouponRel = ResourceId & { + type: 'coupons'; +}; +interface CouponCodesPromotionRule extends Resource { + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; + coupons?: Coupon[]; +} +interface CouponCodesPromotionRuleCreate extends ResourceCreate { + promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + coupons?: CouponRel[]; +} +interface CouponCodesPromotionRuleUpdate extends ResourceUpdate { + promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + coupons?: CouponRel[]; +} +declare class CouponCodesPromotionRules extends ApiResource { + static readonly TYPE: 'coupon_codes_promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CouponCodesPromotionRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CouponCodesPromotionRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCouponCodesPromotionRule(resource: any): resource is CouponCodesPromotionRule; + relationship(id: string | ResourceId): CouponCodesPromotionRuleRel; + type(): string; +} +export default CouponCodesPromotionRules; +export { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate }; diff --git a/lib/cjs/resources/coupon_codes_promotion_rules.js b/lib/cjs/resources/coupon_codes_promotion_rules.js new file mode 100644 index 00000000..9d3f3147 --- /dev/null +++ b/lib/cjs/resources/coupon_codes_promotion_rules.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CouponCodesPromotionRules extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:CouponCodesPromotionRules.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:CouponCodesPromotionRules.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:CouponCodesPromotionRules.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:CouponCodesPromotionRules.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:CouponCodesPromotionRules.TYPE,id:e},t)}isCouponCodesPromotionRule(e){return e.type&&e.type===CouponCodesPromotionRules.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CouponCodesPromotionRules.TYPE}:{id:e.id,type:CouponCodesPromotionRules.TYPE}}type(){return CouponCodesPromotionRules.TYPE}}CouponCodesPromotionRules.TYPE="coupon_codes_promotion_rules",exports.default=CouponCodesPromotionRules; \ No newline at end of file diff --git a/lib/cjs/resources/coupon_recipients.d.ts b/lib/cjs/resources/coupon_recipients.d.ts new file mode 100644 index 00000000..198a2667 --- /dev/null +++ b/lib/cjs/resources/coupon_recipients.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Attachment } from './attachments'; +declare type CouponRecipientRel = ResourceId & { + type: typeof CouponRecipients.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +interface CouponRecipient extends Resource { + email?: string; + first_name?: string; + last_name?: string; + customer?: Customer; + attachments?: Attachment[]; +} +interface CouponRecipientCreate extends ResourceCreate { + email: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +interface CouponRecipientUpdate extends ResourceUpdate { + email?: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +declare class CouponRecipients extends ApiResource { + static readonly TYPE: 'coupon_recipients'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CouponRecipientCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CouponRecipientUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCouponRecipient(resource: any): resource is CouponRecipient; + relationship(id: string | ResourceId): CouponRecipientRel; + type(): string; +} +export default CouponRecipients; +export { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate }; diff --git a/lib/cjs/resources/coupon_recipients.js b/lib/cjs/resources/coupon_recipients.js new file mode 100644 index 00000000..83631187 --- /dev/null +++ b/lib/cjs/resources/coupon_recipients.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CouponRecipients extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:CouponRecipients.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:CouponRecipients.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:CouponRecipients.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:CouponRecipients.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:CouponRecipients.TYPE,id:e},r)}isCouponRecipient(e){return e.type&&e.type===CouponRecipients.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CouponRecipients.TYPE}:{id:e.id,type:CouponRecipients.TYPE}}type(){return CouponRecipients.TYPE}}CouponRecipients.TYPE="coupon_recipients",exports.default=CouponRecipients; \ No newline at end of file diff --git a/lib/cjs/resources/coupons.d.ts b/lib/cjs/resources/coupons.d.ts new file mode 100644 index 00000000..5c7013b6 --- /dev/null +++ b/lib/cjs/resources/coupons.d.ts @@ -0,0 +1,44 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +declare type CouponRel = ResourceId & { + type: typeof Coupons.TYPE; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface Coupon extends Resource { + code?: string; + customer_single_use?: boolean; + usage_limit?: number; + usage_count?: number; + recipient_email?: string; + promotion_rule?: CouponCodesPromotionRule; +} +interface CouponCreate extends ResourceCreate { + code: string; + customer_single_use?: boolean; + usage_limit: number; + recipient_email?: string; + promotion_rule: CouponCodesPromotionRuleRel; +} +interface CouponUpdate extends ResourceUpdate { + code?: string; + customer_single_use?: boolean; + usage_limit?: number; + recipient_email?: string; + promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class Coupons extends ApiResource { + static readonly TYPE: 'coupons'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CouponCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CouponUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCoupon(resource: any): resource is Coupon; + relationship(id: string | ResourceId): CouponRel; + type(): string; +} +export default Coupons; +export { Coupon, CouponCreate, CouponUpdate }; diff --git a/lib/cjs/resources/coupons.js b/lib/cjs/resources/coupons.js new file mode 100644 index 00000000..3501cdcb --- /dev/null +++ b/lib/cjs/resources/coupons.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Coupons extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Coupons.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Coupons.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Coupons.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Coupons.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Coupons.TYPE,id:e},t)}isCoupon(e){return e.type&&e.type===Coupons.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Coupons.TYPE}:{id:e.id,type:Coupons.TYPE}}type(){return Coupons.TYPE}}Coupons.TYPE="coupons",exports.default=Coupons; \ No newline at end of file diff --git a/lib/cjs/resources/customer_addresses.d.ts b/lib/cjs/resources/customer_addresses.d.ts new file mode 100644 index 00000000..5096f13e --- /dev/null +++ b/lib/cjs/resources/customer_addresses.d.ts @@ -0,0 +1,39 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Address } from './addresses'; +declare type CustomerAddressRel = ResourceId & { + type: typeof CustomerAddresses.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +interface CustomerAddress extends Resource { + name?: string; + customer?: Customer; + address?: Address; +} +interface CustomerAddressCreate extends ResourceCreate { + customer: CustomerRel; + address: AddressRel; +} +interface CustomerAddressUpdate extends ResourceUpdate { + customer?: CustomerRel; + address?: AddressRel; +} +declare class CustomerAddresses extends ApiResource { + static readonly TYPE: 'customer_addresses'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerAddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerAddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerAddress(resource: any): resource is CustomerAddress; + relationship(id: string | ResourceId): CustomerAddressRel; + type(): string; +} +export default CustomerAddresses; +export { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate }; diff --git a/lib/cjs/resources/customer_addresses.js b/lib/cjs/resources/customer_addresses.js new file mode 100644 index 00000000..f67847cd --- /dev/null +++ b/lib/cjs/resources/customer_addresses.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CustomerAddresses extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:CustomerAddresses.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:CustomerAddresses.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:CustomerAddresses.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:CustomerAddresses.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:CustomerAddresses.TYPE,id:e},t)}isCustomerAddress(e){return e.type&&e.type===CustomerAddresses.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CustomerAddresses.TYPE}:{id:e.id,type:CustomerAddresses.TYPE}}type(){return CustomerAddresses.TYPE}}CustomerAddresses.TYPE="customer_addresses",exports.default=CustomerAddresses; \ No newline at end of file diff --git a/lib/cjs/resources/customer_groups.d.ts b/lib/cjs/resources/customer_groups.d.ts new file mode 100644 index 00000000..03faf7b0 --- /dev/null +++ b/lib/cjs/resources/customer_groups.d.ts @@ -0,0 +1,33 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type CustomerGroupRel = ResourceId & { + type: typeof CustomerGroups.TYPE; +}; +interface CustomerGroup extends Resource { + name?: string; + customers?: Customer[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface CustomerGroupCreate extends ResourceCreate { + name: string; +} +interface CustomerGroupUpdate extends ResourceUpdate { + name?: string; +} +declare class CustomerGroups extends ApiResource { + static readonly TYPE: 'customer_groups'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerGroupCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerGroupUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerGroup(resource: any): resource is CustomerGroup; + relationship(id: string | ResourceId): CustomerGroupRel; + type(): string; +} +export default CustomerGroups; +export { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate }; diff --git a/lib/cjs/resources/customer_groups.js b/lib/cjs/resources/customer_groups.js new file mode 100644 index 00000000..51b26cba --- /dev/null +++ b/lib/cjs/resources/customer_groups.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CustomerGroups extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:CustomerGroups.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:CustomerGroups.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:CustomerGroups.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:CustomerGroups.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:CustomerGroups.TYPE,id:e},t)}isCustomerGroup(e){return e.type&&e.type===CustomerGroups.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CustomerGroups.TYPE}:{id:e.id,type:CustomerGroups.TYPE}}type(){return CustomerGroups.TYPE}}CustomerGroups.TYPE="customer_groups",exports.default=CustomerGroups; \ No newline at end of file diff --git a/lib/cjs/resources/customer_password_resets.d.ts b/lib/cjs/resources/customer_password_resets.d.ts new file mode 100644 index 00000000..4100ab72 --- /dev/null +++ b/lib/cjs/resources/customer_password_resets.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +declare type CustomerPasswordResetRel = ResourceId & { + type: typeof CustomerPasswordResets.TYPE; +}; +interface CustomerPasswordReset extends Resource { + customer_email?: string; + reset_password_token?: string; + reset_password_at?: string; + customer?: Customer; +} +interface CustomerPasswordResetCreate extends ResourceCreate { + customer_email: string; +} +interface CustomerPasswordResetUpdate extends ResourceUpdate { + customer_password?: string; + _reset_password_token?: string; +} +declare class CustomerPasswordResets extends ApiResource { + static readonly TYPE: 'customer_password_resets'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerPasswordResetCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerPasswordResetUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerPasswordReset(resource: any): resource is CustomerPasswordReset; + relationship(id: string | ResourceId): CustomerPasswordResetRel; + type(): string; +} +export default CustomerPasswordResets; +export { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate }; diff --git a/lib/cjs/resources/customer_password_resets.js b/lib/cjs/resources/customer_password_resets.js new file mode 100644 index 00000000..f36d8434 --- /dev/null +++ b/lib/cjs/resources/customer_password_resets.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CustomerPasswordResets extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:CustomerPasswordResets.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:CustomerPasswordResets.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:CustomerPasswordResets.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:CustomerPasswordResets.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:CustomerPasswordResets.TYPE,id:e},t)}isCustomerPasswordReset(e){return e.type&&e.type===CustomerPasswordResets.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CustomerPasswordResets.TYPE}:{id:e.id,type:CustomerPasswordResets.TYPE}}type(){return CustomerPasswordResets.TYPE}}CustomerPasswordResets.TYPE="customer_password_resets",exports.default=CustomerPasswordResets; \ No newline at end of file diff --git a/lib/cjs/resources/customer_payment_sources.d.ts b/lib/cjs/resources/customer_payment_sources.d.ts new file mode 100644 index 00000000..d3e1c02a --- /dev/null +++ b/lib/cjs/resources/customer_payment_sources.d.ts @@ -0,0 +1,65 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { AdyenPayment } from './adyen_payments'; +import { BraintreePayment } from './braintree_payments'; +import { CheckoutComPayment } from './checkout_com_payments'; +import { ExternalPayment } from './external_payments'; +import { PaypalPayment } from './paypal_payments'; +import { StripePayment } from './stripe_payments'; +import { WireTransfer } from './wire_transfers'; +declare type CustomerPaymentSourceRel = ResourceId & { + type: typeof CustomerPaymentSources.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type AdyenPaymentRel = ResourceId & { + type: 'adyen_payments'; +}; +declare type BraintreePaymentRel = ResourceId & { + type: 'braintree_payments'; +}; +declare type CheckoutComPaymentRel = ResourceId & { + type: 'checkout_com_payments'; +}; +declare type ExternalPaymentRel = ResourceId & { + type: 'external_payments'; +}; +declare type PaypalPaymentRel = ResourceId & { + type: 'paypal_payments'; +}; +declare type StripePaymentRel = ResourceId & { + type: 'stripe_payments'; +}; +declare type WireTransferRel = ResourceId & { + type: 'wire_transfers'; +}; +interface CustomerPaymentSource extends Resource { + name?: string; + customer_token?: string; + payment_source_token?: string; + customer?: Customer; + payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer; +} +interface CustomerPaymentSourceCreate extends ResourceCreate { + customer: CustomerRel; + payment_source: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +interface CustomerPaymentSourceUpdate extends ResourceUpdate { + customer?: CustomerRel; + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +declare class CustomerPaymentSources extends ApiResource { + static readonly TYPE: 'customer_payment_sources'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerPaymentSourceCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerPaymentSourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerPaymentSource(resource: any): resource is CustomerPaymentSource; + relationship(id: string | ResourceId): CustomerPaymentSourceRel; + type(): string; +} +export default CustomerPaymentSources; +export { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate }; diff --git a/lib/cjs/resources/customer_payment_sources.js b/lib/cjs/resources/customer_payment_sources.js new file mode 100644 index 00000000..6cdaf398 --- /dev/null +++ b/lib/cjs/resources/customer_payment_sources.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CustomerPaymentSources extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:CustomerPaymentSources.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:CustomerPaymentSources.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:CustomerPaymentSources.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:CustomerPaymentSources.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:CustomerPaymentSources.TYPE,id:e},t)}isCustomerPaymentSource(e){return e.type&&e.type===CustomerPaymentSources.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CustomerPaymentSources.TYPE}:{id:e.id,type:CustomerPaymentSources.TYPE}}type(){return CustomerPaymentSources.TYPE}}CustomerPaymentSources.TYPE="customer_payment_sources",exports.default=CustomerPaymentSources; \ No newline at end of file diff --git a/lib/cjs/resources/customer_subscriptions.d.ts b/lib/cjs/resources/customer_subscriptions.d.ts new file mode 100644 index 00000000..f13d5fc7 --- /dev/null +++ b/lib/cjs/resources/customer_subscriptions.d.ts @@ -0,0 +1,27 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +declare type CustomerSubscriptionRel = ResourceId & { + type: typeof CustomerSubscriptions.TYPE; +}; +interface CustomerSubscription extends Resource { + customer_email?: string; + customer?: Customer; +} +interface CustomerSubscriptionCreate extends ResourceCreate { + customer_email: string; +} +declare type CustomerSubscriptionUpdate = ResourceUpdate; +declare class CustomerSubscriptions extends ApiResource { + static readonly TYPE: 'customer_subscriptions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerSubscriptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerSubscription(resource: any): resource is CustomerSubscription; + relationship(id: string | ResourceId): CustomerSubscriptionRel; + type(): string; +} +export default CustomerSubscriptions; +export { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate }; diff --git a/lib/cjs/resources/customer_subscriptions.js b/lib/cjs/resources/customer_subscriptions.js new file mode 100644 index 00000000..c1450b45 --- /dev/null +++ b/lib/cjs/resources/customer_subscriptions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class CustomerSubscriptions extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:CustomerSubscriptions.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:CustomerSubscriptions.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:CustomerSubscriptions.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:CustomerSubscriptions.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:CustomerSubscriptions.TYPE,id:e},t)}isCustomerSubscription(e){return e.type&&e.type===CustomerSubscriptions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:CustomerSubscriptions.TYPE}:{id:e.id,type:CustomerSubscriptions.TYPE}}type(){return CustomerSubscriptions.TYPE}}CustomerSubscriptions.TYPE="customer_subscriptions",exports.default=CustomerSubscriptions; \ No newline at end of file diff --git a/lib/cjs/resources/customers.d.ts b/lib/cjs/resources/customers.d.ts new file mode 100644 index 00000000..9c9f138f --- /dev/null +++ b/lib/cjs/resources/customers.d.ts @@ -0,0 +1,52 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { CustomerGroup } from './customer_groups'; +import { CustomerAddress } from './customer_addresses'; +import { CustomerPaymentSource } from './customer_payment_sources'; +import { CustomerSubscription } from './customer_subscriptions'; +import { Order } from './orders'; +import { OrderSubscription } from './order_subscriptions'; +import { Return } from './returns'; +import { Attachment } from './attachments'; +declare type CustomerRel = ResourceId & { + type: typeof Customers.TYPE; +}; +declare type CustomerGroupRel = ResourceId & { + type: 'customer_groups'; +}; +interface Customer extends Resource { + email?: string; + status?: string; + has_password?: boolean; + customer_group?: CustomerGroup; + customer_addresses?: CustomerAddress[]; + customer_payment_sources?: CustomerPaymentSource[]; + customer_subscriptions?: CustomerSubscription[]; + orders?: Order[]; + order_subscriptions?: OrderSubscription[]; + returns?: Return[]; + attachments?: Attachment[]; +} +interface CustomerCreate extends ResourceCreate { + email: string; + password?: string; + customer_group?: CustomerGroupRel; +} +interface CustomerUpdate extends ResourceUpdate { + email?: string; + password?: string; + customer_group?: CustomerGroupRel; +} +declare class Customers extends ApiResource { + static readonly TYPE: 'customers'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomer(resource: any): resource is Customer; + relationship(id: string | ResourceId): CustomerRel; + type(): string; +} +export default Customers; +export { Customer, CustomerCreate, CustomerUpdate }; diff --git a/lib/cjs/resources/customers.js b/lib/cjs/resources/customers.js new file mode 100644 index 00000000..87615a58 --- /dev/null +++ b/lib/cjs/resources/customers.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Customers extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Customers.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Customers.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Customers.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Customers.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Customers.TYPE,id:e},t)}isCustomer(e){return e.type&&e.type===Customers.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Customers.TYPE}:{id:e.id,type:Customers.TYPE}}type(){return Customers.TYPE}}Customers.TYPE="customers",exports.default=Customers; \ No newline at end of file diff --git a/lib/cjs/resources/delivery_lead_times.d.ts b/lib/cjs/resources/delivery_lead_times.d.ts new file mode 100644 index 00000000..aeb99803 --- /dev/null +++ b/lib/cjs/resources/delivery_lead_times.d.ts @@ -0,0 +1,48 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { ShippingMethod } from './shipping_methods'; +import { Attachment } from './attachments'; +declare type DeliveryLeadTimeRel = ResourceId & { + type: typeof DeliveryLeadTimes.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type ShippingMethodRel = ResourceId & { + type: 'shipping_methods'; +}; +interface DeliveryLeadTime extends Resource { + min_hours?: number; + max_hours?: number; + min_days?: number; + max_days?: number; + stock_location?: StockLocation; + shipping_method?: ShippingMethod; + attachments?: Attachment[]; +} +interface DeliveryLeadTimeCreate extends ResourceCreate { + min_hours: number; + max_hours: number; + stock_location: StockLocationRel; + shipping_method: ShippingMethodRel; +} +interface DeliveryLeadTimeUpdate extends ResourceUpdate { + min_hours?: number; + max_hours?: number; + stock_location?: StockLocationRel; + shipping_method?: ShippingMethodRel; +} +declare class DeliveryLeadTimes extends ApiResource { + static readonly TYPE: 'delivery_lead_times'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: DeliveryLeadTimeCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: DeliveryLeadTimeUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isDeliveryLeadTime(resource: any): resource is DeliveryLeadTime; + relationship(id: string | ResourceId): DeliveryLeadTimeRel; + type(): string; +} +export default DeliveryLeadTimes; +export { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate }; diff --git a/lib/cjs/resources/delivery_lead_times.js b/lib/cjs/resources/delivery_lead_times.js new file mode 100644 index 00000000..fd2d4e43 --- /dev/null +++ b/lib/cjs/resources/delivery_lead_times.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class DeliveryLeadTimes extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:DeliveryLeadTimes.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:DeliveryLeadTimes.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:DeliveryLeadTimes.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:DeliveryLeadTimes.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:DeliveryLeadTimes.TYPE,id:e},t)}isDeliveryLeadTime(e){return e.type&&e.type===DeliveryLeadTimes.TYPE}relationship(e){return typeof e=="string"?{id:e,type:DeliveryLeadTimes.TYPE}:{id:e.id,type:DeliveryLeadTimes.TYPE}}type(){return DeliveryLeadTimes.TYPE}}DeliveryLeadTimes.TYPE="delivery_lead_times",exports.default=DeliveryLeadTimes; \ No newline at end of file diff --git a/lib/cjs/resources/event_callbacks.d.ts b/lib/cjs/resources/event_callbacks.d.ts new file mode 100644 index 00000000..7de228c1 --- /dev/null +++ b/lib/cjs/resources/event_callbacks.d.ts @@ -0,0 +1,23 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Webhook } from './webhooks'; +declare type EventCallbackRel = ResourceId & { + type: typeof EventCallbacks.TYPE; +}; +interface EventCallback extends Resource { + callback_url?: string; + payload?: object; + response_code?: string; + response_message?: string; + webhook?: Webhook; +} +declare class EventCallbacks extends ApiResource { + static readonly TYPE: 'event_callbacks'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isEventCallback(resource: any): resource is EventCallback; + relationship(id: string | ResourceId): EventCallbackRel; + type(): string; +} +export default EventCallbacks; +export { EventCallback }; diff --git a/lib/cjs/resources/event_callbacks.js b/lib/cjs/resources/event_callbacks.js new file mode 100644 index 00000000..4206a2da --- /dev/null +++ b/lib/cjs/resources/event_callbacks.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class EventCallbacks extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:EventCallbacks.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:EventCallbacks.TYPE,id:e},r,t)}isEventCallback(e){return e.type&&e.type===EventCallbacks.TYPE}relationship(e){return typeof e=="string"?{id:e,type:EventCallbacks.TYPE}:{id:e.id,type:EventCallbacks.TYPE}}type(){return EventCallbacks.TYPE}}EventCallbacks.TYPE="event_callbacks",exports.default=EventCallbacks; \ No newline at end of file diff --git a/lib/cjs/resources/external_gateways.d.ts b/lib/cjs/resources/external_gateways.d.ts new file mode 100644 index 00000000..24e87992 --- /dev/null +++ b/lib/cjs/resources/external_gateways.d.ts @@ -0,0 +1,44 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { ExternalPayment } from './external_payments'; +declare type ExternalGatewayRel = ResourceId & { + type: typeof ExternalGateways.TYPE; +}; +interface ExternalGateway extends Resource { + name?: string; + shared_secret?: string; + authorize_url?: string; + capture_url?: string; + void_url?: string; + refund_url?: string; + payment_methods?: PaymentMethod[]; + external_payments?: ExternalPayment[]; +} +interface ExternalGatewayCreate extends ResourceCreate { + name: string; + authorize_url?: string; + capture_url?: string; + void_url?: string; + refund_url?: string; +} +interface ExternalGatewayUpdate extends ResourceUpdate { + name?: string; + authorize_url?: string; + capture_url?: string; + void_url?: string; + refund_url?: string; +} +declare class ExternalGateways extends ApiResource { + static readonly TYPE: 'external_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalGateway(resource: any): resource is ExternalGateway; + relationship(id: string | ResourceId): ExternalGatewayRel; + type(): string; +} +export default ExternalGateways; +export { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate }; diff --git a/lib/cjs/resources/external_gateways.js b/lib/cjs/resources/external_gateways.js new file mode 100644 index 00000000..7ef42f8b --- /dev/null +++ b/lib/cjs/resources/external_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ExternalGateways extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:ExternalGateways.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:ExternalGateways.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:ExternalGateways.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:ExternalGateways.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:ExternalGateways.TYPE,id:e},r)}isExternalGateway(e){return e.type&&e.type===ExternalGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ExternalGateways.TYPE}:{id:e.id,type:ExternalGateways.TYPE}}type(){return ExternalGateways.TYPE}}ExternalGateways.TYPE="external_gateways",exports.default=ExternalGateways; \ No newline at end of file diff --git a/lib/cjs/resources/external_payments.d.ts b/lib/cjs/resources/external_payments.d.ts new file mode 100644 index 00000000..9d6345e1 --- /dev/null +++ b/lib/cjs/resources/external_payments.d.ts @@ -0,0 +1,38 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type ExternalPaymentRel = ResourceId & { + type: typeof ExternalPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface ExternalPayment extends Resource { + payment_source_token?: string; + options?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface ExternalPaymentCreate extends ResourceCreate { + payment_source_token: string; + options?: object; + order: OrderRel; +} +interface ExternalPaymentUpdate extends ResourceUpdate { + options?: object; + order?: OrderRel; +} +declare class ExternalPayments extends ApiResource { + static readonly TYPE: 'external_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalPayment(resource: any): resource is ExternalPayment; + relationship(id: string | ResourceId): ExternalPaymentRel; + type(): string; +} +export default ExternalPayments; +export { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate }; diff --git a/lib/cjs/resources/external_payments.js b/lib/cjs/resources/external_payments.js new file mode 100644 index 00000000..fbe83338 --- /dev/null +++ b/lib/cjs/resources/external_payments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ExternalPayments extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:ExternalPayments.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:ExternalPayments.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:ExternalPayments.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:ExternalPayments.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:ExternalPayments.TYPE,id:e},r)}isExternalPayment(e){return e.type&&e.type===ExternalPayments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ExternalPayments.TYPE}:{id:e.id,type:ExternalPayments.TYPE}}type(){return ExternalPayments.TYPE}}ExternalPayments.TYPE="external_payments",exports.default=ExternalPayments; \ No newline at end of file diff --git a/lib/cjs/resources/external_promotions.d.ts b/lib/cjs/resources/external_promotions.d.ts new file mode 100644 index 00000000..7295b942 --- /dev/null +++ b/lib/cjs/resources/external_promotions.d.ts @@ -0,0 +1,78 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type ExternalPromotionRel = ResourceId & { + type: typeof ExternalPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface ExternalPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + promotion_url?: string; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +interface ExternalPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + promotion_url: string; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +interface ExternalPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + promotion_url?: string; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class ExternalPromotions extends ApiResource { + static readonly TYPE: 'external_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalPromotion(resource: any): resource is ExternalPromotion; + relationship(id: string | ResourceId): ExternalPromotionRel; + type(): string; +} +export default ExternalPromotions; +export { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate }; diff --git a/lib/cjs/resources/external_promotions.js b/lib/cjs/resources/external_promotions.js new file mode 100644 index 00000000..f2446efb --- /dev/null +++ b/lib/cjs/resources/external_promotions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ExternalPromotions extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:ExternalPromotions.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:ExternalPromotions.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:ExternalPromotions.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:ExternalPromotions.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:ExternalPromotions.TYPE,id:e},s)}isExternalPromotion(e){return e.type&&e.type===ExternalPromotions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ExternalPromotions.TYPE}:{id:e.id,type:ExternalPromotions.TYPE}}type(){return ExternalPromotions.TYPE}}ExternalPromotions.TYPE="external_promotions",exports.default=ExternalPromotions; \ No newline at end of file diff --git a/lib/cjs/resources/external_tax_calculators.d.ts b/lib/cjs/resources/external_tax_calculators.d.ts new file mode 100644 index 00000000..c0a4d635 --- /dev/null +++ b/lib/cjs/resources/external_tax_calculators.d.ts @@ -0,0 +1,41 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type ExternalTaxCalculatorRel = ResourceId & { + type: typeof ExternalTaxCalculators.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface ExternalTaxCalculator extends Resource { + name?: string; + tax_calculator_url?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface ExternalTaxCalculatorCreate extends ResourceCreate { + name: string; + tax_calculator_url: string; + tax_categories?: TaxCategoryRel[]; +} +interface ExternalTaxCalculatorUpdate extends ResourceUpdate { + name?: string; + tax_calculator_url?: string; + tax_categories?: TaxCategoryRel[]; +} +declare class ExternalTaxCalculators extends ApiResource { + static readonly TYPE: 'external_tax_calculators'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalTaxCalculatorCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalTaxCalculatorUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalTaxCalculator(resource: any): resource is ExternalTaxCalculator; + relationship(id: string | ResourceId): ExternalTaxCalculatorRel; + type(): string; +} +export default ExternalTaxCalculators; +export { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate }; diff --git a/lib/cjs/resources/external_tax_calculators.js b/lib/cjs/resources/external_tax_calculators.js new file mode 100644 index 00000000..83f4489f --- /dev/null +++ b/lib/cjs/resources/external_tax_calculators.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ExternalTaxCalculators extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:ExternalTaxCalculators.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:ExternalTaxCalculators.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:ExternalTaxCalculators.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:ExternalTaxCalculators.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:ExternalTaxCalculators.TYPE,id:e},s)}isExternalTaxCalculator(e){return e.type&&e.type===ExternalTaxCalculators.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ExternalTaxCalculators.TYPE}:{id:e.id,type:ExternalTaxCalculators.TYPE}}type(){return ExternalTaxCalculators.TYPE}}ExternalTaxCalculators.TYPE="external_tax_calculators",exports.default=ExternalTaxCalculators; \ No newline at end of file diff --git a/lib/cjs/resources/fixed_amount_promotions.d.ts b/lib/cjs/resources/fixed_amount_promotions.d.ts new file mode 100644 index 00000000..9435d34d --- /dev/null +++ b/lib/cjs/resources/fixed_amount_promotions.d.ts @@ -0,0 +1,80 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type FixedAmountPromotionRel = ResourceId & { + type: typeof FixedAmountPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface FixedAmountPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + fixed_amount_cents?: number; + fixed_amount_float?: number; + formatted_fixed_amount?: string; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +interface FixedAmountPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + fixed_amount_cents: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +interface FixedAmountPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + fixed_amount_cents?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class FixedAmountPromotions extends ApiResource { + static readonly TYPE: 'fixed_amount_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FixedAmountPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FixedAmountPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFixedAmountPromotion(resource: any): resource is FixedAmountPromotion; + relationship(id: string | ResourceId): FixedAmountPromotionRel; + type(): string; +} +export default FixedAmountPromotions; +export { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate }; diff --git a/lib/cjs/resources/fixed_amount_promotions.js b/lib/cjs/resources/fixed_amount_promotions.js new file mode 100644 index 00000000..7056b742 --- /dev/null +++ b/lib/cjs/resources/fixed_amount_promotions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class FixedAmountPromotions extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:FixedAmountPromotions.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:FixedAmountPromotions.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:FixedAmountPromotions.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:FixedAmountPromotions.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:FixedAmountPromotions.TYPE,id:e},r)}isFixedAmountPromotion(e){return e.type&&e.type===FixedAmountPromotions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:FixedAmountPromotions.TYPE}:{id:e.id,type:FixedAmountPromotions.TYPE}}type(){return FixedAmountPromotions.TYPE}}FixedAmountPromotions.TYPE="fixed_amount_promotions",exports.default=FixedAmountPromotions; \ No newline at end of file diff --git a/lib/cjs/resources/fixed_price_promotions.d.ts b/lib/cjs/resources/fixed_price_promotions.d.ts new file mode 100644 index 00000000..1d409110 --- /dev/null +++ b/lib/cjs/resources/fixed_price_promotions.d.ts @@ -0,0 +1,89 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type FixedPricePromotionRel = ResourceId & { + type: typeof FixedPricePromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface FixedPricePromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + fixed_amount_cents?: number; + fixed_amount_float?: number; + formatted_fixed_amount?: string; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; + sku_list?: SkuList; + skus?: Sku[]; +} +interface FixedPricePromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + fixed_amount_cents: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list: SkuListRel; +} +interface FixedPricePromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + fixed_amount_cents?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +declare class FixedPricePromotions extends ApiResource { + static readonly TYPE: 'fixed_price_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FixedPricePromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FixedPricePromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFixedPricePromotion(resource: any): resource is FixedPricePromotion; + relationship(id: string | ResourceId): FixedPricePromotionRel; + type(): string; +} +export default FixedPricePromotions; +export { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate }; diff --git a/lib/cjs/resources/fixed_price_promotions.js b/lib/cjs/resources/fixed_price_promotions.js new file mode 100644 index 00000000..6c0036bf --- /dev/null +++ b/lib/cjs/resources/fixed_price_promotions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class FixedPricePromotions extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:FixedPricePromotions.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:FixedPricePromotions.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:FixedPricePromotions.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:FixedPricePromotions.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:FixedPricePromotions.TYPE,id:e},t)}isFixedPricePromotion(e){return e.type&&e.type===FixedPricePromotions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:FixedPricePromotions.TYPE}:{id:e.id,type:FixedPricePromotions.TYPE}}type(){return FixedPricePromotions.TYPE}}FixedPricePromotions.TYPE="fixed_price_promotions",exports.default=FixedPricePromotions; \ No newline at end of file diff --git a/lib/cjs/resources/free_gift_promotions.d.ts b/lib/cjs/resources/free_gift_promotions.d.ts new file mode 100644 index 00000000..ac88d852 --- /dev/null +++ b/lib/cjs/resources/free_gift_promotions.d.ts @@ -0,0 +1,87 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type FreeGiftPromotionRel = ResourceId & { + type: typeof FreeGiftPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface FreeGiftPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + max_quantity?: number; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; + sku_list?: SkuList; + skus?: Sku[]; +} +interface FreeGiftPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + max_quantity?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list: SkuListRel; +} +interface FreeGiftPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + max_quantity?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +declare class FreeGiftPromotions extends ApiResource { + static readonly TYPE: 'free_gift_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FreeGiftPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FreeGiftPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFreeGiftPromotion(resource: any): resource is FreeGiftPromotion; + relationship(id: string | ResourceId): FreeGiftPromotionRel; + type(): string; +} +export default FreeGiftPromotions; +export { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate }; diff --git a/lib/cjs/resources/free_gift_promotions.js b/lib/cjs/resources/free_gift_promotions.js new file mode 100644 index 00000000..6851a19d --- /dev/null +++ b/lib/cjs/resources/free_gift_promotions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class FreeGiftPromotions extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:FreeGiftPromotions.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:FreeGiftPromotions.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:FreeGiftPromotions.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:FreeGiftPromotions.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:FreeGiftPromotions.TYPE,id:e},s)}isFreeGiftPromotion(e){return e.type&&e.type===FreeGiftPromotions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:FreeGiftPromotions.TYPE}:{id:e.id,type:FreeGiftPromotions.TYPE}}type(){return FreeGiftPromotions.TYPE}}FreeGiftPromotions.TYPE="free_gift_promotions",exports.default=FreeGiftPromotions; \ No newline at end of file diff --git a/lib/cjs/resources/free_shipping_promotions.d.ts b/lib/cjs/resources/free_shipping_promotions.d.ts new file mode 100644 index 00000000..6bd8634f --- /dev/null +++ b/lib/cjs/resources/free_shipping_promotions.d.ts @@ -0,0 +1,75 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type FreeShippingPromotionRel = ResourceId & { + type: typeof FreeShippingPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface FreeShippingPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +interface FreeShippingPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +interface FreeShippingPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class FreeShippingPromotions extends ApiResource { + static readonly TYPE: 'free_shipping_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FreeShippingPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FreeShippingPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFreeShippingPromotion(resource: any): resource is FreeShippingPromotion; + relationship(id: string | ResourceId): FreeShippingPromotionRel; + type(): string; +} +export default FreeShippingPromotions; +export { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate }; diff --git a/lib/cjs/resources/free_shipping_promotions.js b/lib/cjs/resources/free_shipping_promotions.js new file mode 100644 index 00000000..4b2ba7d2 --- /dev/null +++ b/lib/cjs/resources/free_shipping_promotions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class FreeShippingPromotions extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:FreeShippingPromotions.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:FreeShippingPromotions.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:FreeShippingPromotions.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:FreeShippingPromotions.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:FreeShippingPromotions.TYPE,id:e},t)}isFreeShippingPromotion(e){return e.type&&e.type===FreeShippingPromotions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:FreeShippingPromotions.TYPE}:{id:e.id,type:FreeShippingPromotions.TYPE}}type(){return FreeShippingPromotions.TYPE}}FreeShippingPromotions.TYPE="free_shipping_promotions",exports.default=FreeShippingPromotions; \ No newline at end of file diff --git a/lib/cjs/resources/geocoders.d.ts b/lib/cjs/resources/geocoders.d.ts new file mode 100644 index 00000000..5df22263 --- /dev/null +++ b/lib/cjs/resources/geocoders.d.ts @@ -0,0 +1,22 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type GeocoderRel = ResourceId & { + type: typeof Geocoders.TYPE; +}; +interface Geocoder extends Resource { + name?: string; + addresses?: Address[]; + attachments?: Attachment[]; +} +declare class Geocoders extends ApiResource { + static readonly TYPE: 'geocoders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isGeocoder(resource: any): resource is Geocoder; + relationship(id: string | ResourceId): GeocoderRel; + type(): string; +} +export default Geocoders; +export { Geocoder }; diff --git a/lib/cjs/resources/geocoders.js b/lib/cjs/resources/geocoders.js new file mode 100644 index 00000000..553f4729 --- /dev/null +++ b/lib/cjs/resources/geocoders.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Geocoders extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Geocoders.TYPE},e,t)}async retrieve(e,t,r){return this.resources.retrieve({type:Geocoders.TYPE,id:e},t,r)}isGeocoder(e){return e.type&&e.type===Geocoders.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Geocoders.TYPE}:{id:e.id,type:Geocoders.TYPE}}type(){return Geocoders.TYPE}}Geocoders.TYPE="geocoders",exports.default=Geocoders; \ No newline at end of file diff --git a/lib/cjs/resources/gift_card_recipients.d.ts b/lib/cjs/resources/gift_card_recipients.d.ts new file mode 100644 index 00000000..b7441f07 --- /dev/null +++ b/lib/cjs/resources/gift_card_recipients.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Attachment } from './attachments'; +declare type GiftCardRecipientRel = ResourceId & { + type: typeof GiftCardRecipients.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +interface GiftCardRecipient extends Resource { + email?: string; + first_name?: string; + last_name?: string; + customer?: Customer; + attachments?: Attachment[]; +} +interface GiftCardRecipientCreate extends ResourceCreate { + email: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +interface GiftCardRecipientUpdate extends ResourceUpdate { + email?: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +declare class GiftCardRecipients extends ApiResource { + static readonly TYPE: 'gift_card_recipients'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: GiftCardRecipientCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: GiftCardRecipientUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isGiftCardRecipient(resource: any): resource is GiftCardRecipient; + relationship(id: string | ResourceId): GiftCardRecipientRel; + type(): string; +} +export default GiftCardRecipients; +export { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate }; diff --git a/lib/cjs/resources/gift_card_recipients.js b/lib/cjs/resources/gift_card_recipients.js new file mode 100644 index 00000000..c7d937fe --- /dev/null +++ b/lib/cjs/resources/gift_card_recipients.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class GiftCardRecipients extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:GiftCardRecipients.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:GiftCardRecipients.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:GiftCardRecipients.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:GiftCardRecipients.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:GiftCardRecipients.TYPE,id:e},r)}isGiftCardRecipient(e){return e.type&&e.type===GiftCardRecipients.TYPE}relationship(e){return typeof e=="string"?{id:e,type:GiftCardRecipients.TYPE}:{id:e.id,type:GiftCardRecipients.TYPE}}type(){return GiftCardRecipients.TYPE}}GiftCardRecipients.TYPE="gift_card_recipients",exports.default=GiftCardRecipients; \ No newline at end of file diff --git a/lib/cjs/resources/gift_cards.d.ts b/lib/cjs/resources/gift_cards.d.ts new file mode 100644 index 00000000..414c46c0 --- /dev/null +++ b/lib/cjs/resources/gift_cards.d.ts @@ -0,0 +1,79 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { GiftCardRecipient } from './gift_card_recipients'; +import { Attachment } from './attachments'; +declare type GiftCardRel = ResourceId & { + type: typeof GiftCards.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type GiftCardRecipientRel = ResourceId & { + type: 'gift_card_recipients'; +}; +interface GiftCard extends Resource { + status?: string; + code?: string; + currency_code?: string; + initial_balance_cents?: number; + initial_balance_float?: number; + formatted_initial_balance?: string; + balance_cents?: number; + balance_float?: number; + formatted_balance?: string; + balance_max_cents?: string; + balance_max_float?: number; + formatted_balance_max?: string; + balance_log?: object[]; + single_use?: boolean; + rechargeable?: boolean; + image_url?: string; + expires_at?: string; + recipient_email?: string; + market?: Market; + gift_card_recipient?: GiftCardRecipient; + attachments?: Attachment[]; +} +interface GiftCardCreate extends ResourceCreate { + code?: string; + currency_code: string; + balance_cents: number; + balance_max_cents?: string; + single_use?: boolean; + rechargeable?: boolean; + image_url?: string; + expires_at?: string; + recipient_email?: string; + market?: MarketRel; + gift_card_recipient?: GiftCardRecipientRel; +} +interface GiftCardUpdate extends ResourceUpdate { + currency_code?: string; + balance_cents?: number; + balance_max_cents?: string; + single_use?: boolean; + rechargeable?: boolean; + image_url?: string; + expires_at?: string; + recipient_email?: string; + _purchase?: boolean; + _activate?: boolean; + _deactivate?: boolean; + _balance_change_cents?: number; + market?: MarketRel; + gift_card_recipient?: GiftCardRecipientRel; +} +declare class GiftCards extends ApiResource { + static readonly TYPE: 'gift_cards'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: GiftCardCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: GiftCardUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isGiftCard(resource: any): resource is GiftCard; + relationship(id: string | ResourceId): GiftCardRel; + type(): string; +} +export default GiftCards; +export { GiftCard, GiftCardCreate, GiftCardUpdate }; diff --git a/lib/cjs/resources/gift_cards.js b/lib/cjs/resources/gift_cards.js new file mode 100644 index 00000000..92a9d4e1 --- /dev/null +++ b/lib/cjs/resources/gift_cards.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class GiftCards extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:GiftCards.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:GiftCards.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:GiftCards.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:GiftCards.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:GiftCards.TYPE,id:e},t)}isGiftCard(e){return e.type&&e.type===GiftCards.TYPE}relationship(e){return typeof e=="string"?{id:e,type:GiftCards.TYPE}:{id:e.id,type:GiftCards.TYPE}}type(){return GiftCards.TYPE}}GiftCards.TYPE="gift_cards",exports.default=GiftCards; \ No newline at end of file diff --git a/lib/cjs/resources/google_geocoders.d.ts b/lib/cjs/resources/google_geocoders.d.ts new file mode 100644 index 00000000..2a8b1649 --- /dev/null +++ b/lib/cjs/resources/google_geocoders.d.ts @@ -0,0 +1,33 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type GoogleGeocoderRel = ResourceId & { + type: typeof GoogleGeocoders.TYPE; +}; +interface GoogleGeocoder extends Resource { + name?: string; + addresses?: Address[]; + attachments?: Attachment[]; +} +interface GoogleGeocoderCreate extends ResourceCreate { + name: string; + api_key: string; +} +interface GoogleGeocoderUpdate extends ResourceUpdate { + name?: string; + api_key?: string; +} +declare class GoogleGeocoders extends ApiResource { + static readonly TYPE: 'google_geocoders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: GoogleGeocoderCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: GoogleGeocoderUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isGoogleGeocoder(resource: any): resource is GoogleGeocoder; + relationship(id: string | ResourceId): GoogleGeocoderRel; + type(): string; +} +export default GoogleGeocoders; +export { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate }; diff --git a/lib/cjs/resources/google_geocoders.js b/lib/cjs/resources/google_geocoders.js new file mode 100644 index 00000000..5b272ce8 --- /dev/null +++ b/lib/cjs/resources/google_geocoders.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class GoogleGeocoders extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:GoogleGeocoders.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:GoogleGeocoders.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:GoogleGeocoders.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:GoogleGeocoders.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:GoogleGeocoders.TYPE,id:e},t)}isGoogleGeocoder(e){return e.type&&e.type===GoogleGeocoders.TYPE}relationship(e){return typeof e=="string"?{id:e,type:GoogleGeocoders.TYPE}:{id:e.id,type:GoogleGeocoders.TYPE}}type(){return GoogleGeocoders.TYPE}}GoogleGeocoders.TYPE="google_geocoders",exports.default=GoogleGeocoders; \ No newline at end of file diff --git a/lib/cjs/resources/imports.d.ts b/lib/cjs/resources/imports.d.ts new file mode 100644 index 00000000..3e95016a --- /dev/null +++ b/lib/cjs/resources/imports.d.ts @@ -0,0 +1,40 @@ +import { ApiResource, Resource, ResourceCreate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +declare type ImportRel = ResourceId & { + type: typeof Imports.TYPE; +}; +interface Import extends Resource { + resource_type?: string; + parent_resource_id?: string; + status?: string; + started_at?: string; + completed_at?: string; + interrupted_at?: string; + inputs?: object[]; + inputs_size?: number; + errors_count?: number; + warnings_count?: number; + destroyed_count?: number; + processed_count?: number; + errors_log?: object; + warnings_log?: object; + cleanup_records?: boolean; +} +interface ImportCreate extends ResourceCreate { + resource_type: string; + parent_resource_id?: string; + inputs: object[]; + cleanup_records?: boolean; +} +declare class Imports extends ApiResource { + static readonly TYPE: 'imports'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ImportCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isImport(resource: any): resource is Import; + relationship(id: string | ResourceId): ImportRel; + type(): string; +} +export default Imports; +export { Import, ImportCreate }; diff --git a/lib/cjs/resources/imports.js b/lib/cjs/resources/imports.js new file mode 100644 index 00000000..e9777ad1 --- /dev/null +++ b/lib/cjs/resources/imports.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Imports extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Imports.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Imports.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Imports.TYPE,id:e},t,r)}async delete(e,t){await this.resources.delete({type:Imports.TYPE,id:e},t)}isImport(e){return e.type&&e.type===Imports.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Imports.TYPE}:{id:e.id,type:Imports.TYPE}}type(){return Imports.TYPE}}Imports.TYPE="imports",exports.default=Imports; \ No newline at end of file diff --git a/lib/cjs/resources/in_stock_subscriptions.d.ts b/lib/cjs/resources/in_stock_subscriptions.d.ts new file mode 100644 index 00000000..170a06ca --- /dev/null +++ b/lib/cjs/resources/in_stock_subscriptions.d.ts @@ -0,0 +1,56 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Customer } from './customers'; +import { Sku } from './skus'; +declare type InStockSubscriptionRel = ResourceId & { + type: typeof InStockSubscriptions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface InStockSubscription extends Resource { + status?: string; + customer_email?: string; + sku_code?: string; + stock_threshold?: number; + market?: Market; + customer?: Customer; + sku?: Sku; +} +interface InStockSubscriptionCreate extends ResourceCreate { + customer_email?: string; + sku_code?: string; + stock_threshold?: number; + market: MarketRel; + customer: CustomerRel; + sku: SkuRel; +} +interface InStockSubscriptionUpdate extends ResourceUpdate { + sku_code?: string; + stock_threshold?: number; + _activate?: boolean; + _deactivate?: boolean; + market?: MarketRel; + customer?: CustomerRel; + sku?: SkuRel; +} +declare class InStockSubscriptions extends ApiResource { + static readonly TYPE: 'in_stock_subscriptions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InStockSubscriptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InStockSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInStockSubscription(resource: any): resource is InStockSubscription; + relationship(id: string | ResourceId): InStockSubscriptionRel; + type(): string; +} +export default InStockSubscriptions; +export { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate }; diff --git a/lib/cjs/resources/in_stock_subscriptions.js b/lib/cjs/resources/in_stock_subscriptions.js new file mode 100644 index 00000000..f97ba177 --- /dev/null +++ b/lib/cjs/resources/in_stock_subscriptions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class InStockSubscriptions extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:InStockSubscriptions.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:InStockSubscriptions.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:InStockSubscriptions.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:InStockSubscriptions.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:InStockSubscriptions.TYPE,id:e},r)}isInStockSubscription(e){return e.type&&e.type===InStockSubscriptions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:InStockSubscriptions.TYPE}:{id:e.id,type:InStockSubscriptions.TYPE}}type(){return InStockSubscriptions.TYPE}}InStockSubscriptions.TYPE="in_stock_subscriptions",exports.default=InStockSubscriptions; \ No newline at end of file diff --git a/lib/cjs/resources/inventory_models.d.ts b/lib/cjs/resources/inventory_models.d.ts new file mode 100644 index 00000000..f6051a14 --- /dev/null +++ b/lib/cjs/resources/inventory_models.d.ts @@ -0,0 +1,39 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { InventoryStockLocation } from './inventory_stock_locations'; +import { InventoryReturnLocation } from './inventory_return_locations'; +import { Attachment } from './attachments'; +declare type InventoryModelRel = ResourceId & { + type: typeof InventoryModels.TYPE; +}; +interface InventoryModel extends Resource { + name?: string; + strategy?: string; + stock_locations_cutoff?: number; + inventory_stock_locations?: InventoryStockLocation[]; + inventory_return_locations?: InventoryReturnLocation[]; + attachments?: Attachment[]; +} +interface InventoryModelCreate extends ResourceCreate { + name: string; + strategy: string; + stock_locations_cutoff?: number; +} +interface InventoryModelUpdate extends ResourceUpdate { + name?: string; + strategy?: string; + stock_locations_cutoff?: number; +} +declare class InventoryModels extends ApiResource { + static readonly TYPE: 'inventory_models'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InventoryModelCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InventoryModelUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInventoryModel(resource: any): resource is InventoryModel; + relationship(id: string | ResourceId): InventoryModelRel; + type(): string; +} +export default InventoryModels; +export { InventoryModel, InventoryModelCreate, InventoryModelUpdate }; diff --git a/lib/cjs/resources/inventory_models.js b/lib/cjs/resources/inventory_models.js new file mode 100644 index 00000000..f24f4ac7 --- /dev/null +++ b/lib/cjs/resources/inventory_models.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class InventoryModels extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:InventoryModels.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:InventoryModels.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:InventoryModels.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:InventoryModels.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:InventoryModels.TYPE,id:e},t)}isInventoryModel(e){return e.type&&e.type===InventoryModels.TYPE}relationship(e){return typeof e=="string"?{id:e,type:InventoryModels.TYPE}:{id:e.id,type:InventoryModels.TYPE}}type(){return InventoryModels.TYPE}}InventoryModels.TYPE="inventory_models",exports.default=InventoryModels; \ No newline at end of file diff --git a/lib/cjs/resources/inventory_return_locations.d.ts b/lib/cjs/resources/inventory_return_locations.d.ts new file mode 100644 index 00000000..611e8e26 --- /dev/null +++ b/lib/cjs/resources/inventory_return_locations.d.ts @@ -0,0 +1,41 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { InventoryModel } from './inventory_models'; +declare type InventoryReturnLocationRel = ResourceId & { + type: typeof InventoryReturnLocations.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +interface InventoryReturnLocation extends Resource { + priority?: number; + stock_location?: StockLocation; + inventory_model?: InventoryModel; +} +interface InventoryReturnLocationCreate extends ResourceCreate { + priority: number; + stock_location: StockLocationRel; + inventory_model: InventoryModelRel; +} +interface InventoryReturnLocationUpdate extends ResourceUpdate { + priority?: number; + stock_location?: StockLocationRel; + inventory_model?: InventoryModelRel; +} +declare class InventoryReturnLocations extends ApiResource { + static readonly TYPE: 'inventory_return_locations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InventoryReturnLocationCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InventoryReturnLocationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInventoryReturnLocation(resource: any): resource is InventoryReturnLocation; + relationship(id: string | ResourceId): InventoryReturnLocationRel; + type(): string; +} +export default InventoryReturnLocations; +export { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate }; diff --git a/lib/cjs/resources/inventory_return_locations.js b/lib/cjs/resources/inventory_return_locations.js new file mode 100644 index 00000000..160be19f --- /dev/null +++ b/lib/cjs/resources/inventory_return_locations.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class InventoryReturnLocations extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:InventoryReturnLocations.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:InventoryReturnLocations.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:InventoryReturnLocations.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:InventoryReturnLocations.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:InventoryReturnLocations.TYPE,id:e},s)}isInventoryReturnLocation(e){return e.type&&e.type===InventoryReturnLocations.TYPE}relationship(e){return typeof e=="string"?{id:e,type:InventoryReturnLocations.TYPE}:{id:e.id,type:InventoryReturnLocations.TYPE}}type(){return InventoryReturnLocations.TYPE}}InventoryReturnLocations.TYPE="inventory_return_locations",exports.default=InventoryReturnLocations; \ No newline at end of file diff --git a/lib/cjs/resources/inventory_stock_locations.d.ts b/lib/cjs/resources/inventory_stock_locations.d.ts new file mode 100644 index 00000000..efbcd90c --- /dev/null +++ b/lib/cjs/resources/inventory_stock_locations.d.ts @@ -0,0 +1,44 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { InventoryModel } from './inventory_models'; +declare type InventoryStockLocationRel = ResourceId & { + type: typeof InventoryStockLocations.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +interface InventoryStockLocation extends Resource { + priority?: number; + on_hold?: boolean; + stock_location?: StockLocation; + inventory_model?: InventoryModel; +} +interface InventoryStockLocationCreate extends ResourceCreate { + priority: number; + on_hold?: boolean; + stock_location: StockLocationRel; + inventory_model: InventoryModelRel; +} +interface InventoryStockLocationUpdate extends ResourceUpdate { + priority?: number; + on_hold?: boolean; + stock_location?: StockLocationRel; + inventory_model?: InventoryModelRel; +} +declare class InventoryStockLocations extends ApiResource { + static readonly TYPE: 'inventory_stock_locations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InventoryStockLocationCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InventoryStockLocationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInventoryStockLocation(resource: any): resource is InventoryStockLocation; + relationship(id: string | ResourceId): InventoryStockLocationRel; + type(): string; +} +export default InventoryStockLocations; +export { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate }; diff --git a/lib/cjs/resources/inventory_stock_locations.js b/lib/cjs/resources/inventory_stock_locations.js new file mode 100644 index 00000000..f1a6de26 --- /dev/null +++ b/lib/cjs/resources/inventory_stock_locations.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class InventoryStockLocations extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:InventoryStockLocations.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:InventoryStockLocations.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:InventoryStockLocations.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:InventoryStockLocations.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:InventoryStockLocations.TYPE,id:e},s)}isInventoryStockLocation(e){return e.type&&e.type===InventoryStockLocations.TYPE}relationship(e){return typeof e=="string"?{id:e,type:InventoryStockLocations.TYPE}:{id:e.id,type:InventoryStockLocations.TYPE}}type(){return InventoryStockLocations.TYPE}}InventoryStockLocations.TYPE="inventory_stock_locations",exports.default=InventoryStockLocations; \ No newline at end of file diff --git a/lib/cjs/resources/line_item_options.d.ts b/lib/cjs/resources/line_item_options.d.ts new file mode 100644 index 00000000..4ed4fe04 --- /dev/null +++ b/lib/cjs/resources/line_item_options.d.ts @@ -0,0 +1,55 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { LineItem } from './line_items'; +import { SkuOption } from './sku_options'; +declare type LineItemOptionRel = ResourceId & { + type: typeof LineItemOptions.TYPE; +}; +declare type LineItemRel = ResourceId & { + type: 'line_items'; +}; +declare type SkuOptionRel = ResourceId & { + type: 'sku_options'; +}; +interface LineItemOption extends Resource { + name?: string; + quantity?: number; + currency_code?: string; + unit_amount_cents?: number; + unit_amount_float?: number; + formatted_unit_amount?: string; + total_amount_cents?: number; + total_amount_float?: number; + formatted_total_amount?: string; + delay_hours?: number; + delay_days?: number; + options?: object; + line_item?: LineItem; + sku_option?: SkuOption; +} +interface LineItemOptionCreate extends ResourceCreate { + name?: string; + quantity: number; + options: object; + line_item: LineItemRel; + sku_option: SkuOptionRel; +} +interface LineItemOptionUpdate extends ResourceUpdate { + name?: string; + quantity?: number; + options?: object; + sku_option?: SkuOptionRel; +} +declare class LineItemOptions extends ApiResource { + static readonly TYPE: 'line_item_options'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: LineItemOptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: LineItemOptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isLineItemOption(resource: any): resource is LineItemOption; + relationship(id: string | ResourceId): LineItemOptionRel; + type(): string; +} +export default LineItemOptions; +export { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate }; diff --git a/lib/cjs/resources/line_item_options.js b/lib/cjs/resources/line_item_options.js new file mode 100644 index 00000000..8a5f212e --- /dev/null +++ b/lib/cjs/resources/line_item_options.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class LineItemOptions extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:LineItemOptions.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:LineItemOptions.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:LineItemOptions.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:LineItemOptions.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:LineItemOptions.TYPE,id:e},r)}isLineItemOption(e){return e.type&&e.type===LineItemOptions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:LineItemOptions.TYPE}:{id:e.id,type:LineItemOptions.TYPE}}type(){return LineItemOptions.TYPE}}LineItemOptions.TYPE="line_item_options",exports.default=LineItemOptions; \ No newline at end of file diff --git a/lib/cjs/resources/line_items.d.ts b/lib/cjs/resources/line_items.d.ts new file mode 100644 index 00000000..1b6e6b63 --- /dev/null +++ b/lib/cjs/resources/line_items.d.ts @@ -0,0 +1,121 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Adjustment } from './adjustments'; +import { Bundle } from './bundles'; +import { ExternalPromotion } from './external_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { GiftCard } from './gift_cards'; +import { PaymentMethod } from './payment_methods'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { Shipment } from './shipments'; +import { Sku } from './skus'; +import { LineItemOption } from './line_item_options'; +import { StockLineItem } from './stock_line_items'; +import { StockTransfer } from './stock_transfers'; +declare type LineItemRel = ResourceId & { + type: typeof LineItems.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +declare type AdjustmentRel = ResourceId & { + type: 'adjustments'; +}; +declare type BundleRel = ResourceId & { + type: 'bundles'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type GiftCardRel = ResourceId & { + type: 'gift_cards'; +}; +declare type PaymentMethodRel = ResourceId & { + type: 'payment_methods'; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface LineItem extends Resource { + sku_code?: string; + bundle_code?: string; + quantity?: number; + currency_code?: string; + unit_amount_cents?: number; + unit_amount_float?: number; + formatted_unit_amount?: string; + options_amount_cents?: number; + options_amount_float?: number; + formatted_options_amount?: string; + discount_cents?: number; + discount_float?: number; + formatted_discount?: string; + total_amount_cents?: number; + total_amount_float?: number; + formatted_total_amount?: string; + tax_amount_cents?: number; + tax_amount_float?: number; + formatted_tax_amount?: string; + name?: string; + image_url?: string; + discount_breakdown?: object; + tax_rate?: number; + tax_breakdown?: object; + item_type?: string; + order?: Order; + item?: Adjustment | Bundle | ExternalPromotion | FixedAmountPromotion | FreeShippingPromotion | GiftCard | PaymentMethod | PercentageDiscountPromotion | Shipment | Sku; + line_item_options?: LineItemOption[]; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_items?: object[]; + stock_line_items?: StockLineItem[]; + stock_transfers?: StockTransfer[]; +} +interface LineItemCreate extends ResourceCreate { + sku_code?: string; + bundle_code?: string; + quantity: number; + _external_price?: boolean; + _update_quantity?: boolean; + unit_amount_cents?: number; + name?: string; + image_url?: string; + item_type?: string; + order: OrderRel; + item?: AdjustmentRel | BundleRel | ExternalPromotionRel | FixedAmountPromotionRel | FreeShippingPromotionRel | GiftCardRel | PaymentMethodRel | PercentageDiscountPromotionRel | ShipmentRel | SkuRel; +} +interface LineItemUpdate extends ResourceUpdate { + sku_code?: string; + bundle_code?: string; + quantity?: number; + name?: string; + image_url?: string; +} +declare class LineItems extends ApiResource { + static readonly TYPE: 'line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: LineItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: LineItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isLineItem(resource: any): resource is LineItem; + relationship(id: string | ResourceId): LineItemRel; + type(): string; +} +export default LineItems; +export { LineItem, LineItemCreate, LineItemUpdate }; diff --git a/lib/cjs/resources/line_items.js b/lib/cjs/resources/line_items.js new file mode 100644 index 00000000..5bee204b --- /dev/null +++ b/lib/cjs/resources/line_items.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class LineItems extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:LineItems.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:LineItems.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:LineItems.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:LineItems.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:LineItems.TYPE,id:e},r)}isLineItem(e){return e.type&&e.type===LineItems.TYPE}relationship(e){return typeof e=="string"?{id:e,type:LineItems.TYPE}:{id:e.id,type:LineItems.TYPE}}type(){return LineItems.TYPE}}LineItems.TYPE="line_items",exports.default=LineItems; \ No newline at end of file diff --git a/lib/cjs/resources/manual_gateways.d.ts b/lib/cjs/resources/manual_gateways.d.ts new file mode 100644 index 00000000..68e2ac6e --- /dev/null +++ b/lib/cjs/resources/manual_gateways.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +declare type ManualGatewayRel = ResourceId & { + type: typeof ManualGateways.TYPE; +}; +interface ManualGateway extends Resource { + name?: string; + require_capture?: boolean; + payment_methods?: PaymentMethod[]; +} +interface ManualGatewayCreate extends ResourceCreate { + name: string; + require_capture?: boolean; +} +interface ManualGatewayUpdate extends ResourceUpdate { + name?: string; + require_capture?: boolean; +} +declare class ManualGateways extends ApiResource { + static readonly TYPE: 'manual_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ManualGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ManualGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isManualGateway(resource: any): resource is ManualGateway; + relationship(id: string | ResourceId): ManualGatewayRel; + type(): string; +} +export default ManualGateways; +export { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate }; diff --git a/lib/cjs/resources/manual_gateways.js b/lib/cjs/resources/manual_gateways.js new file mode 100644 index 00000000..1f41741c --- /dev/null +++ b/lib/cjs/resources/manual_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ManualGateways extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:ManualGateways.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:ManualGateways.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:ManualGateways.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:ManualGateways.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:ManualGateways.TYPE,id:e},r)}isManualGateway(e){return e.type&&e.type===ManualGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ManualGateways.TYPE}:{id:e.id,type:ManualGateways.TYPE}}type(){return ManualGateways.TYPE}}ManualGateways.TYPE="manual_gateways",exports.default=ManualGateways; \ No newline at end of file diff --git a/lib/cjs/resources/manual_tax_calculators.d.ts b/lib/cjs/resources/manual_tax_calculators.d.ts new file mode 100644 index 00000000..48fef757 --- /dev/null +++ b/lib/cjs/resources/manual_tax_calculators.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +import { TaxRule } from './tax_rules'; +declare type ManualTaxCalculatorRel = ResourceId & { + type: typeof ManualTaxCalculators.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +declare type TaxRuleRel = ResourceId & { + type: 'tax_rules'; +}; +interface ManualTaxCalculator extends Resource { + name?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; + tax_rules?: TaxRule[]; +} +interface ManualTaxCalculatorCreate extends ResourceCreate { + name: string; + tax_categories?: TaxCategoryRel[]; + tax_rules?: TaxRuleRel[]; +} +interface ManualTaxCalculatorUpdate extends ResourceUpdate { + name?: string; + tax_categories?: TaxCategoryRel[]; + tax_rules?: TaxRuleRel[]; +} +declare class ManualTaxCalculators extends ApiResource { + static readonly TYPE: 'manual_tax_calculators'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ManualTaxCalculatorCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ManualTaxCalculatorUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isManualTaxCalculator(resource: any): resource is ManualTaxCalculator; + relationship(id: string | ResourceId): ManualTaxCalculatorRel; + type(): string; +} +export default ManualTaxCalculators; +export { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate }; diff --git a/lib/cjs/resources/manual_tax_calculators.js b/lib/cjs/resources/manual_tax_calculators.js new file mode 100644 index 00000000..ff902926 --- /dev/null +++ b/lib/cjs/resources/manual_tax_calculators.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ManualTaxCalculators extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:ManualTaxCalculators.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:ManualTaxCalculators.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:ManualTaxCalculators.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:ManualTaxCalculators.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:ManualTaxCalculators.TYPE,id:e},t)}isManualTaxCalculator(e){return e.type&&e.type===ManualTaxCalculators.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ManualTaxCalculators.TYPE}:{id:e.id,type:ManualTaxCalculators.TYPE}}type(){return ManualTaxCalculators.TYPE}}ManualTaxCalculators.TYPE="manual_tax_calculators",exports.default=ManualTaxCalculators; \ No newline at end of file diff --git a/lib/cjs/resources/markets.d.ts b/lib/cjs/resources/markets.d.ts new file mode 100644 index 00000000..0c70d547 --- /dev/null +++ b/lib/cjs/resources/markets.d.ts @@ -0,0 +1,75 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Merchant } from './merchants'; +import { PriceList } from './price_lists'; +import { InventoryModel } from './inventory_models'; +import { TaxCalculator } from './tax_calculators'; +import { CustomerGroup } from './customer_groups'; +import { Attachment } from './attachments'; +declare type MarketRel = ResourceId & { + type: typeof Markets.TYPE; +}; +declare type MerchantRel = ResourceId & { + type: 'merchants'; +}; +declare type PriceListRel = ResourceId & { + type: 'price_lists'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +declare type TaxCalculatorRel = ResourceId & { + type: 'tax_calculators'; +}; +declare type CustomerGroupRel = ResourceId & { + type: 'customer_groups'; +}; +interface Market extends Resource { + number?: number; + name?: string; + facebook_pixel_id?: string; + checkout_url?: string; + external_prices_url?: string; + private?: boolean; + merchant?: Merchant; + price_list?: PriceList; + inventory_model?: InventoryModel; + tax_calculator?: TaxCalculator; + customer_group?: CustomerGroup; + attachments?: Attachment[]; +} +interface MarketCreate extends ResourceCreate { + name: string; + facebook_pixel_id?: string; + checkout_url?: string; + external_prices_url?: string; + merchant: MerchantRel; + price_list: PriceListRel; + inventory_model: InventoryModelRel; + tax_calculator?: TaxCalculatorRel; + customer_group?: CustomerGroupRel; +} +interface MarketUpdate extends ResourceUpdate { + name?: string; + facebook_pixel_id?: string; + checkout_url?: string; + external_prices_url?: string; + merchant?: MerchantRel; + price_list?: PriceListRel; + inventory_model?: InventoryModelRel; + tax_calculator?: TaxCalculatorRel; + customer_group?: CustomerGroupRel; +} +declare class Markets extends ApiResource { + static readonly TYPE: 'markets'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: MarketCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: MarketUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isMarket(resource: any): resource is Market; + relationship(id: string | ResourceId): MarketRel; + type(): string; +} +export default Markets; +export { Market, MarketCreate, MarketUpdate }; diff --git a/lib/cjs/resources/markets.js b/lib/cjs/resources/markets.js new file mode 100644 index 00000000..2b428f57 --- /dev/null +++ b/lib/cjs/resources/markets.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Markets extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Markets.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Markets.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Markets.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Markets.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Markets.TYPE,id:e},t)}isMarket(e){return e.type&&e.type===Markets.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Markets.TYPE}:{id:e.id,type:Markets.TYPE}}type(){return Markets.TYPE}}Markets.TYPE="markets",exports.default=Markets; \ No newline at end of file diff --git a/lib/cjs/resources/merchants.d.ts b/lib/cjs/resources/merchants.d.ts new file mode 100644 index 00000000..06a9e57d --- /dev/null +++ b/lib/cjs/resources/merchants.d.ts @@ -0,0 +1,36 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type MerchantRel = ResourceId & { + type: typeof Merchants.TYPE; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +interface Merchant extends Resource { + name?: string; + address?: Address; + attachments?: Attachment[]; +} +interface MerchantCreate extends ResourceCreate { + name: string; + address: AddressRel; +} +interface MerchantUpdate extends ResourceUpdate { + name?: string; + address?: AddressRel; +} +declare class Merchants extends ApiResource { + static readonly TYPE: 'merchants'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: MerchantCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: MerchantUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isMerchant(resource: any): resource is Merchant; + relationship(id: string | ResourceId): MerchantRel; + type(): string; +} +export default Merchants; +export { Merchant, MerchantCreate, MerchantUpdate }; diff --git a/lib/cjs/resources/merchants.js b/lib/cjs/resources/merchants.js new file mode 100644 index 00000000..481e5152 --- /dev/null +++ b/lib/cjs/resources/merchants.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Merchants extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Merchants.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Merchants.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Merchants.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Merchants.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Merchants.TYPE,id:e},t)}isMerchant(e){return e.type&&e.type===Merchants.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Merchants.TYPE}:{id:e.id,type:Merchants.TYPE}}type(){return Merchants.TYPE}}Merchants.TYPE="merchants",exports.default=Merchants; \ No newline at end of file diff --git a/lib/cjs/resources/order_amount_promotion_rules.d.ts b/lib/cjs/resources/order_amount_promotion_rules.d.ts new file mode 100644 index 00000000..c2617335 --- /dev/null +++ b/lib/cjs/resources/order_amount_promotion_rules.d.ts @@ -0,0 +1,56 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: typeof OrderAmountPromotionRules.TYPE; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeGiftPromotionRel = ResourceId & { + type: 'free_gift_promotions'; +}; +declare type FixedPricePromotionRel = ResourceId & { + type: 'fixed_price_promotions'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +interface OrderAmountPromotionRule extends Resource { + order_amount_cents?: number; + order_amount_float?: number; + formatted_order_amount?: string; + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; +} +interface OrderAmountPromotionRuleCreate extends ResourceCreate { + order_amount_cents?: number; + promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; +} +interface OrderAmountPromotionRuleUpdate extends ResourceUpdate { + order_amount_cents?: number; + promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; +} +declare class OrderAmountPromotionRules extends ApiResource { + static readonly TYPE: 'order_amount_promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderAmountPromotionRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: OrderAmountPromotionRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrderAmountPromotionRule(resource: any): resource is OrderAmountPromotionRule; + relationship(id: string | ResourceId): OrderAmountPromotionRuleRel; + type(): string; +} +export default OrderAmountPromotionRules; +export { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate }; diff --git a/lib/cjs/resources/order_amount_promotion_rules.js b/lib/cjs/resources/order_amount_promotion_rules.js new file mode 100644 index 00000000..194a9255 --- /dev/null +++ b/lib/cjs/resources/order_amount_promotion_rules.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class OrderAmountPromotionRules extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:OrderAmountPromotionRules.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:OrderAmountPromotionRules.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:OrderAmountPromotionRules.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:OrderAmountPromotionRules.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:OrderAmountPromotionRules.TYPE,id:e},s)}isOrderAmountPromotionRule(e){return e.type&&e.type===OrderAmountPromotionRules.TYPE}relationship(e){return typeof e=="string"?{id:e,type:OrderAmountPromotionRules.TYPE}:{id:e.id,type:OrderAmountPromotionRules.TYPE}}type(){return OrderAmountPromotionRules.TYPE}}OrderAmountPromotionRules.TYPE="order_amount_promotion_rules",exports.default=OrderAmountPromotionRules; \ No newline at end of file diff --git a/lib/cjs/resources/order_copies.d.ts b/lib/cjs/resources/order_copies.d.ts new file mode 100644 index 00000000..0f640566 --- /dev/null +++ b/lib/cjs/resources/order_copies.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { OrderSubscription } from './order_subscriptions'; +declare type OrderCopyRel = ResourceId & { + type: typeof OrderCopies.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface OrderCopy extends Resource { + status?: string; + started_at?: string; + completed_at?: string; + failed_at?: string; + place_target_order?: boolean; + cancel_source_order?: boolean; + reuse_wallet?: boolean; + errors_log?: object; + errors_count?: number; + source_order?: Order; + target_order?: Order; + order_subscription?: OrderSubscription; +} +interface OrderCopyCreate extends ResourceCreate { + place_target_order?: boolean; + cancel_source_order?: boolean; + reuse_wallet?: boolean; + source_order: OrderRel; +} +declare class OrderCopies extends ApiResource { + static readonly TYPE: 'order_copies'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderCopyCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrderCopy(resource: any): resource is OrderCopy; + relationship(id: string | ResourceId): OrderCopyRel; + type(): string; +} +export default OrderCopies; +export { OrderCopy, OrderCopyCreate }; diff --git a/lib/cjs/resources/order_copies.js b/lib/cjs/resources/order_copies.js new file mode 100644 index 00000000..6088eaa6 --- /dev/null +++ b/lib/cjs/resources/order_copies.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class OrderCopies extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:OrderCopies.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:OrderCopies.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:OrderCopies.TYPE,id:e},t,s)}async delete(e,t){await this.resources.delete({type:OrderCopies.TYPE,id:e},t)}isOrderCopy(e){return e.type&&e.type===OrderCopies.TYPE}relationship(e){return typeof e=="string"?{id:e,type:OrderCopies.TYPE}:{id:e.id,type:OrderCopies.TYPE}}type(){return OrderCopies.TYPE}}OrderCopies.TYPE="order_copies",exports.default=OrderCopies; \ No newline at end of file diff --git a/lib/cjs/resources/order_subscriptions.d.ts b/lib/cjs/resources/order_subscriptions.d.ts new file mode 100644 index 00000000..fae8cb6a --- /dev/null +++ b/lib/cjs/resources/order_subscriptions.d.ts @@ -0,0 +1,62 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Order } from './orders'; +import { Customer } from './customers'; +import { OrderCopy } from './order_copies'; +declare type OrderSubscriptionRel = ResourceId & { + type: typeof OrderSubscriptions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface OrderSubscription extends Resource { + number?: string; + status?: string; + frequency?: string; + activate_by_source_order?: boolean; + customer_email?: string; + starts_at?: string; + expires_at?: string; + next_run_at?: string; + occurrencies?: number; + errors_count?: number; + succeeded_on_last_run?: boolean; + options?: object; + market?: Market; + source_order?: Order; + customer?: Customer; + order_copies?: OrderCopy[]; + orders?: Order[]; +} +interface OrderSubscriptionCreate extends ResourceCreate { + frequency: string; + activate_by_source_order?: boolean; + starts_at?: string; + expires_at?: string; + options?: object; + market?: MarketRel; + source_order: OrderRel; +} +interface OrderSubscriptionUpdate extends ResourceUpdate { + expires_at?: string; + _activate?: boolean; + _deactivate?: boolean; + _cancel?: boolean; +} +declare class OrderSubscriptions extends ApiResource { + static readonly TYPE: 'order_subscriptions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderSubscriptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: OrderSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrderSubscription(resource: any): resource is OrderSubscription; + relationship(id: string | ResourceId): OrderSubscriptionRel; + type(): string; +} +export default OrderSubscriptions; +export { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate }; diff --git a/lib/cjs/resources/order_subscriptions.js b/lib/cjs/resources/order_subscriptions.js new file mode 100644 index 00000000..f14a7194 --- /dev/null +++ b/lib/cjs/resources/order_subscriptions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class OrderSubscriptions extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:OrderSubscriptions.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:OrderSubscriptions.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:OrderSubscriptions.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:OrderSubscriptions.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:OrderSubscriptions.TYPE,id:e},t)}isOrderSubscription(e){return e.type&&e.type===OrderSubscriptions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:OrderSubscriptions.TYPE}:{id:e.id,type:OrderSubscriptions.TYPE}}type(){return OrderSubscriptions.TYPE}}OrderSubscriptions.TYPE="order_subscriptions",exports.default=OrderSubscriptions; \ No newline at end of file diff --git a/lib/cjs/resources/order_validation_rules.d.ts b/lib/cjs/resources/order_validation_rules.d.ts new file mode 100644 index 00000000..e2435d6c --- /dev/null +++ b/lib/cjs/resources/order_validation_rules.d.ts @@ -0,0 +1,19 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +declare type OrderValidationRuleRel = ResourceId & { + type: typeof OrderValidationRules.TYPE; +}; +interface OrderValidationRule extends Resource { + market?: Market; +} +declare class OrderValidationRules extends ApiResource { + static readonly TYPE: 'order_validation_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isOrderValidationRule(resource: any): resource is OrderValidationRule; + relationship(id: string | ResourceId): OrderValidationRuleRel; + type(): string; +} +export default OrderValidationRules; +export { OrderValidationRule }; diff --git a/lib/cjs/resources/order_validation_rules.js b/lib/cjs/resources/order_validation_rules.js new file mode 100644 index 00000000..8dbad273 --- /dev/null +++ b/lib/cjs/resources/order_validation_rules.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class OrderValidationRules extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:OrderValidationRules.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:OrderValidationRules.TYPE,id:e},r,t)}isOrderValidationRule(e){return e.type&&e.type===OrderValidationRules.TYPE}relationship(e){return typeof e=="string"?{id:e,type:OrderValidationRules.TYPE}:{id:e.id,type:OrderValidationRules.TYPE}}type(){return OrderValidationRules.TYPE}}OrderValidationRules.TYPE="order_validation_rules",exports.default=OrderValidationRules; \ No newline at end of file diff --git a/lib/cjs/resources/orders.d.ts b/lib/cjs/resources/orders.d.ts new file mode 100644 index 00000000..07cd947c --- /dev/null +++ b/lib/cjs/resources/orders.d.ts @@ -0,0 +1,251 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Customer } from './customers'; +import { Address } from './addresses'; +import { PaymentMethod } from './payment_methods'; +import { CustomerPaymentSource } from './customer_payment_sources'; +import { AdyenPayment } from './adyen_payments'; +import { BraintreePayment } from './braintree_payments'; +import { CheckoutComPayment } from './checkout_com_payments'; +import { ExternalPayment } from './external_payments'; +import { PaypalPayment } from './paypal_payments'; +import { StripePayment } from './stripe_payments'; +import { WireTransfer } from './wire_transfers'; +import { LineItem } from './line_items'; +import { Shipment } from './shipments'; +import { Authorization } from './authorizations'; +import { Void } from './voids'; +import { Capture } from './captures'; +import { Refund } from './refunds'; +import { OrderSubscription } from './order_subscriptions'; +import { OrderCopy } from './order_copies'; +import { Attachment } from './attachments'; +declare type OrderRel = ResourceId & { + type: typeof Orders.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +declare type PaymentMethodRel = ResourceId & { + type: 'payment_methods'; +}; +declare type AdyenPaymentRel = ResourceId & { + type: 'adyen_payments'; +}; +declare type BraintreePaymentRel = ResourceId & { + type: 'braintree_payments'; +}; +declare type CheckoutComPaymentRel = ResourceId & { + type: 'checkout_com_payments'; +}; +declare type ExternalPaymentRel = ResourceId & { + type: 'external_payments'; +}; +declare type PaypalPaymentRel = ResourceId & { + type: 'paypal_payments'; +}; +declare type StripePaymentRel = ResourceId & { + type: 'stripe_payments'; +}; +declare type WireTransferRel = ResourceId & { + type: 'wire_transfers'; +}; +interface Order extends Resource { + number?: number; + autorefresh?: boolean; + status?: string; + payment_status?: string; + fulfillment_status?: string; + guest?: boolean; + editable?: boolean; + customer_email?: string; + language_code?: string; + currency_code?: string; + tax_included?: boolean; + tax_rate?: number; + freight_taxable?: boolean; + requires_billing_info?: boolean; + country_code?: string; + shipping_country_code_lock?: string; + coupon_code?: string; + gift_card_code?: string; + gift_card_or_coupon_code?: string; + subtotal_amount_cents?: number; + subtotal_amount_float?: number; + formatted_subtotal_amount?: string; + shipping_amount_cents?: number; + shipping_amount_float?: number; + formatted_shipping_amount?: string; + payment_method_amount_cents?: number; + payment_method_amount_float?: number; + formatted_payment_method_amount?: string; + discount_amount_cents?: number; + discount_amount_float?: number; + formatted_discount_amount?: string; + adjustment_amount_cents?: number; + adjustment_amount_float?: number; + formatted_adjustment_amount?: string; + gift_card_amount_cents?: number; + gift_card_amount_float?: number; + formatted_gift_card_amount?: string; + total_tax_amount_cents?: number; + total_tax_amount_float?: number; + formatted_total_tax_amount?: string; + subtotal_tax_amount_cents?: number; + subtotal_tax_amount_float?: number; + formatted_subtotal_tax_amount?: string; + shipping_tax_amount_cents?: number; + shipping_tax_amount_float?: number; + formatted_shipping_tax_amount?: string; + payment_method_tax_amount_cents?: number; + payment_method_tax_amount_float?: number; + formatted_payment_method_tax_amount?: string; + adjustment_tax_amount_cents?: number; + adjustment_tax_amount_float?: number; + formatted_adjustment_tax_amount?: string; + total_amount_cents?: number; + total_amount_float?: number; + formatted_total_amount?: string; + total_taxable_amount_cents?: number; + total_taxable_amount_float?: number; + formatted_total_taxable_amount?: string; + subtotal_taxable_amount_cents?: number; + subtotal_taxable_amount_float?: number; + formatted_subtotal_taxable_amount?: string; + shipping_taxable_amount_cents?: number; + shipping_taxable_amount_float?: number; + formatted_shipping_taxable_amount?: string; + payment_method_taxable_amount_cents?: number; + payment_method_taxable_amount_float?: number; + formatted_payment_method_taxable_amount?: string; + adjustment_taxable_amount_cents?: number; + adjustment_taxable_amount_float?: number; + formatted_adjustment_taxable_amount?: string; + total_amount_with_taxes_cents?: number; + total_amount_with_taxes_float?: number; + formatted_total_amount_with_taxes?: string; + fees_amount_cents?: number; + fees_amount_float?: number; + formatted_fees_amount?: string; + duty_amount_cents?: number; + duty_amount_float?: number; + formatted_duty_amount?: string; + skus_count?: number; + line_item_options_count?: number; + shipments_count?: number; + payment_source_details?: object; + token?: string; + cart_url?: string; + return_url?: string; + terms_url?: string; + privacy_url?: string; + checkout_url?: string; + placed_at?: string; + approved_at?: string; + cancelled_at?: string; + payment_updated_at?: string; + fulfillment_updated_at?: string; + refreshed_at?: string; + archived_at?: string; + expires_at?: string; + market?: Market; + customer?: Customer; + shipping_address?: Address; + billing_address?: Address; + available_payment_methods?: PaymentMethod[]; + available_customer_payment_sources?: CustomerPaymentSource[]; + payment_method?: PaymentMethod; + payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer; + line_items?: LineItem[]; + shipments?: Shipment[]; + transactions?: (Authorization | Void | Capture | Refund)[]; + authorizations?: Authorization[]; + captures?: Capture[]; + voids?: Void[]; + refunds?: Refund[]; + order_subscriptions?: OrderSubscription[]; + order_copies?: OrderCopy[]; + attachments?: Attachment[]; +} +interface OrderCreate extends ResourceCreate { + autorefresh?: boolean; + guest?: boolean; + customer_email?: string; + customer_password?: string; + language_code?: string; + shipping_country_code_lock?: string; + coupon_code?: string; + gift_card_code?: string; + gift_card_or_coupon_code?: string; + cart_url?: string; + return_url?: string; + terms_url?: string; + privacy_url?: string; + market?: MarketRel; + customer?: CustomerRel; + shipping_address?: AddressRel; + billing_address?: AddressRel; + payment_method?: PaymentMethodRel; + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +interface OrderUpdate extends ResourceUpdate { + autorefresh?: boolean; + guest?: boolean; + customer_email?: string; + customer_password?: string; + language_code?: string; + shipping_country_code_lock?: string; + coupon_code?: string; + gift_card_code?: string; + gift_card_or_coupon_code?: string; + cart_url?: string; + return_url?: string; + terms_url?: string; + privacy_url?: string; + _archive?: boolean; + _unarchive?: boolean; + _place?: boolean; + _cancel?: boolean; + _approve?: boolean; + _approve_and_capture?: boolean; + _authorize?: boolean; + _authorization_amount_cents?: number; + _capture?: boolean; + _refund?: boolean; + _update_taxes?: boolean; + _billing_address_clone_id?: string; + _shipping_address_clone_id?: string; + _customer_payment_source_id?: string; + _shipping_address_same_as_billing?: boolean; + _billing_address_same_as_shipping?: boolean; + _save_payment_source_to_customer_wallet?: boolean; + _save_shipping_address_to_customer_address_book?: boolean; + _save_billing_address_to_customer_address_book?: boolean; + _refresh?: boolean; + market?: MarketRel; + customer?: CustomerRel; + shipping_address?: AddressRel; + billing_address?: AddressRel; + payment_method?: PaymentMethodRel; + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +declare class Orders extends ApiResource { + static readonly TYPE: 'orders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: OrderUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrder(resource: any): resource is Order; + relationship(id: string | ResourceId): OrderRel; + type(): string; +} +export default Orders; +export { Order, OrderCreate, OrderUpdate }; diff --git a/lib/cjs/resources/orders.js b/lib/cjs/resources/orders.js new file mode 100644 index 00000000..75be4282 --- /dev/null +++ b/lib/cjs/resources/orders.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Orders extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Orders.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:Orders.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:Orders.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:Orders.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:Orders.TYPE,id:e},t)}isOrder(e){return e.type&&e.type===Orders.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Orders.TYPE}:{id:e.id,type:Orders.TYPE}}type(){return Orders.TYPE}}Orders.TYPE="orders",exports.default=Orders; \ No newline at end of file diff --git a/lib/cjs/resources/organization.d.ts b/lib/cjs/resources/organization.d.ts new file mode 100644 index 00000000..ee682a71 --- /dev/null +++ b/lib/cjs/resources/organization.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsRetrieve } from '../query'; +declare type OrganizationRel = ResourceId & { + type: typeof Organizations.TYPE; +}; +interface Organization extends Resource { + name?: string; + slug?: string; + domain?: string; + support_phone?: string; + support_email?: string; + logo_url?: string; + favicon_url?: string; + primary_color?: string; + contrast_color?: string; + gtm_id?: string; + gtm_id_test?: string; + discount_disabled?: boolean; + account_disabled?: boolean; + acceptance_disabled?: boolean; + max_concurrent_promotions?: number; + max_concurrent_imports?: number; +} +declare class Organizations extends ApiResource { + static readonly TYPE: 'organization'; + retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isOrganization(resource: any): resource is Organization; + relationship(id: string | ResourceId): OrganizationRel; + type(): string; +} +export default Organizations; +export { Organization }; diff --git a/lib/cjs/resources/organization.js b/lib/cjs/resources/organization.js new file mode 100644 index 00000000..4cc00512 --- /dev/null +++ b/lib/cjs/resources/organization.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Organizations extends resource_1.ApiResource{async retrieve(e,r){return this.resources.singleton({type:Organizations.TYPE},e,r)}isOrganization(e){return e.type&&e.type===Organizations.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Organizations.TYPE}:{id:e.id,type:Organizations.TYPE}}type(){return Organizations.TYPE}}Organizations.TYPE="organization",exports.default=Organizations; \ No newline at end of file diff --git a/lib/cjs/resources/packages.d.ts b/lib/cjs/resources/packages.d.ts new file mode 100644 index 00000000..c5b6b763 --- /dev/null +++ b/lib/cjs/resources/packages.d.ts @@ -0,0 +1,53 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { Parcel } from './parcels'; +import { Attachment } from './attachments'; +declare type PackageRel = ResourceId & { + type: typeof Packages.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +interface Package extends Resource { + name?: string; + code?: string; + length?: number; + width?: number; + height?: number; + unit_of_length?: string; + stock_location?: StockLocation; + parcels?: Parcel[]; + attachments?: Attachment[]; +} +interface PackageCreate extends ResourceCreate { + name: string; + code?: string; + length: number; + width: number; + height: number; + unit_of_length: string; + stock_location: StockLocationRel; +} +interface PackageUpdate extends ResourceUpdate { + name?: string; + code?: string; + length?: number; + width?: number; + height?: number; + unit_of_length?: string; + stock_location?: StockLocationRel; +} +declare class Packages extends ApiResource { + static readonly TYPE: 'packages'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PackageCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PackageUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPackage(resource: any): resource is Package; + relationship(id: string | ResourceId): PackageRel; + type(): string; +} +export default Packages; +export { Package, PackageCreate, PackageUpdate }; diff --git a/lib/cjs/resources/packages.js b/lib/cjs/resources/packages.js new file mode 100644 index 00000000..0265d9e5 --- /dev/null +++ b/lib/cjs/resources/packages.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Packages extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Packages.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Packages.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Packages.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Packages.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Packages.TYPE,id:e},t)}isPackage(e){return e.type&&e.type===Packages.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Packages.TYPE}:{id:e.id,type:Packages.TYPE}}type(){return Packages.TYPE}}Packages.TYPE="packages",exports.default=Packages; \ No newline at end of file diff --git a/lib/cjs/resources/parcel_line_items.d.ts b/lib/cjs/resources/parcel_line_items.d.ts new file mode 100644 index 00000000..1e7dcbc2 --- /dev/null +++ b/lib/cjs/resources/parcel_line_items.d.ts @@ -0,0 +1,47 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Parcel } from './parcels'; +import { StockLineItem } from './stock_line_items'; +declare type ParcelLineItemRel = ResourceId & { + type: typeof ParcelLineItems.TYPE; +}; +declare type ParcelRel = ResourceId & { + type: 'parcels'; +}; +declare type StockLineItemRel = ResourceId & { + type: 'stock_line_items'; +}; +interface ParcelLineItem extends Resource { + sku_code?: string; + quantity?: number; + parcel?: Parcel; + stock_line_item?: StockLineItem; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_item?: object; +} +interface ParcelLineItemCreate extends ResourceCreate { + sku_code?: string; + quantity: number; + parcel: ParcelRel; + stock_line_item: StockLineItemRel; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_item?: object; +} +declare type ParcelLineItemUpdate = ResourceUpdate; +declare class ParcelLineItems extends ApiResource { + static readonly TYPE: 'parcel_line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ParcelLineItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ParcelLineItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isParcelLineItem(resource: any): resource is ParcelLineItem; + relationship(id: string | ResourceId): ParcelLineItemRel; + type(): string; +} +export default ParcelLineItems; +export { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate }; diff --git a/lib/cjs/resources/parcel_line_items.js b/lib/cjs/resources/parcel_line_items.js new file mode 100644 index 00000000..9d29458c --- /dev/null +++ b/lib/cjs/resources/parcel_line_items.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ParcelLineItems extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:ParcelLineItems.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:ParcelLineItems.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:ParcelLineItems.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:ParcelLineItems.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:ParcelLineItems.TYPE,id:e},t)}isParcelLineItem(e){return e.type&&e.type===ParcelLineItems.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ParcelLineItems.TYPE}:{id:e.id,type:ParcelLineItems.TYPE}}type(){return ParcelLineItems.TYPE}}ParcelLineItems.TYPE="parcel_line_items",exports.default=ParcelLineItems; \ No newline at end of file diff --git a/lib/cjs/resources/parcels.d.ts b/lib/cjs/resources/parcels.d.ts new file mode 100644 index 00000000..dbf29eb8 --- /dev/null +++ b/lib/cjs/resources/parcels.d.ts @@ -0,0 +1,104 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Shipment } from './shipments'; +import { Package } from './packages'; +import { ParcelLineItem } from './parcel_line_items'; +import { Attachment } from './attachments'; +declare type ParcelRel = ResourceId & { + type: typeof Parcels.TYPE; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type PackageRel = ResourceId & { + type: 'packages'; +}; +interface Parcel extends Resource { + number?: string; + weight?: number; + unit_of_weight?: string; + eel_pfc?: string; + contents_type?: string; + contents_explanation?: string; + customs_certify?: boolean; + customs_signer?: string; + non_delivery_option?: string; + restriction_type?: string; + restriction_comments?: string; + customs_info_required?: boolean; + shipping_label_url?: string; + shipping_label_file_type?: string; + shipping_label_size?: string; + shipping_label_resolution?: string; + tracking_number?: string; + tracking_status?: string; + tracking_status_detail?: string; + tracking_status_updated_at?: string; + tracking_details?: string; + carrier_weight_oz?: string; + signed_by?: string; + incoterm?: string; + shipment?: Shipment; + package?: Package; + parcel_line_items?: ParcelLineItem[]; + attachments?: Attachment[]; +} +interface ParcelCreate extends ResourceCreate { + weight?: number; + unit_of_weight?: string; + eel_pfc?: string; + contents_type?: string; + contents_explanation?: string; + customs_certify?: boolean; + customs_signer?: string; + non_delivery_option?: string; + restriction_type?: string; + restriction_comments?: string; + customs_info_required?: boolean; + tracking_number?: string; + tracking_status?: string; + tracking_status_detail?: string; + tracking_status_updated_at?: string; + tracking_details?: string; + carrier_weight_oz?: string; + signed_by?: string; + incoterm?: string; + shipment: ShipmentRel; + package: PackageRel; +} +interface ParcelUpdate extends ResourceUpdate { + weight?: number; + unit_of_weight?: string; + eel_pfc?: string; + contents_type?: string; + contents_explanation?: string; + customs_certify?: boolean; + customs_signer?: string; + non_delivery_option?: string; + restriction_type?: string; + restriction_comments?: string; + customs_info_required?: boolean; + tracking_number?: string; + tracking_status?: string; + tracking_status_detail?: string; + tracking_status_updated_at?: string; + tracking_details?: string; + carrier_weight_oz?: string; + signed_by?: string; + incoterm?: string; + shipment?: ShipmentRel; + package?: PackageRel; +} +declare class Parcels extends ApiResource { + static readonly TYPE: 'parcels'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ParcelCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ParcelUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isParcel(resource: any): resource is Parcel; + relationship(id: string | ResourceId): ParcelRel; + type(): string; +} +export default Parcels; +export { Parcel, ParcelCreate, ParcelUpdate }; diff --git a/lib/cjs/resources/parcels.js b/lib/cjs/resources/parcels.js new file mode 100644 index 00000000..e31bf542 --- /dev/null +++ b/lib/cjs/resources/parcels.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Parcels extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Parcels.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Parcels.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Parcels.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Parcels.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Parcels.TYPE,id:e},t)}isParcel(e){return e.type&&e.type===Parcels.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Parcels.TYPE}:{id:e.id,type:Parcels.TYPE}}type(){return Parcels.TYPE}}Parcels.TYPE="parcels",exports.default=Parcels; \ No newline at end of file diff --git a/lib/cjs/resources/payment_gateways.d.ts b/lib/cjs/resources/payment_gateways.d.ts new file mode 100644 index 00000000..39a40c55 --- /dev/null +++ b/lib/cjs/resources/payment_gateways.d.ts @@ -0,0 +1,20 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +declare type PaymentGatewayRel = ResourceId & { + type: typeof PaymentGateways.TYPE; +}; +interface PaymentGateway extends Resource { + name?: string; + payment_methods?: PaymentMethod[]; +} +declare class PaymentGateways extends ApiResource { + static readonly TYPE: 'payment_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isPaymentGateway(resource: any): resource is PaymentGateway; + relationship(id: string | ResourceId): PaymentGatewayRel; + type(): string; +} +export default PaymentGateways; +export { PaymentGateway }; diff --git a/lib/cjs/resources/payment_gateways.js b/lib/cjs/resources/payment_gateways.js new file mode 100644 index 00000000..31623755 --- /dev/null +++ b/lib/cjs/resources/payment_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class PaymentGateways extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:PaymentGateways.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:PaymentGateways.TYPE,id:e},r,t)}isPaymentGateway(e){return e.type&&e.type===PaymentGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:PaymentGateways.TYPE}:{id:e.id,type:PaymentGateways.TYPE}}type(){return PaymentGateways.TYPE}}PaymentGateways.TYPE="payment_gateways",exports.default=PaymentGateways; \ No newline at end of file diff --git a/lib/cjs/resources/payment_methods.d.ts b/lib/cjs/resources/payment_methods.d.ts new file mode 100644 index 00000000..8ba4ca35 --- /dev/null +++ b/lib/cjs/resources/payment_methods.d.ts @@ -0,0 +1,53 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PaymentGateway } from './payment_gateways'; +import { Attachment } from './attachments'; +declare type PaymentMethodRel = ResourceId & { + type: typeof PaymentMethods.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PaymentGatewayRel = ResourceId & { + type: 'payment_gateways'; +}; +interface PaymentMethod extends Resource { + payment_source_type?: string; + name?: string; + moto?: boolean; + disabled_at?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + market?: Market; + payment_gateway?: PaymentGateway; + attachments?: Attachment[]; +} +interface PaymentMethodCreate extends ResourceCreate { + payment_source_type: string; + moto?: boolean; + price_amount_cents: number; + market: MarketRel; + payment_gateway: PaymentGatewayRel; +} +interface PaymentMethodUpdate extends ResourceUpdate { + payment_source_type?: string; + moto?: boolean; + price_amount_cents?: number; + market?: MarketRel; + payment_gateway?: PaymentGatewayRel; +} +declare class PaymentMethods extends ApiResource { + static readonly TYPE: 'payment_methods'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PaymentMethodCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PaymentMethodUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPaymentMethod(resource: any): resource is PaymentMethod; + relationship(id: string | ResourceId): PaymentMethodRel; + type(): string; +} +export default PaymentMethods; +export { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate }; diff --git a/lib/cjs/resources/payment_methods.js b/lib/cjs/resources/payment_methods.js new file mode 100644 index 00000000..839ba8f5 --- /dev/null +++ b/lib/cjs/resources/payment_methods.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class PaymentMethods extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:PaymentMethods.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:PaymentMethods.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:PaymentMethods.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:PaymentMethods.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:PaymentMethods.TYPE,id:e},r)}isPaymentMethod(e){return e.type&&e.type===PaymentMethods.TYPE}relationship(e){return typeof e=="string"?{id:e,type:PaymentMethods.TYPE}:{id:e.id,type:PaymentMethods.TYPE}}type(){return PaymentMethods.TYPE}}PaymentMethods.TYPE="payment_methods",exports.default=PaymentMethods; \ No newline at end of file diff --git a/lib/cjs/resources/paypal_gateways.d.ts b/lib/cjs/resources/paypal_gateways.d.ts new file mode 100644 index 00000000..0b396fd6 --- /dev/null +++ b/lib/cjs/resources/paypal_gateways.d.ts @@ -0,0 +1,37 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { PaypalPayment } from './paypal_payments'; +declare type PaypalGatewayRel = ResourceId & { + type: typeof PaypalGateways.TYPE; +}; +interface PaypalGateway extends Resource { + name?: string; + payment_methods?: PaymentMethod[]; + paypal_payments?: PaypalPayment[]; +} +interface PaypalGatewayCreate extends ResourceCreate { + name: string; + client_id: string; + client_secret: string; + mode: string; +} +interface PaypalGatewayUpdate extends ResourceUpdate { + name?: string; + client_id?: string; + client_secret?: string; + mode?: string; +} +declare class PaypalGateways extends ApiResource { + static readonly TYPE: 'paypal_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PaypalGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PaypalGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPaypalGateway(resource: any): resource is PaypalGateway; + relationship(id: string | ResourceId): PaypalGatewayRel; + type(): string; +} +export default PaypalGateways; +export { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate }; diff --git a/lib/cjs/resources/paypal_gateways.js b/lib/cjs/resources/paypal_gateways.js new file mode 100644 index 00000000..22432aba --- /dev/null +++ b/lib/cjs/resources/paypal_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class PaypalGateways extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:PaypalGateways.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:PaypalGateways.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:PaypalGateways.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:PaypalGateways.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:PaypalGateways.TYPE,id:e},r)}isPaypalGateway(e){return e.type&&e.type===PaypalGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:PaypalGateways.TYPE}:{id:e.id,type:PaypalGateways.TYPE}}type(){return PaypalGateways.TYPE}}PaypalGateways.TYPE="paypal_gateways",exports.default=PaypalGateways; \ No newline at end of file diff --git a/lib/cjs/resources/paypal_payments.d.ts b/lib/cjs/resources/paypal_payments.d.ts new file mode 100644 index 00000000..942cc512 --- /dev/null +++ b/lib/cjs/resources/paypal_payments.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type PaypalPaymentRel = ResourceId & { + type: typeof PaypalPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface PaypalPayment extends Resource { + return_url?: string; + cancel_url?: string; + note_to_payer?: string; + paypal_payer_id?: string; + name?: string; + paypal_id?: string; + status?: string; + approval_url?: string; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface PaypalPaymentCreate extends ResourceCreate { + return_url: string; + cancel_url: string; + note_to_payer?: string; + order: OrderRel; +} +interface PaypalPaymentUpdate extends ResourceUpdate { + paypal_payer_id?: string; + order?: OrderRel; +} +declare class PaypalPayments extends ApiResource { + static readonly TYPE: 'paypal_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PaypalPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PaypalPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPaypalPayment(resource: any): resource is PaypalPayment; + relationship(id: string | ResourceId): PaypalPaymentRel; + type(): string; +} +export default PaypalPayments; +export { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate }; diff --git a/lib/cjs/resources/paypal_payments.js b/lib/cjs/resources/paypal_payments.js new file mode 100644 index 00000000..92586bdc --- /dev/null +++ b/lib/cjs/resources/paypal_payments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class PaypalPayments extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:PaypalPayments.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:PaypalPayments.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:PaypalPayments.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:PaypalPayments.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:PaypalPayments.TYPE,id:e},r)}isPaypalPayment(e){return e.type&&e.type===PaypalPayments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:PaypalPayments.TYPE}:{id:e.id,type:PaypalPayments.TYPE}}type(){return PaypalPayments.TYPE}}PaypalPayments.TYPE="paypal_payments",exports.default=PaypalPayments; \ No newline at end of file diff --git a/lib/cjs/resources/percentage_discount_promotions.d.ts b/lib/cjs/resources/percentage_discount_promotions.d.ts new file mode 100644 index 00000000..7500e37f --- /dev/null +++ b/lib/cjs/resources/percentage_discount_promotions.d.ts @@ -0,0 +1,87 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: typeof PercentageDiscountPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface PercentageDiscountPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + percentage?: number; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; + sku_list?: SkuList; + skus?: Sku[]; +} +interface PercentageDiscountPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + percentage: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +interface PercentageDiscountPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + percentage?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +declare class PercentageDiscountPromotions extends ApiResource { + static readonly TYPE: 'percentage_discount_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PercentageDiscountPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PercentageDiscountPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPercentageDiscountPromotion(resource: any): resource is PercentageDiscountPromotion; + relationship(id: string | ResourceId): PercentageDiscountPromotionRel; + type(): string; +} +export default PercentageDiscountPromotions; +export { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate }; diff --git a/lib/cjs/resources/percentage_discount_promotions.js b/lib/cjs/resources/percentage_discount_promotions.js new file mode 100644 index 00000000..b74cbb31 --- /dev/null +++ b/lib/cjs/resources/percentage_discount_promotions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class PercentageDiscountPromotions extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:PercentageDiscountPromotions.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:PercentageDiscountPromotions.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:PercentageDiscountPromotions.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:PercentageDiscountPromotions.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:PercentageDiscountPromotions.TYPE,id:e},r)}isPercentageDiscountPromotion(e){return e.type&&e.type===PercentageDiscountPromotions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:PercentageDiscountPromotions.TYPE}:{id:e.id,type:PercentageDiscountPromotions.TYPE}}type(){return PercentageDiscountPromotions.TYPE}}PercentageDiscountPromotions.TYPE="percentage_discount_promotions",exports.default=PercentageDiscountPromotions; \ No newline at end of file diff --git a/lib/cjs/resources/price_lists.d.ts b/lib/cjs/resources/price_lists.d.ts new file mode 100644 index 00000000..6b958608 --- /dev/null +++ b/lib/cjs/resources/price_lists.d.ts @@ -0,0 +1,37 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Price } from './prices'; +import { Attachment } from './attachments'; +declare type PriceListRel = ResourceId & { + type: typeof PriceLists.TYPE; +}; +interface PriceList extends Resource { + name?: string; + currency_code?: string; + tax_included?: boolean; + prices?: Price[]; + attachments?: Attachment[]; +} +interface PriceListCreate extends ResourceCreate { + name: string; + currency_code: string; + tax_included?: boolean; +} +interface PriceListUpdate extends ResourceUpdate { + name?: string; + currency_code?: string; + tax_included?: boolean; +} +declare class PriceLists extends ApiResource { + static readonly TYPE: 'price_lists'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PriceListCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PriceListUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPriceList(resource: any): resource is PriceList; + relationship(id: string | ResourceId): PriceListRel; + type(): string; +} +export default PriceLists; +export { PriceList, PriceListCreate, PriceListUpdate }; diff --git a/lib/cjs/resources/price_lists.js b/lib/cjs/resources/price_lists.js new file mode 100644 index 00000000..faf92ba7 --- /dev/null +++ b/lib/cjs/resources/price_lists.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class PriceLists extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:PriceLists.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:PriceLists.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:PriceLists.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:PriceLists.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:PriceLists.TYPE,id:e},t)}isPriceList(e){return e.type&&e.type===PriceLists.TYPE}relationship(e){return typeof e=="string"?{id:e,type:PriceLists.TYPE}:{id:e.id,type:PriceLists.TYPE}}type(){return PriceLists.TYPE}}PriceLists.TYPE="price_lists",exports.default=PriceLists; \ No newline at end of file diff --git a/lib/cjs/resources/prices.d.ts b/lib/cjs/resources/prices.d.ts new file mode 100644 index 00000000..5f01e9e0 --- /dev/null +++ b/lib/cjs/resources/prices.d.ts @@ -0,0 +1,54 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PriceList } from './price_lists'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type PriceRel = ResourceId & { + type: typeof Prices.TYPE; +}; +declare type PriceListRel = ResourceId & { + type: 'price_lists'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface Price extends Resource { + currency_code?: string; + sku_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + compare_at_amount_cents?: number; + compare_at_amount_float?: number; + formatted_compare_at_amount?: string; + price_list?: PriceList; + sku?: Sku; + attachments?: Attachment[]; +} +interface PriceCreate extends ResourceCreate { + sku_code?: string; + amount_cents: number; + compare_at_amount_cents: number; + price_list: PriceListRel; + sku?: SkuRel; +} +interface PriceUpdate extends ResourceUpdate { + sku_code?: string; + amount_cents?: number; + compare_at_amount_cents?: number; + price_list?: PriceListRel; + sku?: SkuRel; +} +declare class Prices extends ApiResource { + static readonly TYPE: 'prices'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PriceCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PriceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPrice(resource: any): resource is Price; + relationship(id: string | ResourceId): PriceRel; + type(): string; +} +export default Prices; +export { Price, PriceCreate, PriceUpdate }; diff --git a/lib/cjs/resources/prices.js b/lib/cjs/resources/prices.js new file mode 100644 index 00000000..dce44c9f --- /dev/null +++ b/lib/cjs/resources/prices.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Prices extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Prices.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Prices.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Prices.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Prices.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Prices.TYPE,id:e},t)}isPrice(e){return e.type&&e.type===Prices.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Prices.TYPE}:{id:e.id,type:Prices.TYPE}}type(){return Prices.TYPE}}Prices.TYPE="prices",exports.default=Prices; \ No newline at end of file diff --git a/lib/cjs/resources/promotion_rules.d.ts b/lib/cjs/resources/promotion_rules.d.ts new file mode 100644 index 00000000..533f9890 --- /dev/null +++ b/lib/cjs/resources/promotion_rules.d.ts @@ -0,0 +1,24 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +declare type PromotionRuleRel = ResourceId & { + type: typeof PromotionRules.TYPE; +}; +interface PromotionRule extends Resource { + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; +} +declare class PromotionRules extends ApiResource { + static readonly TYPE: 'promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isPromotionRule(resource: any): resource is PromotionRule; + relationship(id: string | ResourceId): PromotionRuleRel; + type(): string; +} +export default PromotionRules; +export { PromotionRule }; diff --git a/lib/cjs/resources/promotion_rules.js b/lib/cjs/resources/promotion_rules.js new file mode 100644 index 00000000..4c986563 --- /dev/null +++ b/lib/cjs/resources/promotion_rules.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class PromotionRules extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:PromotionRules.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:PromotionRules.TYPE,id:e},r,t)}isPromotionRule(e){return e.type&&e.type===PromotionRules.TYPE}relationship(e){return typeof e=="string"?{id:e,type:PromotionRules.TYPE}:{id:e.id,type:PromotionRules.TYPE}}type(){return PromotionRules.TYPE}}PromotionRules.TYPE="promotion_rules",exports.default=PromotionRules; \ No newline at end of file diff --git a/lib/cjs/resources/promotions.d.ts b/lib/cjs/resources/promotions.d.ts new file mode 100644 index 00000000..aaa369a7 --- /dev/null +++ b/lib/cjs/resources/promotions.d.ts @@ -0,0 +1,35 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type PromotionRel = ResourceId & { + type: typeof Promotions.TYPE; +}; +interface Promotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +declare class Promotions extends ApiResource { + static readonly TYPE: 'promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isPromotion(resource: any): resource is Promotion; + relationship(id: string | ResourceId): PromotionRel; + type(): string; +} +export default Promotions; +export { Promotion }; diff --git a/lib/cjs/resources/promotions.js b/lib/cjs/resources/promotions.js new file mode 100644 index 00000000..ed4fee25 --- /dev/null +++ b/lib/cjs/resources/promotions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Promotions extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Promotions.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:Promotions.TYPE,id:e},r,t)}isPromotion(e){return e.type&&e.type===Promotions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Promotions.TYPE}:{id:e.id,type:Promotions.TYPE}}type(){return Promotions.TYPE}}Promotions.TYPE="promotions",exports.default=Promotions; \ No newline at end of file diff --git a/lib/cjs/resources/refunds.d.ts b/lib/cjs/resources/refunds.d.ts new file mode 100644 index 00000000..ebe9cb7b --- /dev/null +++ b/lib/cjs/resources/refunds.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Capture } from './captures'; +declare type RefundRel = ResourceId & { + type: typeof Refunds.TYPE; +}; +interface Refund extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + order?: Order; + reference_capture?: Capture; +} +declare class Refunds extends ApiResource { + static readonly TYPE: 'refunds'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isRefund(resource: any): resource is Refund; + relationship(id: string | ResourceId): RefundRel; + type(): string; +} +export default Refunds; +export { Refund }; diff --git a/lib/cjs/resources/refunds.js b/lib/cjs/resources/refunds.js new file mode 100644 index 00000000..d6ea46f1 --- /dev/null +++ b/lib/cjs/resources/refunds.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Refunds extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Refunds.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:Refunds.TYPE,id:e},r,t)}isRefund(e){return e.type&&e.type===Refunds.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Refunds.TYPE}:{id:e.id,type:Refunds.TYPE}}type(){return Refunds.TYPE}}Refunds.TYPE="refunds",exports.default=Refunds; \ No newline at end of file diff --git a/lib/cjs/resources/return_line_items.d.ts b/lib/cjs/resources/return_line_items.d.ts new file mode 100644 index 00000000..9947805e --- /dev/null +++ b/lib/cjs/resources/return_line_items.d.ts @@ -0,0 +1,47 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Return } from './returns'; +import { LineItem } from './line_items'; +declare type ReturnLineItemRel = ResourceId & { + type: typeof ReturnLineItems.TYPE; +}; +declare type ReturnRel = ResourceId & { + type: 'returns'; +}; +declare type LineItemRel = ResourceId & { + type: 'line_items'; +}; +interface ReturnLineItem extends Resource { + sku_code?: string; + bundle_code?: string; + name?: string; + quantity?: number; + return_reason?: object; + restocked_at?: string; + return?: Return; + line_item?: LineItem; +} +interface ReturnLineItemCreate extends ResourceCreate { + quantity: number; + return_reason?: object; + return: ReturnRel; + line_item: LineItemRel; +} +interface ReturnLineItemUpdate extends ResourceUpdate { + quantity?: number; + _restock?: boolean; + return_reason?: object; +} +declare class ReturnLineItems extends ApiResource { + static readonly TYPE: 'return_line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ReturnLineItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ReturnLineItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isReturnLineItem(resource: any): resource is ReturnLineItem; + relationship(id: string | ResourceId): ReturnLineItemRel; + type(): string; +} +export default ReturnLineItems; +export { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate }; diff --git a/lib/cjs/resources/return_line_items.js b/lib/cjs/resources/return_line_items.js new file mode 100644 index 00000000..cec175b1 --- /dev/null +++ b/lib/cjs/resources/return_line_items.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ReturnLineItems extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:ReturnLineItems.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:ReturnLineItems.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:ReturnLineItems.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:ReturnLineItems.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:ReturnLineItems.TYPE,id:e},r)}isReturnLineItem(e){return e.type&&e.type===ReturnLineItems.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ReturnLineItems.TYPE}:{id:e.id,type:ReturnLineItems.TYPE}}type(){return ReturnLineItems.TYPE}}ReturnLineItems.TYPE="return_line_items",exports.default=ReturnLineItems; \ No newline at end of file diff --git a/lib/cjs/resources/returns.d.ts b/lib/cjs/resources/returns.d.ts new file mode 100644 index 00000000..d1c0b90e --- /dev/null +++ b/lib/cjs/resources/returns.d.ts @@ -0,0 +1,65 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Customer } from './customers'; +import { StockLocation } from './stock_locations'; +import { Address } from './addresses'; +import { ReturnLineItem } from './return_line_items'; +import { Attachment } from './attachments'; +declare type ReturnRel = ResourceId & { + type: typeof Returns.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +interface Return extends Resource { + number?: string; + status?: string; + customer_email?: string; + skus_count?: number; + approved_at?: string; + cancelled_at?: string; + shipped_at?: string; + rejected_at?: string; + received_at?: string; + archived_at?: string; + order?: Order; + customer?: Customer; + stock_location?: StockLocation; + origin_address?: Address; + destination_address?: Address; + return_line_items?: ReturnLineItem[]; + attachments?: Attachment[]; +} +interface ReturnCreate extends ResourceCreate { + order: OrderRel; + stock_location?: StockLocationRel; +} +interface ReturnUpdate extends ResourceUpdate { + _request?: boolean; + _approve?: boolean; + _cancel?: boolean; + _ship?: boolean; + _reject?: boolean; + _receive?: boolean; + _restock?: boolean; + _archive?: boolean; + _unarchive?: boolean; + stock_location?: StockLocationRel; +} +declare class Returns extends ApiResource { + static readonly TYPE: 'returns'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ReturnCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ReturnUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isReturn(resource: any): resource is Return; + relationship(id: string | ResourceId): ReturnRel; + type(): string; +} +export default Returns; +export { Return, ReturnCreate, ReturnUpdate }; diff --git a/lib/cjs/resources/returns.js b/lib/cjs/resources/returns.js new file mode 100644 index 00000000..65924b80 --- /dev/null +++ b/lib/cjs/resources/returns.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Returns extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Returns.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Returns.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Returns.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Returns.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Returns.TYPE,id:e},t)}isReturn(e){return e.type&&e.type===Returns.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Returns.TYPE}:{id:e.id,type:Returns.TYPE}}type(){return Returns.TYPE}}Returns.TYPE="returns",exports.default=Returns; \ No newline at end of file diff --git a/lib/cjs/resources/shipments.d.ts b/lib/cjs/resources/shipments.d.ts new file mode 100644 index 00000000..c8b5f35b --- /dev/null +++ b/lib/cjs/resources/shipments.d.ts @@ -0,0 +1,76 @@ +import { ApiResource, Resource, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { ShippingCategory } from './shipping_categories'; +import { StockLocation } from './stock_locations'; +import { Address } from './addresses'; +import { ShippingMethod } from './shipping_methods'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { StockLineItem } from './stock_line_items'; +import { StockTransfer } from './stock_transfers'; +import { CarrierAccount } from './carrier_accounts'; +import { Parcel } from './parcels'; +import { Attachment } from './attachments'; +declare type ShipmentRel = ResourceId & { + type: typeof Shipments.TYPE; +}; +declare type ShippingMethodRel = ResourceId & { + type: 'shipping_methods'; +}; +interface Shipment extends Resource { + number?: string; + status?: string; + currency_code?: string; + cost_amount_cents?: number; + cost_amount_float?: number; + formatted_cost_amount?: string; + skus_count?: number; + selected_rate_id?: string; + rates?: object[]; + purchase_error_code?: string; + purchase_error_message?: string; + get_rates_started_at?: string; + get_rates_completed_at?: string; + purchase_started_at?: string; + purchase_completed_at?: string; + purchase_failed_at?: string; + order?: Order; + shipping_category?: ShippingCategory; + stock_location?: StockLocation; + origin_address?: Address; + shipping_address?: Address; + shipping_method?: ShippingMethod; + delivery_lead_time?: DeliveryLeadTime; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_items?: object[]; + stock_line_items?: StockLineItem[]; + stock_transfers?: StockTransfer[]; + available_shipping_methods?: ShippingMethod[]; + carrier_accounts?: CarrierAccount[]; + parcels?: Parcel[]; + attachments?: Attachment[]; +} +interface ShipmentUpdate extends ResourceUpdate { + _on_hold?: boolean; + _picking?: boolean; + _packing?: boolean; + _ready_to_ship?: boolean; + _ship?: boolean; + _get_rates?: boolean; + selected_rate_id?: string; + _purchase?: boolean; + shipping_method?: ShippingMethodRel; +} +declare class Shipments extends ApiResource { + static readonly TYPE: 'shipments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShipmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isShipment(resource: any): resource is Shipment; + relationship(id: string | ResourceId): ShipmentRel; + type(): string; +} +export default Shipments; +export { Shipment, ShipmentUpdate }; diff --git a/lib/cjs/resources/shipments.js b/lib/cjs/resources/shipments.js new file mode 100644 index 00000000..fffbab3c --- /dev/null +++ b/lib/cjs/resources/shipments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Shipments extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Shipments.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:Shipments.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:Shipments.TYPE}),r,t)}isShipment(e){return e.type&&e.type===Shipments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Shipments.TYPE}:{id:e.id,type:Shipments.TYPE}}type(){return Shipments.TYPE}}Shipments.TYPE="shipments",exports.default=Shipments; \ No newline at end of file diff --git a/lib/cjs/resources/shipping_categories.d.ts b/lib/cjs/resources/shipping_categories.d.ts new file mode 100644 index 00000000..31783c0f --- /dev/null +++ b/lib/cjs/resources/shipping_categories.d.ts @@ -0,0 +1,31 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type ShippingCategoryRel = ResourceId & { + type: typeof ShippingCategories.TYPE; +}; +interface ShippingCategory extends Resource { + name?: string; + skus?: Sku[]; + attachments?: Attachment[]; +} +interface ShippingCategoryCreate extends ResourceCreate { + name: string; +} +interface ShippingCategoryUpdate extends ResourceUpdate { + name?: string; +} +declare class ShippingCategories extends ApiResource { + static readonly TYPE: 'shipping_categories'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ShippingCategoryCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShippingCategoryUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isShippingCategory(resource: any): resource is ShippingCategory; + relationship(id: string | ResourceId): ShippingCategoryRel; + type(): string; +} +export default ShippingCategories; +export { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate }; diff --git a/lib/cjs/resources/shipping_categories.js b/lib/cjs/resources/shipping_categories.js new file mode 100644 index 00000000..0166ce31 --- /dev/null +++ b/lib/cjs/resources/shipping_categories.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ShippingCategories extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:ShippingCategories.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:ShippingCategories.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:ShippingCategories.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:ShippingCategories.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:ShippingCategories.TYPE,id:e},t)}isShippingCategory(e){return e.type&&e.type===ShippingCategories.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ShippingCategories.TYPE}:{id:e.id,type:ShippingCategories.TYPE}}type(){return ShippingCategories.TYPE}}ShippingCategories.TYPE="shipping_categories",exports.default=ShippingCategories; \ No newline at end of file diff --git a/lib/cjs/resources/shipping_methods.d.ts b/lib/cjs/resources/shipping_methods.d.ts new file mode 100644 index 00000000..c1a4dfec --- /dev/null +++ b/lib/cjs/resources/shipping_methods.d.ts @@ -0,0 +1,67 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { ShippingZone } from './shipping_zones'; +import { ShippingCategory } from './shipping_categories'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { Attachment } from './attachments'; +declare type ShippingMethodRel = ResourceId & { + type: typeof ShippingMethods.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type ShippingZoneRel = ResourceId & { + type: 'shipping_zones'; +}; +declare type ShippingCategoryRel = ResourceId & { + type: 'shipping_categories'; +}; +interface ShippingMethod extends Resource { + name?: string; + disabled_at?: string; + currency_code?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + free_over_amount_cents?: number; + free_over_amount_float?: number; + formatted_free_over_amount?: string; + price_amount_for_shipment_cents?: number; + price_amount_for_shipment_float?: number; + formatted_price_amount_for_shipment?: string; + market?: Market; + shipping_zone?: ShippingZone; + shipping_category?: ShippingCategory; + delivery_lead_time_for_shipment?: DeliveryLeadTime; + attachments?: Attachment[]; +} +interface ShippingMethodCreate extends ResourceCreate { + name: string; + price_amount_cents: number; + free_over_amount_cents?: number; + market: MarketRel; + shipping_zone: ShippingZoneRel; + shipping_category: ShippingCategoryRel; +} +interface ShippingMethodUpdate extends ResourceUpdate { + name?: string; + price_amount_cents?: number; + free_over_amount_cents?: number; + market?: MarketRel; + shipping_zone?: ShippingZoneRel; + shipping_category?: ShippingCategoryRel; +} +declare class ShippingMethods extends ApiResource { + static readonly TYPE: 'shipping_methods'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ShippingMethodCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShippingMethodUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isShippingMethod(resource: any): resource is ShippingMethod; + relationship(id: string | ResourceId): ShippingMethodRel; + type(): string; +} +export default ShippingMethods; +export { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate }; diff --git a/lib/cjs/resources/shipping_methods.js b/lib/cjs/resources/shipping_methods.js new file mode 100644 index 00000000..bd487a76 --- /dev/null +++ b/lib/cjs/resources/shipping_methods.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ShippingMethods extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:ShippingMethods.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:ShippingMethods.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:ShippingMethods.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:ShippingMethods.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:ShippingMethods.TYPE,id:e},r)}isShippingMethod(e){return e.type&&e.type===ShippingMethods.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ShippingMethods.TYPE}:{id:e.id,type:ShippingMethods.TYPE}}type(){return ShippingMethods.TYPE}}ShippingMethods.TYPE="shipping_methods",exports.default=ShippingMethods; \ No newline at end of file diff --git a/lib/cjs/resources/shipping_zones.d.ts b/lib/cjs/resources/shipping_zones.d.ts new file mode 100644 index 00000000..fb65f830 --- /dev/null +++ b/lib/cjs/resources/shipping_zones.d.ts @@ -0,0 +1,47 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Attachment } from './attachments'; +declare type ShippingZoneRel = ResourceId & { + type: typeof ShippingZones.TYPE; +}; +interface ShippingZone extends Resource { + name?: string; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + attachments?: Attachment[]; +} +interface ShippingZoneCreate extends ResourceCreate { + name: string; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; +} +interface ShippingZoneUpdate extends ResourceUpdate { + name?: string; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; +} +declare class ShippingZones extends ApiResource { + static readonly TYPE: 'shipping_zones'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ShippingZoneCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShippingZoneUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isShippingZone(resource: any): resource is ShippingZone; + relationship(id: string | ResourceId): ShippingZoneRel; + type(): string; +} +export default ShippingZones; +export { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate }; diff --git a/lib/cjs/resources/shipping_zones.js b/lib/cjs/resources/shipping_zones.js new file mode 100644 index 00000000..dc33fe10 --- /dev/null +++ b/lib/cjs/resources/shipping_zones.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class ShippingZones extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:ShippingZones.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:ShippingZones.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:ShippingZones.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:ShippingZones.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:ShippingZones.TYPE,id:e},t)}isShippingZone(e){return e.type&&e.type===ShippingZones.TYPE}relationship(e){return typeof e=="string"?{id:e,type:ShippingZones.TYPE}:{id:e.id,type:ShippingZones.TYPE}}type(){return ShippingZones.TYPE}}ShippingZones.TYPE="shipping_zones",exports.default=ShippingZones; \ No newline at end of file diff --git a/lib/cjs/resources/sku_list_items.d.ts b/lib/cjs/resources/sku_list_items.d.ts new file mode 100644 index 00000000..86f27451 --- /dev/null +++ b/lib/cjs/resources/sku_list_items.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type SkuListItemRel = ResourceId & { + type: typeof SkuListItems.TYPE; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface SkuListItem extends Resource { + position?: number; + sku_code?: string; + quantity?: number; + sku_list?: SkuList; + sku?: Sku; +} +interface SkuListItemCreate extends ResourceCreate { + position?: number; + sku_code?: string; + quantity?: number; + sku_list: SkuListRel; + sku: SkuRel; +} +interface SkuListItemUpdate extends ResourceUpdate { + position?: number; + sku_code?: string; + quantity?: number; +} +declare class SkuListItems extends ApiResource { + static readonly TYPE: 'sku_list_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuListItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuListItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuListItem(resource: any): resource is SkuListItem; + relationship(id: string | ResourceId): SkuListItemRel; + type(): string; +} +export default SkuListItems; +export { SkuListItem, SkuListItemCreate, SkuListItemUpdate }; diff --git a/lib/cjs/resources/sku_list_items.js b/lib/cjs/resources/sku_list_items.js new file mode 100644 index 00000000..5f581956 --- /dev/null +++ b/lib/cjs/resources/sku_list_items.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class SkuListItems extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:SkuListItems.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:SkuListItems.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:SkuListItems.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:SkuListItems.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:SkuListItems.TYPE,id:e},r)}isSkuListItem(e){return e.type&&e.type===SkuListItems.TYPE}relationship(e){return typeof e=="string"?{id:e,type:SkuListItems.TYPE}:{id:e.id,type:SkuListItems.TYPE}}type(){return SkuListItems.TYPE}}SkuListItems.TYPE="sku_list_items",exports.default=SkuListItems; \ No newline at end of file diff --git a/lib/cjs/resources/sku_list_promotion_rules.d.ts b/lib/cjs/resources/sku_list_promotion_rules.d.ts new file mode 100644 index 00000000..f988b75e --- /dev/null +++ b/lib/cjs/resources/sku_list_promotion_rules.d.ts @@ -0,0 +1,66 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type SkuListPromotionRuleRel = ResourceId & { + type: typeof SkuListPromotionRules.TYPE; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeGiftPromotionRel = ResourceId & { + type: 'free_gift_promotions'; +}; +declare type FixedPricePromotionRel = ResourceId & { + type: 'fixed_price_promotions'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface SkuListPromotionRule extends Resource { + all_skus?: boolean; + min_quantity?: number; + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; + sku_list?: SkuList; + skus?: Sku[]; +} +interface SkuListPromotionRuleCreate extends ResourceCreate { + all_skus?: boolean; + min_quantity?: number; + promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + sku_list?: SkuListRel; +} +interface SkuListPromotionRuleUpdate extends ResourceUpdate { + all_skus?: boolean; + min_quantity?: number; + promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + sku_list?: SkuListRel; +} +declare class SkuListPromotionRules extends ApiResource { + static readonly TYPE: 'sku_list_promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuListPromotionRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuListPromotionRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuListPromotionRule(resource: any): resource is SkuListPromotionRule; + relationship(id: string | ResourceId): SkuListPromotionRuleRel; + type(): string; +} +export default SkuListPromotionRules; +export { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate }; diff --git a/lib/cjs/resources/sku_list_promotion_rules.js b/lib/cjs/resources/sku_list_promotion_rules.js new file mode 100644 index 00000000..3f17611a --- /dev/null +++ b/lib/cjs/resources/sku_list_promotion_rules.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class SkuListPromotionRules extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:SkuListPromotionRules.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:SkuListPromotionRules.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:SkuListPromotionRules.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:SkuListPromotionRules.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:SkuListPromotionRules.TYPE,id:e},r)}isSkuListPromotionRule(e){return e.type&&e.type===SkuListPromotionRules.TYPE}relationship(e){return typeof e=="string"?{id:e,type:SkuListPromotionRules.TYPE}:{id:e.id,type:SkuListPromotionRules.TYPE}}type(){return SkuListPromotionRules.TYPE}}SkuListPromotionRules.TYPE="sku_list_promotion_rules",exports.default=SkuListPromotionRules; \ No newline at end of file diff --git a/lib/cjs/resources/sku_lists.d.ts b/lib/cjs/resources/sku_lists.d.ts new file mode 100644 index 00000000..95c98ac8 --- /dev/null +++ b/lib/cjs/resources/sku_lists.d.ts @@ -0,0 +1,46 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { SkuListItem } from './sku_list_items'; +import { Bundle } from './bundles'; +declare type SkuListRel = ResourceId & { + type: typeof SkuLists.TYPE; +}; +interface SkuList extends Resource { + name?: string; + slug?: string; + description?: string; + image_url?: string; + manual?: boolean; + sku_code_regex?: string; + skus?: Sku[]; + sku_list_items?: SkuListItem[]; + bundles?: Bundle[]; +} +interface SkuListCreate extends ResourceCreate { + name: string; + description?: string; + image_url?: string; + manual?: boolean; + sku_code_regex?: string; +} +interface SkuListUpdate extends ResourceUpdate { + name?: string; + description?: string; + image_url?: string; + manual?: boolean; + sku_code_regex?: string; +} +declare class SkuLists extends ApiResource { + static readonly TYPE: 'sku_lists'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuListCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuListUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuList(resource: any): resource is SkuList; + relationship(id: string | ResourceId): SkuListRel; + type(): string; +} +export default SkuLists; +export { SkuList, SkuListCreate, SkuListUpdate }; diff --git a/lib/cjs/resources/sku_lists.js b/lib/cjs/resources/sku_lists.js new file mode 100644 index 00000000..3ad81f80 --- /dev/null +++ b/lib/cjs/resources/sku_lists.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class SkuLists extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:SkuLists.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:SkuLists.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:SkuLists.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:SkuLists.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:SkuLists.TYPE,id:e},r)}isSkuList(e){return e.type&&e.type===SkuLists.TYPE}relationship(e){return typeof e=="string"?{id:e,type:SkuLists.TYPE}:{id:e.id,type:SkuLists.TYPE}}type(){return SkuLists.TYPE}}SkuLists.TYPE="sku_lists",exports.default=SkuLists; \ No newline at end of file diff --git a/lib/cjs/resources/sku_options.d.ts b/lib/cjs/resources/sku_options.d.ts new file mode 100644 index 00000000..47743da7 --- /dev/null +++ b/lib/cjs/resources/sku_options.d.ts @@ -0,0 +1,51 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type SkuOptionRel = ResourceId & { + type: typeof SkuOptions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +interface SkuOption extends Resource { + name?: string; + description?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + delay_hours?: number; + delay_days?: number; + sku_code_regex?: string; + market?: Market; + attachments?: Attachment[]; +} +interface SkuOptionCreate extends ResourceCreate { + name: string; + description?: string; + price_amount_cents?: number; + delay_hours?: number; + sku_code_regex?: string; + market: MarketRel; +} +interface SkuOptionUpdate extends ResourceUpdate { + name?: string; + description?: string; + price_amount_cents?: number; + delay_hours?: number; + sku_code_regex?: string; + market?: MarketRel; +} +declare class SkuOptions extends ApiResource { + static readonly TYPE: 'sku_options'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuOptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuOptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuOption(resource: any): resource is SkuOption; + relationship(id: string | ResourceId): SkuOptionRel; + type(): string; +} +export default SkuOptions; +export { SkuOption, SkuOptionCreate, SkuOptionUpdate }; diff --git a/lib/cjs/resources/sku_options.js b/lib/cjs/resources/sku_options.js new file mode 100644 index 00000000..7f680cc5 --- /dev/null +++ b/lib/cjs/resources/sku_options.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class SkuOptions extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:SkuOptions.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:SkuOptions.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:SkuOptions.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:SkuOptions.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:SkuOptions.TYPE,id:e},r)}isSkuOption(e){return e.type&&e.type===SkuOptions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:SkuOptions.TYPE}:{id:e.id,type:SkuOptions.TYPE}}type(){return SkuOptions.TYPE}}SkuOptions.TYPE="sku_options",exports.default=SkuOptions; \ No newline at end of file diff --git a/lib/cjs/resources/skus.d.ts b/lib/cjs/resources/skus.d.ts new file mode 100644 index 00000000..d4cf58f6 --- /dev/null +++ b/lib/cjs/resources/skus.d.ts @@ -0,0 +1,72 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { ShippingCategory } from './shipping_categories'; +import { Price } from './prices'; +import { StockItem } from './stock_items'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { SkuOption } from './sku_options'; +import { Attachment } from './attachments'; +declare type SkuRel = ResourceId & { + type: typeof Skus.TYPE; +}; +declare type ShippingCategoryRel = ResourceId & { + type: 'shipping_categories'; +}; +interface Sku extends Resource { + code?: string; + name?: string; + description?: string; + image_url?: string; + pieces_per_pack?: number; + weight?: number; + unit_of_weight?: string; + hs_tariff_number?: string; + do_not_ship?: boolean; + do_not_track?: boolean; + inventory?: object; + shipping_category?: ShippingCategory; + prices?: Price[]; + stock_items?: StockItem[]; + delivery_lead_times?: DeliveryLeadTime[]; + sku_options?: SkuOption[]; + attachments?: Attachment[]; +} +interface SkuCreate extends ResourceCreate { + code: string; + name: string; + description?: string; + image_url?: string; + pieces_per_pack?: number; + weight?: number; + unit_of_weight?: string; + hs_tariff_number?: string; + do_not_ship?: boolean; + do_not_track?: boolean; + shipping_category: ShippingCategoryRel; +} +interface SkuUpdate extends ResourceUpdate { + code?: string; + name?: string; + description?: string; + image_url?: string; + pieces_per_pack?: number; + weight?: number; + unit_of_weight?: string; + hs_tariff_number?: string; + do_not_ship?: boolean; + do_not_track?: boolean; + shipping_category?: ShippingCategoryRel; +} +declare class Skus extends ApiResource { + static readonly TYPE: 'skus'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSku(resource: any): resource is Sku; + relationship(id: string | ResourceId): SkuRel; + type(): string; +} +export default Skus; +export { Sku, SkuCreate, SkuUpdate }; diff --git a/lib/cjs/resources/skus.js b/lib/cjs/resources/skus.js new file mode 100644 index 00000000..2e81342a --- /dev/null +++ b/lib/cjs/resources/skus.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Skus extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Skus.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Skus.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Skus.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Skus.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Skus.TYPE,id:e},t)}isSku(e){return e.type&&e.type===Skus.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Skus.TYPE}:{id:e.id,type:Skus.TYPE}}type(){return Skus.TYPE}}Skus.TYPE="skus",exports.default=Skus; \ No newline at end of file diff --git a/lib/cjs/resources/stock_items.d.ts b/lib/cjs/resources/stock_items.d.ts new file mode 100644 index 00000000..cec89e4f --- /dev/null +++ b/lib/cjs/resources/stock_items.d.ts @@ -0,0 +1,46 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type StockItemRel = ResourceId & { + type: typeof StockItems.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface StockItem extends Resource { + sku_code?: string; + quantity?: number; + stock_location?: StockLocation; + sku?: Sku; + attachments?: Attachment[]; +} +interface StockItemCreate extends ResourceCreate { + sku_code?: string; + quantity: number; + stock_location: StockLocationRel; + sku?: SkuRel; +} +interface StockItemUpdate extends ResourceUpdate { + sku_code?: string; + quantity?: number; + stock_location?: StockLocationRel; + sku?: SkuRel; +} +declare class StockItems extends ApiResource { + static readonly TYPE: 'stock_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StockItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StockItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStockItem(resource: any): resource is StockItem; + relationship(id: string | ResourceId): StockItemRel; + type(): string; +} +export default StockItems; +export { StockItem, StockItemCreate, StockItemUpdate }; diff --git a/lib/cjs/resources/stock_items.js b/lib/cjs/resources/stock_items.js new file mode 100644 index 00000000..936bb7a4 --- /dev/null +++ b/lib/cjs/resources/stock_items.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class StockItems extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:StockItems.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:StockItems.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:StockItems.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:StockItems.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:StockItems.TYPE,id:e},r)}isStockItem(e){return e.type&&e.type===StockItems.TYPE}relationship(e){return typeof e=="string"?{id:e,type:StockItems.TYPE}:{id:e.id,type:StockItems.TYPE}}type(){return StockItems.TYPE}}StockItems.TYPE="stock_items",exports.default=StockItems; \ No newline at end of file diff --git a/lib/cjs/resources/stock_line_items.d.ts b/lib/cjs/resources/stock_line_items.d.ts new file mode 100644 index 00000000..7771cef3 --- /dev/null +++ b/lib/cjs/resources/stock_line_items.d.ts @@ -0,0 +1,26 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Shipment } from './shipments'; +import { LineItem } from './line_items'; +import { StockItem } from './stock_items'; +declare type StockLineItemRel = ResourceId & { + type: typeof StockLineItems.TYPE; +}; +interface StockLineItem extends Resource { + sku_code?: string; + bundle_code?: string; + quantity?: number; + shipment?: Shipment; + line_item?: LineItem; + stock_item?: StockItem; +} +declare class StockLineItems extends ApiResource { + static readonly TYPE: 'stock_line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isStockLineItem(resource: any): resource is StockLineItem; + relationship(id: string | ResourceId): StockLineItemRel; + type(): string; +} +export default StockLineItems; +export { StockLineItem }; diff --git a/lib/cjs/resources/stock_line_items.js b/lib/cjs/resources/stock_line_items.js new file mode 100644 index 00000000..35ee7f7d --- /dev/null +++ b/lib/cjs/resources/stock_line_items.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class StockLineItems extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:StockLineItems.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:StockLineItems.TYPE,id:e},r,t)}isStockLineItem(e){return e.type&&e.type===StockLineItems.TYPE}relationship(e){return typeof e=="string"?{id:e,type:StockLineItems.TYPE}:{id:e.id,type:StockLineItems.TYPE}}type(){return StockLineItems.TYPE}}StockLineItems.TYPE="stock_line_items",exports.default=StockLineItems; \ No newline at end of file diff --git a/lib/cjs/resources/stock_locations.d.ts b/lib/cjs/resources/stock_locations.d.ts new file mode 100644 index 00000000..13d9f057 --- /dev/null +++ b/lib/cjs/resources/stock_locations.d.ts @@ -0,0 +1,51 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { InventoryStockLocation } from './inventory_stock_locations'; +import { InventoryReturnLocation } from './inventory_return_locations'; +import { StockItem } from './stock_items'; +import { StockTransfer } from './stock_transfers'; +import { Attachment } from './attachments'; +declare type StockLocationRel = ResourceId & { + type: typeof StockLocations.TYPE; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +interface StockLocation extends Resource { + number?: number; + name?: string; + label_format?: string; + suppress_etd?: boolean; + address?: Address; + inventory_stock_locations?: InventoryStockLocation[]; + inventory_return_locations?: InventoryReturnLocation[]; + stock_items?: StockItem[]; + stock_transfers?: StockTransfer[]; + attachments?: Attachment[]; +} +interface StockLocationCreate extends ResourceCreate { + name: string; + label_format?: string; + suppress_etd?: boolean; + address: AddressRel; +} +interface StockLocationUpdate extends ResourceUpdate { + name?: string; + label_format?: string; + suppress_etd?: boolean; + address?: AddressRel; +} +declare class StockLocations extends ApiResource { + static readonly TYPE: 'stock_locations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StockLocationCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StockLocationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStockLocation(resource: any): resource is StockLocation; + relationship(id: string | ResourceId): StockLocationRel; + type(): string; +} +export default StockLocations; +export { StockLocation, StockLocationCreate, StockLocationUpdate }; diff --git a/lib/cjs/resources/stock_locations.js b/lib/cjs/resources/stock_locations.js new file mode 100644 index 00000000..3edd86e3 --- /dev/null +++ b/lib/cjs/resources/stock_locations.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class StockLocations extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:StockLocations.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:StockLocations.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:StockLocations.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:StockLocations.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:StockLocations.TYPE,id:e},r)}isStockLocation(e){return e.type&&e.type===StockLocations.TYPE}relationship(e){return typeof e=="string"?{id:e,type:StockLocations.TYPE}:{id:e.id,type:StockLocations.TYPE}}type(){return StockLocations.TYPE}}StockLocations.TYPE="stock_locations",exports.default=StockLocations; \ No newline at end of file diff --git a/lib/cjs/resources/stock_transfers.d.ts b/lib/cjs/resources/stock_transfers.d.ts new file mode 100644 index 00000000..874e805e --- /dev/null +++ b/lib/cjs/resources/stock_transfers.d.ts @@ -0,0 +1,66 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { StockLocation } from './stock_locations'; +import { Shipment } from './shipments'; +import { LineItem } from './line_items'; +declare type StockTransferRel = ResourceId & { + type: typeof StockTransfers.TYPE; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type LineItemRel = ResourceId & { + type: 'line_items'; +}; +interface StockTransfer extends Resource { + sku_code?: string; + status?: string; + quantity?: number; + completed_at?: string; + cancelled_at?: string; + sku?: Sku; + origin_stock_location?: StockLocation; + destination_stock_location?: StockLocation; + shipment?: Shipment; + line_item?: LineItem; +} +interface StockTransferCreate extends ResourceCreate { + sku_code?: string; + quantity: number; + sku: SkuRel; + origin_stock_location: StockLocationRel; + destination_stock_location: StockLocationRel; + shipment?: ShipmentRel; + line_item?: LineItemRel; +} +interface StockTransferUpdate extends ResourceUpdate { + sku_code?: string; + _upcoming?: boolean; + _picking?: boolean; + _in_transit?: boolean; + _complete?: boolean; + _cancel?: boolean; + sku?: SkuRel; + origin_stock_location?: StockLocationRel; + destination_stock_location?: StockLocationRel; +} +declare class StockTransfers extends ApiResource { + static readonly TYPE: 'stock_transfers'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StockTransferCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StockTransferUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStockTransfer(resource: any): resource is StockTransfer; + relationship(id: string | ResourceId): StockTransferRel; + type(): string; +} +export default StockTransfers; +export { StockTransfer, StockTransferCreate, StockTransferUpdate }; diff --git a/lib/cjs/resources/stock_transfers.js b/lib/cjs/resources/stock_transfers.js new file mode 100644 index 00000000..21588543 --- /dev/null +++ b/lib/cjs/resources/stock_transfers.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class StockTransfers extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:StockTransfers.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:StockTransfers.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:StockTransfers.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:StockTransfers.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:StockTransfers.TYPE,id:e},t)}isStockTransfer(e){return e.type&&e.type===StockTransfers.TYPE}relationship(e){return typeof e=="string"?{id:e,type:StockTransfers.TYPE}:{id:e.id,type:StockTransfers.TYPE}}type(){return StockTransfers.TYPE}}StockTransfers.TYPE="stock_transfers",exports.default=StockTransfers; \ No newline at end of file diff --git a/lib/cjs/resources/stripe_gateways.d.ts b/lib/cjs/resources/stripe_gateways.d.ts new file mode 100644 index 00000000..83277ba1 --- /dev/null +++ b/lib/cjs/resources/stripe_gateways.d.ts @@ -0,0 +1,36 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { StripePayment } from './stripe_payments'; +declare type StripeGatewayRel = ResourceId & { + type: typeof StripeGateways.TYPE; +}; +interface StripeGateway extends Resource { + name?: string; + webhook_endpoint_id?: string; + webhook_endpoint_secret?: string; + webhook_endpoint_url?: string; + payment_methods?: PaymentMethod[]; + stripe_payments?: StripePayment[]; +} +interface StripeGatewayCreate extends ResourceCreate { + name: string; + login: string; + publishable_key?: string; +} +interface StripeGatewayUpdate extends ResourceUpdate { + name?: string; +} +declare class StripeGateways extends ApiResource { + static readonly TYPE: 'stripe_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StripeGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StripeGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStripeGateway(resource: any): resource is StripeGateway; + relationship(id: string | ResourceId): StripeGatewayRel; + type(): string; +} +export default StripeGateways; +export { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate }; diff --git a/lib/cjs/resources/stripe_gateways.js b/lib/cjs/resources/stripe_gateways.js new file mode 100644 index 00000000..33097358 --- /dev/null +++ b/lib/cjs/resources/stripe_gateways.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class StripeGateways extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:StripeGateways.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:StripeGateways.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:StripeGateways.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:StripeGateways.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:StripeGateways.TYPE,id:e},s)}isStripeGateway(e){return e.type&&e.type===StripeGateways.TYPE}relationship(e){return typeof e=="string"?{id:e,type:StripeGateways.TYPE}:{id:e.id,type:StripeGateways.TYPE}}type(){return StripeGateways.TYPE}}StripeGateways.TYPE="stripe_gateways",exports.default=StripeGateways; \ No newline at end of file diff --git a/lib/cjs/resources/stripe_payments.d.ts b/lib/cjs/resources/stripe_payments.d.ts new file mode 100644 index 00000000..7f56c83d --- /dev/null +++ b/lib/cjs/resources/stripe_payments.d.ts @@ -0,0 +1,40 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type StripePaymentRel = ResourceId & { + type: typeof StripePayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface StripePayment extends Resource { + client_secret?: string; + publishable_key?: string; + options?: object; + payment_method?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface StripePaymentCreate extends ResourceCreate { + options?: object; + order: OrderRel; +} +interface StripePaymentUpdate extends ResourceUpdate { + options?: object; + _refresh?: boolean; + order?: OrderRel; +} +declare class StripePayments extends ApiResource { + static readonly TYPE: 'stripe_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StripePaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StripePaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStripePayment(resource: any): resource is StripePayment; + relationship(id: string | ResourceId): StripePaymentRel; + type(): string; +} +export default StripePayments; +export { StripePayment, StripePaymentCreate, StripePaymentUpdate }; diff --git a/lib/cjs/resources/stripe_payments.js b/lib/cjs/resources/stripe_payments.js new file mode 100644 index 00000000..d534e119 --- /dev/null +++ b/lib/cjs/resources/stripe_payments.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class StripePayments extends resource_1.ApiResource{async list(e,s){return this.resources.list({type:StripePayments.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:StripePayments.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:StripePayments.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:StripePayments.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:StripePayments.TYPE,id:e},s)}isStripePayment(e){return e.type&&e.type===StripePayments.TYPE}relationship(e){return typeof e=="string"?{id:e,type:StripePayments.TYPE}:{id:e.id,type:StripePayments.TYPE}}type(){return StripePayments.TYPE}}StripePayments.TYPE="stripe_payments",exports.default=StripePayments; \ No newline at end of file diff --git a/lib/cjs/resources/tax_calculators.d.ts b/lib/cjs/resources/tax_calculators.d.ts new file mode 100644 index 00000000..62519c82 --- /dev/null +++ b/lib/cjs/resources/tax_calculators.d.ts @@ -0,0 +1,24 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type TaxCalculatorRel = ResourceId & { + type: typeof TaxCalculators.TYPE; +}; +interface TaxCalculator extends Resource { + name?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +declare class TaxCalculators extends ApiResource { + static readonly TYPE: 'tax_calculators'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isTaxCalculator(resource: any): resource is TaxCalculator; + relationship(id: string | ResourceId): TaxCalculatorRel; + type(): string; +} +export default TaxCalculators; +export { TaxCalculator }; diff --git a/lib/cjs/resources/tax_calculators.js b/lib/cjs/resources/tax_calculators.js new file mode 100644 index 00000000..0846d323 --- /dev/null +++ b/lib/cjs/resources/tax_calculators.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class TaxCalculators extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:TaxCalculators.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:TaxCalculators.TYPE,id:e},r,t)}isTaxCalculator(e){return e.type&&e.type===TaxCalculators.TYPE}relationship(e){return typeof e=="string"?{id:e,type:TaxCalculators.TYPE}:{id:e.id,type:TaxCalculators.TYPE}}type(){return TaxCalculators.TYPE}}TaxCalculators.TYPE="tax_calculators",exports.default=TaxCalculators; \ No newline at end of file diff --git a/lib/cjs/resources/tax_categories.d.ts b/lib/cjs/resources/tax_categories.d.ts new file mode 100644 index 00000000..b49bc0b9 --- /dev/null +++ b/lib/cjs/resources/tax_categories.d.ts @@ -0,0 +1,57 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { AvalaraAccount } from './avalara_accounts'; +import { TaxjarAccount } from './taxjar_accounts'; +import { ManualTaxCalculator } from './manual_tax_calculators'; +import { ExternalTaxCalculator } from './external_tax_calculators'; +import { Attachment } from './attachments'; +declare type TaxCategoryRel = ResourceId & { + type: typeof TaxCategories.TYPE; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +declare type AvalaraAccountRel = ResourceId & { + type: 'avalara_accounts'; +}; +declare type TaxjarAccountRel = ResourceId & { + type: 'taxjar_accounts'; +}; +declare type ManualTaxCalculatorRel = ResourceId & { + type: 'manual_tax_calculators'; +}; +declare type ExternalTaxCalculatorRel = ResourceId & { + type: 'external_tax_calculators'; +}; +interface TaxCategory extends Resource { + code?: string; + sku_code?: string; + sku?: Sku; + tax_calculator?: AvalaraAccount | TaxjarAccount | ManualTaxCalculator | ExternalTaxCalculator; + attachments?: Attachment[]; +} +interface TaxCategoryCreate extends ResourceCreate { + code: string; + sku_code?: string; + sku: SkuRel; + tax_calculator: AvalaraAccountRel | TaxjarAccountRel | ManualTaxCalculatorRel | ExternalTaxCalculatorRel; +} +interface TaxCategoryUpdate extends ResourceUpdate { + code?: string; + sku_code?: string; + sku?: SkuRel; +} +declare class TaxCategories extends ApiResource { + static readonly TYPE: 'tax_categories'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: TaxCategoryCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: TaxCategoryUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isTaxCategory(resource: any): resource is TaxCategory; + relationship(id: string | ResourceId): TaxCategoryRel; + type(): string; +} +export default TaxCategories; +export { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate }; diff --git a/lib/cjs/resources/tax_categories.js b/lib/cjs/resources/tax_categories.js new file mode 100644 index 00000000..5a0b5d08 --- /dev/null +++ b/lib/cjs/resources/tax_categories.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class TaxCategories extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:TaxCategories.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:TaxCategories.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:TaxCategories.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:TaxCategories.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:TaxCategories.TYPE,id:e},t)}isTaxCategory(e){return e.type&&e.type===TaxCategories.TYPE}relationship(e){return typeof e=="string"?{id:e,type:TaxCategories.TYPE}:{id:e.id,type:TaxCategories.TYPE}}type(){return TaxCategories.TYPE}}TaxCategories.TYPE="tax_categories",exports.default=TaxCategories; \ No newline at end of file diff --git a/lib/cjs/resources/tax_rules.d.ts b/lib/cjs/resources/tax_rules.d.ts new file mode 100644 index 00000000..f050364a --- /dev/null +++ b/lib/cjs/resources/tax_rules.d.ts @@ -0,0 +1,68 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { ManualTaxCalculator } from './manual_tax_calculators'; +declare type TaxRuleRel = ResourceId & { + type: typeof TaxRules.TYPE; +}; +declare type ManualTaxCalculatorRel = ResourceId & { + type: 'manual_tax_calculators'; +}; +interface TaxRule extends Resource { + name?: string; + tax_rate?: number; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + freight_taxable?: boolean; + payment_method_taxable?: boolean; + gift_card_taxable?: boolean; + adjustment_taxable?: boolean; + breakdown?: object; + manual_tax_calculator?: ManualTaxCalculator; +} +interface TaxRuleCreate extends ResourceCreate { + name: string; + tax_rate?: number; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + freight_taxable?: boolean; + payment_method_taxable?: boolean; + gift_card_taxable?: boolean; + adjustment_taxable?: boolean; + manual_tax_calculator: ManualTaxCalculatorRel; +} +interface TaxRuleUpdate extends ResourceUpdate { + name?: string; + tax_rate?: number; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + freight_taxable?: boolean; + payment_method_taxable?: boolean; + gift_card_taxable?: boolean; + adjustment_taxable?: boolean; + manual_tax_calculator?: ManualTaxCalculatorRel; +} +declare class TaxRules extends ApiResource { + static readonly TYPE: 'tax_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: TaxRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: TaxRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isTaxRule(resource: any): resource is TaxRule; + relationship(id: string | ResourceId): TaxRuleRel; + type(): string; +} +export default TaxRules; +export { TaxRule, TaxRuleCreate, TaxRuleUpdate }; diff --git a/lib/cjs/resources/tax_rules.js b/lib/cjs/resources/tax_rules.js new file mode 100644 index 00000000..6f77d126 --- /dev/null +++ b/lib/cjs/resources/tax_rules.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class TaxRules extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:TaxRules.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:TaxRules.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:TaxRules.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:TaxRules.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:TaxRules.TYPE,id:e},t)}isTaxRule(e){return e.type&&e.type===TaxRules.TYPE}relationship(e){return typeof e=="string"?{id:e,type:TaxRules.TYPE}:{id:e.id,type:TaxRules.TYPE}}type(){return TaxRules.TYPE}}TaxRules.TYPE="tax_rules",exports.default=TaxRules; \ No newline at end of file diff --git a/lib/cjs/resources/taxjar_accounts.d.ts b/lib/cjs/resources/taxjar_accounts.d.ts new file mode 100644 index 00000000..d3c502d2 --- /dev/null +++ b/lib/cjs/resources/taxjar_accounts.d.ts @@ -0,0 +1,40 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type TaxjarAccountRel = ResourceId & { + type: typeof TaxjarAccounts.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface TaxjarAccount extends Resource { + name?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface TaxjarAccountCreate extends ResourceCreate { + name: string; + api_key: string; + tax_categories?: TaxCategoryRel[]; +} +interface TaxjarAccountUpdate extends ResourceUpdate { + name?: string; + api_key?: string; + tax_categories?: TaxCategoryRel[]; +} +declare class TaxjarAccounts extends ApiResource { + static readonly TYPE: 'taxjar_accounts'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: TaxjarAccountCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: TaxjarAccountUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isTaxjarAccount(resource: any): resource is TaxjarAccount; + relationship(id: string | ResourceId): TaxjarAccountRel; + type(): string; +} +export default TaxjarAccounts; +export { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate }; diff --git a/lib/cjs/resources/taxjar_accounts.js b/lib/cjs/resources/taxjar_accounts.js new file mode 100644 index 00000000..e3ec3c77 --- /dev/null +++ b/lib/cjs/resources/taxjar_accounts.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class TaxjarAccounts extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:TaxjarAccounts.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:TaxjarAccounts.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:TaxjarAccounts.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:TaxjarAccounts.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:TaxjarAccounts.TYPE,id:e},t)}isTaxjarAccount(e){return e.type&&e.type===TaxjarAccounts.TYPE}relationship(e){return typeof e=="string"?{id:e,type:TaxjarAccounts.TYPE}:{id:e.id,type:TaxjarAccounts.TYPE}}type(){return TaxjarAccounts.TYPE}}TaxjarAccounts.TYPE="taxjar_accounts",exports.default=TaxjarAccounts; \ No newline at end of file diff --git a/lib/cjs/resources/transactions.d.ts b/lib/cjs/resources/transactions.d.ts new file mode 100644 index 00000000..19e07d3b --- /dev/null +++ b/lib/cjs/resources/transactions.d.ts @@ -0,0 +1,30 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +declare type TransactionRel = ResourceId & { + type: typeof Transactions.TYPE; +}; +interface Transaction extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + order?: Order; +} +declare class Transactions extends ApiResource { + static readonly TYPE: 'transactions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isTransaction(resource: any): resource is Transaction; + relationship(id: string | ResourceId): TransactionRel; + type(): string; +} +export default Transactions; +export { Transaction }; diff --git a/lib/cjs/resources/transactions.js b/lib/cjs/resources/transactions.js new file mode 100644 index 00000000..b799de55 --- /dev/null +++ b/lib/cjs/resources/transactions.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Transactions extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Transactions.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:Transactions.TYPE,id:e},r,t)}isTransaction(e){return e.type&&e.type===Transactions.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Transactions.TYPE}:{id:e.id,type:Transactions.TYPE}}type(){return Transactions.TYPE}}Transactions.TYPE="transactions",exports.default=Transactions; \ No newline at end of file diff --git a/lib/cjs/resources/voids.d.ts b/lib/cjs/resources/voids.d.ts new file mode 100644 index 00000000..1969291d --- /dev/null +++ b/lib/cjs/resources/voids.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Authorization } from './authorizations'; +declare type VoidRel = ResourceId & { + type: typeof Voids.TYPE; +}; +interface Void extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + order?: Order; + reference_authorization?: Authorization; +} +declare class Voids extends ApiResource { + static readonly TYPE: 'voids'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isVoid(resource: any): resource is Void; + relationship(id: string | ResourceId): VoidRel; + type(): string; +} +export default Voids; +export { Void }; diff --git a/lib/cjs/resources/voids.js b/lib/cjs/resources/voids.js new file mode 100644 index 00000000..c3679ef5 --- /dev/null +++ b/lib/cjs/resources/voids.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Voids extends resource_1.ApiResource{async list(e,r){return this.resources.list({type:Voids.TYPE},e,r)}async retrieve(e,r,t){return this.resources.retrieve({type:Voids.TYPE,id:e},r,t)}isVoid(e){return e.type&&e.type===Voids.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Voids.TYPE}:{id:e.id,type:Voids.TYPE}}type(){return Voids.TYPE}}Voids.TYPE="voids",exports.default=Voids; \ No newline at end of file diff --git a/lib/cjs/resources/webhooks.d.ts b/lib/cjs/resources/webhooks.d.ts new file mode 100644 index 00000000..23f0a518 --- /dev/null +++ b/lib/cjs/resources/webhooks.d.ts @@ -0,0 +1,41 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { EventCallback } from './event_callbacks'; +declare type WebhookRel = ResourceId & { + type: typeof Webhooks.TYPE; +}; +interface Webhook extends Resource { + name?: string; + topic?: string; + callback_url?: string; + include_resources?: string[]; + circuit_state?: string; + circuit_failure_count?: number; + last_event_callbacks?: EventCallback[]; +} +interface WebhookCreate extends ResourceCreate { + name?: string; + topic: string; + callback_url: string; + include_resources?: string[]; +} +interface WebhookUpdate extends ResourceUpdate { + name?: string; + topic?: string; + callback_url?: string; + include_resources?: string[]; + _reset_circuit?: boolean; +} +declare class Webhooks extends ApiResource { + static readonly TYPE: 'webhooks'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: WebhookCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: WebhookUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isWebhook(resource: any): resource is Webhook; + relationship(id: string | ResourceId): WebhookRel; + type(): string; +} +export default Webhooks; +export { Webhook, WebhookCreate, WebhookUpdate }; diff --git a/lib/cjs/resources/webhooks.js b/lib/cjs/resources/webhooks.js new file mode 100644 index 00000000..0d91df4a --- /dev/null +++ b/lib/cjs/resources/webhooks.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class Webhooks extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:Webhooks.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:Webhooks.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:Webhooks.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:Webhooks.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:Webhooks.TYPE,id:e},t)}isWebhook(e){return e.type&&e.type===Webhooks.TYPE}relationship(e){return typeof e=="string"?{id:e,type:Webhooks.TYPE}:{id:e.id,type:Webhooks.TYPE}}type(){return Webhooks.TYPE}}Webhooks.TYPE="webhooks",exports.default=Webhooks; \ No newline at end of file diff --git a/lib/cjs/resources/wire_transfers.d.ts b/lib/cjs/resources/wire_transfers.d.ts new file mode 100644 index 00000000..d62de117 --- /dev/null +++ b/lib/cjs/resources/wire_transfers.d.ts @@ -0,0 +1,31 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +declare type WireTransferRel = ResourceId & { + type: typeof WireTransfers.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface WireTransfer extends Resource { + order?: Order; +} +interface WireTransferCreate extends ResourceCreate { + order: OrderRel; +} +interface WireTransferUpdate extends ResourceUpdate { + order?: OrderRel; +} +declare class WireTransfers extends ApiResource { + static readonly TYPE: 'wire_transfers'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: WireTransferCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: WireTransferUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isWireTransfer(resource: any): resource is WireTransfer; + relationship(id: string | ResourceId): WireTransferRel; + type(): string; +} +export default WireTransfers; +export { WireTransfer, WireTransferCreate, WireTransferUpdate }; diff --git a/lib/cjs/resources/wire_transfers.js b/lib/cjs/resources/wire_transfers.js new file mode 100644 index 00000000..c3f1c1d5 --- /dev/null +++ b/lib/cjs/resources/wire_transfers.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const resource_1=require("../resource");class WireTransfers extends resource_1.ApiResource{async list(e,t){return this.resources.list({type:WireTransfers.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:WireTransfers.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:WireTransfers.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:WireTransfers.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:WireTransfers.TYPE,id:e},t)}isWireTransfer(e){return e.type&&e.type===WireTransfers.TYPE}relationship(e){return typeof e=="string"?{id:e,type:WireTransfers.TYPE}:{id:e.id,type:WireTransfers.TYPE}}type(){return WireTransfers.TYPE}}WireTransfers.TYPE="wire_transfers",exports.default=WireTransfers; \ No newline at end of file diff --git a/lib/cjs/static.d.ts b/lib/cjs/static.d.ts new file mode 100644 index 00000000..5c5a2fd3 --- /dev/null +++ b/lib/cjs/static.d.ts @@ -0,0 +1,6 @@ +import { SdkError, ApiError } from './error'; +export declare const CommerceLayerStatic: { + resources: () => readonly string[]; + isSdkError: (error: unknown) => error is SdkError; + isApiError: (error: unknown) => error is ApiError; +}; diff --git a/lib/cjs/static.js b/lib/cjs/static.js new file mode 100644 index 00000000..b9c71d27 --- /dev/null +++ b/lib/cjs/static.js @@ -0,0 +1 @@ +"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(r,e,t,i){i===void 0&&(i=t),Object.defineProperty(r,i,{enumerable:!0,get:function(){return e[t]}})}:function(r,e,t,i){i===void 0&&(i=t),r[i]=e[t]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(r,e){Object.defineProperty(r,"default",{enumerable:!0,value:e})}:function(r,e){r.default=e}),__importStar=this&&this.__importStar||function(r){if(r&&r.__esModule)return r;var e={};if(r!=null)for(var t in r)t!=="default"&&Object.prototype.hasOwnProperty.call(r,t)&&__createBinding(e,r,t);return __setModuleDefault(e,r),e};Object.defineProperty(exports,"__esModule",{value:!0}),exports.CommerceLayerStatic=void 0;const api=__importStar(require("./api")),error_1=require("./error");exports.CommerceLayerStatic={resources:()=>api.resourceList,isSdkError:r=>error_1.SdkError.isSdkError(r),isApiError:r=>error_1.ApiError.isApiError(r)}; \ No newline at end of file diff --git a/lib/cjs/util.d.ts b/lib/cjs/util.d.ts new file mode 100644 index 00000000..fca07084 --- /dev/null +++ b/lib/cjs/util.d.ts @@ -0,0 +1,3 @@ +/// +declare const sleep: (ms: number) => Promise; +export { sleep }; diff --git a/lib/cjs/util.js b/lib/cjs/util.js new file mode 100644 index 00000000..49563ed8 --- /dev/null +++ b/lib/cjs/util.js @@ -0,0 +1 @@ +"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sleep=void 0;const sleep=async e=>new Promise(s=>setTimeout(s,e));exports.sleep=sleep; \ No newline at end of file diff --git a/lib/esm/api.d.ts b/lib/esm/api.d.ts new file mode 100644 index 00000000..cf3e40ba --- /dev/null +++ b/lib/esm/api.d.ts @@ -0,0 +1,101 @@ +/** + * ©2022 Commerce Layer Inc. + * OpenAPI schema, version 2.7.6 + **/ +export { default as Addresses } from './resources/addresses'; +export { default as Adjustments } from './resources/adjustments'; +export { default as AdyenGateways } from './resources/adyen_gateways'; +export { default as AdyenPayments } from './resources/adyen_payments'; +export { default as Applications } from './resources/application'; +export { default as Attachments } from './resources/attachments'; +export { default as Authorizations } from './resources/authorizations'; +export { default as AvalaraAccounts } from './resources/avalara_accounts'; +export { default as BillingInfoValidationRules } from './resources/billing_info_validation_rules'; +export { default as BingGeocoders } from './resources/bing_geocoders'; +export { default as BraintreeGateways } from './resources/braintree_gateways'; +export { default as BraintreePayments } from './resources/braintree_payments'; +export { default as Bundles } from './resources/bundles'; +export { default as Captures } from './resources/captures'; +export { default as CarrierAccounts } from './resources/carrier_accounts'; +export { default as CheckoutComGateways } from './resources/checkout_com_gateways'; +export { default as CheckoutComPayments } from './resources/checkout_com_payments'; +export { default as CouponCodesPromotionRules } from './resources/coupon_codes_promotion_rules'; +export { default as CouponRecipients } from './resources/coupon_recipients'; +export { default as Coupons } from './resources/coupons'; +export { default as CustomerAddresses } from './resources/customer_addresses'; +export { default as CustomerGroups } from './resources/customer_groups'; +export { default as CustomerPasswordResets } from './resources/customer_password_resets'; +export { default as CustomerPaymentSources } from './resources/customer_payment_sources'; +export { default as CustomerSubscriptions } from './resources/customer_subscriptions'; +export { default as Customers } from './resources/customers'; +export { default as DeliveryLeadTimes } from './resources/delivery_lead_times'; +export { default as EventCallbacks } from './resources/event_callbacks'; +export { default as ExternalGateways } from './resources/external_gateways'; +export { default as ExternalPayments } from './resources/external_payments'; +export { default as ExternalPromotions } from './resources/external_promotions'; +export { default as ExternalTaxCalculators } from './resources/external_tax_calculators'; +export { default as FixedAmountPromotions } from './resources/fixed_amount_promotions'; +export { default as FixedPricePromotions } from './resources/fixed_price_promotions'; +export { default as FreeGiftPromotions } from './resources/free_gift_promotions'; +export { default as FreeShippingPromotions } from './resources/free_shipping_promotions'; +export { default as Geocoders } from './resources/geocoders'; +export { default as GiftCardRecipients } from './resources/gift_card_recipients'; +export { default as GiftCards } from './resources/gift_cards'; +export { default as GoogleGeocoders } from './resources/google_geocoders'; +export { default as Imports } from './resources/imports'; +export { default as InStockSubscriptions } from './resources/in_stock_subscriptions'; +export { default as InventoryModels } from './resources/inventory_models'; +export { default as InventoryReturnLocations } from './resources/inventory_return_locations'; +export { default as InventoryStockLocations } from './resources/inventory_stock_locations'; +export { default as LineItemOptions } from './resources/line_item_options'; +export { default as LineItems } from './resources/line_items'; +export { default as ManualGateways } from './resources/manual_gateways'; +export { default as ManualTaxCalculators } from './resources/manual_tax_calculators'; +export { default as Markets } from './resources/markets'; +export { default as Merchants } from './resources/merchants'; +export { default as OrderAmountPromotionRules } from './resources/order_amount_promotion_rules'; +export { default as OrderCopies } from './resources/order_copies'; +export { default as OrderSubscriptions } from './resources/order_subscriptions'; +export { default as OrderValidationRules } from './resources/order_validation_rules'; +export { default as Orders } from './resources/orders'; +export { default as Organizations } from './resources/organization'; +export { default as Packages } from './resources/packages'; +export { default as ParcelLineItems } from './resources/parcel_line_items'; +export { default as Parcels } from './resources/parcels'; +export { default as PaymentGateways } from './resources/payment_gateways'; +export { default as PaymentMethods } from './resources/payment_methods'; +export { default as PaypalGateways } from './resources/paypal_gateways'; +export { default as PaypalPayments } from './resources/paypal_payments'; +export { default as PercentageDiscountPromotions } from './resources/percentage_discount_promotions'; +export { default as PriceLists } from './resources/price_lists'; +export { default as Prices } from './resources/prices'; +export { default as PromotionRules } from './resources/promotion_rules'; +export { default as Promotions } from './resources/promotions'; +export { default as Refunds } from './resources/refunds'; +export { default as ReturnLineItems } from './resources/return_line_items'; +export { default as Returns } from './resources/returns'; +export { default as Shipments } from './resources/shipments'; +export { default as ShippingCategories } from './resources/shipping_categories'; +export { default as ShippingMethods } from './resources/shipping_methods'; +export { default as ShippingZones } from './resources/shipping_zones'; +export { default as SkuListItems } from './resources/sku_list_items'; +export { default as SkuListPromotionRules } from './resources/sku_list_promotion_rules'; +export { default as SkuLists } from './resources/sku_lists'; +export { default as SkuOptions } from './resources/sku_options'; +export { default as Skus } from './resources/skus'; +export { default as StockItems } from './resources/stock_items'; +export { default as StockLineItems } from './resources/stock_line_items'; +export { default as StockLocations } from './resources/stock_locations'; +export { default as StockTransfers } from './resources/stock_transfers'; +export { default as StripeGateways } from './resources/stripe_gateways'; +export { default as StripePayments } from './resources/stripe_payments'; +export { default as TaxCalculators } from './resources/tax_calculators'; +export { default as TaxCategories } from './resources/tax_categories'; +export { default as TaxRules } from './resources/tax_rules'; +export { default as TaxjarAccounts } from './resources/taxjar_accounts'; +export { default as Transactions } from './resources/transactions'; +export { default as Voids } from './resources/voids'; +export { default as Webhooks } from './resources/webhooks'; +export { default as WireTransfers } from './resources/wire_transfers'; +export declare type ResourceTypeLock = 'addresses' | 'adjustments' | 'adyen_gateways' | 'adyen_payments' | 'application' | 'attachments' | 'authorizations' | 'avalara_accounts' | 'billing_info_validation_rules' | 'bing_geocoders' | 'braintree_gateways' | 'braintree_payments' | 'bundles' | 'captures' | 'carrier_accounts' | 'checkout_com_gateways' | 'checkout_com_payments' | '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' | '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' | 'line_item_options' | 'line_items' | 'manual_gateways' | 'manual_tax_calculators' | 'markets' | 'merchants' | 'order_amount_promotion_rules' | 'order_copies' | 'order_subscriptions' | 'order_validation_rules' | 'orders' | 'organization' | 'packages' | 'parcel_line_items' | 'parcels' | 'payment_gateways' | 'payment_methods' | 'paypal_gateways' | 'paypal_payments' | 'percentage_discount_promotions' | 'price_lists' | 'prices' | 'promotion_rules' | 'promotions' | 'refunds' | 'return_line_items' | 'returns' | 'shipments' | 'shipping_categories' | 'shipping_methods' | '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' | 'tax_calculators' | 'tax_categories' | 'tax_rules' | 'taxjar_accounts' | 'transactions' | 'voids' | 'webhooks' | 'wire_transfers'; +export declare const resourceList: readonly ["addresses", "adjustments", "adyen_gateways", "adyen_payments", "application", "attachments", "authorizations", "avalara_accounts", "billing_info_validation_rules", "bing_geocoders", "braintree_gateways", "braintree_payments", "bundles", "captures", "carrier_accounts", "checkout_com_gateways", "checkout_com_payments", "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", "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", "line_item_options", "line_items", "manual_gateways", "manual_tax_calculators", "markets", "merchants", "order_amount_promotion_rules", "order_copies", "order_subscriptions", "order_validation_rules", "orders", "organization", "packages", "parcel_line_items", "parcels", "payment_gateways", "payment_methods", "paypal_gateways", "paypal_payments", "percentage_discount_promotions", "price_lists", "prices", "promotion_rules", "promotions", "refunds", "return_line_items", "returns", "shipments", "shipping_categories", "shipping_methods", "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", "tax_calculators", "tax_categories", "tax_rules", "taxjar_accounts", "transactions", "voids", "webhooks", "wire_transfers"]; diff --git a/lib/esm/api.js b/lib/esm/api.js new file mode 100644 index 00000000..df5512e7 --- /dev/null +++ b/lib/esm/api.js @@ -0,0 +1 @@ +export{default as Addresses}from"./resources/addresses";export{default as Adjustments}from"./resources/adjustments";export{default as AdyenGateways}from"./resources/adyen_gateways";export{default as AdyenPayments}from"./resources/adyen_payments";export{default as Applications}from"./resources/application";export{default as Attachments}from"./resources/attachments";export{default as Authorizations}from"./resources/authorizations";export{default as AvalaraAccounts}from"./resources/avalara_accounts";export{default as BillingInfoValidationRules}from"./resources/billing_info_validation_rules";export{default as BingGeocoders}from"./resources/bing_geocoders";export{default as BraintreeGateways}from"./resources/braintree_gateways";export{default as BraintreePayments}from"./resources/braintree_payments";export{default as Bundles}from"./resources/bundles";export{default as Captures}from"./resources/captures";export{default as CarrierAccounts}from"./resources/carrier_accounts";export{default as CheckoutComGateways}from"./resources/checkout_com_gateways";export{default as CheckoutComPayments}from"./resources/checkout_com_payments";export{default as CouponCodesPromotionRules}from"./resources/coupon_codes_promotion_rules";export{default as CouponRecipients}from"./resources/coupon_recipients";export{default as Coupons}from"./resources/coupons";export{default as CustomerAddresses}from"./resources/customer_addresses";export{default as CustomerGroups}from"./resources/customer_groups";export{default as CustomerPasswordResets}from"./resources/customer_password_resets";export{default as CustomerPaymentSources}from"./resources/customer_payment_sources";export{default as CustomerSubscriptions}from"./resources/customer_subscriptions";export{default as Customers}from"./resources/customers";export{default as DeliveryLeadTimes}from"./resources/delivery_lead_times";export{default as EventCallbacks}from"./resources/event_callbacks";export{default as ExternalGateways}from"./resources/external_gateways";export{default as ExternalPayments}from"./resources/external_payments";export{default as ExternalPromotions}from"./resources/external_promotions";export{default as ExternalTaxCalculators}from"./resources/external_tax_calculators";export{default as FixedAmountPromotions}from"./resources/fixed_amount_promotions";export{default as FixedPricePromotions}from"./resources/fixed_price_promotions";export{default as FreeGiftPromotions}from"./resources/free_gift_promotions";export{default as FreeShippingPromotions}from"./resources/free_shipping_promotions";export{default as Geocoders}from"./resources/geocoders";export{default as GiftCardRecipients}from"./resources/gift_card_recipients";export{default as GiftCards}from"./resources/gift_cards";export{default as GoogleGeocoders}from"./resources/google_geocoders";export{default as Imports}from"./resources/imports";export{default as InStockSubscriptions}from"./resources/in_stock_subscriptions";export{default as InventoryModels}from"./resources/inventory_models";export{default as InventoryReturnLocations}from"./resources/inventory_return_locations";export{default as InventoryStockLocations}from"./resources/inventory_stock_locations";export{default as LineItemOptions}from"./resources/line_item_options";export{default as LineItems}from"./resources/line_items";export{default as ManualGateways}from"./resources/manual_gateways";export{default as ManualTaxCalculators}from"./resources/manual_tax_calculators";export{default as Markets}from"./resources/markets";export{default as Merchants}from"./resources/merchants";export{default as OrderAmountPromotionRules}from"./resources/order_amount_promotion_rules";export{default as OrderCopies}from"./resources/order_copies";export{default as OrderSubscriptions}from"./resources/order_subscriptions";export{default as OrderValidationRules}from"./resources/order_validation_rules";export{default as Orders}from"./resources/orders";export{default as Organizations}from"./resources/organization";export{default as Packages}from"./resources/packages";export{default as ParcelLineItems}from"./resources/parcel_line_items";export{default as Parcels}from"./resources/parcels";export{default as PaymentGateways}from"./resources/payment_gateways";export{default as PaymentMethods}from"./resources/payment_methods";export{default as PaypalGateways}from"./resources/paypal_gateways";export{default as PaypalPayments}from"./resources/paypal_payments";export{default as PercentageDiscountPromotions}from"./resources/percentage_discount_promotions";export{default as PriceLists}from"./resources/price_lists";export{default as Prices}from"./resources/prices";export{default as PromotionRules}from"./resources/promotion_rules";export{default as Promotions}from"./resources/promotions";export{default as Refunds}from"./resources/refunds";export{default as ReturnLineItems}from"./resources/return_line_items";export{default as Returns}from"./resources/returns";export{default as Shipments}from"./resources/shipments";export{default as ShippingCategories}from"./resources/shipping_categories";export{default as ShippingMethods}from"./resources/shipping_methods";export{default as ShippingZones}from"./resources/shipping_zones";export{default as SkuListItems}from"./resources/sku_list_items";export{default as SkuListPromotionRules}from"./resources/sku_list_promotion_rules";export{default as SkuLists}from"./resources/sku_lists";export{default as SkuOptions}from"./resources/sku_options";export{default as Skus}from"./resources/skus";export{default as StockItems}from"./resources/stock_items";export{default as StockLineItems}from"./resources/stock_line_items";export{default as StockLocations}from"./resources/stock_locations";export{default as StockTransfers}from"./resources/stock_transfers";export{default as StripeGateways}from"./resources/stripe_gateways";export{default as StripePayments}from"./resources/stripe_payments";export{default as TaxCalculators}from"./resources/tax_calculators";export{default as TaxCategories}from"./resources/tax_categories";export{default as TaxRules}from"./resources/tax_rules";export{default as TaxjarAccounts}from"./resources/taxjar_accounts";export{default as Transactions}from"./resources/transactions";export{default as Voids}from"./resources/voids";export{default as Webhooks}from"./resources/webhooks";export{default as WireTransfers}from"./resources/wire_transfers";export const resourceList=["addresses","adjustments","adyen_gateways","adyen_payments","application","attachments","authorizations","avalara_accounts","billing_info_validation_rules","bing_geocoders","braintree_gateways","braintree_payments","bundles","captures","carrier_accounts","checkout_com_gateways","checkout_com_payments","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","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","line_item_options","line_items","manual_gateways","manual_tax_calculators","markets","merchants","order_amount_promotion_rules","order_copies","order_subscriptions","order_validation_rules","orders","organization","packages","parcel_line_items","parcels","payment_gateways","payment_methods","paypal_gateways","paypal_payments","percentage_discount_promotions","price_lists","prices","promotion_rules","promotions","refunds","return_line_items","returns","shipments","shipping_categories","shipping_methods","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","tax_calculators","tax_categories","tax_rules","taxjar_accounts","transactions","voids","webhooks","wire_transfers"]; \ No newline at end of file diff --git a/lib/esm/client.d.ts b/lib/esm/client.d.ts new file mode 100644 index 00000000..f3c56a5e --- /dev/null +++ b/lib/esm/client.d.ts @@ -0,0 +1,26 @@ +import { Method } from 'axios'; +import type { DocWithData as JSONApiDocument, ResourceObject as JSONApiResource } from 'jsonapi-typescript'; +import type { InterceptorManager } from './interceptor'; +declare type RequestConfig = { + timeout?: number; + params?: { + [key: string]: string | number | boolean; + }; +}; +declare type ApiClientInitConfig = { + organization: string; + domain?: string; + accessToken: string; +} & RequestConfig; +declare type ApiClientConfig = Partial; +declare class ApiClient { + #private; + static create(options: ApiClientInitConfig): ApiClient; + baseUrl: string; + interceptors: InterceptorManager; + private constructor(); + config(config: ApiClientConfig): void; + request(method: Method, path: string, body?: JSONApiResource, options?: ApiClientConfig): Promise; +} +export default ApiClient; +export { ApiClientInitConfig, ApiClientConfig, RequestConfig }; diff --git a/lib/esm/client.js b/lib/esm/client.js new file mode 100644 index 00000000..364e4d7c --- /dev/null +++ b/lib/esm/client.js @@ -0,0 +1 @@ +var u=this&&this.__classPrivateFieldSet||function(o,t,e,i,r){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?o!==t||!r:!t.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(o,e):r?r.value=e:t.set(o,e),e},a=this&&this.__classPrivateFieldGet||function(o,t,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?o!==t||!i:!t.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(o):i?i.value:t.get(o)},s,n;import p from"axios";import{SdkError as b,ApiError as z,ErrorType as c}from"./error";import l from"./config";import C from"./debug";const d=C(),f=(o,t)=>`https://${o.toLowerCase()}.${t||l.default.domain}/api`,k=o=>{let t=new b({message:o.message,type:c.GENERIC});if(p.isAxiosError(o))if(o.response){const e=new z(t);e.type=c.RESPONSE,e.status=o.response.status,e.code=String(e.status),e.errors=o.response.data.errors,t=e}else o.request?(t.type=c.REQUEST,t.request=o.request):t.type=c.CLIENT;else p.isCancel(o)?t.type=c.CANCEL:t.source=o;throw t};class m{constructor(t){s.set(this,void 0),n.set(this,void 0),d("new client instance %O",t),this.baseUrl=f(t.organization,t.domain),u(this,s,t.accessToken,"f");const e={timeout:t.timeout||l.client.timeout},i=Object.assign({baseURL:this.baseUrl,timeout:l.client.timeout,headers:{Accept:"application/vnd.api+json","Content-Type":"application/vnd.api+json",Authorization:"Bearer "+a(this,s,"f")}},e);d("axios options: %O",i),u(this,n,p.create(i),"f"),this.interceptors=a(this,n,"f").interceptors}static create(t){if(!(t==null?void 0:t.organization))throw new Error("Undefined 'organization' parameter");if(!(t==null?void 0:t.accessToken))throw new Error("Undefined 'accessToken' parameter");return new m(t)}config(t){d("config %o",t);const e=a(this,n,"f").defaults;t.timeout&&(e.timeout=t.timeout),t.organization&&(this.baseUrl=f(t.organization,t.domain)),t.accessToken&&(u(this,s,t.accessToken,"f"),e.headers.common.Authorization="Bearer "+a(this,s,"f"))}async request(t,e,i,r){d("request %s %s, %O, %O",t,e,i||{},r||{});const E=i?{data:i}:void 0,g=e,y=(r==null?void 0:r.organization)?f(r.organization,r.domain):void 0,w=(r==null?void 0:r.accessToken)||a(this,s,"f"),T=w?{Authorization:"Bearer "+w}:void 0,v=Object.assign({method:t,baseURL:y,url:g,data:E,headers:T},r);return d("request params: %O",v),a(this,n,"f").request(v).then(h=>h.data).catch(h=>k(h))}}s=new WeakMap,n=new WeakMap;export default m; \ No newline at end of file diff --git a/lib/esm/commercelayer.d.ts b/lib/esm/commercelayer.d.ts new file mode 100644 index 00000000..8643cba8 --- /dev/null +++ b/lib/esm/commercelayer.d.ts @@ -0,0 +1,120 @@ +import * as api from './api'; +import { ApiError } from './error'; +import type { ErrorInterceptor, InterceptorType, RawResponseReader, RequestInterceptor, ResponseInterceptor } from './interceptor'; +import { ResourcesConfig, ResourcesInitConfig } from './resource'; +declare type SdkConfig = {}; +declare type CommerceLayerInitConfig = SdkConfig & ResourcesInitConfig; +declare type CommerceLayerConfig = SdkConfig & ResourcesConfig; +declare class CommerceLayerClient { + #private; + static get openApiSchemaVersion(): string; + addresses: api.Addresses; + adjustments: api.Adjustments; + adyen_gateways: api.AdyenGateways; + adyen_payments: api.AdyenPayments; + application: api.Applications; + attachments: api.Attachments; + authorizations: api.Authorizations; + avalara_accounts: api.AvalaraAccounts; + billing_info_validation_rules: api.BillingInfoValidationRules; + bing_geocoders: api.BingGeocoders; + braintree_gateways: api.BraintreeGateways; + braintree_payments: api.BraintreePayments; + bundles: api.Bundles; + captures: api.Captures; + carrier_accounts: api.CarrierAccounts; + checkout_com_gateways: api.CheckoutComGateways; + checkout_com_payments: api.CheckoutComPayments; + coupon_codes_promotion_rules: api.CouponCodesPromotionRules; + coupon_recipients: api.CouponRecipients; + coupons: api.Coupons; + customer_addresses: api.CustomerAddresses; + customer_groups: api.CustomerGroups; + customer_password_resets: api.CustomerPasswordResets; + customer_payment_sources: api.CustomerPaymentSources; + customer_subscriptions: api.CustomerSubscriptions; + customers: api.Customers; + delivery_lead_times: api.DeliveryLeadTimes; + event_callbacks: api.EventCallbacks; + external_gateways: api.ExternalGateways; + external_payments: api.ExternalPayments; + external_promotions: api.ExternalPromotions; + external_tax_calculators: api.ExternalTaxCalculators; + fixed_amount_promotions: api.FixedAmountPromotions; + fixed_price_promotions: api.FixedPricePromotions; + free_gift_promotions: api.FreeGiftPromotions; + free_shipping_promotions: api.FreeShippingPromotions; + geocoders: api.Geocoders; + gift_card_recipients: api.GiftCardRecipients; + gift_cards: api.GiftCards; + google_geocoders: api.GoogleGeocoders; + imports: api.Imports; + in_stock_subscriptions: api.InStockSubscriptions; + inventory_models: api.InventoryModels; + inventory_return_locations: api.InventoryReturnLocations; + inventory_stock_locations: api.InventoryStockLocations; + line_item_options: api.LineItemOptions; + line_items: api.LineItems; + manual_gateways: api.ManualGateways; + manual_tax_calculators: api.ManualTaxCalculators; + markets: api.Markets; + merchants: api.Merchants; + order_amount_promotion_rules: api.OrderAmountPromotionRules; + order_copies: api.OrderCopies; + order_subscriptions: api.OrderSubscriptions; + order_validation_rules: api.OrderValidationRules; + orders: api.Orders; + organization: api.Organizations; + packages: api.Packages; + parcel_line_items: api.ParcelLineItems; + parcels: api.Parcels; + payment_gateways: api.PaymentGateways; + payment_methods: api.PaymentMethods; + paypal_gateways: api.PaypalGateways; + paypal_payments: api.PaypalPayments; + percentage_discount_promotions: api.PercentageDiscountPromotions; + price_lists: api.PriceLists; + prices: api.Prices; + promotion_rules: api.PromotionRules; + promotions: api.Promotions; + refunds: api.Refunds; + return_line_items: api.ReturnLineItems; + returns: api.Returns; + shipments: api.Shipments; + shipping_categories: api.ShippingCategories; + shipping_methods: api.ShippingMethods; + shipping_zones: api.ShippingZones; + sku_list_items: api.SkuListItems; + sku_list_promotion_rules: api.SkuListPromotionRules; + sku_lists: api.SkuLists; + sku_options: api.SkuOptions; + skus: api.Skus; + stock_items: api.StockItems; + stock_line_items: api.StockLineItems; + stock_locations: api.StockLocations; + stock_transfers: api.StockTransfers; + stripe_gateways: api.StripeGateways; + stripe_payments: api.StripePayments; + tax_calculators: api.TaxCalculators; + tax_categories: api.TaxCategories; + tax_rules: api.TaxRules; + taxjar_accounts: api.TaxjarAccounts; + transactions: api.Transactions; + voids: api.Voids; + webhooks: api.Webhooks; + wire_transfers: api.WireTransfers; + constructor(config: CommerceLayerInitConfig); + get currentOrganization(): string; + private localConfig; + config(config: CommerceLayerConfig): void; + resources(): readonly string[]; + isApiError(error: any): error is ApiError; + addRequestInterceptor(onFulfilled?: RequestInterceptor, onRejected?: ErrorInterceptor): number; + addResponseInterceptor(onFulfilled?: ResponseInterceptor, onRejected?: ErrorInterceptor): number; + removeInterceptor(type: InterceptorType, id: number): void; + addRawResponseReader(): RawResponseReader; + removeRawResponseReader(reader: number | RawResponseReader): void; +} +declare const CommerceLayer: (config: CommerceLayerInitConfig) => CommerceLayerClient; +export default CommerceLayer; +export type { CommerceLayerClient, CommerceLayerConfig, CommerceLayerInitConfig }; diff --git a/lib/esm/commercelayer.js b/lib/esm/commercelayer.js new file mode 100644 index 00000000..db89fa05 --- /dev/null +++ b/lib/esm/commercelayer.js @@ -0,0 +1 @@ +var c=this&&this.__classPrivateFieldSet||function(o,i,n,r,a){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof i=="function"?o!==i||!a:!i.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?a.call(o,n):a?a.value=n:i.set(o,n),n},s=this&&this.__classPrivateFieldGet||function(o,i,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof i=="function"?o!==i||!r:!i.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(o):r?r.value:i.get(o)},t,h;import*as e from"./api";import{CommerceLayerStatic as f}from"./static";import u from"./resource";import p from"./debug";const w=p(),m="2.7.6";class l{constructor(i){t.set(this,void 0),h.set(this,void 0),w("new commercelayer instance %O",i),c(this,t,new u(i),"f"),c(this,h,i.organization,"f"),this.addresses=new e.Addresses(s(this,t,"f")),this.adjustments=new e.Adjustments(s(this,t,"f")),this.adyen_gateways=new e.AdyenGateways(s(this,t,"f")),this.adyen_payments=new e.AdyenPayments(s(this,t,"f")),this.application=new e.Applications(s(this,t,"f")),this.attachments=new e.Attachments(s(this,t,"f")),this.authorizations=new e.Authorizations(s(this,t,"f")),this.avalara_accounts=new e.AvalaraAccounts(s(this,t,"f")),this.billing_info_validation_rules=new e.BillingInfoValidationRules(s(this,t,"f")),this.bing_geocoders=new e.BingGeocoders(s(this,t,"f")),this.braintree_gateways=new e.BraintreeGateways(s(this,t,"f")),this.braintree_payments=new e.BraintreePayments(s(this,t,"f")),this.bundles=new e.Bundles(s(this,t,"f")),this.captures=new e.Captures(s(this,t,"f")),this.carrier_accounts=new e.CarrierAccounts(s(this,t,"f")),this.checkout_com_gateways=new e.CheckoutComGateways(s(this,t,"f")),this.checkout_com_payments=new e.CheckoutComPayments(s(this,t,"f")),this.coupon_codes_promotion_rules=new e.CouponCodesPromotionRules(s(this,t,"f")),this.coupon_recipients=new e.CouponRecipients(s(this,t,"f")),this.coupons=new e.Coupons(s(this,t,"f")),this.customer_addresses=new e.CustomerAddresses(s(this,t,"f")),this.customer_groups=new e.CustomerGroups(s(this,t,"f")),this.customer_password_resets=new e.CustomerPasswordResets(s(this,t,"f")),this.customer_payment_sources=new e.CustomerPaymentSources(s(this,t,"f")),this.customer_subscriptions=new e.CustomerSubscriptions(s(this,t,"f")),this.customers=new e.Customers(s(this,t,"f")),this.delivery_lead_times=new e.DeliveryLeadTimes(s(this,t,"f")),this.event_callbacks=new e.EventCallbacks(s(this,t,"f")),this.external_gateways=new e.ExternalGateways(s(this,t,"f")),this.external_payments=new e.ExternalPayments(s(this,t,"f")),this.external_promotions=new e.ExternalPromotions(s(this,t,"f")),this.external_tax_calculators=new e.ExternalTaxCalculators(s(this,t,"f")),this.fixed_amount_promotions=new e.FixedAmountPromotions(s(this,t,"f")),this.fixed_price_promotions=new e.FixedPricePromotions(s(this,t,"f")),this.free_gift_promotions=new e.FreeGiftPromotions(s(this,t,"f")),this.free_shipping_promotions=new e.FreeShippingPromotions(s(this,t,"f")),this.geocoders=new e.Geocoders(s(this,t,"f")),this.gift_card_recipients=new e.GiftCardRecipients(s(this,t,"f")),this.gift_cards=new e.GiftCards(s(this,t,"f")),this.google_geocoders=new e.GoogleGeocoders(s(this,t,"f")),this.imports=new e.Imports(s(this,t,"f")),this.in_stock_subscriptions=new e.InStockSubscriptions(s(this,t,"f")),this.inventory_models=new e.InventoryModels(s(this,t,"f")),this.inventory_return_locations=new e.InventoryReturnLocations(s(this,t,"f")),this.inventory_stock_locations=new e.InventoryStockLocations(s(this,t,"f")),this.line_item_options=new e.LineItemOptions(s(this,t,"f")),this.line_items=new e.LineItems(s(this,t,"f")),this.manual_gateways=new e.ManualGateways(s(this,t,"f")),this.manual_tax_calculators=new e.ManualTaxCalculators(s(this,t,"f")),this.markets=new e.Markets(s(this,t,"f")),this.merchants=new e.Merchants(s(this,t,"f")),this.order_amount_promotion_rules=new e.OrderAmountPromotionRules(s(this,t,"f")),this.order_copies=new e.OrderCopies(s(this,t,"f")),this.order_subscriptions=new e.OrderSubscriptions(s(this,t,"f")),this.order_validation_rules=new e.OrderValidationRules(s(this,t,"f")),this.orders=new e.Orders(s(this,t,"f")),this.organization=new e.Organizations(s(this,t,"f")),this.packages=new e.Packages(s(this,t,"f")),this.parcel_line_items=new e.ParcelLineItems(s(this,t,"f")),this.parcels=new e.Parcels(s(this,t,"f")),this.payment_gateways=new e.PaymentGateways(s(this,t,"f")),this.payment_methods=new e.PaymentMethods(s(this,t,"f")),this.paypal_gateways=new e.PaypalGateways(s(this,t,"f")),this.paypal_payments=new e.PaypalPayments(s(this,t,"f")),this.percentage_discount_promotions=new e.PercentageDiscountPromotions(s(this,t,"f")),this.price_lists=new e.PriceLists(s(this,t,"f")),this.prices=new e.Prices(s(this,t,"f")),this.promotion_rules=new e.PromotionRules(s(this,t,"f")),this.promotions=new e.Promotions(s(this,t,"f")),this.refunds=new e.Refunds(s(this,t,"f")),this.return_line_items=new e.ReturnLineItems(s(this,t,"f")),this.returns=new e.Returns(s(this,t,"f")),this.shipments=new e.Shipments(s(this,t,"f")),this.shipping_categories=new e.ShippingCategories(s(this,t,"f")),this.shipping_methods=new e.ShippingMethods(s(this,t,"f")),this.shipping_zones=new e.ShippingZones(s(this,t,"f")),this.sku_list_items=new e.SkuListItems(s(this,t,"f")),this.sku_list_promotion_rules=new e.SkuListPromotionRules(s(this,t,"f")),this.sku_lists=new e.SkuLists(s(this,t,"f")),this.sku_options=new e.SkuOptions(s(this,t,"f")),this.skus=new e.Skus(s(this,t,"f")),this.stock_items=new e.StockItems(s(this,t,"f")),this.stock_line_items=new e.StockLineItems(s(this,t,"f")),this.stock_locations=new e.StockLocations(s(this,t,"f")),this.stock_transfers=new e.StockTransfers(s(this,t,"f")),this.stripe_gateways=new e.StripeGateways(s(this,t,"f")),this.stripe_payments=new e.StripePayments(s(this,t,"f")),this.tax_calculators=new e.TaxCalculators(s(this,t,"f")),this.tax_categories=new e.TaxCategories(s(this,t,"f")),this.tax_rules=new e.TaxRules(s(this,t,"f")),this.taxjar_accounts=new e.TaxjarAccounts(s(this,t,"f")),this.transactions=new e.Transactions(s(this,t,"f")),this.voids=new e.Voids(s(this,t,"f")),this.webhooks=new e.Webhooks(s(this,t,"f")),this.wire_transfers=new e.WireTransfers(s(this,t,"f"))}static get openApiSchemaVersion(){return m}get currentOrganization(){return s(this,h,"f")}localConfig(i){i.organization&&c(this,h,i.organization,"f")}config(i){w("config %o",i),this.localConfig(i),s(this,t,"f").config(i)}resources(){return f.resources()}isApiError(i){return f.isApiError(i)}addRequestInterceptor(i,n){return s(this,t,"f").interceptors.request.use(i,n)}addResponseInterceptor(i,n){return s(this,t,"f").interceptors.response.use(i,n)}removeInterceptor(i,n){return s(this,t,"f").interceptors[i].eject(n)}addRawResponseReader(){const i={id:void 0,rawResponse:void 0};function n(a){return i.rawResponse=a==null?void 0:a.data,a}const r=this.addResponseInterceptor(n);return i.id=r,i}removeRawResponseReader(i){const n=typeof i=="number"?i:i.id;if(n)return this.removeInterceptor("response",n)}}t=new WeakMap,h=new WeakMap;const _=o=>new l(o);export default _; \ No newline at end of file diff --git a/lib/esm/common.d.ts b/lib/esm/common.d.ts new file mode 100644 index 00000000..23d49d3c --- /dev/null +++ b/lib/esm/common.d.ts @@ -0,0 +1,4 @@ +import type { ResourceId, ResourceType } from './resource'; +declare const isResourceId: (resource: any) => resource is ResourceId; +declare const isResourceType: (resource: any) => resource is ResourceType; +export { isResourceId, isResourceType }; diff --git a/lib/esm/common.js b/lib/esm/common.js new file mode 100644 index 00000000..7681a227 --- /dev/null +++ b/lib/esm/common.js @@ -0,0 +1 @@ +import{resourceList as s}from"./api";const p=e=>e&&e.type&&e.id&&s.includes(e.type),i=e=>e&&typeof e.type!="undefined"&&e.type&&s.includes(e.type);export{p as isResourceId,i as isResourceType}; \ No newline at end of file diff --git a/lib/esm/config.d.ts b/lib/esm/config.d.ts new file mode 100644 index 00000000..b43508b5 --- /dev/null +++ b/lib/esm/config.d.ts @@ -0,0 +1,11 @@ +declare const config: { + readonly default: { + readonly domain: "commercelayer.io"; + readonly pageNumber: 1; + readonly pageSize: 10; + }; + readonly client: { + readonly timeout: 15000; + }; +}; +export default config; diff --git a/lib/esm/config.js b/lib/esm/config.js new file mode 100644 index 00000000..eb22932f --- /dev/null +++ b/lib/esm/config.js @@ -0,0 +1 @@ +const e={default:{domain:"commercelayer.io",pageNumber:1,pageSize:10},client:{timeout:15e3}};export default e; \ No newline at end of file diff --git a/lib/esm/debug.d.ts b/lib/esm/debug.d.ts new file mode 100644 index 00000000..3f77907a --- /dev/null +++ b/lib/esm/debug.d.ts @@ -0,0 +1,3 @@ +declare type Debugger = (pattern: string, ...args: any[]) => void; +declare const debug: (namespace?: string | undefined) => Debugger; +export default debug; diff --git a/lib/esm/debug.js b/lib/esm/debug.js new file mode 100644 index 00000000..060cde67 --- /dev/null +++ b/lib/esm/debug.js @@ -0,0 +1 @@ +const a=(e,...r)=>{};let t=e=>a;try{const e=require("debug");e&&typeof e=="function"&&(t=e)}catch{}const o="clsdk",n=()=>{const e=new Error;Error.prepareStackTrace=(p,c)=>c;const r=e.stack;return Error.prepareStackTrace=void 0,(r[2].getFileName()||"/").replace(/^.*[\\/]/,"").replace(".ts","")},s=e=>t(`${o}:${e||n()}`);export default s; \ No newline at end of file diff --git a/lib/esm/error.d.ts b/lib/esm/error.d.ts new file mode 100644 index 00000000..5dce3c3f --- /dev/null +++ b/lib/esm/error.d.ts @@ -0,0 +1,26 @@ +declare enum ErrorType { + CLIENT = "client", + REQUEST = "request", + RESPONSE = "response", + GENERIC = "generic", + CANCEL = "cancel" +} +declare class SdkError extends Error { + static isSdkError(error: any): error is ApiError; + type: string; + code?: string; + source?: Error; + request?: any; + constructor(error: { + message: string; + type?: ErrorType; + }); +} +declare class ApiError extends SdkError { + static isApiError(error: any): error is ApiError; + errors: any[]; + status?: number; + constructor(error: SdkError); + first(): any; +} +export { SdkError, ApiError, ErrorType }; diff --git a/lib/esm/error.js b/lib/esm/error.js new file mode 100644 index 00000000..beff348f --- /dev/null +++ b/lib/esm/error.js @@ -0,0 +1 @@ +var s;(function(e){e.CLIENT="client",e.REQUEST="request",e.RESPONSE="response",e.GENERIC="generic",e.CANCEL="cancel"})(s||(s={}));class t extends Error{constructor(r){super(r.message);this.name=this.constructor.name,this.type=r.type||s.GENERIC}static isSdkError(r){return r&&["SdkError","ApiError"].includes(r.name)&&Object.values(s).includes(r.type)}}class i extends t{constructor(r){super(Object.assign(Object.assign({},r),{type:s.RESPONSE}));this.errors=[],this.name=this.constructor.name}static isApiError(r){return t.isSdkError(r)&&r.name==="ApiError"&&r.type===s.RESPONSE}first(){var r;return((r=this.errors)===null||r===void 0?void 0:r.length)>0?this.errors[0]:void 0}}export{t as SdkError,i as ApiError,s as ErrorType}; \ No newline at end of file diff --git a/lib/esm/index.d.ts b/lib/esm/index.d.ts new file mode 100644 index 00000000..7944d63a --- /dev/null +++ b/lib/esm/index.d.ts @@ -0,0 +1,7 @@ +export { default } from './commercelayer'; +export type { CommerceLayerClient } from './commercelayer'; +export { CommerceLayerStatic } from './static'; +export type { QueryParamsRetrieve, QueryParamsList, QueryParams } from './query'; +export * from './model'; +export type { RequestObj, ResponseObj, ErrorObj } from './interceptor'; +export type { SdkError, ApiError, ErrorType } from './error'; diff --git a/lib/esm/index.js b/lib/esm/index.js new file mode 100644 index 00000000..b79deeec --- /dev/null +++ b/lib/esm/index.js @@ -0,0 +1 @@ +export{default}from"./commercelayer";export{CommerceLayerStatic}from"./static";export*from"./model"; \ No newline at end of file diff --git a/lib/esm/interceptor.d.ts b/lib/esm/interceptor.d.ts new file mode 100644 index 00000000..7852a408 --- /dev/null +++ b/lib/esm/interceptor.d.ts @@ -0,0 +1,19 @@ +import { AxiosError, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from "axios"; +declare type InterceptorManager = { + request: AxiosInterceptorManager; + response: AxiosInterceptorManager; +}; +declare type RequestObj = AxiosRequestConfig; +declare type RequestInterceptor = (request: RequestObj) => RequestObj | Promise; +declare type ResponseObj = AxiosResponse; +declare type ResponseInterceptor = (response: ResponseObj) => ResponseObj; +declare type ErrorObj = AxiosError; +declare type ErrorInterceptor = (error: ErrorObj) => ErrorObj; +declare type InterceptorType = 'request' | 'response'; +export type { InterceptorManager, RequestInterceptor, ResponseInterceptor, ErrorInterceptor, InterceptorType }; +export type { RequestObj, ResponseObj, ErrorObj }; +declare type RawResponseReader = { + id: number | undefined; + rawResponse: ResponseObj | undefined; +}; +export type { RawResponseReader }; diff --git a/lib/esm/interceptor.js b/lib/esm/interceptor.js new file mode 100644 index 00000000..17bca460 --- /dev/null +++ b/lib/esm/interceptor.js @@ -0,0 +1 @@ +export{}; \ No newline at end of file diff --git a/lib/esm/jsonapi.d.ts b/lib/esm/jsonapi.d.ts new file mode 100644 index 00000000..34c090d5 --- /dev/null +++ b/lib/esm/jsonapi.d.ts @@ -0,0 +1,5 @@ +import { DocWithData, ResourceObject } from 'jsonapi-typescript'; +import type { ResourceCreate, ResourceUpdate, ResourceId, ResourceType, Resource } from './resource'; +declare const denormalize: (response: DocWithData) => R | R[]; +declare const normalize: (resource: (ResourceCreate & ResourceType) | (ResourceUpdate & ResourceId)) => ResourceObject; +export { denormalize, normalize }; diff --git a/lib/esm/jsonapi.js b/lib/esm/jsonapi.js new file mode 100644 index 00000000..858cfdb7 --- /dev/null +++ b/lib/esm/jsonapi.js @@ -0,0 +1 @@ +import{isResourceId as i}from"./common";import c from"./debug";const a=c(),p=r=>{let s;r.links&&delete r.links;const e=r.data,n=r.included;return Array.isArray(e)?s=e.map(t=>d(t,n)):s=d(e,n),s},l=(r,s=[])=>s.find(e=>r.id===e.id&&r.type===e.type)||r,d=(r,s)=>{a("denormalize resource: %O, %o",r,s||{});const e=Object.assign({id:r.id,type:r.type},r.attributes);return r.relationships&&Object.keys(r.relationships).forEach(n=>{const t=r.relationships[n].data;t?Array.isArray(t)?e[n]=t.map(o=>d(l(o,s),s)):e[n]=d(l(t,s),s):t===null&&(e[n]=null)}),a("denormalized resource: %O",e),e},u=r=>{a("normalize resource: %O",r);const s={},e={};for(const t in r){if(["type","id"].includes(t))continue;const o=r[t];o&&(i(o)||Array.isArray(o)&&i(o[0]))?e[t]={data:o}:s[t]=o}const n={type:r.type,attributes:s,relationships:e};return i(r)&&(n.id=r.id),a("normalized resource: %O",n),n};export{p as denormalize,u as normalize}; \ No newline at end of file diff --git a/lib/esm/model.d.ts b/lib/esm/model.d.ts new file mode 100644 index 00000000..23718bcc --- /dev/null +++ b/lib/esm/model.d.ts @@ -0,0 +1,99 @@ +/** + * ©2022 Commerce Layer Inc. + * OpenAPI schema, version 2.7.6 + **/ +export type { Address, AddressCreate, AddressUpdate } from './resources/addresses'; +export type { Adjustment, AdjustmentCreate, AdjustmentUpdate } from './resources/adjustments'; +export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate } from './resources/adyen_gateways'; +export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate } from './resources/adyen_payments'; +export type { Application } from './resources/application'; +export type { Attachment, AttachmentCreate, AttachmentUpdate } from './resources/attachments'; +export type { Authorization, AuthorizationUpdate } from './resources/authorizations'; +export type { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate } from './resources/avalara_accounts'; +export type { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate } from './resources/billing_info_validation_rules'; +export type { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate } from './resources/bing_geocoders'; +export type { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate } from './resources/braintree_gateways'; +export type { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate } from './resources/braintree_payments'; +export type { Bundle, BundleCreate, BundleUpdate } from './resources/bundles'; +export type { Capture, CaptureUpdate } from './resources/captures'; +export type { CarrierAccount } from './resources/carrier_accounts'; +export type { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate } from './resources/checkout_com_gateways'; +export type { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate } from './resources/checkout_com_payments'; +export type { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate } from './resources/coupon_codes_promotion_rules'; +export type { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate } from './resources/coupon_recipients'; +export type { Coupon, CouponCreate, CouponUpdate } from './resources/coupons'; +export type { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate } from './resources/customer_addresses'; +export type { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate } from './resources/customer_groups'; +export type { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate } from './resources/customer_password_resets'; +export type { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate } from './resources/customer_payment_sources'; +export type { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate } from './resources/customer_subscriptions'; +export type { Customer, CustomerCreate, CustomerUpdate } from './resources/customers'; +export type { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate } from './resources/delivery_lead_times'; +export type { EventCallback } from './resources/event_callbacks'; +export type { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate } from './resources/external_gateways'; +export type { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate } from './resources/external_payments'; +export type { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate } from './resources/external_promotions'; +export type { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate } from './resources/external_tax_calculators'; +export type { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate } from './resources/fixed_amount_promotions'; +export type { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate } from './resources/fixed_price_promotions'; +export type { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate } from './resources/free_gift_promotions'; +export type { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate } from './resources/free_shipping_promotions'; +export type { Geocoder } from './resources/geocoders'; +export type { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate } from './resources/gift_card_recipients'; +export type { GiftCard, GiftCardCreate, GiftCardUpdate } from './resources/gift_cards'; +export type { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate } from './resources/google_geocoders'; +export type { Import, ImportCreate } from './resources/imports'; +export type { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate } from './resources/in_stock_subscriptions'; +export type { InventoryModel, InventoryModelCreate, InventoryModelUpdate } from './resources/inventory_models'; +export type { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate } from './resources/inventory_return_locations'; +export type { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate } from './resources/inventory_stock_locations'; +export type { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate } from './resources/line_item_options'; +export type { LineItem, LineItemCreate, LineItemUpdate } from './resources/line_items'; +export type { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate } from './resources/manual_gateways'; +export type { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate } from './resources/manual_tax_calculators'; +export type { Market, MarketCreate, MarketUpdate } from './resources/markets'; +export type { Merchant, MerchantCreate, MerchantUpdate } from './resources/merchants'; +export type { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate } from './resources/order_amount_promotion_rules'; +export type { OrderCopy, OrderCopyCreate } from './resources/order_copies'; +export type { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate } from './resources/order_subscriptions'; +export type { OrderValidationRule } from './resources/order_validation_rules'; +export type { Order, OrderCreate, OrderUpdate } from './resources/orders'; +export type { Organization } from './resources/organization'; +export type { Package, PackageCreate, PackageUpdate } from './resources/packages'; +export type { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate } from './resources/parcel_line_items'; +export type { Parcel, ParcelCreate, ParcelUpdate } from './resources/parcels'; +export type { PaymentGateway } from './resources/payment_gateways'; +export type { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate } from './resources/payment_methods'; +export type { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate } from './resources/paypal_gateways'; +export type { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate } from './resources/paypal_payments'; +export type { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate } from './resources/percentage_discount_promotions'; +export type { PriceList, PriceListCreate, PriceListUpdate } from './resources/price_lists'; +export type { Price, PriceCreate, PriceUpdate } from './resources/prices'; +export type { PromotionRule } from './resources/promotion_rules'; +export type { Promotion } from './resources/promotions'; +export type { Refund } from './resources/refunds'; +export type { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate } from './resources/return_line_items'; +export type { Return, ReturnCreate, ReturnUpdate } from './resources/returns'; +export type { Shipment, ShipmentUpdate } from './resources/shipments'; +export type { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate } from './resources/shipping_categories'; +export type { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate } from './resources/shipping_methods'; +export type { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate } from './resources/shipping_zones'; +export type { SkuListItem, SkuListItemCreate, SkuListItemUpdate } from './resources/sku_list_items'; +export type { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate } from './resources/sku_list_promotion_rules'; +export type { SkuList, SkuListCreate, SkuListUpdate } from './resources/sku_lists'; +export type { SkuOption, SkuOptionCreate, SkuOptionUpdate } from './resources/sku_options'; +export type { Sku, SkuCreate, SkuUpdate } from './resources/skus'; +export type { StockItem, StockItemCreate, StockItemUpdate } from './resources/stock_items'; +export type { StockLineItem } from './resources/stock_line_items'; +export type { StockLocation, StockLocationCreate, StockLocationUpdate } from './resources/stock_locations'; +export type { StockTransfer, StockTransferCreate, StockTransferUpdate } from './resources/stock_transfers'; +export type { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate } from './resources/stripe_gateways'; +export type { StripePayment, StripePaymentCreate, StripePaymentUpdate } from './resources/stripe_payments'; +export type { TaxCalculator } from './resources/tax_calculators'; +export type { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate } from './resources/tax_categories'; +export type { TaxRule, TaxRuleCreate, TaxRuleUpdate } from './resources/tax_rules'; +export type { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate } from './resources/taxjar_accounts'; +export type { Transaction } from './resources/transactions'; +export type { Void } from './resources/voids'; +export type { Webhook, WebhookCreate, WebhookUpdate } from './resources/webhooks'; +export type { WireTransfer, WireTransferCreate, WireTransferUpdate } from './resources/wire_transfers'; diff --git a/lib/esm/model.js b/lib/esm/model.js new file mode 100644 index 00000000..17bca460 --- /dev/null +++ b/lib/esm/model.js @@ -0,0 +1 @@ +export{}; \ No newline at end of file diff --git a/lib/esm/query.d.ts b/lib/esm/query.d.ts new file mode 100644 index 00000000..fae0d09e --- /dev/null +++ b/lib/esm/query.d.ts @@ -0,0 +1,23 @@ +import { ResourceType } from "./resource"; +interface QueryParamsRetrieve { + include?: string[]; + fields?: string[] | { + [key: string]: string[]; + }; +} +interface QueryParamsList extends QueryParamsRetrieve { + sort?: string[] | { + [key: string]: 'asc' | 'desc'; + }; + filters?: { + [key: string]: string | number | boolean; + }; + pageNumber?: number; + pageSize?: number; +} +declare type QueryParams = QueryParamsRetrieve | QueryParamsList; +export { QueryParamsRetrieve, QueryParamsList, QueryParams }; +declare const generateQueryStringParams: (params: QueryParamsRetrieve | QueryParamsList | undefined, res: ResourceType) => { + [key: string]: string; +}; +export { generateQueryStringParams }; diff --git a/lib/esm/query.js b/lib/esm/query.js new file mode 100644 index 00000000..f9b54a8a --- /dev/null +++ b/lib/esm/query.js @@ -0,0 +1 @@ +import n from"./debug";const a=n(),o=r=>r.filters||r.pageNumber||r.pageSize||r.sort,g=(r,e)=>{a("generate query string params: %O, %O",r,e);const i={};return r&&(r.include&&(i.include=r.include.join(",")),r.fields&&(Array.isArray(r.fields)&&(r.fields={[e.type]:r.fields}),Object.entries(r.fields).forEach(([s,t])=>{i[`fields[${s}]`]=t.join(",")})),o(r)&&(r.sort&&(Array.isArray(r.sort)?i.sort=r.sort.join(","):i.sort=Object.entries(r.sort).map(([s,t])=>`${t==="desc"?"-":""}${s}`).join(",")),r.pageNumber&&(i["page[number]"]=String(r.pageNumber)),r.pageSize&&(i["page[size]"]=String(r.pageSize)),r.filters&&Object.entries(r.filters).forEach(([s,t])=>{i[`filter[q][${s}]`]=String(t)})),a("query string params: %O",i)),i};export{g as generateQueryStringParams}; \ No newline at end of file diff --git a/lib/esm/resource.d.ts b/lib/esm/resource.d.ts new file mode 100644 index 00000000..40b5cd32 --- /dev/null +++ b/lib/esm/resource.d.ts @@ -0,0 +1,71 @@ +import { ApiClientInitConfig } from './client'; +import { QueryParamsRetrieve, QueryParamsList } from './query'; +import { ResourceTypeLock } from './api'; +import { InterceptorManager } from './interceptor'; +import { Value as JSONValue } from 'json-typescript'; +declare type Metadata = { + [key: string]: JSONValue; +}; +interface ResourceType { + readonly type: ResourceTypeLock; +} +interface ResourceId extends ResourceType { + readonly id: string; +} +interface Resource extends ResourceId { + reference?: string; + reference_origin?: string; + metadata?: Metadata; + readonly created_at: string; + readonly updated_at: string; +} +interface ResourceCreate { + reference?: string; + reference_origin?: string; + metadata?: Metadata; +} +interface ResourceUpdate { + readonly id: string; + reference?: string; + reference_origin?: string; + metadata?: Metadata; +} +declare type ListMeta = { + readonly pageCount: number; + readonly recordCount: number; + readonly currentPage: number; + readonly recordsPerPage: number; +}; +declare class ListResponse extends Array { + readonly meta: ListMeta; + constructor(meta: ListMeta, data: Array); + first(): R | undefined; + last(): R | undefined; + get(index: number): R | undefined; +} +export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse }; +declare type ResourceAdapterConfig = {}; +declare type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig; +declare type ResourcesConfig = Partial; +declare class ResourceAdapter { + #private; + constructor(config: ResourcesInitConfig); + get interceptors(): InterceptorManager; + private localConfig; + config(config: ResourcesConfig): void; + singleton(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + list(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(resource: ResourceId, options?: ResourcesConfig): Promise; +} +declare abstract class ApiResource { + static readonly TYPE: ResourceTypeLock; + protected resources: ResourceAdapter; + constructor(adapter: ResourceAdapter); + abstract relationship(id: string | ResourceId): ResourceId; + abstract type(): string; +} +export default ResourceAdapter; +export { ApiResource, ResourcesConfig, ResourcesInitConfig }; diff --git a/lib/esm/resource.js b/lib/esm/resource.js new file mode 100644 index 00000000..411e0587 --- /dev/null +++ b/lib/esm/resource.js @@ -0,0 +1 @@ +var w=this&&this.__classPrivateFieldSet||function(a,t,s,e,r){if(e==="m")throw new TypeError("Private method is not writable");if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?a!==t||!r:!t.has(a))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e==="a"?r.call(a,s):r?r.value=s:t.set(a,s),s},n=this&&this.__classPrivateFieldGet||function(a,t,s,e){if(s==="a"&&!e)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?a!==t||!e:!t.has(a))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?e:s==="a"?e.call(a):e?e.value:t.get(a)},o,g;import O from"./client";import{denormalize as u,normalize as h}from"./jsonapi";import{generateQueryStringParams as d}from"./query";import m from"./config";import b from"./debug";const c=b();class y extends Array{constructor(t,s){super(...s||[]);this.meta=t}first(){return this.length?this[0]:void 0}last(){return this.length?this[this.length-1]:void 0}get(t){return this.length&&t>=0?this[t]:void 0}}class j{constructor(t){o.set(this,void 0),g.set(this,{}),w(this,o,O.create(t),"f"),this.localConfig(t)}get interceptors(){return n(this,o,"f").interceptors}localConfig(t){}config(t){c("config %o",t),this.localConfig(t),n(this,o,"f").config(t)}async singleton(t,s,e){c("singleton: %o, %O, %O",t,s||{},e||{});const r=d(s,t);(e==null?void 0:e.params)&&Object.assign(r,e==null?void 0:e.params);const i=await n(this,o,"f").request("get",`${t.type}`,void 0,Object.assign(Object.assign({},e),{params:r}));return u(i)}async retrieve(t,s,e){c("retrieve: %o, %O, %O",t,s||{},e||{});const r=d(s,t);(e==null?void 0:e.params)&&Object.assign(r,e==null?void 0:e.params);const i=await n(this,o,"f").request("get",`${t.type}/${t.id}`,void 0,Object.assign(Object.assign({},e),{params:r}));return u(i)}async list(t,s,e){var r,i;c("list: %o, %O, %O",t,s||{},e||{});const l=d(s,t);(e==null?void 0:e.params)&&Object.assign(l,e==null?void 0:e.params);const p=await n(this,o,"f").request("get",`${t.type}`,void 0,Object.assign(Object.assign({},e),{params:l})),f=u(p),v={pageCount:Number((r=p.meta)===null||r===void 0?void 0:r.page_count),recordCount:Number((i=p.meta)===null||i===void 0?void 0:i.record_count),currentPage:(s==null?void 0:s.pageNumber)||m.default.pageNumber,recordsPerPage:(s==null?void 0:s.pageSize)||m.default.pageSize};return new y(v,f)}async create(t,s,e){c("create: %o, %O, %O",t,s||{},e||{});const r=d(s,t);(e==null?void 0:e.params)&&Object.assign(r,e==null?void 0:e.params);const i=h(t),l=await n(this,o,"f").request("post",t.type,i,Object.assign(Object.assign({},e),{params:r}));return u(l)}async update(t,s,e){c("update: %o, %O, %O",t,s||{},e||{});const r=d(s,t);(e==null?void 0:e.params)&&Object.assign(r,e==null?void 0:e.params);const i=h(t),l=await n(this,o,"f").request("patch",`${t.type}/${t.id}`,i,Object.assign(Object.assign({},e),{params:r}));return u(l)}async delete(t,s){c("delete: %o, %O",t,s||{}),await n(this,o,"f").request("delete",`${t.type}/${t.id}`,void 0,s)}}o=new WeakMap,g=new WeakMap;class P{constructor(t){c("new resource instance: %s",this.type()),this.resources=t}}export default j;export{P as ApiResource}; \ No newline at end of file diff --git a/lib/esm/resources/addresses.d.ts b/lib/esm/resources/addresses.d.ts new file mode 100644 index 00000000..f07bb887 --- /dev/null +++ b/lib/esm/resources/addresses.d.ts @@ -0,0 +1,87 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Geocoder } from './geocoders'; +declare type AddressRel = ResourceId & { + type: typeof Addresses.TYPE; +}; +declare type GeocoderRel = ResourceId & { + type: 'geocoders'; +}; +interface Address extends Resource { + business?: boolean; + first_name?: string; + last_name?: string; + company?: string; + full_name?: string; + line_1?: string; + line_2?: string; + city?: string; + zip_code?: string; + state_code?: string; + country_code?: string; + phone?: string; + full_address?: string; + name?: string; + email?: string; + notes?: string; + lat?: number; + lng?: number; + is_localized?: boolean; + is_geocoded?: boolean; + provider_name?: string; + map_url?: string; + static_map_url?: string; + billing_info?: string; + geocoder?: Geocoder; +} +interface AddressCreate extends ResourceCreate { + business?: boolean; + first_name?: string; + last_name?: string; + company?: string; + line_1: string; + line_2?: string; + city: string; + zip_code?: string; + state_code: string; + country_code: string; + phone: string; + email?: string; + notes?: string; + lat?: number; + lng?: number; + billing_info?: string; + geocoder?: GeocoderRel; +} +interface AddressUpdate extends ResourceUpdate { + business?: boolean; + first_name?: string; + last_name?: string; + company?: string; + line_1?: string; + line_2?: string; + city?: string; + zip_code?: string; + state_code?: string; + country_code?: string; + phone?: string; + email?: string; + notes?: string; + lat?: number; + lng?: number; + billing_info?: string; + geocoder?: GeocoderRel; +} +declare class Addresses extends ApiResource { + static readonly TYPE: 'addresses'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise
; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise
; + update(resource: AddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise
; + delete(id: string, options?: ResourcesConfig): Promise; + isAddress(resource: any): resource is Address; + relationship(id: string | ResourceId): AddressRel; + type(): string; +} +export default Addresses; +export { Address, AddressCreate, AddressUpdate }; diff --git a/lib/esm/resources/addresses.js b/lib/esm/resources/addresses.js new file mode 100644 index 00000000..47a622ee --- /dev/null +++ b/lib/esm/resources/addresses.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isAddress(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="addresses";export default s; \ No newline at end of file diff --git a/lib/esm/resources/adjustments.d.ts b/lib/esm/resources/adjustments.d.ts new file mode 100644 index 00000000..2bbee20c --- /dev/null +++ b/lib/esm/resources/adjustments.d.ts @@ -0,0 +1,35 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +declare type AdjustmentRel = ResourceId & { + type: typeof Adjustments.TYPE; +}; +interface Adjustment extends Resource { + name?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; +} +interface AdjustmentCreate extends ResourceCreate { + name: string; + currency_code: string; + amount_cents: number; +} +interface AdjustmentUpdate extends ResourceUpdate { + name?: string; + currency_code?: string; + amount_cents?: number; +} +declare class Adjustments extends ApiResource { + static readonly TYPE: 'adjustments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AdjustmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AdjustmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAdjustment(resource: any): resource is Adjustment; + relationship(id: string | ResourceId): AdjustmentRel; + type(): string; +} +export default Adjustments; +export { Adjustment, AdjustmentCreate, AdjustmentUpdate }; diff --git a/lib/esm/resources/adjustments.js b/lib/esm/resources/adjustments.js new file mode 100644 index 00000000..1723d0d3 --- /dev/null +++ b/lib/esm/resources/adjustments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isAdjustment(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="adjustments";export default t; \ No newline at end of file diff --git a/lib/esm/resources/adyen_gateways.d.ts b/lib/esm/resources/adyen_gateways.d.ts new file mode 100644 index 00000000..ebb41cef --- /dev/null +++ b/lib/esm/resources/adyen_gateways.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { AdyenPayment } from './adyen_payments'; +declare type AdyenGatewayRel = ResourceId & { + type: typeof AdyenGateways.TYPE; +}; +declare type AdyenPaymentRel = ResourceId & { + type: 'adyen_payments'; +}; +interface AdyenGateway extends Resource { + name?: string; + live_url_prefix?: string; + payment_methods?: PaymentMethod[]; + adyen_payments?: AdyenPayment[]; +} +interface AdyenGatewayCreate extends ResourceCreate { + name: string; + merchant_account: string; + api_key: string; + public_key?: string; + live_url_prefix: string; + adyen_payments?: AdyenPaymentRel[]; +} +interface AdyenGatewayUpdate extends ResourceUpdate { + name?: string; + merchant_account?: string; + api_key?: string; + public_key?: string; + live_url_prefix?: string; + adyen_payments?: AdyenPaymentRel[]; +} +declare class AdyenGateways extends ApiResource { + static readonly TYPE: 'adyen_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AdyenGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AdyenGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAdyenGateway(resource: any): resource is AdyenGateway; + relationship(id: string | ResourceId): AdyenGatewayRel; + type(): string; +} +export default AdyenGateways; +export { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate }; diff --git a/lib/esm/resources/adyen_gateways.js b/lib/esm/resources/adyen_gateways.js new file mode 100644 index 00000000..3388f96a --- /dev/null +++ b/lib/esm/resources/adyen_gateways.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isAdyenGateway(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="adyen_gateways";export default s; \ No newline at end of file diff --git a/lib/esm/resources/adyen_payments.d.ts b/lib/esm/resources/adyen_payments.d.ts new file mode 100644 index 00000000..94c49d2c --- /dev/null +++ b/lib/esm/resources/adyen_payments.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type AdyenPaymentRel = ResourceId & { + type: typeof AdyenPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface AdyenPayment extends Resource { + public_key?: string; + payment_methods?: object; + payment_request_data?: object; + payment_request_details?: object; + payment_response?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface AdyenPaymentCreate extends ResourceCreate { + order: OrderRel; +} +interface AdyenPaymentUpdate extends ResourceUpdate { + payment_request_data?: object; + payment_request_details?: object; + payment_response?: object; + _details?: boolean; + order?: OrderRel; +} +declare class AdyenPayments extends ApiResource { + static readonly TYPE: 'adyen_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AdyenPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AdyenPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAdyenPayment(resource: any): resource is AdyenPayment; + relationship(id: string | ResourceId): AdyenPaymentRel; + type(): string; +} +export default AdyenPayments; +export { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate }; diff --git a/lib/esm/resources/adyen_payments.js b/lib/esm/resources/adyen_payments.js new file mode 100644 index 00000000..b61b854e --- /dev/null +++ b/lib/esm/resources/adyen_payments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isAdyenPayment(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="adyen_payments";export default s; \ No newline at end of file diff --git a/lib/esm/resources/application.d.ts b/lib/esm/resources/application.d.ts new file mode 100644 index 00000000..814876eb --- /dev/null +++ b/lib/esm/resources/application.d.ts @@ -0,0 +1,21 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsRetrieve } from '../query'; +declare type ApplicationRel = ResourceId & { + type: typeof Applications.TYPE; +}; +interface Application extends Resource { + name?: string; + kind?: string; + public_access?: string; + redirect_uri?: string; + scopes?: string; +} +declare class Applications extends ApiResource { + static readonly TYPE: 'application'; + retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isApplication(resource: any): resource is Application; + relationship(id: string | ResourceId): ApplicationRel; + type(): string; +} +export default Applications; +export { Application }; diff --git a/lib/esm/resources/application.js b/lib/esm/resources/application.js new file mode 100644 index 00000000..23761bf0 --- /dev/null +++ b/lib/esm/resources/application.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async retrieve(e,t){return this.resources.singleton({type:r.TYPE},e,t)}isApplication(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="application";export default r; \ No newline at end of file diff --git a/lib/esm/resources/attachments.d.ts b/lib/esm/resources/attachments.d.ts new file mode 100644 index 00000000..894fd4b5 --- /dev/null +++ b/lib/esm/resources/attachments.d.ts @@ -0,0 +1,156 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Bundle } from './bundles'; +import { CarrierAccount } from './carrier_accounts'; +import { CustomerGroup } from './customer_groups'; +import { Customer } from './customers'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { Geocoder } from './geocoders'; +import { GiftCardRecipient } from './gift_card_recipients'; +import { GiftCard } from './gift_cards'; +import { InventoryModel } from './inventory_models'; +import { Market } from './markets'; +import { Merchant } from './merchants'; +import { BillingInfoValidationRule } from './billing_info_validation_rules'; +import { Order } from './orders'; +import { Package } from './packages'; +import { Parcel } from './parcels'; +import { PaymentMethod } from './payment_methods'; +import { PriceList } from './price_lists'; +import { Price } from './prices'; +import { Promotion } from './promotions'; +import { Return } from './returns'; +import { Shipment } from './shipments'; +import { ShippingCategory } from './shipping_categories'; +import { ShippingMethod } from './shipping_methods'; +import { ShippingZone } from './shipping_zones'; +import { SkuOption } from './sku_options'; +import { Sku } from './skus'; +import { StockItem } from './stock_items'; +import { StockLocation } from './stock_locations'; +import { TaxCalculator } from './tax_calculators'; +import { TaxCategory } from './tax_categories'; +declare type AttachmentRel = ResourceId & { + type: typeof Attachments.TYPE; +}; +declare type BundleRel = ResourceId & { + type: 'bundles'; +}; +declare type CarrierAccountRel = ResourceId & { + type: 'carrier_accounts'; +}; +declare type CustomerGroupRel = ResourceId & { + type: 'customer_groups'; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type DeliveryLeadTimeRel = ResourceId & { + type: 'delivery_lead_times'; +}; +declare type GeocoderRel = ResourceId & { + type: 'geocoders'; +}; +declare type GiftCardRecipientRel = ResourceId & { + type: 'gift_card_recipients'; +}; +declare type GiftCardRel = ResourceId & { + type: 'gift_cards'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type MerchantRel = ResourceId & { + type: 'merchants'; +}; +declare type BillingInfoValidationRuleRel = ResourceId & { + type: 'billing_info_validation_rules'; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +declare type PackageRel = ResourceId & { + type: 'packages'; +}; +declare type ParcelRel = ResourceId & { + type: 'parcels'; +}; +declare type PaymentMethodRel = ResourceId & { + type: 'payment_methods'; +}; +declare type PriceListRel = ResourceId & { + type: 'price_lists'; +}; +declare type PriceRel = ResourceId & { + type: 'prices'; +}; +declare type PromotionRel = ResourceId & { + type: 'promotions'; +}; +declare type ReturnRel = ResourceId & { + type: 'returns'; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type ShippingCategoryRel = ResourceId & { + type: 'shipping_categories'; +}; +declare type ShippingMethodRel = ResourceId & { + type: 'shipping_methods'; +}; +declare type ShippingZoneRel = ResourceId & { + type: 'shipping_zones'; +}; +declare type SkuOptionRel = ResourceId & { + type: 'sku_options'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +declare type StockItemRel = ResourceId & { + type: 'stock_items'; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type TaxCalculatorRel = ResourceId & { + type: 'tax_calculators'; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface Attachment extends Resource { + name?: string; + description?: string; + url?: string; + attachable?: Bundle | CarrierAccount | CustomerGroup | Customer | DeliveryLeadTime | Geocoder | GiftCardRecipient | GiftCard | InventoryModel | Market | Merchant | BillingInfoValidationRule | Order | Package | Parcel | PaymentMethod | PriceList | Price | Promotion | Return | Shipment | ShippingCategory | ShippingMethod | ShippingZone | SkuOption | Sku | StockItem | StockLocation | TaxCalculator | TaxCategory; +} +interface AttachmentCreate extends ResourceCreate { + name: string; + description?: string; + url?: string; + attachable: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | TaxCalculatorRel | TaxCategoryRel; +} +interface AttachmentUpdate extends ResourceUpdate { + name?: string; + description?: string; + url?: string; + attachable?: BundleRel | CarrierAccountRel | CustomerGroupRel | CustomerRel | DeliveryLeadTimeRel | GeocoderRel | GiftCardRecipientRel | GiftCardRel | InventoryModelRel | MarketRel | MerchantRel | BillingInfoValidationRuleRel | OrderRel | PackageRel | ParcelRel | PaymentMethodRel | PriceListRel | PriceRel | PromotionRel | ReturnRel | ShipmentRel | ShippingCategoryRel | ShippingMethodRel | ShippingZoneRel | SkuOptionRel | SkuRel | StockItemRel | StockLocationRel | TaxCalculatorRel | TaxCategoryRel; +} +declare class Attachments extends ApiResource { + static readonly TYPE: 'attachments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AttachmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AttachmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAttachment(resource: any): resource is Attachment; + relationship(id: string | ResourceId): AttachmentRel; + type(): string; +} +export default Attachments; +export { Attachment, AttachmentCreate, AttachmentUpdate }; diff --git a/lib/esm/resources/attachments.js b/lib/esm/resources/attachments.js new file mode 100644 index 00000000..f47ac05d --- /dev/null +++ b/lib/esm/resources/attachments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isAttachment(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="attachments";export default t; \ No newline at end of file diff --git a/lib/esm/resources/authorizations.d.ts b/lib/esm/resources/authorizations.d.ts new file mode 100644 index 00000000..bb7ab435 --- /dev/null +++ b/lib/esm/resources/authorizations.d.ts @@ -0,0 +1,54 @@ +import { ApiResource, Resource, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Capture } from './captures'; +import { Void } from './voids'; +declare type AuthorizationRel = ResourceId & { + type: typeof Authorizations.TYPE; +}; +interface Authorization extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + cvv_code?: string; + cvv_message?: string; + avs_code?: string; + avs_message?: string; + fraud_review?: string; + capture_amount_cents?: number; + capture_amount_float?: number; + formatted_capture_amount?: string; + capture_balance_cents?: number; + capture_balance_float?: number; + formatted_capture_balance?: string; + void_balance_cents?: number; + void_balance_float?: number; + formatted_void_balance?: string; + order?: Order; + captures?: Capture[]; + voids?: Void[]; +} +interface AuthorizationUpdate extends ResourceUpdate { + _capture?: boolean; + _capture_amount_cents?: number; + _void?: boolean; +} +declare class Authorizations extends ApiResource { + static readonly TYPE: 'authorizations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AuthorizationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isAuthorization(resource: any): resource is Authorization; + relationship(id: string | ResourceId): AuthorizationRel; + type(): string; +} +export default Authorizations; +export { Authorization, AuthorizationUpdate }; diff --git a/lib/esm/resources/authorizations.js b/lib/esm/resources/authorizations.js new file mode 100644 index 00000000..3c481c45 --- /dev/null +++ b/lib/esm/resources/authorizations.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}isAuthorization(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="authorizations";export default r; \ No newline at end of file diff --git a/lib/esm/resources/avalara_accounts.d.ts b/lib/esm/resources/avalara_accounts.d.ts new file mode 100644 index 00000000..1f6debf7 --- /dev/null +++ b/lib/esm/resources/avalara_accounts.d.ts @@ -0,0 +1,49 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type AvalaraAccountRel = ResourceId & { + type: typeof AvalaraAccounts.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface AvalaraAccount extends Resource { + name?: string; + username?: string; + company_code?: string; + ddp?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface AvalaraAccountCreate extends ResourceCreate { + name: string; + username: string; + password: string; + company_code: string; + ddp?: string; + tax_categories?: TaxCategoryRel[]; +} +interface AvalaraAccountUpdate extends ResourceUpdate { + name?: string; + username?: string; + password?: string; + company_code?: string; + ddp?: string; + tax_categories?: TaxCategoryRel[]; +} +declare class AvalaraAccounts extends ApiResource { + static readonly TYPE: 'avalara_accounts'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: AvalaraAccountCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: AvalaraAccountUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isAvalaraAccount(resource: any): resource is AvalaraAccount; + relationship(id: string | ResourceId): AvalaraAccountRel; + type(): string; +} +export default AvalaraAccounts; +export { AvalaraAccount, AvalaraAccountCreate, AvalaraAccountUpdate }; diff --git a/lib/esm/resources/avalara_accounts.js b/lib/esm/resources/avalara_accounts.js new file mode 100644 index 00000000..d8941a26 --- /dev/null +++ b/lib/esm/resources/avalara_accounts.js @@ -0,0 +1 @@ +import{ApiResource as a}from"../resource";class s extends a{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isAvalaraAccount(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="avalara_accounts";export default s; \ No newline at end of file diff --git a/lib/esm/resources/billing_info_validation_rules.d.ts b/lib/esm/resources/billing_info_validation_rules.d.ts new file mode 100644 index 00000000..2c3410e0 --- /dev/null +++ b/lib/esm/resources/billing_info_validation_rules.d.ts @@ -0,0 +1,31 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +declare type BillingInfoValidationRuleRel = ResourceId & { + type: typeof BillingInfoValidationRules.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +interface BillingInfoValidationRule extends Resource { + market?: Market; +} +interface BillingInfoValidationRuleCreate extends ResourceCreate { + market: MarketRel; +} +interface BillingInfoValidationRuleUpdate extends ResourceUpdate { + market?: MarketRel; +} +declare class BillingInfoValidationRules extends ApiResource { + static readonly TYPE: 'billing_info_validation_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BillingInfoValidationRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BillingInfoValidationRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBillingInfoValidationRule(resource: any): resource is BillingInfoValidationRule; + relationship(id: string | ResourceId): BillingInfoValidationRuleRel; + type(): string; +} +export default BillingInfoValidationRules; +export { BillingInfoValidationRule, BillingInfoValidationRuleCreate, BillingInfoValidationRuleUpdate }; diff --git a/lib/esm/resources/billing_info_validation_rules.js b/lib/esm/resources/billing_info_validation_rules.js new file mode 100644 index 00000000..56d2950d --- /dev/null +++ b/lib/esm/resources/billing_info_validation_rules.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isBillingInfoValidationRule(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="billing_info_validation_rules";export default s; \ No newline at end of file diff --git a/lib/esm/resources/bing_geocoders.d.ts b/lib/esm/resources/bing_geocoders.d.ts new file mode 100644 index 00000000..cf0c71f5 --- /dev/null +++ b/lib/esm/resources/bing_geocoders.d.ts @@ -0,0 +1,33 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type BingGeocoderRel = ResourceId & { + type: typeof BingGeocoders.TYPE; +}; +interface BingGeocoder extends Resource { + name?: string; + addresses?: Address[]; + attachments?: Attachment[]; +} +interface BingGeocoderCreate extends ResourceCreate { + name: string; + key: string; +} +interface BingGeocoderUpdate extends ResourceUpdate { + name?: string; + key?: string; +} +declare class BingGeocoders extends ApiResource { + static readonly TYPE: 'bing_geocoders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BingGeocoderCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BingGeocoderUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBingGeocoder(resource: any): resource is BingGeocoder; + relationship(id: string | ResourceId): BingGeocoderRel; + type(): string; +} +export default BingGeocoders; +export { BingGeocoder, BingGeocoderCreate, BingGeocoderUpdate }; diff --git a/lib/esm/resources/bing_geocoders.js b/lib/esm/resources/bing_geocoders.js new file mode 100644 index 00000000..99b2ab65 --- /dev/null +++ b/lib/esm/resources/bing_geocoders.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isBingGeocoder(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="bing_geocoders";export default t; \ No newline at end of file diff --git a/lib/esm/resources/braintree_gateways.d.ts b/lib/esm/resources/braintree_gateways.d.ts new file mode 100644 index 00000000..e63ed61e --- /dev/null +++ b/lib/esm/resources/braintree_gateways.d.ts @@ -0,0 +1,54 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { BraintreePayment } from './braintree_payments'; +declare type BraintreeGatewayRel = ResourceId & { + type: typeof BraintreeGateways.TYPE; +}; +declare type BraintreePaymentRel = ResourceId & { + type: 'braintree_payments'; +}; +interface BraintreeGateway extends Resource { + name?: string; + descriptor_name?: string; + descriptor_phone?: string; + descriptor_url?: string; + webhook_endpoint_url?: string; + payment_methods?: PaymentMethod[]; + braintree_payments?: BraintreePayment[]; +} +interface BraintreeGatewayCreate extends ResourceCreate { + name: string; + merchant_account_id: string; + merchant_id: string; + public_key: string; + private_key: string; + descriptor_name?: string; + descriptor_phone?: string; + descriptor_url?: string; + braintree_payments?: BraintreePaymentRel[]; +} +interface BraintreeGatewayUpdate extends ResourceUpdate { + name?: string; + merchant_account_id?: string; + merchant_id?: string; + public_key?: string; + private_key?: string; + descriptor_name?: string; + descriptor_phone?: string; + descriptor_url?: string; + braintree_payments?: BraintreePaymentRel[]; +} +declare class BraintreeGateways extends ApiResource { + static readonly TYPE: 'braintree_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BraintreeGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BraintreeGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBraintreeGateway(resource: any): resource is BraintreeGateway; + relationship(id: string | ResourceId): BraintreeGatewayRel; + type(): string; +} +export default BraintreeGateways; +export { BraintreeGateway, BraintreeGatewayCreate, BraintreeGatewayUpdate }; diff --git a/lib/esm/resources/braintree_gateways.js b/lib/esm/resources/braintree_gateways.js new file mode 100644 index 00000000..f231d50b --- /dev/null +++ b/lib/esm/resources/braintree_gateways.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isBraintreeGateway(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="braintree_gateways";export default r; \ No newline at end of file diff --git a/lib/esm/resources/braintree_payments.d.ts b/lib/esm/resources/braintree_payments.d.ts new file mode 100644 index 00000000..f527a12d --- /dev/null +++ b/lib/esm/resources/braintree_payments.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type BraintreePaymentRel = ResourceId & { + type: typeof BraintreePayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface BraintreePayment extends Resource { + client_token?: string; + payment_method_nonce?: string; + payment_id?: string; + local?: boolean; + options?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface BraintreePaymentCreate extends ResourceCreate { + payment_id?: string; + local?: boolean; + options?: object; + order: OrderRel; +} +interface BraintreePaymentUpdate extends ResourceUpdate { + payment_method_nonce?: string; + payment_id?: string; + local?: boolean; + options?: object; + order?: OrderRel; +} +declare class BraintreePayments extends ApiResource { + static readonly TYPE: 'braintree_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BraintreePaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BraintreePaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBraintreePayment(resource: any): resource is BraintreePayment; + relationship(id: string | ResourceId): BraintreePaymentRel; + type(): string; +} +export default BraintreePayments; +export { BraintreePayment, BraintreePaymentCreate, BraintreePaymentUpdate }; diff --git a/lib/esm/resources/braintree_payments.js b/lib/esm/resources/braintree_payments.js new file mode 100644 index 00000000..d959cd18 --- /dev/null +++ b/lib/esm/resources/braintree_payments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isBraintreePayment(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="braintree_payments";export default r; \ No newline at end of file diff --git a/lib/esm/resources/bundles.d.ts b/lib/esm/resources/bundles.d.ts new file mode 100644 index 00000000..d7badaf5 --- /dev/null +++ b/lib/esm/resources/bundles.d.ts @@ -0,0 +1,65 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type BundleRel = ResourceId & { + type: typeof Bundles.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface Bundle extends Resource { + code?: string; + name?: string; + description?: string; + image_url?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + compare_at_amount_cents?: number; + compare_at_amount_float?: number; + formatted_compare_at_amount?: string; + skus_count?: number; + market?: Market; + sku_list?: SkuList; + skus?: Sku[]; + attachments?: Attachment[]; +} +interface BundleCreate extends ResourceCreate { + code: string; + name: string; + description?: string; + image_url?: string; + price_amount_cents: number; + compare_at_amount_cents: number; + _compute_compare_at_amount?: boolean; + market?: MarketRel; + sku_list: SkuListRel; +} +interface BundleUpdate extends ResourceUpdate { + code?: string; + name?: string; + description?: string; + image_url?: string; + price_amount_cents?: number; + compare_at_amount_cents?: number; + _compute_compare_at_amount?: boolean; +} +declare class Bundles extends ApiResource { + static readonly TYPE: 'bundles'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: BundleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: BundleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isBundle(resource: any): resource is Bundle; + relationship(id: string | ResourceId): BundleRel; + type(): string; +} +export default Bundles; +export { Bundle, BundleCreate, BundleUpdate }; diff --git a/lib/esm/resources/bundles.js b/lib/esm/resources/bundles.js new file mode 100644 index 00000000..6074d83a --- /dev/null +++ b/lib/esm/resources/bundles.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isBundle(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="bundles";export default s; \ No newline at end of file diff --git a/lib/esm/resources/captures.d.ts b/lib/esm/resources/captures.d.ts new file mode 100644 index 00000000..369ab109 --- /dev/null +++ b/lib/esm/resources/captures.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Authorization } from './authorizations'; +import { Refund } from './refunds'; +declare type CaptureRel = ResourceId & { + type: typeof Captures.TYPE; +}; +interface Capture extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + refund_amount_cents?: number; + refund_amount_float?: number; + formatted_refund_amount?: string; + refund_balance_cents?: number; + refund_balance_float?: number; + formatted_refund_balance?: string; + order?: Order; + reference_authorization?: Authorization; + refunds?: Refund[]; +} +interface CaptureUpdate extends ResourceUpdate { + _refund?: boolean; + _refund_amount_cents?: number; +} +declare class Captures extends ApiResource { + static readonly TYPE: 'captures'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CaptureUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isCapture(resource: any): resource is Capture; + relationship(id: string | ResourceId): CaptureRel; + type(): string; +} +export default Captures; +export { Capture, CaptureUpdate }; diff --git a/lib/esm/resources/captures.js b/lib/esm/resources/captures.js new file mode 100644 index 00000000..58a01aae --- /dev/null +++ b/lib/esm/resources/captures.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}isCapture(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="captures";export default r; \ No newline at end of file diff --git a/lib/esm/resources/carrier_accounts.d.ts b/lib/esm/resources/carrier_accounts.d.ts new file mode 100644 index 00000000..6f09fcbd --- /dev/null +++ b/lib/esm/resources/carrier_accounts.d.ts @@ -0,0 +1,24 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type CarrierAccountRel = ResourceId & { + type: typeof CarrierAccounts.TYPE; +}; +interface CarrierAccount extends Resource { + name?: string; + easypost_type?: string; + easypost_id?: string; + market?: Market; + attachments?: Attachment[]; +} +declare class CarrierAccounts extends ApiResource { + static readonly TYPE: 'carrier_accounts'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isCarrierAccount(resource: any): resource is CarrierAccount; + relationship(id: string | ResourceId): CarrierAccountRel; + type(): string; +} +export default CarrierAccounts; +export { CarrierAccount }; diff --git a/lib/esm/resources/carrier_accounts.js b/lib/esm/resources/carrier_accounts.js new file mode 100644 index 00000000..20902ab1 --- /dev/null +++ b/lib/esm/resources/carrier_accounts.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class e extends i{async list(r,t){return this.resources.list({type:e.TYPE},r,t)}async retrieve(r,t,s){return this.resources.retrieve({type:e.TYPE,id:r},t,s)}isCarrierAccount(r){return r.type&&r.type===e.TYPE}relationship(r){return typeof r=="string"?{id:r,type:e.TYPE}:{id:r.id,type:e.TYPE}}type(){return e.TYPE}}e.TYPE="carrier_accounts";export default e; \ No newline at end of file diff --git a/lib/esm/resources/checkout_com_gateways.d.ts b/lib/esm/resources/checkout_com_gateways.d.ts new file mode 100644 index 00000000..a288407a --- /dev/null +++ b/lib/esm/resources/checkout_com_gateways.d.ts @@ -0,0 +1,43 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { CheckoutComPayment } from './checkout_com_payments'; +declare type CheckoutComGatewayRel = ResourceId & { + type: typeof CheckoutComGateways.TYPE; +}; +declare type CheckoutComPaymentRel = ResourceId & { + type: 'checkout_com_payments'; +}; +interface CheckoutComGateway extends Resource { + name?: string; + webhook_endpoint_id?: string; + webhook_endpoint_secret?: string; + webhook_endpoint_url?: string; + payment_methods?: PaymentMethod[]; + checkout_com_payments?: CheckoutComPayment[]; +} +interface CheckoutComGatewayCreate extends ResourceCreate { + name: string; + secret_key: string; + public_key: string; + checkout_com_payments?: CheckoutComPaymentRel[]; +} +interface CheckoutComGatewayUpdate extends ResourceUpdate { + name?: string; + secret_key?: string; + public_key?: string; + checkout_com_payments?: CheckoutComPaymentRel[]; +} +declare class CheckoutComGateways extends ApiResource { + static readonly TYPE: 'checkout_com_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CheckoutComGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CheckoutComGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCheckoutComGateway(resource: any): resource is CheckoutComGateway; + relationship(id: string | ResourceId): CheckoutComGatewayRel; + type(): string; +} +export default CheckoutComGateways; +export { CheckoutComGateway, CheckoutComGatewayCreate, CheckoutComGatewayUpdate }; diff --git a/lib/esm/resources/checkout_com_gateways.js b/lib/esm/resources/checkout_com_gateways.js new file mode 100644 index 00000000..5960c638 --- /dev/null +++ b/lib/esm/resources/checkout_com_gateways.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isCheckoutComGateway(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="checkout_com_gateways";export default t; \ No newline at end of file diff --git a/lib/esm/resources/checkout_com_payments.d.ts b/lib/esm/resources/checkout_com_payments.d.ts new file mode 100644 index 00000000..0d8da1fb --- /dev/null +++ b/lib/esm/resources/checkout_com_payments.d.ts @@ -0,0 +1,48 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type CheckoutComPaymentRel = ResourceId & { + type: typeof CheckoutComPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface CheckoutComPayment extends Resource { + payment_type?: string; + token?: string; + session_id?: string; + source_id?: string; + customer_token?: string; + redirect_uri?: string; + payment_response?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface CheckoutComPaymentCreate extends ResourceCreate { + payment_type: string; + token: string; + session_id?: string; + order: OrderRel; +} +interface CheckoutComPaymentUpdate extends ResourceUpdate { + payment_type?: string; + token?: string; + session_id?: string; + _details?: boolean; + _refresh?: boolean; + order?: OrderRel; +} +declare class CheckoutComPayments extends ApiResource { + static readonly TYPE: 'checkout_com_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CheckoutComPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CheckoutComPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCheckoutComPayment(resource: any): resource is CheckoutComPayment; + relationship(id: string | ResourceId): CheckoutComPaymentRel; + type(): string; +} +export default CheckoutComPayments; +export { CheckoutComPayment, CheckoutComPaymentCreate, CheckoutComPaymentUpdate }; diff --git a/lib/esm/resources/checkout_com_payments.js b/lib/esm/resources/checkout_com_payments.js new file mode 100644 index 00000000..9865c008 --- /dev/null +++ b/lib/esm/resources/checkout_com_payments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isCheckoutComPayment(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="checkout_com_payments";export default t; \ No newline at end of file diff --git a/lib/esm/resources/coupon_codes_promotion_rules.d.ts b/lib/esm/resources/coupon_codes_promotion_rules.d.ts new file mode 100644 index 00000000..c143dbf7 --- /dev/null +++ b/lib/esm/resources/coupon_codes_promotion_rules.d.ts @@ -0,0 +1,58 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +import { Coupon } from './coupons'; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: typeof CouponCodesPromotionRules.TYPE; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeGiftPromotionRel = ResourceId & { + type: 'free_gift_promotions'; +}; +declare type FixedPricePromotionRel = ResourceId & { + type: 'fixed_price_promotions'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +declare type CouponRel = ResourceId & { + type: 'coupons'; +}; +interface CouponCodesPromotionRule extends Resource { + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; + coupons?: Coupon[]; +} +interface CouponCodesPromotionRuleCreate extends ResourceCreate { + promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + coupons?: CouponRel[]; +} +interface CouponCodesPromotionRuleUpdate extends ResourceUpdate { + promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + coupons?: CouponRel[]; +} +declare class CouponCodesPromotionRules extends ApiResource { + static readonly TYPE: 'coupon_codes_promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CouponCodesPromotionRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CouponCodesPromotionRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCouponCodesPromotionRule(resource: any): resource is CouponCodesPromotionRule; + relationship(id: string | ResourceId): CouponCodesPromotionRuleRel; + type(): string; +} +export default CouponCodesPromotionRules; +export { CouponCodesPromotionRule, CouponCodesPromotionRuleCreate, CouponCodesPromotionRuleUpdate }; diff --git a/lib/esm/resources/coupon_codes_promotion_rules.js b/lib/esm/resources/coupon_codes_promotion_rules.js new file mode 100644 index 00000000..5897f185 --- /dev/null +++ b/lib/esm/resources/coupon_codes_promotion_rules.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isCouponCodesPromotionRule(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="coupon_codes_promotion_rules";export default s; \ No newline at end of file diff --git a/lib/esm/resources/coupon_recipients.d.ts b/lib/esm/resources/coupon_recipients.d.ts new file mode 100644 index 00000000..198a2667 --- /dev/null +++ b/lib/esm/resources/coupon_recipients.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Attachment } from './attachments'; +declare type CouponRecipientRel = ResourceId & { + type: typeof CouponRecipients.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +interface CouponRecipient extends Resource { + email?: string; + first_name?: string; + last_name?: string; + customer?: Customer; + attachments?: Attachment[]; +} +interface CouponRecipientCreate extends ResourceCreate { + email: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +interface CouponRecipientUpdate extends ResourceUpdate { + email?: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +declare class CouponRecipients extends ApiResource { + static readonly TYPE: 'coupon_recipients'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CouponRecipientCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CouponRecipientUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCouponRecipient(resource: any): resource is CouponRecipient; + relationship(id: string | ResourceId): CouponRecipientRel; + type(): string; +} +export default CouponRecipients; +export { CouponRecipient, CouponRecipientCreate, CouponRecipientUpdate }; diff --git a/lib/esm/resources/coupon_recipients.js b/lib/esm/resources/coupon_recipients.js new file mode 100644 index 00000000..f23ca277 --- /dev/null +++ b/lib/esm/resources/coupon_recipients.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isCouponRecipient(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="coupon_recipients";export default s; \ No newline at end of file diff --git a/lib/esm/resources/coupons.d.ts b/lib/esm/resources/coupons.d.ts new file mode 100644 index 00000000..5c7013b6 --- /dev/null +++ b/lib/esm/resources/coupons.d.ts @@ -0,0 +1,44 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +declare type CouponRel = ResourceId & { + type: typeof Coupons.TYPE; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface Coupon extends Resource { + code?: string; + customer_single_use?: boolean; + usage_limit?: number; + usage_count?: number; + recipient_email?: string; + promotion_rule?: CouponCodesPromotionRule; +} +interface CouponCreate extends ResourceCreate { + code: string; + customer_single_use?: boolean; + usage_limit: number; + recipient_email?: string; + promotion_rule: CouponCodesPromotionRuleRel; +} +interface CouponUpdate extends ResourceUpdate { + code?: string; + customer_single_use?: boolean; + usage_limit?: number; + recipient_email?: string; + promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class Coupons extends ApiResource { + static readonly TYPE: 'coupons'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CouponCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CouponUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCoupon(resource: any): resource is Coupon; + relationship(id: string | ResourceId): CouponRel; + type(): string; +} +export default Coupons; +export { Coupon, CouponCreate, CouponUpdate }; diff --git a/lib/esm/resources/coupons.js b/lib/esm/resources/coupons.js new file mode 100644 index 00000000..a08594f9 --- /dev/null +++ b/lib/esm/resources/coupons.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isCoupon(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="coupons";export default s; \ No newline at end of file diff --git a/lib/esm/resources/customer_addresses.d.ts b/lib/esm/resources/customer_addresses.d.ts new file mode 100644 index 00000000..5096f13e --- /dev/null +++ b/lib/esm/resources/customer_addresses.d.ts @@ -0,0 +1,39 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Address } from './addresses'; +declare type CustomerAddressRel = ResourceId & { + type: typeof CustomerAddresses.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +interface CustomerAddress extends Resource { + name?: string; + customer?: Customer; + address?: Address; +} +interface CustomerAddressCreate extends ResourceCreate { + customer: CustomerRel; + address: AddressRel; +} +interface CustomerAddressUpdate extends ResourceUpdate { + customer?: CustomerRel; + address?: AddressRel; +} +declare class CustomerAddresses extends ApiResource { + static readonly TYPE: 'customer_addresses'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerAddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerAddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerAddress(resource: any): resource is CustomerAddress; + relationship(id: string | ResourceId): CustomerAddressRel; + type(): string; +} +export default CustomerAddresses; +export { CustomerAddress, CustomerAddressCreate, CustomerAddressUpdate }; diff --git a/lib/esm/resources/customer_addresses.js b/lib/esm/resources/customer_addresses.js new file mode 100644 index 00000000..3e57d21d --- /dev/null +++ b/lib/esm/resources/customer_addresses.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isCustomerAddress(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="customer_addresses";export default s; \ No newline at end of file diff --git a/lib/esm/resources/customer_groups.d.ts b/lib/esm/resources/customer_groups.d.ts new file mode 100644 index 00000000..03faf7b0 --- /dev/null +++ b/lib/esm/resources/customer_groups.d.ts @@ -0,0 +1,33 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type CustomerGroupRel = ResourceId & { + type: typeof CustomerGroups.TYPE; +}; +interface CustomerGroup extends Resource { + name?: string; + customers?: Customer[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface CustomerGroupCreate extends ResourceCreate { + name: string; +} +interface CustomerGroupUpdate extends ResourceUpdate { + name?: string; +} +declare class CustomerGroups extends ApiResource { + static readonly TYPE: 'customer_groups'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerGroupCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerGroupUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerGroup(resource: any): resource is CustomerGroup; + relationship(id: string | ResourceId): CustomerGroupRel; + type(): string; +} +export default CustomerGroups; +export { CustomerGroup, CustomerGroupCreate, CustomerGroupUpdate }; diff --git a/lib/esm/resources/customer_groups.js b/lib/esm/resources/customer_groups.js new file mode 100644 index 00000000..1c7722ae --- /dev/null +++ b/lib/esm/resources/customer_groups.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isCustomerGroup(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="customer_groups";export default s; \ No newline at end of file diff --git a/lib/esm/resources/customer_password_resets.d.ts b/lib/esm/resources/customer_password_resets.d.ts new file mode 100644 index 00000000..4100ab72 --- /dev/null +++ b/lib/esm/resources/customer_password_resets.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +declare type CustomerPasswordResetRel = ResourceId & { + type: typeof CustomerPasswordResets.TYPE; +}; +interface CustomerPasswordReset extends Resource { + customer_email?: string; + reset_password_token?: string; + reset_password_at?: string; + customer?: Customer; +} +interface CustomerPasswordResetCreate extends ResourceCreate { + customer_email: string; +} +interface CustomerPasswordResetUpdate extends ResourceUpdate { + customer_password?: string; + _reset_password_token?: string; +} +declare class CustomerPasswordResets extends ApiResource { + static readonly TYPE: 'customer_password_resets'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerPasswordResetCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerPasswordResetUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerPasswordReset(resource: any): resource is CustomerPasswordReset; + relationship(id: string | ResourceId): CustomerPasswordResetRel; + type(): string; +} +export default CustomerPasswordResets; +export { CustomerPasswordReset, CustomerPasswordResetCreate, CustomerPasswordResetUpdate }; diff --git a/lib/esm/resources/customer_password_resets.js b/lib/esm/resources/customer_password_resets.js new file mode 100644 index 00000000..413fe375 --- /dev/null +++ b/lib/esm/resources/customer_password_resets.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isCustomerPasswordReset(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="customer_password_resets";export default s; \ No newline at end of file diff --git a/lib/esm/resources/customer_payment_sources.d.ts b/lib/esm/resources/customer_payment_sources.d.ts new file mode 100644 index 00000000..d3e1c02a --- /dev/null +++ b/lib/esm/resources/customer_payment_sources.d.ts @@ -0,0 +1,65 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { AdyenPayment } from './adyen_payments'; +import { BraintreePayment } from './braintree_payments'; +import { CheckoutComPayment } from './checkout_com_payments'; +import { ExternalPayment } from './external_payments'; +import { PaypalPayment } from './paypal_payments'; +import { StripePayment } from './stripe_payments'; +import { WireTransfer } from './wire_transfers'; +declare type CustomerPaymentSourceRel = ResourceId & { + type: typeof CustomerPaymentSources.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type AdyenPaymentRel = ResourceId & { + type: 'adyen_payments'; +}; +declare type BraintreePaymentRel = ResourceId & { + type: 'braintree_payments'; +}; +declare type CheckoutComPaymentRel = ResourceId & { + type: 'checkout_com_payments'; +}; +declare type ExternalPaymentRel = ResourceId & { + type: 'external_payments'; +}; +declare type PaypalPaymentRel = ResourceId & { + type: 'paypal_payments'; +}; +declare type StripePaymentRel = ResourceId & { + type: 'stripe_payments'; +}; +declare type WireTransferRel = ResourceId & { + type: 'wire_transfers'; +}; +interface CustomerPaymentSource extends Resource { + name?: string; + customer_token?: string; + payment_source_token?: string; + customer?: Customer; + payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer; +} +interface CustomerPaymentSourceCreate extends ResourceCreate { + customer: CustomerRel; + payment_source: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +interface CustomerPaymentSourceUpdate extends ResourceUpdate { + customer?: CustomerRel; + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +declare class CustomerPaymentSources extends ApiResource { + static readonly TYPE: 'customer_payment_sources'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerPaymentSourceCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerPaymentSourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerPaymentSource(resource: any): resource is CustomerPaymentSource; + relationship(id: string | ResourceId): CustomerPaymentSourceRel; + type(): string; +} +export default CustomerPaymentSources; +export { CustomerPaymentSource, CustomerPaymentSourceCreate, CustomerPaymentSourceUpdate }; diff --git a/lib/esm/resources/customer_payment_sources.js b/lib/esm/resources/customer_payment_sources.js new file mode 100644 index 00000000..5099972f --- /dev/null +++ b/lib/esm/resources/customer_payment_sources.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isCustomerPaymentSource(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="customer_payment_sources";export default s; \ No newline at end of file diff --git a/lib/esm/resources/customer_subscriptions.d.ts b/lib/esm/resources/customer_subscriptions.d.ts new file mode 100644 index 00000000..f13d5fc7 --- /dev/null +++ b/lib/esm/resources/customer_subscriptions.d.ts @@ -0,0 +1,27 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +declare type CustomerSubscriptionRel = ResourceId & { + type: typeof CustomerSubscriptions.TYPE; +}; +interface CustomerSubscription extends Resource { + customer_email?: string; + customer?: Customer; +} +interface CustomerSubscriptionCreate extends ResourceCreate { + customer_email: string; +} +declare type CustomerSubscriptionUpdate = ResourceUpdate; +declare class CustomerSubscriptions extends ApiResource { + static readonly TYPE: 'customer_subscriptions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerSubscriptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomerSubscription(resource: any): resource is CustomerSubscription; + relationship(id: string | ResourceId): CustomerSubscriptionRel; + type(): string; +} +export default CustomerSubscriptions; +export { CustomerSubscription, CustomerSubscriptionCreate, CustomerSubscriptionUpdate }; diff --git a/lib/esm/resources/customer_subscriptions.js b/lib/esm/resources/customer_subscriptions.js new file mode 100644 index 00000000..b60bf84b --- /dev/null +++ b/lib/esm/resources/customer_subscriptions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isCustomerSubscription(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="customer_subscriptions";export default s; \ No newline at end of file diff --git a/lib/esm/resources/customers.d.ts b/lib/esm/resources/customers.d.ts new file mode 100644 index 00000000..9c9f138f --- /dev/null +++ b/lib/esm/resources/customers.d.ts @@ -0,0 +1,52 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { CustomerGroup } from './customer_groups'; +import { CustomerAddress } from './customer_addresses'; +import { CustomerPaymentSource } from './customer_payment_sources'; +import { CustomerSubscription } from './customer_subscriptions'; +import { Order } from './orders'; +import { OrderSubscription } from './order_subscriptions'; +import { Return } from './returns'; +import { Attachment } from './attachments'; +declare type CustomerRel = ResourceId & { + type: typeof Customers.TYPE; +}; +declare type CustomerGroupRel = ResourceId & { + type: 'customer_groups'; +}; +interface Customer extends Resource { + email?: string; + status?: string; + has_password?: boolean; + customer_group?: CustomerGroup; + customer_addresses?: CustomerAddress[]; + customer_payment_sources?: CustomerPaymentSource[]; + customer_subscriptions?: CustomerSubscription[]; + orders?: Order[]; + order_subscriptions?: OrderSubscription[]; + returns?: Return[]; + attachments?: Attachment[]; +} +interface CustomerCreate extends ResourceCreate { + email: string; + password?: string; + customer_group?: CustomerGroupRel; +} +interface CustomerUpdate extends ResourceUpdate { + email?: string; + password?: string; + customer_group?: CustomerGroupRel; +} +declare class Customers extends ApiResource { + static readonly TYPE: 'customers'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: CustomerCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: CustomerUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isCustomer(resource: any): resource is Customer; + relationship(id: string | ResourceId): CustomerRel; + type(): string; +} +export default Customers; +export { Customer, CustomerCreate, CustomerUpdate }; diff --git a/lib/esm/resources/customers.js b/lib/esm/resources/customers.js new file mode 100644 index 00000000..3b58b3d5 --- /dev/null +++ b/lib/esm/resources/customers.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isCustomer(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="customers";export default s; \ No newline at end of file diff --git a/lib/esm/resources/delivery_lead_times.d.ts b/lib/esm/resources/delivery_lead_times.d.ts new file mode 100644 index 00000000..aeb99803 --- /dev/null +++ b/lib/esm/resources/delivery_lead_times.d.ts @@ -0,0 +1,48 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { ShippingMethod } from './shipping_methods'; +import { Attachment } from './attachments'; +declare type DeliveryLeadTimeRel = ResourceId & { + type: typeof DeliveryLeadTimes.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type ShippingMethodRel = ResourceId & { + type: 'shipping_methods'; +}; +interface DeliveryLeadTime extends Resource { + min_hours?: number; + max_hours?: number; + min_days?: number; + max_days?: number; + stock_location?: StockLocation; + shipping_method?: ShippingMethod; + attachments?: Attachment[]; +} +interface DeliveryLeadTimeCreate extends ResourceCreate { + min_hours: number; + max_hours: number; + stock_location: StockLocationRel; + shipping_method: ShippingMethodRel; +} +interface DeliveryLeadTimeUpdate extends ResourceUpdate { + min_hours?: number; + max_hours?: number; + stock_location?: StockLocationRel; + shipping_method?: ShippingMethodRel; +} +declare class DeliveryLeadTimes extends ApiResource { + static readonly TYPE: 'delivery_lead_times'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: DeliveryLeadTimeCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: DeliveryLeadTimeUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isDeliveryLeadTime(resource: any): resource is DeliveryLeadTime; + relationship(id: string | ResourceId): DeliveryLeadTimeRel; + type(): string; +} +export default DeliveryLeadTimes; +export { DeliveryLeadTime, DeliveryLeadTimeCreate, DeliveryLeadTimeUpdate }; diff --git a/lib/esm/resources/delivery_lead_times.js b/lib/esm/resources/delivery_lead_times.js new file mode 100644 index 00000000..4b221c38 --- /dev/null +++ b/lib/esm/resources/delivery_lead_times.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isDeliveryLeadTime(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="delivery_lead_times";export default t; \ No newline at end of file diff --git a/lib/esm/resources/event_callbacks.d.ts b/lib/esm/resources/event_callbacks.d.ts new file mode 100644 index 00000000..7de228c1 --- /dev/null +++ b/lib/esm/resources/event_callbacks.d.ts @@ -0,0 +1,23 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Webhook } from './webhooks'; +declare type EventCallbackRel = ResourceId & { + type: typeof EventCallbacks.TYPE; +}; +interface EventCallback extends Resource { + callback_url?: string; + payload?: object; + response_code?: string; + response_message?: string; + webhook?: Webhook; +} +declare class EventCallbacks extends ApiResource { + static readonly TYPE: 'event_callbacks'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isEventCallback(resource: any): resource is EventCallback; + relationship(id: string | ResourceId): EventCallbackRel; + type(): string; +} +export default EventCallbacks; +export { EventCallback }; diff --git a/lib/esm/resources/event_callbacks.js b/lib/esm/resources/event_callbacks.js new file mode 100644 index 00000000..e6a8bfd0 --- /dev/null +++ b/lib/esm/resources/event_callbacks.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}isEventCallback(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="event_callbacks";export default t; \ No newline at end of file diff --git a/lib/esm/resources/external_gateways.d.ts b/lib/esm/resources/external_gateways.d.ts new file mode 100644 index 00000000..24e87992 --- /dev/null +++ b/lib/esm/resources/external_gateways.d.ts @@ -0,0 +1,44 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { ExternalPayment } from './external_payments'; +declare type ExternalGatewayRel = ResourceId & { + type: typeof ExternalGateways.TYPE; +}; +interface ExternalGateway extends Resource { + name?: string; + shared_secret?: string; + authorize_url?: string; + capture_url?: string; + void_url?: string; + refund_url?: string; + payment_methods?: PaymentMethod[]; + external_payments?: ExternalPayment[]; +} +interface ExternalGatewayCreate extends ResourceCreate { + name: string; + authorize_url?: string; + capture_url?: string; + void_url?: string; + refund_url?: string; +} +interface ExternalGatewayUpdate extends ResourceUpdate { + name?: string; + authorize_url?: string; + capture_url?: string; + void_url?: string; + refund_url?: string; +} +declare class ExternalGateways extends ApiResource { + static readonly TYPE: 'external_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalGateway(resource: any): resource is ExternalGateway; + relationship(id: string | ResourceId): ExternalGatewayRel; + type(): string; +} +export default ExternalGateways; +export { ExternalGateway, ExternalGatewayCreate, ExternalGatewayUpdate }; diff --git a/lib/esm/resources/external_gateways.js b/lib/esm/resources/external_gateways.js new file mode 100644 index 00000000..fd8c1fef --- /dev/null +++ b/lib/esm/resources/external_gateways.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isExternalGateway(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="external_gateways";export default t; \ No newline at end of file diff --git a/lib/esm/resources/external_payments.d.ts b/lib/esm/resources/external_payments.d.ts new file mode 100644 index 00000000..9d6345e1 --- /dev/null +++ b/lib/esm/resources/external_payments.d.ts @@ -0,0 +1,38 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type ExternalPaymentRel = ResourceId & { + type: typeof ExternalPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface ExternalPayment extends Resource { + payment_source_token?: string; + options?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface ExternalPaymentCreate extends ResourceCreate { + payment_source_token: string; + options?: object; + order: OrderRel; +} +interface ExternalPaymentUpdate extends ResourceUpdate { + options?: object; + order?: OrderRel; +} +declare class ExternalPayments extends ApiResource { + static readonly TYPE: 'external_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalPayment(resource: any): resource is ExternalPayment; + relationship(id: string | ResourceId): ExternalPaymentRel; + type(): string; +} +export default ExternalPayments; +export { ExternalPayment, ExternalPaymentCreate, ExternalPaymentUpdate }; diff --git a/lib/esm/resources/external_payments.js b/lib/esm/resources/external_payments.js new file mode 100644 index 00000000..f5d9d201 --- /dev/null +++ b/lib/esm/resources/external_payments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isExternalPayment(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="external_payments";export default t; \ No newline at end of file diff --git a/lib/esm/resources/external_promotions.d.ts b/lib/esm/resources/external_promotions.d.ts new file mode 100644 index 00000000..7295b942 --- /dev/null +++ b/lib/esm/resources/external_promotions.d.ts @@ -0,0 +1,78 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type ExternalPromotionRel = ResourceId & { + type: typeof ExternalPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface ExternalPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + promotion_url?: string; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +interface ExternalPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + promotion_url: string; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +interface ExternalPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + promotion_url?: string; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class ExternalPromotions extends ApiResource { + static readonly TYPE: 'external_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalPromotion(resource: any): resource is ExternalPromotion; + relationship(id: string | ResourceId): ExternalPromotionRel; + type(): string; +} +export default ExternalPromotions; +export { ExternalPromotion, ExternalPromotionCreate, ExternalPromotionUpdate }; diff --git a/lib/esm/resources/external_promotions.js b/lib/esm/resources/external_promotions.js new file mode 100644 index 00000000..ce0d00c9 --- /dev/null +++ b/lib/esm/resources/external_promotions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isExternalPromotion(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="external_promotions";export default r; \ No newline at end of file diff --git a/lib/esm/resources/external_tax_calculators.d.ts b/lib/esm/resources/external_tax_calculators.d.ts new file mode 100644 index 00000000..c0a4d635 --- /dev/null +++ b/lib/esm/resources/external_tax_calculators.d.ts @@ -0,0 +1,41 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type ExternalTaxCalculatorRel = ResourceId & { + type: typeof ExternalTaxCalculators.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface ExternalTaxCalculator extends Resource { + name?: string; + tax_calculator_url?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface ExternalTaxCalculatorCreate extends ResourceCreate { + name: string; + tax_calculator_url: string; + tax_categories?: TaxCategoryRel[]; +} +interface ExternalTaxCalculatorUpdate extends ResourceUpdate { + name?: string; + tax_calculator_url?: string; + tax_categories?: TaxCategoryRel[]; +} +declare class ExternalTaxCalculators extends ApiResource { + static readonly TYPE: 'external_tax_calculators'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ExternalTaxCalculatorCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ExternalTaxCalculatorUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isExternalTaxCalculator(resource: any): resource is ExternalTaxCalculator; + relationship(id: string | ResourceId): ExternalTaxCalculatorRel; + type(): string; +} +export default ExternalTaxCalculators; +export { ExternalTaxCalculator, ExternalTaxCalculatorCreate, ExternalTaxCalculatorUpdate }; diff --git a/lib/esm/resources/external_tax_calculators.js b/lib/esm/resources/external_tax_calculators.js new file mode 100644 index 00000000..839c42a3 --- /dev/null +++ b/lib/esm/resources/external_tax_calculators.js @@ -0,0 +1 @@ +import{ApiResource as a}from"../resource";class t extends a{async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:t.TYPE,id:e},r)}isExternalTaxCalculator(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="external_tax_calculators";export default t; \ No newline at end of file diff --git a/lib/esm/resources/fixed_amount_promotions.d.ts b/lib/esm/resources/fixed_amount_promotions.d.ts new file mode 100644 index 00000000..9435d34d --- /dev/null +++ b/lib/esm/resources/fixed_amount_promotions.d.ts @@ -0,0 +1,80 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type FixedAmountPromotionRel = ResourceId & { + type: typeof FixedAmountPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface FixedAmountPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + fixed_amount_cents?: number; + fixed_amount_float?: number; + formatted_fixed_amount?: string; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +interface FixedAmountPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + fixed_amount_cents: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +interface FixedAmountPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + fixed_amount_cents?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class FixedAmountPromotions extends ApiResource { + static readonly TYPE: 'fixed_amount_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FixedAmountPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FixedAmountPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFixedAmountPromotion(resource: any): resource is FixedAmountPromotion; + relationship(id: string | ResourceId): FixedAmountPromotionRel; + type(): string; +} +export default FixedAmountPromotions; +export { FixedAmountPromotion, FixedAmountPromotionCreate, FixedAmountPromotionUpdate }; diff --git a/lib/esm/resources/fixed_amount_promotions.js b/lib/esm/resources/fixed_amount_promotions.js new file mode 100644 index 00000000..9909f41d --- /dev/null +++ b/lib/esm/resources/fixed_amount_promotions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isFixedAmountPromotion(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="fixed_amount_promotions";export default t; \ No newline at end of file diff --git a/lib/esm/resources/fixed_price_promotions.d.ts b/lib/esm/resources/fixed_price_promotions.d.ts new file mode 100644 index 00000000..1d409110 --- /dev/null +++ b/lib/esm/resources/fixed_price_promotions.d.ts @@ -0,0 +1,89 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type FixedPricePromotionRel = ResourceId & { + type: typeof FixedPricePromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface FixedPricePromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + fixed_amount_cents?: number; + fixed_amount_float?: number; + formatted_fixed_amount?: string; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; + sku_list?: SkuList; + skus?: Sku[]; +} +interface FixedPricePromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + fixed_amount_cents: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list: SkuListRel; +} +interface FixedPricePromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + fixed_amount_cents?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +declare class FixedPricePromotions extends ApiResource { + static readonly TYPE: 'fixed_price_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FixedPricePromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FixedPricePromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFixedPricePromotion(resource: any): resource is FixedPricePromotion; + relationship(id: string | ResourceId): FixedPricePromotionRel; + type(): string; +} +export default FixedPricePromotions; +export { FixedPricePromotion, FixedPricePromotionCreate, FixedPricePromotionUpdate }; diff --git a/lib/esm/resources/fixed_price_promotions.js b/lib/esm/resources/fixed_price_promotions.js new file mode 100644 index 00000000..54189f13 --- /dev/null +++ b/lib/esm/resources/fixed_price_promotions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,s){return this.resources.list({type:r.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:r.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:r.TYPE,id:e},s)}isFixedPricePromotion(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="fixed_price_promotions";export default r; \ No newline at end of file diff --git a/lib/esm/resources/free_gift_promotions.d.ts b/lib/esm/resources/free_gift_promotions.d.ts new file mode 100644 index 00000000..ac88d852 --- /dev/null +++ b/lib/esm/resources/free_gift_promotions.d.ts @@ -0,0 +1,87 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type FreeGiftPromotionRel = ResourceId & { + type: typeof FreeGiftPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface FreeGiftPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + max_quantity?: number; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; + sku_list?: SkuList; + skus?: Sku[]; +} +interface FreeGiftPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + max_quantity?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list: SkuListRel; +} +interface FreeGiftPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + max_quantity?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +declare class FreeGiftPromotions extends ApiResource { + static readonly TYPE: 'free_gift_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FreeGiftPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FreeGiftPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFreeGiftPromotion(resource: any): resource is FreeGiftPromotion; + relationship(id: string | ResourceId): FreeGiftPromotionRel; + type(): string; +} +export default FreeGiftPromotions; +export { FreeGiftPromotion, FreeGiftPromotionCreate, FreeGiftPromotionUpdate }; diff --git a/lib/esm/resources/free_gift_promotions.js b/lib/esm/resources/free_gift_promotions.js new file mode 100644 index 00000000..85def3e6 --- /dev/null +++ b/lib/esm/resources/free_gift_promotions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isFreeGiftPromotion(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="free_gift_promotions";export default r; \ No newline at end of file diff --git a/lib/esm/resources/free_shipping_promotions.d.ts b/lib/esm/resources/free_shipping_promotions.d.ts new file mode 100644 index 00000000..6bd8634f --- /dev/null +++ b/lib/esm/resources/free_shipping_promotions.d.ts @@ -0,0 +1,75 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type FreeShippingPromotionRel = ResourceId & { + type: typeof FreeShippingPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +interface FreeShippingPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +interface FreeShippingPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +interface FreeShippingPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; +} +declare class FreeShippingPromotions extends ApiResource { + static readonly TYPE: 'free_shipping_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: FreeShippingPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: FreeShippingPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isFreeShippingPromotion(resource: any): resource is FreeShippingPromotion; + relationship(id: string | ResourceId): FreeShippingPromotionRel; + type(): string; +} +export default FreeShippingPromotions; +export { FreeShippingPromotion, FreeShippingPromotionCreate, FreeShippingPromotionUpdate }; diff --git a/lib/esm/resources/free_shipping_promotions.js b/lib/esm/resources/free_shipping_promotions.js new file mode 100644 index 00000000..ba8afa3a --- /dev/null +++ b/lib/esm/resources/free_shipping_promotions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,s){return this.resources.list({type:r.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:r.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:r.TYPE,id:e},s)}isFreeShippingPromotion(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="free_shipping_promotions";export default r; \ No newline at end of file diff --git a/lib/esm/resources/geocoders.d.ts b/lib/esm/resources/geocoders.d.ts new file mode 100644 index 00000000..5df22263 --- /dev/null +++ b/lib/esm/resources/geocoders.d.ts @@ -0,0 +1,22 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type GeocoderRel = ResourceId & { + type: typeof Geocoders.TYPE; +}; +interface Geocoder extends Resource { + name?: string; + addresses?: Address[]; + attachments?: Attachment[]; +} +declare class Geocoders extends ApiResource { + static readonly TYPE: 'geocoders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isGeocoder(resource: any): resource is Geocoder; + relationship(id: string | ResourceId): GeocoderRel; + type(): string; +} +export default Geocoders; +export { Geocoder }; diff --git a/lib/esm/resources/geocoders.js b/lib/esm/resources/geocoders.js new file mode 100644 index 00000000..141e760c --- /dev/null +++ b/lib/esm/resources/geocoders.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}isGeocoder(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="geocoders";export default r; \ No newline at end of file diff --git a/lib/esm/resources/gift_card_recipients.d.ts b/lib/esm/resources/gift_card_recipients.d.ts new file mode 100644 index 00000000..b7441f07 --- /dev/null +++ b/lib/esm/resources/gift_card_recipients.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Customer } from './customers'; +import { Attachment } from './attachments'; +declare type GiftCardRecipientRel = ResourceId & { + type: typeof GiftCardRecipients.TYPE; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +interface GiftCardRecipient extends Resource { + email?: string; + first_name?: string; + last_name?: string; + customer?: Customer; + attachments?: Attachment[]; +} +interface GiftCardRecipientCreate extends ResourceCreate { + email: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +interface GiftCardRecipientUpdate extends ResourceUpdate { + email?: string; + first_name?: string; + last_name?: string; + customer?: CustomerRel; +} +declare class GiftCardRecipients extends ApiResource { + static readonly TYPE: 'gift_card_recipients'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: GiftCardRecipientCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: GiftCardRecipientUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isGiftCardRecipient(resource: any): resource is GiftCardRecipient; + relationship(id: string | ResourceId): GiftCardRecipientRel; + type(): string; +} +export default GiftCardRecipients; +export { GiftCardRecipient, GiftCardRecipientCreate, GiftCardRecipientUpdate }; diff --git a/lib/esm/resources/gift_card_recipients.js b/lib/esm/resources/gift_card_recipients.js new file mode 100644 index 00000000..3386c34a --- /dev/null +++ b/lib/esm/resources/gift_card_recipients.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:t.TYPE,id:e},r)}isGiftCardRecipient(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="gift_card_recipients";export default t; \ No newline at end of file diff --git a/lib/esm/resources/gift_cards.d.ts b/lib/esm/resources/gift_cards.d.ts new file mode 100644 index 00000000..414c46c0 --- /dev/null +++ b/lib/esm/resources/gift_cards.d.ts @@ -0,0 +1,79 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { GiftCardRecipient } from './gift_card_recipients'; +import { Attachment } from './attachments'; +declare type GiftCardRel = ResourceId & { + type: typeof GiftCards.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type GiftCardRecipientRel = ResourceId & { + type: 'gift_card_recipients'; +}; +interface GiftCard extends Resource { + status?: string; + code?: string; + currency_code?: string; + initial_balance_cents?: number; + initial_balance_float?: number; + formatted_initial_balance?: string; + balance_cents?: number; + balance_float?: number; + formatted_balance?: string; + balance_max_cents?: string; + balance_max_float?: number; + formatted_balance_max?: string; + balance_log?: object[]; + single_use?: boolean; + rechargeable?: boolean; + image_url?: string; + expires_at?: string; + recipient_email?: string; + market?: Market; + gift_card_recipient?: GiftCardRecipient; + attachments?: Attachment[]; +} +interface GiftCardCreate extends ResourceCreate { + code?: string; + currency_code: string; + balance_cents: number; + balance_max_cents?: string; + single_use?: boolean; + rechargeable?: boolean; + image_url?: string; + expires_at?: string; + recipient_email?: string; + market?: MarketRel; + gift_card_recipient?: GiftCardRecipientRel; +} +interface GiftCardUpdate extends ResourceUpdate { + currency_code?: string; + balance_cents?: number; + balance_max_cents?: string; + single_use?: boolean; + rechargeable?: boolean; + image_url?: string; + expires_at?: string; + recipient_email?: string; + _purchase?: boolean; + _activate?: boolean; + _deactivate?: boolean; + _balance_change_cents?: number; + market?: MarketRel; + gift_card_recipient?: GiftCardRecipientRel; +} +declare class GiftCards extends ApiResource { + static readonly TYPE: 'gift_cards'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: GiftCardCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: GiftCardUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isGiftCard(resource: any): resource is GiftCard; + relationship(id: string | ResourceId): GiftCardRel; + type(): string; +} +export default GiftCards; +export { GiftCard, GiftCardCreate, GiftCardUpdate }; diff --git a/lib/esm/resources/gift_cards.js b/lib/esm/resources/gift_cards.js new file mode 100644 index 00000000..5f152943 --- /dev/null +++ b/lib/esm/resources/gift_cards.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isGiftCard(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="gift_cards";export default s; \ No newline at end of file diff --git a/lib/esm/resources/google_geocoders.d.ts b/lib/esm/resources/google_geocoders.d.ts new file mode 100644 index 00000000..2a8b1649 --- /dev/null +++ b/lib/esm/resources/google_geocoders.d.ts @@ -0,0 +1,33 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type GoogleGeocoderRel = ResourceId & { + type: typeof GoogleGeocoders.TYPE; +}; +interface GoogleGeocoder extends Resource { + name?: string; + addresses?: Address[]; + attachments?: Attachment[]; +} +interface GoogleGeocoderCreate extends ResourceCreate { + name: string; + api_key: string; +} +interface GoogleGeocoderUpdate extends ResourceUpdate { + name?: string; + api_key?: string; +} +declare class GoogleGeocoders extends ApiResource { + static readonly TYPE: 'google_geocoders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: GoogleGeocoderCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: GoogleGeocoderUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isGoogleGeocoder(resource: any): resource is GoogleGeocoder; + relationship(id: string | ResourceId): GoogleGeocoderRel; + type(): string; +} +export default GoogleGeocoders; +export { GoogleGeocoder, GoogleGeocoderCreate, GoogleGeocoderUpdate }; diff --git a/lib/esm/resources/google_geocoders.js b/lib/esm/resources/google_geocoders.js new file mode 100644 index 00000000..b2b27bd6 --- /dev/null +++ b/lib/esm/resources/google_geocoders.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isGoogleGeocoder(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="google_geocoders";export default t; \ No newline at end of file diff --git a/lib/esm/resources/imports.d.ts b/lib/esm/resources/imports.d.ts new file mode 100644 index 00000000..3e95016a --- /dev/null +++ b/lib/esm/resources/imports.d.ts @@ -0,0 +1,40 @@ +import { ApiResource, Resource, ResourceCreate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +declare type ImportRel = ResourceId & { + type: typeof Imports.TYPE; +}; +interface Import extends Resource { + resource_type?: string; + parent_resource_id?: string; + status?: string; + started_at?: string; + completed_at?: string; + interrupted_at?: string; + inputs?: object[]; + inputs_size?: number; + errors_count?: number; + warnings_count?: number; + destroyed_count?: number; + processed_count?: number; + errors_log?: object; + warnings_log?: object; + cleanup_records?: boolean; +} +interface ImportCreate extends ResourceCreate { + resource_type: string; + parent_resource_id?: string; + inputs: object[]; + cleanup_records?: boolean; +} +declare class Imports extends ApiResource { + static readonly TYPE: 'imports'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ImportCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isImport(resource: any): resource is Import; + relationship(id: string | ResourceId): ImportRel; + type(): string; +} +export default Imports; +export { Import, ImportCreate }; diff --git a/lib/esm/resources/imports.js b/lib/esm/resources/imports.js new file mode 100644 index 00000000..1a4b1d00 --- /dev/null +++ b/lib/esm/resources/imports.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isImport(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="imports";export default r; \ No newline at end of file diff --git a/lib/esm/resources/in_stock_subscriptions.d.ts b/lib/esm/resources/in_stock_subscriptions.d.ts new file mode 100644 index 00000000..170a06ca --- /dev/null +++ b/lib/esm/resources/in_stock_subscriptions.d.ts @@ -0,0 +1,56 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Customer } from './customers'; +import { Sku } from './skus'; +declare type InStockSubscriptionRel = ResourceId & { + type: typeof InStockSubscriptions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface InStockSubscription extends Resource { + status?: string; + customer_email?: string; + sku_code?: string; + stock_threshold?: number; + market?: Market; + customer?: Customer; + sku?: Sku; +} +interface InStockSubscriptionCreate extends ResourceCreate { + customer_email?: string; + sku_code?: string; + stock_threshold?: number; + market: MarketRel; + customer: CustomerRel; + sku: SkuRel; +} +interface InStockSubscriptionUpdate extends ResourceUpdate { + sku_code?: string; + stock_threshold?: number; + _activate?: boolean; + _deactivate?: boolean; + market?: MarketRel; + customer?: CustomerRel; + sku?: SkuRel; +} +declare class InStockSubscriptions extends ApiResource { + static readonly TYPE: 'in_stock_subscriptions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InStockSubscriptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InStockSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInStockSubscription(resource: any): resource is InStockSubscription; + relationship(id: string | ResourceId): InStockSubscriptionRel; + type(): string; +} +export default InStockSubscriptions; +export { InStockSubscription, InStockSubscriptionCreate, InStockSubscriptionUpdate }; diff --git a/lib/esm/resources/in_stock_subscriptions.js b/lib/esm/resources/in_stock_subscriptions.js new file mode 100644 index 00000000..d38e5139 --- /dev/null +++ b/lib/esm/resources/in_stock_subscriptions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isInStockSubscription(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="in_stock_subscriptions";export default s; \ No newline at end of file diff --git a/lib/esm/resources/inventory_models.d.ts b/lib/esm/resources/inventory_models.d.ts new file mode 100644 index 00000000..f6051a14 --- /dev/null +++ b/lib/esm/resources/inventory_models.d.ts @@ -0,0 +1,39 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { InventoryStockLocation } from './inventory_stock_locations'; +import { InventoryReturnLocation } from './inventory_return_locations'; +import { Attachment } from './attachments'; +declare type InventoryModelRel = ResourceId & { + type: typeof InventoryModels.TYPE; +}; +interface InventoryModel extends Resource { + name?: string; + strategy?: string; + stock_locations_cutoff?: number; + inventory_stock_locations?: InventoryStockLocation[]; + inventory_return_locations?: InventoryReturnLocation[]; + attachments?: Attachment[]; +} +interface InventoryModelCreate extends ResourceCreate { + name: string; + strategy: string; + stock_locations_cutoff?: number; +} +interface InventoryModelUpdate extends ResourceUpdate { + name?: string; + strategy?: string; + stock_locations_cutoff?: number; +} +declare class InventoryModels extends ApiResource { + static readonly TYPE: 'inventory_models'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InventoryModelCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InventoryModelUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInventoryModel(resource: any): resource is InventoryModel; + relationship(id: string | ResourceId): InventoryModelRel; + type(): string; +} +export default InventoryModels; +export { InventoryModel, InventoryModelCreate, InventoryModelUpdate }; diff --git a/lib/esm/resources/inventory_models.js b/lib/esm/resources/inventory_models.js new file mode 100644 index 00000000..d9364add --- /dev/null +++ b/lib/esm/resources/inventory_models.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isInventoryModel(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="inventory_models";export default s; \ No newline at end of file diff --git a/lib/esm/resources/inventory_return_locations.d.ts b/lib/esm/resources/inventory_return_locations.d.ts new file mode 100644 index 00000000..611e8e26 --- /dev/null +++ b/lib/esm/resources/inventory_return_locations.d.ts @@ -0,0 +1,41 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { InventoryModel } from './inventory_models'; +declare type InventoryReturnLocationRel = ResourceId & { + type: typeof InventoryReturnLocations.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +interface InventoryReturnLocation extends Resource { + priority?: number; + stock_location?: StockLocation; + inventory_model?: InventoryModel; +} +interface InventoryReturnLocationCreate extends ResourceCreate { + priority: number; + stock_location: StockLocationRel; + inventory_model: InventoryModelRel; +} +interface InventoryReturnLocationUpdate extends ResourceUpdate { + priority?: number; + stock_location?: StockLocationRel; + inventory_model?: InventoryModelRel; +} +declare class InventoryReturnLocations extends ApiResource { + static readonly TYPE: 'inventory_return_locations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InventoryReturnLocationCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InventoryReturnLocationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInventoryReturnLocation(resource: any): resource is InventoryReturnLocation; + relationship(id: string | ResourceId): InventoryReturnLocationRel; + type(): string; +} +export default InventoryReturnLocations; +export { InventoryReturnLocation, InventoryReturnLocationCreate, InventoryReturnLocationUpdate }; diff --git a/lib/esm/resources/inventory_return_locations.js b/lib/esm/resources/inventory_return_locations.js new file mode 100644 index 00000000..79b8c65e --- /dev/null +++ b/lib/esm/resources/inventory_return_locations.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:t.TYPE,id:e},r)}isInventoryReturnLocation(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="inventory_return_locations";export default t; \ No newline at end of file diff --git a/lib/esm/resources/inventory_stock_locations.d.ts b/lib/esm/resources/inventory_stock_locations.d.ts new file mode 100644 index 00000000..efbcd90c --- /dev/null +++ b/lib/esm/resources/inventory_stock_locations.d.ts @@ -0,0 +1,44 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { InventoryModel } from './inventory_models'; +declare type InventoryStockLocationRel = ResourceId & { + type: typeof InventoryStockLocations.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +interface InventoryStockLocation extends Resource { + priority?: number; + on_hold?: boolean; + stock_location?: StockLocation; + inventory_model?: InventoryModel; +} +interface InventoryStockLocationCreate extends ResourceCreate { + priority: number; + on_hold?: boolean; + stock_location: StockLocationRel; + inventory_model: InventoryModelRel; +} +interface InventoryStockLocationUpdate extends ResourceUpdate { + priority?: number; + on_hold?: boolean; + stock_location?: StockLocationRel; + inventory_model?: InventoryModelRel; +} +declare class InventoryStockLocations extends ApiResource { + static readonly TYPE: 'inventory_stock_locations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: InventoryStockLocationCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: InventoryStockLocationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isInventoryStockLocation(resource: any): resource is InventoryStockLocation; + relationship(id: string | ResourceId): InventoryStockLocationRel; + type(): string; +} +export default InventoryStockLocations; +export { InventoryStockLocation, InventoryStockLocationCreate, InventoryStockLocationUpdate }; diff --git a/lib/esm/resources/inventory_stock_locations.js b/lib/esm/resources/inventory_stock_locations.js new file mode 100644 index 00000000..c998fa99 --- /dev/null +++ b/lib/esm/resources/inventory_stock_locations.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:t.TYPE,id:e},r)}isInventoryStockLocation(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="inventory_stock_locations";export default t; \ No newline at end of file diff --git a/lib/esm/resources/line_item_options.d.ts b/lib/esm/resources/line_item_options.d.ts new file mode 100644 index 00000000..4ed4fe04 --- /dev/null +++ b/lib/esm/resources/line_item_options.d.ts @@ -0,0 +1,55 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { LineItem } from './line_items'; +import { SkuOption } from './sku_options'; +declare type LineItemOptionRel = ResourceId & { + type: typeof LineItemOptions.TYPE; +}; +declare type LineItemRel = ResourceId & { + type: 'line_items'; +}; +declare type SkuOptionRel = ResourceId & { + type: 'sku_options'; +}; +interface LineItemOption extends Resource { + name?: string; + quantity?: number; + currency_code?: string; + unit_amount_cents?: number; + unit_amount_float?: number; + formatted_unit_amount?: string; + total_amount_cents?: number; + total_amount_float?: number; + formatted_total_amount?: string; + delay_hours?: number; + delay_days?: number; + options?: object; + line_item?: LineItem; + sku_option?: SkuOption; +} +interface LineItemOptionCreate extends ResourceCreate { + name?: string; + quantity: number; + options: object; + line_item: LineItemRel; + sku_option: SkuOptionRel; +} +interface LineItemOptionUpdate extends ResourceUpdate { + name?: string; + quantity?: number; + options?: object; + sku_option?: SkuOptionRel; +} +declare class LineItemOptions extends ApiResource { + static readonly TYPE: 'line_item_options'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: LineItemOptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: LineItemOptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isLineItemOption(resource: any): resource is LineItemOption; + relationship(id: string | ResourceId): LineItemOptionRel; + type(): string; +} +export default LineItemOptions; +export { LineItemOption, LineItemOptionCreate, LineItemOptionUpdate }; diff --git a/lib/esm/resources/line_item_options.js b/lib/esm/resources/line_item_options.js new file mode 100644 index 00000000..31a0d723 --- /dev/null +++ b/lib/esm/resources/line_item_options.js @@ -0,0 +1 @@ +import{ApiResource as r}from"../resource";class t extends r{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,i){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,i)}async retrieve(e,s,i){return this.resources.retrieve({type:t.TYPE,id:e},s,i)}async update(e,s,i){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,i)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isLineItemOption(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="line_item_options";export default t; \ No newline at end of file diff --git a/lib/esm/resources/line_items.d.ts b/lib/esm/resources/line_items.d.ts new file mode 100644 index 00000000..1b6e6b63 --- /dev/null +++ b/lib/esm/resources/line_items.d.ts @@ -0,0 +1,121 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Adjustment } from './adjustments'; +import { Bundle } from './bundles'; +import { ExternalPromotion } from './external_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { GiftCard } from './gift_cards'; +import { PaymentMethod } from './payment_methods'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { Shipment } from './shipments'; +import { Sku } from './skus'; +import { LineItemOption } from './line_item_options'; +import { StockLineItem } from './stock_line_items'; +import { StockTransfer } from './stock_transfers'; +declare type LineItemRel = ResourceId & { + type: typeof LineItems.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +declare type AdjustmentRel = ResourceId & { + type: 'adjustments'; +}; +declare type BundleRel = ResourceId & { + type: 'bundles'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type GiftCardRel = ResourceId & { + type: 'gift_cards'; +}; +declare type PaymentMethodRel = ResourceId & { + type: 'payment_methods'; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface LineItem extends Resource { + sku_code?: string; + bundle_code?: string; + quantity?: number; + currency_code?: string; + unit_amount_cents?: number; + unit_amount_float?: number; + formatted_unit_amount?: string; + options_amount_cents?: number; + options_amount_float?: number; + formatted_options_amount?: string; + discount_cents?: number; + discount_float?: number; + formatted_discount?: string; + total_amount_cents?: number; + total_amount_float?: number; + formatted_total_amount?: string; + tax_amount_cents?: number; + tax_amount_float?: number; + formatted_tax_amount?: string; + name?: string; + image_url?: string; + discount_breakdown?: object; + tax_rate?: number; + tax_breakdown?: object; + item_type?: string; + order?: Order; + item?: Adjustment | Bundle | ExternalPromotion | FixedAmountPromotion | FreeShippingPromotion | GiftCard | PaymentMethod | PercentageDiscountPromotion | Shipment | Sku; + line_item_options?: LineItemOption[]; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_items?: object[]; + stock_line_items?: StockLineItem[]; + stock_transfers?: StockTransfer[]; +} +interface LineItemCreate extends ResourceCreate { + sku_code?: string; + bundle_code?: string; + quantity: number; + _external_price?: boolean; + _update_quantity?: boolean; + unit_amount_cents?: number; + name?: string; + image_url?: string; + item_type?: string; + order: OrderRel; + item?: AdjustmentRel | BundleRel | ExternalPromotionRel | FixedAmountPromotionRel | FreeShippingPromotionRel | GiftCardRel | PaymentMethodRel | PercentageDiscountPromotionRel | ShipmentRel | SkuRel; +} +interface LineItemUpdate extends ResourceUpdate { + sku_code?: string; + bundle_code?: string; + quantity?: number; + name?: string; + image_url?: string; +} +declare class LineItems extends ApiResource { + static readonly TYPE: 'line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: LineItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: LineItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isLineItem(resource: any): resource is LineItem; + relationship(id: string | ResourceId): LineItemRel; + type(): string; +} +export default LineItems; +export { LineItem, LineItemCreate, LineItemUpdate }; diff --git a/lib/esm/resources/line_items.js b/lib/esm/resources/line_items.js new file mode 100644 index 00000000..fc55b5db --- /dev/null +++ b/lib/esm/resources/line_items.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isLineItem(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="line_items";export default s; \ No newline at end of file diff --git a/lib/esm/resources/manual_gateways.d.ts b/lib/esm/resources/manual_gateways.d.ts new file mode 100644 index 00000000..68e2ac6e --- /dev/null +++ b/lib/esm/resources/manual_gateways.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +declare type ManualGatewayRel = ResourceId & { + type: typeof ManualGateways.TYPE; +}; +interface ManualGateway extends Resource { + name?: string; + require_capture?: boolean; + payment_methods?: PaymentMethod[]; +} +interface ManualGatewayCreate extends ResourceCreate { + name: string; + require_capture?: boolean; +} +interface ManualGatewayUpdate extends ResourceUpdate { + name?: string; + require_capture?: boolean; +} +declare class ManualGateways extends ApiResource { + static readonly TYPE: 'manual_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ManualGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ManualGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isManualGateway(resource: any): resource is ManualGateway; + relationship(id: string | ResourceId): ManualGatewayRel; + type(): string; +} +export default ManualGateways; +export { ManualGateway, ManualGatewayCreate, ManualGatewayUpdate }; diff --git a/lib/esm/resources/manual_gateways.js b/lib/esm/resources/manual_gateways.js new file mode 100644 index 00000000..0f0fe2ee --- /dev/null +++ b/lib/esm/resources/manual_gateways.js @@ -0,0 +1 @@ +import{ApiResource as a}from"../resource";class s extends a{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isManualGateway(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="manual_gateways";export default s; \ No newline at end of file diff --git a/lib/esm/resources/manual_tax_calculators.d.ts b/lib/esm/resources/manual_tax_calculators.d.ts new file mode 100644 index 00000000..48fef757 --- /dev/null +++ b/lib/esm/resources/manual_tax_calculators.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +import { TaxRule } from './tax_rules'; +declare type ManualTaxCalculatorRel = ResourceId & { + type: typeof ManualTaxCalculators.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +declare type TaxRuleRel = ResourceId & { + type: 'tax_rules'; +}; +interface ManualTaxCalculator extends Resource { + name?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; + tax_rules?: TaxRule[]; +} +interface ManualTaxCalculatorCreate extends ResourceCreate { + name: string; + tax_categories?: TaxCategoryRel[]; + tax_rules?: TaxRuleRel[]; +} +interface ManualTaxCalculatorUpdate extends ResourceUpdate { + name?: string; + tax_categories?: TaxCategoryRel[]; + tax_rules?: TaxRuleRel[]; +} +declare class ManualTaxCalculators extends ApiResource { + static readonly TYPE: 'manual_tax_calculators'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ManualTaxCalculatorCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ManualTaxCalculatorUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isManualTaxCalculator(resource: any): resource is ManualTaxCalculator; + relationship(id: string | ResourceId): ManualTaxCalculatorRel; + type(): string; +} +export default ManualTaxCalculators; +export { ManualTaxCalculator, ManualTaxCalculatorCreate, ManualTaxCalculatorUpdate }; diff --git a/lib/esm/resources/manual_tax_calculators.js b/lib/esm/resources/manual_tax_calculators.js new file mode 100644 index 00000000..c60408bc --- /dev/null +++ b/lib/esm/resources/manual_tax_calculators.js @@ -0,0 +1 @@ +import{ApiResource as a}from"../resource";class s extends a{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isManualTaxCalculator(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="manual_tax_calculators";export default s; \ No newline at end of file diff --git a/lib/esm/resources/markets.d.ts b/lib/esm/resources/markets.d.ts new file mode 100644 index 00000000..0c70d547 --- /dev/null +++ b/lib/esm/resources/markets.d.ts @@ -0,0 +1,75 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Merchant } from './merchants'; +import { PriceList } from './price_lists'; +import { InventoryModel } from './inventory_models'; +import { TaxCalculator } from './tax_calculators'; +import { CustomerGroup } from './customer_groups'; +import { Attachment } from './attachments'; +declare type MarketRel = ResourceId & { + type: typeof Markets.TYPE; +}; +declare type MerchantRel = ResourceId & { + type: 'merchants'; +}; +declare type PriceListRel = ResourceId & { + type: 'price_lists'; +}; +declare type InventoryModelRel = ResourceId & { + type: 'inventory_models'; +}; +declare type TaxCalculatorRel = ResourceId & { + type: 'tax_calculators'; +}; +declare type CustomerGroupRel = ResourceId & { + type: 'customer_groups'; +}; +interface Market extends Resource { + number?: number; + name?: string; + facebook_pixel_id?: string; + checkout_url?: string; + external_prices_url?: string; + private?: boolean; + merchant?: Merchant; + price_list?: PriceList; + inventory_model?: InventoryModel; + tax_calculator?: TaxCalculator; + customer_group?: CustomerGroup; + attachments?: Attachment[]; +} +interface MarketCreate extends ResourceCreate { + name: string; + facebook_pixel_id?: string; + checkout_url?: string; + external_prices_url?: string; + merchant: MerchantRel; + price_list: PriceListRel; + inventory_model: InventoryModelRel; + tax_calculator?: TaxCalculatorRel; + customer_group?: CustomerGroupRel; +} +interface MarketUpdate extends ResourceUpdate { + name?: string; + facebook_pixel_id?: string; + checkout_url?: string; + external_prices_url?: string; + merchant?: MerchantRel; + price_list?: PriceListRel; + inventory_model?: InventoryModelRel; + tax_calculator?: TaxCalculatorRel; + customer_group?: CustomerGroupRel; +} +declare class Markets extends ApiResource { + static readonly TYPE: 'markets'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: MarketCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: MarketUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isMarket(resource: any): resource is Market; + relationship(id: string | ResourceId): MarketRel; + type(): string; +} +export default Markets; +export { Market, MarketCreate, MarketUpdate }; diff --git a/lib/esm/resources/markets.js b/lib/esm/resources/markets.js new file mode 100644 index 00000000..befe2b17 --- /dev/null +++ b/lib/esm/resources/markets.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isMarket(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="markets";export default s; \ No newline at end of file diff --git a/lib/esm/resources/merchants.d.ts b/lib/esm/resources/merchants.d.ts new file mode 100644 index 00000000..06a9e57d --- /dev/null +++ b/lib/esm/resources/merchants.d.ts @@ -0,0 +1,36 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { Attachment } from './attachments'; +declare type MerchantRel = ResourceId & { + type: typeof Merchants.TYPE; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +interface Merchant extends Resource { + name?: string; + address?: Address; + attachments?: Attachment[]; +} +interface MerchantCreate extends ResourceCreate { + name: string; + address: AddressRel; +} +interface MerchantUpdate extends ResourceUpdate { + name?: string; + address?: AddressRel; +} +declare class Merchants extends ApiResource { + static readonly TYPE: 'merchants'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: MerchantCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: MerchantUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isMerchant(resource: any): resource is Merchant; + relationship(id: string | ResourceId): MerchantRel; + type(): string; +} +export default Merchants; +export { Merchant, MerchantCreate, MerchantUpdate }; diff --git a/lib/esm/resources/merchants.js b/lib/esm/resources/merchants.js new file mode 100644 index 00000000..3474cf7f --- /dev/null +++ b/lib/esm/resources/merchants.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isMerchant(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="merchants";export default s; \ No newline at end of file diff --git a/lib/esm/resources/order_amount_promotion_rules.d.ts b/lib/esm/resources/order_amount_promotion_rules.d.ts new file mode 100644 index 00000000..c2617335 --- /dev/null +++ b/lib/esm/resources/order_amount_promotion_rules.d.ts @@ -0,0 +1,56 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: typeof OrderAmountPromotionRules.TYPE; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeGiftPromotionRel = ResourceId & { + type: 'free_gift_promotions'; +}; +declare type FixedPricePromotionRel = ResourceId & { + type: 'fixed_price_promotions'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +interface OrderAmountPromotionRule extends Resource { + order_amount_cents?: number; + order_amount_float?: number; + formatted_order_amount?: string; + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; +} +interface OrderAmountPromotionRuleCreate extends ResourceCreate { + order_amount_cents?: number; + promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; +} +interface OrderAmountPromotionRuleUpdate extends ResourceUpdate { + order_amount_cents?: number; + promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; +} +declare class OrderAmountPromotionRules extends ApiResource { + static readonly TYPE: 'order_amount_promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderAmountPromotionRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: OrderAmountPromotionRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrderAmountPromotionRule(resource: any): resource is OrderAmountPromotionRule; + relationship(id: string | ResourceId): OrderAmountPromotionRuleRel; + type(): string; +} +export default OrderAmountPromotionRules; +export { OrderAmountPromotionRule, OrderAmountPromotionRuleCreate, OrderAmountPromotionRuleUpdate }; diff --git a/lib/esm/resources/order_amount_promotion_rules.js b/lib/esm/resources/order_amount_promotion_rules.js new file mode 100644 index 00000000..f1206b80 --- /dev/null +++ b/lib/esm/resources/order_amount_promotion_rules.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isOrderAmountPromotionRule(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="order_amount_promotion_rules";export default r; \ No newline at end of file diff --git a/lib/esm/resources/order_copies.d.ts b/lib/esm/resources/order_copies.d.ts new file mode 100644 index 00000000..0f640566 --- /dev/null +++ b/lib/esm/resources/order_copies.d.ts @@ -0,0 +1,42 @@ +import { ApiResource, Resource, ResourceCreate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { OrderSubscription } from './order_subscriptions'; +declare type OrderCopyRel = ResourceId & { + type: typeof OrderCopies.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface OrderCopy extends Resource { + status?: string; + started_at?: string; + completed_at?: string; + failed_at?: string; + place_target_order?: boolean; + cancel_source_order?: boolean; + reuse_wallet?: boolean; + errors_log?: object; + errors_count?: number; + source_order?: Order; + target_order?: Order; + order_subscription?: OrderSubscription; +} +interface OrderCopyCreate extends ResourceCreate { + place_target_order?: boolean; + cancel_source_order?: boolean; + reuse_wallet?: boolean; + source_order: OrderRel; +} +declare class OrderCopies extends ApiResource { + static readonly TYPE: 'order_copies'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderCopyCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrderCopy(resource: any): resource is OrderCopy; + relationship(id: string | ResourceId): OrderCopyRel; + type(): string; +} +export default OrderCopies; +export { OrderCopy, OrderCopyCreate }; diff --git a/lib/esm/resources/order_copies.js b/lib/esm/resources/order_copies.js new file mode 100644 index 00000000..e7acf189 --- /dev/null +++ b/lib/esm/resources/order_copies.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isOrderCopy(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="order_copies";export default r; \ No newline at end of file diff --git a/lib/esm/resources/order_subscriptions.d.ts b/lib/esm/resources/order_subscriptions.d.ts new file mode 100644 index 00000000..fae8cb6a --- /dev/null +++ b/lib/esm/resources/order_subscriptions.d.ts @@ -0,0 +1,62 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Order } from './orders'; +import { Customer } from './customers'; +import { OrderCopy } from './order_copies'; +declare type OrderSubscriptionRel = ResourceId & { + type: typeof OrderSubscriptions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface OrderSubscription extends Resource { + number?: string; + status?: string; + frequency?: string; + activate_by_source_order?: boolean; + customer_email?: string; + starts_at?: string; + expires_at?: string; + next_run_at?: string; + occurrencies?: number; + errors_count?: number; + succeeded_on_last_run?: boolean; + options?: object; + market?: Market; + source_order?: Order; + customer?: Customer; + order_copies?: OrderCopy[]; + orders?: Order[]; +} +interface OrderSubscriptionCreate extends ResourceCreate { + frequency: string; + activate_by_source_order?: boolean; + starts_at?: string; + expires_at?: string; + options?: object; + market?: MarketRel; + source_order: OrderRel; +} +interface OrderSubscriptionUpdate extends ResourceUpdate { + expires_at?: string; + _activate?: boolean; + _deactivate?: boolean; + _cancel?: boolean; +} +declare class OrderSubscriptions extends ApiResource { + static readonly TYPE: 'order_subscriptions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderSubscriptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: OrderSubscriptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrderSubscription(resource: any): resource is OrderSubscription; + relationship(id: string | ResourceId): OrderSubscriptionRel; + type(): string; +} +export default OrderSubscriptions; +export { OrderSubscription, OrderSubscriptionCreate, OrderSubscriptionUpdate }; diff --git a/lib/esm/resources/order_subscriptions.js b/lib/esm/resources/order_subscriptions.js new file mode 100644 index 00000000..9dee49f4 --- /dev/null +++ b/lib/esm/resources/order_subscriptions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,s){return this.resources.list({type:r.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:r.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:r.TYPE,id:e},s)}isOrderSubscription(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="order_subscriptions";export default r; \ No newline at end of file diff --git a/lib/esm/resources/order_validation_rules.d.ts b/lib/esm/resources/order_validation_rules.d.ts new file mode 100644 index 00000000..e2435d6c --- /dev/null +++ b/lib/esm/resources/order_validation_rules.d.ts @@ -0,0 +1,19 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +declare type OrderValidationRuleRel = ResourceId & { + type: typeof OrderValidationRules.TYPE; +}; +interface OrderValidationRule extends Resource { + market?: Market; +} +declare class OrderValidationRules extends ApiResource { + static readonly TYPE: 'order_validation_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isOrderValidationRule(resource: any): resource is OrderValidationRule; + relationship(id: string | ResourceId): OrderValidationRuleRel; + type(): string; +} +export default OrderValidationRules; +export { OrderValidationRule }; diff --git a/lib/esm/resources/order_validation_rules.js b/lib/esm/resources/order_validation_rules.js new file mode 100644 index 00000000..ed02f9fd --- /dev/null +++ b/lib/esm/resources/order_validation_rules.js @@ -0,0 +1 @@ +import{ApiResource as s}from"../resource";class r extends s{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,i){return this.resources.retrieve({type:r.TYPE,id:e},t,i)}isOrderValidationRule(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="order_validation_rules";export default r; \ No newline at end of file diff --git a/lib/esm/resources/orders.d.ts b/lib/esm/resources/orders.d.ts new file mode 100644 index 00000000..07cd947c --- /dev/null +++ b/lib/esm/resources/orders.d.ts @@ -0,0 +1,251 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Customer } from './customers'; +import { Address } from './addresses'; +import { PaymentMethod } from './payment_methods'; +import { CustomerPaymentSource } from './customer_payment_sources'; +import { AdyenPayment } from './adyen_payments'; +import { BraintreePayment } from './braintree_payments'; +import { CheckoutComPayment } from './checkout_com_payments'; +import { ExternalPayment } from './external_payments'; +import { PaypalPayment } from './paypal_payments'; +import { StripePayment } from './stripe_payments'; +import { WireTransfer } from './wire_transfers'; +import { LineItem } from './line_items'; +import { Shipment } from './shipments'; +import { Authorization } from './authorizations'; +import { Void } from './voids'; +import { Capture } from './captures'; +import { Refund } from './refunds'; +import { OrderSubscription } from './order_subscriptions'; +import { OrderCopy } from './order_copies'; +import { Attachment } from './attachments'; +declare type OrderRel = ResourceId & { + type: typeof Orders.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type CustomerRel = ResourceId & { + type: 'customers'; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +declare type PaymentMethodRel = ResourceId & { + type: 'payment_methods'; +}; +declare type AdyenPaymentRel = ResourceId & { + type: 'adyen_payments'; +}; +declare type BraintreePaymentRel = ResourceId & { + type: 'braintree_payments'; +}; +declare type CheckoutComPaymentRel = ResourceId & { + type: 'checkout_com_payments'; +}; +declare type ExternalPaymentRel = ResourceId & { + type: 'external_payments'; +}; +declare type PaypalPaymentRel = ResourceId & { + type: 'paypal_payments'; +}; +declare type StripePaymentRel = ResourceId & { + type: 'stripe_payments'; +}; +declare type WireTransferRel = ResourceId & { + type: 'wire_transfers'; +}; +interface Order extends Resource { + number?: number; + autorefresh?: boolean; + status?: string; + payment_status?: string; + fulfillment_status?: string; + guest?: boolean; + editable?: boolean; + customer_email?: string; + language_code?: string; + currency_code?: string; + tax_included?: boolean; + tax_rate?: number; + freight_taxable?: boolean; + requires_billing_info?: boolean; + country_code?: string; + shipping_country_code_lock?: string; + coupon_code?: string; + gift_card_code?: string; + gift_card_or_coupon_code?: string; + subtotal_amount_cents?: number; + subtotal_amount_float?: number; + formatted_subtotal_amount?: string; + shipping_amount_cents?: number; + shipping_amount_float?: number; + formatted_shipping_amount?: string; + payment_method_amount_cents?: number; + payment_method_amount_float?: number; + formatted_payment_method_amount?: string; + discount_amount_cents?: number; + discount_amount_float?: number; + formatted_discount_amount?: string; + adjustment_amount_cents?: number; + adjustment_amount_float?: number; + formatted_adjustment_amount?: string; + gift_card_amount_cents?: number; + gift_card_amount_float?: number; + formatted_gift_card_amount?: string; + total_tax_amount_cents?: number; + total_tax_amount_float?: number; + formatted_total_tax_amount?: string; + subtotal_tax_amount_cents?: number; + subtotal_tax_amount_float?: number; + formatted_subtotal_tax_amount?: string; + shipping_tax_amount_cents?: number; + shipping_tax_amount_float?: number; + formatted_shipping_tax_amount?: string; + payment_method_tax_amount_cents?: number; + payment_method_tax_amount_float?: number; + formatted_payment_method_tax_amount?: string; + adjustment_tax_amount_cents?: number; + adjustment_tax_amount_float?: number; + formatted_adjustment_tax_amount?: string; + total_amount_cents?: number; + total_amount_float?: number; + formatted_total_amount?: string; + total_taxable_amount_cents?: number; + total_taxable_amount_float?: number; + formatted_total_taxable_amount?: string; + subtotal_taxable_amount_cents?: number; + subtotal_taxable_amount_float?: number; + formatted_subtotal_taxable_amount?: string; + shipping_taxable_amount_cents?: number; + shipping_taxable_amount_float?: number; + formatted_shipping_taxable_amount?: string; + payment_method_taxable_amount_cents?: number; + payment_method_taxable_amount_float?: number; + formatted_payment_method_taxable_amount?: string; + adjustment_taxable_amount_cents?: number; + adjustment_taxable_amount_float?: number; + formatted_adjustment_taxable_amount?: string; + total_amount_with_taxes_cents?: number; + total_amount_with_taxes_float?: number; + formatted_total_amount_with_taxes?: string; + fees_amount_cents?: number; + fees_amount_float?: number; + formatted_fees_amount?: string; + duty_amount_cents?: number; + duty_amount_float?: number; + formatted_duty_amount?: string; + skus_count?: number; + line_item_options_count?: number; + shipments_count?: number; + payment_source_details?: object; + token?: string; + cart_url?: string; + return_url?: string; + terms_url?: string; + privacy_url?: string; + checkout_url?: string; + placed_at?: string; + approved_at?: string; + cancelled_at?: string; + payment_updated_at?: string; + fulfillment_updated_at?: string; + refreshed_at?: string; + archived_at?: string; + expires_at?: string; + market?: Market; + customer?: Customer; + shipping_address?: Address; + billing_address?: Address; + available_payment_methods?: PaymentMethod[]; + available_customer_payment_sources?: CustomerPaymentSource[]; + payment_method?: PaymentMethod; + payment_source?: AdyenPayment | BraintreePayment | CheckoutComPayment | ExternalPayment | PaypalPayment | StripePayment | WireTransfer; + line_items?: LineItem[]; + shipments?: Shipment[]; + transactions?: (Authorization | Void | Capture | Refund)[]; + authorizations?: Authorization[]; + captures?: Capture[]; + voids?: Void[]; + refunds?: Refund[]; + order_subscriptions?: OrderSubscription[]; + order_copies?: OrderCopy[]; + attachments?: Attachment[]; +} +interface OrderCreate extends ResourceCreate { + autorefresh?: boolean; + guest?: boolean; + customer_email?: string; + customer_password?: string; + language_code?: string; + shipping_country_code_lock?: string; + coupon_code?: string; + gift_card_code?: string; + gift_card_or_coupon_code?: string; + cart_url?: string; + return_url?: string; + terms_url?: string; + privacy_url?: string; + market?: MarketRel; + customer?: CustomerRel; + shipping_address?: AddressRel; + billing_address?: AddressRel; + payment_method?: PaymentMethodRel; + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +interface OrderUpdate extends ResourceUpdate { + autorefresh?: boolean; + guest?: boolean; + customer_email?: string; + customer_password?: string; + language_code?: string; + shipping_country_code_lock?: string; + coupon_code?: string; + gift_card_code?: string; + gift_card_or_coupon_code?: string; + cart_url?: string; + return_url?: string; + terms_url?: string; + privacy_url?: string; + _archive?: boolean; + _unarchive?: boolean; + _place?: boolean; + _cancel?: boolean; + _approve?: boolean; + _approve_and_capture?: boolean; + _authorize?: boolean; + _authorization_amount_cents?: number; + _capture?: boolean; + _refund?: boolean; + _update_taxes?: boolean; + _billing_address_clone_id?: string; + _shipping_address_clone_id?: string; + _customer_payment_source_id?: string; + _shipping_address_same_as_billing?: boolean; + _billing_address_same_as_shipping?: boolean; + _save_payment_source_to_customer_wallet?: boolean; + _save_shipping_address_to_customer_address_book?: boolean; + _save_billing_address_to_customer_address_book?: boolean; + _refresh?: boolean; + market?: MarketRel; + customer?: CustomerRel; + shipping_address?: AddressRel; + billing_address?: AddressRel; + payment_method?: PaymentMethodRel; + payment_source?: AdyenPaymentRel | BraintreePaymentRel | CheckoutComPaymentRel | ExternalPaymentRel | PaypalPaymentRel | StripePaymentRel | WireTransferRel; +} +declare class Orders extends ApiResource { + static readonly TYPE: 'orders'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: OrderCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: OrderUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isOrder(resource: any): resource is Order; + relationship(id: string | ResourceId): OrderRel; + type(): string; +} +export default Orders; +export { Order, OrderCreate, OrderUpdate }; diff --git a/lib/esm/resources/orders.js b/lib/esm/resources/orders.js new file mode 100644 index 00000000..2ed77662 --- /dev/null +++ b/lib/esm/resources/orders.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,s){return this.resources.list({type:r.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:r.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:r.TYPE,id:e},s)}isOrder(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="orders";export default r; \ No newline at end of file diff --git a/lib/esm/resources/organization.d.ts b/lib/esm/resources/organization.d.ts new file mode 100644 index 00000000..ee682a71 --- /dev/null +++ b/lib/esm/resources/organization.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsRetrieve } from '../query'; +declare type OrganizationRel = ResourceId & { + type: typeof Organizations.TYPE; +}; +interface Organization extends Resource { + name?: string; + slug?: string; + domain?: string; + support_phone?: string; + support_email?: string; + logo_url?: string; + favicon_url?: string; + primary_color?: string; + contrast_color?: string; + gtm_id?: string; + gtm_id_test?: string; + discount_disabled?: boolean; + account_disabled?: boolean; + acceptance_disabled?: boolean; + max_concurrent_promotions?: number; + max_concurrent_imports?: number; +} +declare class Organizations extends ApiResource { + static readonly TYPE: 'organization'; + retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isOrganization(resource: any): resource is Organization; + relationship(id: string | ResourceId): OrganizationRel; + type(): string; +} +export default Organizations; +export { Organization }; diff --git a/lib/esm/resources/organization.js b/lib/esm/resources/organization.js new file mode 100644 index 00000000..7057cf72 --- /dev/null +++ b/lib/esm/resources/organization.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async retrieve(e,t){return this.resources.singleton({type:r.TYPE},e,t)}isOrganization(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="organization";export default r; \ No newline at end of file diff --git a/lib/esm/resources/packages.d.ts b/lib/esm/resources/packages.d.ts new file mode 100644 index 00000000..c5b6b763 --- /dev/null +++ b/lib/esm/resources/packages.d.ts @@ -0,0 +1,53 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { Parcel } from './parcels'; +import { Attachment } from './attachments'; +declare type PackageRel = ResourceId & { + type: typeof Packages.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +interface Package extends Resource { + name?: string; + code?: string; + length?: number; + width?: number; + height?: number; + unit_of_length?: string; + stock_location?: StockLocation; + parcels?: Parcel[]; + attachments?: Attachment[]; +} +interface PackageCreate extends ResourceCreate { + name: string; + code?: string; + length: number; + width: number; + height: number; + unit_of_length: string; + stock_location: StockLocationRel; +} +interface PackageUpdate extends ResourceUpdate { + name?: string; + code?: string; + length?: number; + width?: number; + height?: number; + unit_of_length?: string; + stock_location?: StockLocationRel; +} +declare class Packages extends ApiResource { + static readonly TYPE: 'packages'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PackageCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PackageUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPackage(resource: any): resource is Package; + relationship(id: string | ResourceId): PackageRel; + type(): string; +} +export default Packages; +export { Package, PackageCreate, PackageUpdate }; diff --git a/lib/esm/resources/packages.js b/lib/esm/resources/packages.js new file mode 100644 index 00000000..b4592189 --- /dev/null +++ b/lib/esm/resources/packages.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isPackage(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="packages";export default s; \ No newline at end of file diff --git a/lib/esm/resources/parcel_line_items.d.ts b/lib/esm/resources/parcel_line_items.d.ts new file mode 100644 index 00000000..1e7dcbc2 --- /dev/null +++ b/lib/esm/resources/parcel_line_items.d.ts @@ -0,0 +1,47 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Parcel } from './parcels'; +import { StockLineItem } from './stock_line_items'; +declare type ParcelLineItemRel = ResourceId & { + type: typeof ParcelLineItems.TYPE; +}; +declare type ParcelRel = ResourceId & { + type: 'parcels'; +}; +declare type StockLineItemRel = ResourceId & { + type: 'stock_line_items'; +}; +interface ParcelLineItem extends Resource { + sku_code?: string; + quantity?: number; + parcel?: Parcel; + stock_line_item?: StockLineItem; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_item?: object; +} +interface ParcelLineItemCreate extends ResourceCreate { + sku_code?: string; + quantity: number; + parcel: ParcelRel; + stock_line_item: StockLineItemRel; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_item?: object; +} +declare type ParcelLineItemUpdate = ResourceUpdate; +declare class ParcelLineItems extends ApiResource { + static readonly TYPE: 'parcel_line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ParcelLineItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ParcelLineItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isParcelLineItem(resource: any): resource is ParcelLineItem; + relationship(id: string | ResourceId): ParcelLineItemRel; + type(): string; +} +export default ParcelLineItems; +export { ParcelLineItem, ParcelLineItemCreate, ParcelLineItemUpdate }; diff --git a/lib/esm/resources/parcel_line_items.js b/lib/esm/resources/parcel_line_items.js new file mode 100644 index 00000000..17ace9bd --- /dev/null +++ b/lib/esm/resources/parcel_line_items.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isParcelLineItem(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="parcel_line_items";export default t; \ No newline at end of file diff --git a/lib/esm/resources/parcels.d.ts b/lib/esm/resources/parcels.d.ts new file mode 100644 index 00000000..dbf29eb8 --- /dev/null +++ b/lib/esm/resources/parcels.d.ts @@ -0,0 +1,104 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Shipment } from './shipments'; +import { Package } from './packages'; +import { ParcelLineItem } from './parcel_line_items'; +import { Attachment } from './attachments'; +declare type ParcelRel = ResourceId & { + type: typeof Parcels.TYPE; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type PackageRel = ResourceId & { + type: 'packages'; +}; +interface Parcel extends Resource { + number?: string; + weight?: number; + unit_of_weight?: string; + eel_pfc?: string; + contents_type?: string; + contents_explanation?: string; + customs_certify?: boolean; + customs_signer?: string; + non_delivery_option?: string; + restriction_type?: string; + restriction_comments?: string; + customs_info_required?: boolean; + shipping_label_url?: string; + shipping_label_file_type?: string; + shipping_label_size?: string; + shipping_label_resolution?: string; + tracking_number?: string; + tracking_status?: string; + tracking_status_detail?: string; + tracking_status_updated_at?: string; + tracking_details?: string; + carrier_weight_oz?: string; + signed_by?: string; + incoterm?: string; + shipment?: Shipment; + package?: Package; + parcel_line_items?: ParcelLineItem[]; + attachments?: Attachment[]; +} +interface ParcelCreate extends ResourceCreate { + weight?: number; + unit_of_weight?: string; + eel_pfc?: string; + contents_type?: string; + contents_explanation?: string; + customs_certify?: boolean; + customs_signer?: string; + non_delivery_option?: string; + restriction_type?: string; + restriction_comments?: string; + customs_info_required?: boolean; + tracking_number?: string; + tracking_status?: string; + tracking_status_detail?: string; + tracking_status_updated_at?: string; + tracking_details?: string; + carrier_weight_oz?: string; + signed_by?: string; + incoterm?: string; + shipment: ShipmentRel; + package: PackageRel; +} +interface ParcelUpdate extends ResourceUpdate { + weight?: number; + unit_of_weight?: string; + eel_pfc?: string; + contents_type?: string; + contents_explanation?: string; + customs_certify?: boolean; + customs_signer?: string; + non_delivery_option?: string; + restriction_type?: string; + restriction_comments?: string; + customs_info_required?: boolean; + tracking_number?: string; + tracking_status?: string; + tracking_status_detail?: string; + tracking_status_updated_at?: string; + tracking_details?: string; + carrier_weight_oz?: string; + signed_by?: string; + incoterm?: string; + shipment?: ShipmentRel; + package?: PackageRel; +} +declare class Parcels extends ApiResource { + static readonly TYPE: 'parcels'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ParcelCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ParcelUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isParcel(resource: any): resource is Parcel; + relationship(id: string | ResourceId): ParcelRel; + type(): string; +} +export default Parcels; +export { Parcel, ParcelCreate, ParcelUpdate }; diff --git a/lib/esm/resources/parcels.js b/lib/esm/resources/parcels.js new file mode 100644 index 00000000..a885af4d --- /dev/null +++ b/lib/esm/resources/parcels.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isParcel(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="parcels";export default s; \ No newline at end of file diff --git a/lib/esm/resources/payment_gateways.d.ts b/lib/esm/resources/payment_gateways.d.ts new file mode 100644 index 00000000..39a40c55 --- /dev/null +++ b/lib/esm/resources/payment_gateways.d.ts @@ -0,0 +1,20 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +declare type PaymentGatewayRel = ResourceId & { + type: typeof PaymentGateways.TYPE; +}; +interface PaymentGateway extends Resource { + name?: string; + payment_methods?: PaymentMethod[]; +} +declare class PaymentGateways extends ApiResource { + static readonly TYPE: 'payment_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isPaymentGateway(resource: any): resource is PaymentGateway; + relationship(id: string | ResourceId): PaymentGatewayRel; + type(): string; +} +export default PaymentGateways; +export { PaymentGateway }; diff --git a/lib/esm/resources/payment_gateways.js b/lib/esm/resources/payment_gateways.js new file mode 100644 index 00000000..37043f0c --- /dev/null +++ b/lib/esm/resources/payment_gateways.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}isPaymentGateway(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="payment_gateways";export default t; \ No newline at end of file diff --git a/lib/esm/resources/payment_methods.d.ts b/lib/esm/resources/payment_methods.d.ts new file mode 100644 index 00000000..8ba4ca35 --- /dev/null +++ b/lib/esm/resources/payment_methods.d.ts @@ -0,0 +1,53 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PaymentGateway } from './payment_gateways'; +import { Attachment } from './attachments'; +declare type PaymentMethodRel = ResourceId & { + type: typeof PaymentMethods.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PaymentGatewayRel = ResourceId & { + type: 'payment_gateways'; +}; +interface PaymentMethod extends Resource { + payment_source_type?: string; + name?: string; + moto?: boolean; + disabled_at?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + market?: Market; + payment_gateway?: PaymentGateway; + attachments?: Attachment[]; +} +interface PaymentMethodCreate extends ResourceCreate { + payment_source_type: string; + moto?: boolean; + price_amount_cents: number; + market: MarketRel; + payment_gateway: PaymentGatewayRel; +} +interface PaymentMethodUpdate extends ResourceUpdate { + payment_source_type?: string; + moto?: boolean; + price_amount_cents?: number; + market?: MarketRel; + payment_gateway?: PaymentGatewayRel; +} +declare class PaymentMethods extends ApiResource { + static readonly TYPE: 'payment_methods'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PaymentMethodCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PaymentMethodUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPaymentMethod(resource: any): resource is PaymentMethod; + relationship(id: string | ResourceId): PaymentMethodRel; + type(): string; +} +export default PaymentMethods; +export { PaymentMethod, PaymentMethodCreate, PaymentMethodUpdate }; diff --git a/lib/esm/resources/payment_methods.js b/lib/esm/resources/payment_methods.js new file mode 100644 index 00000000..e91d1de9 --- /dev/null +++ b/lib/esm/resources/payment_methods.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isPaymentMethod(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="payment_methods";export default t; \ No newline at end of file diff --git a/lib/esm/resources/paypal_gateways.d.ts b/lib/esm/resources/paypal_gateways.d.ts new file mode 100644 index 00000000..0b396fd6 --- /dev/null +++ b/lib/esm/resources/paypal_gateways.d.ts @@ -0,0 +1,37 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { PaypalPayment } from './paypal_payments'; +declare type PaypalGatewayRel = ResourceId & { + type: typeof PaypalGateways.TYPE; +}; +interface PaypalGateway extends Resource { + name?: string; + payment_methods?: PaymentMethod[]; + paypal_payments?: PaypalPayment[]; +} +interface PaypalGatewayCreate extends ResourceCreate { + name: string; + client_id: string; + client_secret: string; + mode: string; +} +interface PaypalGatewayUpdate extends ResourceUpdate { + name?: string; + client_id?: string; + client_secret?: string; + mode?: string; +} +declare class PaypalGateways extends ApiResource { + static readonly TYPE: 'paypal_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PaypalGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PaypalGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPaypalGateway(resource: any): resource is PaypalGateway; + relationship(id: string | ResourceId): PaypalGatewayRel; + type(): string; +} +export default PaypalGateways; +export { PaypalGateway, PaypalGatewayCreate, PaypalGatewayUpdate }; diff --git a/lib/esm/resources/paypal_gateways.js b/lib/esm/resources/paypal_gateways.js new file mode 100644 index 00000000..9bc32870 --- /dev/null +++ b/lib/esm/resources/paypal_gateways.js @@ -0,0 +1 @@ +import{ApiResource as a}from"../resource";class s extends a{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isPaypalGateway(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="paypal_gateways";export default s; \ No newline at end of file diff --git a/lib/esm/resources/paypal_payments.d.ts b/lib/esm/resources/paypal_payments.d.ts new file mode 100644 index 00000000..942cc512 --- /dev/null +++ b/lib/esm/resources/paypal_payments.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type PaypalPaymentRel = ResourceId & { + type: typeof PaypalPayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface PaypalPayment extends Resource { + return_url?: string; + cancel_url?: string; + note_to_payer?: string; + paypal_payer_id?: string; + name?: string; + paypal_id?: string; + status?: string; + approval_url?: string; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface PaypalPaymentCreate extends ResourceCreate { + return_url: string; + cancel_url: string; + note_to_payer?: string; + order: OrderRel; +} +interface PaypalPaymentUpdate extends ResourceUpdate { + paypal_payer_id?: string; + order?: OrderRel; +} +declare class PaypalPayments extends ApiResource { + static readonly TYPE: 'paypal_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PaypalPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PaypalPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPaypalPayment(resource: any): resource is PaypalPayment; + relationship(id: string | ResourceId): PaypalPaymentRel; + type(): string; +} +export default PaypalPayments; +export { PaypalPayment, PaypalPaymentCreate, PaypalPaymentUpdate }; diff --git a/lib/esm/resources/paypal_payments.js b/lib/esm/resources/paypal_payments.js new file mode 100644 index 00000000..daf63165 --- /dev/null +++ b/lib/esm/resources/paypal_payments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isPaypalPayment(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="paypal_payments";export default s; \ No newline at end of file diff --git a/lib/esm/resources/percentage_discount_promotions.d.ts b/lib/esm/resources/percentage_discount_promotions.d.ts new file mode 100644 index 00000000..7500e37f --- /dev/null +++ b/lib/esm/resources/percentage_discount_promotions.d.ts @@ -0,0 +1,87 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: typeof PercentageDiscountPromotions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type PromotionRuleRel = ResourceId & { + type: 'promotion_rules'; +}; +declare type OrderAmountPromotionRuleRel = ResourceId & { + type: 'order_amount_promotion_rules'; +}; +declare type SkuListPromotionRuleRel = ResourceId & { + type: 'sku_list_promotion_rules'; +}; +declare type CouponCodesPromotionRuleRel = ResourceId & { + type: 'coupon_codes_promotion_rules'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface PercentageDiscountPromotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + percentage?: number; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; + sku_list?: SkuList; + skus?: Sku[]; +} +interface PercentageDiscountPromotionCreate extends ResourceCreate { + name: string; + starts_at: string; + expires_at: string; + total_usage_limit: number; + percentage: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +interface PercentageDiscountPromotionUpdate extends ResourceUpdate { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + percentage?: number; + market?: MarketRel; + promotion_rules?: PromotionRuleRel[]; + order_amount_promotion_rule?: OrderAmountPromotionRuleRel; + sku_list_promotion_rule?: SkuListPromotionRuleRel; + coupon_codes_promotion_rule?: CouponCodesPromotionRuleRel; + sku_list?: SkuListRel; +} +declare class PercentageDiscountPromotions extends ApiResource { + static readonly TYPE: 'percentage_discount_promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PercentageDiscountPromotionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PercentageDiscountPromotionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPercentageDiscountPromotion(resource: any): resource is PercentageDiscountPromotion; + relationship(id: string | ResourceId): PercentageDiscountPromotionRel; + type(): string; +} +export default PercentageDiscountPromotions; +export { PercentageDiscountPromotion, PercentageDiscountPromotionCreate, PercentageDiscountPromotionUpdate }; diff --git a/lib/esm/resources/percentage_discount_promotions.js b/lib/esm/resources/percentage_discount_promotions.js new file mode 100644 index 00000000..f936e14a --- /dev/null +++ b/lib/esm/resources/percentage_discount_promotions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isPercentageDiscountPromotion(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="percentage_discount_promotions";export default t; \ No newline at end of file diff --git a/lib/esm/resources/price_lists.d.ts b/lib/esm/resources/price_lists.d.ts new file mode 100644 index 00000000..6b958608 --- /dev/null +++ b/lib/esm/resources/price_lists.d.ts @@ -0,0 +1,37 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Price } from './prices'; +import { Attachment } from './attachments'; +declare type PriceListRel = ResourceId & { + type: typeof PriceLists.TYPE; +}; +interface PriceList extends Resource { + name?: string; + currency_code?: string; + tax_included?: boolean; + prices?: Price[]; + attachments?: Attachment[]; +} +interface PriceListCreate extends ResourceCreate { + name: string; + currency_code: string; + tax_included?: boolean; +} +interface PriceListUpdate extends ResourceUpdate { + name?: string; + currency_code?: string; + tax_included?: boolean; +} +declare class PriceLists extends ApiResource { + static readonly TYPE: 'price_lists'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PriceListCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PriceListUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPriceList(resource: any): resource is PriceList; + relationship(id: string | ResourceId): PriceListRel; + type(): string; +} +export default PriceLists; +export { PriceList, PriceListCreate, PriceListUpdate }; diff --git a/lib/esm/resources/price_lists.js b/lib/esm/resources/price_lists.js new file mode 100644 index 00000000..823b6ea1 --- /dev/null +++ b/lib/esm/resources/price_lists.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isPriceList(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="price_lists";export default s; \ No newline at end of file diff --git a/lib/esm/resources/prices.d.ts b/lib/esm/resources/prices.d.ts new file mode 100644 index 00000000..5f01e9e0 --- /dev/null +++ b/lib/esm/resources/prices.d.ts @@ -0,0 +1,54 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PriceList } from './price_lists'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type PriceRel = ResourceId & { + type: typeof Prices.TYPE; +}; +declare type PriceListRel = ResourceId & { + type: 'price_lists'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface Price extends Resource { + currency_code?: string; + sku_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + compare_at_amount_cents?: number; + compare_at_amount_float?: number; + formatted_compare_at_amount?: string; + price_list?: PriceList; + sku?: Sku; + attachments?: Attachment[]; +} +interface PriceCreate extends ResourceCreate { + sku_code?: string; + amount_cents: number; + compare_at_amount_cents: number; + price_list: PriceListRel; + sku?: SkuRel; +} +interface PriceUpdate extends ResourceUpdate { + sku_code?: string; + amount_cents?: number; + compare_at_amount_cents?: number; + price_list?: PriceListRel; + sku?: SkuRel; +} +declare class Prices extends ApiResource { + static readonly TYPE: 'prices'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: PriceCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: PriceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isPrice(resource: any): resource is Price; + relationship(id: string | ResourceId): PriceRel; + type(): string; +} +export default Prices; +export { Price, PriceCreate, PriceUpdate }; diff --git a/lib/esm/resources/prices.js b/lib/esm/resources/prices.js new file mode 100644 index 00000000..cbad0619 --- /dev/null +++ b/lib/esm/resources/prices.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isPrice(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="prices";export default s; \ No newline at end of file diff --git a/lib/esm/resources/promotion_rules.d.ts b/lib/esm/resources/promotion_rules.d.ts new file mode 100644 index 00000000..533f9890 --- /dev/null +++ b/lib/esm/resources/promotion_rules.d.ts @@ -0,0 +1,24 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +declare type PromotionRuleRel = ResourceId & { + type: typeof PromotionRules.TYPE; +}; +interface PromotionRule extends Resource { + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; +} +declare class PromotionRules extends ApiResource { + static readonly TYPE: 'promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isPromotionRule(resource: any): resource is PromotionRule; + relationship(id: string | ResourceId): PromotionRuleRel; + type(): string; +} +export default PromotionRules; +export { PromotionRule }; diff --git a/lib/esm/resources/promotion_rules.js b/lib/esm/resources/promotion_rules.js new file mode 100644 index 00000000..b9044317 --- /dev/null +++ b/lib/esm/resources/promotion_rules.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}isPromotionRule(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="promotion_rules";export default r; \ No newline at end of file diff --git a/lib/esm/resources/promotions.d.ts b/lib/esm/resources/promotions.d.ts new file mode 100644 index 00000000..aaa369a7 --- /dev/null +++ b/lib/esm/resources/promotions.d.ts @@ -0,0 +1,35 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { PromotionRule } from './promotion_rules'; +import { OrderAmountPromotionRule } from './order_amount_promotion_rules'; +import { SkuListPromotionRule } from './sku_list_promotion_rules'; +import { CouponCodesPromotionRule } from './coupon_codes_promotion_rules'; +import { Attachment } from './attachments'; +declare type PromotionRel = ResourceId & { + type: typeof Promotions.TYPE; +}; +interface Promotion extends Resource { + name?: string; + starts_at?: string; + expires_at?: string; + total_usage_limit?: number; + total_usage_count?: number; + active?: boolean; + market?: Market; + promotion_rules?: PromotionRule[]; + order_amount_promotion_rule?: OrderAmountPromotionRule; + sku_list_promotion_rule?: SkuListPromotionRule; + coupon_codes_promotion_rule?: CouponCodesPromotionRule; + attachments?: Attachment[]; +} +declare class Promotions extends ApiResource { + static readonly TYPE: 'promotions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isPromotion(resource: any): resource is Promotion; + relationship(id: string | ResourceId): PromotionRel; + type(): string; +} +export default Promotions; +export { Promotion }; diff --git a/lib/esm/resources/promotions.js b/lib/esm/resources/promotions.js new file mode 100644 index 00000000..3c566625 --- /dev/null +++ b/lib/esm/resources/promotions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}isPromotion(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="promotions";export default r; \ No newline at end of file diff --git a/lib/esm/resources/refunds.d.ts b/lib/esm/resources/refunds.d.ts new file mode 100644 index 00000000..ebe9cb7b --- /dev/null +++ b/lib/esm/resources/refunds.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Capture } from './captures'; +declare type RefundRel = ResourceId & { + type: typeof Refunds.TYPE; +}; +interface Refund extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + order?: Order; + reference_capture?: Capture; +} +declare class Refunds extends ApiResource { + static readonly TYPE: 'refunds'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isRefund(resource: any): resource is Refund; + relationship(id: string | ResourceId): RefundRel; + type(): string; +} +export default Refunds; +export { Refund }; diff --git a/lib/esm/resources/refunds.js b/lib/esm/resources/refunds.js new file mode 100644 index 00000000..1559f0e3 --- /dev/null +++ b/lib/esm/resources/refunds.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}isRefund(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="refunds";export default r; \ No newline at end of file diff --git a/lib/esm/resources/return_line_items.d.ts b/lib/esm/resources/return_line_items.d.ts new file mode 100644 index 00000000..9947805e --- /dev/null +++ b/lib/esm/resources/return_line_items.d.ts @@ -0,0 +1,47 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Return } from './returns'; +import { LineItem } from './line_items'; +declare type ReturnLineItemRel = ResourceId & { + type: typeof ReturnLineItems.TYPE; +}; +declare type ReturnRel = ResourceId & { + type: 'returns'; +}; +declare type LineItemRel = ResourceId & { + type: 'line_items'; +}; +interface ReturnLineItem extends Resource { + sku_code?: string; + bundle_code?: string; + name?: string; + quantity?: number; + return_reason?: object; + restocked_at?: string; + return?: Return; + line_item?: LineItem; +} +interface ReturnLineItemCreate extends ResourceCreate { + quantity: number; + return_reason?: object; + return: ReturnRel; + line_item: LineItemRel; +} +interface ReturnLineItemUpdate extends ResourceUpdate { + quantity?: number; + _restock?: boolean; + return_reason?: object; +} +declare class ReturnLineItems extends ApiResource { + static readonly TYPE: 'return_line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ReturnLineItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ReturnLineItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isReturnLineItem(resource: any): resource is ReturnLineItem; + relationship(id: string | ResourceId): ReturnLineItemRel; + type(): string; +} +export default ReturnLineItems; +export { ReturnLineItem, ReturnLineItemCreate, ReturnLineItemUpdate }; diff --git a/lib/esm/resources/return_line_items.js b/lib/esm/resources/return_line_items.js new file mode 100644 index 00000000..7ed760c6 --- /dev/null +++ b/lib/esm/resources/return_line_items.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,r){return this.resources.list({type:t.TYPE},e,r)}async create(e,r,s){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async retrieve(e,r,s){return this.resources.retrieve({type:t.TYPE,id:e},r,s)}async update(e,r,s){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),r,s)}async delete(e,r){await this.resources.delete({type:t.TYPE,id:e},r)}isReturnLineItem(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="return_line_items";export default t; \ No newline at end of file diff --git a/lib/esm/resources/returns.d.ts b/lib/esm/resources/returns.d.ts new file mode 100644 index 00000000..d1c0b90e --- /dev/null +++ b/lib/esm/resources/returns.d.ts @@ -0,0 +1,65 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Customer } from './customers'; +import { StockLocation } from './stock_locations'; +import { Address } from './addresses'; +import { ReturnLineItem } from './return_line_items'; +import { Attachment } from './attachments'; +declare type ReturnRel = ResourceId & { + type: typeof Returns.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +interface Return extends Resource { + number?: string; + status?: string; + customer_email?: string; + skus_count?: number; + approved_at?: string; + cancelled_at?: string; + shipped_at?: string; + rejected_at?: string; + received_at?: string; + archived_at?: string; + order?: Order; + customer?: Customer; + stock_location?: StockLocation; + origin_address?: Address; + destination_address?: Address; + return_line_items?: ReturnLineItem[]; + attachments?: Attachment[]; +} +interface ReturnCreate extends ResourceCreate { + order: OrderRel; + stock_location?: StockLocationRel; +} +interface ReturnUpdate extends ResourceUpdate { + _request?: boolean; + _approve?: boolean; + _cancel?: boolean; + _ship?: boolean; + _reject?: boolean; + _receive?: boolean; + _restock?: boolean; + _archive?: boolean; + _unarchive?: boolean; + stock_location?: StockLocationRel; +} +declare class Returns extends ApiResource { + static readonly TYPE: 'returns'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ReturnCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ReturnUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isReturn(resource: any): resource is Return; + relationship(id: string | ResourceId): ReturnRel; + type(): string; +} +export default Returns; +export { Return, ReturnCreate, ReturnUpdate }; diff --git a/lib/esm/resources/returns.js b/lib/esm/resources/returns.js new file mode 100644 index 00000000..3f2d4a69 --- /dev/null +++ b/lib/esm/resources/returns.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,s){return this.resources.list({type:r.TYPE},e,s)}async create(e,s,t){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async retrieve(e,s,t){return this.resources.retrieve({type:r.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}async delete(e,s){await this.resources.delete({type:r.TYPE,id:e},s)}isReturn(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="returns";export default r; \ No newline at end of file diff --git a/lib/esm/resources/shipments.d.ts b/lib/esm/resources/shipments.d.ts new file mode 100644 index 00000000..c8b5f35b --- /dev/null +++ b/lib/esm/resources/shipments.d.ts @@ -0,0 +1,76 @@ +import { ApiResource, Resource, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { ShippingCategory } from './shipping_categories'; +import { StockLocation } from './stock_locations'; +import { Address } from './addresses'; +import { ShippingMethod } from './shipping_methods'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { StockLineItem } from './stock_line_items'; +import { StockTransfer } from './stock_transfers'; +import { CarrierAccount } from './carrier_accounts'; +import { Parcel } from './parcels'; +import { Attachment } from './attachments'; +declare type ShipmentRel = ResourceId & { + type: typeof Shipments.TYPE; +}; +declare type ShippingMethodRel = ResourceId & { + type: 'shipping_methods'; +}; +interface Shipment extends Resource { + number?: string; + status?: string; + currency_code?: string; + cost_amount_cents?: number; + cost_amount_float?: number; + formatted_cost_amount?: string; + skus_count?: number; + selected_rate_id?: string; + rates?: object[]; + purchase_error_code?: string; + purchase_error_message?: string; + get_rates_started_at?: string; + get_rates_completed_at?: string; + purchase_started_at?: string; + purchase_completed_at?: string; + purchase_failed_at?: string; + order?: Order; + shipping_category?: ShippingCategory; + stock_location?: StockLocation; + origin_address?: Address; + shipping_address?: Address; + shipping_method?: ShippingMethod; + delivery_lead_time?: DeliveryLeadTime; + /** + * @deprecated This field should not be used as it may be removed in the future without notice + */ + shipment_line_items?: object[]; + stock_line_items?: StockLineItem[]; + stock_transfers?: StockTransfer[]; + available_shipping_methods?: ShippingMethod[]; + carrier_accounts?: CarrierAccount[]; + parcels?: Parcel[]; + attachments?: Attachment[]; +} +interface ShipmentUpdate extends ResourceUpdate { + _on_hold?: boolean; + _picking?: boolean; + _packing?: boolean; + _ready_to_ship?: boolean; + _ship?: boolean; + _get_rates?: boolean; + selected_rate_id?: string; + _purchase?: boolean; + shipping_method?: ShippingMethodRel; +} +declare class Shipments extends ApiResource { + static readonly TYPE: 'shipments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShipmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isShipment(resource: any): resource is Shipment; + relationship(id: string | ResourceId): ShipmentRel; + type(): string; +} +export default Shipments; +export { Shipment, ShipmentUpdate }; diff --git a/lib/esm/resources/shipments.js b/lib/esm/resources/shipments.js new file mode 100644 index 00000000..60fadc58 --- /dev/null +++ b/lib/esm/resources/shipments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,s){return this.resources.list({type:r.TYPE},e,s)}async retrieve(e,s,t){return this.resources.retrieve({type:r.TYPE,id:e},s,t)}async update(e,s,t){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),s,t)}isShipment(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="shipments";export default r; \ No newline at end of file diff --git a/lib/esm/resources/shipping_categories.d.ts b/lib/esm/resources/shipping_categories.d.ts new file mode 100644 index 00000000..31783c0f --- /dev/null +++ b/lib/esm/resources/shipping_categories.d.ts @@ -0,0 +1,31 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type ShippingCategoryRel = ResourceId & { + type: typeof ShippingCategories.TYPE; +}; +interface ShippingCategory extends Resource { + name?: string; + skus?: Sku[]; + attachments?: Attachment[]; +} +interface ShippingCategoryCreate extends ResourceCreate { + name: string; +} +interface ShippingCategoryUpdate extends ResourceUpdate { + name?: string; +} +declare class ShippingCategories extends ApiResource { + static readonly TYPE: 'shipping_categories'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ShippingCategoryCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShippingCategoryUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isShippingCategory(resource: any): resource is ShippingCategory; + relationship(id: string | ResourceId): ShippingCategoryRel; + type(): string; +} +export default ShippingCategories; +export { ShippingCategory, ShippingCategoryCreate, ShippingCategoryUpdate }; diff --git a/lib/esm/resources/shipping_categories.js b/lib/esm/resources/shipping_categories.js new file mode 100644 index 00000000..0bfca298 --- /dev/null +++ b/lib/esm/resources/shipping_categories.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isShippingCategory(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="shipping_categories";export default s; \ No newline at end of file diff --git a/lib/esm/resources/shipping_methods.d.ts b/lib/esm/resources/shipping_methods.d.ts new file mode 100644 index 00000000..c1a4dfec --- /dev/null +++ b/lib/esm/resources/shipping_methods.d.ts @@ -0,0 +1,67 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { ShippingZone } from './shipping_zones'; +import { ShippingCategory } from './shipping_categories'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { Attachment } from './attachments'; +declare type ShippingMethodRel = ResourceId & { + type: typeof ShippingMethods.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +declare type ShippingZoneRel = ResourceId & { + type: 'shipping_zones'; +}; +declare type ShippingCategoryRel = ResourceId & { + type: 'shipping_categories'; +}; +interface ShippingMethod extends Resource { + name?: string; + disabled_at?: string; + currency_code?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + free_over_amount_cents?: number; + free_over_amount_float?: number; + formatted_free_over_amount?: string; + price_amount_for_shipment_cents?: number; + price_amount_for_shipment_float?: number; + formatted_price_amount_for_shipment?: string; + market?: Market; + shipping_zone?: ShippingZone; + shipping_category?: ShippingCategory; + delivery_lead_time_for_shipment?: DeliveryLeadTime; + attachments?: Attachment[]; +} +interface ShippingMethodCreate extends ResourceCreate { + name: string; + price_amount_cents: number; + free_over_amount_cents?: number; + market: MarketRel; + shipping_zone: ShippingZoneRel; + shipping_category: ShippingCategoryRel; +} +interface ShippingMethodUpdate extends ResourceUpdate { + name?: string; + price_amount_cents?: number; + free_over_amount_cents?: number; + market?: MarketRel; + shipping_zone?: ShippingZoneRel; + shipping_category?: ShippingCategoryRel; +} +declare class ShippingMethods extends ApiResource { + static readonly TYPE: 'shipping_methods'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ShippingMethodCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShippingMethodUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isShippingMethod(resource: any): resource is ShippingMethod; + relationship(id: string | ResourceId): ShippingMethodRel; + type(): string; +} +export default ShippingMethods; +export { ShippingMethod, ShippingMethodCreate, ShippingMethodUpdate }; diff --git a/lib/esm/resources/shipping_methods.js b/lib/esm/resources/shipping_methods.js new file mode 100644 index 00000000..89aa0b87 --- /dev/null +++ b/lib/esm/resources/shipping_methods.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isShippingMethod(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="shipping_methods";export default s; \ No newline at end of file diff --git a/lib/esm/resources/shipping_zones.d.ts b/lib/esm/resources/shipping_zones.d.ts new file mode 100644 index 00000000..fb65f830 --- /dev/null +++ b/lib/esm/resources/shipping_zones.d.ts @@ -0,0 +1,47 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Attachment } from './attachments'; +declare type ShippingZoneRel = ResourceId & { + type: typeof ShippingZones.TYPE; +}; +interface ShippingZone extends Resource { + name?: string; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + attachments?: Attachment[]; +} +interface ShippingZoneCreate extends ResourceCreate { + name: string; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; +} +interface ShippingZoneUpdate extends ResourceUpdate { + name?: string; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; +} +declare class ShippingZones extends ApiResource { + static readonly TYPE: 'shipping_zones'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: ShippingZoneCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: ShippingZoneUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isShippingZone(resource: any): resource is ShippingZone; + relationship(id: string | ResourceId): ShippingZoneRel; + type(): string; +} +export default ShippingZones; +export { ShippingZone, ShippingZoneCreate, ShippingZoneUpdate }; diff --git a/lib/esm/resources/shipping_zones.js b/lib/esm/resources/shipping_zones.js new file mode 100644 index 00000000..15e67659 --- /dev/null +++ b/lib/esm/resources/shipping_zones.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isShippingZone(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="shipping_zones";export default s; \ No newline at end of file diff --git a/lib/esm/resources/sku_list_items.d.ts b/lib/esm/resources/sku_list_items.d.ts new file mode 100644 index 00000000..86f27451 --- /dev/null +++ b/lib/esm/resources/sku_list_items.d.ts @@ -0,0 +1,45 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type SkuListItemRel = ResourceId & { + type: typeof SkuListItems.TYPE; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface SkuListItem extends Resource { + position?: number; + sku_code?: string; + quantity?: number; + sku_list?: SkuList; + sku?: Sku; +} +interface SkuListItemCreate extends ResourceCreate { + position?: number; + sku_code?: string; + quantity?: number; + sku_list: SkuListRel; + sku: SkuRel; +} +interface SkuListItemUpdate extends ResourceUpdate { + position?: number; + sku_code?: string; + quantity?: number; +} +declare class SkuListItems extends ApiResource { + static readonly TYPE: 'sku_list_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuListItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuListItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuListItem(resource: any): resource is SkuListItem; + relationship(id: string | ResourceId): SkuListItemRel; + type(): string; +} +export default SkuListItems; +export { SkuListItem, SkuListItemCreate, SkuListItemUpdate }; diff --git a/lib/esm/resources/sku_list_items.js b/lib/esm/resources/sku_list_items.js new file mode 100644 index 00000000..32d92c1e --- /dev/null +++ b/lib/esm/resources/sku_list_items.js @@ -0,0 +1 @@ +import{ApiResource as r}from"../resource";class t extends r{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,i){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,i)}async retrieve(e,s,i){return this.resources.retrieve({type:t.TYPE,id:e},s,i)}async update(e,s,i){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,i)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isSkuListItem(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="sku_list_items";export default t; \ No newline at end of file diff --git a/lib/esm/resources/sku_list_promotion_rules.d.ts b/lib/esm/resources/sku_list_promotion_rules.d.ts new file mode 100644 index 00000000..f988b75e --- /dev/null +++ b/lib/esm/resources/sku_list_promotion_rules.d.ts @@ -0,0 +1,66 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PercentageDiscountPromotion } from './percentage_discount_promotions'; +import { FreeShippingPromotion } from './free_shipping_promotions'; +import { FixedAmountPromotion } from './fixed_amount_promotions'; +import { FreeGiftPromotion } from './free_gift_promotions'; +import { FixedPricePromotion } from './fixed_price_promotions'; +import { ExternalPromotion } from './external_promotions'; +import { SkuList } from './sku_lists'; +import { Sku } from './skus'; +declare type SkuListPromotionRuleRel = ResourceId & { + type: typeof SkuListPromotionRules.TYPE; +}; +declare type PercentageDiscountPromotionRel = ResourceId & { + type: 'percentage_discount_promotions'; +}; +declare type FreeShippingPromotionRel = ResourceId & { + type: 'free_shipping_promotions'; +}; +declare type FixedAmountPromotionRel = ResourceId & { + type: 'fixed_amount_promotions'; +}; +declare type FreeGiftPromotionRel = ResourceId & { + type: 'free_gift_promotions'; +}; +declare type FixedPricePromotionRel = ResourceId & { + type: 'fixed_price_promotions'; +}; +declare type ExternalPromotionRel = ResourceId & { + type: 'external_promotions'; +}; +declare type SkuListRel = ResourceId & { + type: 'sku_lists'; +}; +interface SkuListPromotionRule extends Resource { + all_skus?: boolean; + min_quantity?: number; + promotion?: PercentageDiscountPromotion | FreeShippingPromotion | FixedAmountPromotion | FreeGiftPromotion | FixedPricePromotion | ExternalPromotion; + sku_list?: SkuList; + skus?: Sku[]; +} +interface SkuListPromotionRuleCreate extends ResourceCreate { + all_skus?: boolean; + min_quantity?: number; + promotion: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + sku_list?: SkuListRel; +} +interface SkuListPromotionRuleUpdate extends ResourceUpdate { + all_skus?: boolean; + min_quantity?: number; + promotion?: PercentageDiscountPromotionRel | FreeShippingPromotionRel | FixedAmountPromotionRel | FreeGiftPromotionRel | FixedPricePromotionRel | ExternalPromotionRel; + sku_list?: SkuListRel; +} +declare class SkuListPromotionRules extends ApiResource { + static readonly TYPE: 'sku_list_promotion_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuListPromotionRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuListPromotionRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuListPromotionRule(resource: any): resource is SkuListPromotionRule; + relationship(id: string | ResourceId): SkuListPromotionRuleRel; + type(): string; +} +export default SkuListPromotionRules; +export { SkuListPromotionRule, SkuListPromotionRuleCreate, SkuListPromotionRuleUpdate }; diff --git a/lib/esm/resources/sku_list_promotion_rules.js b/lib/esm/resources/sku_list_promotion_rules.js new file mode 100644 index 00000000..a431e897 --- /dev/null +++ b/lib/esm/resources/sku_list_promotion_rules.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isSkuListPromotionRule(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="sku_list_promotion_rules";export default s; \ No newline at end of file diff --git a/lib/esm/resources/sku_lists.d.ts b/lib/esm/resources/sku_lists.d.ts new file mode 100644 index 00000000..95c98ac8 --- /dev/null +++ b/lib/esm/resources/sku_lists.d.ts @@ -0,0 +1,46 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { SkuListItem } from './sku_list_items'; +import { Bundle } from './bundles'; +declare type SkuListRel = ResourceId & { + type: typeof SkuLists.TYPE; +}; +interface SkuList extends Resource { + name?: string; + slug?: string; + description?: string; + image_url?: string; + manual?: boolean; + sku_code_regex?: string; + skus?: Sku[]; + sku_list_items?: SkuListItem[]; + bundles?: Bundle[]; +} +interface SkuListCreate extends ResourceCreate { + name: string; + description?: string; + image_url?: string; + manual?: boolean; + sku_code_regex?: string; +} +interface SkuListUpdate extends ResourceUpdate { + name?: string; + description?: string; + image_url?: string; + manual?: boolean; + sku_code_regex?: string; +} +declare class SkuLists extends ApiResource { + static readonly TYPE: 'sku_lists'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuListCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuListUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuList(resource: any): resource is SkuList; + relationship(id: string | ResourceId): SkuListRel; + type(): string; +} +export default SkuLists; +export { SkuList, SkuListCreate, SkuListUpdate }; diff --git a/lib/esm/resources/sku_lists.js b/lib/esm/resources/sku_lists.js new file mode 100644 index 00000000..4cd9fd51 --- /dev/null +++ b/lib/esm/resources/sku_lists.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isSkuList(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="sku_lists";export default s; \ No newline at end of file diff --git a/lib/esm/resources/sku_options.d.ts b/lib/esm/resources/sku_options.d.ts new file mode 100644 index 00000000..47743da7 --- /dev/null +++ b/lib/esm/resources/sku_options.d.ts @@ -0,0 +1,51 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type SkuOptionRel = ResourceId & { + type: typeof SkuOptions.TYPE; +}; +declare type MarketRel = ResourceId & { + type: 'markets'; +}; +interface SkuOption extends Resource { + name?: string; + description?: string; + price_amount_cents?: number; + price_amount_float?: number; + formatted_price_amount?: string; + delay_hours?: number; + delay_days?: number; + sku_code_regex?: string; + market?: Market; + attachments?: Attachment[]; +} +interface SkuOptionCreate extends ResourceCreate { + name: string; + description?: string; + price_amount_cents?: number; + delay_hours?: number; + sku_code_regex?: string; + market: MarketRel; +} +interface SkuOptionUpdate extends ResourceUpdate { + name?: string; + description?: string; + price_amount_cents?: number; + delay_hours?: number; + sku_code_regex?: string; + market?: MarketRel; +} +declare class SkuOptions extends ApiResource { + static readonly TYPE: 'sku_options'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuOptionCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuOptionUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSkuOption(resource: any): resource is SkuOption; + relationship(id: string | ResourceId): SkuOptionRel; + type(): string; +} +export default SkuOptions; +export { SkuOption, SkuOptionCreate, SkuOptionUpdate }; diff --git a/lib/esm/resources/sku_options.js b/lib/esm/resources/sku_options.js new file mode 100644 index 00000000..07eac09b --- /dev/null +++ b/lib/esm/resources/sku_options.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isSkuOption(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="sku_options";export default s; \ No newline at end of file diff --git a/lib/esm/resources/skus.d.ts b/lib/esm/resources/skus.d.ts new file mode 100644 index 00000000..d4cf58f6 --- /dev/null +++ b/lib/esm/resources/skus.d.ts @@ -0,0 +1,72 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { ShippingCategory } from './shipping_categories'; +import { Price } from './prices'; +import { StockItem } from './stock_items'; +import { DeliveryLeadTime } from './delivery_lead_times'; +import { SkuOption } from './sku_options'; +import { Attachment } from './attachments'; +declare type SkuRel = ResourceId & { + type: typeof Skus.TYPE; +}; +declare type ShippingCategoryRel = ResourceId & { + type: 'shipping_categories'; +}; +interface Sku extends Resource { + code?: string; + name?: string; + description?: string; + image_url?: string; + pieces_per_pack?: number; + weight?: number; + unit_of_weight?: string; + hs_tariff_number?: string; + do_not_ship?: boolean; + do_not_track?: boolean; + inventory?: object; + shipping_category?: ShippingCategory; + prices?: Price[]; + stock_items?: StockItem[]; + delivery_lead_times?: DeliveryLeadTime[]; + sku_options?: SkuOption[]; + attachments?: Attachment[]; +} +interface SkuCreate extends ResourceCreate { + code: string; + name: string; + description?: string; + image_url?: string; + pieces_per_pack?: number; + weight?: number; + unit_of_weight?: string; + hs_tariff_number?: string; + do_not_ship?: boolean; + do_not_track?: boolean; + shipping_category: ShippingCategoryRel; +} +interface SkuUpdate extends ResourceUpdate { + code?: string; + name?: string; + description?: string; + image_url?: string; + pieces_per_pack?: number; + weight?: number; + unit_of_weight?: string; + hs_tariff_number?: string; + do_not_ship?: boolean; + do_not_track?: boolean; + shipping_category?: ShippingCategoryRel; +} +declare class Skus extends ApiResource { + static readonly TYPE: 'skus'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: SkuCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: SkuUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isSku(resource: any): resource is Sku; + relationship(id: string | ResourceId): SkuRel; + type(): string; +} +export default Skus; +export { Sku, SkuCreate, SkuUpdate }; diff --git a/lib/esm/resources/skus.js b/lib/esm/resources/skus.js new file mode 100644 index 00000000..90ce7dfa --- /dev/null +++ b/lib/esm/resources/skus.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isSku(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="skus";export default s; \ No newline at end of file diff --git a/lib/esm/resources/stock_items.d.ts b/lib/esm/resources/stock_items.d.ts new file mode 100644 index 00000000..cec89e4f --- /dev/null +++ b/lib/esm/resources/stock_items.d.ts @@ -0,0 +1,46 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { StockLocation } from './stock_locations'; +import { Sku } from './skus'; +import { Attachment } from './attachments'; +declare type StockItemRel = ResourceId & { + type: typeof StockItems.TYPE; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +interface StockItem extends Resource { + sku_code?: string; + quantity?: number; + stock_location?: StockLocation; + sku?: Sku; + attachments?: Attachment[]; +} +interface StockItemCreate extends ResourceCreate { + sku_code?: string; + quantity: number; + stock_location: StockLocationRel; + sku?: SkuRel; +} +interface StockItemUpdate extends ResourceUpdate { + sku_code?: string; + quantity?: number; + stock_location?: StockLocationRel; + sku?: SkuRel; +} +declare class StockItems extends ApiResource { + static readonly TYPE: 'stock_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StockItemCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StockItemUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStockItem(resource: any): resource is StockItem; + relationship(id: string | ResourceId): StockItemRel; + type(): string; +} +export default StockItems; +export { StockItem, StockItemCreate, StockItemUpdate }; diff --git a/lib/esm/resources/stock_items.js b/lib/esm/resources/stock_items.js new file mode 100644 index 00000000..d7b06579 --- /dev/null +++ b/lib/esm/resources/stock_items.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isStockItem(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="stock_items";export default t; \ No newline at end of file diff --git a/lib/esm/resources/stock_line_items.d.ts b/lib/esm/resources/stock_line_items.d.ts new file mode 100644 index 00000000..7771cef3 --- /dev/null +++ b/lib/esm/resources/stock_line_items.d.ts @@ -0,0 +1,26 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Shipment } from './shipments'; +import { LineItem } from './line_items'; +import { StockItem } from './stock_items'; +declare type StockLineItemRel = ResourceId & { + type: typeof StockLineItems.TYPE; +}; +interface StockLineItem extends Resource { + sku_code?: string; + bundle_code?: string; + quantity?: number; + shipment?: Shipment; + line_item?: LineItem; + stock_item?: StockItem; +} +declare class StockLineItems extends ApiResource { + static readonly TYPE: 'stock_line_items'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isStockLineItem(resource: any): resource is StockLineItem; + relationship(id: string | ResourceId): StockLineItemRel; + type(): string; +} +export default StockLineItems; +export { StockLineItem }; diff --git a/lib/esm/resources/stock_line_items.js b/lib/esm/resources/stock_line_items.js new file mode 100644 index 00000000..115d2318 --- /dev/null +++ b/lib/esm/resources/stock_line_items.js @@ -0,0 +1 @@ +import{ApiResource as r}from"../resource";class t extends r{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async retrieve(e,s,i){return this.resources.retrieve({type:t.TYPE,id:e},s,i)}isStockLineItem(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="stock_line_items";export default t; \ No newline at end of file diff --git a/lib/esm/resources/stock_locations.d.ts b/lib/esm/resources/stock_locations.d.ts new file mode 100644 index 00000000..13d9f057 --- /dev/null +++ b/lib/esm/resources/stock_locations.d.ts @@ -0,0 +1,51 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Address } from './addresses'; +import { InventoryStockLocation } from './inventory_stock_locations'; +import { InventoryReturnLocation } from './inventory_return_locations'; +import { StockItem } from './stock_items'; +import { StockTransfer } from './stock_transfers'; +import { Attachment } from './attachments'; +declare type StockLocationRel = ResourceId & { + type: typeof StockLocations.TYPE; +}; +declare type AddressRel = ResourceId & { + type: 'addresses'; +}; +interface StockLocation extends Resource { + number?: number; + name?: string; + label_format?: string; + suppress_etd?: boolean; + address?: Address; + inventory_stock_locations?: InventoryStockLocation[]; + inventory_return_locations?: InventoryReturnLocation[]; + stock_items?: StockItem[]; + stock_transfers?: StockTransfer[]; + attachments?: Attachment[]; +} +interface StockLocationCreate extends ResourceCreate { + name: string; + label_format?: string; + suppress_etd?: boolean; + address: AddressRel; +} +interface StockLocationUpdate extends ResourceUpdate { + name?: string; + label_format?: string; + suppress_etd?: boolean; + address?: AddressRel; +} +declare class StockLocations extends ApiResource { + static readonly TYPE: 'stock_locations'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StockLocationCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StockLocationUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStockLocation(resource: any): resource is StockLocation; + relationship(id: string | ResourceId): StockLocationRel; + type(): string; +} +export default StockLocations; +export { StockLocation, StockLocationCreate, StockLocationUpdate }; diff --git a/lib/esm/resources/stock_locations.js b/lib/esm/resources/stock_locations.js new file mode 100644 index 00000000..cfe3233c --- /dev/null +++ b/lib/esm/resources/stock_locations.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class t extends i{async list(e,s){return this.resources.list({type:t.TYPE},e,s)}async create(e,s,r){return this.resources.create(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async retrieve(e,s,r){return this.resources.retrieve({type:t.TYPE,id:e},s,r)}async update(e,s,r){return this.resources.update(Object.assign(Object.assign({},e),{type:t.TYPE}),s,r)}async delete(e,s){await this.resources.delete({type:t.TYPE,id:e},s)}isStockLocation(e){return e.type&&e.type===t.TYPE}relationship(e){return typeof e=="string"?{id:e,type:t.TYPE}:{id:e.id,type:t.TYPE}}type(){return t.TYPE}}t.TYPE="stock_locations";export default t; \ No newline at end of file diff --git a/lib/esm/resources/stock_transfers.d.ts b/lib/esm/resources/stock_transfers.d.ts new file mode 100644 index 00000000..874e805e --- /dev/null +++ b/lib/esm/resources/stock_transfers.d.ts @@ -0,0 +1,66 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { StockLocation } from './stock_locations'; +import { Shipment } from './shipments'; +import { LineItem } from './line_items'; +declare type StockTransferRel = ResourceId & { + type: typeof StockTransfers.TYPE; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +declare type StockLocationRel = ResourceId & { + type: 'stock_locations'; +}; +declare type ShipmentRel = ResourceId & { + type: 'shipments'; +}; +declare type LineItemRel = ResourceId & { + type: 'line_items'; +}; +interface StockTransfer extends Resource { + sku_code?: string; + status?: string; + quantity?: number; + completed_at?: string; + cancelled_at?: string; + sku?: Sku; + origin_stock_location?: StockLocation; + destination_stock_location?: StockLocation; + shipment?: Shipment; + line_item?: LineItem; +} +interface StockTransferCreate extends ResourceCreate { + sku_code?: string; + quantity: number; + sku: SkuRel; + origin_stock_location: StockLocationRel; + destination_stock_location: StockLocationRel; + shipment?: ShipmentRel; + line_item?: LineItemRel; +} +interface StockTransferUpdate extends ResourceUpdate { + sku_code?: string; + _upcoming?: boolean; + _picking?: boolean; + _in_transit?: boolean; + _complete?: boolean; + _cancel?: boolean; + sku?: SkuRel; + origin_stock_location?: StockLocationRel; + destination_stock_location?: StockLocationRel; +} +declare class StockTransfers extends ApiResource { + static readonly TYPE: 'stock_transfers'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StockTransferCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StockTransferUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStockTransfer(resource: any): resource is StockTransfer; + relationship(id: string | ResourceId): StockTransferRel; + type(): string; +} +export default StockTransfers; +export { StockTransfer, StockTransferCreate, StockTransferUpdate }; diff --git a/lib/esm/resources/stock_transfers.js b/lib/esm/resources/stock_transfers.js new file mode 100644 index 00000000..ab310f34 --- /dev/null +++ b/lib/esm/resources/stock_transfers.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isStockTransfer(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="stock_transfers";export default s; \ No newline at end of file diff --git a/lib/esm/resources/stripe_gateways.d.ts b/lib/esm/resources/stripe_gateways.d.ts new file mode 100644 index 00000000..83277ba1 --- /dev/null +++ b/lib/esm/resources/stripe_gateways.d.ts @@ -0,0 +1,36 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { PaymentMethod } from './payment_methods'; +import { StripePayment } from './stripe_payments'; +declare type StripeGatewayRel = ResourceId & { + type: typeof StripeGateways.TYPE; +}; +interface StripeGateway extends Resource { + name?: string; + webhook_endpoint_id?: string; + webhook_endpoint_secret?: string; + webhook_endpoint_url?: string; + payment_methods?: PaymentMethod[]; + stripe_payments?: StripePayment[]; +} +interface StripeGatewayCreate extends ResourceCreate { + name: string; + login: string; + publishable_key?: string; +} +interface StripeGatewayUpdate extends ResourceUpdate { + name?: string; +} +declare class StripeGateways extends ApiResource { + static readonly TYPE: 'stripe_gateways'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StripeGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StripeGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStripeGateway(resource: any): resource is StripeGateway; + relationship(id: string | ResourceId): StripeGatewayRel; + type(): string; +} +export default StripeGateways; +export { StripeGateway, StripeGatewayCreate, StripeGatewayUpdate }; diff --git a/lib/esm/resources/stripe_gateways.js b/lib/esm/resources/stripe_gateways.js new file mode 100644 index 00000000..abc97ea4 --- /dev/null +++ b/lib/esm/resources/stripe_gateways.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isStripeGateway(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="stripe_gateways";export default s; \ No newline at end of file diff --git a/lib/esm/resources/stripe_payments.d.ts b/lib/esm/resources/stripe_payments.d.ts new file mode 100644 index 00000000..7f56c83d --- /dev/null +++ b/lib/esm/resources/stripe_payments.d.ts @@ -0,0 +1,40 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { PaymentGateway } from './payment_gateways'; +declare type StripePaymentRel = ResourceId & { + type: typeof StripePayments.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface StripePayment extends Resource { + client_secret?: string; + publishable_key?: string; + options?: object; + payment_method?: object; + order?: Order; + payment_gateway?: PaymentGateway; +} +interface StripePaymentCreate extends ResourceCreate { + options?: object; + order: OrderRel; +} +interface StripePaymentUpdate extends ResourceUpdate { + options?: object; + _refresh?: boolean; + order?: OrderRel; +} +declare class StripePayments extends ApiResource { + static readonly TYPE: 'stripe_payments'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: StripePaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: StripePaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isStripePayment(resource: any): resource is StripePayment; + relationship(id: string | ResourceId): StripePaymentRel; + type(): string; +} +export default StripePayments; +export { StripePayment, StripePaymentCreate, StripePaymentUpdate }; diff --git a/lib/esm/resources/stripe_payments.js b/lib/esm/resources/stripe_payments.js new file mode 100644 index 00000000..17a79ec6 --- /dev/null +++ b/lib/esm/resources/stripe_payments.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isStripePayment(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="stripe_payments";export default s; \ No newline at end of file diff --git a/lib/esm/resources/tax_calculators.d.ts b/lib/esm/resources/tax_calculators.d.ts new file mode 100644 index 00000000..62519c82 --- /dev/null +++ b/lib/esm/resources/tax_calculators.d.ts @@ -0,0 +1,24 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type TaxCalculatorRel = ResourceId & { + type: typeof TaxCalculators.TYPE; +}; +interface TaxCalculator extends Resource { + name?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +declare class TaxCalculators extends ApiResource { + static readonly TYPE: 'tax_calculators'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isTaxCalculator(resource: any): resource is TaxCalculator; + relationship(id: string | ResourceId): TaxCalculatorRel; + type(): string; +} +export default TaxCalculators; +export { TaxCalculator }; diff --git a/lib/esm/resources/tax_calculators.js b/lib/esm/resources/tax_calculators.js new file mode 100644 index 00000000..86409879 --- /dev/null +++ b/lib/esm/resources/tax_calculators.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}isTaxCalculator(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="tax_calculators";export default r; \ No newline at end of file diff --git a/lib/esm/resources/tax_categories.d.ts b/lib/esm/resources/tax_categories.d.ts new file mode 100644 index 00000000..b49bc0b9 --- /dev/null +++ b/lib/esm/resources/tax_categories.d.ts @@ -0,0 +1,57 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Sku } from './skus'; +import { AvalaraAccount } from './avalara_accounts'; +import { TaxjarAccount } from './taxjar_accounts'; +import { ManualTaxCalculator } from './manual_tax_calculators'; +import { ExternalTaxCalculator } from './external_tax_calculators'; +import { Attachment } from './attachments'; +declare type TaxCategoryRel = ResourceId & { + type: typeof TaxCategories.TYPE; +}; +declare type SkuRel = ResourceId & { + type: 'skus'; +}; +declare type AvalaraAccountRel = ResourceId & { + type: 'avalara_accounts'; +}; +declare type TaxjarAccountRel = ResourceId & { + type: 'taxjar_accounts'; +}; +declare type ManualTaxCalculatorRel = ResourceId & { + type: 'manual_tax_calculators'; +}; +declare type ExternalTaxCalculatorRel = ResourceId & { + type: 'external_tax_calculators'; +}; +interface TaxCategory extends Resource { + code?: string; + sku_code?: string; + sku?: Sku; + tax_calculator?: AvalaraAccount | TaxjarAccount | ManualTaxCalculator | ExternalTaxCalculator; + attachments?: Attachment[]; +} +interface TaxCategoryCreate extends ResourceCreate { + code: string; + sku_code?: string; + sku: SkuRel; + tax_calculator: AvalaraAccountRel | TaxjarAccountRel | ManualTaxCalculatorRel | ExternalTaxCalculatorRel; +} +interface TaxCategoryUpdate extends ResourceUpdate { + code?: string; + sku_code?: string; + sku?: SkuRel; +} +declare class TaxCategories extends ApiResource { + static readonly TYPE: 'tax_categories'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: TaxCategoryCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: TaxCategoryUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isTaxCategory(resource: any): resource is TaxCategory; + relationship(id: string | ResourceId): TaxCategoryRel; + type(): string; +} +export default TaxCategories; +export { TaxCategory, TaxCategoryCreate, TaxCategoryUpdate }; diff --git a/lib/esm/resources/tax_categories.js b/lib/esm/resources/tax_categories.js new file mode 100644 index 00000000..b59a846e --- /dev/null +++ b/lib/esm/resources/tax_categories.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isTaxCategory(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="tax_categories";export default s; \ No newline at end of file diff --git a/lib/esm/resources/tax_rules.d.ts b/lib/esm/resources/tax_rules.d.ts new file mode 100644 index 00000000..f050364a --- /dev/null +++ b/lib/esm/resources/tax_rules.d.ts @@ -0,0 +1,68 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { ManualTaxCalculator } from './manual_tax_calculators'; +declare type TaxRuleRel = ResourceId & { + type: typeof TaxRules.TYPE; +}; +declare type ManualTaxCalculatorRel = ResourceId & { + type: 'manual_tax_calculators'; +}; +interface TaxRule extends Resource { + name?: string; + tax_rate?: number; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + freight_taxable?: boolean; + payment_method_taxable?: boolean; + gift_card_taxable?: boolean; + adjustment_taxable?: boolean; + breakdown?: object; + manual_tax_calculator?: ManualTaxCalculator; +} +interface TaxRuleCreate extends ResourceCreate { + name: string; + tax_rate?: number; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + freight_taxable?: boolean; + payment_method_taxable?: boolean; + gift_card_taxable?: boolean; + adjustment_taxable?: boolean; + manual_tax_calculator: ManualTaxCalculatorRel; +} +interface TaxRuleUpdate extends ResourceUpdate { + name?: string; + tax_rate?: number; + country_code_regex?: string; + not_country_code_regex?: string; + state_code_regex?: string; + not_state_code_regex?: string; + zip_code_regex?: string; + not_zip_code_regex?: string; + freight_taxable?: boolean; + payment_method_taxable?: boolean; + gift_card_taxable?: boolean; + adjustment_taxable?: boolean; + manual_tax_calculator?: ManualTaxCalculatorRel; +} +declare class TaxRules extends ApiResource { + static readonly TYPE: 'tax_rules'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: TaxRuleCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: TaxRuleUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isTaxRule(resource: any): resource is TaxRule; + relationship(id: string | ResourceId): TaxRuleRel; + type(): string; +} +export default TaxRules; +export { TaxRule, TaxRuleCreate, TaxRuleUpdate }; diff --git a/lib/esm/resources/tax_rules.js b/lib/esm/resources/tax_rules.js new file mode 100644 index 00000000..b8e4faf0 --- /dev/null +++ b/lib/esm/resources/tax_rules.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isTaxRule(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="tax_rules";export default s; \ No newline at end of file diff --git a/lib/esm/resources/taxjar_accounts.d.ts b/lib/esm/resources/taxjar_accounts.d.ts new file mode 100644 index 00000000..d3c502d2 --- /dev/null +++ b/lib/esm/resources/taxjar_accounts.d.ts @@ -0,0 +1,40 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { TaxCategory } from './tax_categories'; +import { Market } from './markets'; +import { Attachment } from './attachments'; +declare type TaxjarAccountRel = ResourceId & { + type: typeof TaxjarAccounts.TYPE; +}; +declare type TaxCategoryRel = ResourceId & { + type: 'tax_categories'; +}; +interface TaxjarAccount extends Resource { + name?: string; + tax_categories?: TaxCategory[]; + markets?: Market[]; + attachments?: Attachment[]; +} +interface TaxjarAccountCreate extends ResourceCreate { + name: string; + api_key: string; + tax_categories?: TaxCategoryRel[]; +} +interface TaxjarAccountUpdate extends ResourceUpdate { + name?: string; + api_key?: string; + tax_categories?: TaxCategoryRel[]; +} +declare class TaxjarAccounts extends ApiResource { + static readonly TYPE: 'taxjar_accounts'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: TaxjarAccountCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: TaxjarAccountUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isTaxjarAccount(resource: any): resource is TaxjarAccount; + relationship(id: string | ResourceId): TaxjarAccountRel; + type(): string; +} +export default TaxjarAccounts; +export { TaxjarAccount, TaxjarAccountCreate, TaxjarAccountUpdate }; diff --git a/lib/esm/resources/taxjar_accounts.js b/lib/esm/resources/taxjar_accounts.js new file mode 100644 index 00000000..23922784 --- /dev/null +++ b/lib/esm/resources/taxjar_accounts.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,t){return this.resources.list({type:s.TYPE},e,t)}async create(e,t,r){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async retrieve(e,t,r){return this.resources.retrieve({type:s.TYPE,id:e},t,r)}async update(e,t,r){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),t,r)}async delete(e,t){await this.resources.delete({type:s.TYPE,id:e},t)}isTaxjarAccount(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="taxjar_accounts";export default s; \ No newline at end of file diff --git a/lib/esm/resources/transactions.d.ts b/lib/esm/resources/transactions.d.ts new file mode 100644 index 00000000..19e07d3b --- /dev/null +++ b/lib/esm/resources/transactions.d.ts @@ -0,0 +1,30 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +declare type TransactionRel = ResourceId & { + type: typeof Transactions.TYPE; +}; +interface Transaction extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + order?: Order; +} +declare class Transactions extends ApiResource { + static readonly TYPE: 'transactions'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isTransaction(resource: any): resource is Transaction; + relationship(id: string | ResourceId): TransactionRel; + type(): string; +} +export default Transactions; +export { Transaction }; diff --git a/lib/esm/resources/transactions.js b/lib/esm/resources/transactions.js new file mode 100644 index 00000000..f51ebae3 --- /dev/null +++ b/lib/esm/resources/transactions.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}isTransaction(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="transactions";export default r; \ No newline at end of file diff --git a/lib/esm/resources/voids.d.ts b/lib/esm/resources/voids.d.ts new file mode 100644 index 00000000..1969291d --- /dev/null +++ b/lib/esm/resources/voids.d.ts @@ -0,0 +1,32 @@ +import { ApiResource, Resource, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +import { Authorization } from './authorizations'; +declare type VoidRel = ResourceId & { + type: typeof Voids.TYPE; +}; +interface Void extends Resource { + number?: string; + currency_code?: string; + amount_cents?: number; + amount_float?: number; + formatted_amount?: string; + succeeded?: boolean; + message?: string; + error_code?: string; + error_detail?: string; + token?: string; + gateway_transaction_id?: string; + order?: Order; + reference_authorization?: Authorization; +} +declare class Voids extends ApiResource { + static readonly TYPE: 'voids'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + isVoid(resource: any): resource is Void; + relationship(id: string | ResourceId): VoidRel; + type(): string; +} +export default Voids; +export { Void }; diff --git a/lib/esm/resources/voids.js b/lib/esm/resources/voids.js new file mode 100644 index 00000000..025c62b0 --- /dev/null +++ b/lib/esm/resources/voids.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,s){return this.resources.list({type:r.TYPE},e,s)}async retrieve(e,s,t){return this.resources.retrieve({type:r.TYPE,id:e},s,t)}isVoid(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="voids";export default r; \ No newline at end of file diff --git a/lib/esm/resources/webhooks.d.ts b/lib/esm/resources/webhooks.d.ts new file mode 100644 index 00000000..23f0a518 --- /dev/null +++ b/lib/esm/resources/webhooks.d.ts @@ -0,0 +1,41 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { EventCallback } from './event_callbacks'; +declare type WebhookRel = ResourceId & { + type: typeof Webhooks.TYPE; +}; +interface Webhook extends Resource { + name?: string; + topic?: string; + callback_url?: string; + include_resources?: string[]; + circuit_state?: string; + circuit_failure_count?: number; + last_event_callbacks?: EventCallback[]; +} +interface WebhookCreate extends ResourceCreate { + name?: string; + topic: string; + callback_url: string; + include_resources?: string[]; +} +interface WebhookUpdate extends ResourceUpdate { + name?: string; + topic?: string; + callback_url?: string; + include_resources?: string[]; + _reset_circuit?: boolean; +} +declare class Webhooks extends ApiResource { + static readonly TYPE: 'webhooks'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: WebhookCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: WebhookUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isWebhook(resource: any): resource is Webhook; + relationship(id: string | ResourceId): WebhookRel; + type(): string; +} +export default Webhooks; +export { Webhook, WebhookCreate, WebhookUpdate }; diff --git a/lib/esm/resources/webhooks.js b/lib/esm/resources/webhooks.js new file mode 100644 index 00000000..be2a01e0 --- /dev/null +++ b/lib/esm/resources/webhooks.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class s extends i{async list(e,r){return this.resources.list({type:s.TYPE},e,r)}async create(e,r,t){return this.resources.create(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async retrieve(e,r,t){return this.resources.retrieve({type:s.TYPE,id:e},r,t)}async update(e,r,t){return this.resources.update(Object.assign(Object.assign({},e),{type:s.TYPE}),r,t)}async delete(e,r){await this.resources.delete({type:s.TYPE,id:e},r)}isWebhook(e){return e.type&&e.type===s.TYPE}relationship(e){return typeof e=="string"?{id:e,type:s.TYPE}:{id:e.id,type:s.TYPE}}type(){return s.TYPE}}s.TYPE="webhooks";export default s; \ No newline at end of file diff --git a/lib/esm/resources/wire_transfers.d.ts b/lib/esm/resources/wire_transfers.d.ts new file mode 100644 index 00000000..d62de117 --- /dev/null +++ b/lib/esm/resources/wire_transfers.d.ts @@ -0,0 +1,31 @@ +import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourcesConfig, ResourceId, ListResponse } from '../resource'; +import { /* QueryBuilderRetrieve, QueryBuilderList, */ QueryParamsList, QueryParamsRetrieve } from '../query'; +import { Order } from './orders'; +declare type WireTransferRel = ResourceId & { + type: typeof WireTransfers.TYPE; +}; +declare type OrderRel = ResourceId & { + type: 'orders'; +}; +interface WireTransfer extends Resource { + order?: Order; +} +interface WireTransferCreate extends ResourceCreate { + order: OrderRel; +} +interface WireTransferUpdate extends ResourceUpdate { + order?: OrderRel; +} +declare class WireTransfers extends ApiResource { + static readonly TYPE: 'wire_transfers'; + list(params?: QueryParamsList, options?: ResourcesConfig): Promise>; + create(resource: WireTransferCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + retrieve(id: string, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + update(resource: WireTransferUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise; + delete(id: string, options?: ResourcesConfig): Promise; + isWireTransfer(resource: any): resource is WireTransfer; + relationship(id: string | ResourceId): WireTransferRel; + type(): string; +} +export default WireTransfers; +export { WireTransfer, WireTransferCreate, WireTransferUpdate }; diff --git a/lib/esm/resources/wire_transfers.js b/lib/esm/resources/wire_transfers.js new file mode 100644 index 00000000..5a326c36 --- /dev/null +++ b/lib/esm/resources/wire_transfers.js @@ -0,0 +1 @@ +import{ApiResource as i}from"../resource";class r extends i{async list(e,t){return this.resources.list({type:r.TYPE},e,t)}async create(e,t,s){return this.resources.create(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async retrieve(e,t,s){return this.resources.retrieve({type:r.TYPE,id:e},t,s)}async update(e,t,s){return this.resources.update(Object.assign(Object.assign({},e),{type:r.TYPE}),t,s)}async delete(e,t){await this.resources.delete({type:r.TYPE,id:e},t)}isWireTransfer(e){return e.type&&e.type===r.TYPE}relationship(e){return typeof e=="string"?{id:e,type:r.TYPE}:{id:e.id,type:r.TYPE}}type(){return r.TYPE}}r.TYPE="wire_transfers";export default r; \ No newline at end of file diff --git a/lib/esm/static.d.ts b/lib/esm/static.d.ts new file mode 100644 index 00000000..5c5a2fd3 --- /dev/null +++ b/lib/esm/static.d.ts @@ -0,0 +1,6 @@ +import { SdkError, ApiError } from './error'; +export declare const CommerceLayerStatic: { + resources: () => readonly string[]; + isSdkError: (error: unknown) => error is SdkError; + isApiError: (error: unknown) => error is ApiError; +}; diff --git a/lib/esm/static.js b/lib/esm/static.js new file mode 100644 index 00000000..8454a6d9 --- /dev/null +++ b/lib/esm/static.js @@ -0,0 +1 @@ +import*as o from"./api";import{SdkError as i,ApiError as s}from"./error";export const CommerceLayerStatic={resources:()=>o.resourceList,isSdkError:r=>i.isSdkError(r),isApiError:r=>s.isApiError(r)}; \ No newline at end of file diff --git a/lib/esm/util.d.ts b/lib/esm/util.d.ts new file mode 100644 index 00000000..fca07084 --- /dev/null +++ b/lib/esm/util.d.ts @@ -0,0 +1,3 @@ +/// +declare const sleep: (ms: number) => Promise; +export { sleep }; diff --git a/lib/esm/util.js b/lib/esm/util.js new file mode 100644 index 00000000..8777b9b6 --- /dev/null +++ b/lib/esm/util.js @@ -0,0 +1 @@ +const t=async e=>new Promise(s=>setTimeout(s,e));export{t as sleep}; \ No newline at end of file diff --git a/package.json b/package.json index 31186de1..5373dd88 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@commercelayer/sdk", - "version": "4.0.0", + "version": "4.1.0", "main": "lib/cjs/index.js", "types": "lib/cjs/index.d.ts", "module": "lib/esm/index.js",