@commercelayer/sdk 5.0.0-alpha.5 → 5.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +201 -123
- package/lib/cjs/api.d.ts +128 -0
- package/lib/cjs/api.js +342 -0
- package/lib/cjs/client.d.ts +33 -0
- package/lib/cjs/client.js +126 -0
- package/lib/cjs/commercelayer.d.ts +139 -0
- package/lib/cjs/commercelayer.js +230 -0
- package/lib/cjs/common.d.ts +4 -0
- package/lib/cjs/common.js +12 -0
- package/lib/cjs/config.d.ts +12 -0
- package/lib/cjs/config.js +14 -0
- package/lib/cjs/debug.d.ts +3 -0
- package/lib/cjs/debug.js +38 -0
- package/lib/cjs/error.d.ts +28 -0
- package/lib/cjs/error.js +40 -0
- package/lib/cjs/index.d.ts +8 -0
- package/lib/cjs/index.js +29 -0
- package/lib/cjs/interceptor.d.ts +25 -0
- package/lib/cjs/interceptor.js +2 -0
- package/lib/cjs/jsonapi.d.ts +5 -0
- package/lib/cjs/jsonapi.js +86 -0
- package/lib/cjs/model.d.ts +111 -0
- package/lib/cjs/model.js +3 -0
- package/lib/cjs/query.d.ts +25 -0
- package/lib/cjs/query.js +52 -0
- package/lib/cjs/resource.d.ts +87 -0
- package/lib/cjs/resource.js +170 -0
- package/lib/cjs/resources/addresses.d.ts +88 -0
- package/lib/cjs/resources/addresses.js +29 -0
- package/lib/cjs/resources/adjustments.d.ts +35 -0
- package/lib/cjs/resources/adjustments.js +25 -0
- package/lib/cjs/resources/adyen_gateways.d.ts +56 -0
- package/lib/cjs/resources/adyen_gateways.js +33 -0
- package/lib/cjs/resources/adyen_payments.d.ts +46 -0
- package/lib/cjs/resources/adyen_payments.js +33 -0
- package/lib/cjs/resources/application.d.ts +21 -0
- package/lib/cjs/resources/application.js +16 -0
- package/lib/cjs/resources/attachments.d.ts +156 -0
- package/lib/cjs/resources/attachments.js +25 -0
- package/lib/cjs/resources/authorizations.d.ts +60 -0
- package/lib/cjs/resources/authorizations.js +35 -0
- package/lib/cjs/resources/avalara_accounts.d.ts +55 -0
- package/lib/cjs/resources/avalara_accounts.js +37 -0
- package/lib/cjs/resources/axerve_gateways.d.ts +43 -0
- package/lib/cjs/resources/axerve_gateways.js +33 -0
- package/lib/cjs/resources/axerve_payments.d.ts +46 -0
- package/lib/cjs/resources/axerve_payments.js +33 -0
- package/lib/cjs/resources/billing_info_validation_rules.d.ts +35 -0
- package/lib/cjs/resources/billing_info_validation_rules.js +33 -0
- package/lib/cjs/resources/bing_geocoders.d.ts +35 -0
- package/lib/cjs/resources/bing_geocoders.js +33 -0
- package/lib/cjs/resources/braintree_gateways.d.ts +56 -0
- package/lib/cjs/resources/braintree_gateways.js +33 -0
- package/lib/cjs/resources/braintree_payments.d.ts +48 -0
- package/lib/cjs/resources/braintree_payments.js +33 -0
- package/lib/cjs/resources/bundles.d.ts +76 -0
- package/lib/cjs/resources/bundles.js +41 -0
- package/lib/cjs/resources/captures.d.ts +51 -0
- package/lib/cjs/resources/captures.js +35 -0
- package/lib/cjs/resources/carrier_accounts.d.ts +26 -0
- package/lib/cjs/resources/carrier_accounts.js +24 -0
- package/lib/cjs/resources/checkout_com_gateways.d.ts +45 -0
- package/lib/cjs/resources/checkout_com_gateways.js +33 -0
- package/lib/cjs/resources/checkout_com_payments.d.ts +59 -0
- package/lib/cjs/resources/checkout_com_payments.js +33 -0
- package/lib/cjs/resources/cleanups.d.ts +36 -0
- package/lib/cjs/resources/cleanups.js +26 -0
- package/lib/cjs/resources/coupon_codes_promotion_rules.d.ts +59 -0
- package/lib/cjs/resources/coupon_codes_promotion_rules.js +29 -0
- package/lib/cjs/resources/coupon_recipients.d.ts +44 -0
- package/lib/cjs/resources/coupon_recipients.js +33 -0
- package/lib/cjs/resources/coupons.d.ts +45 -0
- package/lib/cjs/resources/coupons.js +29 -0
- package/lib/cjs/resources/customer_addresses.d.ts +44 -0
- package/lib/cjs/resources/customer_addresses.js +37 -0
- package/lib/cjs/resources/customer_groups.d.ts +36 -0
- package/lib/cjs/resources/customer_groups.js +37 -0
- package/lib/cjs/resources/customer_password_resets.d.ts +36 -0
- package/lib/cjs/resources/customer_password_resets.js +33 -0
- package/lib/cjs/resources/customer_payment_sources.d.ts +78 -0
- package/lib/cjs/resources/customer_payment_sources.js +29 -0
- package/lib/cjs/resources/customer_subscriptions.d.ts +31 -0
- package/lib/cjs/resources/customer_subscriptions.js +33 -0
- package/lib/cjs/resources/customers.d.ts +66 -0
- package/lib/cjs/resources/customers.js +65 -0
- package/lib/cjs/resources/delivery_lead_times.d.ts +51 -0
- package/lib/cjs/resources/delivery_lead_times.js +37 -0
- package/lib/cjs/resources/event_callbacks.d.ts +24 -0
- package/lib/cjs/resources/event_callbacks.js +20 -0
- package/lib/cjs/resources/events.d.ts +24 -0
- package/lib/cjs/resources/events.js +24 -0
- package/lib/cjs/resources/exports.d.ts +40 -0
- package/lib/cjs/resources/exports.js +26 -0
- package/lib/cjs/resources/external_gateways.d.ts +49 -0
- package/lib/cjs/resources/external_gateways.js +33 -0
- package/lib/cjs/resources/external_payments.d.ts +44 -0
- package/lib/cjs/resources/external_payments.js +37 -0
- package/lib/cjs/resources/external_promotions.d.ts +90 -0
- package/lib/cjs/resources/external_promotions.js +49 -0
- package/lib/cjs/resources/external_tax_calculators.d.ts +37 -0
- package/lib/cjs/resources/external_tax_calculators.js +33 -0
- package/lib/cjs/resources/fixed_amount_promotions.d.ts +91 -0
- package/lib/cjs/resources/fixed_amount_promotions.js +49 -0
- package/lib/cjs/resources/fixed_price_promotions.d.ts +102 -0
- package/lib/cjs/resources/fixed_price_promotions.js +57 -0
- package/lib/cjs/resources/free_gift_promotions.d.ts +100 -0
- package/lib/cjs/resources/free_gift_promotions.js +57 -0
- package/lib/cjs/resources/free_shipping_promotions.d.ts +83 -0
- package/lib/cjs/resources/free_shipping_promotions.js +45 -0
- package/lib/cjs/resources/geocoders.d.ts +24 -0
- package/lib/cjs/resources/geocoders.js +24 -0
- package/lib/cjs/resources/gift_card_recipients.d.ts +44 -0
- package/lib/cjs/resources/gift_card_recipients.js +33 -0
- package/lib/cjs/resources/gift_cards.d.ts +85 -0
- package/lib/cjs/resources/gift_cards.js +41 -0
- package/lib/cjs/resources/google_geocoders.d.ts +35 -0
- package/lib/cjs/resources/google_geocoders.js +33 -0
- package/lib/cjs/resources/imports.d.ts +45 -0
- package/lib/cjs/resources/imports.js +26 -0
- package/lib/cjs/resources/in_stock_subscriptions.d.ts +62 -0
- package/lib/cjs/resources/in_stock_subscriptions.js +41 -0
- package/lib/cjs/resources/inventory_models.d.ts +42 -0
- package/lib/cjs/resources/inventory_models.js +37 -0
- package/lib/cjs/resources/inventory_return_locations.d.ts +43 -0
- package/lib/cjs/resources/inventory_return_locations.js +33 -0
- package/lib/cjs/resources/inventory_stock_locations.d.ts +46 -0
- package/lib/cjs/resources/inventory_stock_locations.js +33 -0
- package/lib/cjs/resources/klarna_gateways.d.ts +44 -0
- package/lib/cjs/resources/klarna_gateways.js +33 -0
- package/lib/cjs/resources/klarna_payments.d.ts +46 -0
- package/lib/cjs/resources/klarna_payments.js +33 -0
- package/lib/cjs/resources/line_item_options.d.ts +57 -0
- package/lib/cjs/resources/line_item_options.js +33 -0
- package/lib/cjs/resources/line_items.d.ts +126 -0
- package/lib/cjs/resources/line_items.js +41 -0
- package/lib/cjs/resources/manual_gateways.d.ts +30 -0
- package/lib/cjs/resources/manual_gateways.js +29 -0
- package/lib/cjs/resources/manual_tax_calculators.d.ts +41 -0
- package/lib/cjs/resources/manual_tax_calculators.js +37 -0
- package/lib/cjs/resources/markets.d.ts +88 -0
- package/lib/cjs/resources/markets.js +49 -0
- package/lib/cjs/resources/merchants.d.ts +38 -0
- package/lib/cjs/resources/merchants.js +33 -0
- package/lib/cjs/resources/order_amount_promotion_rules.d.ts +56 -0
- package/lib/cjs/resources/order_amount_promotion_rules.js +25 -0
- package/lib/cjs/resources/order_copies.d.ts +48 -0
- package/lib/cjs/resources/order_copies.js +38 -0
- package/lib/cjs/resources/order_subscriptions.d.ts +70 -0
- package/lib/cjs/resources/order_subscriptions.js +49 -0
- package/lib/cjs/resources/order_validation_rules.d.ts +23 -0
- package/lib/cjs/resources/order_validation_rules.js +24 -0
- package/lib/cjs/resources/orders.d.ts +296 -0
- package/lib/cjs/resources/orders.js +105 -0
- package/lib/cjs/resources/organization.d.ts +32 -0
- package/lib/cjs/resources/organization.js +16 -0
- package/lib/cjs/resources/packages.d.ts +56 -0
- package/lib/cjs/resources/packages.js +37 -0
- package/lib/cjs/resources/parcel_line_items.d.ts +51 -0
- package/lib/cjs/resources/parcel_line_items.js +33 -0
- package/lib/cjs/resources/parcels.d.ts +119 -0
- package/lib/cjs/resources/parcels.js +45 -0
- package/lib/cjs/resources/payment_gateways.d.ts +21 -0
- package/lib/cjs/resources/payment_gateways.js +20 -0
- package/lib/cjs/resources/payment_methods.d.ts +72 -0
- package/lib/cjs/resources/payment_methods.js +37 -0
- package/lib/cjs/resources/paypal_gateways.d.ts +37 -0
- package/lib/cjs/resources/paypal_gateways.js +33 -0
- package/lib/cjs/resources/paypal_payments.d.ts +52 -0
- package/lib/cjs/resources/paypal_payments.js +33 -0
- package/lib/cjs/resources/percentage_discount_promotions.d.ts +100 -0
- package/lib/cjs/resources/percentage_discount_promotions.js +57 -0
- package/lib/cjs/resources/price_lists.d.ts +39 -0
- package/lib/cjs/resources/price_lists.js +33 -0
- package/lib/cjs/resources/price_tiers.d.ts +28 -0
- package/lib/cjs/resources/price_tiers.js +24 -0
- package/lib/cjs/resources/price_volume_tiers.d.ts +46 -0
- package/lib/cjs/resources/price_volume_tiers.js +33 -0
- package/lib/cjs/resources/prices.d.ts +68 -0
- package/lib/cjs/resources/prices.js +45 -0
- package/lib/cjs/resources/promotion_rules.d.ts +23 -0
- package/lib/cjs/resources/promotion_rules.js +16 -0
- package/lib/cjs/resources/promotions.d.ts +41 -0
- package/lib/cjs/resources/promotions.js +36 -0
- package/lib/cjs/resources/refunds.d.ts +37 -0
- package/lib/cjs/resources/refunds.js +28 -0
- package/lib/cjs/resources/return_line_items.d.ts +49 -0
- package/lib/cjs/resources/return_line_items.js +33 -0
- package/lib/cjs/resources/returns.d.ts +75 -0
- package/lib/cjs/resources/returns.js +57 -0
- package/lib/cjs/resources/satispay_gateways.d.ts +39 -0
- package/lib/cjs/resources/satispay_gateways.js +33 -0
- package/lib/cjs/resources/satispay_payments.d.ts +43 -0
- package/lib/cjs/resources/satispay_payments.js +33 -0
- package/lib/cjs/resources/shipments.d.ts +93 -0
- package/lib/cjs/resources/shipments.js +75 -0
- package/lib/cjs/resources/shipping_categories.d.ts +33 -0
- package/lib/cjs/resources/shipping_categories.js +33 -0
- package/lib/cjs/resources/shipping_method_tiers.d.ts +28 -0
- package/lib/cjs/resources/shipping_method_tiers.js +24 -0
- package/lib/cjs/resources/shipping_methods.d.ts +107 -0
- package/lib/cjs/resources/shipping_methods.js +57 -0
- package/lib/cjs/resources/shipping_weight_tiers.d.ts +46 -0
- package/lib/cjs/resources/shipping_weight_tiers.js +33 -0
- package/lib/cjs/resources/shipping_zones.d.ts +48 -0
- package/lib/cjs/resources/shipping_zones.js +29 -0
- package/lib/cjs/resources/sku_list_items.d.ts +47 -0
- package/lib/cjs/resources/sku_list_items.js +33 -0
- package/lib/cjs/resources/sku_list_promotion_rules.d.ts +68 -0
- package/lib/cjs/resources/sku_list_promotion_rules.js +33 -0
- package/lib/cjs/resources/sku_lists.d.ts +60 -0
- package/lib/cjs/resources/sku_lists.js +45 -0
- package/lib/cjs/resources/sku_options.d.ts +56 -0
- package/lib/cjs/resources/sku_options.js +33 -0
- package/lib/cjs/resources/skus.d.ts +78 -0
- package/lib/cjs/resources/skus.js +49 -0
- package/lib/cjs/resources/stock_items.d.ts +49 -0
- package/lib/cjs/resources/stock_items.js +37 -0
- package/lib/cjs/resources/stock_line_items.d.ts +29 -0
- package/lib/cjs/resources/stock_line_items.js +28 -0
- package/lib/cjs/resources/stock_locations.d.ts +57 -0
- package/lib/cjs/resources/stock_locations.js +49 -0
- package/lib/cjs/resources/stock_transfers.d.ts +74 -0
- package/lib/cjs/resources/stock_transfers.js +49 -0
- package/lib/cjs/resources/stripe_gateways.d.ts +41 -0
- package/lib/cjs/resources/stripe_gateways.js +33 -0
- package/lib/cjs/resources/stripe_payments.d.ts +47 -0
- package/lib/cjs/resources/stripe_payments.js +33 -0
- package/lib/cjs/resources/tax_calculators.d.ts +24 -0
- package/lib/cjs/resources/tax_calculators.js +24 -0
- package/lib/cjs/resources/tax_categories.d.ts +59 -0
- package/lib/cjs/resources/tax_categories.js +33 -0
- package/lib/cjs/resources/tax_rules.d.ts +69 -0
- package/lib/cjs/resources/tax_rules.js +29 -0
- package/lib/cjs/resources/taxjar_accounts.d.ts +43 -0
- package/lib/cjs/resources/taxjar_accounts.js +37 -0
- package/lib/cjs/resources/transactions.d.ts +31 -0
- package/lib/cjs/resources/transactions.js +20 -0
- package/lib/cjs/resources/voids.d.ts +37 -0
- package/lib/cjs/resources/voids.js +28 -0
- package/lib/cjs/resources/webhooks.d.ts +43 -0
- package/lib/cjs/resources/webhooks.js +29 -0
- package/lib/cjs/resources/wire_transfers.d.ts +33 -0
- package/lib/cjs/resources/wire_transfers.js +29 -0
- package/lib/cjs/static.d.ts +9 -0
- package/lib/cjs/static.js +45 -0
- package/lib/cjs/util.d.ts +10 -0
- package/lib/cjs/util.js +15 -0
- package/lib/esm/api.d.ts +128 -0
- package/lib/esm/api.js +226 -0
- package/lib/esm/client.d.ts +33 -0
- package/lib/esm/client.js +121 -0
- package/lib/esm/commercelayer.d.ts +139 -0
- package/lib/esm/commercelayer.js +201 -0
- package/lib/esm/common.d.ts +4 -0
- package/lib/esm/common.js +8 -0
- package/lib/esm/config.d.ts +12 -0
- package/lib/esm/config.js +12 -0
- package/lib/esm/debug.d.ts +3 -0
- package/lib/esm/debug.js +36 -0
- package/lib/esm/error.d.ts +28 -0
- package/lib/esm/error.js +35 -0
- package/lib/esm/index.d.ts +8 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/interceptor.d.ts +25 -0
- package/lib/esm/interceptor.js +1 -0
- package/lib/esm/jsonapi.d.ts +5 -0
- package/lib/esm/jsonapi.js +79 -0
- package/lib/esm/model.d.ts +111 -0
- package/lib/esm/model.js +2 -0
- package/lib/esm/query.d.ts +25 -0
- package/lib/esm/query.js +45 -0
- package/lib/esm/resource.d.ts +87 -0
- package/lib/esm/resource.js +163 -0
- package/lib/esm/resources/addresses.d.ts +88 -0
- package/lib/esm/resources/addresses.js +27 -0
- package/lib/esm/resources/adjustments.d.ts +35 -0
- package/lib/esm/resources/adjustments.js +23 -0
- package/lib/esm/resources/adyen_gateways.d.ts +56 -0
- package/lib/esm/resources/adyen_gateways.js +31 -0
- package/lib/esm/resources/adyen_payments.d.ts +46 -0
- package/lib/esm/resources/adyen_payments.js +31 -0
- package/lib/esm/resources/application.d.ts +21 -0
- package/lib/esm/resources/application.js +14 -0
- package/lib/esm/resources/attachments.d.ts +156 -0
- package/lib/esm/resources/attachments.js +23 -0
- package/lib/esm/resources/authorizations.d.ts +60 -0
- package/lib/esm/resources/authorizations.js +33 -0
- package/lib/esm/resources/avalara_accounts.d.ts +55 -0
- package/lib/esm/resources/avalara_accounts.js +35 -0
- package/lib/esm/resources/axerve_gateways.d.ts +43 -0
- package/lib/esm/resources/axerve_gateways.js +31 -0
- package/lib/esm/resources/axerve_payments.d.ts +46 -0
- package/lib/esm/resources/axerve_payments.js +31 -0
- package/lib/esm/resources/billing_info_validation_rules.d.ts +35 -0
- package/lib/esm/resources/billing_info_validation_rules.js +31 -0
- package/lib/esm/resources/bing_geocoders.d.ts +35 -0
- package/lib/esm/resources/bing_geocoders.js +31 -0
- package/lib/esm/resources/braintree_gateways.d.ts +56 -0
- package/lib/esm/resources/braintree_gateways.js +31 -0
- package/lib/esm/resources/braintree_payments.d.ts +48 -0
- package/lib/esm/resources/braintree_payments.js +31 -0
- package/lib/esm/resources/bundles.d.ts +76 -0
- package/lib/esm/resources/bundles.js +39 -0
- package/lib/esm/resources/captures.d.ts +51 -0
- package/lib/esm/resources/captures.js +33 -0
- package/lib/esm/resources/carrier_accounts.d.ts +26 -0
- package/lib/esm/resources/carrier_accounts.js +22 -0
- package/lib/esm/resources/checkout_com_gateways.d.ts +45 -0
- package/lib/esm/resources/checkout_com_gateways.js +31 -0
- package/lib/esm/resources/checkout_com_payments.d.ts +59 -0
- package/lib/esm/resources/checkout_com_payments.js +31 -0
- package/lib/esm/resources/cleanups.d.ts +36 -0
- package/lib/esm/resources/cleanups.js +24 -0
- package/lib/esm/resources/coupon_codes_promotion_rules.d.ts +59 -0
- package/lib/esm/resources/coupon_codes_promotion_rules.js +27 -0
- package/lib/esm/resources/coupon_recipients.d.ts +44 -0
- package/lib/esm/resources/coupon_recipients.js +31 -0
- package/lib/esm/resources/coupons.d.ts +45 -0
- package/lib/esm/resources/coupons.js +27 -0
- package/lib/esm/resources/customer_addresses.d.ts +44 -0
- package/lib/esm/resources/customer_addresses.js +35 -0
- package/lib/esm/resources/customer_groups.d.ts +36 -0
- package/lib/esm/resources/customer_groups.js +35 -0
- package/lib/esm/resources/customer_password_resets.d.ts +36 -0
- package/lib/esm/resources/customer_password_resets.js +31 -0
- package/lib/esm/resources/customer_payment_sources.d.ts +78 -0
- package/lib/esm/resources/customer_payment_sources.js +27 -0
- package/lib/esm/resources/customer_subscriptions.d.ts +31 -0
- package/lib/esm/resources/customer_subscriptions.js +31 -0
- package/lib/esm/resources/customers.d.ts +66 -0
- package/lib/esm/resources/customers.js +63 -0
- package/lib/esm/resources/delivery_lead_times.d.ts +51 -0
- package/lib/esm/resources/delivery_lead_times.js +35 -0
- package/lib/esm/resources/event_callbacks.d.ts +24 -0
- package/lib/esm/resources/event_callbacks.js +18 -0
- package/lib/esm/resources/events.d.ts +24 -0
- package/lib/esm/resources/events.js +22 -0
- package/lib/esm/resources/exports.d.ts +40 -0
- package/lib/esm/resources/exports.js +24 -0
- package/lib/esm/resources/external_gateways.d.ts +49 -0
- package/lib/esm/resources/external_gateways.js +31 -0
- package/lib/esm/resources/external_payments.d.ts +44 -0
- package/lib/esm/resources/external_payments.js +35 -0
- package/lib/esm/resources/external_promotions.d.ts +90 -0
- package/lib/esm/resources/external_promotions.js +47 -0
- package/lib/esm/resources/external_tax_calculators.d.ts +37 -0
- package/lib/esm/resources/external_tax_calculators.js +31 -0
- package/lib/esm/resources/fixed_amount_promotions.d.ts +91 -0
- package/lib/esm/resources/fixed_amount_promotions.js +47 -0
- package/lib/esm/resources/fixed_price_promotions.d.ts +102 -0
- package/lib/esm/resources/fixed_price_promotions.js +55 -0
- package/lib/esm/resources/free_gift_promotions.d.ts +100 -0
- package/lib/esm/resources/free_gift_promotions.js +55 -0
- package/lib/esm/resources/free_shipping_promotions.d.ts +83 -0
- package/lib/esm/resources/free_shipping_promotions.js +43 -0
- package/lib/esm/resources/geocoders.d.ts +24 -0
- package/lib/esm/resources/geocoders.js +22 -0
- package/lib/esm/resources/gift_card_recipients.d.ts +44 -0
- package/lib/esm/resources/gift_card_recipients.js +31 -0
- package/lib/esm/resources/gift_cards.d.ts +85 -0
- package/lib/esm/resources/gift_cards.js +39 -0
- package/lib/esm/resources/google_geocoders.d.ts +35 -0
- package/lib/esm/resources/google_geocoders.js +31 -0
- package/lib/esm/resources/imports.d.ts +45 -0
- package/lib/esm/resources/imports.js +24 -0
- package/lib/esm/resources/in_stock_subscriptions.d.ts +62 -0
- package/lib/esm/resources/in_stock_subscriptions.js +39 -0
- package/lib/esm/resources/inventory_models.d.ts +42 -0
- package/lib/esm/resources/inventory_models.js +35 -0
- package/lib/esm/resources/inventory_return_locations.d.ts +43 -0
- package/lib/esm/resources/inventory_return_locations.js +31 -0
- package/lib/esm/resources/inventory_stock_locations.d.ts +46 -0
- package/lib/esm/resources/inventory_stock_locations.js +31 -0
- package/lib/esm/resources/klarna_gateways.d.ts +44 -0
- package/lib/esm/resources/klarna_gateways.js +31 -0
- package/lib/esm/resources/klarna_payments.d.ts +46 -0
- package/lib/esm/resources/klarna_payments.js +31 -0
- package/lib/esm/resources/line_item_options.d.ts +57 -0
- package/lib/esm/resources/line_item_options.js +31 -0
- package/lib/esm/resources/line_items.d.ts +126 -0
- package/lib/esm/resources/line_items.js +39 -0
- package/lib/esm/resources/manual_gateways.d.ts +30 -0
- package/lib/esm/resources/manual_gateways.js +27 -0
- package/lib/esm/resources/manual_tax_calculators.d.ts +41 -0
- package/lib/esm/resources/manual_tax_calculators.js +35 -0
- package/lib/esm/resources/markets.d.ts +88 -0
- package/lib/esm/resources/markets.js +47 -0
- package/lib/esm/resources/merchants.d.ts +38 -0
- package/lib/esm/resources/merchants.js +31 -0
- package/lib/esm/resources/order_amount_promotion_rules.d.ts +56 -0
- package/lib/esm/resources/order_amount_promotion_rules.js +23 -0
- package/lib/esm/resources/order_copies.d.ts +48 -0
- package/lib/esm/resources/order_copies.js +36 -0
- package/lib/esm/resources/order_subscriptions.d.ts +70 -0
- package/lib/esm/resources/order_subscriptions.js +47 -0
- package/lib/esm/resources/order_validation_rules.d.ts +23 -0
- package/lib/esm/resources/order_validation_rules.js +22 -0
- package/lib/esm/resources/orders.d.ts +296 -0
- package/lib/esm/resources/orders.js +103 -0
- package/lib/esm/resources/organization.d.ts +32 -0
- package/lib/esm/resources/organization.js +14 -0
- package/lib/esm/resources/packages.d.ts +56 -0
- package/lib/esm/resources/packages.js +35 -0
- package/lib/esm/resources/parcel_line_items.d.ts +51 -0
- package/lib/esm/resources/parcel_line_items.js +31 -0
- package/lib/esm/resources/parcels.d.ts +119 -0
- package/lib/esm/resources/parcels.js +43 -0
- package/lib/esm/resources/payment_gateways.d.ts +21 -0
- package/lib/esm/resources/payment_gateways.js +18 -0
- package/lib/esm/resources/payment_methods.d.ts +72 -0
- package/lib/esm/resources/payment_methods.js +35 -0
- package/lib/esm/resources/paypal_gateways.d.ts +37 -0
- package/lib/esm/resources/paypal_gateways.js +31 -0
- package/lib/esm/resources/paypal_payments.d.ts +52 -0
- package/lib/esm/resources/paypal_payments.js +31 -0
- package/lib/esm/resources/percentage_discount_promotions.d.ts +100 -0
- package/lib/esm/resources/percentage_discount_promotions.js +55 -0
- package/lib/esm/resources/price_lists.d.ts +39 -0
- package/lib/esm/resources/price_lists.js +31 -0
- package/lib/esm/resources/price_tiers.d.ts +28 -0
- package/lib/esm/resources/price_tiers.js +22 -0
- package/lib/esm/resources/price_volume_tiers.d.ts +46 -0
- package/lib/esm/resources/price_volume_tiers.js +31 -0
- package/lib/esm/resources/prices.d.ts +68 -0
- package/lib/esm/resources/prices.js +43 -0
- package/lib/esm/resources/promotion_rules.d.ts +23 -0
- package/lib/esm/resources/promotion_rules.js +14 -0
- package/lib/esm/resources/promotions.d.ts +41 -0
- package/lib/esm/resources/promotions.js +34 -0
- package/lib/esm/resources/refunds.d.ts +37 -0
- package/lib/esm/resources/refunds.js +26 -0
- package/lib/esm/resources/return_line_items.d.ts +49 -0
- package/lib/esm/resources/return_line_items.js +31 -0
- package/lib/esm/resources/returns.d.ts +75 -0
- package/lib/esm/resources/returns.js +55 -0
- package/lib/esm/resources/satispay_gateways.d.ts +39 -0
- package/lib/esm/resources/satispay_gateways.js +31 -0
- package/lib/esm/resources/satispay_payments.d.ts +43 -0
- package/lib/esm/resources/satispay_payments.js +31 -0
- package/lib/esm/resources/shipments.d.ts +93 -0
- package/lib/esm/resources/shipments.js +73 -0
- package/lib/esm/resources/shipping_categories.d.ts +33 -0
- package/lib/esm/resources/shipping_categories.js +31 -0
- package/lib/esm/resources/shipping_method_tiers.d.ts +28 -0
- package/lib/esm/resources/shipping_method_tiers.js +22 -0
- package/lib/esm/resources/shipping_methods.d.ts +107 -0
- package/lib/esm/resources/shipping_methods.js +55 -0
- package/lib/esm/resources/shipping_weight_tiers.d.ts +46 -0
- package/lib/esm/resources/shipping_weight_tiers.js +31 -0
- package/lib/esm/resources/shipping_zones.d.ts +48 -0
- package/lib/esm/resources/shipping_zones.js +27 -0
- package/lib/esm/resources/sku_list_items.d.ts +47 -0
- package/lib/esm/resources/sku_list_items.js +31 -0
- package/lib/esm/resources/sku_list_promotion_rules.d.ts +68 -0
- package/lib/esm/resources/sku_list_promotion_rules.js +31 -0
- package/lib/esm/resources/sku_lists.d.ts +60 -0
- package/lib/esm/resources/sku_lists.js +43 -0
- package/lib/esm/resources/sku_options.d.ts +56 -0
- package/lib/esm/resources/sku_options.js +31 -0
- package/lib/esm/resources/skus.d.ts +78 -0
- package/lib/esm/resources/skus.js +47 -0
- package/lib/esm/resources/stock_items.d.ts +49 -0
- package/lib/esm/resources/stock_items.js +35 -0
- package/lib/esm/resources/stock_line_items.d.ts +29 -0
- package/lib/esm/resources/stock_line_items.js +26 -0
- package/lib/esm/resources/stock_locations.d.ts +57 -0
- package/lib/esm/resources/stock_locations.js +47 -0
- package/lib/esm/resources/stock_transfers.d.ts +74 -0
- package/lib/esm/resources/stock_transfers.js +47 -0
- package/lib/esm/resources/stripe_gateways.d.ts +41 -0
- package/lib/esm/resources/stripe_gateways.js +31 -0
- package/lib/esm/resources/stripe_payments.d.ts +47 -0
- package/lib/esm/resources/stripe_payments.js +31 -0
- package/lib/esm/resources/tax_calculators.d.ts +24 -0
- package/lib/esm/resources/tax_calculators.js +22 -0
- package/lib/esm/resources/tax_categories.d.ts +59 -0
- package/lib/esm/resources/tax_categories.js +31 -0
- package/lib/esm/resources/tax_rules.d.ts +69 -0
- package/lib/esm/resources/tax_rules.js +27 -0
- package/lib/esm/resources/taxjar_accounts.d.ts +43 -0
- package/lib/esm/resources/taxjar_accounts.js +35 -0
- package/lib/esm/resources/transactions.d.ts +31 -0
- package/lib/esm/resources/transactions.js +18 -0
- package/lib/esm/resources/voids.d.ts +37 -0
- package/lib/esm/resources/voids.js +26 -0
- package/lib/esm/resources/webhooks.d.ts +43 -0
- package/lib/esm/resources/webhooks.js +27 -0
- package/lib/esm/resources/wire_transfers.d.ts +33 -0
- package/lib/esm/resources/wire_transfers.js +27 -0
- package/lib/esm/static.d.ts +9 -0
- package/lib/esm/static.js +19 -0
- package/lib/esm/util.d.ts +10 -0
- package/lib/esm/util.js +11 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +27 -36
- package/lib/api.d.ts +0 -1
- package/lib/api.js +0 -1
- package/lib/client.d.ts +0 -2
- package/lib/client.js +0 -1
- package/lib/commercelayer.d.ts +0 -1
- package/lib/commercelayer.js +0 -1
- package/lib/common.d.ts +0 -1
- package/lib/common.js +0 -1
- package/lib/config.d.ts +0 -1
- package/lib/config.js +0 -1
- package/lib/debug.d.ts +0 -1
- package/lib/debug.js +0 -1
- package/lib/error.d.ts +0 -1
- package/lib/error.js +0 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/interceptor.d.ts +0 -1
- package/lib/interceptor.js +0 -1
- package/lib/jsonapi.d.ts +0 -1
- package/lib/jsonapi.js +0 -1
- package/lib/model.d.ts +0 -1
- package/lib/model.js +0 -1
- package/lib/query.d.ts +0 -1
- package/lib/query.js +0 -1
- package/lib/resource.d.ts +0 -1
- package/lib/resource.js +0 -1
- package/lib/resources/addresses.d.ts +0 -1
- package/lib/resources/addresses.js +0 -1
- package/lib/resources/adjustments.d.ts +0 -1
- package/lib/resources/adjustments.js +0 -1
- package/lib/resources/adyen_gateways.d.ts +0 -1
- package/lib/resources/adyen_gateways.js +0 -1
- package/lib/resources/adyen_payments.d.ts +0 -1
- package/lib/resources/adyen_payments.js +0 -1
- package/lib/resources/application.d.ts +0 -1
- package/lib/resources/application.js +0 -1
- package/lib/resources/attachments.d.ts +0 -1
- package/lib/resources/attachments.js +0 -1
- package/lib/resources/authorizations.d.ts +0 -1
- package/lib/resources/authorizations.js +0 -1
- package/lib/resources/avalara_accounts.d.ts +0 -1
- package/lib/resources/avalara_accounts.js +0 -1
- package/lib/resources/billing_info_validation_rules.d.ts +0 -1
- package/lib/resources/billing_info_validation_rules.js +0 -1
- package/lib/resources/bing_geocoders.d.ts +0 -1
- package/lib/resources/bing_geocoders.js +0 -1
- package/lib/resources/braintree_gateways.d.ts +0 -1
- package/lib/resources/braintree_gateways.js +0 -1
- package/lib/resources/braintree_payments.d.ts +0 -1
- package/lib/resources/braintree_payments.js +0 -1
- package/lib/resources/bundles.d.ts +0 -1
- package/lib/resources/bundles.js +0 -1
- package/lib/resources/captures.d.ts +0 -1
- package/lib/resources/captures.js +0 -1
- package/lib/resources/carrier_accounts.d.ts +0 -1
- package/lib/resources/carrier_accounts.js +0 -1
- package/lib/resources/checkout_com_gateways.d.ts +0 -1
- package/lib/resources/checkout_com_gateways.js +0 -1
- package/lib/resources/checkout_com_payments.d.ts +0 -1
- package/lib/resources/checkout_com_payments.js +0 -1
- package/lib/resources/coupon_codes_promotion_rules.d.ts +0 -1
- package/lib/resources/coupon_codes_promotion_rules.js +0 -1
- package/lib/resources/coupon_recipients.d.ts +0 -1
- package/lib/resources/coupon_recipients.js +0 -1
- package/lib/resources/coupons.d.ts +0 -1
- package/lib/resources/coupons.js +0 -1
- package/lib/resources/customer_addresses.d.ts +0 -1
- package/lib/resources/customer_addresses.js +0 -1
- package/lib/resources/customer_groups.d.ts +0 -1
- package/lib/resources/customer_groups.js +0 -1
- package/lib/resources/customer_password_resets.d.ts +0 -1
- package/lib/resources/customer_password_resets.js +0 -1
- package/lib/resources/customer_payment_sources.d.ts +0 -1
- package/lib/resources/customer_payment_sources.js +0 -1
- package/lib/resources/customer_subscriptions.d.ts +0 -1
- package/lib/resources/customer_subscriptions.js +0 -1
- package/lib/resources/customers.d.ts +0 -1
- package/lib/resources/customers.js +0 -1
- package/lib/resources/delivery_lead_times.d.ts +0 -1
- package/lib/resources/delivery_lead_times.js +0 -1
- package/lib/resources/event_callbacks.d.ts +0 -1
- package/lib/resources/event_callbacks.js +0 -1
- package/lib/resources/external_gateways.d.ts +0 -1
- package/lib/resources/external_gateways.js +0 -1
- package/lib/resources/external_payments.d.ts +0 -1
- package/lib/resources/external_payments.js +0 -1
- package/lib/resources/external_promotions.d.ts +0 -1
- package/lib/resources/external_promotions.js +0 -1
- package/lib/resources/external_tax_calculators.d.ts +0 -1
- package/lib/resources/external_tax_calculators.js +0 -1
- package/lib/resources/fixed_amount_promotions.d.ts +0 -1
- package/lib/resources/fixed_amount_promotions.js +0 -1
- package/lib/resources/fixed_price_promotions.d.ts +0 -1
- package/lib/resources/fixed_price_promotions.js +0 -1
- package/lib/resources/free_gift_promotions.d.ts +0 -1
- package/lib/resources/free_gift_promotions.js +0 -1
- package/lib/resources/free_shipping_promotions.d.ts +0 -1
- package/lib/resources/free_shipping_promotions.js +0 -1
- package/lib/resources/geocoders.d.ts +0 -1
- package/lib/resources/geocoders.js +0 -1
- package/lib/resources/gift_card_recipients.d.ts +0 -1
- package/lib/resources/gift_card_recipients.js +0 -1
- package/lib/resources/gift_cards.d.ts +0 -1
- package/lib/resources/gift_cards.js +0 -1
- package/lib/resources/google_geocoders.d.ts +0 -1
- package/lib/resources/google_geocoders.js +0 -1
- package/lib/resources/imports.d.ts +0 -1
- package/lib/resources/imports.js +0 -1
- package/lib/resources/in_stock_subscriptions.d.ts +0 -1
- package/lib/resources/in_stock_subscriptions.js +0 -1
- package/lib/resources/inventory_models.d.ts +0 -1
- package/lib/resources/inventory_models.js +0 -1
- package/lib/resources/inventory_return_locations.d.ts +0 -1
- package/lib/resources/inventory_return_locations.js +0 -1
- package/lib/resources/inventory_stock_locations.d.ts +0 -1
- package/lib/resources/inventory_stock_locations.js +0 -1
- package/lib/resources/klarna_gateways.d.ts +0 -1
- package/lib/resources/klarna_gateways.js +0 -1
- package/lib/resources/klarna_payments.d.ts +0 -1
- package/lib/resources/klarna_payments.js +0 -1
- package/lib/resources/line_item_options.d.ts +0 -1
- package/lib/resources/line_item_options.js +0 -1
- package/lib/resources/line_items.d.ts +0 -1
- package/lib/resources/line_items.js +0 -1
- package/lib/resources/manual_gateways.d.ts +0 -1
- package/lib/resources/manual_gateways.js +0 -1
- package/lib/resources/manual_tax_calculators.d.ts +0 -1
- package/lib/resources/manual_tax_calculators.js +0 -1
- package/lib/resources/markets.d.ts +0 -1
- package/lib/resources/markets.js +0 -1
- package/lib/resources/merchants.d.ts +0 -1
- package/lib/resources/merchants.js +0 -1
- package/lib/resources/order_amount_promotion_rules.d.ts +0 -1
- package/lib/resources/order_amount_promotion_rules.js +0 -1
- package/lib/resources/order_copies.d.ts +0 -1
- package/lib/resources/order_copies.js +0 -1
- package/lib/resources/order_subscriptions.d.ts +0 -1
- package/lib/resources/order_subscriptions.js +0 -1
- package/lib/resources/order_validation_rules.d.ts +0 -1
- package/lib/resources/order_validation_rules.js +0 -1
- package/lib/resources/orders.d.ts +0 -1
- package/lib/resources/orders.js +0 -1
- package/lib/resources/organization.d.ts +0 -1
- package/lib/resources/organization.js +0 -1
- package/lib/resources/packages.d.ts +0 -1
- package/lib/resources/packages.js +0 -1
- package/lib/resources/parcel_line_items.d.ts +0 -1
- package/lib/resources/parcel_line_items.js +0 -1
- package/lib/resources/parcels.d.ts +0 -1
- package/lib/resources/parcels.js +0 -1
- package/lib/resources/payment_gateways.d.ts +0 -1
- package/lib/resources/payment_gateways.js +0 -1
- package/lib/resources/payment_methods.d.ts +0 -1
- package/lib/resources/payment_methods.js +0 -1
- package/lib/resources/paypal_gateways.d.ts +0 -1
- package/lib/resources/paypal_gateways.js +0 -1
- package/lib/resources/paypal_payments.d.ts +0 -1
- package/lib/resources/paypal_payments.js +0 -1
- package/lib/resources/percentage_discount_promotions.d.ts +0 -1
- package/lib/resources/percentage_discount_promotions.js +0 -1
- package/lib/resources/price_lists.d.ts +0 -1
- package/lib/resources/price_lists.js +0 -1
- package/lib/resources/prices.d.ts +0 -1
- package/lib/resources/prices.js +0 -1
- package/lib/resources/promotion_rules.d.ts +0 -1
- package/lib/resources/promotion_rules.js +0 -1
- package/lib/resources/promotions.d.ts +0 -1
- package/lib/resources/promotions.js +0 -1
- package/lib/resources/refunds.d.ts +0 -1
- package/lib/resources/refunds.js +0 -1
- package/lib/resources/return_line_items.d.ts +0 -1
- package/lib/resources/return_line_items.js +0 -1
- package/lib/resources/returns.d.ts +0 -1
- package/lib/resources/returns.js +0 -1
- package/lib/resources/shipments.d.ts +0 -1
- package/lib/resources/shipments.js +0 -1
- package/lib/resources/shipping_categories.d.ts +0 -1
- package/lib/resources/shipping_categories.js +0 -1
- package/lib/resources/shipping_methods.d.ts +0 -1
- package/lib/resources/shipping_methods.js +0 -1
- package/lib/resources/shipping_zones.d.ts +0 -1
- package/lib/resources/shipping_zones.js +0 -1
- package/lib/resources/sku_list_items.d.ts +0 -1
- package/lib/resources/sku_list_items.js +0 -1
- package/lib/resources/sku_list_promotion_rules.d.ts +0 -1
- package/lib/resources/sku_list_promotion_rules.js +0 -1
- package/lib/resources/sku_lists.d.ts +0 -1
- package/lib/resources/sku_lists.js +0 -1
- package/lib/resources/sku_options.d.ts +0 -1
- package/lib/resources/sku_options.js +0 -1
- package/lib/resources/skus.d.ts +0 -1
- package/lib/resources/skus.js +0 -1
- package/lib/resources/stock_items.d.ts +0 -1
- package/lib/resources/stock_items.js +0 -1
- package/lib/resources/stock_line_items.d.ts +0 -1
- package/lib/resources/stock_line_items.js +0 -1
- package/lib/resources/stock_locations.d.ts +0 -1
- package/lib/resources/stock_locations.js +0 -1
- package/lib/resources/stock_transfers.d.ts +0 -1
- package/lib/resources/stock_transfers.js +0 -1
- package/lib/resources/stripe_gateways.d.ts +0 -1
- package/lib/resources/stripe_gateways.js +0 -1
- package/lib/resources/stripe_payments.d.ts +0 -1
- package/lib/resources/stripe_payments.js +0 -1
- package/lib/resources/tax_calculators.d.ts +0 -1
- package/lib/resources/tax_calculators.js +0 -1
- package/lib/resources/tax_categories.d.ts +0 -1
- package/lib/resources/tax_categories.js +0 -1
- package/lib/resources/tax_rules.d.ts +0 -1
- package/lib/resources/tax_rules.js +0 -1
- package/lib/resources/taxjar_accounts.d.ts +0 -1
- package/lib/resources/taxjar_accounts.js +0 -1
- package/lib/resources/transactions.d.ts +0 -1
- package/lib/resources/transactions.js +0 -1
- package/lib/resources/voids.d.ts +0 -1
- package/lib/resources/voids.js +0 -1
- package/lib/resources/webhooks.d.ts +0 -1
- package/lib/resources/webhooks.js +0 -1
- package/lib/resources/wire_transfers.d.ts +0 -1
- package/lib/resources/wire_transfers.js +0 -1
- package/lib/static.d.ts +0 -1
- package/lib/static.js +0 -1
- package/lib/util.d.ts +0 -2
- package/lib/util.js +0 -1
package/lib/esm/query.js
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
import Debug from './debug';
|
2
|
+
const debug = Debug('query');
|
3
|
+
const isParamsList = (params) => {
|
4
|
+
return params && (params.filters || params.pageNumber || params.pageSize || params.sort);
|
5
|
+
};
|
6
|
+
const generateQueryStringParams = (params, res) => {
|
7
|
+
debug('generate query string params: %O, %O', params, res);
|
8
|
+
const qp = {};
|
9
|
+
if (!params)
|
10
|
+
return qp;
|
11
|
+
// Include
|
12
|
+
if (params.include)
|
13
|
+
qp.include = params.include.join(',');
|
14
|
+
// Fields
|
15
|
+
if (params.fields) {
|
16
|
+
if (Array.isArray(params.fields))
|
17
|
+
params.fields = { [res.type || res]: params.fields };
|
18
|
+
Object.entries(params.fields).forEach(([p, v]) => {
|
19
|
+
qp[`fields[${p}]`] = v.join(',');
|
20
|
+
});
|
21
|
+
}
|
22
|
+
if (isParamsList(params)) {
|
23
|
+
// Sort
|
24
|
+
if (params.sort) {
|
25
|
+
if (Array.isArray(params.sort))
|
26
|
+
qp.sort = params.sort.join(',');
|
27
|
+
else
|
28
|
+
qp.sort = Object.entries(params.sort).map(([k, v]) => `${v === 'desc' ? '-' : ''}${k}`).join(',');
|
29
|
+
}
|
30
|
+
// Page
|
31
|
+
if (params.pageNumber)
|
32
|
+
qp['page[number]'] = String(params.pageNumber);
|
33
|
+
if (params.pageSize)
|
34
|
+
qp['page[size]'] = String(params.pageSize);
|
35
|
+
// Filters
|
36
|
+
if (params.filters) {
|
37
|
+
Object.entries(params.filters).forEach(([p, v]) => {
|
38
|
+
qp[`filter[q][${p}]`] = String(v);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
}
|
42
|
+
debug('query string params: %O', qp);
|
43
|
+
return qp;
|
44
|
+
};
|
45
|
+
export { generateQueryStringParams, isParamsList };
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import type { ApiClientInitConfig } from './client';
|
2
|
+
import type { QueryParamsRetrieve, QueryParamsList, QueryFilter } from './query';
|
3
|
+
import type { ResourceTypeLock } from './api';
|
4
|
+
import type { InterceptorManager } from './interceptor';
|
5
|
+
import { QueryParams } from '.';
|
6
|
+
type ResourceNull = {
|
7
|
+
id: null;
|
8
|
+
} & ResourceType;
|
9
|
+
type ResourceRel = ResourceId | ResourceNull;
|
10
|
+
type Metadata = {
|
11
|
+
[key: string]: any;
|
12
|
+
};
|
13
|
+
interface ResourceType {
|
14
|
+
readonly type: ResourceTypeLock;
|
15
|
+
}
|
16
|
+
interface ResourceId extends ResourceType {
|
17
|
+
readonly id: string;
|
18
|
+
}
|
19
|
+
interface ResourceBase {
|
20
|
+
reference?: string;
|
21
|
+
reference_origin?: string;
|
22
|
+
metadata?: Metadata;
|
23
|
+
}
|
24
|
+
interface Resource extends ResourceBase, ResourceId {
|
25
|
+
readonly created_at: string;
|
26
|
+
readonly updated_at: string;
|
27
|
+
}
|
28
|
+
interface ResourceCreate extends ResourceBase {
|
29
|
+
}
|
30
|
+
interface ResourceUpdate extends ResourceBase {
|
31
|
+
readonly id: string;
|
32
|
+
}
|
33
|
+
type ListMeta = {
|
34
|
+
readonly pageCount: number;
|
35
|
+
readonly recordCount: number;
|
36
|
+
readonly currentPage: number;
|
37
|
+
readonly recordsPerPage: number;
|
38
|
+
};
|
39
|
+
declare class ListResponse<R> extends Array<R> {
|
40
|
+
readonly meta: ListMeta;
|
41
|
+
constructor(meta: ListMeta, data: R[]);
|
42
|
+
first(): R | undefined;
|
43
|
+
last(): R | undefined;
|
44
|
+
get(index: number): R | undefined;
|
45
|
+
hasNextPage(): boolean;
|
46
|
+
hasPrevPage(): boolean;
|
47
|
+
getRecordCount(): number;
|
48
|
+
getPageCount(): number;
|
49
|
+
get recordCount(): number;
|
50
|
+
get pageCount(): number;
|
51
|
+
}
|
52
|
+
export type { Metadata, ResourceType, ResourceId, Resource, ResourceCreate, ResourceUpdate, ListResponse, ResourceRel };
|
53
|
+
type ResourceAdapterConfig = {};
|
54
|
+
type ResourcesInitConfig = ResourceAdapterConfig & ApiClientInitConfig;
|
55
|
+
type ResourcesConfig = Partial<ResourcesInitConfig>;
|
56
|
+
declare class ResourceAdapter {
|
57
|
+
#private;
|
58
|
+
constructor(config: ResourcesInitConfig);
|
59
|
+
get interceptors(): InterceptorManager;
|
60
|
+
private localConfig;
|
61
|
+
config(config: ResourcesConfig): void;
|
62
|
+
singleton<R extends Resource>(resource: ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
63
|
+
retrieve<R extends Resource>(resource: ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
64
|
+
list<R extends Resource>(resource: ResourceType, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
65
|
+
create<C extends ResourceCreate, R extends Resource>(resource: C & ResourceType, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
66
|
+
update<U extends ResourceUpdate, R extends Resource>(resource: U & ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
67
|
+
delete(resource: ResourceId, options?: ResourcesConfig): Promise<void>;
|
68
|
+
fetch<R extends Resource>(resource: string | ResourceType, path: string, params?: QueryParams, options?: ResourcesConfig): Promise<R | ListResponse<R>>;
|
69
|
+
}
|
70
|
+
declare abstract class ApiResourceBase<R extends Resource> {
|
71
|
+
static readonly TYPE: ResourceTypeLock;
|
72
|
+
protected readonly resources: ResourceAdapter;
|
73
|
+
constructor(adapter: ResourceAdapter);
|
74
|
+
abstract relationship(id: string | ResourceId | null): ResourceRel;
|
75
|
+
abstract type(): ResourceTypeLock;
|
76
|
+
update(resource: ResourceUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
77
|
+
count(filter?: QueryFilter | QueryParamsList, options?: ResourcesConfig): Promise<number>;
|
78
|
+
}
|
79
|
+
declare abstract class ApiResource<R extends Resource> extends ApiResourceBase<R> {
|
80
|
+
retrieve(id: string | ResourceId, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
81
|
+
list(params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<R>>;
|
82
|
+
}
|
83
|
+
declare abstract class ApiSingleton<R extends Resource> extends ApiResourceBase<R> {
|
84
|
+
retrieve(params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<R>;
|
85
|
+
}
|
86
|
+
export default ResourceAdapter;
|
87
|
+
export { ApiResource, ApiSingleton, ResourcesConfig, ResourcesInitConfig };
|
@@ -0,0 +1,163 @@
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
+
};
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
+
};
|
12
|
+
var _ResourceAdapter_client, _ResourceAdapter_config;
|
13
|
+
import ApiClient from './client';
|
14
|
+
import { denormalize, normalize } from './jsonapi';
|
15
|
+
import { generateQueryStringParams, isParamsList } from './query';
|
16
|
+
import config from './config';
|
17
|
+
import Debug from './debug';
|
18
|
+
const debug = Debug('resource');
|
19
|
+
class ListResponse extends Array {
|
20
|
+
constructor(meta, data) {
|
21
|
+
super(...(data || []));
|
22
|
+
this.meta = meta;
|
23
|
+
}
|
24
|
+
first() { return this.length ? this[0] : undefined; }
|
25
|
+
last() { return this.length ? this[this.length - 1] : undefined; }
|
26
|
+
get(index) { return (this.length && (index >= 0)) ? this[index] : undefined; }
|
27
|
+
hasNextPage() { return (this.meta.currentPage < this.meta.pageCount); }
|
28
|
+
hasPrevPage() { return (this.meta.currentPage > 1); }
|
29
|
+
getRecordCount() { return this.meta.recordCount; }
|
30
|
+
getPageCount() { return this.meta.pageCount; }
|
31
|
+
get recordCount() { return this.meta.recordCount; }
|
32
|
+
get pageCount() { return this.meta.pageCount; }
|
33
|
+
}
|
34
|
+
class ResourceAdapter {
|
35
|
+
constructor(config) {
|
36
|
+
_ResourceAdapter_client.set(this, void 0);
|
37
|
+
_ResourceAdapter_config.set(this, {});
|
38
|
+
__classPrivateFieldSet(this, _ResourceAdapter_client, ApiClient.create(config), "f");
|
39
|
+
this.localConfig(config);
|
40
|
+
}
|
41
|
+
get interceptors() { return __classPrivateFieldGet(this, _ResourceAdapter_client, "f").interceptors; }
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
43
|
+
localConfig(config) {
|
44
|
+
// if (typeof config.xyz !== 'undefined') this.#config.xyz = config.xyz
|
45
|
+
}
|
46
|
+
config(config) {
|
47
|
+
debug('config %o', config);
|
48
|
+
// ResourceAdapter config
|
49
|
+
this.localConfig(config);
|
50
|
+
// Client config
|
51
|
+
__classPrivateFieldGet(this, _ResourceAdapter_client, "f").config(config);
|
52
|
+
}
|
53
|
+
async singleton(resource, params, options) {
|
54
|
+
debug('singleton: %o, %O, %O', resource, params || {}, options || {});
|
55
|
+
const queryParams = generateQueryStringParams(params, resource);
|
56
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
57
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
58
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
|
59
|
+
const r = denormalize(res);
|
60
|
+
return r;
|
61
|
+
}
|
62
|
+
async retrieve(resource, params, options) {
|
63
|
+
debug('retrieve: %o, %O, %O', resource, params || {}, options || {});
|
64
|
+
const queryParams = generateQueryStringParams(params, resource);
|
65
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
66
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
67
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}/${resource.id}`, undefined, { ...options, params: queryParams });
|
68
|
+
const r = denormalize(res);
|
69
|
+
return r;
|
70
|
+
}
|
71
|
+
async list(resource, params, options) {
|
72
|
+
var _a, _b;
|
73
|
+
debug('list: %o, %O, %O', resource, params || {}, options || {});
|
74
|
+
const queryParams = generateQueryStringParams(params, resource);
|
75
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
76
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
77
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', `${resource.type}`, undefined, { ...options, params: queryParams });
|
78
|
+
const r = denormalize(res);
|
79
|
+
const meta = {
|
80
|
+
pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
|
81
|
+
recordCount: Number((_b = res.meta) === null || _b === void 0 ? void 0 : _b.record_count),
|
82
|
+
currentPage: (params === null || params === void 0 ? void 0 : params.pageNumber) || config.default.pageNumber,
|
83
|
+
recordsPerPage: (params === null || params === void 0 ? void 0 : params.pageSize) || config.default.pageSize
|
84
|
+
};
|
85
|
+
return new ListResponse(meta, r);
|
86
|
+
}
|
87
|
+
async create(resource, params, options) {
|
88
|
+
debug('create: %o, %O, %O', resource, params || {}, options || {});
|
89
|
+
const queryParams = generateQueryStringParams(params, resource);
|
90
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
91
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
92
|
+
const data = normalize(resource);
|
93
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('post', resource.type, data, { ...options, params: queryParams });
|
94
|
+
const r = denormalize(res);
|
95
|
+
return r;
|
96
|
+
}
|
97
|
+
async update(resource, params, options) {
|
98
|
+
debug('update: %o, %O, %O', resource, params || {}, options || {});
|
99
|
+
const queryParams = generateQueryStringParams(params, resource);
|
100
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
101
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
102
|
+
const data = normalize(resource);
|
103
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('patch', `${resource.type}/${resource.id}`, data, { ...options, params: queryParams });
|
104
|
+
const r = denormalize(res);
|
105
|
+
return r;
|
106
|
+
}
|
107
|
+
async delete(resource, options) {
|
108
|
+
debug('delete: %o, %O', resource, options || {});
|
109
|
+
await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('delete', `${resource.type}/${resource.id}`, undefined, options);
|
110
|
+
}
|
111
|
+
async fetch(resource, path, params, options) {
|
112
|
+
var _a, _b;
|
113
|
+
debug('fetch: %o, %O, %O', path, params || {}, options || {});
|
114
|
+
const queryParams = generateQueryStringParams(params, resource);
|
115
|
+
if (options === null || options === void 0 ? void 0 : options.params)
|
116
|
+
Object.assign(queryParams, options === null || options === void 0 ? void 0 : options.params);
|
117
|
+
const res = await __classPrivateFieldGet(this, _ResourceAdapter_client, "f").request('get', path, undefined, { ...options, params: queryParams });
|
118
|
+
const r = denormalize(res);
|
119
|
+
if (Array.isArray(r)) {
|
120
|
+
const p = params;
|
121
|
+
const meta = {
|
122
|
+
pageCount: Number((_a = res.meta) === null || _a === void 0 ? void 0 : _a.page_count),
|
123
|
+
recordCount: Number((_b = res.meta) === null || _b === void 0 ? void 0 : _b.record_count),
|
124
|
+
currentPage: (p === null || p === void 0 ? void 0 : p.pageNumber) || config.default.pageNumber,
|
125
|
+
recordsPerPage: (p === null || p === void 0 ? void 0 : p.pageSize) || config.default.pageSize
|
126
|
+
};
|
127
|
+
return new ListResponse(meta, r);
|
128
|
+
}
|
129
|
+
else
|
130
|
+
return r;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
_ResourceAdapter_client = new WeakMap(), _ResourceAdapter_config = new WeakMap();
|
134
|
+
class ApiResourceBase {
|
135
|
+
constructor(adapter) {
|
136
|
+
debug('new resource instance: %s', this.type());
|
137
|
+
this.resources = adapter;
|
138
|
+
}
|
139
|
+
// reference, reference_origin and metadata attributes are always updatable
|
140
|
+
async update(resource, params, options) {
|
141
|
+
return this.resources.update({ ...resource, type: this.type() }, params, options);
|
142
|
+
}
|
143
|
+
async count(filter, options) {
|
144
|
+
const params = { filters: isParamsList(filter) ? filter.filters : filter, pageNumber: 1, pageSize: 1 };
|
145
|
+
const response = await this.resources.list({ type: this.type() }, params, options);
|
146
|
+
return Promise.resolve(response.meta.recordCount);
|
147
|
+
}
|
148
|
+
}
|
149
|
+
class ApiResource extends ApiResourceBase {
|
150
|
+
async retrieve(id, params, options) {
|
151
|
+
return this.resources.retrieve((typeof id === 'string') ? { type: this.type(), id } : id, params, options);
|
152
|
+
}
|
153
|
+
async list(params, options) {
|
154
|
+
return this.resources.list({ type: this.type() }, params, options);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
class ApiSingleton extends ApiResourceBase {
|
158
|
+
async retrieve(params, options) {
|
159
|
+
return this.resources.singleton({ type: this.type() }, params, options);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
export default ResourceAdapter;
|
163
|
+
export { ApiResource, ApiSingleton };
|
@@ -0,0 +1,88 @@
|
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
|
2
|
+
import type { QueryParamsRetrieve } from '../query';
|
3
|
+
import type { Geocoder, GeocoderType } from './geocoders';
|
4
|
+
type AddressType = 'addresses';
|
5
|
+
type AddressRel = ResourceRel & {
|
6
|
+
type: AddressType;
|
7
|
+
};
|
8
|
+
type GeocoderRel = ResourceRel & {
|
9
|
+
type: GeocoderType;
|
10
|
+
};
|
11
|
+
interface Address extends Resource {
|
12
|
+
readonly type: AddressType;
|
13
|
+
business?: boolean | null;
|
14
|
+
first_name?: string | null;
|
15
|
+
last_name?: string | null;
|
16
|
+
company?: string | null;
|
17
|
+
full_name?: string | null;
|
18
|
+
line_1: string;
|
19
|
+
line_2?: string | null;
|
20
|
+
city: string;
|
21
|
+
zip_code?: string | null;
|
22
|
+
state_code: string;
|
23
|
+
country_code: string;
|
24
|
+
phone: string;
|
25
|
+
full_address?: string | null;
|
26
|
+
name?: string | null;
|
27
|
+
email?: string | null;
|
28
|
+
notes?: string | null;
|
29
|
+
lat?: number | null;
|
30
|
+
lng?: number | null;
|
31
|
+
is_localized?: boolean | null;
|
32
|
+
is_geocoded?: boolean | null;
|
33
|
+
provider_name?: string | null;
|
34
|
+
map_url?: string | null;
|
35
|
+
static_map_url?: string | null;
|
36
|
+
billing_info?: string | null;
|
37
|
+
geocoder?: Geocoder | null;
|
38
|
+
}
|
39
|
+
interface AddressCreate extends ResourceCreate {
|
40
|
+
business?: boolean | null;
|
41
|
+
first_name?: string | null;
|
42
|
+
last_name?: string | null;
|
43
|
+
company?: string | null;
|
44
|
+
line_1: string;
|
45
|
+
line_2?: string | null;
|
46
|
+
city: string;
|
47
|
+
zip_code?: string | null;
|
48
|
+
state_code: string;
|
49
|
+
country_code: string;
|
50
|
+
phone: string;
|
51
|
+
email?: string | null;
|
52
|
+
notes?: string | null;
|
53
|
+
lat?: number | null;
|
54
|
+
lng?: number | null;
|
55
|
+
billing_info?: string | null;
|
56
|
+
geocoder?: GeocoderRel | null;
|
57
|
+
}
|
58
|
+
interface AddressUpdate extends ResourceUpdate {
|
59
|
+
business?: boolean | null;
|
60
|
+
first_name?: string | null;
|
61
|
+
last_name?: string | null;
|
62
|
+
company?: string | null;
|
63
|
+
line_1?: string | null;
|
64
|
+
line_2?: string | null;
|
65
|
+
city?: string | null;
|
66
|
+
zip_code?: string | null;
|
67
|
+
state_code?: string | null;
|
68
|
+
country_code?: string | null;
|
69
|
+
phone?: string | null;
|
70
|
+
email?: string | null;
|
71
|
+
notes?: string | null;
|
72
|
+
lat?: number | null;
|
73
|
+
lng?: number | null;
|
74
|
+
billing_info?: string | null;
|
75
|
+
geocoder?: GeocoderRel | null;
|
76
|
+
}
|
77
|
+
declare class Addresses extends ApiResource<Address> {
|
78
|
+
static readonly TYPE: AddressType;
|
79
|
+
create(resource: AddressCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
80
|
+
update(resource: AddressUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Address>;
|
81
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
82
|
+
geocoder(addressId: string | Address, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Geocoder>;
|
83
|
+
isAddress(resource: any): resource is Address;
|
84
|
+
relationship(id: string | ResourceId | null): AddressRel;
|
85
|
+
type(): AddressType;
|
86
|
+
}
|
87
|
+
export default Addresses;
|
88
|
+
export type { Address, AddressCreate, AddressUpdate, AddressType };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class Addresses extends ApiResource {
|
3
|
+
async create(resource, params, options) {
|
4
|
+
return this.resources.create({ ...resource, type: Addresses.TYPE }, params, options);
|
5
|
+
}
|
6
|
+
async update(resource, params, options) {
|
7
|
+
return this.resources.update({ ...resource, type: Addresses.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async delete(id, options) {
|
10
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: Addresses.TYPE } : id, options);
|
11
|
+
}
|
12
|
+
async geocoder(addressId, params, options) {
|
13
|
+
const _addressId = addressId.id || addressId;
|
14
|
+
return this.resources.fetch({ type: 'geocoders' }, `addresses/${_addressId}/geocoder`, params, options);
|
15
|
+
}
|
16
|
+
isAddress(resource) {
|
17
|
+
return resource.type && (resource.type === Addresses.TYPE);
|
18
|
+
}
|
19
|
+
relationship(id) {
|
20
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: Addresses.TYPE } : { id: id.id, type: Addresses.TYPE };
|
21
|
+
}
|
22
|
+
type() {
|
23
|
+
return Addresses.TYPE;
|
24
|
+
}
|
25
|
+
}
|
26
|
+
Addresses.TYPE = 'addresses';
|
27
|
+
export default Addresses;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
|
2
|
+
import type { QueryParamsRetrieve } from '../query';
|
3
|
+
type AdjustmentType = 'adjustments';
|
4
|
+
type AdjustmentRel = ResourceRel & {
|
5
|
+
type: AdjustmentType;
|
6
|
+
};
|
7
|
+
interface Adjustment extends Resource {
|
8
|
+
readonly type: AdjustmentType;
|
9
|
+
name: string;
|
10
|
+
currency_code: string;
|
11
|
+
amount_cents: number;
|
12
|
+
amount_float: number;
|
13
|
+
formatted_amount: string;
|
14
|
+
}
|
15
|
+
interface AdjustmentCreate extends ResourceCreate {
|
16
|
+
name: string;
|
17
|
+
currency_code: string;
|
18
|
+
amount_cents: number;
|
19
|
+
}
|
20
|
+
interface AdjustmentUpdate extends ResourceUpdate {
|
21
|
+
name?: string | null;
|
22
|
+
currency_code?: string | null;
|
23
|
+
amount_cents?: number | null;
|
24
|
+
}
|
25
|
+
declare class Adjustments extends ApiResource<Adjustment> {
|
26
|
+
static readonly TYPE: AdjustmentType;
|
27
|
+
create(resource: AdjustmentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
28
|
+
update(resource: AdjustmentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Adjustment>;
|
29
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
30
|
+
isAdjustment(resource: any): resource is Adjustment;
|
31
|
+
relationship(id: string | ResourceId | null): AdjustmentRel;
|
32
|
+
type(): AdjustmentType;
|
33
|
+
}
|
34
|
+
export default Adjustments;
|
35
|
+
export type { Adjustment, AdjustmentCreate, AdjustmentUpdate, AdjustmentType };
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class Adjustments extends ApiResource {
|
3
|
+
async create(resource, params, options) {
|
4
|
+
return this.resources.create({ ...resource, type: Adjustments.TYPE }, params, options);
|
5
|
+
}
|
6
|
+
async update(resource, params, options) {
|
7
|
+
return this.resources.update({ ...resource, type: Adjustments.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async delete(id, options) {
|
10
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: Adjustments.TYPE } : id, options);
|
11
|
+
}
|
12
|
+
isAdjustment(resource) {
|
13
|
+
return resource.type && (resource.type === Adjustments.TYPE);
|
14
|
+
}
|
15
|
+
relationship(id) {
|
16
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: Adjustments.TYPE } : { id: id.id, type: Adjustments.TYPE };
|
17
|
+
}
|
18
|
+
type() {
|
19
|
+
return Adjustments.TYPE;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
Adjustments.TYPE = 'adjustments';
|
23
|
+
export default Adjustments;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel, ListResponse } from '../resource';
|
2
|
+
import type { QueryParamsRetrieve, QueryParamsList } from '../query';
|
3
|
+
import type { PaymentMethod } from './payment_methods';
|
4
|
+
import type { AdyenPayment, AdyenPaymentType } from './adyen_payments';
|
5
|
+
type AdyenGatewayType = 'adyen_gateways';
|
6
|
+
type AdyenGatewayRel = ResourceRel & {
|
7
|
+
type: AdyenGatewayType;
|
8
|
+
};
|
9
|
+
type AdyenPaymentRel = ResourceRel & {
|
10
|
+
type: AdyenPaymentType;
|
11
|
+
};
|
12
|
+
interface AdyenGateway extends Resource {
|
13
|
+
readonly type: AdyenGatewayType;
|
14
|
+
name: string;
|
15
|
+
live_url_prefix: string;
|
16
|
+
async_api?: boolean | null;
|
17
|
+
webhook_endpoint_secret?: string | null;
|
18
|
+
webhook_endpoint_url?: string | null;
|
19
|
+
payment_methods?: PaymentMethod[] | null;
|
20
|
+
adyen_payments?: AdyenPayment[] | null;
|
21
|
+
}
|
22
|
+
interface AdyenGatewayCreate extends ResourceCreate {
|
23
|
+
name: string;
|
24
|
+
merchant_account: string;
|
25
|
+
api_key: string;
|
26
|
+
public_key?: string | null;
|
27
|
+
live_url_prefix: string;
|
28
|
+
api_version?: string | null;
|
29
|
+
async_api?: boolean | null;
|
30
|
+
webhook_endpoint_secret?: string | null;
|
31
|
+
adyen_payments?: AdyenPaymentRel[] | null;
|
32
|
+
}
|
33
|
+
interface AdyenGatewayUpdate extends ResourceUpdate {
|
34
|
+
name?: string | null;
|
35
|
+
merchant_account?: string | null;
|
36
|
+
api_key?: string | null;
|
37
|
+
public_key?: string | null;
|
38
|
+
live_url_prefix?: string | null;
|
39
|
+
api_version?: string | null;
|
40
|
+
async_api?: boolean | null;
|
41
|
+
webhook_endpoint_secret?: string | null;
|
42
|
+
adyen_payments?: AdyenPaymentRel[] | null;
|
43
|
+
}
|
44
|
+
declare class AdyenGateways extends ApiResource<AdyenGateway> {
|
45
|
+
static readonly TYPE: AdyenGatewayType;
|
46
|
+
create(resource: AdyenGatewayCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenGateway>;
|
47
|
+
update(resource: AdyenGatewayUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenGateway>;
|
48
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
49
|
+
payment_methods(adyenGatewayId: string | AdyenGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<PaymentMethod>>;
|
50
|
+
adyen_payments(adyenGatewayId: string | AdyenGateway, params?: QueryParamsList, options?: ResourcesConfig): Promise<ListResponse<AdyenPayment>>;
|
51
|
+
isAdyenGateway(resource: any): resource is AdyenGateway;
|
52
|
+
relationship(id: string | ResourceId | null): AdyenGatewayRel;
|
53
|
+
type(): AdyenGatewayType;
|
54
|
+
}
|
55
|
+
export default AdyenGateways;
|
56
|
+
export type { AdyenGateway, AdyenGatewayCreate, AdyenGatewayUpdate, AdyenGatewayType };
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class AdyenGateways extends ApiResource {
|
3
|
+
async create(resource, params, options) {
|
4
|
+
return this.resources.create({ ...resource, type: AdyenGateways.TYPE }, params, options);
|
5
|
+
}
|
6
|
+
async update(resource, params, options) {
|
7
|
+
return this.resources.update({ ...resource, type: AdyenGateways.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async delete(id, options) {
|
10
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: AdyenGateways.TYPE } : id, options);
|
11
|
+
}
|
12
|
+
async payment_methods(adyenGatewayId, params, options) {
|
13
|
+
const _adyenGatewayId = adyenGatewayId.id || adyenGatewayId;
|
14
|
+
return this.resources.fetch({ type: 'payment_methods' }, `adyen_gateways/${_adyenGatewayId}/payment_methods`, params, options);
|
15
|
+
}
|
16
|
+
async adyen_payments(adyenGatewayId, params, options) {
|
17
|
+
const _adyenGatewayId = adyenGatewayId.id || adyenGatewayId;
|
18
|
+
return this.resources.fetch({ type: 'adyen_payments' }, `adyen_gateways/${_adyenGatewayId}/adyen_payments`, params, options);
|
19
|
+
}
|
20
|
+
isAdyenGateway(resource) {
|
21
|
+
return resource.type && (resource.type === AdyenGateways.TYPE);
|
22
|
+
}
|
23
|
+
relationship(id) {
|
24
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: AdyenGateways.TYPE } : { id: id.id, type: AdyenGateways.TYPE };
|
25
|
+
}
|
26
|
+
type() {
|
27
|
+
return AdyenGateways.TYPE;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
AdyenGateways.TYPE = 'adyen_gateways';
|
31
|
+
export default AdyenGateways;
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import { ApiResource, Resource, ResourceCreate, ResourceUpdate, ResourceId, ResourcesConfig, ResourceRel } from '../resource';
|
2
|
+
import type { QueryParamsRetrieve } from '../query';
|
3
|
+
import type { Order, OrderType } from './orders';
|
4
|
+
import type { PaymentGateway } from './payment_gateways';
|
5
|
+
type AdyenPaymentType = 'adyen_payments';
|
6
|
+
type AdyenPaymentRel = ResourceRel & {
|
7
|
+
type: AdyenPaymentType;
|
8
|
+
};
|
9
|
+
type OrderRel = ResourceRel & {
|
10
|
+
type: OrderType;
|
11
|
+
};
|
12
|
+
interface AdyenPayment extends Resource {
|
13
|
+
readonly type: AdyenPaymentType;
|
14
|
+
public_key?: string | null;
|
15
|
+
payment_methods: object;
|
16
|
+
payment_request_data?: object | null;
|
17
|
+
payment_request_details?: object | null;
|
18
|
+
payment_response?: object | null;
|
19
|
+
mismatched_amounts?: boolean | null;
|
20
|
+
payment_instrument?: object | null;
|
21
|
+
order?: Order | null;
|
22
|
+
payment_gateway?: PaymentGateway | null;
|
23
|
+
}
|
24
|
+
interface AdyenPaymentCreate extends ResourceCreate {
|
25
|
+
order: OrderRel;
|
26
|
+
}
|
27
|
+
interface AdyenPaymentUpdate extends ResourceUpdate {
|
28
|
+
payment_request_data?: object | null;
|
29
|
+
payment_request_details?: object | null;
|
30
|
+
payment_response?: object | null;
|
31
|
+
_details?: boolean | null;
|
32
|
+
order?: OrderRel | null;
|
33
|
+
}
|
34
|
+
declare class AdyenPayments extends ApiResource<AdyenPayment> {
|
35
|
+
static readonly TYPE: AdyenPaymentType;
|
36
|
+
create(resource: AdyenPaymentCreate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenPayment>;
|
37
|
+
update(resource: AdyenPaymentUpdate, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<AdyenPayment>;
|
38
|
+
delete(id: string | ResourceId, options?: ResourcesConfig): Promise<void>;
|
39
|
+
order(adyenPaymentId: string | AdyenPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<Order>;
|
40
|
+
payment_gateway(adyenPaymentId: string | AdyenPayment, params?: QueryParamsRetrieve, options?: ResourcesConfig): Promise<PaymentGateway>;
|
41
|
+
isAdyenPayment(resource: any): resource is AdyenPayment;
|
42
|
+
relationship(id: string | ResourceId | null): AdyenPaymentRel;
|
43
|
+
type(): AdyenPaymentType;
|
44
|
+
}
|
45
|
+
export default AdyenPayments;
|
46
|
+
export type { AdyenPayment, AdyenPaymentCreate, AdyenPaymentUpdate, AdyenPaymentType };
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { ApiResource } from '../resource';
|
2
|
+
class AdyenPayments extends ApiResource {
|
3
|
+
async create(resource, params, options) {
|
4
|
+
return this.resources.create({ ...resource, type: AdyenPayments.TYPE }, params, options);
|
5
|
+
}
|
6
|
+
async update(resource, params, options) {
|
7
|
+
return this.resources.update({ ...resource, type: AdyenPayments.TYPE }, params, options);
|
8
|
+
}
|
9
|
+
async delete(id, options) {
|
10
|
+
await this.resources.delete((typeof id === 'string') ? { id, type: AdyenPayments.TYPE } : id, options);
|
11
|
+
}
|
12
|
+
async order(adyenPaymentId, params, options) {
|
13
|
+
const _adyenPaymentId = adyenPaymentId.id || adyenPaymentId;
|
14
|
+
return this.resources.fetch({ type: 'orders' }, `adyen_payments/${_adyenPaymentId}/order`, params, options);
|
15
|
+
}
|
16
|
+
async payment_gateway(adyenPaymentId, params, options) {
|
17
|
+
const _adyenPaymentId = adyenPaymentId.id || adyenPaymentId;
|
18
|
+
return this.resources.fetch({ type: 'payment_gateways' }, `adyen_payments/${_adyenPaymentId}/payment_gateway`, params, options);
|
19
|
+
}
|
20
|
+
isAdyenPayment(resource) {
|
21
|
+
return resource.type && (resource.type === AdyenPayments.TYPE);
|
22
|
+
}
|
23
|
+
relationship(id) {
|
24
|
+
return ((id === null) || (typeof id === 'string')) ? { id, type: AdyenPayments.TYPE } : { id: id.id, type: AdyenPayments.TYPE };
|
25
|
+
}
|
26
|
+
type() {
|
27
|
+
return AdyenPayments.TYPE;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
AdyenPayments.TYPE = 'adyen_payments';
|
31
|
+
export default AdyenPayments;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import { ApiSingleton, Resource, ResourceId, ResourceRel } from '../resource';
|
2
|
+
type ApplicationType = 'application';
|
3
|
+
type ApplicationRel = ResourceRel & {
|
4
|
+
type: ApplicationType;
|
5
|
+
};
|
6
|
+
interface Application extends Resource {
|
7
|
+
readonly type: ApplicationType;
|
8
|
+
name?: string | null;
|
9
|
+
kind?: string | null;
|
10
|
+
public_access?: boolean | null;
|
11
|
+
redirect_uri?: string | null;
|
12
|
+
scopes?: string | null;
|
13
|
+
}
|
14
|
+
declare class Applications extends ApiSingleton<Application> {
|
15
|
+
static readonly TYPE: ApplicationType;
|
16
|
+
isApplication(resource: any): resource is Application;
|
17
|
+
relationship(id: string | ResourceId | null): ApplicationRel;
|
18
|
+
type(): ApplicationType;
|
19
|
+
}
|
20
|
+
export default Applications;
|
21
|
+
export type { Application, ApplicationType };
|