diff --git a/.gitignore b/.gitignore index 13f590ed..2a4fa45b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/react-query +/.speakeasy/reports /funcs /core.* /__tests__ diff --git a/.npmignore b/.npmignore index 06cd8abf..9ad259ee 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,7 @@ **/* +!/FUNCTIONS.md +!/RUNTIMES.md +!/REACT_QUERY.md !/**/*.ts !/**/*.js !/**/*.map diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index ccdadab5..acbae047 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 4f7e8ab5-4c00-496a-9710-e7c707e4ee78 management: - docChecksum: 256e7d68eaf807fc9ef86f8311e8a13f + docChecksum: 95abafd64f919da72bea9db4df1fd39f docVersion: "2018-02-08" - speakeasyVersion: 1.401.2 - generationVersion: 2.421.3 - releaseVersion: 2.14.1 - configChecksum: bcfebe2c39e567249ac9def567cd98fe + speakeasyVersion: 1.468.2 + generationVersion: 2.493.4 + releaseVersion: 2.15.0 + configChecksum: dc009920eee1561b634768bc485393ff repoURL: https://github.com/goshippo/shippo-javascript-sdk.git installationURL: https://github.com/goshippo/shippo-javascript-sdk published: true @@ -14,12 +14,12 @@ features: typescript: additionalDependencies: 0.1.0 constsAndDefaults: 0.1.11 - core: 3.17.6 + core: 3.18.12 defaultEnabledRetries: 0.1.0 enumUnions: 0.1.0 - envVarSecurityUsage: 0.1.1 - flattening: 2.81.1 - globalSecurity: 2.82.11 + envVarSecurityUsage: 0.1.2 + flattening: 2.82.1 + globalSecurity: 2.82.12 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.4 @@ -30,14 +30,13 @@ features: nullables: 0.1.0 responseFormat: 0.2.3 retries: 2.83.0 - sdkHooks: 0.1.0 - unions: 2.85.7 - webhooks: 1.0.0 + sdkHooks: 0.2.0 + unions: 2.85.8 + webhooks: 1.4.1 generatedFiles: - .eslintrc.cjs - .gitattributes - .npmignore - - CONTRIBUTING.md - FUNCTIONS.md - RUNTIMES.md - USAGE.md @@ -187,7 +186,6 @@ generatedFiles: - docs/models/components/parcelpaginatedlist.md - docs/models/components/parcels.md - docs/models/components/parceltemplatearamexaustraliaenum.md - - docs/models/components/parceltemplatecourierspleaseenum.md - docs/models/components/parceltemplatedhlecommerceenum.md - docs/models/components/parceltemplatedpdukenum.md - docs/models/components/parceltemplateenumset.md @@ -230,7 +228,6 @@ generatedFiles: - docs/models/components/servicelevelchronopostenum.md - docs/models/components/servicelevelcolissimoenum.md - docs/models/components/servicelevelcorreosespanaenum.md - - docs/models/components/servicelevelcourierspleaseenum.md - docs/models/components/serviceleveldeutschepostenum.md - docs/models/components/serviceleveldhlecommerceenum.md - docs/models/components/serviceleveldhlexpressenum.md @@ -634,7 +631,6 @@ generatedFiles: - src/models/components/parcelinsurance.ts - src/models/components/parcelpaginatedlist.ts - src/models/components/parceltemplatearamexaustraliaenum.ts - - src/models/components/parceltemplatecourierspleaseenum.ts - src/models/components/parceltemplatedhlecommerceenum.ts - src/models/components/parceltemplatedpdukenum.ts - src/models/components/parceltemplateenumset.ts @@ -670,7 +666,6 @@ generatedFiles: - src/models/components/servicelevelchronopostenum.ts - src/models/components/servicelevelcolissimoenum.ts - src/models/components/servicelevelcorreosespanaenum.ts - - src/models/components/servicelevelcourierspleaseenum.ts - src/models/components/serviceleveldeutschepostenum.ts - src/models/components/serviceleveldhlecommerceenum.ts - src/models/components/serviceleveldhlexpressenum.ts @@ -840,6 +835,7 @@ generatedFiles: - src/types/operations.ts - src/types/rfcdate.ts - src/types/streams.ts + - src/types/webhooks.ts - tsconfig.json examples: ListAddresses: @@ -910,7 +906,7 @@ examples: header: SHIPPO-API-VERSION: "2018-02-08" requestBody: - application/json: [{"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3", "metadata": "SHIPMENT #1", "servicelevel_token": "fedex_ground", "shipment": {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_to": "d799c2679e644279b59fe661ac8fa489", "customs_declaration": "adcfdddf8ec64b84ad22772bce3ea37a", "carrier_accounts": ["065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0"], "parcels": ["", "", {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "template": "USPS_SmallFlatRateEnvelope"}]}}, {"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3", "metadata": "SHIPMENT #1", "servicelevel_token": "fedex_ground", "shipment": {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "Blumenstraße", "street3": "", "street_no": "22", "city": "München", "state": "CA", "zip": "80331", "country": "DE", "phone": "80331", "email": "shippotle@shippo.com", "is_residential": true}, "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": [], "non_delivery_option": "RETURN", "test": true}, "carrier_accounts": ["065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0"], "parcels": [{"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "template": "couriersplease_1kg_satchel"}, {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "template": "DHLeC_SM_Flats"}]}}, {"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3", "metadata": "SHIPMENT #1", "servicelevel_token": "fedex_ground", "shipment": {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": "d799c2679e644279b59fe661ac8fa488", "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_to": "d799c2679e644279b59fe661ac8fa489", "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "Blumenstraße", "street3": "", "street_no": "22", "city": "München", "state": "CA", "zip": "80331", "country": "DE", "phone": "80331", "email": "shippotle@shippo.com", "is_residential": true}, "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": [{"description": "T-Shirt", "mass_unit": "lb", "metadata": "Order ID \"123454\"", "net_weight": "5", "origin_country": "", "quantity": 20, "sku_code": "HM-123", "hs_code": "0901.21", "value_amount": "200", "value_currency": "USD"}, {"description": "T-Shirt", "mass_unit": "lb", "metadata": "Order ID \"123454\"", "net_weight": "5", "origin_country": "", "quantity": 20, "sku_code": "HM-123", "hs_code": "0901.21", "value_amount": "200", "value_currency": "USD"}, {"description": "T-Shirt", "mass_unit": "lb", "metadata": "Order ID \"123454\"", "net_weight": "5", "origin_country": "", "quantity": 20, "sku_code": "HM-123", "hs_code": "0901.21", "value_amount": "200", "value_currency": "USD"}], "non_delivery_option": "RETURN", "test": true}, "carrier_accounts": ["065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0"], "parcels": ["", "", ""]}}] + application/json: [{"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3", "metadata": "SHIPMENT #1", "servicelevel_token": "fedex_ground", "shipment": {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_to": "d799c2679e644279b59fe661ac8fa489", "customs_declaration": "adcfdddf8ec64b84ad22772bce3ea37a", "carrier_accounts": ["065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0"], "parcels": ["", "", {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "template": "USPS_SmallFlatRateEnvelope"}]}}, {"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3", "metadata": "SHIPMENT #1", "servicelevel_token": "fedex_ground", "shipment": {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "Blumenstraße", "street3": "", "street_no": "22", "city": "München", "state": "CA", "zip": "80331", "country": "DE", "phone": "80331", "email": "shippotle@shippo.com", "is_residential": true}, "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": [], "non_delivery_option": "RETURN", "test": true}, "carrier_accounts": ["065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0"], "parcels": ["", {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "template": "DHLeC_SM_Flats"}]}}, {"carrier_account": "a4391cd4ab974f478f55dc08b5c8e3b3", "metadata": "SHIPMENT #1", "servicelevel_token": "fedex_ground", "shipment": {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": "d799c2679e644279b59fe661ac8fa488", "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_to": "d799c2679e644279b59fe661ac8fa489", "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "Blumenstraße", "street3": "", "street_no": "22", "city": "München", "state": "CA", "zip": "80331", "country": "DE", "phone": "80331", "email": "shippotle@shippo.com", "is_residential": true}, "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": [{"description": "T-Shirt", "mass_unit": "lb", "metadata": "Order ID \"123454\"", "net_weight": "5", "origin_country": "", "quantity": 20, "sku_code": "HM-123", "hs_code": "0901.21", "value_amount": "200", "value_currency": "USD"}, {"description": "T-Shirt", "mass_unit": "lb", "metadata": "Order ID \"123454\"", "net_weight": "5", "origin_country": "", "quantity": 20, "sku_code": "HM-123", "hs_code": "0901.21", "value_amount": "200", "value_currency": "USD"}, {"description": "T-Shirt", "mass_unit": "lb", "metadata": "Order ID \"123454\"", "net_weight": "5", "origin_country": "", "quantity": 20, "sku_code": "HM-123", "hs_code": "0901.21", "value_amount": "200", "value_currency": "USD"}], "non_delivery_option": "RETURN", "test": true}, "carrier_accounts": ["065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0"], "parcels": ["", "", ""]}}] responses: "200": application/json: {"default_carrier_account": "078870331023437cb917f5187429b093", "default_servicelevel_token": "usps_priority", "label_filetype": "PDF_4x6", "metadata": "BATCH #1", "batch_shipments": {"next": "baseurl?page=3&results=10", "previous": "baseurl?page=1&results=10", "results": []}, "label_url": ["", ""], "object_created": "2016-01-04T00:15:44.394Z", "object_id": "5ef63c54f5bf45d3b1f8fb37dcb1c5f4", "object_owner": "shippo@shippo.com", "object_results": {"creation_failed": 3, "creation_succeeded": 5, "purchase_failed": 0, "purchase_succeeded": 0}, "object_updated": "2016-01-04T00:48:13.841Z", "status": "VALID", "test": false} @@ -1194,7 +1190,7 @@ examples: SHIPPO-API-VERSION: "2018-02-08" responses: "200": - application/json: {"next": "baseurl?page=3&results=10", "previous": "baseurl?page=1&results=10", "results": [{"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"}]} + application/json: {"next": "baseurl?page=3&results=10", "previous": "baseurl?page=1&results=10", "results": [{"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}]} CreateParcel: speakeasy-default-create-parcel: parameters: @@ -1204,7 +1200,7 @@ examples: application/json: {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"} responses: "201": - application/json: {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"} + application/json: {"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"} GetParcel: speakeasy-default-get-parcel: parameters: @@ -1214,7 +1210,7 @@ examples: SHIPPO-API-VERSION: "2018-02-08" responses: "200": - application/json: {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"} + application/json: {"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"} CreatePickup: speakeasy-default-create-pickup: parameters: @@ -1329,7 +1325,7 @@ examples: SHIPPO-API-VERSION: "2018-02-08" responses: "200": - application/json: {"next": "baseurl?page=3&results=10", "previous": "baseurl?page=1&results=10", "results": [{"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "carrier_accounts": [], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [], "object_created": "2023-11-28T13:02:27.296Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-12-02T18:25:37.169Z", "parcels": [{"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"}], "rates": [], "status": "QUEUED"}, {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "carrier_accounts": ["", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2023-11-26T18:23:24.264Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2022-01-09T04:26:27.312Z", "parcels": [{"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"}], "rates": [], "status": "QUEUED"}, {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "carrier_accounts": ["", "", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2024-08-18T13:00:42.665Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-06-22T03:00:04.393Z", "parcels": [{"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"}], "rates": [], "status": "QUEUED"}]} + application/json: {"next": "baseurl?page=3&results=10", "previous": "baseurl?page=1&results=10", "results": [{"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "carrier_accounts": [], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [], "object_created": "2023-11-28T13:02:27.296Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-12-02T18:25:37.169Z", "parcels": [{"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}], "rates": [], "status": "QUEUED"}, {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "carrier_accounts": ["", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2023-11-26T18:23:24.264Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2022-01-09T04:26:27.312Z", "parcels": [{"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}], "rates": [], "status": "QUEUED"}, {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "carrier_accounts": ["", "", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2024-08-18T13:00:42.665Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-06-22T03:00:04.393Z", "parcels": [{"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}], "rates": [], "status": "QUEUED"}]} CreateShipment: speakeasy-default-create-shipment: parameters: @@ -1339,7 +1335,7 @@ examples: application/json: {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "address_return": "d799c2679e644279b59fe661ac8fa488", "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "validate": true}, "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "Blumenstraße", "street3": "", "street_no": "22", "city": "München", "state": "CA", "zip": "80331", "country": "DE", "phone": "80331", "email": "shippotle@shippo.com", "is_residential": true}, "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": [], "non_delivery_option": "RETURN", "test": true}, "carrier_accounts": ["065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0"], "parcels": ["", {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}, {"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}]} responses: "201": - application/json: {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "carrier_accounts": ["", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2024-11-15T07:40:19.243Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-01-27T07:05:06.005Z", "parcels": [{"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"}], "rates": [{"amount": "5.5", "amount_local": "5.5", "currency": "USD", "currency_local": "USD", "arrives_by": "08:30:00", "attributes": [], "carrier_account": "078870331023437cb917f5187429b093", "duration_terms": "Delivery in 1 to 3 business days", "estimated_days": 2, "included_insurance_price": "1.05", "messages": [], "object_created": "2022-08-20T15:01:30.899Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "provider": "USPS", "provider_image_75": "https://cdn2.goshippo.com/providers/75/USPS.png", "provider_image_200": "https://cdn2.goshippo.com/providers/200/USPS.png", "servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, "shipment": "adcfdddf8ec64b84ad22772bce3ea37a", "zone": "1"}], "status": "QUEUED"} + application/json: {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": []}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "carrier_accounts": ["", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2024-11-15T07:40:19.243Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-01-27T07:05:06.005Z", "parcels": [{"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}], "rates": [{"amount": "5.5", "amount_local": "5.5", "currency": "USD", "currency_local": "USD", "arrives_by": "08:30:00", "attributes": [], "carrier_account": "078870331023437cb917f5187429b093", "duration_terms": "Delivery in 1 to 3 business days", "estimated_days": 2, "included_insurance_price": "1.05", "messages": [], "object_created": "2022-08-20T15:01:30.899Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "provider": "USPS", "provider_image_75": "https://cdn2.goshippo.com/providers/75/USPS.png", "provider_image_200": "https://cdn2.goshippo.com/providers/200/USPS.png", "servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, "shipment": "adcfdddf8ec64b84ad22772bce3ea37a", "zone": "1"}], "status": "QUEUED"} GetShipment: speakeasy-default-get-shipment: parameters: @@ -1349,7 +1345,7 @@ examples: SHIPPO-API-VERSION: "2018-02-08" responses: "200": - application/json: {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "carrier_accounts": ["", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2023-05-18T00:32:02.244Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-05-10T02:28:23.533Z", "parcels": [{"extra": {"COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "insurance": {"amount": "5.5", "content": "Laptop", "currency": "USD", "provider": "UPS"}}, "metadata": "Customer ID 123456", "mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1", "object_created": "2014-07-09T02:19:13.174Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "shippotle@shippo.com", "object_state": "VALID", "object_updated": "2014-07-09T02:19:13.174Z"}], "rates": [{"amount": "5.5", "amount_local": "5.5", "currency": "USD", "currency_local": "USD", "arrives_by": "08:30:00", "attributes": [], "carrier_account": "078870331023437cb917f5187429b093", "duration_terms": "Delivery in 1 to 3 business days", "estimated_days": 2, "included_insurance_price": "1.05", "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2023-04-26T04:53:50.189Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "provider": "USPS", "provider_image_75": "https://cdn2.goshippo.com/providers/75/USPS.png", "provider_image_200": "https://cdn2.goshippo.com/providers/200/USPS.png", "servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, "shipment": "adcfdddf8ec64b84ad22772bce3ea37a", "zone": "1"}], "status": "QUEUED"} + application/json: {"extra": {"accounts_receivable_customer_account": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "appropriation_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "bill_of_lading_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "COD": {"amount": "5.5", "currency": "USD", "payment_method": "CASH"}, "cod_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "customer_reference": {"ref_sort": 1}, "dealer_order_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "dept_number": {"ref_sort": 3}, "fda_product_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "insurance": {"amount": "5.5", "currency": "USD"}, "invoice_number": {"ref_sort": 2}, "manifest_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "model_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "part_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "po_number": {"ref_sort": 2}, "production_code": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "purchase_request_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "rma_number": {"ref_sort": 1}, "salesperson_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "serial_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "store_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}, "transaction_reference_number": {"prefix": "ABC", "value": "value", "ref_sort": 1}}, "metadata": "Customer ID 123456", "shipment_date": "2021-03-22T12:00:00Z", "address_from": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_return": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "address_to": {"name": "Shwan Ippotle", "company": "Shippo", "street1": "215 Clayton St.", "street3": "", "street_no": "", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "shippotle@shippo.com", "is_residential": true, "metadata": "Customer ID 123456", "is_complete": true, "object_created": "2014-07-09T02:19:13.174Z", "object_id": "d799c2679e644279b59fe661ac8fa488", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-09T02:19:13.174Z", "validation_results": {"is_valid": false, "messages": [{"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}, {"code": "Unknown Street", "source": "Shippo Address Validator", "text": "City, State and ZIP Code are valid, but street address is not a match.", "type": "address_warning"}]}, "test": false}, "carrier_accounts": ["", ""], "customs_declaration": {"b13a_filing_option": "FILED_ELECTRONICALLY", "certify": true, "certify_signer": "Shawn Ippotle", "contents_explanation": "T-Shirt purchase", "duties_payor": {"account": "2323434543", "type": "THIRD_PARTY", "address": {"name": "Patrick Kavanagh", "zip": "80331", "country": "DE"}}, "exporter_identification": {"eori_number": "PL123456790ABCDE", "tax_id": {"number": "123456789", "type": "EIN"}}, "invoice": "#123123", "metadata": "Order ID #123123", "address_importer": "257ba08436604d2aaf069caafe7acb2a", "contents_type": "MERCHANDISE", "eel_pfc": "NOEEI_30_37_a", "incoterm": "DDP", "items": ["5087f181d1dc4b14b73fdbf636498886"], "non_delivery_option": "RETURN", "object_created": "2014-07-17T01:01:08.306Z", "object_id": "e2197a54da9d470480f4f8796cc419cb", "object_owner": "shippotle@shippo.com", "object_updated": "2014-07-17T01:01:08.306Z", "test": true}, "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2023-05-18T00:32:02.244Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "object_updated": "2023-05-10T02:28:23.533Z", "parcels": [{"mass_unit": "lb", "weight": "1", "distance_unit": "in", "height": "1", "length": "1", "width": "1"}], "rates": [{"amount": "5.5", "amount_local": "5.5", "currency": "USD", "currency_local": "USD", "arrives_by": "08:30:00", "attributes": [], "carrier_account": "078870331023437cb917f5187429b093", "duration_terms": "Delivery in 1 to 3 business days", "estimated_days": 2, "included_insurance_price": "1.05", "messages": [{"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}, {"source": "UPS", "code": "carrier_timeout", "text": "UPS API did not respond. Please try again in a few minutes."}], "object_created": "2023-04-26T04:53:50.189Z", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "object_owner": "pp@gmail.com", "provider": "USPS", "provider_image_75": "https://cdn2.goshippo.com/providers/75/USPS.png", "provider_image_200": "https://cdn2.goshippo.com/providers/200/USPS.png", "servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, "shipment": "adcfdddf8ec64b84ad22772bce3ea37a", "zone": "1"}], "status": "QUEUED"} CreateTrack: speakeasy-default-create-track: parameters: @@ -1525,4 +1521,13 @@ examples: parameters: path: webhookId: "" + batch: {} + track: + speakeasy-default-track: + requestBody: + application/json: {"data": {"address_from": {"city": "Las Vegas", "country": "US", "state": "NV", "zip": "89101"}, "address_to": {"city": "Las Vegas", "country": "US", "state": "NV", "zip": "89101"}, "carrier": "usps", "messages": [""], "metadata": "Order 000123", "original_eta": "2021-07-23T00:00:00Z", "servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express", "parent_servicelevel": {"name": "Priority Mail Express", "token": "usps_priority_express"}}, "tracking_history": [{"location": {"city": "Las Vegas", "country": "US", "state": "NV", "zip": "89101"}, "object_created": "2024-07-24T17:47:12.180Z", "object_id": "", "object_updated": "2024-02-21T22:35:19.645Z", "status": "DELIVERED", "substatus": {"code": "information_received", "text": "Information about the package received.", "action_required": true}, "status_date": "2016-07-23T00:00:00Z", "status_details": "Your shipment has been delivered at the destination mailbox."}], "tracking_number": "9205590164917312751089", "tracking_status": {"location": {"city": "Las Vegas", "country": "US", "state": "NV", "zip": "89101"}, "object_created": "2025-05-20T11:37:56.914Z", "object_id": "", "object_updated": "2024-06-06T16:48:30.895Z", "status": "DELIVERED", "substatus": {"code": "information_received", "text": "Information about the package received.", "action_required": true}, "status_date": "2016-07-23T00:00:00Z", "status_details": "Your shipment has been delivered at the destination mailbox."}}} + transaction: + speakeasy-default-transaction: + requestBody: + application/json: {"data": {"created_by": {"first_name": "Shwan", "last_name": "Ippotle", "username": "shippotle@shippo.com"}, "label_file_type": "PDF_4x6", "label_url": "https://shippo-delivery.s3.amazonaws.com/70ae8117ee1749e393f249d5b77c45e0.pdf?Signature=vDw1ltcyGveVR1OQoUDdzC43BY8%3D&Expires=1437093830&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", "messages": [], "object_id": "915d94940ea54c3a80cbfa328722f5a1", "object_owner": "shippotle@shippo.com", "parcel": "e94c7fdfdc7b495dbb390a28d929d90a", "qr_code_url": "https://shippo-delivery.s3.amazonaws.com/96_qr_code.pdf?Signature=PEdWrp0mFWAGwJp7FW3b%2FeA2eyY%3D&Expires=1385930652&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", "rate": {"amount": "5.5", "amount_local": "5.5", "currency": "USD", "currency_local": "USD", "object_id": "adcfdddf8ec64b84ad22772bce3ea37a", "provider": "USPS", "carrier_account": "078870331023437cb917f5187429b093", "servicelevel_name": "Priority Mail", "servicelevel_token": "fedex_ground"}, "status": "SUCCESS", "tracking_number": "9499907123456123456781", "tracking_status": "DELIVERED", "tracking_url_provider": "https://tools.usps.com/go/TrackConfirmAction_input?origTrackNum=9499907123456123456781"}} generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index dcb6e41a..c7d3f6ac 100755 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -11,8 +11,9 @@ generation: requestResponseComponentNamesFeb2024: true auth: oAuth2ClientCredentialsEnabled: true + oAuth2PasswordEnabled: false typescript: - version: 2.14.1 + version: 2.15.0 additionalDependencies: dependencies: {} devDependencies: @@ -27,6 +28,7 @@ typescript: author: Shippo clientServerStatusCodesAsErrors: true defaultErrorName: SDKError + enableCustomCodeRegions: false enableReactQuery: false enumFormat: union flattenGlobalSecurity: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 19faa948..564163c8 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,20 +1,21 @@ -speakeasyVersion: 1.401.2 +speakeasyVersion: 1.468.2 sources: openapi: sourceNamespace: openapi - sourceRevisionDigest: sha256:67380a5740d2ebf50c6b5d4ecd48d398c184e281c8302c0d0306220da7535048 - sourceBlobDigest: sha256:d1d1d6dbb27ba9c1d86549fa879da10167c9890d2d3443c087c7b8555971a12c + sourceRevisionDigest: sha256:069cc0ce8814063f548ab5845d36d34cd2bb5a399cd0c688dc4c6f752a7e9c8b + sourceBlobDigest: sha256:cd9da3407a166b3f3649622b362cd9710086eee23be01fef701736f0c030f6ed tags: - latest - - main + - speakeasy-sdk-regen-1732753737 + - "2018-02-08" targets: first-target: source: openapi sourceNamespace: openapi - sourceRevisionDigest: sha256:67380a5740d2ebf50c6b5d4ecd48d398c184e281c8302c0d0306220da7535048 - sourceBlobDigest: sha256:d1d1d6dbb27ba9c1d86549fa879da10167c9890d2d3443c087c7b8555971a12c - codeSamplesNamespace: openapi-code-samples - codeSamplesRevisionDigest: sha256:df1a9ca170bc417e1e111efbc10b1f07765943764cb1cbd046d9b6efc18cfc43 + sourceRevisionDigest: sha256:069cc0ce8814063f548ab5845d36d34cd2bb5a399cd0c688dc4c6f752a7e9c8b + sourceBlobDigest: sha256:cd9da3407a166b3f3649622b362cd9710086eee23be01fef701736f0c030f6ed + codeSamplesNamespace: openapi-typescript-code-samples + codeSamplesRevisionDigest: sha256:d86e97539e320e0cba0c36fc012364826627ac9e9d8b1782549ce70be6eaacc8 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest @@ -32,6 +33,6 @@ workflow: npm: token: $npm_token codeSamples: - output: "" registry: - location: registry.speakeasyapi.dev/shippo/shippo/openapi-code-samples + location: registry.speakeasyapi.dev/shippo/shippo/openapi-typescript-code-samples + blocking: false diff --git a/.speakeasy/workflow.yaml b/.speakeasy/workflow.yaml index c0ab4da1..eaca99d0 100644 --- a/.speakeasy/workflow.yaml +++ b/.speakeasy/workflow.yaml @@ -15,5 +15,5 @@ targets: token: $npm_token codeSamples: registry: - location: registry.speakeasyapi.dev/shippo/shippo/openapi-code-samples + location: registry.speakeasyapi.dev/shippo/shippo/openapi-typescript-code-samples blocking: false diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index d585717f..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,26 +0,0 @@ -# Contributing to This Repository - -Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements. - -## How to Report Issues - -If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes: - -- A clear and descriptive title -- Steps to reproduce the issue -- Expected and actual behavior -- Any relevant logs, screenshots, or error messages -- Information about your environment (e.g., operating system, software versions) - - For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed - -## Issue Triage and Upstream Fixes - -We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code. - -## Contact - -If you have any questions or need further assistance, please feel free to reach out by opening an issue. - -Thank you for your understanding and cooperation! - -The Maintainers diff --git a/FUNCTIONS.md b/FUNCTIONS.md index 10f7d409..c3de6906 100644 --- a/FUNCTIONS.md +++ b/FUNCTIONS.md @@ -53,7 +53,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); diff --git a/README.md b/README.md index 3cdd3027..b4093ecc 100644 --- a/README.md +++ b/README.md @@ -20,18 +20,22 @@ Shippo external API.: Use this API to integrate with the Shippo service ## Table of Contents + +* [Shippo logo Shippo JavaScript SDK](#img-srchttpsdocsgoshippocomimageslogopng-width30-altshippo-logo-shippo-javascript-sdk) + * [SDK Installation](#sdk-installation) + * [Requirements](#requirements) + * [SDK Example Usage](#sdk-example-usage) + * [Standalone functions](#standalone-functions) + * [Retries](#retries) + * [Custom HTTP Client](#custom-http-client) + * [Debugging](#debugging) + * [Documentation](#documentation) + * [Available Resources and Operations](#available-resources-and-operations) +* [Development](#development) + * [Maturity](#maturity) + * [Contributions](#contributions) + * [About Shippo](#about-shippo) -* [SDK Installation](#sdk-installation) -* [Requirements](#requirements) -* [SDK Example Usage](#sdk-example-usage) -* [Available Resources and Operations](#available-resources-and-operations) -* [Standalone functions](#standalone-functions) -* [Retries](#retries) -* [Error Handling](#error-handling) -* [Server Selection](#server-selection) -* [Custom HTTP Client](#custom-http-client) -* [Authentication](#authentication) -* [Debugging](#debugging) @@ -117,77 +121,76 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md). Available standalone functions -- [addressesCreate](docs/sdks/addresses/README.md#create) -- [addressesGet](docs/sdks/addresses/README.md#get) -- [addressesList](docs/sdks/addresses/README.md#list) -- [addressesValidate](docs/sdks/addresses/README.md#validate) -- [batchesAddShipments](docs/sdks/batches/README.md#addshipments) -- [batchesCreate](docs/sdks/batches/README.md#create) -- [batchesGet](docs/sdks/batches/README.md#get) -- [batchesPurchase](docs/sdks/batches/README.md#purchase) -- [batchesRemoveShipments](docs/sdks/batches/README.md#removeshipments) -- [carrierAccountsCreate](docs/sdks/carrieraccounts/README.md#create) -- [carrierAccountsGetRegistrationStatus](docs/sdks/carrieraccounts/README.md#getregistrationstatus) -- [carrierAccountsGet](docs/sdks/carrieraccounts/README.md#get) -- [carrierAccountsInitiateOauth2Signin](docs/sdks/carrieraccounts/README.md#initiateoauth2signin) -- [carrierAccountsList](docs/sdks/carrieraccounts/README.md#list) -- [carrierAccountsRegister](docs/sdks/carrieraccounts/README.md#register) -- [carrierAccountsUpdate](docs/sdks/carrieraccounts/README.md#update) -- [carrierParcelTemplatesGet](docs/sdks/carrierparceltemplates/README.md#get) -- [carrierParcelTemplatesList](docs/sdks/carrierparceltemplates/README.md#list) -- [customsDeclarationsCreate](docs/sdks/customsdeclarations/README.md#create) -- [customsDeclarationsGet](docs/sdks/customsdeclarations/README.md#get) -- [customsDeclarationsList](docs/sdks/customsdeclarations/README.md#list) -- [customsItemsCreate](docs/sdks/customsitems/README.md#create) -- [customsItemsGet](docs/sdks/customsitems/README.md#get) -- [customsItemsList](docs/sdks/customsitems/README.md#list) -- [manifestsCreate](docs/sdks/manifests/README.md#create) -- [manifestsGet](docs/sdks/manifests/README.md#get) -- [manifestsList](docs/sdks/manifests/README.md#list) -- [ordersCreate](docs/sdks/orders/README.md#create) -- [ordersGet](docs/sdks/orders/README.md#get) -- [ordersList](docs/sdks/orders/README.md#list) -- [parcelsCreate](docs/sdks/parcels/README.md#create) -- [parcelsGet](docs/sdks/parcels/README.md#get) -- [parcelsList](docs/sdks/parcels/README.md#list) -- [pickupsCreate](docs/sdks/pickups/README.md#create) -- [ratesAtCheckoutCreate](docs/sdks/ratesatcheckout/README.md#create) -- [ratesAtCheckoutDeleteDefaultParcelTemplate](docs/sdks/ratesatcheckout/README.md#deletedefaultparceltemplate) -- [ratesAtCheckoutGetDefaultParcelTemplate](docs/sdks/ratesatcheckout/README.md#getdefaultparceltemplate) -- [ratesAtCheckoutUpdateDefaultParcelTemplate](docs/sdks/ratesatcheckout/README.md#updatedefaultparceltemplate) -- [ratesGet](docs/sdks/rates/README.md#get) -- [ratesListShipmentRatesByCurrencyCode](docs/sdks/rates/README.md#listshipmentratesbycurrencycode) -- [ratesListShipmentRates](docs/sdks/rates/README.md#listshipmentrates) -- [refundsCreate](docs/sdks/refunds/README.md#create) -- [refundsGet](docs/sdks/refunds/README.md#get) -- [refundsList](docs/sdks/refunds/README.md#list) -- [serviceGroupsCreate](docs/sdks/servicegroups/README.md#create) -- [serviceGroupsDelete](docs/sdks/servicegroups/README.md#delete) -- [serviceGroupsList](docs/sdks/servicegroups/README.md#list) -- [serviceGroupsUpdate](docs/sdks/servicegroups/README.md#update) -- [shipmentsCreate](docs/sdks/shipments/README.md#create) -- [shipmentsGet](docs/sdks/shipments/README.md#get) -- [shipmentsList](docs/sdks/shipments/README.md#list) -- [shippoAccountsCreate](docs/sdks/shippoaccounts/README.md#create) -- [shippoAccountsGet](docs/sdks/shippoaccounts/README.md#get) -- [shippoAccountsList](docs/sdks/shippoaccounts/README.md#list) -- [shippoAccountsUpdate](docs/sdks/shippoaccounts/README.md#update) -- [trackingStatusCreate](docs/sdks/trackingstatus/README.md#create) -- [trackingStatusGet](docs/sdks/trackingstatus/README.md#get) -- [transactionsCreate](docs/sdks/transactions/README.md#create) -- [transactionsGet](docs/sdks/transactions/README.md#get) -- [transactionsList](docs/sdks/transactions/README.md#list) -- [userParcelTemplatesCreate](docs/sdks/userparceltemplates/README.md#create) -- [userParcelTemplatesDelete](docs/sdks/userparceltemplates/README.md#delete) -- [userParcelTemplatesGet](docs/sdks/userparceltemplates/README.md#get) -- [userParcelTemplatesList](docs/sdks/userparceltemplates/README.md#list) -- [userParcelTemplatesUpdate](docs/sdks/userparceltemplates/README.md#update) -- [webhooksCreateWebhook](docs/sdks/webhooks/README.md#createwebhook) -- [webhooksDeleteWebhook](docs/sdks/webhooks/README.md#deletewebhook) -- [webhooksGetWebhook](docs/sdks/webhooks/README.md#getwebhook) -- [webhooksListWebhooks](docs/sdks/webhooks/README.md#listwebhooks) -- [webhooksUpdateWebhook](docs/sdks/webhooks/README.md#updatewebhook) - +- [`addressesCreate`](docs/sdks/addresses/README.md#create) - Create a new address +- [`addressesGet`](docs/sdks/addresses/README.md#get) - Retrieve an address +- [`addressesList`](docs/sdks/addresses/README.md#list) - List all addresses +- [`addressesValidate`](docs/sdks/addresses/README.md#validate) - Validate an address +- [`batchesAddShipments`](docs/sdks/batches/README.md#addshipments) - Add shipments to a batch +- [`batchesCreate`](docs/sdks/batches/README.md#create) - Create a batch +- [`batchesGet`](docs/sdks/batches/README.md#get) - Retrieve a batch +- [`batchesPurchase`](docs/sdks/batches/README.md#purchase) - Purchase a batch +- [`batchesRemoveShipments`](docs/sdks/batches/README.md#removeshipments) - Remove shipments from a batch +- [`carrierAccountsCreate`](docs/sdks/carrieraccounts/README.md#create) - Create a new carrier account +- [`carrierAccountsGet`](docs/sdks/carrieraccounts/README.md#get) - Retrieve a carrier account +- [`carrierAccountsGetRegistrationStatus`](docs/sdks/carrieraccounts/README.md#getregistrationstatus) - Get Carrier Registration status +- [`carrierAccountsInitiateOauth2Signin`](docs/sdks/carrieraccounts/README.md#initiateoauth2signin) - Connect an existing carrier account using OAuth 2.0 +- [`carrierAccountsList`](docs/sdks/carrieraccounts/README.md#list) - List all carrier accounts +- [`carrierAccountsRegister`](docs/sdks/carrieraccounts/README.md#register) - Add a Shippo carrier account +- [`carrierAccountsUpdate`](docs/sdks/carrieraccounts/README.md#update) - Update a carrier account +- [`carrierParcelTemplatesGet`](docs/sdks/carrierparceltemplates/README.md#get) - Retrieve a carrier parcel templates +- [`carrierParcelTemplatesList`](docs/sdks/carrierparceltemplates/README.md#list) - List all carrier parcel templates +- [`customsDeclarationsCreate`](docs/sdks/customsdeclarations/README.md#create) - Create a new customs declaration +- [`customsDeclarationsGet`](docs/sdks/customsdeclarations/README.md#get) - Retrieve a customs declaration +- [`customsDeclarationsList`](docs/sdks/customsdeclarations/README.md#list) - List all customs declarations +- [`customsItemsCreate`](docs/sdks/customsitems/README.md#create) - Create a new customs item +- [`customsItemsGet`](docs/sdks/customsitems/README.md#get) - Retrieve a customs item +- [`customsItemsList`](docs/sdks/customsitems/README.md#list) - List all customs items +- [`manifestsCreate`](docs/sdks/manifests/README.md#create) - Create a new manifest +- [`manifestsGet`](docs/sdks/manifests/README.md#get) - Retrieve a manifest +- [`manifestsList`](docs/sdks/manifests/README.md#list) - List all manifests +- [`ordersCreate`](docs/sdks/orders/README.md#create) - Create a new order +- [`ordersGet`](docs/sdks/orders/README.md#get) - Retrieve an order +- [`ordersList`](docs/sdks/orders/README.md#list) - List all orders +- [`parcelsCreate`](docs/sdks/parcels/README.md#create) - Create a new parcel +- [`parcelsGet`](docs/sdks/parcels/README.md#get) - Retrieve an existing parcel +- [`parcelsList`](docs/sdks/parcels/README.md#list) - List all parcels +- [`pickupsCreate`](docs/sdks/pickups/README.md#create) - Create a pickup +- [`ratesAtCheckoutCreate`](docs/sdks/ratesatcheckout/README.md#create) - Generate a live rates request +- [`ratesAtCheckoutDeleteDefaultParcelTemplate`](docs/sdks/ratesatcheckout/README.md#deletedefaultparceltemplate) - Clear current default parcel template +- [`ratesAtCheckoutGetDefaultParcelTemplate`](docs/sdks/ratesatcheckout/README.md#getdefaultparceltemplate) - Show current default parcel template +- [`ratesAtCheckoutUpdateDefaultParcelTemplate`](docs/sdks/ratesatcheckout/README.md#updatedefaultparceltemplate) - Update default parcel template +- [`ratesGet`](docs/sdks/rates/README.md#get) - Retrieve a rate +- [`ratesListShipmentRates`](docs/sdks/rates/README.md#listshipmentrates) - Retrieve shipment rates +- [`ratesListShipmentRatesByCurrencyCode`](docs/sdks/rates/README.md#listshipmentratesbycurrencycode) - Retrieve shipment rates in currency +- [`refundsCreate`](docs/sdks/refunds/README.md#create) - Create a refund +- [`refundsGet`](docs/sdks/refunds/README.md#get) - Retrieve a refund +- [`refundsList`](docs/sdks/refunds/README.md#list) - List all refunds +- [`serviceGroupsCreate`](docs/sdks/servicegroups/README.md#create) - Create a new service group +- [`serviceGroupsDelete`](docs/sdks/servicegroups/README.md#delete) - Delete a service group +- [`serviceGroupsList`](docs/sdks/servicegroups/README.md#list) - List all service groups +- [`serviceGroupsUpdate`](docs/sdks/servicegroups/README.md#update) - Update an existing service group +- [`shipmentsCreate`](docs/sdks/shipments/README.md#create) - Create a new shipment +- [`shipmentsGet`](docs/sdks/shipments/README.md#get) - Retrieve a shipment +- [`shipmentsList`](docs/sdks/shipments/README.md#list) - List all shipments +- [`shippoAccountsCreate`](docs/sdks/shippoaccounts/README.md#create) - Create a Shippo Account +- [`shippoAccountsGet`](docs/sdks/shippoaccounts/README.md#get) - Retrieve a Shippo Account +- [`shippoAccountsList`](docs/sdks/shippoaccounts/README.md#list) - List all Shippo Accounts +- [`shippoAccountsUpdate`](docs/sdks/shippoaccounts/README.md#update) - Update a Shippo Account +- [`trackingStatusCreate`](docs/sdks/trackingstatus/README.md#create) - Register a tracking webhook +- [`trackingStatusGet`](docs/sdks/trackingstatus/README.md#get) - Get a tracking status +- [`transactionsCreate`](docs/sdks/transactions/README.md#create) - Create a shipping label +- [`transactionsGet`](docs/sdks/transactions/README.md#get) - Retrieve a shipping label +- [`transactionsList`](docs/sdks/transactions/README.md#list) - List all shipping labels +- [`userParcelTemplatesCreate`](docs/sdks/userparceltemplates/README.md#create) - Create a new user parcel template +- [`userParcelTemplatesDelete`](docs/sdks/userparceltemplates/README.md#delete) - Delete a user parcel template +- [`userParcelTemplatesGet`](docs/sdks/userparceltemplates/README.md#get) - Retrieves a user parcel template +- [`userParcelTemplatesList`](docs/sdks/userparceltemplates/README.md#list) - List all user parcel templates +- [`userParcelTemplatesUpdate`](docs/sdks/userparceltemplates/README.md#update) - Update an existing user parcel template +- [`webhooksCreateWebhook`](docs/sdks/webhooks/README.md#createwebhook) - Create a new webhook +- [`webhooksDeleteWebhook`](docs/sdks/webhooks/README.md#deletewebhook) - Delete a specific webhook +- [`webhooksGetWebhook`](docs/sdks/webhooks/README.md#getwebhook) - Retrieve a specific webhook +- [`webhooksListWebhooks`](docs/sdks/webhooks/README.md#listwebhooks) - List all webhooks +- [`webhooksUpdateWebhook`](docs/sdks/webhooks/README.md#updatewebhook) - Update an existing webhook diff --git a/RELEASES.md b/RELEASES.md index 2295c885..37f09a44 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -336,4 +336,14 @@ Based on: ### Generated - [typescript v2.14.1] . ### Releases -- [NPM v2.14.1] https://www.npmjs.com/package/shippo/v/2.14.1 - . \ No newline at end of file +- [NPM v2.14.1] https://www.npmjs.com/package/shippo/v/2.14.1 - . + +## 2025-01-13 00:12:07 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.468.2 (2.493.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [typescript v2.15.0] . +### Releases +- [NPM v2.15.0] https://www.npmjs.com/package/shippo/v/2.15.0 - . \ No newline at end of file diff --git a/RUNTIMES.md b/RUNTIMES.md index d08a0c07..db7ea942 100644 --- a/RUNTIMES.md +++ b/RUNTIMES.md @@ -1,6 +1,6 @@ # Supported JavaScript runtimes -This SDK is intended to be used in JavaScript runtimes that support the following features: +This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features: * [Web Fetch API][web-fetch] * [Web Streams API][web-streams] and in particular `ReadableStream` @@ -20,3 +20,29 @@ Runtime environments that are explicitly supported are: - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming]) [deno-file-streaming]: https://github.com/denoland/deno/issues/11018 + +## Recommended TypeScript compiler options + +The following `tsconfig.json` options are recommended for projects using this +SDK in order to get static type support for features like async iterables, +streams and `fetch`-related APIs ([`for await...of`][for-await-of], +[`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and +so on): + +[for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of +[abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal +[request]: https://developer.mozilla.org/en-US/docs/Web/API/Request +[response]: https://developer.mozilla.org/en-US/docs/Web/API/Response + +```jsonc +{ + "compilerOptions": { + "target": "es2020", // or higher + "lib": ["es2020", "dom", "dom.iterable"], + } +} +``` + +While `target` can be set to older ECMAScript versions, it may result in extra, +unnecessary compatibility code being generated if you are not targeting old +runtimes. \ No newline at end of file diff --git a/docs/models/components/addressfrom.md b/docs/models/components/addressfrom.md index df89b96a..b00476ce 100644 --- a/docs/models/components/addressfrom.md +++ b/docs/models/components/addressfrom.md @@ -1,11 +1,12 @@ # AddressFrom -## Example Usage -```typescript -import { AddressFrom } from "shippo/models/components"; +## Supported Types + +### `components.AddressCreateRequest` -let value: AddressFrom = { +```typescript +const value: components.AddressCreateRequest = { name: "Shwan Ippotle", company: "Shippo", street1: "215 Clayton St.", @@ -23,17 +24,9 @@ let value: AddressFrom = { }; ``` -## Supported Types - -### `components.AddressCreateRequest` - -```typescript -const value: components.AddressCreateRequest = /* values here */ -``` - ### `string` ```typescript -const value: string = /* values here */ +const value: string = "d799c2679e644279b59fe661ac8fa488"; ``` diff --git a/docs/models/components/addressreturn.md b/docs/models/components/addressreturn.md index db263398..6d1f7d8a 100644 --- a/docs/models/components/addressreturn.md +++ b/docs/models/components/addressreturn.md @@ -1,11 +1,12 @@ # AddressReturn -## Example Usage -```typescript -import { AddressReturn } from "shippo/models/components"; +## Supported Types + +### `components.AddressCreateRequest` -let value: AddressReturn = { +```typescript +const value: components.AddressCreateRequest = { name: "Shwan Ippotle", company: "Shippo", street1: "215 Clayton St.", @@ -23,17 +24,9 @@ let value: AddressReturn = { }; ``` -## Supported Types - -### `components.AddressCreateRequest` - -```typescript -const value: components.AddressCreateRequest = /* values here */ -``` - ### `string` ```typescript -const value: string = /* values here */ +const value: string = "d799c2679e644279b59fe661ac8fa488"; ``` diff --git a/docs/models/components/addressto.md b/docs/models/components/addressto.md index b8eadade..e89646db 100644 --- a/docs/models/components/addressto.md +++ b/docs/models/components/addressto.md @@ -1,11 +1,12 @@ # AddressTo -## Example Usage -```typescript -import { AddressTo } from "shippo/models/components"; +## Supported Types + +### `components.AddressCreateRequest` -let value: AddressTo = { +```typescript +const value: components.AddressCreateRequest = { name: "Shwan Ippotle", company: "Shippo", street1: "215 Clayton St.", @@ -23,17 +24,9 @@ let value: AddressTo = { }; ``` -## Supported Types - -### `components.AddressCreateRequest` - -```typescript -const value: components.AddressCreateRequest = /* values here */ -``` - ### `string` ```typescript -const value: string = /* values here */ +const value: string = "d799c2679e644279b59fe661ac8fa489"; ``` diff --git a/docs/models/components/addressvalidationresultsmessagecodeenum.md b/docs/models/components/addressvalidationresultsmessagecodeenum.md index 9583aa5c..94db9241 100644 --- a/docs/models/components/addressvalidationresultsmessagecodeenum.md +++ b/docs/models/components/addressvalidationresultsmessagecodeenum.md @@ -5,7 +5,8 @@ ```typescript import { AddressValidationResultsMessageCodeEnum } from "shippo/models/components"; -let value: AddressValidationResultsMessageCodeEnum = "Multiple Responses"; +let value: AddressValidationResultsMessageCodeEnum = + "administrative_area_partial"; ``` ## Values diff --git a/docs/models/components/addressvalidationresultsmessagesourceenum.md b/docs/models/components/addressvalidationresultsmessagesourceenum.md index a3d97b90..00664438 100644 --- a/docs/models/components/addressvalidationresultsmessagesourceenum.md +++ b/docs/models/components/addressvalidationresultsmessagesourceenum.md @@ -5,7 +5,8 @@ ```typescript import { AddressValidationResultsMessageSourceEnum } from "shippo/models/components"; -let value: AddressValidationResultsMessageSourceEnum = "UPS"; +let value: AddressValidationResultsMessageSourceEnum = + "Shippo Address Validator"; ``` ## Values diff --git a/docs/models/components/ancillaryendorsement.md b/docs/models/components/ancillaryendorsement.md index f361e85c..e329ad0c 100644 --- a/docs/models/components/ancillaryendorsement.md +++ b/docs/models/components/ancillaryendorsement.md @@ -7,7 +7,7 @@ Specify an ancillary service endorsement to provide the USPS with instructions o ```typescript import { AncillaryEndorsement } from "shippo/models/components"; -let value: AncillaryEndorsement = "FORWARDING_SERVICE_REQUESTED"; +let value: AncillaryEndorsement = "RETURN_SERVICE_REQUESTED"; ``` ## Values diff --git a/docs/models/components/attributes.md b/docs/models/components/attributes.md index 4cd8f1e8..3e2e3def 100644 --- a/docs/models/components/attributes.md +++ b/docs/models/components/attributes.md @@ -5,7 +5,7 @@ ```typescript import { Attributes } from "shippo/models/components"; -let value: Attributes = "CHEAPEST"; +let value: Attributes = "BESTVALUE"; ``` ## Values diff --git a/docs/models/components/batch.md b/docs/models/components/batch.md index 169616b5..7ba6bc35 100644 --- a/docs/models/components/batch.md +++ b/docs/models/components/batch.md @@ -26,7 +26,7 @@ let value: Batch = { ], }, labelUrl: [ - "", + "https://talkative-sauerkraut.org/", ], objectCreated: "2016-01-04T00:15:44.394Z", objectId: "5ef63c54f5bf45d3b1f8fb37dcb1c5f4", diff --git a/docs/models/components/batchcreaterequest.md b/docs/models/components/batchcreaterequest.md index 2dc725f2..fb47ae70 100644 --- a/docs/models/components/batchcreaterequest.md +++ b/docs/models/components/batchcreaterequest.md @@ -160,7 +160,10 @@ let value: BatchCreateRequest = { metadata: "Customer ID 123456", massUnit: "lb", weight: "1", - template: "Fastway_Australia_Satchel_A5", + distanceUnit: "in", + height: "1", + length: "1", + width: "1", }, ], }, diff --git a/docs/models/components/batchshipmentcreaterequest.md b/docs/models/components/batchshipmentcreaterequest.md index c0f453c9..3de40e3f 100644 --- a/docs/models/components/batchshipmentcreaterequest.md +++ b/docs/models/components/batchshipmentcreaterequest.md @@ -113,7 +113,8 @@ let value: BatchShipmentCreateRequest = { }, metadata: "Customer ID 123456", shipmentDate: "2021-03-22T12:00:00Z", - addressFrom: { + addressFrom: "d799c2679e644279b59fe661ac8fa488", + addressReturn: { name: "Shwan Ippotle", company: "Shippo", street1: "215 Clayton St.", @@ -129,7 +130,6 @@ let value: BatchShipmentCreateRequest = { metadata: "Customer ID 123456", validate: true, }, - addressReturn: "d799c2679e644279b59fe661ac8fa488", addressTo: "d799c2679e644279b59fe661ac8fa489", customsDeclaration: "adcfdddf8ec64b84ad22772bce3ea37a", carrierAccounts: [ @@ -137,7 +137,25 @@ let value: BatchShipmentCreateRequest = { "73f706f4bdb94b54a337563840ce52b0", ], parcels: [ - "", + { + extra: { + cod: { + amount: "5.5", + currency: "USD", + paymentMethod: "CASH", + }, + insurance: { + amount: "5.5", + content: "Laptop", + currency: "USD", + provider: "UPS", + }, + }, + metadata: "Customer ID 123456", + massUnit: "lb", + weight: "1", + template: "UPS_MI_MEDIA_MAIL", + }, ], }, }; diff --git a/docs/models/components/carrieraccount.md b/docs/models/components/carrieraccount.md index d317252b..25d092d2 100644 --- a/docs/models/components/carrieraccount.md +++ b/docs/models/components/carrieraccount.md @@ -9,28 +9,14 @@ let value: CarrierAccount = { accountId: "****", carrier: "usps", parameters: { - accountNumber: "94567e", - aiaCountryIso2: "US", - billingAddressCity: "San Francisco", - billingAddressCountryIso2: "US", - billingAddressState: "CA", - billingAddressStreet1: "731 Market St", - billingAddressStreet2: "STE 200", - billingAddressZip: "94103", - collecCountryIso2: "US", - collecZip: "94103", - company: "Shippo", - currencyCode: "USD", - email: "hippo@shippo.com", - fullName: "Shippo Meister", - hasInvoice: false, - invoiceControlid: "1234", - invoiceDate: "20210529", - invoiceNumber: "1112234", - invoiceValue: "11.23", - phone: "1112223333", - title: "Manager", - upsAgreements: false, + firstName: "Rose", + lastName: "Gulgowski", + phoneNumber: "(585) 967-5964 x60362", + fromAddressSt: "", + fromAddressCity: "", + fromAddressState: "", + fromAddressZip: "", + fromAddressCountryIso2: "", }, carrierName: "USPS", isShippoAccount: false, diff --git a/docs/models/components/carrieraccountbase.md b/docs/models/components/carrieraccountbase.md index ec4d76b7..6ce71d1b 100644 --- a/docs/models/components/carrieraccountbase.md +++ b/docs/models/components/carrieraccountbase.md @@ -9,14 +9,28 @@ let value: CarrierAccountBase = { accountId: "****", carrier: "usps", parameters: { - firstName: "Laron", - lastName: "Fadel", - phoneNumber: "586.483.8586 x75964", - fromAddressSt: "", - fromAddressCity: "", - fromAddressState: "", - fromAddressZip: "", - fromAddressCountryIso2: "", + accountNumber: "94567e", + aiaCountryIso2: "US", + billingAddressCity: "San Francisco", + billingAddressCountryIso2: "US", + billingAddressState: "CA", + billingAddressStreet1: "731 Market St", + billingAddressStreet2: "STE 200", + billingAddressZip: "94103", + collecCountryIso2: "US", + collecZip: "94103", + company: "Shippo", + currencyCode: "USD", + email: "hippo@shippo.com", + fullName: "Shippo Meister", + hasInvoice: false, + invoiceControlid: "1234", + invoiceDate: "20210529", + invoiceNumber: "1112234", + invoiceValue: "11.23", + phone: "1112223333", + title: "Manager", + upsAgreements: false, }, }; ``` diff --git a/docs/models/components/carrieraccountbaseparameters.md b/docs/models/components/carrieraccountbaseparameters.md index f799fab4..fa377f11 100644 --- a/docs/models/components/carrieraccountbaseparameters.md +++ b/docs/models/components/carrieraccountbaseparameters.md @@ -1,32 +1,57 @@ # CarrierAccountBaseParameters -## Example Usage - -```typescript -import { CarrierAccountBaseParameters } from "shippo/models/components"; - -let value: CarrierAccountBaseParameters = { - "key": "", -}; -``` ## Supported Types ### `{ [k: string]: any }` ```typescript -const value: { [k: string]: any } = /* values here */ +const value: { [k: string]: any } = { + "key": "", +}; ``` ### `components.FedExConnectExistingOwnAccountParameters` ```typescript -const value: components.FedExConnectExistingOwnAccountParameters = /* values here */ +const value: components.FedExConnectExistingOwnAccountParameters = { + firstName: "Michael", + lastName: "Cormier-Stroman", + phoneNumber: "1-618-854-0647", + fromAddressSt: "", + fromAddressCity: "", + fromAddressState: "", + fromAddressZip: "", + fromAddressCountryIso2: "", +}; ``` ### `components.UPSConnectExistingOwnAccountParameters` ```typescript -const value: components.UPSConnectExistingOwnAccountParameters = /* values here */ +const value: components.UPSConnectExistingOwnAccountParameters = { + accountNumber: "94567e", + aiaCountryIso2: "US", + billingAddressCity: "San Francisco", + billingAddressCountryIso2: "US", + billingAddressState: "CA", + billingAddressStreet1: "731 Market St", + billingAddressStreet2: "STE 200", + billingAddressZip: "94103", + collecCountryIso2: "US", + collecZip: "94103", + company: "Shippo", + currencyCode: "USD", + email: "hippo@shippo.com", + fullName: "Shippo Meister", + hasInvoice: false, + invoiceControlid: "1234", + invoiceDate: "20210529", + invoiceNumber: "1112234", + invoiceValue: "11.23", + phone: "1112223333", + title: "Manager", + upsAgreements: false, +}; ``` diff --git a/docs/models/components/carrieraccountpaginatedlist.md b/docs/models/components/carrieraccountpaginatedlist.md index cd7a13a1..3b77f192 100644 --- a/docs/models/components/carrieraccountpaginatedlist.md +++ b/docs/models/components/carrieraccountpaginatedlist.md @@ -13,28 +13,7 @@ let value: CarrierAccountPaginatedList = { accountId: "****", carrier: "usps", parameters: { - accountNumber: "94567e", - aiaCountryIso2: "US", - billingAddressCity: "San Francisco", - billingAddressCountryIso2: "US", - billingAddressState: "CA", - billingAddressStreet1: "731 Market St", - billingAddressStreet2: "STE 200", - billingAddressZip: "94103", - collecCountryIso2: "US", - collecZip: "94103", - company: "Shippo", - currencyCode: "USD", - email: "hippo@shippo.com", - fullName: "Shippo Meister", - hasInvoice: false, - invoiceControlid: "1234", - invoiceDate: "20210529", - invoiceNumber: "1112234", - invoiceValue: "11.23", - phone: "1112223333", - title: "Manager", - upsAgreements: false, + "key": "", }, carrierName: "USPS", isShippoAccount: false, diff --git a/docs/models/components/carrieraccountparameters.md b/docs/models/components/carrieraccountparameters.md index 9d063035..f727a2c8 100644 --- a/docs/models/components/carrieraccountparameters.md +++ b/docs/models/components/carrieraccountparameters.md @@ -1,32 +1,57 @@ # CarrierAccountParameters -## Example Usage - -```typescript -import { CarrierAccountParameters } from "shippo/models/components"; - -let value: CarrierAccountParameters = { - "key": "", -}; -``` ## Supported Types ### `{ [k: string]: any }` ```typescript -const value: { [k: string]: any } = /* values here */ +const value: { [k: string]: any } = { + "key": "", +}; ``` ### `components.FedExConnectExistingOwnAccountParameters` ```typescript -const value: components.FedExConnectExistingOwnAccountParameters = /* values here */ +const value: components.FedExConnectExistingOwnAccountParameters = { + firstName: "Kyler", + lastName: "Simonis", + phoneNumber: "727-925-5529", + fromAddressSt: "", + fromAddressCity: "", + fromAddressState: "", + fromAddressZip: "", + fromAddressCountryIso2: "", +}; ``` ### `components.UPSConnectExistingOwnAccountParameters` ```typescript -const value: components.UPSConnectExistingOwnAccountParameters = /* values here */ +const value: components.UPSConnectExistingOwnAccountParameters = { + accountNumber: "94567e", + aiaCountryIso2: "US", + billingAddressCity: "San Francisco", + billingAddressCountryIso2: "US", + billingAddressState: "CA", + billingAddressStreet1: "731 Market St", + billingAddressStreet2: "STE 200", + billingAddressZip: "94103", + collecCountryIso2: "US", + collecZip: "94103", + company: "Shippo", + currencyCode: "USD", + email: "hippo@shippo.com", + fullName: "Shippo Meister", + hasInvoice: false, + invoiceControlid: "1234", + invoiceDate: "20210529", + invoiceNumber: "1112234", + invoiceValue: "11.23", + phone: "1112223333", + title: "Manager", + upsAgreements: false, +}; ``` diff --git a/docs/models/components/carriersenum.md b/docs/models/components/carriersenum.md index 41533361..01b009ab 100644 --- a/docs/models/components/carriersenum.md +++ b/docs/models/components/carriersenum.md @@ -19,7 +19,6 @@ | collect_plus | CollectPlus| | correios_br | CorreiosBR| | correos_espana | Correos España | -| couriersplease | Couriers Please| | colissimo | Colissimo| | deutsche_post | Deutsche Post| | dhl_benelux | DHL Benelux| @@ -45,7 +44,6 @@ | new_zealand_post | New Zealand Post (also used for Pace and CourierPost)| | nippon_express | Nippon Express| | ontrac | OnTrac| -| orangeds | OrangeDS| | parcelforce | Parcelforce| | passport | Passport| | pcf | PCF| @@ -70,11 +68,11 @@ ```typescript import { CarriersEnum } from "shippo/models/components"; -let value: CarriersEnum = "rr_donnelley"; +let value: CarriersEnum = "bring"; ``` ## Values ```typescript -"airterra" | "apc_postal" | "apg" | "aramex" | "asendia_us" | "australia_post" | "axlehire" | "better_trucks" | "borderguru" | "boxberry" | "bring" | "canada_post" | "cdl" | "chronopost" | "collect_plus" | "correios_br" | "correos_espana" | "couriersplease" | "colissimo" | "deutsche_post" | "dhl_benelux" | "dhl_ecommerce" | "dhl_express" | "dhl_germany_c2c" | "dhl_germany" | "dpd_de" | "dpd_uk" | "estafeta" | "fastway_australia" | "fedex" | "globegistics" | "gls_us" | "gophr" | "gso" | "hermes_germany_b2c" | "hermes_uk" | "hongkong_post" | "lasership" | "lso" | "mondial_relay" | "new_zealand_post" | "nippon_express" | "ontrac" | "orangeds" | "parcelforce" | "passport" | "pcf" | "poste_italiane" | "posti" | "purolator" | "royal_mail" | "rr_donnelley" | "russian_post" | "sendle" | "skypostal" | "stuart" | "swyft" | "uds" | "ups" | "usps" | "veho" +"airterra" | "apc_postal" | "apg" | "aramex" | "asendia_us" | "australia_post" | "axlehire" | "better_trucks" | "borderguru" | "boxberry" | "bring" | "canada_post" | "cdl" | "chronopost" | "collect_plus" | "correios_br" | "correos_espana" | "colissimo" | "deutsche_post" | "dhl_benelux" | "dhl_ecommerce" | "dhl_express" | "dhl_germany_c2c" | "dhl_germany" | "dpd_de" | "dpd_uk" | "estafeta" | "fastway_australia" | "fedex" | "globegistics" | "gls_us" | "gophr" | "gso" | "hermes_germany_b2c" | "hermes_uk" | "hongkong_post" | "lasership" | "lso" | "mondial_relay" | "new_zealand_post" | "nippon_express" | "ontrac" | "parcelforce" | "passport" | "pcf" | "poste_italiane" | "posti" | "purolator" | "royal_mail" | "rr_donnelley" | "russian_post" | "sendle" | "skypostal" | "stuart" | "swyft" | "uds" | "ups" | "usps" | "veho" ``` \ No newline at end of file diff --git a/docs/models/components/connectexistingownaccountrequest.md b/docs/models/components/connectexistingownaccountrequest.md index 81170f41..e27f77e7 100644 --- a/docs/models/components/connectexistingownaccountrequest.md +++ b/docs/models/components/connectexistingownaccountrequest.md @@ -10,14 +10,28 @@ let value: ConnectExistingOwnAccountRequest = { carrier: "fedex", metadata: "FEDEX Account", parameters: { - firstName: "Aurelia", - lastName: "Ward", - phoneNumber: "(717) 415-0806 x279", - fromAddressSt: "", - fromAddressCity: "", - fromAddressState: "", - fromAddressZip: "", - fromAddressCountryIso2: "", + accountNumber: "94567e", + aiaCountryIso2: "US", + billingAddressCity: "San Francisco", + billingAddressCountryIso2: "US", + billingAddressState: "CA", + billingAddressStreet1: "731 Market St", + billingAddressStreet2: "STE 200", + billingAddressZip: "94103", + collecCountryIso2: "US", + collecZip: "94103", + company: "Shippo", + currencyCode: "USD", + email: "hippo@shippo.com", + fullName: "Shippo Meister", + hasInvoice: false, + invoiceControlid: "1234", + invoiceDate: "20210529", + invoiceNumber: "1112234", + invoiceValue: "11.23", + phone: "1112223333", + title: "Manager", + upsAgreements: false, }, test: false, }; diff --git a/docs/models/components/connectexistingownaccountrequestparameters.md b/docs/models/components/connectexistingownaccountrequestparameters.md index 34cb4e28..fb091540 100644 --- a/docs/models/components/connectexistingownaccountrequestparameters.md +++ b/docs/models/components/connectexistingownaccountrequestparameters.md @@ -1,39 +1,57 @@ # ConnectExistingOwnAccountRequestParameters -## Example Usage - -```typescript -import { ConnectExistingOwnAccountRequestParameters } from "shippo/models/components"; - -let value: ConnectExistingOwnAccountRequestParameters = { - firstName: "Whitney", - lastName: "Ritchie", - phoneNumber: "412-234-0652", - fromAddressSt: "", - fromAddressCity: "", - fromAddressState: "", - fromAddressZip: "", - fromAddressCountryIso2: "", -}; -``` ## Supported Types ### `{ [k: string]: any }` ```typescript -const value: { [k: string]: any } = /* values here */ +const value: { [k: string]: any } = { + "key": "", +}; ``` ### `components.FedExConnectExistingOwnAccountParameters` ```typescript -const value: components.FedExConnectExistingOwnAccountParameters = /* values here */ +const value: components.FedExConnectExistingOwnAccountParameters = { + firstName: "Liana", + lastName: "Collins", + phoneNumber: "655-764-8348 x871", + fromAddressSt: "", + fromAddressCity: "", + fromAddressState: "", + fromAddressZip: "", + fromAddressCountryIso2: "", +}; ``` ### `components.UPSConnectExistingOwnAccountParameters` ```typescript -const value: components.UPSConnectExistingOwnAccountParameters = /* values here */ +const value: components.UPSConnectExistingOwnAccountParameters = { + accountNumber: "94567e", + aiaCountryIso2: "US", + billingAddressCity: "San Francisco", + billingAddressCountryIso2: "US", + billingAddressState: "CA", + billingAddressStreet1: "731 Market St", + billingAddressStreet2: "STE 200", + billingAddressZip: "94103", + collecCountryIso2: "US", + collecZip: "94103", + company: "Shippo", + currencyCode: "USD", + email: "hippo@shippo.com", + fullName: "Shippo Meister", + hasInvoice: false, + invoiceControlid: "1234", + invoiceDate: "20210529", + invoiceNumber: "1112234", + invoiceValue: "11.23", + phone: "1112223333", + title: "Manager", + upsAgreements: false, +}; ``` diff --git a/docs/models/components/dangerousgoodscode.md b/docs/models/components/dangerousgoodscode.md index 1d4a516b..bab8b40f 100644 --- a/docs/models/components/dangerousgoodscode.md +++ b/docs/models/components/dangerousgoodscode.md @@ -7,7 +7,7 @@ Dangerous Goods Code (DHL eCommerce only). See ", fromAddressCity: "", fromAddressState: "", diff --git a/docs/models/components/instanttransactioncreaterequest.md b/docs/models/components/instanttransactioncreaterequest.md index ccc41cad..e3a664f8 100644 --- a/docs/models/components/instanttransactioncreaterequest.md +++ b/docs/models/components/instanttransactioncreaterequest.md @@ -115,8 +115,38 @@ let value: InstantTransactionCreateRequest = { }, metadata: "Customer ID 123456", shipmentDate: "2021-03-22T12:00:00Z", - addressFrom: "d799c2679e644279b59fe661ac8fa488", - addressReturn: "d799c2679e644279b59fe661ac8fa488", + addressFrom: { + name: "Shwan Ippotle", + company: "Shippo", + street1: "215 Clayton St.", + street3: "", + streetNo: "", + city: "San Francisco", + state: "CA", + zip: "94117", + country: "US", + phone: "+1 555 341 9393", + email: "shippotle@shippo.com", + isResidential: true, + metadata: "Customer ID 123456", + validate: true, + }, + addressReturn: { + name: "Shwan Ippotle", + company: "Shippo", + street1: "215 Clayton St.", + street3: "", + streetNo: "", + city: "San Francisco", + state: "CA", + zip: "94117", + country: "US", + phone: "+1 555 341 9393", + email: "shippotle@shippo.com", + isResidential: true, + metadata: "Customer ID 123456", + validate: true, + }, addressTo: { name: "Shwan Ippotle", company: "Shippo", diff --git a/docs/models/components/latitude.md b/docs/models/components/latitude.md index d610cf7e..d8059c49 100644 --- a/docs/models/components/latitude.md +++ b/docs/models/components/latitude.md @@ -1,24 +1,17 @@ # Latitude -## Example Usage - -```typescript -import { Latitude } from "shippo/models/components"; - -let value: Latitude = ""; -``` ## Supported Types ### `number` ```typescript -const value: number = /* values here */ +const value: number = 710.36; ``` ### `string` ```typescript -const value: string = /* values here */ +const value: string = ""; ``` diff --git a/docs/models/components/liveratecreaterequest.md b/docs/models/components/liveratecreaterequest.md index 84e61ae4..e2b28922 100644 --- a/docs/models/components/liveratecreaterequest.md +++ b/docs/models/components/liveratecreaterequest.md @@ -6,7 +6,22 @@ import { LiveRateCreateRequest } from "shippo/models/components"; let value: LiveRateCreateRequest = { - addressFrom: "", + addressFrom: { + name: "Shwan Ippotle", + company: "Shippo", + street1: "215 Clayton St.", + street3: "", + streetNo: "", + city: "San Francisco", + state: "CA", + zip: "94117", + country: "US", + phone: "+1 555 341 9393", + email: "shippotle@shippo.com", + isResidential: true, + metadata: "Customer ID 123456", + validate: true, + }, addressTo: { name: "Shwan Ippotle", company: "Shippo", diff --git a/docs/models/components/liveratecreaterequestaddressfrom.md b/docs/models/components/liveratecreaterequestaddressfrom.md index 2c68896d..dfabfde3 100644 --- a/docs/models/components/liveratecreaterequestaddressfrom.md +++ b/docs/models/components/liveratecreaterequestaddressfrom.md @@ -4,25 +4,33 @@ The sender address, which includes your name, company name, street address, city country, phone number, and email address (strings). Special characters should not be included in any address element, especially name, company, and email. -## Example Usage - -```typescript -import { LiveRateCreateRequestAddressFrom } from "shippo/models/components"; - -let value: LiveRateCreateRequestAddressFrom = ""; -``` ## Supported Types ### `string` ```typescript -const value: string = /* values here */ +const value: string = ""; ``` ### `components.AddressCompleteCreateRequest` ```typescript -const value: components.AddressCompleteCreateRequest = /* values here */ +const value: components.AddressCompleteCreateRequest = { + name: "Shwan Ippotle", + company: "Shippo", + street1: "215 Clayton St.", + street3: "", + streetNo: "", + city: "San Francisco", + state: "CA", + zip: "94117", + country: "US", + phone: "+1 555 341 9393", + email: "shippotle@shippo.com", + isResidential: true, + metadata: "Customer ID 123456", + validate: true, +}; ``` diff --git a/docs/models/components/liveratecreaterequestaddressto.md b/docs/models/components/liveratecreaterequestaddressto.md index f49989ce..3ddb1455 100644 --- a/docs/models/components/liveratecreaterequestaddressto.md +++ b/docs/models/components/liveratecreaterequestaddressto.md @@ -4,25 +4,33 @@ The recipient address, which includes the recipient's name, company name, street country, phone number, and email address (strings). Special characters should not be included in any address element, especially name, company, and email. -## Example Usage - -```typescript -import { LiveRateCreateRequestAddressTo } from "shippo/models/components"; - -let value: LiveRateCreateRequestAddressTo = ""; -``` ## Supported Types ### `string` ```typescript -const value: string = /* values here */ +const value: string = ""; ``` ### `components.AddressCompleteCreateRequest` ```typescript -const value: components.AddressCompleteCreateRequest = /* values here */ +const value: components.AddressCompleteCreateRequest = { + name: "Shwan Ippotle", + company: "Shippo", + street1: "215 Clayton St.", + street3: "", + streetNo: "", + city: "San Francisco", + state: "CA", + zip: "94117", + country: "US", + phone: "+1 555 341 9393", + email: "shippotle@shippo.com", + isResidential: true, + metadata: "Customer ID 123456", + validate: true, +}; ``` diff --git a/docs/models/components/liveratecreaterequestparcel.md b/docs/models/components/liveratecreaterequestparcel.md index c6d418b6..16dcbe7b 100644 --- a/docs/models/components/liveratecreaterequestparcel.md +++ b/docs/models/components/liveratecreaterequestparcel.md @@ -2,51 +2,25 @@ Object ID for an existing User Parcel Template OR a fully formed Parcel object. -## Example Usage - -```typescript -import { LiveRateCreateRequestParcel } from "shippo/models/components"; - -let value: LiveRateCreateRequestParcel = { - extra: { - cod: { - amount: "5.5", - currency: "USD", - paymentMethod: "CASH", - }, - insurance: { - amount: "5.5", - content: "Laptop", - currency: "USD", - provider: "UPS", - }, - }, - metadata: "Customer ID 123456", - massUnit: "lb", - weight: "1", - distanceUnit: "in", - height: "1", - length: "1", - width: "1", - objectCreated: new Date("2014-07-09T02:19:13.174Z"), - objectId: "adcfdddf8ec64b84ad22772bce3ea37a", - objectOwner: "shippotle@shippo.com", - objectState: "VALID", - objectUpdated: new Date("2014-07-09T02:19:13.174Z"), -}; -``` ## Supported Types ### `string` ```typescript -const value: string = /* values here */ +const value: string = "5df144dca289442cv7a06"; ``` ### `components.Parcel` ```typescript -const value: components.Parcel = /* values here */ +const value: components.Parcel = { + massUnit: "lb", + weight: "1", + distanceUnit: "in", + height: "1", + length: "1", + width: "1", +}; ``` diff --git a/docs/models/components/longitude.md b/docs/models/components/longitude.md index b0e53a69..10b6948f 100644 --- a/docs/models/components/longitude.md +++ b/docs/models/components/longitude.md @@ -1,24 +1,17 @@ # Longitude -## Example Usage - -```typescript -import { Longitude } from "shippo/models/components"; - -let value: Longitude = ""; -``` ## Supported Types ### `number` ```typescript -const value: number = /* values here */ +const value: number = 871.29; ``` ### `string` ```typescript -const value: string = /* values here */ +const value: string = ""; ``` diff --git a/docs/models/components/manifest.md b/docs/models/components/manifest.md index 9d4901bb..38d501fb 100644 --- a/docs/models/components/manifest.md +++ b/docs/models/components/manifest.md @@ -15,10 +15,10 @@ let value: Manifest = { documents: [ "https://shippo-delivery.s3.amazonaws.com/0fadebf6f60c4aca95fa01bcc59c79ae.pdf?Signature=tlQU3RECwdHUQJQadwqg5bAzGFQ%3D&Expires=1402803835&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", ], - objectCreated: new Date("2023-09-17T16:21:25.240Z"), + objectCreated: new Date("2025-03-11T01:40:18.315Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "shippotle@shippo.com", - objectUpdated: new Date("2023-10-10T14:19:01.603Z"), + objectUpdated: new Date("2023-07-08T02:32:49.310Z"), status: "SUCCESS", }; ``` diff --git a/docs/models/components/manifestcreaterequestaddressfrom.md b/docs/models/components/manifestcreaterequestaddressfrom.md index 44333632..c9aef88f 100644 --- a/docs/models/components/manifestcreaterequestaddressfrom.md +++ b/docs/models/components/manifestcreaterequestaddressfrom.md @@ -1,24 +1,32 @@ # ManifestCreateRequestAddressFrom -## Example Usage - -```typescript -import { ManifestCreateRequestAddressFrom } from "shippo/models/components"; - -let value: ManifestCreateRequestAddressFrom = ""; -``` ## Supported Types ### `components.AddressCreateRequest` ```typescript -const value: components.AddressCreateRequest = /* values here */ +const value: components.AddressCreateRequest = { + name: "Shwan Ippotle", + company: "Shippo", + street1: "215 Clayton St.", + street3: "", + streetNo: "", + city: "San Francisco", + state: "CA", + zip: "94117", + country: "US", + phone: "+1 555 341 9393", + email: "shippotle@shippo.com", + isResidential: true, + metadata: "Customer ID 123456", + validate: true, +}; ``` ### `string` ```typescript -const value: string = /* values here */ +const value: string = ""; ``` diff --git a/docs/models/components/manifestpaginatedlist.md b/docs/models/components/manifestpaginatedlist.md index 0022545e..5500fb83 100644 --- a/docs/models/components/manifestpaginatedlist.md +++ b/docs/models/components/manifestpaginatedlist.md @@ -19,10 +19,10 @@ let value: ManifestPaginatedList = { documents: [ "https://shippo-delivery.s3.amazonaws.com/0fadebf6f60c4aca95fa01bcc59c79ae.pdf?Signature=tlQU3RECwdHUQJQadwqg5bAzGFQ%3D&Expires=1402803835&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", ], - objectCreated: new Date("2022-05-29T11:30:35.227Z"), + objectCreated: new Date("2023-01-13T20:07:38.173Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "shippotle@shippo.com", - objectUpdated: new Date("2022-11-23T22:01:05.887Z"), + objectUpdated: new Date("2024-01-30T12:51:46.829Z"), status: "SUCCESS", }, ], diff --git a/docs/models/components/parameterst.md b/docs/models/components/parameterst.md index 3b63baa4..9f5deb38 100644 --- a/docs/models/components/parameterst.md +++ b/docs/models/components/parameterst.md @@ -1,11 +1,35 @@ # ParametersT -## Example Usage + +## Supported Types + +### `{ [k: string]: any }` + +```typescript +const value: { [k: string]: any } = { + "key": "", +}; +``` + +### `components.FedExConnectExistingOwnAccountParameters` ```typescript -import { ParametersT } from "shippo/models/components"; +const value: components.FedExConnectExistingOwnAccountParameters = { + firstName: "Bernie", + lastName: "Conn", + phoneNumber: "480.809.4967", + fromAddressSt: "", + fromAddressCity: "", + fromAddressState: "", + fromAddressZip: "", + fromAddressCountryIso2: "", +}; +``` -let value: ParametersT = { +### `components.UPSConnectExistingOwnAccountParameters` + +```typescript +const value: components.UPSConnectExistingOwnAccountParameters = { accountNumber: "94567e", aiaCountryIso2: "US", billingAddressCity: "San Francisco", @@ -31,23 +55,3 @@ let value: ParametersT = { }; ``` -## Supported Types - -### `{ [k: string]: any }` - -```typescript -const value: { [k: string]: any } = /* values here */ -``` - -### `components.FedExConnectExistingOwnAccountParameters` - -```typescript -const value: components.FedExConnectExistingOwnAccountParameters = /* values here */ -``` - -### `components.UPSConnectExistingOwnAccountParameters` - -```typescript -const value: components.UPSConnectExistingOwnAccountParameters = /* values here */ -``` - diff --git a/docs/models/components/parcel.md b/docs/models/components/parcel.md index a817dc69..ef223ea9 100644 --- a/docs/models/components/parcel.md +++ b/docs/models/components/parcel.md @@ -6,31 +6,12 @@ import { Parcel } from "shippo/models/components"; let value: Parcel = { - extra: { - cod: { - amount: "5.5", - currency: "USD", - paymentMethod: "CASH", - }, - insurance: { - amount: "5.5", - content: "Laptop", - currency: "USD", - provider: "UPS", - }, - }, - metadata: "Customer ID 123456", massUnit: "lb", weight: "1", distanceUnit: "in", height: "1", length: "1", width: "1", - objectCreated: new Date("2014-07-09T02:19:13.174Z"), - objectId: "adcfdddf8ec64b84ad22772bce3ea37a", - objectOwner: "shippotle@shippo.com", - objectState: "VALID", - objectUpdated: new Date("2014-07-09T02:19:13.174Z"), }; ``` diff --git a/docs/models/components/parcelcreatefromtemplaterequest.md b/docs/models/components/parcelcreatefromtemplaterequest.md index 52e3c350..e9b66c33 100644 --- a/docs/models/components/parcelcreatefromtemplaterequest.md +++ b/docs/models/components/parcelcreatefromtemplaterequest.md @@ -22,7 +22,7 @@ let value: ParcelCreateFromTemplateRequest = { metadata: "Customer ID 123456", massUnit: "lb", weight: "1", - template: "FedEx_Envelope", + template: "DPD_UK_Express_Pak", }; ``` diff --git a/docs/models/components/parcelpaginatedlist.md b/docs/models/components/parcelpaginatedlist.md index 0f2b4008..eb8d3c1f 100644 --- a/docs/models/components/parcelpaginatedlist.md +++ b/docs/models/components/parcelpaginatedlist.md @@ -10,31 +10,12 @@ let value: ParcelPaginatedList = { previous: "baseurl?page=1&results=10", results: [ { - extra: { - cod: { - amount: "5.5", - currency: "USD", - paymentMethod: "CASH", - }, - insurance: { - amount: "5.5", - content: "Laptop", - currency: "USD", - provider: "UPS", - }, - }, - metadata: "Customer ID 123456", massUnit: "lb", weight: "1", distanceUnit: "in", height: "1", length: "1", width: "1", - objectCreated: new Date("2014-07-09T02:19:13.174Z"), - objectId: "adcfdddf8ec64b84ad22772bce3ea37a", - objectOwner: "shippotle@shippo.com", - objectState: "VALID", - objectUpdated: new Date("2014-07-09T02:19:13.174Z"), }, ], }; diff --git a/docs/models/components/parcels.md b/docs/models/components/parcels.md index bff2296e..48e7b6a8 100644 --- a/docs/models/components/parcels.md +++ b/docs/models/components/parcels.md @@ -1,30 +1,62 @@ # Parcels -## Example Usage - -```typescript -import { Parcels } from "shippo/models/components"; - -let value: Parcels = ""; -``` ## Supported Types ### `components.ParcelCreateRequest` ```typescript -const value: components.ParcelCreateRequest = /* values here */ +const value: components.ParcelCreateRequest = { + extra: { + cod: { + amount: "5.5", + currency: "USD", + paymentMethod: "CASH", + }, + insurance: { + amount: "5.5", + content: "Laptop", + currency: "USD", + provider: "UPS", + }, + }, + metadata: "Customer ID 123456", + massUnit: "lb", + weight: "1", + distanceUnit: "in", + height: "1", + length: "1", + width: "1", +}; ``` ### `components.ParcelCreateFromTemplateRequest` ```typescript -const value: components.ParcelCreateFromTemplateRequest = /* values here */ +const value: components.ParcelCreateFromTemplateRequest = { + extra: { + cod: { + amount: "5.5", + currency: "USD", + paymentMethod: "CASH", + }, + insurance: { + amount: "5.5", + content: "Laptop", + currency: "USD", + provider: "UPS", + }, + }, + metadata: "Customer ID 123456", + massUnit: "lb", + weight: "1", + template: "USPS_MediumFlatRateBox1", +}; ``` ### `string` ```typescript -const value: string = /* values here */ +const value: string = ""; ``` diff --git a/docs/models/components/parceltemplatearamexaustraliaenum.md b/docs/models/components/parceltemplatearamexaustraliaenum.md index 208509d2..c07132a8 100644 --- a/docs/models/components/parceltemplatearamexaustraliaenum.md +++ b/docs/models/components/parceltemplatearamexaustraliaenum.md @@ -13,7 +13,7 @@ ```typescript import { ParcelTemplateAramexAustraliaEnum } from "shippo/models/components"; -let value: ParcelTemplateAramexAustraliaEnum = "Fastway_Australia_Satchel_A4"; +let value: ParcelTemplateAramexAustraliaEnum = "Fastway_Australia_Satchel_A3"; ``` ## Values diff --git a/docs/models/components/parceltemplatecourierspleaseenum.md b/docs/models/components/parceltemplatecourierspleaseenum.md deleted file mode 100644 index 841e7d69..00000000 --- a/docs/models/components/parceltemplatecourierspleaseenum.md +++ /dev/null @@ -1,23 +0,0 @@ -# ParcelTemplateCouriersPleaseEnum - -|Token | Name | Dimensions| -|:---|:---|:---| -| couriersplease_500g_satchel | 500g Satchel | 22.00 x 33.50 x 0.10 cm| -| couriersplease_1kg_satchel | 1kg Satchel | 28.00 x 35.00 x 0.10 cm| -| couriersplease_3kg_satchel | 3kg Satchel | 34.00 x 42.00 x 0.10 cm| -| couriersplease_5kg_satchel | 5kg Satchel | 43.70 x 59.70 x 0.10 cm| - - -## Example Usage - -```typescript -import { ParcelTemplateCouriersPleaseEnum } from "shippo/models/components"; - -let value: ParcelTemplateCouriersPleaseEnum = "couriersplease_1kg_satchel"; -``` - -## Values - -```typescript -"couriersplease_500g_satchel" | "couriersplease_1kg_satchel" | "couriersplease_3kg_satchel" | "couriersplease_5kg_satchel" -``` \ No newline at end of file diff --git a/docs/models/components/parceltemplatedhlecommerceenum.md b/docs/models/components/parceltemplatedhlecommerceenum.md index cd02760a..8ffc8e39 100644 --- a/docs/models/components/parceltemplatedhlecommerceenum.md +++ b/docs/models/components/parceltemplatedhlecommerceenum.md @@ -11,7 +11,7 @@ ```typescript import { ParcelTemplateDHLeCommerceEnum } from "shippo/models/components"; -let value: ParcelTemplateDHLeCommerceEnum = "DHLeC_SM_Flats"; +let value: ParcelTemplateDHLeCommerceEnum = "DHLeC_Irregular"; ``` ## Values diff --git a/docs/models/components/parceltemplateenumset.md b/docs/models/components/parceltemplateenumset.md index bae8eee6..ea8a12cf 100644 --- a/docs/models/components/parceltemplateenumset.md +++ b/docs/models/components/parceltemplateenumset.md @@ -2,55 +2,43 @@ If template is passed, `length`, `width`, `height`, and `distance_unit` are not required -## Example Usage - -```typescript -import { ParcelTemplateEnumSet } from "shippo/models/components"; - -let value: ParcelTemplateEnumSet = "UPS_Pad_Pak"; -``` ## Supported Types ### `components.ParcelTemplateFedExEnum` ```typescript -const value: components.ParcelTemplateFedExEnum = /* values here */ +const value: components.ParcelTemplateFedExEnum = "FedEx_Box_Large_2"; ``` ### `components.ParcelTemplateUPSEnum` ```typescript -const value: components.ParcelTemplateUPSEnum = /* values here */ +const value: components.ParcelTemplateUPSEnum = "UPS_Express_Tube"; ``` ### `components.ParcelTemplateUSPSEnum` ```typescript -const value: components.ParcelTemplateUSPSEnum = /* values here */ +const value: components.ParcelTemplateUSPSEnum = "USPS_RegionalRateBoxA1"; ``` ### `components.ParcelTemplateDHLeCommerceEnum` ```typescript -const value: components.ParcelTemplateDHLeCommerceEnum = /* values here */ +const value: components.ParcelTemplateDHLeCommerceEnum = "DHLeC_Irregular"; ``` ### `components.ParcelTemplateDPDUKEnum` ```typescript -const value: components.ParcelTemplateDPDUKEnum = /* values here */ -``` - -### `components.ParcelTemplateCouriersPleaseEnum` - -```typescript -const value: components.ParcelTemplateCouriersPleaseEnum = /* values here */ +const value: components.ParcelTemplateDPDUKEnum = "DPD_UK_Express_Pak"; ``` ### `components.ParcelTemplateAramexAustraliaEnum` ```typescript -const value: components.ParcelTemplateAramexAustraliaEnum = /* values here */ +const value: components.ParcelTemplateAramexAustraliaEnum = + "Fastway_Australia_Satchel_A4"; ``` diff --git a/docs/models/components/parceltemplatefedexenum.md b/docs/models/components/parceltemplatefedexenum.md index e8ffba3c..42030a38 100644 --- a/docs/models/components/parceltemplatefedexenum.md +++ b/docs/models/components/parceltemplatefedexenum.md @@ -25,7 +25,7 @@ ```typescript import { ParcelTemplateFedExEnum } from "shippo/models/components"; -let value: ParcelTemplateFedExEnum = "FedEx_Box_Small_1"; +let value: ParcelTemplateFedExEnum = "FedEx_Envelope"; ``` ## Values diff --git a/docs/models/components/parceltemplateupsenum.md b/docs/models/components/parceltemplateupsenum.md index 5410a6cb..fdc9768c 100644 --- a/docs/models/components/parceltemplateupsenum.md +++ b/docs/models/components/parceltemplateupsenum.md @@ -34,7 +34,7 @@ ```typescript import { ParcelTemplateUPSEnum } from "shippo/models/components"; -let value: ParcelTemplateUPSEnum = "UPS_Express_Tube"; +let value: ParcelTemplateUPSEnum = "UPS_Express_Box_Small"; ``` ## Values diff --git a/docs/models/components/parceltemplateuspsenum.md b/docs/models/components/parceltemplateuspsenum.md index fa7b6915..a9bd085a 100644 --- a/docs/models/components/parceltemplateuspsenum.md +++ b/docs/models/components/parceltemplateuspsenum.md @@ -29,7 +29,7 @@ ```typescript import { ParcelTemplateUSPSEnum } from "shippo/models/components"; -let value: ParcelTemplateUSPSEnum = "USPS_FlatRateWindowEnvelope"; +let value: ParcelTemplateUSPSEnum = "USPS_FlatRateGiftCardEnvelope"; ``` ## Values diff --git a/docs/models/components/pickup.md b/docs/models/components/pickup.md index 61071af0..2e696044 100644 --- a/docs/models/components/pickup.md +++ b/docs/models/components/pickup.md @@ -28,8 +28,8 @@ let value: Pickup = { buildingType: "apartment", instructions: "Behind screen door", }, - requestedEndTime: new Date("2023-12-16T16:55:27.891Z"), - requestedStartTime: new Date("2023-04-18T20:01:49.892Z"), + requestedEndTime: new Date("2023-03-01T13:18:23.203Z"), + requestedStartTime: new Date("2023-08-08T04:42:30.927Z"), transactions: [ "adcfdddf8ec64b84ad22772bce3ea37a", ], diff --git a/docs/models/components/pickupbase.md b/docs/models/components/pickupbase.md index b00e85f1..0f16f044 100644 --- a/docs/models/components/pickupbase.md +++ b/docs/models/components/pickupbase.md @@ -28,8 +28,8 @@ let value: PickupBase = { buildingType: "apartment", instructions: "Behind screen door", }, - requestedEndTime: new Date("2024-09-09T14:45:41.967Z"), - requestedStartTime: new Date("2023-02-07T20:20:50.747Z"), + requestedEndTime: new Date("2023-01-21T07:11:50.213Z"), + requestedStartTime: new Date("2025-05-19T21:25:27.801Z"), transactions: [ "adcfdddf8ec64b84ad22772bce3ea37a", ], diff --git a/docs/models/components/preferreddeliverytimeframe.md b/docs/models/components/preferreddeliverytimeframe.md index 5d6c1b50..c0b3c76e 100644 --- a/docs/models/components/preferreddeliverytimeframe.md +++ b/docs/models/components/preferreddeliverytimeframe.md @@ -7,7 +7,7 @@ Required for DHL Germany Paket Sameday. Designates a desired timeframe for deliv ```typescript import { PreferredDeliveryTimeframe } from "shippo/models/components"; -let value: PreferredDeliveryTimeframe = "16001800"; +let value: PreferredDeliveryTimeframe = "19002100"; ``` ## Values diff --git a/docs/models/components/provider.md b/docs/models/components/provider.md index 9808dd7f..efc84cfb 100644 --- a/docs/models/components/provider.md +++ b/docs/models/components/provider.md @@ -7,7 +7,7 @@ To have insurance cover provided by a carrier directly instead of Shippo's provi ```typescript import { Provider } from "shippo/models/components"; -let value: Provider = "UPS"; +let value: Provider = "FEDEX"; ``` ## Values diff --git a/docs/models/components/rate.md b/docs/models/components/rate.md index ca228a15..3afb274f 100644 --- a/docs/models/components/rate.md +++ b/docs/models/components/rate.md @@ -12,7 +12,7 @@ let value: Rate = { currencyLocal: "USD", arrivesBy: "08:30:00", attributes: [ - "FASTEST", + "CHEAPEST", ], carrierAccount: "078870331023437cb917f5187429b093", durationTerms: "Delivery in 1 to 3 business days", @@ -25,7 +25,7 @@ let value: Rate = { text: "UPS API did not respond. Please try again in a few minutes.", }, ], - objectCreated: new Date("2024-06-02T14:07:36.077Z"), + objectCreated: new Date("2025-10-14T04:15:01.236Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "pp@gmail.com", provider: "USPS", diff --git a/docs/models/components/ratepaginatedlist.md b/docs/models/components/ratepaginatedlist.md index b508217d..4719203c 100644 --- a/docs/models/components/ratepaginatedlist.md +++ b/docs/models/components/ratepaginatedlist.md @@ -29,7 +29,7 @@ let value: RatePaginatedList = { text: "UPS API did not respond. Please try again in a few minutes.", }, ], - objectCreated: new Date("2022-04-20T20:22:04.958Z"), + objectCreated: new Date("2023-02-04T21:29:28.328Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "pp@gmail.com", provider: "USPS", diff --git a/docs/models/components/returnservicetype.md b/docs/models/components/returnservicetype.md index a15e87cb..b17aebdb 100644 --- a/docs/models/components/returnservicetype.md +++ b/docs/models/components/returnservicetype.md @@ -2,25 +2,20 @@ Request additional return option for return shipments (UPS and Lasership only). -## Example Usage - -```typescript -import { ReturnServiceType } from "shippo/models/components"; - -let value: ReturnServiceType = "NO_RETURN"; -``` ## Supported Types ### `components.ShipmentExtraReturnServiceTypeUPSEnum` ```typescript -const value: components.ShipmentExtraReturnServiceTypeUPSEnum = /* values here */ +const value: components.ShipmentExtraReturnServiceTypeUPSEnum = + "PRINT_AND_MAIL"; ``` ### `components.ShipmentExtraReturnServiceTypeLasershipEnum` ```typescript -const value: components.ShipmentExtraReturnServiceTypeLasershipEnum = /* values here */ +const value: components.ShipmentExtraReturnServiceTypeLasershipEnum = + "NO_RETURN"; ``` diff --git a/docs/models/components/servicelevelairterraenum.md b/docs/models/components/servicelevelairterraenum.md index d26a6b2f..796d6443 100644 --- a/docs/models/components/servicelevelairterraenum.md +++ b/docs/models/components/servicelevelairterraenum.md @@ -11,7 +11,7 @@ ```typescript import { ServiceLevelAirterraEnum } from "shippo/models/components"; -let value: ServiceLevelAirterraEnum = "airterra_postal"; +let value: ServiceLevelAirterraEnum = "airterra_ground"; ``` ## Values diff --git a/docs/models/components/servicelevelaramexaustraliaenum.md b/docs/models/components/servicelevelaramexaustraliaenum.md index 31096347..55412f0b 100644 --- a/docs/models/components/servicelevelaramexaustraliaenum.md +++ b/docs/models/components/servicelevelaramexaustraliaenum.md @@ -14,7 +14,7 @@ ```typescript import { ServiceLevelAramexAustraliaEnum } from "shippo/models/components"; -let value: ServiceLevelAramexAustraliaEnum = "fastway_australia_parcel"; +let value: ServiceLevelAramexAustraliaEnum = "fastway_australia_box_medium"; ``` ## Values diff --git a/docs/models/components/servicelevelasendiaenum.md b/docs/models/components/servicelevelasendiaenum.md index b86daae3..37d36e93 100644 --- a/docs/models/components/servicelevelasendiaenum.md +++ b/docs/models/components/servicelevelasendiaenum.md @@ -17,7 +17,7 @@ ```typescript import { ServiceLevelAsendiaEnum } from "shippo/models/components"; -let value: ServiceLevelAsendiaEnum = "asendia_us_international_surface_airlift"; +let value: ServiceLevelAsendiaEnum = "asendia_us_priority_mail_international"; ``` ## Values diff --git a/docs/models/components/servicelevelaustraliapostenum.md b/docs/models/components/servicelevelaustraliapostenum.md index 1920f59d..eaef3ed7 100644 --- a/docs/models/components/servicelevelaustraliapostenum.md +++ b/docs/models/components/servicelevelaustraliapostenum.md @@ -20,7 +20,7 @@ import { ServiceLevelAustraliaPostEnum } from "shippo/models/components"; let value: ServiceLevelAustraliaPostEnum = - "australia_post_pack_and_track_international"; + "australia_post_international_economy"; ``` ## Values diff --git a/docs/models/components/servicelevelcanadapostenum.md b/docs/models/components/servicelevelcanadapostenum.md index 0bd91c4f..9924031a 100644 --- a/docs/models/components/servicelevelcanadapostenum.md +++ b/docs/models/components/servicelevelcanadapostenum.md @@ -23,8 +23,7 @@ ```typescript import { ServiceLevelCanadaPostEnum } from "shippo/models/components"; -let value: ServiceLevelCanadaPostEnum = - "canada_post_small_packet_international_air"; +let value: ServiceLevelCanadaPostEnum = "canada_post_expedited_parcel"; ``` ## Values diff --git a/docs/models/components/servicelevelchronopostenum.md b/docs/models/components/servicelevelchronopostenum.md index 18b11093..b862a0d0 100644 --- a/docs/models/components/servicelevelchronopostenum.md +++ b/docs/models/components/servicelevelchronopostenum.md @@ -15,7 +15,7 @@ ```typescript import { ServiceLevelChronopostEnum } from "shippo/models/components"; -let value: ServiceLevelChronopostEnum = "chronopost_18"; +let value: ServiceLevelChronopostEnum = "chronopost_classic"; ``` ## Values diff --git a/docs/models/components/servicelevelcolissimoenum.md b/docs/models/components/servicelevelcolissimoenum.md index 78d0a44a..1ff1e2c9 100644 --- a/docs/models/components/servicelevelcolissimoenum.md +++ b/docs/models/components/servicelevelcolissimoenum.md @@ -12,7 +12,7 @@ ```typescript import { ServiceLevelColissimoEnum } from "shippo/models/components"; -let value: ServiceLevelColissimoEnum = "colissimo_home"; +let value: ServiceLevelColissimoEnum = "colissimo_pick_up_point"; ``` ## Values diff --git a/docs/models/components/servicelevelcourierspleaseenum.md b/docs/models/components/servicelevelcourierspleaseenum.md deleted file mode 100644 index 95262e08..00000000 --- a/docs/models/components/servicelevelcourierspleaseenum.md +++ /dev/null @@ -1,31 +0,0 @@ -# ServiceLevelCouriersPleaseEnum - -|Token | Service name| -|:---|:---| -| couriersplease_domestic_priority_auth_to_leave | Domestic Priority - Authority To Leave/POPPoints| -| couriersplease_domestic_priority_sign_required | Domestic Priority - Signature Required| -| couriersplease_gold_domestic_auth_to_leave | Gold Domestic - Authority To Leave/POPPoints| -| couriersplease_gold_domestic_sign_required | Gold Domestic - Signature Required| -| couriersplease_off_peak_auth_to_leave | Off Peak - Authority To Leave/POPPoints| -| couriersplease_off_peak_sign_required | Off Peak - Signature Required| -| couriersplease_parcel_auth_to_leave | Parcel - Authority To Leave| -| couriersplease_parcel_sign_required | Parcel - Signature Required| -| couriersplease_road_express | Road Express| -| couriersplease_satchel_auth_to_leave | Satchel - Authority To Leave| -| couriersplease_satchel_sign_required | Satchel - Signature Required| - - -## Example Usage - -```typescript -import { ServiceLevelCouriersPleaseEnum } from "shippo/models/components"; - -let value: ServiceLevelCouriersPleaseEnum = - "couriersplease_gold_domestic_auth_to_leave"; -``` - -## Values - -```typescript -"couriersplease_domestic_priority_auth_to_leave" | "couriersplease_domestic_priority_sign_required" | "couriersplease_gold_domestic_auth_to_leave" | "couriersplease_gold_domestic_sign_required" | "couriersplease_off_peak_auth_to_leave" | "couriersplease_off_peak_sign_required" | "couriersplease_parcel_auth_to_leave" | "couriersplease_parcel_sign_required" | "couriersplease_road_express" | "couriersplease_satchel_auth_to_leave" | "couriersplease_satchel_sign_required" -``` \ No newline at end of file diff --git a/docs/models/components/serviceleveldeutschepostenum.md b/docs/models/components/serviceleveldeutschepostenum.md index bdbb5531..ff58a2c8 100644 --- a/docs/models/components/serviceleveldeutschepostenum.md +++ b/docs/models/components/serviceleveldeutschepostenum.md @@ -19,7 +19,8 @@ ```typescript import { ServiceLevelDeutschePostEnum } from "shippo/models/components"; -let value: ServiceLevelDeutschePostEnum = "deutsche_post_postkarte"; +let value: ServiceLevelDeutschePostEnum = + "deutsche_post_warenpost_international_s"; ``` ## Values diff --git a/docs/models/components/serviceleveldhlecommerceenum.md b/docs/models/components/serviceleveldhlecommerceenum.md index 0b9a3dac..baa658e0 100644 --- a/docs/models/components/serviceleveldhlecommerceenum.md +++ b/docs/models/components/serviceleveldhlecommerceenum.md @@ -38,7 +38,7 @@ import { ServiceLevelDHLeCommerceEnum } from "shippo/models/components"; let value: ServiceLevelDHLeCommerceEnum = - "dhl_ecommerce_parcel_international_standard"; + "dhl_ecommerce_globalmail_business_isal"; ``` ## Values diff --git a/docs/models/components/serviceleveldhlexpressenum.md b/docs/models/components/serviceleveldhlexpressenum.md index b8f1d063..d941b0a2 100644 --- a/docs/models/components/serviceleveldhlexpressenum.md +++ b/docs/models/components/serviceleveldhlexpressenum.md @@ -31,7 +31,7 @@ ```typescript import { ServiceLevelDHLExpressEnum } from "shippo/models/components"; -let value: ServiceLevelDHLExpressEnum = "dhl_express_break_bulk_express_doc"; +let value: ServiceLevelDHLExpressEnum = "dhl_express_worldwide_doc"; ``` ## Values diff --git a/docs/models/components/serviceleveldpdukenum.md b/docs/models/components/serviceleveldpdukenum.md index 90a756db..f735f337 100644 --- a/docs/models/components/serviceleveldpdukenum.md +++ b/docs/models/components/serviceleveldpdukenum.md @@ -26,7 +26,7 @@ ```typescript import { ServiceLevelDPDUKEnum } from "shippo/models/components"; -let value: ServiceLevelDPDUKEnum = "dpd_uk_saturday"; +let value: ServiceLevelDPDUKEnum = "dpd_uk_direct_tracked_mail"; ``` ## Values diff --git a/docs/models/components/servicelevelenumset.md b/docs/models/components/servicelevelenumset.md index 9b766055..826f725e 100644 --- a/docs/models/components/servicelevelenumset.md +++ b/docs/models/components/servicelevelenumset.md @@ -1,246 +1,248 @@ # ServiceLevelEnumSet -## Example Usage - -```typescript -import { ServiceLevelEnumSet } from "shippo/models/components"; - -let value: ServiceLevelEnumSet = "uds_next_day"; -``` ## Supported Types ### `components.ServiceLevelUSPSEnum` ```typescript -const value: components.ServiceLevelUSPSEnum = /* values here */ +const value: components.ServiceLevelUSPSEnum = "usps_priority_express"; ``` ### `components.ServiceLevelFedExEnum` ```typescript -const value: components.ServiceLevelFedExEnum = /* values here */ +const value: components.ServiceLevelFedExEnum = "fedex_ground"; ``` ### `components.ServiceLevelUPSEnum` ```typescript -const value: components.ServiceLevelUPSEnum = /* values here */ +const value: components.ServiceLevelUPSEnum = "ups_ground"; ``` ### `components.ServiceLevelAirterraEnum` ```typescript -const value: components.ServiceLevelAirterraEnum = /* values here */ +const value: components.ServiceLevelAirterraEnum = "airterra_postal"; ``` ### `components.ServiceLevelAPCPostalEnum` ```typescript -const value: components.ServiceLevelAPCPostalEnum = /* values here */ +const value: components.ServiceLevelAPCPostalEnum = + "apc_postal_parcelconnect_book_service"; ``` ### `components.ServiceLevelAsendiaEnum` ```typescript -const value: components.ServiceLevelAsendiaEnum = /* values here */ +const value: components.ServiceLevelAsendiaEnum = + "asendia_us_priority_mail_international"; ``` ### `components.ServiceLevelAustraliaPostEnum` ```typescript -const value: components.ServiceLevelAustraliaPostEnum = /* values here */ +const value: components.ServiceLevelAustraliaPostEnum = + "australia_post_international_economy"; ``` ### `components.ServiceLevelAPGEnum` ```typescript -const value: components.ServiceLevelAPGEnum = /* values here */ +const value: components.ServiceLevelAPGEnum = "apg_eparcel_expedited"; ``` ### `components.ServiceLevelBetterTrucksEnum` ```typescript -const value: components.ServiceLevelBetterTrucksEnum = /* values here */ +const value: components.ServiceLevelBetterTrucksEnum = "better_trucks_same_day"; ``` ### `components.ServiceLevelCanadaPostEnum` ```typescript -const value: components.ServiceLevelCanadaPostEnum = /* values here */ +const value: components.ServiceLevelCanadaPostEnum = + "canada_post_tracked_packet_international"; ``` ### `components.ServiceLevelCDLEnum` ```typescript -const value: components.ServiceLevelCDLEnum = /* values here */ +const value: components.ServiceLevelCDLEnum = "cdl_next_day"; ``` ### `components.ServiceLevelChronopostEnum` ```typescript -const value: components.ServiceLevelChronopostEnum = /* values here */ -``` - -### `components.ServiceLevelCouriersPleaseEnum` - -```typescript -const value: components.ServiceLevelCouriersPleaseEnum = /* values here */ +const value: components.ServiceLevelChronopostEnum = "chronopost_10"; ``` ### `components.ServiceLevelCorreosEspanaEnum` ```typescript -const value: components.ServiceLevelCorreosEspanaEnum = /* values here */ +const value: components.ServiceLevelCorreosEspanaEnum = "correos_standard_home"; ``` ### `components.ServiceLevelColissimoEnum` ```typescript -const value: components.ServiceLevelColissimoEnum = /* values here */ +const value: components.ServiceLevelColissimoEnum = + "colissimo_return_mainland_france"; ``` ### `components.ServiceLevelPurolatorEnum` ```typescript -const value: components.ServiceLevelPurolatorEnum = /* values here */ +const value: components.ServiceLevelPurolatorEnum = "purolator_ground_us"; ``` ### `components.ServiceLevelDHLExpressEnum` ```typescript -const value: components.ServiceLevelDHLExpressEnum = /* values here */ +const value: components.ServiceLevelDHLExpressEnum = + "dhl_express_economy_select_nondoc"; ``` ### `components.ServiceLevelDHLeCommerceEnum` ```typescript -const value: components.ServiceLevelDHLeCommerceEnum = /* values here */ +const value: components.ServiceLevelDHLeCommerceEnum = + "dhl_ecommerce_parcels_ground"; ``` ### `components.ServiceLevelDHLGermanyEnum` ```typescript -const value: components.ServiceLevelDHLGermanyEnum = /* values here */ +const value: components.ServiceLevelDHLGermanyEnum = + "dhl_germany_paket_priority"; ``` ### `components.ServiceLevelDPDDEEnum` ```typescript -const value: components.ServiceLevelDPDDEEnum = /* values here */ +const value: components.ServiceLevelDPDDEEnum = "dpd_de_classic"; ``` ### `components.ServiceLevelDPDUKEnum` ```typescript -const value: components.ServiceLevelDPDUKEnum = /* values here */ +const value: components.ServiceLevelDPDUKEnum = "dpd_uk_two_day"; ``` ### `components.ServiceLevelDeutschePostEnum` ```typescript -const value: components.ServiceLevelDeutschePostEnum = /* values here */ +const value: components.ServiceLevelDeutschePostEnum = + "deutsche_post_warenpost_international_m"; ``` ### `components.ServiceLevelAramexAustraliaEnum` ```typescript -const value: components.ServiceLevelAramexAustraliaEnum = /* values here */ +const value: components.ServiceLevelAramexAustraliaEnum = + "fastway_australia_satchel"; ``` ### `components.ServiceLevelGlobegisticsEnum` ```typescript -const value: components.ServiceLevelGlobegisticsEnum = /* values here */ +const value: components.ServiceLevelGlobegisticsEnum = + "globegistics_ecom_extra"; ``` ### `components.ServiceLevelGLSUSEnum` ```typescript -const value: components.ServiceLevelGLSUSEnum = /* values here */ +const value: components.ServiceLevelGLSUSEnum = "gls_us_eps"; ``` ### `components.ServiceLevelLSOEnum` ```typescript -const value: components.ServiceLevelLSOEnum = /* values here */ +const value: components.ServiceLevelLSOEnum = "lso_early_overnight"; ``` ### `components.ServiceLevelMondialRelayEnum` ```typescript -const value: components.ServiceLevelMondialRelayEnum = /* values here */ +const value: components.ServiceLevelMondialRelayEnum = + "mondial_relay_pointrelais"; ``` ### `components.ServiceLevelParcelforceEnum` ```typescript -const value: components.ServiceLevelParcelforceEnum = /* values here */ +const value: components.ServiceLevelParcelforceEnum = "parcelforce_expressam"; ``` ### `components.ServiceLevelPostItalianeEnum` ```typescript -const value: components.ServiceLevelPostItalianeEnum = /* values here */ +const value: components.ServiceLevelPostItalianeEnum = + "poste_italiane_delivery_business_express"; ``` ### `components.ServiceLevelePostGlobalEnum` ```typescript -const value: components.ServiceLevelePostGlobalEnum = /* values here */ +const value: components.ServiceLevelePostGlobalEnum = + "rr_donnelley_domestic_parcel_bpm"; ``` ### `components.ServiceLevelRoyalMailEnum` ```typescript -const value: components.ServiceLevelRoyalMailEnum = /* values here */ +const value: components.ServiceLevelRoyalMailEnum = "royal_mail_24_flat_rate"; ``` ### `components.ServiceLevelSendleEnum` ```typescript -const value: components.ServiceLevelSendleEnum = /* values here */ +const value: components.ServiceLevelSendleEnum = "sendle_standard_dropoff"; ``` ### `components.ServiceLevelOnTracEnum` ```typescript -const value: components.ServiceLevelOnTracEnum = /* values here */ +const value: components.ServiceLevelOnTracEnum = "ontrac_ground"; ``` ### `components.ServiceLevelJitsuEnum` ```typescript -const value: components.ServiceLevelJitsuEnum = /* values here */ +const value: components.ServiceLevelJitsuEnum = "axlehire_same_day"; ``` ### `components.ServiceLevelLasershipEnum` ```typescript -const value: components.ServiceLevelLasershipEnum = /* values here */ +const value: components.ServiceLevelLasershipEnum = "lasership_routed_delivery"; ``` ### `components.ServiceLevelEvriUKEnum` ```typescript -const value: components.ServiceLevelEvriUKEnum = /* values here */ +const value: components.ServiceLevelEvriUKEnum = + "hermes_uk_parcelshop_dropoff_nextday"; ``` ### `components.ServiceLevelUDSEnum` ```typescript -const value: components.ServiceLevelUDSEnum = /* values here */ +const value: components.ServiceLevelUDSEnum = "uds_next_day"; ``` ### `components.ServiceLevelVehoEnum` ```typescript -const value: components.ServiceLevelVehoEnum = /* values here */ +const value: components.ServiceLevelVehoEnum = "veho_next_day"; ``` ### `components.ServiceLevelSwyftEnum` ```typescript -const value: components.ServiceLevelSwyftEnum = /* values here */ +const value: components.ServiceLevelSwyftEnum = "same_day"; ``` diff --git a/docs/models/components/servicelevelevriukenum.md b/docs/models/components/servicelevelevriukenum.md index 794e8bbe..cd39b128 100644 --- a/docs/models/components/servicelevelevriukenum.md +++ b/docs/models/components/servicelevelevriukenum.md @@ -14,7 +14,7 @@ ```typescript import { ServiceLevelEvriUKEnum } from "shippo/models/components"; -let value: ServiceLevelEvriUKEnum = "hermes_uk_postable"; +let value: ServiceLevelEvriUKEnum = "hermes_uk_postable_nextday"; ``` ## Values diff --git a/docs/models/components/servicelevelfedexenum.md b/docs/models/components/servicelevelfedexenum.md index fdbccda6..ef05be88 100644 --- a/docs/models/components/servicelevelfedexenum.md +++ b/docs/models/components/servicelevelfedexenum.md @@ -33,7 +33,7 @@ ```typescript import { ServiceLevelFedExEnum } from "shippo/models/components"; -let value: ServiceLevelFedExEnum = "fedex_europe_first_international_priority"; +let value: ServiceLevelFedExEnum = "fedex_international_economy"; ``` ## Values diff --git a/docs/models/components/servicelevelglobegisticsenum.md b/docs/models/components/servicelevelglobegisticsenum.md index 59d975d9..c2946c37 100644 --- a/docs/models/components/servicelevelglobegisticsenum.md +++ b/docs/models/components/servicelevelglobegisticsenum.md @@ -22,7 +22,7 @@ import { ServiceLevelGlobegisticsEnum } from "shippo/models/components"; let value: ServiceLevelGlobegisticsEnum = - "globegistics_ecom_priority_mail_express_international_ddp"; + "globegistics_ecom_international_priority_airmail"; ``` ## Values diff --git a/docs/models/components/servicelevelglsusenum.md b/docs/models/components/servicelevelglsusenum.md index fb81bf79..6d67f1e4 100644 --- a/docs/models/components/servicelevelglsusenum.md +++ b/docs/models/components/servicelevelglsusenum.md @@ -15,7 +15,7 @@ ```typescript import { ServiceLevelGLSUSEnum } from "shippo/models/components"; -let value: ServiceLevelGLSUSEnum = "gls_us_ess"; +let value: ServiceLevelGLSUSEnum = "gls_us_cps"; ``` ## Values diff --git a/docs/models/components/servicelevelparcelforceenum.md b/docs/models/components/servicelevelparcelforceenum.md index 603d7d68..59335bb7 100644 --- a/docs/models/components/servicelevelparcelforceenum.md +++ b/docs/models/components/servicelevelparcelforceenum.md @@ -12,7 +12,7 @@ ```typescript import { ServiceLevelParcelforceEnum } from "shippo/models/components"; -let value: ServiceLevelParcelforceEnum = "parcelforce_expressam"; +let value: ServiceLevelParcelforceEnum = "parcelforce_express24"; ``` ## Values diff --git a/docs/models/components/servicelevelpurolatorenum.md b/docs/models/components/servicelevelpurolatorenum.md index ca11af9d..004ccef5 100644 --- a/docs/models/components/servicelevelpurolatorenum.md +++ b/docs/models/components/servicelevelpurolatorenum.md @@ -27,7 +27,7 @@ ```typescript import { ServiceLevelPurolatorEnum } from "shippo/models/components"; -let value: ServiceLevelPurolatorEnum = "purolator_express9_am"; +let value: ServiceLevelPurolatorEnum = "purolator_ground_distribution"; ``` ## Values diff --git a/docs/models/components/servicelevelroyalmailenum.md b/docs/models/components/servicelevelroyalmailenum.md index 6bb9e203..cea404b7 100644 --- a/docs/models/components/servicelevelroyalmailenum.md +++ b/docs/models/components/servicelevelroyalmailenum.md @@ -30,7 +30,7 @@ import { ServiceLevelRoyalMailEnum } from "shippo/models/components"; let value: ServiceLevelRoyalMailEnum = - "royal_mail_special_delivery_guaranteed_1pm"; + "royal_mail_special_delivery_guaranteed_9am"; ``` ## Values diff --git a/docs/models/components/servicelevelsendleenum.md b/docs/models/components/servicelevelsendleenum.md index b529ff3c..67e6f81e 100644 --- a/docs/models/components/servicelevelsendleenum.md +++ b/docs/models/components/servicelevelsendleenum.md @@ -11,7 +11,7 @@ ```typescript import { ServiceLevelSendleEnum } from "shippo/models/components"; -let value: ServiceLevelSendleEnum = "sendle_standard_dropoff"; +let value: ServiceLevelSendleEnum = "sendle_parcel"; ``` ## Values diff --git a/docs/models/components/servicelevelswyftenum.md b/docs/models/components/servicelevelswyftenum.md index 14471d5a..c1edbcb4 100644 --- a/docs/models/components/servicelevelswyftenum.md +++ b/docs/models/components/servicelevelswyftenum.md @@ -11,7 +11,7 @@ ```typescript import { ServiceLevelSwyftEnum } from "shippo/models/components"; -let value: ServiceLevelSwyftEnum = "same_day"; +let value: ServiceLevelSwyftEnum = "next_day"; ``` ## Values diff --git a/docs/models/components/servicelevelupsenum.md b/docs/models/components/servicelevelupsenum.md index 16afb0b3..a1b84e84 100644 --- a/docs/models/components/servicelevelupsenum.md +++ b/docs/models/components/servicelevelupsenum.md @@ -34,7 +34,7 @@ ```typescript import { ServiceLevelUPSEnum } from "shippo/models/components"; -let value: ServiceLevelUPSEnum = "ups_mail_innovations_standard_flat"; +let value: ServiceLevelUPSEnum = "ups_mail_innovations_bpm_flat"; ``` ## Values diff --git a/docs/models/components/serviceleveluspsenum.md b/docs/models/components/serviceleveluspsenum.md index 60c8742e..003bcfe6 100644 --- a/docs/models/components/serviceleveluspsenum.md +++ b/docs/models/components/serviceleveluspsenum.md @@ -16,7 +16,7 @@ ```typescript import { ServiceLevelUSPSEnum } from "shippo/models/components"; -let value: ServiceLevelUSPSEnum = "usps_priority_mail_express_international"; +let value: ServiceLevelUSPSEnum = "usps_priority_express"; ``` ## Values diff --git a/docs/models/components/shipment.md b/docs/models/components/shipment.md index 46b1e823..eb99dc61 100644 --- a/docs/models/components/shipment.md +++ b/docs/models/components/shipment.md @@ -257,37 +257,18 @@ let value: Shipment = { text: "UPS API did not respond. Please try again in a few minutes.", }, ], - objectCreated: new Date("2024-08-09T11:11:16.127Z"), + objectCreated: new Date("2025-10-20T21:33:54.006Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "pp@gmail.com", - objectUpdated: new Date("2022-06-28T02:12:50.953Z"), + objectUpdated: new Date("2024-11-03T21:45:37.821Z"), parcels: [ { - extra: { - cod: { - amount: "5.5", - currency: "USD", - paymentMethod: "CASH", - }, - insurance: { - amount: "5.5", - content: "Laptop", - currency: "USD", - provider: "UPS", - }, - }, - metadata: "Customer ID 123456", massUnit: "lb", weight: "1", distanceUnit: "in", height: "1", length: "1", width: "1", - objectCreated: new Date("2014-07-09T02:19:13.174Z"), - objectId: "adcfdddf8ec64b84ad22772bce3ea37a", - objectOwner: "shippotle@shippo.com", - objectState: "VALID", - objectUpdated: new Date("2014-07-09T02:19:13.174Z"), }, ], rates: [ @@ -311,7 +292,7 @@ let value: Shipment = { text: "UPS API did not respond. Please try again in a few minutes.", }, ], - objectCreated: new Date("2022-05-16T16:57:38.984Z"), + objectCreated: new Date("2024-10-08T12:59:31.265Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "pp@gmail.com", provider: "USPS", diff --git a/docs/models/components/shipmentcreaterequest.md b/docs/models/components/shipmentcreaterequest.md index 10581131..b860c582 100644 --- a/docs/models/components/shipmentcreaterequest.md +++ b/docs/models/components/shipmentcreaterequest.md @@ -109,66 +109,25 @@ let value: ShipmentCreateRequest = { }, metadata: "Customer ID 123456", shipmentDate: "2021-03-22T12:00:00Z", - addressFrom: "d799c2679e644279b59fe661ac8fa488", + addressFrom: { + name: "Shwan Ippotle", + company: "Shippo", + street1: "215 Clayton St.", + street3: "", + streetNo: "", + city: "San Francisco", + state: "CA", + zip: "94117", + country: "US", + phone: "+1 555 341 9393", + email: "shippotle@shippo.com", + isResidential: true, + metadata: "Customer ID 123456", + validate: true, + }, addressReturn: "d799c2679e644279b59fe661ac8fa488", addressTo: "d799c2679e644279b59fe661ac8fa489", - customsDeclaration: { - b13aFilingOption: "FILED_ELECTRONICALLY", - certify: true, - certifySigner: "Shawn Ippotle", - contentsExplanation: "T-Shirt purchase", - dutiesPayor: { - account: "2323434543", - type: "THIRD_PARTY", - address: { - name: "Patrick Kavanagh", - zip: "80331", - country: "DE", - }, - }, - exporterIdentification: { - eoriNumber: "PL123456790ABCDE", - taxId: { - number: "123456789", - type: "EIN", - }, - }, - invoice: "#123123", - metadata: "Order ID #123123", - addressImporter: { - name: "Shwan Ippotle", - company: "Shippo", - street1: "Blumenstraße", - street3: "", - streetNo: "22", - city: "München", - state: "CA", - zip: "80331", - country: "DE", - phone: "80331", - email: "shippotle@shippo.com", - isResidential: true, - }, - contentsType: "MERCHANDISE", - eelPfc: "NOEEI_30_37_a", - incoterm: "DDP", - items: [ - { - description: "T-Shirt", - massUnit: "lb", - metadata: "Order ID \"123454\"", - netWeight: "5", - originCountry: "", - quantity: 20, - skuCode: "HM-123", - hsCode: "0901.21", - valueAmount: "200", - valueCurrency: "USD", - }, - ], - nonDeliveryOption: "RETURN", - test: true, - }, + customsDeclaration: "adcfdddf8ec64b84ad22772bce3ea37a", carrierAccounts: [ "065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0", diff --git a/docs/models/components/shipmentcreaterequestcustomsdeclaration.md b/docs/models/components/shipmentcreaterequestcustomsdeclaration.md index dcff5582..58124cd1 100644 --- a/docs/models/components/shipmentcreaterequestcustomsdeclaration.md +++ b/docs/models/components/shipmentcreaterequestcustomsdeclaration.md @@ -1,25 +1,73 @@ # ShipmentCreateRequestCustomsDeclaration -## Example Usage - -```typescript -import { ShipmentCreateRequestCustomsDeclaration } from "shippo/models/components"; - -let value: ShipmentCreateRequestCustomsDeclaration = - "adcfdddf8ec64b84ad22772bce3ea37a"; -``` ## Supported Types ### `components.CustomsDeclarationCreateRequest` ```typescript -const value: components.CustomsDeclarationCreateRequest = /* values here */ +const value: components.CustomsDeclarationCreateRequest = { + b13aFilingOption: "FILED_ELECTRONICALLY", + certify: true, + certifySigner: "Shawn Ippotle", + contentsExplanation: "T-Shirt purchase", + dutiesPayor: { + account: "2323434543", + type: "THIRD_PARTY", + address: { + name: "Patrick Kavanagh", + zip: "80331", + country: "DE", + }, + }, + exporterIdentification: { + eoriNumber: "PL123456790ABCDE", + taxId: { + number: "123456789", + type: "EIN", + }, + }, + invoice: "#123123", + metadata: "Order ID #123123", + addressImporter: { + name: "Shwan Ippotle", + company: "Shippo", + street1: "Blumenstraße", + street3: "", + streetNo: "22", + city: "München", + state: "CA", + zip: "80331", + country: "DE", + phone: "80331", + email: "shippotle@shippo.com", + isResidential: true, + }, + contentsType: "MERCHANDISE", + eelPfc: "NOEEI_30_37_a", + incoterm: "DDP", + items: [ + { + description: "T-Shirt", + massUnit: "lb", + metadata: "Order ID \"123454\"", + netWeight: "5", + originCountry: "", + quantity: 20, + skuCode: "HM-123", + hsCode: "0901.21", + valueAmount: "200", + valueCurrency: "USD", + }, + ], + nonDeliveryOption: "RETURN", + test: true, +}; ``` ### `string` ```typescript -const value: string = /* values here */ +const value: string = "adcfdddf8ec64b84ad22772bce3ea37a"; ``` diff --git a/docs/models/components/shipmentextralasershipattributesenum.md b/docs/models/components/shipmentextralasershipattributesenum.md index a040a93a..9a65c128 100644 --- a/docs/models/components/shipmentextralasershipattributesenum.md +++ b/docs/models/components/shipmentextralasershipattributesenum.md @@ -5,7 +5,7 @@ ```typescript import { ShipmentExtraLasershipAttributesEnum } from "shippo/models/components"; -let value: ShipmentExtraLasershipAttributesEnum = "Hazmat"; +let value: ShipmentExtraLasershipAttributesEnum = "Refrigerated"; ``` ## Values diff --git a/docs/models/components/shipmentextrareturnservicetypeupsenum.md b/docs/models/components/shipmentextrareturnservicetypeupsenum.md index 30a490df..f544fa48 100644 --- a/docs/models/components/shipmentextrareturnservicetypeupsenum.md +++ b/docs/models/components/shipmentextrareturnservicetypeupsenum.md @@ -5,7 +5,7 @@ ```typescript import { ShipmentExtraReturnServiceTypeUPSEnum } from "shippo/models/components"; -let value: ShipmentExtraReturnServiceTypeUPSEnum = "ATTEMPT_3"; +let value: ShipmentExtraReturnServiceTypeUPSEnum = "PRINT_AND_MAIL"; ``` ## Values diff --git a/docs/models/components/shipmentpaginatedlist.md b/docs/models/components/shipmentpaginatedlist.md index a83ba639..3f5c9014 100644 --- a/docs/models/components/shipmentpaginatedlist.md +++ b/docs/models/components/shipmentpaginatedlist.md @@ -259,37 +259,18 @@ let value: ShipmentPaginatedList = { text: "UPS API did not respond. Please try again in a few minutes.", }, ], - objectCreated: new Date("2024-10-04T18:04:14.419Z"), + objectCreated: new Date("2023-06-30T12:06:54.333Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "pp@gmail.com", - objectUpdated: new Date("2024-02-22T19:24:11.316Z"), + objectUpdated: new Date("2024-11-12T03:22:04.343Z"), parcels: [ { - extra: { - cod: { - amount: "5.5", - currency: "USD", - paymentMethod: "CASH", - }, - insurance: { - amount: "5.5", - content: "Laptop", - currency: "USD", - provider: "UPS", - }, - }, - metadata: "Customer ID 123456", massUnit: "lb", weight: "1", distanceUnit: "in", height: "1", length: "1", width: "1", - objectCreated: new Date("2014-07-09T02:19:13.174Z"), - objectId: "adcfdddf8ec64b84ad22772bce3ea37a", - objectOwner: "shippotle@shippo.com", - objectState: "VALID", - objectUpdated: new Date("2014-07-09T02:19:13.174Z"), }, ], rates: [ @@ -300,7 +281,7 @@ let value: ShipmentPaginatedList = { currencyLocal: "USD", arrivesBy: "08:30:00", attributes: [ - "FASTEST", + "CHEAPEST", ], carrierAccount: "078870331023437cb917f5187429b093", durationTerms: "Delivery in 1 to 3 business days", @@ -314,7 +295,7 @@ let value: ShipmentPaginatedList = { "UPS API did not respond. Please try again in a few minutes.", }, ], - objectCreated: new Date("2022-06-13T19:05:17.540Z"), + objectCreated: new Date("2023-09-18T17:31:57.984Z"), objectId: "adcfdddf8ec64b84ad22772bce3ea37a", objectOwner: "pp@gmail.com", provider: "USPS", diff --git a/docs/models/components/signatureconfirmation.md b/docs/models/components/signatureconfirmation.md index 47212bb3..1260024f 100644 --- a/docs/models/components/signatureconfirmation.md +++ b/docs/models/components/signatureconfirmation.md @@ -8,7 +8,7 @@ or Indirect signature (FedEx only) or Carrier Confirmation (Deutsche Post only). ```typescript import { SignatureConfirmation } from "shippo/models/components"; -let value: SignatureConfirmation = "CARRIER_CONFIRMATION"; +let value: SignatureConfirmation = "ADULT"; ``` ## Values diff --git a/docs/models/components/track.md b/docs/models/components/track.md index 5cb77abe..36f97656 100644 --- a/docs/models/components/track.md +++ b/docs/models/components/track.md @@ -40,9 +40,9 @@ let value: Track = { state: "NV", zip: "89101", }, - objectCreated: new Date("2024-07-18T10:00:30.471Z"), - objectId: "", - objectUpdated: new Date("2024-06-03T19:43:04.405Z"), + objectCreated: new Date("2024-12-08T21:35:55.501Z"), + objectId: "", + objectUpdated: new Date("2024-04-24T14:17:38.418Z"), status: "DELIVERED", substatus: { code: "information_received", @@ -62,9 +62,9 @@ let value: Track = { state: "NV", zip: "89101", }, - objectCreated: new Date("2023-09-16T17:37:32.983Z"), - objectId: "", - objectUpdated: new Date("2023-03-23T06:32:58.021Z"), + objectCreated: new Date("2025-09-04T09:11:49.246Z"), + objectId: "", + objectUpdated: new Date("2025-11-22T04:11:06.908Z"), status: "DELIVERED", substatus: { code: "information_received", diff --git a/docs/models/components/trackingstatus.md b/docs/models/components/trackingstatus.md index 2bc74600..72de2c94 100644 --- a/docs/models/components/trackingstatus.md +++ b/docs/models/components/trackingstatus.md @@ -14,9 +14,9 @@ let value: TrackingStatus = { state: "NV", zip: "89101", }, - objectCreated: new Date("2022-03-17T19:22:07.134Z"), - objectId: "", - objectUpdated: new Date("2024-02-04T09:09:59.216Z"), + objectCreated: new Date("2024-02-25T06:02:44.560Z"), + objectId: "", + objectUpdated: new Date("2025-05-17T17:32:07.447Z"), status: "DELIVERED", substatus: { code: "information_received", diff --git a/docs/models/components/transactionpaginatedlist.md b/docs/models/components/transactionpaginatedlist.md index ffc5cdb3..5ad8df1d 100644 --- a/docs/models/components/transactionpaginatedlist.md +++ b/docs/models/components/transactionpaginatedlist.md @@ -30,17 +30,7 @@ let value: TransactionPaginatedList = { parcel: "e94c7fdfdc7b495dbb390a28d929d90a", qrCodeUrl: "https://shippo-delivery.s3.amazonaws.com/96_qr_code.pdf?Signature=PEdWrp0mFWAGwJp7FW3b%2FeA2eyY%3D&Expires=1385930652&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", - rate: { - amount: "5.5", - amountLocal: "5.5", - currency: "USD", - currencyLocal: "USD", - objectId: "adcfdddf8ec64b84ad22772bce3ea37a", - provider: "USPS", - carrierAccount: "078870331023437cb917f5187429b093", - servicelevelName: "Priority Mail", - servicelevelToken: "fedex_ground", - }, + rate: "ec9f0d3adc9441449c85d315f0997fd5", status: "SUCCESS", trackingNumber: "9499907123456123456781", trackingStatus: "DELIVERED", diff --git a/docs/models/components/transactionrate.md b/docs/models/components/transactionrate.md index a391541d..cde71381 100644 --- a/docs/models/components/transactionrate.md +++ b/docs/models/components/transactionrate.md @@ -5,25 +5,28 @@ If you purchase a label by calling the transaction endpoint without a rate (inst this field will be a simplified Rate object in the Transaction model returned from the POST request.
Note, only rates less than 7 days old can be purchased to ensure up-to-date pricing. -## Example Usage - -```typescript -import { TransactionRate } from "shippo/models/components"; - -let value: TransactionRate = "ec9f0d3adc9441449c85d315f0997fd5"; -``` ## Supported Types ### `components.CoreRate` ```typescript -const value: components.CoreRate = /* values here */ +const value: components.CoreRate = { + amount: "5.5", + amountLocal: "5.5", + currency: "USD", + currencyLocal: "USD", + objectId: "adcfdddf8ec64b84ad22772bce3ea37a", + provider: "USPS", + carrierAccount: "078870331023437cb917f5187429b093", + servicelevelName: "Priority Mail", + servicelevelToken: "fedex_ground", +}; ``` ### `string` ```typescript -const value: string = /* values here */ +const value: string = "ec9f0d3adc9441449c85d315f0997fd5"; ``` diff --git a/docs/models/components/type.md b/docs/models/components/type.md index ac9fda73..d20605e7 100644 --- a/docs/models/components/type.md +++ b/docs/models/components/type.md @@ -7,7 +7,7 @@ Party to be billed. (Leave blank for DHL Germany.) ```typescript import { Type } from "shippo/models/components"; -let value: Type = "THIRD_PARTY_CONSIGNEE"; +let value: Type = "THIRD_PARTY"; ``` ## Values diff --git a/docs/models/components/userparceltemplatecreaterequest.md b/docs/models/components/userparceltemplatecreaterequest.md index 23154ba5..a62560aa 100644 --- a/docs/models/components/userparceltemplatecreaterequest.md +++ b/docs/models/components/userparceltemplatecreaterequest.md @@ -1,27 +1,29 @@ # UserParcelTemplateCreateRequest -## Example Usage - -```typescript -import { UserParcelTemplateCreateRequest } from "shippo/models/components"; - -let value: UserParcelTemplateCreateRequest = { - weight: "12", - weightUnit: "lb", -}; -``` ## Supported Types ### `components.UserParcelTemplateWithCarrierTemplateCreateRequest` ```typescript -const value: components.UserParcelTemplateWithCarrierTemplateCreateRequest = /* values here */ +const value: components.UserParcelTemplateWithCarrierTemplateCreateRequest = { + weight: "12", + weightUnit: "lb", +}; ``` ### `components.UserParcelTemplateWithoutCarrierTemplateCreateRequest` ```typescript -const value: components.UserParcelTemplateWithoutCarrierTemplateCreateRequest = /* values here */ +const value: components.UserParcelTemplateWithoutCarrierTemplateCreateRequest = + { + distanceUnit: "in", + height: "6", + length: "10", + name: "My Custom Template", + weight: "12", + weightUnit: "lb", + width: "8", + }; ``` diff --git a/docs/models/components/webhookeventtypeenum.md b/docs/models/components/webhookeventtypeenum.md index c90ecb67..7996fc66 100644 --- a/docs/models/components/webhookeventtypeenum.md +++ b/docs/models/components/webhookeventtypeenum.md @@ -7,7 +7,7 @@ Type of event that triggered the webhook. ```typescript import { WebhookEventTypeEnum } from "shippo/models/components"; -let value: WebhookEventTypeEnum = "transaction_created"; +let value: WebhookEventTypeEnum = "batch_created"; ``` ## Values diff --git a/docs/models/components/webhookpayload.md b/docs/models/components/webhookpayload.md index b6558a3e..047f146e 100644 --- a/docs/models/components/webhookpayload.md +++ b/docs/models/components/webhookpayload.md @@ -1,11 +1,12 @@ # WebhookPayload -## Example Usage -```typescript -import { WebhookPayload } from "shippo/models/components"; +## Supported Types + +### `components.WebhookPayloadTrack` -let value: WebhookPayload = { +```typescript +const value: components.WebhookPayloadTrack = { data: { addressFrom: { city: "Las Vegas", @@ -41,9 +42,9 @@ let value: WebhookPayload = { state: "NV", zip: "89101", }, - objectCreated: new Date("2022-06-30T12:06:54.333Z"), - objectId: "", - objectUpdated: new Date("2023-11-13T03:22:04.343Z"), + objectCreated: new Date("2023-10-06T18:35:34.427Z"), + objectId: "", + objectUpdated: new Date("2023-03-05T14:23:56.519Z"), status: "DELIVERED", substatus: { code: "information_received", @@ -63,9 +64,9 @@ let value: WebhookPayload = { state: "NV", zip: "89101", }, - objectCreated: new Date("2023-09-25T15:25:14.861Z"), - objectId: "", - objectUpdated: new Date("2022-09-18T17:31:57.984Z"), + objectCreated: new Date("2024-04-21T02:53:41.707Z"), + objectId: "", + objectUpdated: new Date("2023-12-08T17:28:43.968Z"), status: "DELIVERED", substatus: { code: "information_received", @@ -80,35 +81,95 @@ let value: WebhookPayload = { }; ``` -## Supported Types - -### `components.WebhookPayloadTrack` - -```typescript -const value: components.WebhookPayloadTrack = /* values here */ -``` - ### `components.WebhookPayloadBatch` ```typescript -const value: components.WebhookPayloadBatch = /* values here */ +const value: components.WebhookPayloadBatch = {}; ``` ### `components.WebhookPayloadBatch` ```typescript -const value: components.WebhookPayloadBatch = /* values here */ +const value: components.WebhookPayloadBatch = {}; ``` ### `components.WebhookPayloadTransaction` ```typescript -const value: components.WebhookPayloadTransaction = /* values here */ +const value: components.WebhookPayloadTransaction = { + data: { + createdBy: { + firstName: "Shwan", + lastName: "Ippotle", + username: "shippotle@shippo.com", + }, + labelFileType: "PDF_4x6", + labelUrl: + "https://shippo-delivery.s3.amazonaws.com/70ae8117ee1749e393f249d5b77c45e0.pdf?Signature=vDw1ltcyGveVR1OQoUDdzC43BY8%3D&Expires=1437093830&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", + messages: [ + { + source: "UPS", + code: "carrier_timeout", + text: "UPS API did not respond. Please try again in a few minutes.", + }, + ], + objectId: "915d94940ea54c3a80cbfa328722f5a1", + objectOwner: "shippotle@shippo.com", + parcel: "e94c7fdfdc7b495dbb390a28d929d90a", + qrCodeUrl: + "https://shippo-delivery.s3.amazonaws.com/96_qr_code.pdf?Signature=PEdWrp0mFWAGwJp7FW3b%2FeA2eyY%3D&Expires=1385930652&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", + rate: "ec9f0d3adc9441449c85d315f0997fd5", + status: "SUCCESS", + trackingNumber: "9499907123456123456781", + trackingStatus: "DELIVERED", + trackingUrlProvider: + "https://tools.usps.com/go/TrackConfirmAction_input?origTrackNum=9499907123456123456781", + }, +}; ``` ### `components.WebhookPayloadTransaction` ```typescript -const value: components.WebhookPayloadTransaction = /* values here */ +const value: components.WebhookPayloadTransaction = { + data: { + createdBy: { + firstName: "Shwan", + lastName: "Ippotle", + username: "shippotle@shippo.com", + }, + labelFileType: "PDF_4x6", + labelUrl: + "https://shippo-delivery.s3.amazonaws.com/70ae8117ee1749e393f249d5b77c45e0.pdf?Signature=vDw1ltcyGveVR1OQoUDdzC43BY8%3D&Expires=1437093830&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", + messages: [ + { + source: "UPS", + code: "carrier_timeout", + text: "UPS API did not respond. Please try again in a few minutes.", + }, + ], + objectId: "915d94940ea54c3a80cbfa328722f5a1", + objectOwner: "shippotle@shippo.com", + parcel: "e94c7fdfdc7b495dbb390a28d929d90a", + qrCodeUrl: + "https://shippo-delivery.s3.amazonaws.com/96_qr_code.pdf?Signature=PEdWrp0mFWAGwJp7FW3b%2FeA2eyY%3D&Expires=1385930652&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", + rate: { + amount: "5.5", + amountLocal: "5.5", + currency: "USD", + currencyLocal: "USD", + objectId: "adcfdddf8ec64b84ad22772bce3ea37a", + provider: "USPS", + carrierAccount: "078870331023437cb917f5187429b093", + servicelevelName: "Priority Mail", + servicelevelToken: "fedex_ground", + }, + status: "SUCCESS", + trackingNumber: "9499907123456123456781", + trackingStatus: "DELIVERED", + trackingUrlProvider: + "https://tools.usps.com/go/TrackConfirmAction_input?origTrackNum=9499907123456123456781", + }, +}; ``` diff --git a/docs/models/components/webhookpayloadtrack.md b/docs/models/components/webhookpayloadtrack.md index 837241b3..05956227 100644 --- a/docs/models/components/webhookpayloadtrack.md +++ b/docs/models/components/webhookpayloadtrack.md @@ -43,9 +43,9 @@ let value: WebhookPayloadTrack = { state: "NV", zip: "89101", }, - objectCreated: new Date("2022-08-08T04:42:30.927Z"), - objectId: "", - objectUpdated: new Date("2022-01-21T07:11:50.213Z"), + objectCreated: new Date("2025-02-22T20:20:27.935Z"), + objectId: "", + objectUpdated: new Date("2024-10-22T15:05:16.239Z"), status: "DELIVERED", substatus: { code: "information_received", @@ -65,9 +65,9 @@ let value: WebhookPayloadTrack = { state: "NV", zip: "89101", }, - objectCreated: new Date("2024-05-19T21:25:27.801Z"), - objectId: "", - objectUpdated: new Date("2022-09-03T10:06:53.981Z"), + objectCreated: new Date("2024-08-20T04:36:26.084Z"), + objectId: "", + objectUpdated: new Date("2024-04-09T07:48:57.030Z"), status: "DELIVERED", substatus: { code: "information_received", diff --git a/docs/models/components/webhookpayloadtransaction.md b/docs/models/components/webhookpayloadtransaction.md index fea40499..6595a384 100644 --- a/docs/models/components/webhookpayloadtransaction.md +++ b/docs/models/components/webhookpayloadtransaction.md @@ -29,17 +29,7 @@ let value: WebhookPayloadTransaction = { parcel: "e94c7fdfdc7b495dbb390a28d929d90a", qrCodeUrl: "https://shippo-delivery.s3.amazonaws.com/96_qr_code.pdf?Signature=PEdWrp0mFWAGwJp7FW3b%2FeA2eyY%3D&Expires=1385930652&AWSAccessKeyId=AKIAJTHP3LLFMYAWALIA", - rate: { - amount: "5.5", - amountLocal: "5.5", - currency: "USD", - currencyLocal: "USD", - objectId: "adcfdddf8ec64b84ad22772bce3ea37a", - provider: "USPS", - carrierAccount: "078870331023437cb917f5187429b093", - servicelevelName: "Priority Mail", - servicelevelToken: "fedex_ground", - }, + rate: "ec9f0d3adc9441449c85d315f0997fd5", status: "SUCCESS", trackingNumber: "9499907123456123456781", trackingStatus: "DELIVERED", diff --git a/docs/models/components/webhookupdaterequest.md b/docs/models/components/webhookupdaterequest.md index 3a2f5e17..6d85cc24 100644 --- a/docs/models/components/webhookupdaterequest.md +++ b/docs/models/components/webhookupdaterequest.md @@ -6,7 +6,7 @@ import { WebhookUpdateRequest } from "shippo/models/components"; let value: WebhookUpdateRequest = { - event: "batch_created", + event: "batch_purchased", url: "https://example.com/shippo-webhook", active: true, isTest: false, diff --git a/docs/models/operations/addshipmentstobatchrequest.md b/docs/models/operations/addshipmentstobatchrequest.md index b7441be7..240b2545 100644 --- a/docs/models/operations/addshipmentstobatchrequest.md +++ b/docs/models/operations/addshipmentstobatchrequest.md @@ -6,7 +6,7 @@ import { AddShipmentsToBatchRequest } from "shippo/models/operations"; let value: AddShipmentsToBatchRequest = { - batchId: "", + batchId: "", requestBody: [ { carrierAccount: "a4391cd4ab974f478f55dc08b5c8e3b3", @@ -116,7 +116,8 @@ let value: AddShipmentsToBatchRequest = { }, metadata: "Customer ID 123456", shipmentDate: "2021-03-22T12:00:00Z", - addressFrom: { + addressFrom: "d799c2679e644279b59fe661ac8fa488", + addressReturn: { name: "Shwan Ippotle", company: "Shippo", street1: "215 Clayton St.", @@ -132,15 +133,88 @@ let value: AddShipmentsToBatchRequest = { metadata: "Customer ID 123456", validate: true, }, - addressReturn: "d799c2679e644279b59fe661ac8fa488", addressTo: "d799c2679e644279b59fe661ac8fa489", - customsDeclaration: "adcfdddf8ec64b84ad22772bce3ea37a", + customsDeclaration: { + b13aFilingOption: "FILED_ELECTRONICALLY", + certify: true, + certifySigner: "Shawn Ippotle", + contentsExplanation: "T-Shirt purchase", + dutiesPayor: { + account: "2323434543", + type: "THIRD_PARTY", + address: { + name: "Patrick Kavanagh", + zip: "80331", + country: "DE", + }, + }, + exporterIdentification: { + eoriNumber: "PL123456790ABCDE", + taxId: { + number: "123456789", + type: "EIN", + }, + }, + invoice: "#123123", + metadata: "Order ID #123123", + addressImporter: { + name: "Shwan Ippotle", + company: "Shippo", + street1: "Blumenstraße", + street3: "", + streetNo: "22", + city: "München", + state: "CA", + zip: "80331", + country: "DE", + phone: "80331", + email: "shippotle@shippo.com", + isResidential: true, + }, + contentsType: "MERCHANDISE", + eelPfc: "NOEEI_30_37_a", + incoterm: "DDP", + items: [ + { + description: "T-Shirt", + massUnit: "lb", + metadata: "Order ID \"123454\"", + netWeight: "5", + originCountry: "", + quantity: 20, + skuCode: "HM-123", + hsCode: "0901.21", + valueAmount: "200", + valueCurrency: "USD", + }, + ], + nonDeliveryOption: "RETURN", + test: true, + }, carrierAccounts: [ "065a4a8c10d24a34ab932163a1b87f52", "73f706f4bdb94b54a337563840ce52b0", ], parcels: [ - "", + { + extra: { + cod: { + amount: "5.5", + currency: "USD", + paymentMethod: "CASH", + }, + insurance: { + amount: "5.5", + content: "Laptop", + currency: "USD", + provider: "UPS", + }, + }, + metadata: "Customer ID 123456", + massUnit: "lb", + weight: "1", + template: "Fastway_Australia_Satchel_A5", + }, ], }, }, diff --git a/docs/models/operations/carrier.md b/docs/models/operations/carrier.md index d9058b01..affa8bff 100644 --- a/docs/models/operations/carrier.md +++ b/docs/models/operations/carrier.md @@ -7,7 +7,7 @@ filter by specific carrier ```typescript import { Carrier } from "shippo/models/operations"; -let value: Carrier = "canada_post"; +let value: Carrier = "ups"; ``` ## Values diff --git a/docs/models/operations/createparcelrequestbody.md b/docs/models/operations/createparcelrequestbody.md index 44b16421..2938e5c8 100644 --- a/docs/models/operations/createparcelrequestbody.md +++ b/docs/models/operations/createparcelrequestbody.md @@ -2,12 +2,13 @@ Parcel details. -## Example Usage -```typescript -import { CreateParcelRequestBody } from "shippo/models/operations"; +## Supported Types + +### `components.ParcelCreateRequest` -let value: CreateParcelRequestBody = { +```typescript +const value: components.ParcelCreateRequest = { extra: { cod: { amount: "5.5", @@ -31,17 +32,27 @@ let value: CreateParcelRequestBody = { }; ``` -## Supported Types - -### `components.ParcelCreateRequest` - -```typescript -const value: components.ParcelCreateRequest = /* values here */ -``` - ### `components.ParcelCreateFromTemplateRequest` ```typescript -const value: components.ParcelCreateFromTemplateRequest = /* values here */ +const value: components.ParcelCreateFromTemplateRequest = { + extra: { + cod: { + amount: "5.5", + currency: "USD", + paymentMethod: "CASH", + }, + insurance: { + amount: "5.5", + content: "Laptop", + currency: "USD", + provider: "UPS", + }, + }, + metadata: "Customer ID 123456", + massUnit: "lb", + weight: "1", + template: "Fastway_Australia_Satchel_A5", +}; ``` diff --git a/docs/models/operations/createtransactionrequestbody.md b/docs/models/operations/createtransactionrequestbody.md index c7a06a15..e1a1cb01 100644 --- a/docs/models/operations/createtransactionrequestbody.md +++ b/docs/models/operations/createtransactionrequestbody.md @@ -2,12 +2,25 @@ Examples. -## Example Usage + +## Supported Types + +### `components.TransactionCreateRequest` ```typescript -import { CreateTransactionRequestBody } from "shippo/models/operations"; +const value: components.TransactionCreateRequest = { + async: false, + labelFileType: "PDF_4x6", + metadata: "Order ID #12345", + rate: "ec9f0d3adc9441449c85d315f0997fd5", + order: "adcfdddf8ec64b84ad22772bce3ea37a", +}; +``` + +### `components.InstantTransactionCreateRequest` -let value: CreateTransactionRequestBody = { +```typescript +const value: components.InstantTransactionCreateRequest = { async: false, carrierAccount: "b741b99f95e841639b54272834bc478c", labelFileType: "PDF", @@ -117,22 +130,7 @@ let value: CreateTransactionRequestBody = { }, metadata: "Customer ID 123456", shipmentDate: "2021-03-22T12:00:00Z", - addressFrom: { - name: "Shwan Ippotle", - company: "Shippo", - street1: "215 Clayton St.", - street3: "", - streetNo: "", - city: "San Francisco", - state: "CA", - zip: "94117", - country: "US", - phone: "+1 555 341 9393", - email: "shippotle@shippo.com", - isResidential: true, - metadata: "Customer ID 123456", - validate: true, - }, + addressFrom: "d799c2679e644279b59fe661ac8fa488", addressReturn: { name: "Shwan Ippotle", company: "Shippo", @@ -244,7 +242,10 @@ let value: CreateTransactionRequestBody = { metadata: "Customer ID 123456", massUnit: "lb", weight: "1", - template: "UPS_MI_BPM_Parcel", + distanceUnit: "in", + height: "1", + length: "1", + width: "1", }, ], }, @@ -252,17 +253,3 @@ let value: CreateTransactionRequestBody = { }; ``` -## Supported Types - -### `components.TransactionCreateRequest` - -```typescript -const value: components.TransactionCreateRequest = /* values here */ -``` - -### `components.InstantTransactionCreateRequest` - -```typescript -const value: components.InstantTransactionCreateRequest = /* values here */ -``` - diff --git a/docs/models/operations/deleteservicegrouprequest.md b/docs/models/operations/deleteservicegrouprequest.md index a44cfb56..e9bb8aaf 100644 --- a/docs/models/operations/deleteservicegrouprequest.md +++ b/docs/models/operations/deleteservicegrouprequest.md @@ -6,7 +6,7 @@ import { DeleteServiceGroupRequest } from "shippo/models/operations"; let value: DeleteServiceGroupRequest = { - serviceGroupId: "", + serviceGroupId: "", }; ``` diff --git a/docs/models/operations/deleteuserparceltemplaterequest.md b/docs/models/operations/deleteuserparceltemplaterequest.md index 1d1830bd..71d22350 100644 --- a/docs/models/operations/deleteuserparceltemplaterequest.md +++ b/docs/models/operations/deleteuserparceltemplaterequest.md @@ -6,7 +6,7 @@ import { DeleteUserParcelTemplateRequest } from "shippo/models/operations"; let value: DeleteUserParcelTemplateRequest = { - userParcelTemplateObjectId: "", + userParcelTemplateObjectId: "", }; ``` diff --git a/docs/models/operations/deletewebhookrequest.md b/docs/models/operations/deletewebhookrequest.md index fb05ef14..25c751c4 100644 --- a/docs/models/operations/deletewebhookrequest.md +++ b/docs/models/operations/deletewebhookrequest.md @@ -6,7 +6,7 @@ import { DeleteWebhookRequest } from "shippo/models/operations"; let value: DeleteWebhookRequest = { - webhookId: "", + webhookId: "", }; ``` diff --git a/docs/models/operations/getaddressrequest.md b/docs/models/operations/getaddressrequest.md index 50de81ac..01feccc6 100644 --- a/docs/models/operations/getaddressrequest.md +++ b/docs/models/operations/getaddressrequest.md @@ -6,7 +6,7 @@ import { GetAddressRequest } from "shippo/models/operations"; let value: GetAddressRequest = { - addressId: "", + addressId: "", }; ``` diff --git a/docs/models/operations/getbatchrequest.md b/docs/models/operations/getbatchrequest.md index a01dfc0e..769dce4b 100644 --- a/docs/models/operations/getbatchrequest.md +++ b/docs/models/operations/getbatchrequest.md @@ -6,7 +6,7 @@ import { GetBatchRequest } from "shippo/models/operations"; let value: GetBatchRequest = { - batchId: "", + batchId: "", }; ``` diff --git a/docs/models/operations/getcarrieraccountrequest.md b/docs/models/operations/getcarrieraccountrequest.md index c971b98b..518e2b3d 100644 --- a/docs/models/operations/getcarrieraccountrequest.md +++ b/docs/models/operations/getcarrieraccountrequest.md @@ -6,7 +6,7 @@ import { GetCarrierAccountRequest } from "shippo/models/operations"; let value: GetCarrierAccountRequest = { - carrierAccountId: "", + carrierAccountId: "", }; ``` diff --git a/docs/models/operations/getcustomsdeclarationrequest.md b/docs/models/operations/getcustomsdeclarationrequest.md index 4ca9694e..238f3a52 100644 --- a/docs/models/operations/getcustomsdeclarationrequest.md +++ b/docs/models/operations/getcustomsdeclarationrequest.md @@ -6,7 +6,7 @@ import { GetCustomsDeclarationRequest } from "shippo/models/operations"; let value: GetCustomsDeclarationRequest = { - customsDeclarationId: "", + customsDeclarationId: "", }; ``` diff --git a/docs/models/operations/getcustomsitemrequest.md b/docs/models/operations/getcustomsitemrequest.md index fee66c41..0addefb2 100644 --- a/docs/models/operations/getcustomsitemrequest.md +++ b/docs/models/operations/getcustomsitemrequest.md @@ -6,7 +6,7 @@ import { GetCustomsItemRequest } from "shippo/models/operations"; let value: GetCustomsItemRequest = { - customsItemId: "", + customsItemId: "", }; ``` diff --git a/docs/models/operations/getmanifestrequest.md b/docs/models/operations/getmanifestrequest.md index 2d1514a7..2ef70ab8 100644 --- a/docs/models/operations/getmanifestrequest.md +++ b/docs/models/operations/getmanifestrequest.md @@ -6,7 +6,7 @@ import { GetManifestRequest } from "shippo/models/operations"; let value: GetManifestRequest = { - manifestId: "", + manifestId: "", }; ``` diff --git a/docs/models/operations/getorderrequest.md b/docs/models/operations/getorderrequest.md index a4d604c4..3271d0c4 100644 --- a/docs/models/operations/getorderrequest.md +++ b/docs/models/operations/getorderrequest.md @@ -6,7 +6,7 @@ import { GetOrderRequest } from "shippo/models/operations"; let value: GetOrderRequest = { - orderId: "", + orderId: "", }; ``` diff --git a/docs/models/operations/getparcelrequest.md b/docs/models/operations/getparcelrequest.md index 3781fd39..385d6896 100644 --- a/docs/models/operations/getparcelrequest.md +++ b/docs/models/operations/getparcelrequest.md @@ -6,7 +6,7 @@ import { GetParcelRequest } from "shippo/models/operations"; let value: GetParcelRequest = { - parcelId: "", + parcelId: "", }; ``` diff --git a/docs/models/operations/getraterequest.md b/docs/models/operations/getraterequest.md index 9dc85dd4..9f3c2a9b 100644 --- a/docs/models/operations/getraterequest.md +++ b/docs/models/operations/getraterequest.md @@ -6,7 +6,7 @@ import { GetRateRequest } from "shippo/models/operations"; let value: GetRateRequest = { - rateId: "", + rateId: "", }; ``` diff --git a/docs/models/operations/getrefundrequest.md b/docs/models/operations/getrefundrequest.md index dfb97e0e..c351534e 100644 --- a/docs/models/operations/getrefundrequest.md +++ b/docs/models/operations/getrefundrequest.md @@ -6,7 +6,7 @@ import { GetRefundRequest } from "shippo/models/operations"; let value: GetRefundRequest = { - refundId: "", + refundId: "", }; ``` diff --git a/docs/models/operations/getshipmentrequest.md b/docs/models/operations/getshipmentrequest.md index 25ad39e8..aedd8660 100644 --- a/docs/models/operations/getshipmentrequest.md +++ b/docs/models/operations/getshipmentrequest.md @@ -6,7 +6,7 @@ import { GetShipmentRequest } from "shippo/models/operations"; let value: GetShipmentRequest = { - shipmentId: "", + shipmentId: "", }; ``` diff --git a/docs/models/operations/getshippoaccountrequest.md b/docs/models/operations/getshippoaccountrequest.md index ffc96ff1..497a83cc 100644 --- a/docs/models/operations/getshippoaccountrequest.md +++ b/docs/models/operations/getshippoaccountrequest.md @@ -6,7 +6,7 @@ import { GetShippoAccountRequest } from "shippo/models/operations"; let value: GetShippoAccountRequest = { - shippoAccountId: "", + shippoAccountId: "", }; ``` diff --git a/docs/models/operations/gettransactionrequest.md b/docs/models/operations/gettransactionrequest.md index c40e360e..f2e2a08f 100644 --- a/docs/models/operations/gettransactionrequest.md +++ b/docs/models/operations/gettransactionrequest.md @@ -6,7 +6,7 @@ import { GetTransactionRequest } from "shippo/models/operations"; let value: GetTransactionRequest = { - transactionId: "", + transactionId: "", }; ``` diff --git a/docs/models/operations/getuserparceltemplaterequest.md b/docs/models/operations/getuserparceltemplaterequest.md index 35ebb76d..820f507e 100644 --- a/docs/models/operations/getuserparceltemplaterequest.md +++ b/docs/models/operations/getuserparceltemplaterequest.md @@ -6,7 +6,7 @@ import { GetUserParcelTemplateRequest } from "shippo/models/operations"; let value: GetUserParcelTemplateRequest = { - userParcelTemplateObjectId: "", + userParcelTemplateObjectId: "", }; ``` diff --git a/docs/models/operations/getwebhookrequest.md b/docs/models/operations/getwebhookrequest.md index 7ff5819f..1da09456 100644 --- a/docs/models/operations/getwebhookrequest.md +++ b/docs/models/operations/getwebhookrequest.md @@ -6,7 +6,7 @@ import { GetWebhookRequest } from "shippo/models/operations"; let value: GetWebhookRequest = { - webhookId: "", + webhookId: "", }; ``` diff --git a/docs/models/operations/include.md b/docs/models/operations/include.md index 0c07ac7f..1a5e87cd 100644 --- a/docs/models/operations/include.md +++ b/docs/models/operations/include.md @@ -7,7 +7,7 @@ filter by user or enabled ```typescript import { Include } from "shippo/models/operations"; -let value: Include = "all"; +let value: Include = "enabled"; ``` ## Values diff --git a/docs/models/operations/initiateoauth2signinrequest.md b/docs/models/operations/initiateoauth2signinrequest.md index 0302efd1..e3764d5a 100644 --- a/docs/models/operations/initiateoauth2signinrequest.md +++ b/docs/models/operations/initiateoauth2signinrequest.md @@ -6,8 +6,8 @@ import { InitiateOauth2SigninRequest } from "shippo/models/operations"; let value: InitiateOauth2SigninRequest = { - carrierAccountObjectId: "", - redirectUri: "https://dependent-valentine.net", + carrierAccountObjectId: "", + redirectUri: "https://devoted-lashes.biz", }; ``` diff --git a/docs/models/operations/listshipmentratesbycurrencycoderequest.md b/docs/models/operations/listshipmentratesbycurrencycoderequest.md index dbf0a63f..51fad931 100644 --- a/docs/models/operations/listshipmentratesbycurrencycoderequest.md +++ b/docs/models/operations/listshipmentratesbycurrencycoderequest.md @@ -6,7 +6,7 @@ import { ListShipmentRatesByCurrencyCodeRequest } from "shippo/models/operations"; let value: ListShipmentRatesByCurrencyCodeRequest = { - shipmentId: "", + shipmentId: "", currencyCode: "USD", }; ``` diff --git a/docs/models/operations/listshipmentratesrequest.md b/docs/models/operations/listshipmentratesrequest.md index 2ca16a7f..de71fc09 100644 --- a/docs/models/operations/listshipmentratesrequest.md +++ b/docs/models/operations/listshipmentratesrequest.md @@ -6,7 +6,7 @@ import { ListShipmentRatesRequest } from "shippo/models/operations"; let value: ListShipmentRatesRequest = { - shipmentId: "", + shipmentId: "", }; ``` diff --git a/docs/models/operations/purchasebatchrequest.md b/docs/models/operations/purchasebatchrequest.md index 317b2006..06e613e1 100644 --- a/docs/models/operations/purchasebatchrequest.md +++ b/docs/models/operations/purchasebatchrequest.md @@ -6,7 +6,7 @@ import { PurchaseBatchRequest } from "shippo/models/operations"; let value: PurchaseBatchRequest = { - batchId: "", + batchId: "", }; ``` diff --git a/docs/models/operations/registercarrieraccountrequestbody.md b/docs/models/operations/registercarrieraccountrequestbody.md index be4d75ca..0438c52c 100644 --- a/docs/models/operations/registercarrieraccountrequestbody.md +++ b/docs/models/operations/registercarrieraccountrequestbody.md @@ -2,106 +2,168 @@ Examples. -## Example Usage - -```typescript -import { RegisterCarrierAccountRequestBody } from "shippo/models/operations"; - -let value: RegisterCarrierAccountRequestBody = { - carrier: "correos", - parameters: {}, -}; -``` ## Supported Types ### `components.CarrierAccountCanadaPostCreateRequest` ```typescript -const value: components.CarrierAccountCanadaPostCreateRequest = /* values here */ +const value: components.CarrierAccountCanadaPostCreateRequest = { + carrier: "canada_post", + parameters: { + canadaPostTerms: false, + company: "Shippo", + email: "hippo@shippo.com", + fullName: "Shippo Meister", + phone: "1112223333", + }, +}; ``` ### `components.CarrierAccountChronopostCreateRequest` ```typescript -const value: components.CarrierAccountChronopostCreateRequest = /* values here */ +const value: components.CarrierAccountChronopostCreateRequest = { + carrier: "chronopost", + parameters: {}, +}; ``` ### `components.CarrierAccountColissimoCreateRequest` ```typescript -const value: components.CarrierAccountColissimoCreateRequest = /* values here */ +const value: components.CarrierAccountColissimoCreateRequest = { + carrier: "colissimo", + parameters: {}, +}; ``` ### `components.CarrierAccountCorreosCreateRequest` ```typescript -const value: components.CarrierAccountCorreosCreateRequest = /* values here */ +const value: components.CarrierAccountCorreosCreateRequest = { + carrier: "correos", + parameters: {}, +}; ``` ### `components.CarrierAccountDeutschePostCreateRequest` ```typescript -const value: components.CarrierAccountDeutschePostCreateRequest = /* values here */ +const value: components.CarrierAccountDeutschePostCreateRequest = { + carrier: "deutsche_post", + parameters: {}, +}; ``` ### `components.CarrierAccountDHLExpressCreateRequest` ```typescript -const value: components.CarrierAccountDHLExpressCreateRequest = /* values here */ +const value: components.CarrierAccountDHLExpressCreateRequest = { + carrier: "dhl_express", + parameters: { + userAcceptedTermsAndConditions: false, + }, +}; ``` ### `components.CarrierAccountDpdDeCreateRequest` ```typescript -const value: components.CarrierAccountDpdDeCreateRequest = /* values here */ +const value: components.CarrierAccountDpdDeCreateRequest = { + carrier: "dpd_de", + parameters: {}, +}; ``` ### `components.CarrierAccountDPDUKCreateRequest` ```typescript -const value: components.CarrierAccountDPDUKCreateRequest = /* values here */ +const value: components.CarrierAccountDPDUKCreateRequest = { + carrier: "dpd_uk", + parameters: {}, +}; ``` ### `components.CarrierAccountFedExCreateRequest` ```typescript -const value: components.CarrierAccountFedExCreateRequest = /* values here */ +const value: components.CarrierAccountFedExCreateRequest = { + carrier: "fedex", + parameters: {}, +}; ``` ### `components.CarrierAccountHermesUKCreateRequest` ```typescript -const value: components.CarrierAccountHermesUKCreateRequest = /* values here */ +const value: components.CarrierAccountHermesUKCreateRequest = { + carrier: "hermes_uk", + parameters: {}, +}; ``` ### `components.CarrierAccountMondialRelayCreateRequest` ```typescript -const value: components.CarrierAccountMondialRelayCreateRequest = /* values here */ +const value: components.CarrierAccountMondialRelayCreateRequest = { + carrier: "mondialrelay", + parameters: {}, +}; ``` ### `components.CarrierAccountPosteItalianeCreateRequest` ```typescript -const value: components.CarrierAccountPosteItalianeCreateRequest = /* values here */ +const value: components.CarrierAccountPosteItalianeCreateRequest = { + carrier: "poste_italiane", + parameters: {}, +}; ``` ### `components.CarrierAccountUPSCreateRequest` ```typescript -const value: components.CarrierAccountUPSCreateRequest = /* values here */ +const value: components.CarrierAccountUPSCreateRequest = { + carrier: "ups", + parameters: { + billingAddressCity: "San Francisco", + billingAddressCountryIso2: "US", + billingAddressState: "CA", + billingAddressStreet1: "731 Market St", + billingAddressStreet2: "STE 200", + billingAddressZip: "94103", + company: "Shippo", + email: "hippo@shippo.com", + fullName: "Shippo Meister", + phone: "1112223333", + pickupAddressCity: "San Francisco", + pickupAddressCountryIso2: "US", + pickupAddressSameAsBillingAddress: false, + pickupAddressState: "CA", + pickupAddressStreet1: "731 Market St", + pickupAddressStreet2: "STE 200", + pickupAddressZip: "94103", + upsAgreements: false, + }, +}; ``` ### `components.CarrierAccountUSPSCreateRequest` ```typescript -const value: components.CarrierAccountUSPSCreateRequest = /* values here */ +const value: components.CarrierAccountUSPSCreateRequest = { + carrier: "usps", + parameters: {}, +}; ``` ### `components.CarrierAccountSendleCreateRequest` ```typescript -const value: components.CarrierAccountSendleCreateRequest = /* values here */ +const value: components.CarrierAccountSendleCreateRequest = { + carrier: "sendle", + parameters: {}, +}; ``` diff --git a/docs/models/operations/removeshipmentsfrombatchrequest.md b/docs/models/operations/removeshipmentsfrombatchrequest.md index 5ac7e27a..2c7ce59f 100644 --- a/docs/models/operations/removeshipmentsfrombatchrequest.md +++ b/docs/models/operations/removeshipmentsfrombatchrequest.md @@ -6,7 +6,7 @@ import { RemoveShipmentsFromBatchRequest } from "shippo/models/operations"; let value: RemoveShipmentsFromBatchRequest = { - batchId: "", + batchId: "", requestBody: [ "", ], diff --git a/docs/models/operations/updatecarrieraccountrequest.md b/docs/models/operations/updatecarrieraccountrequest.md index c3bbc6cf..4ed82fcf 100644 --- a/docs/models/operations/updatecarrieraccountrequest.md +++ b/docs/models/operations/updatecarrieraccountrequest.md @@ -6,12 +6,19 @@ import { UpdateCarrierAccountRequest } from "shippo/models/operations"; let value: UpdateCarrierAccountRequest = { - carrierAccountId: "", + carrierAccountId: "", carrierAccountBase: { accountId: "****", carrier: "usps", parameters: { - "key": "", + firstName: "Vida", + lastName: "Wiegand", + phoneNumber: "868.486.0319 x44631", + fromAddressSt: "", + fromAddressCity: "", + fromAddressState: "", + fromAddressZip: "", + fromAddressCountryIso2: "", }, }, }; diff --git a/docs/models/operations/updateshippoaccountrequest.md b/docs/models/operations/updateshippoaccountrequest.md index 927429ef..6d3cb46d 100644 --- a/docs/models/operations/updateshippoaccountrequest.md +++ b/docs/models/operations/updateshippoaccountrequest.md @@ -6,7 +6,7 @@ import { UpdateShippoAccountRequest } from "shippo/models/operations"; let value: UpdateShippoAccountRequest = { - shippoAccountId: "", + shippoAccountId: "", shippoAccountUpdateRequest: { email: "hippo@shippo.com", firstName: "Shippo", diff --git a/docs/models/operations/updateuserparceltemplaterequest.md b/docs/models/operations/updateuserparceltemplaterequest.md index aae22d85..9067892d 100644 --- a/docs/models/operations/updateuserparceltemplaterequest.md +++ b/docs/models/operations/updateuserparceltemplaterequest.md @@ -6,7 +6,7 @@ import { UpdateUserParcelTemplateRequest } from "shippo/models/operations"; let value: UpdateUserParcelTemplateRequest = { - userParcelTemplateObjectId: "", + userParcelTemplateObjectId: "", userParcelTemplateUpdateRequest: { distanceUnit: "in", height: "6", diff --git a/docs/models/operations/updatewebhookrequest.md b/docs/models/operations/updatewebhookrequest.md index 6b5bf023..21765bc9 100644 --- a/docs/models/operations/updatewebhookrequest.md +++ b/docs/models/operations/updatewebhookrequest.md @@ -6,9 +6,9 @@ import { UpdateWebhookRequest } from "shippo/models/operations"; let value: UpdateWebhookRequest = { - webhookId: "", + webhookId: "", webhookUpdateRequest: { - event: "all", + event: "transaction_created", url: "https://example.com/shippo-webhook", active: true, isTest: false, diff --git a/docs/models/operations/validateaddressrequest.md b/docs/models/operations/validateaddressrequest.md index dc14731a..d879c96c 100644 --- a/docs/models/operations/validateaddressrequest.md +++ b/docs/models/operations/validateaddressrequest.md @@ -6,7 +6,7 @@ import { ValidateAddressRequest } from "shippo/models/operations"; let value: ValidateAddressRequest = { - addressId: "", + addressId: "", }; ``` diff --git a/docs/sdks/addresses/README.md b/docs/sdks/addresses/README.md index 746c410a..4b27aab0 100644 --- a/docs/sdks/addresses/README.md +++ b/docs/sdks/addresses/README.md @@ -29,9 +29,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.addresses.list(); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -62,7 +62,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -84,10 +84,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -120,9 +119,9 @@ async function run() { metadata: "Customer ID 123456", validate: true, }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -168,7 +167,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -189,10 +188,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -210,9 +208,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.addresses.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -243,7 +241,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -264,10 +262,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## validate @@ -285,9 +282,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.addresses.validate(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -318,7 +315,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -339,6 +336,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/batches/README.md b/docs/sdks/batches/README.md index 930afdb2..4a2baf1c 100644 --- a/docs/sdks/batches/README.md +++ b/docs/sdks/batches/README.md @@ -341,9 +341,9 @@ async function run() { }, ], }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -677,7 +677,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -698,10 +698,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -722,9 +721,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.batches.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -755,7 +754,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -778,10 +777,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## addShipments @@ -798,7 +796,7 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.batches.addShipments("", [ + const result = await shippo.batches.addShipments([ { carrierAccount: "a4391cd4ab974f478f55dc08b5c8e3b3", metadata: "SHIPMENT #1", @@ -1188,25 +1186,7 @@ async function run() { "73f706f4bdb94b54a337563840ce52b0", ], parcels: [ - { - extra: { - cod: { - amount: "5.5", - currency: "USD", - paymentMethod: "CASH", - }, - insurance: { - amount: "5.5", - content: "Laptop", - currency: "USD", - provider: "UPS", - }, - }, - metadata: "Customer ID 123456", - massUnit: "lb", - weight: "1", - template: "couriersplease_1kg_satchel", - }, + "", { extra: { cod: { @@ -1447,10 +1427,10 @@ async function run() { ], }, }, - ]); - + ], ""); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -1472,7 +1452,7 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await batchesAddShipments(shippo, "", [ + const res = await batchesAddShipments(shippo, [ { carrierAccount: "a4391cd4ab974f478f55dc08b5c8e3b3", metadata: "SHIPMENT #1", @@ -1862,25 +1842,7 @@ async function run() { "73f706f4bdb94b54a337563840ce52b0", ], parcels: [ - { - extra: { - cod: { - amount: "5.5", - currency: "USD", - paymentMethod: "CASH", - }, - insurance: { - amount: "5.5", - content: "Laptop", - currency: "USD", - provider: "UPS", - }, - }, - metadata: "Customer ID 123456", - massUnit: "lb", - weight: "1", - template: "couriersplease_1kg_satchel", - }, + "", { extra: { cod: { @@ -2121,7 +2083,7 @@ async function run() { ], }, }, - ]); + ], ""); if (!res.ok) { throw res.error; @@ -2130,7 +2092,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -2152,10 +2114,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## purchase @@ -2176,9 +2137,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.batches.purchase(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -2209,7 +2170,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -2230,10 +2191,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## removeShipments @@ -2250,14 +2210,14 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.batches.removeShipments("", [ + const result = await shippo.batches.removeShipments([ "", "", "", - ]); - + ], ""); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -2279,11 +2239,11 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await batchesRemoveShipments(shippo, "", [ + const res = await batchesRemoveShipments(shippo, [ "", "", "", - ]); + ], ""); if (!res.ok) { throw res.error; @@ -2292,7 +2252,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -2314,6 +2274,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/carrieraccounts/README.md b/docs/sdks/carrieraccounts/README.md index 4d81961a..343e7211 100644 --- a/docs/sdks/carrieraccounts/README.md +++ b/docs/sdks/carrieraccounts/README.md @@ -37,9 +37,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.carrierAccounts.list({}); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -70,7 +70,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -91,10 +91,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -127,9 +126,9 @@ async function run() { }, test: false, }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -175,7 +174,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -196,10 +195,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -217,9 +215,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.carrierAccounts.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -250,7 +248,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -271,10 +269,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## update @@ -319,9 +316,9 @@ async function run() { upsAgreements: true, }, }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -379,7 +376,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -401,10 +398,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## initiateOauth2Signin @@ -422,9 +418,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.carrierAccounts.initiateOauth2Signin("", "https://enlightened-mortise.com/"); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -455,7 +451,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -478,13 +474,12 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | -------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------- | | errors.InitiateOauth2SigninResponseBody | 400 | application/json | | errors.InitiateOauth2SigninCarrierAccountsResponseBody | 401 | application/json | | errors.InitiateOauth2SigninCarrierAccountsResponseResponseBody | 404 | application/json | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## register @@ -524,9 +519,9 @@ async function run() { upsAgreements: true, }, }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -579,7 +574,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -600,10 +595,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## getRegistrationStatus @@ -621,9 +615,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.carrierAccounts.getRegistrationStatus("usps"); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -654,7 +648,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -675,6 +669,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/carrierparceltemplates/README.md b/docs/sdks/carrierparceltemplates/README.md index caf6e2d8..f3c366bd 100644 --- a/docs/sdks/carrierparceltemplates/README.md +++ b/docs/sdks/carrierparceltemplates/README.md @@ -34,9 +34,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.carrierParcelTemplates.list("fedex"); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -67,7 +67,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -89,10 +89,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -110,9 +109,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.carrierParcelTemplates.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -143,7 +142,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -164,6 +163,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/customsdeclarations/README.md b/docs/sdks/customsdeclarations/README.md index dd9d5006..74b296d0 100644 --- a/docs/sdks/customsdeclarations/README.md +++ b/docs/sdks/customsdeclarations/README.md @@ -29,9 +29,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.customsDeclarations.list(); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -62,7 +62,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -84,10 +84,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -161,9 +160,9 @@ async function run() { nonDeliveryOption: "RETURN", test: true, }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -250,7 +249,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -271,10 +270,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -292,9 +290,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.customsDeclarations.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -325,7 +323,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -347,6 +345,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/customsitems/README.md b/docs/sdks/customsitems/README.md index a0785dc3..2db72c80 100644 --- a/docs/sdks/customsitems/README.md +++ b/docs/sdks/customsitems/README.md @@ -28,9 +28,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.customsItems.list(); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -61,7 +61,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -83,10 +83,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -115,9 +114,9 @@ async function run() { valueAmount: "200", valueCurrency: "USD", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -159,7 +158,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -180,10 +179,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -201,9 +199,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.customsItems.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -234,7 +232,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -256,6 +254,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/manifests/README.md b/docs/sdks/manifests/README.md index de10a52c..bc326bd2 100644 --- a/docs/sdks/manifests/README.md +++ b/docs/sdks/manifests/README.md @@ -34,9 +34,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.manifests.list(); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -67,7 +67,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -89,10 +89,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -132,9 +131,9 @@ async function run() { validate: true, }, }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -187,7 +186,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -208,10 +207,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -229,9 +227,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.manifests.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -262,7 +260,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -283,6 +281,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/orders/README.md b/docs/sdks/orders/README.md index 0c8bd516..3b0235df 100644 --- a/docs/sdks/orders/README.md +++ b/docs/sdks/orders/README.md @@ -44,9 +44,9 @@ async function run() { ], shopApp: "Shippo", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -82,7 +82,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -103,10 +103,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -185,9 +184,9 @@ async function run() { }, ], }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -279,7 +278,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -300,10 +299,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -321,9 +319,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.orders.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -354,7 +352,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -375,6 +373,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/parcels/README.md b/docs/sdks/parcels/README.md index ee8f568f..d2ee7f64 100644 --- a/docs/sdks/parcels/README.md +++ b/docs/sdks/parcels/README.md @@ -32,9 +32,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.parcels.list(); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -65,7 +65,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -87,10 +87,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -129,9 +128,9 @@ async function run() { length: "1", width: "1", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -183,7 +182,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -204,10 +203,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -225,9 +223,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.parcels.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -258,7 +256,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -279,6 +277,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/pickups/README.md b/docs/sdks/pickups/README.md index 94ac17ef..80f089aa 100644 --- a/docs/sdks/pickups/README.md +++ b/docs/sdks/pickups/README.md @@ -55,9 +55,9 @@ async function run() { "adcfdddf8ec64b84ad22772bce3ea37a", ], }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -116,7 +116,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -137,6 +137,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/rates/README.md b/docs/sdks/rates/README.md index 39b3a1e4..ce5bdd37 100644 --- a/docs/sdks/rates/README.md +++ b/docs/sdks/rates/README.md @@ -28,9 +28,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.rates.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -61,7 +61,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -82,10 +82,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## listShipmentRates @@ -103,9 +102,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.rates.listShipmentRates(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -136,7 +135,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -159,10 +158,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## listShipmentRatesByCurrencyCode @@ -189,9 +187,9 @@ async function run() { shipmentId: "", currencyCode: "USD", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -225,7 +223,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -246,6 +244,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/ratesatcheckout/README.md b/docs/sdks/ratesatcheckout/README.md index 9a6a81aa..e343118d 100644 --- a/docs/sdks/ratesatcheckout/README.md +++ b/docs/sdks/ratesatcheckout/README.md @@ -74,9 +74,9 @@ async function run() { ], parcel: "5df144dca289442cv7a06", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -142,7 +142,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -163,10 +163,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## getDefaultParcelTemplate @@ -183,10 +182,10 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.ratesAtCheckout.getDefaultParcelTemplate(); - + const result = await shippo.ratesAtCheckout.getDefaultParcelTemplate({}); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -208,7 +207,7 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await ratesAtCheckoutGetDefaultParcelTemplate(shippo); + const res = await ratesAtCheckoutGetDefaultParcelTemplate(shippo, {}); if (!res.ok) { throw res.error; @@ -217,7 +216,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -237,10 +236,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## updateDefaultParcelTemplate @@ -257,10 +255,12 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.ratesAtCheckout.updateDefaultParcelTemplate("b958d3690bb04bb8b2986724872750f5"); - + const result = await shippo.ratesAtCheckout.updateDefaultParcelTemplate({ + objectId: "b958d3690bb04bb8b2986724872750f5", + }); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -282,7 +282,9 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await ratesAtCheckoutUpdateDefaultParcelTemplate(shippo, "b958d3690bb04bb8b2986724872750f5"); + const res = await ratesAtCheckoutUpdateDefaultParcelTemplate(shippo, { + objectId: "b958d3690bb04bb8b2986724872750f5", + }); if (!res.ok) { throw res.error; @@ -291,7 +293,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -312,10 +314,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## deleteDefaultParcelTemplate @@ -332,7 +333,9 @@ const shippo = new Shippo({ }); async function run() { - await shippo.ratesAtCheckout.deleteDefaultParcelTemplate(); + await shippo.ratesAtCheckout.deleteDefaultParcelTemplate({}); + + } run(); @@ -354,7 +357,7 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await ratesAtCheckoutDeleteDefaultParcelTemplate(shippo); + const res = await ratesAtCheckoutDeleteDefaultParcelTemplate(shippo, {}); if (!res.ok) { throw res.error; @@ -382,6 +385,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/refunds/README.md b/docs/sdks/refunds/README.md index 47515f77..8a561c00 100644 --- a/docs/sdks/refunds/README.md +++ b/docs/sdks/refunds/README.md @@ -27,10 +27,13 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.refunds.create("915d94940ea54c3a80cbfa328722f5a1", false); - + const result = await shippo.refunds.create({ + async: false, + transaction: "915d94940ea54c3a80cbfa328722f5a1", + }); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -52,7 +55,10 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await refundsCreate(shippo, "915d94940ea54c3a80cbfa328722f5a1", false); + const res = await refundsCreate(shippo, { + async: false, + transaction: "915d94940ea54c3a80cbfa328722f5a1", + }); if (!res.ok) { throw res.error; @@ -61,7 +67,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -83,10 +89,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## list @@ -103,10 +108,10 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.refunds.list(); - + const result = await shippo.refunds.list({}); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -128,7 +133,7 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await refundsList(shippo); + const res = await refundsList(shippo, {}); if (!res.ok) { throw res.error; @@ -137,7 +142,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -157,10 +162,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -178,9 +182,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.refunds.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -211,7 +215,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -232,6 +236,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/servicegroups/README.md b/docs/sdks/servicegroups/README.md index 878a01de..98986a45 100644 --- a/docs/sdks/servicegroups/README.md +++ b/docs/sdks/servicegroups/README.md @@ -29,10 +29,10 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.serviceGroups.list(); - + const result = await shippo.serviceGroups.list({}); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -54,7 +54,7 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await serviceGroupsList(shippo); + const res = await serviceGroupsList(shippo, {}); if (!res.ok) { throw res.error; @@ -63,7 +63,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -83,10 +83,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -119,9 +118,9 @@ async function run() { }, ], }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -167,7 +166,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -188,10 +187,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## update @@ -234,9 +232,9 @@ async function run() { }, ], }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -292,7 +290,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -313,10 +311,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## delete @@ -334,6 +331,8 @@ const shippo = new Shippo({ async function run() { await shippo.serviceGroups.delete(""); + + } run(); @@ -384,6 +383,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/shipments/README.md b/docs/sdks/shipments/README.md index f5ee118b..596ed759 100644 --- a/docs/sdks/shipments/README.md +++ b/docs/sdks/shipments/README.md @@ -49,9 +49,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.shipments.list({}); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -82,7 +82,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -103,10 +103,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -369,9 +368,9 @@ async function run() { }, ], }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -647,7 +646,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -668,10 +667,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -689,9 +687,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.shipments.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -722,7 +720,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -743,6 +741,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/shippo/README.md b/docs/sdks/shippo/README.md index 91ba14ff..1ed996ba 100644 --- a/docs/sdks/shippo/README.md +++ b/docs/sdks/shippo/README.md @@ -2,4 +2,6 @@ ## Overview -Shippo external API.: Use this API to integrate with the Shippo service \ No newline at end of file +Shippo external API.: Use this API to integrate with the Shippo service + +### Available Operations diff --git a/docs/sdks/shippoaccounts/README.md b/docs/sdks/shippoaccounts/README.md index d9f559ee..0b01eac2 100644 --- a/docs/sdks/shippoaccounts/README.md +++ b/docs/sdks/shippoaccounts/README.md @@ -31,9 +31,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.shippoAccounts.list(); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -64,7 +64,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -86,10 +86,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -112,9 +111,9 @@ async function run() { lastName: "Meister", companyName: "Acme", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -150,7 +149,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -171,10 +170,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -192,9 +190,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.shippoAccounts.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -225,7 +223,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -246,10 +244,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## update @@ -272,9 +269,9 @@ async function run() { lastName: "Meister", companyName: "Acme", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -310,7 +307,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -332,6 +329,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/trackingstatus/README.md b/docs/sdks/trackingstatus/README.md index 62bbaa34..d853fad5 100644 --- a/docs/sdks/trackingstatus/README.md +++ b/docs/sdks/trackingstatus/README.md @@ -35,10 +35,14 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.trackingStatus.create("usps", "9205590164917312751089", "Order 000123"); - + const result = await shippo.trackingStatus.create({ + carrier: "usps", + metadata: "Order 000123", + trackingNumber: "9205590164917312751089", + }); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -60,7 +64,11 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await trackingStatusCreate(shippo, "usps", "9205590164917312751089", "Order 000123"); + const res = await trackingStatusCreate(shippo, { + carrier: "usps", + metadata: "Order 000123", + trackingNumber: "9205590164917312751089", + }); if (!res.ok) { throw res.error; @@ -69,7 +77,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -92,10 +100,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -113,9 +120,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.trackingStatus.get("", ""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -146,7 +153,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -168,6 +175,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/transactions/README.md b/docs/sdks/transactions/README.md index 95505249..f12e61c9 100644 --- a/docs/sdks/transactions/README.md +++ b/docs/sdks/transactions/README.md @@ -31,9 +31,9 @@ async function run() { objectStatus: "SUCCESS", trackingStatus: "DELIVERED", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -67,7 +67,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -88,10 +88,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -115,9 +114,9 @@ async function run() { rate: "ec9f0d3adc9441449c85d315f0997fd5", order: "adcfdddf8ec64b84ad22772bce3ea37a", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -154,7 +153,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -175,10 +174,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -196,9 +194,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.transactions.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -229,7 +227,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -250,6 +248,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/userparceltemplates/README.md b/docs/sdks/userparceltemplates/README.md index 7caf98f0..ac5cc006 100644 --- a/docs/sdks/userparceltemplates/README.md +++ b/docs/sdks/userparceltemplates/README.md @@ -34,10 +34,10 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.userParcelTemplates.list(); - + const result = await shippo.userParcelTemplates.list({}); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -59,7 +59,7 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await userParcelTemplatesList(shippo); + const res = await userParcelTemplatesList(shippo, {}); if (!res.ok) { throw res.error; @@ -68,7 +68,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -88,10 +88,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## create @@ -118,9 +117,9 @@ async function run() { weight: "12", weightUnit: "lb", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -154,7 +153,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -175,10 +174,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## delete @@ -196,6 +194,8 @@ const shippo = new Shippo({ async function run() { await shippo.userParcelTemplates.delete(""); + + } run(); @@ -246,10 +246,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## get @@ -268,9 +267,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.userParcelTemplates.get(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -301,7 +300,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -322,10 +321,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## update @@ -351,9 +349,9 @@ async function run() { weightUnit: "lb", width: "8", }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -392,7 +390,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -414,6 +412,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/docs/sdks/webhooks/README.md b/docs/sdks/webhooks/README.md index dabafa95..d33e7154 100644 --- a/docs/sdks/webhooks/README.md +++ b/docs/sdks/webhooks/README.md @@ -39,9 +39,9 @@ async function run() { active: true, isTest: false, }); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -77,7 +77,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -98,10 +98,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## listWebhooks @@ -119,9 +118,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.webhooks.listWebhooks(); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -152,7 +151,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -172,10 +171,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## getWebhook @@ -193,9 +191,9 @@ const shippo = new Shippo({ async function run() { const result = await shippo.webhooks.getWebhook(""); - + // Handle the result - console.log(result) + console.log(result); } run(); @@ -226,7 +224,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -247,10 +245,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## updateWebhook @@ -267,15 +264,15 @@ const shippo = new Shippo({ }); async function run() { - const result = await shippo.webhooks.updateWebhook("", { + const result = await shippo.webhooks.updateWebhook({ event: "batch_created", url: "https://example.com/shippo-webhook", active: true, isTest: false, - }); - + }, ""); + // Handle the result - console.log(result) + console.log(result); } run(); @@ -297,12 +294,12 @@ const shippo = new ShippoCore({ }); async function run() { - const res = await webhooksUpdateWebhook(shippo, "", { + const res = await webhooksUpdateWebhook(shippo, { event: "batch_created", url: "https://example.com/shippo-webhook", active: true, isTest: false, - }); + }, ""); if (!res.ok) { throw res.error; @@ -311,7 +308,7 @@ async function run() { const { value: result } = res; // Handle the result - console.log(result) + console.log(result); } run(); @@ -333,10 +330,9 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | - +| errors.SDKError | 4XX, 5XX | \*/\* | ## deleteWebhook @@ -354,6 +350,8 @@ const shippo = new Shippo({ async function run() { await shippo.webhooks.deleteWebhook(""); + + } run(); @@ -404,6 +402,6 @@ run(); ### Errors -| Error Object | Status Code | Content Type | +| Error Type | Status Code | Content Type | | --------------- | --------------- | --------------- | -| errors.SDKError | 4xx-5xx | */* | +| errors.SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/jsr.json b/jsr.json index 17ec9a11..d4e3c2de 100644 --- a/jsr.json +++ b/jsr.json @@ -2,7 +2,7 @@ { "name": "shippo", - "version": "2.14.1", + "version": "2.15.0", "exports": { ".": "./src/index.ts", "./models/errors": "./src/models/errors/index.ts", diff --git a/package-lock.json b/package-lock.json index 35f3a5a7..952aa12a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "shippo", - "version": "2.14.1", + "version": "2.15.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "shippo", - "version": "2.14.1", + "version": "2.15.0", "license": "MIT", "devDependencies": { "@types/chai": "^4.3.14", diff --git a/package.json b/package.json index afa3c81b..823de68f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "shippo", - "version": "2.14.1", + "version": "2.15.0", "author": "Shippo", "license": "MIT", "main": "./index.js", diff --git a/src/funcs/addressesCreate.ts b/src/funcs/addressesCreate.ts index 5827504e..a9d85831 100644 --- a/src/funcs/addressesCreate.ts +++ b/src/funcs/addressesCreate.ts @@ -43,10 +43,8 @@ export async function addressesCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.AddressCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function addressesCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateAddress", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function addressesCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/addressesGet.ts b/src/funcs/addressesGet.ts index a65c32fc..220c73da 100644 --- a/src/funcs/addressesGet.ts +++ b/src/funcs/addressesGet.ts @@ -79,16 +79,25 @@ export async function addressesGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetAddress", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function addressesGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/addressesList.ts b/src/funcs/addressesList.ts index b17acedd..7483b106 100644 --- a/src/funcs/addressesList.ts +++ b/src/funcs/addressesList.ts @@ -79,16 +79,25 @@ export async function addressesList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListAddresses", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -103,9 +112,8 @@ export async function addressesList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/addressesValidate.ts b/src/funcs/addressesValidate.ts index 8b1d745b..3296a2d0 100644 --- a/src/funcs/addressesValidate.ts +++ b/src/funcs/addressesValidate.ts @@ -79,16 +79,25 @@ export async function addressesValidate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ValidateAddress", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function addressesValidate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/batchesAddShipments.ts b/src/funcs/batchesAddShipments.ts index a4373060..9f9a86ae 100644 --- a/src/funcs/batchesAddShipments.ts +++ b/src/funcs/batchesAddShipments.ts @@ -30,8 +30,8 @@ import { Result } from "../types/fp.js"; */ export async function batchesAddShipments( client: ShippoCore, - batchId: string, requestBody: Array, + batchId: string, options?: RequestOptions, ): Promise< Result< @@ -46,8 +46,8 @@ export async function batchesAddShipments( > > { const input: operations.AddShipmentsToBatchRequest = { - batchId: batchId, requestBody: requestBody, + batchId: batchId, }; const parsed = safeParse( @@ -83,16 +83,25 @@ export async function batchesAddShipments( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "AddShipmentsToBatch", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -106,9 +115,8 @@ export async function batchesAddShipments( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/batchesCreate.ts b/src/funcs/batchesCreate.ts index 0a00d3c7..642f7c4b 100644 --- a/src/funcs/batchesCreate.ts +++ b/src/funcs/batchesCreate.ts @@ -43,10 +43,8 @@ export async function batchesCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.BatchCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function batchesCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateBatch", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function batchesCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/batchesGet.ts b/src/funcs/batchesGet.ts index cd6305fe..c4e709b8 100644 --- a/src/funcs/batchesGet.ts +++ b/src/funcs/batchesGet.ts @@ -91,16 +91,25 @@ export async function batchesGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetBatch", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -115,9 +124,8 @@ export async function batchesGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/batchesPurchase.ts b/src/funcs/batchesPurchase.ts index 66a981ab..42a0a2dd 100644 --- a/src/funcs/batchesPurchase.ts +++ b/src/funcs/batchesPurchase.ts @@ -82,16 +82,25 @@ export async function batchesPurchase( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "PurchaseBatch", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -105,9 +114,8 @@ export async function batchesPurchase( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/batchesRemoveShipments.ts b/src/funcs/batchesRemoveShipments.ts index 8561a933..59082aa2 100644 --- a/src/funcs/batchesRemoveShipments.ts +++ b/src/funcs/batchesRemoveShipments.ts @@ -30,8 +30,8 @@ import { Result } from "../types/fp.js"; */ export async function batchesRemoveShipments( client: ShippoCore, - batchId: string, requestBody: Array, + batchId: string, options?: RequestOptions, ): Promise< Result< @@ -46,8 +46,8 @@ export async function batchesRemoveShipments( > > { const input: operations.RemoveShipmentsFromBatchRequest = { - batchId: batchId, requestBody: requestBody, + batchId: batchId, }; const parsed = safeParse( @@ -83,16 +83,25 @@ export async function batchesRemoveShipments( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "RemoveShipmentsFromBatch", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -106,9 +115,8 @@ export async function batchesRemoveShipments( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierAccountsCreate.ts b/src/funcs/carrierAccountsCreate.ts index ce8e3fb9..aa40a597 100644 --- a/src/funcs/carrierAccountsCreate.ts +++ b/src/funcs/carrierAccountsCreate.ts @@ -43,10 +43,8 @@ export async function carrierAccountsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.ConnectExistingOwnAccountRequest$outboundSchema.parse(value), "Input validation failed", @@ -71,16 +69,25 @@ export async function carrierAccountsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateCarrierAccount", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -94,9 +101,8 @@ export async function carrierAccountsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierAccountsGet.ts b/src/funcs/carrierAccountsGet.ts index 34389687..860d59f5 100644 --- a/src/funcs/carrierAccountsGet.ts +++ b/src/funcs/carrierAccountsGet.ts @@ -80,16 +80,25 @@ export async function carrierAccountsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetCarrierAccount", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -103,9 +112,8 @@ export async function carrierAccountsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierAccountsGetRegistrationStatus.ts b/src/funcs/carrierAccountsGetRegistrationStatus.ts index 01e69830..2b05f4c4 100644 --- a/src/funcs/carrierAccountsGetRegistrationStatus.ts +++ b/src/funcs/carrierAccountsGetRegistrationStatus.ts @@ -79,16 +79,25 @@ export async function carrierAccountsGetRegistrationStatus( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetCarrierRegistrationStatus", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -103,9 +112,8 @@ export async function carrierAccountsGetRegistrationStatus( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierAccountsInitiateOauth2Signin.ts b/src/funcs/carrierAccountsInitiateOauth2Signin.ts index e2113aa3..ea18cb7e 100644 --- a/src/funcs/carrierAccountsInitiateOauth2Signin.ts +++ b/src/funcs/carrierAccountsInitiateOauth2Signin.ts @@ -95,16 +95,25 @@ export async function carrierAccountsInitiateOauth2Signin( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "InitiateOauth2Signin", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -119,9 +128,8 @@ export async function carrierAccountsInitiateOauth2Signin( const doResult = await client._do(req, { context, errorCodes: ["400", "401", "404", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierAccountsList.ts b/src/funcs/carrierAccountsList.ts index d3b2b3b4..4b250f44 100644 --- a/src/funcs/carrierAccountsList.ts +++ b/src/funcs/carrierAccountsList.ts @@ -48,10 +48,8 @@ export async function carrierAccountsList( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.ListCarrierAccountsRequest$outboundSchema.parse(value), "Input validation failed", @@ -83,16 +81,25 @@ export async function carrierAccountsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListCarrierAccounts", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -107,9 +114,8 @@ export async function carrierAccountsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierAccountsRegister.ts b/src/funcs/carrierAccountsRegister.ts index 6b8c31c9..37ceceed 100644 --- a/src/funcs/carrierAccountsRegister.ts +++ b/src/funcs/carrierAccountsRegister.ts @@ -44,10 +44,8 @@ export async function carrierAccountsRegister( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.RegisterCarrierAccountRequestBody$outboundSchema.parse(value), "Input validation failed", @@ -72,16 +70,25 @@ export async function carrierAccountsRegister( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "RegisterCarrierAccount", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -95,9 +102,8 @@ export async function carrierAccountsRegister( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierAccountsUpdate.ts b/src/funcs/carrierAccountsUpdate.ts index 98073498..c9902131 100644 --- a/src/funcs/carrierAccountsUpdate.ts +++ b/src/funcs/carrierAccountsUpdate.ts @@ -86,16 +86,25 @@ export async function carrierAccountsUpdate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "UpdateCarrierAccount", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "PUT", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -109,9 +118,8 @@ export async function carrierAccountsUpdate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierParcelTemplatesGet.ts b/src/funcs/carrierParcelTemplatesGet.ts index a4b5818a..125b52c9 100644 --- a/src/funcs/carrierParcelTemplatesGet.ts +++ b/src/funcs/carrierParcelTemplatesGet.ts @@ -83,16 +83,25 @@ export async function carrierParcelTemplatesGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetCarrierParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -106,9 +115,8 @@ export async function carrierParcelTemplatesGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/carrierParcelTemplatesList.ts b/src/funcs/carrierParcelTemplatesList.ts index f45f2120..9b6d9435 100644 --- a/src/funcs/carrierParcelTemplatesList.ts +++ b/src/funcs/carrierParcelTemplatesList.ts @@ -86,16 +86,25 @@ export async function carrierParcelTemplatesList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListCarrierParcelTemplates", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -110,9 +119,8 @@ export async function carrierParcelTemplatesList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/customsDeclarationsCreate.ts b/src/funcs/customsDeclarationsCreate.ts index ca7692b0..592d5292 100644 --- a/src/funcs/customsDeclarationsCreate.ts +++ b/src/funcs/customsDeclarationsCreate.ts @@ -43,10 +43,8 @@ export async function customsDeclarationsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.CustomsDeclarationCreateRequest$outboundSchema.parse(value), "Input validation failed", @@ -71,16 +69,25 @@ export async function customsDeclarationsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateCustomsDeclaration", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -94,9 +101,8 @@ export async function customsDeclarationsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/customsDeclarationsGet.ts b/src/funcs/customsDeclarationsGet.ts index f600e2b0..68dbdcfa 100644 --- a/src/funcs/customsDeclarationsGet.ts +++ b/src/funcs/customsDeclarationsGet.ts @@ -89,16 +89,25 @@ export async function customsDeclarationsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetCustomsDeclaration", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -113,9 +122,8 @@ export async function customsDeclarationsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/customsDeclarationsList.ts b/src/funcs/customsDeclarationsList.ts index a871e638..83d24424 100644 --- a/src/funcs/customsDeclarationsList.ts +++ b/src/funcs/customsDeclarationsList.ts @@ -80,16 +80,25 @@ export async function customsDeclarationsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListCustomsDeclarations", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -104,9 +113,8 @@ export async function customsDeclarationsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/customsItemsCreate.ts b/src/funcs/customsItemsCreate.ts index f846419f..b964b3ff 100644 --- a/src/funcs/customsItemsCreate.ts +++ b/src/funcs/customsItemsCreate.ts @@ -43,10 +43,8 @@ export async function customsItemsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.CustomsItemCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function customsItemsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateCustomsItem", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function customsItemsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/customsItemsGet.ts b/src/funcs/customsItemsGet.ts index 585fa95a..92e65536 100644 --- a/src/funcs/customsItemsGet.ts +++ b/src/funcs/customsItemsGet.ts @@ -85,16 +85,25 @@ export async function customsItemsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetCustomsItem", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -109,9 +118,8 @@ export async function customsItemsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/customsItemsList.ts b/src/funcs/customsItemsList.ts index 6cca3ade..e3c5ac5d 100644 --- a/src/funcs/customsItemsList.ts +++ b/src/funcs/customsItemsList.ts @@ -79,16 +79,25 @@ export async function customsItemsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListCustomsItems", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -103,9 +112,8 @@ export async function customsItemsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/manifestsCreate.ts b/src/funcs/manifestsCreate.ts index d084dad0..c271abae 100644 --- a/src/funcs/manifestsCreate.ts +++ b/src/funcs/manifestsCreate.ts @@ -43,10 +43,8 @@ export async function manifestsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.ManifestCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function manifestsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateManifest", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function manifestsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/manifestsGet.ts b/src/funcs/manifestsGet.ts index 6b4ee92f..548c17cc 100644 --- a/src/funcs/manifestsGet.ts +++ b/src/funcs/manifestsGet.ts @@ -79,16 +79,25 @@ export async function manifestsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetManifest", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function manifestsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/manifestsList.ts b/src/funcs/manifestsList.ts index 62540de5..01292ab2 100644 --- a/src/funcs/manifestsList.ts +++ b/src/funcs/manifestsList.ts @@ -79,16 +79,25 @@ export async function manifestsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListManifests", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -103,9 +112,8 @@ export async function manifestsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ordersCreate.ts b/src/funcs/ordersCreate.ts index 5fc473d1..029f2325 100644 --- a/src/funcs/ordersCreate.ts +++ b/src/funcs/ordersCreate.ts @@ -43,10 +43,8 @@ export async function ordersCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.OrderCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function ordersCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateOrder", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function ordersCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ordersGet.ts b/src/funcs/ordersGet.ts index 89c6893d..cd939e04 100644 --- a/src/funcs/ordersGet.ts +++ b/src/funcs/ordersGet.ts @@ -79,16 +79,25 @@ export async function ordersGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetOrder", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function ordersGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ordersList.ts b/src/funcs/ordersList.ts index 2e23136d..f0d13f8c 100644 --- a/src/funcs/ordersList.ts +++ b/src/funcs/ordersList.ts @@ -44,10 +44,8 @@ export async function ordersList( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.ListOrdersRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -79,16 +77,25 @@ export async function ordersList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListOrders", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -103,9 +110,8 @@ export async function ordersList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/parcelsCreate.ts b/src/funcs/parcelsCreate.ts index 7c7af89e..abe35765 100644 --- a/src/funcs/parcelsCreate.ts +++ b/src/funcs/parcelsCreate.ts @@ -44,10 +44,8 @@ export async function parcelsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.CreateParcelRequestBody$outboundSchema.parse(value), "Input validation failed", ); @@ -71,16 +69,25 @@ export async function parcelsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateParcel", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -94,9 +101,8 @@ export async function parcelsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/parcelsGet.ts b/src/funcs/parcelsGet.ts index 955cbec5..7ff7a787 100644 --- a/src/funcs/parcelsGet.ts +++ b/src/funcs/parcelsGet.ts @@ -79,16 +79,25 @@ export async function parcelsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetParcel", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function parcelsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/parcelsList.ts b/src/funcs/parcelsList.ts index 66bc2408..2fa7842d 100644 --- a/src/funcs/parcelsList.ts +++ b/src/funcs/parcelsList.ts @@ -79,16 +79,25 @@ export async function parcelsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListParcels", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -103,9 +112,8 @@ export async function parcelsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/pickupsCreate.ts b/src/funcs/pickupsCreate.ts index ed95d7e7..7a9495fd 100644 --- a/src/funcs/pickupsCreate.ts +++ b/src/funcs/pickupsCreate.ts @@ -43,10 +43,8 @@ export async function pickupsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.PickupBase$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function pickupsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreatePickup", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function pickupsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ratesAtCheckoutCreate.ts b/src/funcs/ratesAtCheckoutCreate.ts index d3ad87e5..c38a9c98 100644 --- a/src/funcs/ratesAtCheckoutCreate.ts +++ b/src/funcs/ratesAtCheckoutCreate.ts @@ -46,10 +46,8 @@ export async function ratesAtCheckoutCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.LiveRateCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -73,16 +71,25 @@ export async function ratesAtCheckoutCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateLiveRate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -96,9 +103,8 @@ export async function ratesAtCheckoutCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ratesAtCheckoutDeleteDefaultParcelTemplate.ts b/src/funcs/ratesAtCheckoutDeleteDefaultParcelTemplate.ts index 51416591..b3c530c0 100644 --- a/src/funcs/ratesAtCheckoutDeleteDefaultParcelTemplate.ts +++ b/src/funcs/ratesAtCheckoutDeleteDefaultParcelTemplate.ts @@ -29,6 +29,7 @@ import { Result } from "../types/fp.js"; */ export async function ratesAtCheckoutDeleteDefaultParcelTemplate( client: ShippoCore, + _request: operations.DeleteDefaultParcelTemplateRequest, options?: RequestOptions, ): Promise< Result< @@ -42,9 +43,6 @@ export async function ratesAtCheckoutDeleteDefaultParcelTemplate( | ConnectionError > > { - const input: operations.DeleteDefaultParcelTemplateRequest = {}; - void input; // request input is unused - const path = pathToFunc("/live-rates/settings/parcel-template")(); const headers = new Headers({ @@ -58,16 +56,25 @@ export async function ratesAtCheckoutDeleteDefaultParcelTemplate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "DeleteDefaultParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "DELETE", + baseURL: options?.serverURL, path: path, headers: headers, timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, @@ -80,9 +87,8 @@ export async function ratesAtCheckoutDeleteDefaultParcelTemplate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ratesAtCheckoutGetDefaultParcelTemplate.ts b/src/funcs/ratesAtCheckoutGetDefaultParcelTemplate.ts index be01f1fd..8b8b9702 100644 --- a/src/funcs/ratesAtCheckoutGetDefaultParcelTemplate.ts +++ b/src/funcs/ratesAtCheckoutGetDefaultParcelTemplate.ts @@ -29,6 +29,7 @@ import { Result } from "../types/fp.js"; */ export async function ratesAtCheckoutGetDefaultParcelTemplate( client: ShippoCore, + _request: operations.GetDefaultParcelTemplateRequest, options?: RequestOptions, ): Promise< Result< @@ -42,9 +43,6 @@ export async function ratesAtCheckoutGetDefaultParcelTemplate( | ConnectionError > > { - const input: operations.GetDefaultParcelTemplateRequest = {}; - void input; // request input is unused - const path = pathToFunc("/live-rates/settings/parcel-template")(); const headers = new Headers({ @@ -58,16 +56,25 @@ export async function ratesAtCheckoutGetDefaultParcelTemplate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetDefaultParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, @@ -80,9 +87,8 @@ export async function ratesAtCheckoutGetDefaultParcelTemplate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ratesAtCheckoutUpdateDefaultParcelTemplate.ts b/src/funcs/ratesAtCheckoutUpdateDefaultParcelTemplate.ts index 00c8eefb..6cb2dc38 100644 --- a/src/funcs/ratesAtCheckoutUpdateDefaultParcelTemplate.ts +++ b/src/funcs/ratesAtCheckoutUpdateDefaultParcelTemplate.ts @@ -29,7 +29,7 @@ import { Result } from "../types/fp.js"; */ export async function ratesAtCheckoutUpdateDefaultParcelTemplate( client: ShippoCore, - objectId?: string | undefined, + request?: components.DefaultParcelTemplateUpdateRequest | undefined, options?: RequestOptions, ): Promise< Result< @@ -43,12 +43,8 @@ export async function ratesAtCheckoutUpdateDefaultParcelTemplate( | ConnectionError > > { - const input: components.DefaultParcelTemplateUpdateRequest | undefined = { - objectId: objectId, - }; - const parsed = safeParse( - input, + request, (value) => components.DefaultParcelTemplateUpdateRequest$outboundSchema.optional() .parse(value), @@ -76,16 +72,25 @@ export async function ratesAtCheckoutUpdateDefaultParcelTemplate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "UpdateDefaultParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "PUT", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -99,9 +104,8 @@ export async function ratesAtCheckoutUpdateDefaultParcelTemplate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ratesGet.ts b/src/funcs/ratesGet.ts index 26e81a71..f24c379f 100644 --- a/src/funcs/ratesGet.ts +++ b/src/funcs/ratesGet.ts @@ -79,16 +79,25 @@ export async function ratesGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetRate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function ratesGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ratesListShipmentRates.ts b/src/funcs/ratesListShipmentRates.ts index 3061ecb4..89aa560f 100644 --- a/src/funcs/ratesListShipmentRates.ts +++ b/src/funcs/ratesListShipmentRates.ts @@ -88,16 +88,25 @@ export async function ratesListShipmentRates( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListShipmentRates", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -112,9 +121,8 @@ export async function ratesListShipmentRates( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/ratesListShipmentRatesByCurrencyCode.ts b/src/funcs/ratesListShipmentRatesByCurrencyCode.ts index b49666a6..3459d67c 100644 --- a/src/funcs/ratesListShipmentRatesByCurrencyCode.ts +++ b/src/funcs/ratesListShipmentRatesByCurrencyCode.ts @@ -50,10 +50,8 @@ export async function ratesListShipmentRatesByCurrencyCode( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.ListShipmentRatesByCurrencyCodeRequest$outboundSchema.parse( value, @@ -97,16 +95,25 @@ export async function ratesListShipmentRatesByCurrencyCode( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListShipmentRatesByCurrencyCode", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -121,9 +128,8 @@ export async function ratesListShipmentRatesByCurrencyCode( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/refundsCreate.ts b/src/funcs/refundsCreate.ts index c2d733a0..852aa542 100644 --- a/src/funcs/refundsCreate.ts +++ b/src/funcs/refundsCreate.ts @@ -29,8 +29,7 @@ import { Result } from "../types/fp.js"; */ export async function refundsCreate( client: ShippoCore, - transaction: string, - async?: boolean | undefined, + request: components.RefundRequestBody, options?: RequestOptions, ): Promise< Result< @@ -44,13 +43,8 @@ export async function refundsCreate( | ConnectionError > > { - const input: components.RefundRequestBody = { - async: async, - transaction: transaction, - }; - const parsed = safeParse( - input, + request, (value) => components.RefundRequestBody$outboundSchema.parse(value), "Input validation failed", ); @@ -74,16 +68,25 @@ export async function refundsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateRefund", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -97,9 +100,8 @@ export async function refundsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/refundsGet.ts b/src/funcs/refundsGet.ts index f571e54e..10826525 100644 --- a/src/funcs/refundsGet.ts +++ b/src/funcs/refundsGet.ts @@ -79,16 +79,25 @@ export async function refundsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetRefund", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function refundsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/refundsList.ts b/src/funcs/refundsList.ts index 6ae6affd..c394708b 100644 --- a/src/funcs/refundsList.ts +++ b/src/funcs/refundsList.ts @@ -29,6 +29,7 @@ import { Result } from "../types/fp.js"; */ export async function refundsList( client: ShippoCore, + _request: operations.ListRefundsRequest, options?: RequestOptions, ): Promise< Result< @@ -42,9 +43,6 @@ export async function refundsList( | ConnectionError > > { - const input: operations.ListRefundsRequest = {}; - void input; // request input is unused - const path = pathToFunc("/refunds/")(); const headers = new Headers({ @@ -58,16 +56,25 @@ export async function refundsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListRefunds", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, @@ -80,9 +87,8 @@ export async function refundsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/serviceGroupsCreate.ts b/src/funcs/serviceGroupsCreate.ts index 30fb0a85..222fda2e 100644 --- a/src/funcs/serviceGroupsCreate.ts +++ b/src/funcs/serviceGroupsCreate.ts @@ -43,10 +43,8 @@ export async function serviceGroupsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.ServiceGroupCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function serviceGroupsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateServiceGroup", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function serviceGroupsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/serviceGroupsDelete.ts b/src/funcs/serviceGroupsDelete.ts index 1461430b..73b7263f 100644 --- a/src/funcs/serviceGroupsDelete.ts +++ b/src/funcs/serviceGroupsDelete.ts @@ -79,16 +79,25 @@ export async function serviceGroupsDelete( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "DeleteServiceGroup", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "DELETE", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function serviceGroupsDelete( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/serviceGroupsList.ts b/src/funcs/serviceGroupsList.ts index 1235dd6e..360b8866 100644 --- a/src/funcs/serviceGroupsList.ts +++ b/src/funcs/serviceGroupsList.ts @@ -30,6 +30,7 @@ import { Result } from "../types/fp.js"; */ export async function serviceGroupsList( client: ShippoCore, + _request: operations.ListServiceGroupsRequest, options?: RequestOptions, ): Promise< Result< @@ -43,9 +44,6 @@ export async function serviceGroupsList( | ConnectionError > > { - const input: operations.ListServiceGroupsRequest = {}; - void input; // request input is unused - const path = pathToFunc("/service-groups")(); const headers = new Headers({ @@ -59,16 +57,25 @@ export async function serviceGroupsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListServiceGroups", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, @@ -81,9 +88,8 @@ export async function serviceGroupsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/serviceGroupsUpdate.ts b/src/funcs/serviceGroupsUpdate.ts index 8d9a5f76..1ef420ca 100644 --- a/src/funcs/serviceGroupsUpdate.ts +++ b/src/funcs/serviceGroupsUpdate.ts @@ -43,10 +43,8 @@ export async function serviceGroupsUpdate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.ServiceGroupUpdateRequest$outboundSchema.optional().parse( value, @@ -75,16 +73,25 @@ export async function serviceGroupsUpdate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "UpdateServiceGroup", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "PUT", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -98,9 +105,8 @@ export async function serviceGroupsUpdate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/shipmentsCreate.ts b/src/funcs/shipmentsCreate.ts index fe72edf0..58555e62 100644 --- a/src/funcs/shipmentsCreate.ts +++ b/src/funcs/shipmentsCreate.ts @@ -43,10 +43,8 @@ export async function shipmentsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.ShipmentCreateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -70,16 +68,25 @@ export async function shipmentsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateShipment", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -93,9 +100,8 @@ export async function shipmentsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/shipmentsGet.ts b/src/funcs/shipmentsGet.ts index c8d9e42d..b9ec6533 100644 --- a/src/funcs/shipmentsGet.ts +++ b/src/funcs/shipmentsGet.ts @@ -79,16 +79,25 @@ export async function shipmentsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetShipment", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function shipmentsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/shipmentsList.ts b/src/funcs/shipmentsList.ts index 8263f370..eab747f3 100644 --- a/src/funcs/shipmentsList.ts +++ b/src/funcs/shipmentsList.ts @@ -61,10 +61,8 @@ export async function shipmentsList( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.ListShipmentsRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -97,16 +95,25 @@ export async function shipmentsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListShipments", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -121,9 +128,8 @@ export async function shipmentsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/shippoAccountsCreate.ts b/src/funcs/shippoAccountsCreate.ts index 138445f6..cade37b0 100644 --- a/src/funcs/shippoAccountsCreate.ts +++ b/src/funcs/shippoAccountsCreate.ts @@ -43,10 +43,8 @@ export async function shippoAccountsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.ShippoAccountUpdateRequest$outboundSchema.parse(value), "Input validation failed", @@ -71,16 +69,25 @@ export async function shippoAccountsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateShippoAccount", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -94,9 +101,8 @@ export async function shippoAccountsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/shippoAccountsGet.ts b/src/funcs/shippoAccountsGet.ts index b378bed9..479d4bf3 100644 --- a/src/funcs/shippoAccountsGet.ts +++ b/src/funcs/shippoAccountsGet.ts @@ -79,16 +79,25 @@ export async function shippoAccountsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetShippoAccount", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function shippoAccountsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/shippoAccountsList.ts b/src/funcs/shippoAccountsList.ts index 64e4100b..c782c93f 100644 --- a/src/funcs/shippoAccountsList.ts +++ b/src/funcs/shippoAccountsList.ts @@ -79,16 +79,25 @@ export async function shippoAccountsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListShippoAccounts", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -103,9 +112,8 @@ export async function shippoAccountsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/shippoAccountsUpdate.ts b/src/funcs/shippoAccountsUpdate.ts index 66eb2892..4f59c3ea 100644 --- a/src/funcs/shippoAccountsUpdate.ts +++ b/src/funcs/shippoAccountsUpdate.ts @@ -87,16 +87,25 @@ export async function shippoAccountsUpdate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "UpdateShippoAccount", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "PUT", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -110,9 +119,8 @@ export async function shippoAccountsUpdate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/trackingStatusCreate.ts b/src/funcs/trackingStatusCreate.ts index 6dc3cddb..63ad84fc 100644 --- a/src/funcs/trackingStatusCreate.ts +++ b/src/funcs/trackingStatusCreate.ts @@ -29,9 +29,7 @@ import { Result } from "../types/fp.js"; */ export async function trackingStatusCreate( client: ShippoCore, - carrier: string, - trackingNumber: string, - metadata?: string | undefined, + request: components.TracksRequest, options?: RequestOptions, ): Promise< Result< @@ -45,14 +43,8 @@ export async function trackingStatusCreate( | ConnectionError > > { - const input: components.TracksRequest = { - carrier: carrier, - metadata: metadata, - trackingNumber: trackingNumber, - }; - const parsed = safeParse( - input, + request, (value) => components.TracksRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -76,16 +68,25 @@ export async function trackingStatusCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateTrack", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -99,9 +100,8 @@ export async function trackingStatusCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/trackingStatusGet.ts b/src/funcs/trackingStatusGet.ts index 2802183a..7701e55c 100644 --- a/src/funcs/trackingStatusGet.ts +++ b/src/funcs/trackingStatusGet.ts @@ -85,16 +85,25 @@ export async function trackingStatusGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetTrack", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -108,9 +117,8 @@ export async function trackingStatusGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/transactionsCreate.ts b/src/funcs/transactionsCreate.ts index fbb32e0e..f4a1a7c8 100644 --- a/src/funcs/transactionsCreate.ts +++ b/src/funcs/transactionsCreate.ts @@ -44,10 +44,8 @@ export async function transactionsCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.CreateTransactionRequestBody$outboundSchema.parse(value), "Input validation failed", @@ -72,16 +70,25 @@ export async function transactionsCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateTransaction", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -95,9 +102,8 @@ export async function transactionsCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/transactionsGet.ts b/src/funcs/transactionsGet.ts index 76863fb8..1ee94187 100644 --- a/src/funcs/transactionsGet.ts +++ b/src/funcs/transactionsGet.ts @@ -79,16 +79,25 @@ export async function transactionsGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetTransaction", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function transactionsGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/transactionsList.ts b/src/funcs/transactionsList.ts index b6bf12be..ab1a3ef8 100644 --- a/src/funcs/transactionsList.ts +++ b/src/funcs/transactionsList.ts @@ -44,10 +44,8 @@ export async function transactionsList( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => operations.ListTransactionsRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -78,16 +76,25 @@ export async function transactionsList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListTransactions", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, query: query, @@ -102,9 +109,8 @@ export async function transactionsList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/userParcelTemplatesCreate.ts b/src/funcs/userParcelTemplatesCreate.ts index 5375c5f3..a09d699e 100644 --- a/src/funcs/userParcelTemplatesCreate.ts +++ b/src/funcs/userParcelTemplatesCreate.ts @@ -49,10 +49,8 @@ export async function userParcelTemplatesCreate( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.UserParcelTemplateCreateRequest$outboundSchema.parse(value), "Input validation failed", @@ -77,16 +75,25 @@ export async function userParcelTemplatesCreate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "CreateUserParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -100,9 +107,8 @@ export async function userParcelTemplatesCreate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/userParcelTemplatesDelete.ts b/src/funcs/userParcelTemplatesDelete.ts index 674b318a..7ffcc791 100644 --- a/src/funcs/userParcelTemplatesDelete.ts +++ b/src/funcs/userParcelTemplatesDelete.ts @@ -83,16 +83,25 @@ export async function userParcelTemplatesDelete( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "DeleteUserParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "DELETE", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -106,9 +115,8 @@ export async function userParcelTemplatesDelete( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/userParcelTemplatesGet.ts b/src/funcs/userParcelTemplatesGet.ts index 0569f355..8ffb8836 100644 --- a/src/funcs/userParcelTemplatesGet.ts +++ b/src/funcs/userParcelTemplatesGet.ts @@ -84,16 +84,25 @@ export async function userParcelTemplatesGet( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "GetUserParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -107,9 +116,8 @@ export async function userParcelTemplatesGet( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/userParcelTemplatesList.ts b/src/funcs/userParcelTemplatesList.ts index bb7389bb..2f03d864 100644 --- a/src/funcs/userParcelTemplatesList.ts +++ b/src/funcs/userParcelTemplatesList.ts @@ -29,6 +29,7 @@ import { Result } from "../types/fp.js"; */ export async function userParcelTemplatesList( client: ShippoCore, + _request: operations.ListUserParcelTemplatesRequest, options?: RequestOptions, ): Promise< Result< @@ -42,9 +43,6 @@ export async function userParcelTemplatesList( | ConnectionError > > { - const input: operations.ListUserParcelTemplatesRequest = {}; - void input; // request input is unused - const path = pathToFunc("/user-parcel-templates")(); const headers = new Headers({ @@ -58,16 +56,25 @@ export async function userParcelTemplatesList( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "ListUserParcelTemplates", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, @@ -80,9 +87,8 @@ export async function userParcelTemplatesList( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/userParcelTemplatesUpdate.ts b/src/funcs/userParcelTemplatesUpdate.ts index b8486bbd..fadb4378 100644 --- a/src/funcs/userParcelTemplatesUpdate.ts +++ b/src/funcs/userParcelTemplatesUpdate.ts @@ -90,16 +90,25 @@ export async function userParcelTemplatesUpdate( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "UpdateUserParcelTemplate", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "PUT", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -113,9 +122,8 @@ export async function userParcelTemplatesUpdate( const doResult = await client._do(req, { context, errorCodes: ["400", "4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/webhooksCreateWebhook.ts b/src/funcs/webhooksCreateWebhook.ts index 55534aa5..7239ff51 100644 --- a/src/funcs/webhooksCreateWebhook.ts +++ b/src/funcs/webhooksCreateWebhook.ts @@ -43,10 +43,8 @@ export async function webhooksCreateWebhook( | ConnectionError > > { - const input = request; - const parsed = safeParse( - input, + request, (value) => components.WebhookUpdateRequest$outboundSchema.parse(value), "Input validation failed", ); @@ -65,16 +63,25 @@ export async function webhooksCreateWebhook( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "createWebhook", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "POST", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -88,9 +95,8 @@ export async function webhooksCreateWebhook( const doResult = await client._do(req, { context, errorCodes: ["4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/webhooksDeleteWebhook.ts b/src/funcs/webhooksDeleteWebhook.ts index e8a1cd9b..e870f8b3 100644 --- a/src/funcs/webhooksDeleteWebhook.ts +++ b/src/funcs/webhooksDeleteWebhook.ts @@ -74,16 +74,25 @@ export async function webhooksDeleteWebhook( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "deleteWebhook", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "DELETE", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -97,9 +106,8 @@ export async function webhooksDeleteWebhook( const doResult = await client._do(req, { context, errorCodes: ["4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/webhooksGetWebhook.ts b/src/funcs/webhooksGetWebhook.ts index 8a010e38..ec8afcce 100644 --- a/src/funcs/webhooksGetWebhook.ts +++ b/src/funcs/webhooksGetWebhook.ts @@ -74,16 +74,25 @@ export async function webhooksGetWebhook( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "getWebhook", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -97,9 +106,8 @@ export async function webhooksGetWebhook( const doResult = await client._do(req, { context, errorCodes: ["4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/webhooksListWebhooks.ts b/src/funcs/webhooksListWebhooks.ts index a578cf22..721551ad 100644 --- a/src/funcs/webhooksListWebhooks.ts +++ b/src/funcs/webhooksListWebhooks.ts @@ -48,16 +48,25 @@ export async function webhooksListWebhooks( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "listWebhooks", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "GET", + baseURL: options?.serverURL, path: path, headers: headers, timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1, @@ -70,9 +79,8 @@ export async function webhooksListWebhooks( const doResult = await client._do(req, { context, errorCodes: ["4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/funcs/webhooksUpdateWebhook.ts b/src/funcs/webhooksUpdateWebhook.ts index d7ea2c6a..85b15ad3 100644 --- a/src/funcs/webhooksUpdateWebhook.ts +++ b/src/funcs/webhooksUpdateWebhook.ts @@ -30,8 +30,8 @@ import { Result } from "../types/fp.js"; */ export async function webhooksUpdateWebhook( client: ShippoCore, - webhookId: string, webhookUpdateRequest: components.WebhookUpdateRequest, + webhookId: string, options?: RequestOptions, ): Promise< Result< @@ -46,8 +46,8 @@ export async function webhooksUpdateWebhook( > > { const input: operations.UpdateWebhookRequest = { - webhookId: webhookId, webhookUpdateRequest: webhookUpdateRequest, + webhookId: webhookId, }; const parsed = safeParse( @@ -79,16 +79,25 @@ export async function webhooksUpdateWebhook( const secConfig = await extractSecurity(client._options.apiKeyHeader); const securityInput = secConfig == null ? {} : { apiKeyHeader: secConfig }; + const requestSecurity = resolveGlobalSecurity(securityInput); + const context = { operationID: "updateWebhook", oAuth2Scopes: [], + + resolvedSecurity: requestSecurity, + securitySource: client._options.apiKeyHeader, + retryConfig: options?.retries + || client._options.retryConfig + || { strategy: "none" }, + retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], }; - const requestSecurity = resolveGlobalSecurity(securityInput); const requestRes = client._createRequest(context, { security: requestSecurity, method: "PUT", + baseURL: options?.serverURL, path: path, headers: headers, body: body, @@ -102,9 +111,8 @@ export async function webhooksUpdateWebhook( const doResult = await client._do(req, { context, errorCodes: ["4XX", "5XX"], - retryConfig: options?.retries - || client._options.retryConfig, - retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"], + retryConfig: context.retryConfig, + retryCodes: context.retryCodes, }); if (!doResult.ok) { return doResult; diff --git a/src/hooks/hooks.ts b/src/hooks/hooks.ts index d1b3396f..d34c8849 100644 --- a/src/hooks/hooks.ts +++ b/src/hooks/hooks.ts @@ -12,6 +12,7 @@ import { BeforeCreateRequestHook, BeforeRequestContext, BeforeRequestHook, + Hook, Hooks, SDKInitHook, SDKInitOptions, @@ -27,6 +28,25 @@ export class SDKHooks implements Hooks { afterErrorHooks: AfterErrorHook[] = []; constructor() { + const presetHooks: Array = []; + + for (const hook of presetHooks) { + if ("sdkInit" in hook) { + this.registerSDKInitHook(hook); + } + if ("beforeCreateRequest" in hook) { + this.registerBeforeCreateRequestHook(hook); + } + if ("beforeRequest" in hook) { + this.registerBeforeRequestHook(hook); + } + if ("afterSuccess" in hook) { + this.registerAfterSuccessHook(hook); + } + if ("afterError" in hook) { + this.registerAfterErrorHook(hook); + } + } initHooks(this); } diff --git a/src/hooks/types.ts b/src/hooks/types.ts index 656b9e37..9908a063 100644 --- a/src/hooks/types.ts +++ b/src/hooks/types.ts @@ -3,11 +3,17 @@ */ import { HTTPClient, RequestInput } from "../lib/http.js"; +import { RetryConfig } from "../lib/retries.js"; +import { SecurityState } from "../lib/security.js"; +import { WebhookRecipient } from "../types/webhooks.js"; export type HookContext = { operationID: string; oAuth2Scopes?: string[]; + webhookRecipient?: WebhookRecipient; securitySource?: any | (() => Promise); + retryConfig: RetryConfig; + resolvedSecurity: SecurityState | null; }; export type Awaitable = T | Promise; @@ -96,3 +102,10 @@ export interface Hooks { /** Registers a hook to be used by the SDK for the after error event. */ registerAfterErrorHook(hook: AfterErrorHook): void; } + +export type Hook = + | SDKInitHook + | BeforeCreateRequestHook + | BeforeRequestHook + | AfterSuccessHook + | AfterErrorHook; diff --git a/src/lib/config.ts b/src/lib/config.ts index 8a72cb78..a7c28867 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -59,7 +59,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null { export const SDK_METADATA = { language: "typescript", openapiDocVersion: "2018-02-08", - sdkVersion: "2.14.1", - genVersion: "2.421.3", - userAgent: "speakeasy-sdk/typescript 2.14.1 2.421.3 2018-02-08 shippo", + sdkVersion: "2.15.0", + genVersion: "2.493.4", + userAgent: "speakeasy-sdk/typescript 2.15.0 2.493.4 2018-02-08 shippo", } as const; diff --git a/src/lib/matchers.ts b/src/lib/matchers.ts index 55a9e14b..19b46b33 100644 --- a/src/lib/matchers.ts +++ b/src/lib/matchers.ts @@ -205,7 +205,7 @@ export function match( raw = await response.json(); break; case "bytes": - raw = await response.arrayBuffer(); + raw = new Uint8Array(await response.arrayBuffer()); break; case "stream": raw = response.body; diff --git a/src/lib/primitives.ts b/src/lib/primitives.ts index 23794a2b..1dc4ee43 100644 --- a/src/lib/primitives.ts +++ b/src/lib/primitives.ts @@ -2,6 +2,26 @@ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ +class InvariantError extends Error { + constructor(message: string) { + super(message); + this.name = "InvariantError"; + } +} + +export function invariant( + condition: unknown, + message: string, +): asserts condition { + if (!condition) { + throw new InvariantError(message); + } +} + +export type ExactPartial = { + [P in keyof T]?: T[P] | undefined; +}; + export type Remap = { [k in keyof Inp as Mapping[k] extends string /* if we have a string mapping for this key then use it */ ? Mapping[k] @@ -38,3 +58,65 @@ export function remap< return out; } + +export function combineSignals( + ...signals: Array +): AbortSignal | null { + const filtered: AbortSignal[] = []; + for (const signal of signals) { + if (signal) { + filtered.push(signal); + } + } + + switch (filtered.length) { + case 0: + case 1: + return filtered[0] || null; + default: + if ("any" in AbortSignal && typeof AbortSignal.any === "function") { + return AbortSignal.any(filtered); + } + return abortSignalAny(filtered); + } +} + +export function abortSignalAny(signals: AbortSignal[]): AbortSignal { + const controller = new AbortController(); + const result = controller.signal; + if (!signals.length) { + return controller.signal; + } + + if (signals.length === 1) { + return signals[0] || controller.signal; + } + + for (const signal of signals) { + if (signal.aborted) { + return signal; + } + } + + function abort(this: AbortSignal) { + controller.abort(this.reason); + clean(); + } + + const signalRefs: WeakRef[] = []; + function clean() { + for (const signalRef of signalRefs) { + const signal = signalRef.deref(); + if (signal) { + signal.removeEventListener("abort", abort); + } + } + } + + for (const signal of signals) { + signalRefs.push(new WeakRef(signal)); + signal.addEventListener("abort", abort); + } + + return result; +} diff --git a/src/lib/retries.ts b/src/lib/retries.ts index df3e0bc2..93ebc8de 100644 --- a/src/lib/retries.ts +++ b/src/lib/retries.ts @@ -26,23 +26,44 @@ export type RetryConfig = retryConnectionErrors?: boolean; }; -class PermanentError extends Error { - inner: unknown; +/** + * PermanentError is an error that is not recoverable. Throwing this error will + * cause a retry loop to terminate. + */ +export class PermanentError extends Error { + /** The underlying cause of the error. */ + override readonly cause: unknown; + + constructor(message: string, options?: { cause?: unknown }) { + let msg = message; + if (options?.cause) { + msg += `: ${options.cause}`; + } - constructor(inner: unknown) { - super("Permanent error"); - this.inner = inner; + super(msg, options); + this.name = "PermanentError"; + // In older runtimes, the cause field would not have been assigned through + // the super() call. + if (typeof this.cause === "undefined") { + this.cause = options?.cause; + } Object.setPrototypeOf(this, PermanentError.prototype); } } -class TemporaryError extends Error { - res: Response; +/** + * TemporaryError is an error is used to signal that an HTTP request can be + * retried as part of a retry loop. If retry attempts are exhausted and this + * error is thrown, the response will be returned to the caller. + */ +export class TemporaryError extends Error { + response: Response; - constructor(res: Response) { - super("Temporary error"); - this.res = res; + constructor(message: string, response: Response) { + super(message); + this.response = response; + this.name = "TemporaryError"; Object.setPrototypeOf(this, TemporaryError.prototype); } @@ -80,11 +101,14 @@ function wrapFetcher( try { const res = await fn(); if (isRetryableResponse(res, options.statusCodes)) { - throw new TemporaryError(res); + throw new TemporaryError( + "Response failed with retryable status code", + res, + ); } return res; - } catch (err) { + } catch (err: unknown) { if (err instanceof TemporaryError) { throw err; } @@ -96,7 +120,7 @@ function wrapFetcher( throw err; } - throw new PermanentError(err); + throw new PermanentError("Permanent error", { cause: err }); } }; } @@ -139,37 +163,25 @@ async function retryBackoff( try { const res = await fn(); return res; - } catch (err) { + } catch (err: unknown) { if (err instanceof PermanentError) { - throw err.inner; + throw err.cause; } const elapsed = Date.now() - start; if (elapsed > maxElapsedTime) { if (err instanceof TemporaryError) { - return err.res; + return err.response; } throw err; } let retryInterval = 0; - if (err instanceof TemporaryError && err.res && err.res.headers) { - const retryVal = err.res.headers.get("retry-after") || ""; - if (retryVal != "") { - const parsedNumber = Number(retryVal); - if (!isNaN(parsedNumber) && Number.isInteger(parsedNumber)) { - retryInterval = parsedNumber * 1000; - } else { - const parsedDate = Date.parse(retryVal); - if (!isNaN(parsedDate)) { - const deltaMS = parsedDate - Date.now(); - retryInterval = deltaMS > 0 ? Math.ceil(deltaMS) : 0; - } - } - } + if (err instanceof TemporaryError) { + retryInterval = retryIntervalFromResponse(err.response); } - if (retryInterval == 0) { + if (retryInterval <= 0) { retryInterval = initialInterval * Math.pow(x, exponent) + Math.random() * 1000; } @@ -182,6 +194,26 @@ async function retryBackoff( } } +function retryIntervalFromResponse(res: Response): number { + const retryVal = res.headers.get("retry-after") || ""; + if (!retryVal) { + return 0; + } + + const parsedNumber = Number(retryVal); + if (Number.isInteger(parsedNumber)) { + return parsedNumber * 1000; + } + + const parsedDate = Date.parse(retryVal); + if (Number.isInteger(parsedDate)) { + const deltaMS = parsedDate - Date.now(); + return deltaMS > 0 ? Math.ceil(deltaMS) : 0; + } + + return 0; +} + async function delay(delay: number): Promise { return new Promise((resolve) => setTimeout(resolve, delay)); } diff --git a/src/lib/sdks.ts b/src/lib/sdks.ts index a0f4de16..334bc3d6 100644 --- a/src/lib/sdks.ts +++ b/src/lib/sdks.ts @@ -41,6 +41,10 @@ export type RequestOptions = { * Specifies the status codes which should be retried using the given retry policy. */ retryCodes?: string[]; + /** + * Overrides the base server URL that will be used by an operation. + */ + serverURL?: string | URL; /** * Sets various request options on the `fetch` call made by an SDK method. * @@ -52,7 +56,7 @@ export type RequestOptions = { type RequestConfig = { method: string; path: string; - baseURL?: string | URL; + baseURL?: string | URL | undefined; query?: string; body?: RequestInit["body"]; headers?: HeadersInit; @@ -119,6 +123,7 @@ export class ClientSDK { const inputURL = new URL(path, reqURL); if (path) { + reqURL.pathname += reqURL.pathname.endsWith("/") ? "" : "/"; reqURL.pathname += inputURL.pathname.replace(/^\/+/, ""); } @@ -220,8 +225,8 @@ export class ClientSDK { options: { context: HookContext; errorCodes: number | string | (number | string)[]; - retryConfig?: RetryConfig | undefined; - retryCodes?: string[] | undefined; + retryConfig: RetryConfig; + retryCodes: string[]; }, ): Promise< Result< @@ -233,8 +238,6 @@ export class ClientSDK { > > { const { context, errorCodes } = options; - const retryConfig = options.retryConfig || { strategy: "none" }; - const retryCodes = options.retryCodes || []; return retry( async () => { @@ -245,22 +248,28 @@ export class ClientSDK { let response = await this.#httpClient.request(req); - if (matchStatusCode(response, errorCodes)) { - const result = await this.#hooks.afterError(context, response, null); - if (result.error) { - throw result.error; + try { + if (matchStatusCode(response, errorCodes)) { + const result = await this.#hooks.afterError( + context, + response, + null, + ); + if (result.error) { + throw result.error; + } + response = result.response || response; + } else { + response = await this.#hooks.afterSuccess(context, response); } - response = result.response || response; - } else { - response = await this.#hooks.afterSuccess(context, response); + } finally { + await logResponse(this.#logger, response, req) + .catch(e => this.#logger?.log("Failed to log response:", e)); } - await logResponse(this.#logger, response, req) - .catch(e => this.#logger?.log("Failed to log response:", e)); - return response; }, - { config: retryConfig, statusCodes: retryCodes }, + { config: options.retryConfig, statusCodes: options.retryCodes }, ).then( (r) => OK(r), (err) => { diff --git a/src/lib/security.ts b/src/lib/security.ts index 64dd7c94..ad6abd89 100644 --- a/src/lib/security.ts +++ b/src/lib/security.ts @@ -4,6 +4,14 @@ import * as components from "../models/components/index.js"; +type OAuth2PasswordFlow = { + username: string; + password?: string | undefined; + clientID: string; + clientSecret?: string | undefined; + tokenURL: string; +}; + export enum SecurityErrorCode { Incomplete = "incomplete", UnrecognisedSecurityType = "unrecognized_security_type", @@ -37,6 +45,7 @@ export type SecurityState = { headers: Record; queryParams: Record; cookies: Record; + oauth2: ({ type: "password" } & OAuth2PasswordFlow) | { type: "none" }; }; type SecurityInputBasic = { @@ -73,7 +82,18 @@ type SecurityInputOAuth2 = { type SecurityInputOAuth2ClientCredentials = { type: "oauth2:client_credentials"; - value: string | null | undefined; + value: + | { clientID?: string | undefined; clientSecret?: string | undefined } + | null + | undefined; +}; + +type SecurityInputOAuth2PasswordCredentials = { + type: "oauth2:password"; + value: + | string + | null + | undefined; fieldName: string; }; @@ -89,6 +109,7 @@ export type SecurityInput = | SecurityInputAPIKey | SecurityInputOAuth2 | SecurityInputOAuth2ClientCredentials + | SecurityInputOAuth2PasswordCredentials | SecurityInputOIDC | SecurityInputCustom; @@ -96,10 +117,11 @@ export function resolveSecurity( ...options: SecurityInput[][] ): SecurityState | null { const state: SecurityState = { - basic: { username: "", password: "" }, + basic: {}, headers: {}, queryParams: {}, cookies: {}, + oauth2: { type: "none" }, }; const option = options.find((opts) => { @@ -110,6 +132,12 @@ export function resolveSecurity( return o.value.username != null || o.value.password != null; } else if (o.type === "http:custom") { return null; + } else if (o.type === "oauth2:password") { + return ( + typeof o.value === "string" && !!o.value + ); + } else if (o.type === "oauth2:client_credentials") { + return o.value.clientID != null || o.value.clientSecret != null; } else if (typeof o.value === "string") { return !!o.value; } else { @@ -152,6 +180,9 @@ export function resolveSecurity( case "oauth2": applyBearer(state, spec); break; + case "oauth2:password": + applyBearer(state, spec); + break; case "oauth2:client_credentials": break; case "openIdConnect": @@ -179,9 +210,13 @@ function applyBasic( function applyBearer( state: SecurityState, - spec: SecurityInputBearer | SecurityInputOAuth2 | SecurityInputOIDC, + spec: + | SecurityInputBearer + | SecurityInputOAuth2 + | SecurityInputOIDC + | SecurityInputOAuth2PasswordCredentials, ) { - if (spec.value == null) { + if (typeof spec.value !== "string" || !spec.value) { return; } @@ -192,6 +227,7 @@ function applyBearer( state.headers[spec.fieldName] = value; } + export function resolveGlobalSecurity( security: Partial | null | undefined, ): SecurityState | null { diff --git a/src/models/components/address.ts b/src/models/components/address.ts index c8913a3d..8a9901e2 100644 --- a/src/models/components/address.ts +++ b/src/models/components/address.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressValidationResults, AddressValidationResults$inboundSchema, @@ -191,6 +194,20 @@ export namespace Latitude$ { export type Outbound = Latitude$Outbound; } +export function latitudeToJSON(latitude: Latitude): string { + return JSON.stringify(Latitude$outboundSchema.parse(latitude)); +} + +export function latitudeFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Latitude$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Latitude' from JSON`, + ); +} + /** @internal */ export const Longitude$inboundSchema: z.ZodType< Longitude, @@ -221,6 +238,20 @@ export namespace Longitude$ { export type Outbound = Longitude$Outbound; } +export function longitudeToJSON(longitude: Longitude): string { + return JSON.stringify(Longitude$outboundSchema.parse(longitude)); +} + +export function longitudeFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Longitude$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Longitude' from JSON`, + ); +} + /** @internal */ export const Address$inboundSchema: z.ZodType = z.object({ @@ -345,3 +376,17 @@ export namespace Address$ { /** @deprecated use `Address$Outbound` instead. */ export type Outbound = Address$Outbound; } + +export function addressToJSON(address: Address): string { + return JSON.stringify(Address$outboundSchema.parse(address)); +} + +export function addressFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Address$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Address' from JSON`, + ); +} diff --git a/src/models/components/addresscompletecreaterequest.ts b/src/models/components/addresscompletecreaterequest.ts index 26e2917e..0eec5a8b 100644 --- a/src/models/components/addresscompletecreaterequest.ts +++ b/src/models/components/addresscompletecreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Address represents the address as retrieved from the database @@ -189,3 +192,23 @@ export namespace AddressCompleteCreateRequest$ { /** @deprecated use `AddressCompleteCreateRequest$Outbound` instead. */ export type Outbound = AddressCompleteCreateRequest$Outbound; } + +export function addressCompleteCreateRequestToJSON( + addressCompleteCreateRequest: AddressCompleteCreateRequest, +): string { + return JSON.stringify( + AddressCompleteCreateRequest$outboundSchema.parse( + addressCompleteCreateRequest, + ), + ); +} + +export function addressCompleteCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressCompleteCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressCompleteCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/addresscreaterequest.ts b/src/models/components/addresscreaterequest.ts index e680d9b1..fbcfbc68 100644 --- a/src/models/components/addresscreaterequest.ts +++ b/src/models/components/addresscreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Address represents the address as retrieved from the database @@ -192,3 +195,21 @@ export namespace AddressCreateRequest$ { /** @deprecated use `AddressCreateRequest$Outbound` instead. */ export type Outbound = AddressCreateRequest$Outbound; } + +export function addressCreateRequestToJSON( + addressCreateRequest: AddressCreateRequest, +): string { + return JSON.stringify( + AddressCreateRequest$outboundSchema.parse(addressCreateRequest), + ); +} + +export function addressCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/addressimporter.ts b/src/models/components/addressimporter.ts index 40d40994..5656efc1 100644 --- a/src/models/components/addressimporter.ts +++ b/src/models/components/addressimporter.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Object that represents the address of the importer @@ -162,3 +165,19 @@ export namespace AddressImporter$ { /** @deprecated use `AddressImporter$Outbound` instead. */ export type Outbound = AddressImporter$Outbound; } + +export function addressImporterToJSON( + addressImporter: AddressImporter, +): string { + return JSON.stringify(AddressImporter$outboundSchema.parse(addressImporter)); +} + +export function addressImporterFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressImporter$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressImporter' from JSON`, + ); +} diff --git a/src/models/components/addresspaginatedlist.ts b/src/models/components/addresspaginatedlist.ts index bdc1bcff..3957fce7 100644 --- a/src/models/components/addresspaginatedlist.ts +++ b/src/models/components/addresspaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, @@ -57,3 +60,21 @@ export namespace AddressPaginatedList$ { /** @deprecated use `AddressPaginatedList$Outbound` instead. */ export type Outbound = AddressPaginatedList$Outbound; } + +export function addressPaginatedListToJSON( + addressPaginatedList: AddressPaginatedList, +): string { + return JSON.stringify( + AddressPaginatedList$outboundSchema.parse(addressPaginatedList), + ); +} + +export function addressPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/addressvalidationresults.ts b/src/models/components/addressvalidationresults.ts index f62f6e64..c0d8ca5f 100644 --- a/src/models/components/addressvalidationresults.ts +++ b/src/models/components/addressvalidationresults.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressValidationResultsMessage, AddressValidationResultsMessage$inboundSchema, @@ -68,3 +71,21 @@ export namespace AddressValidationResults$ { /** @deprecated use `AddressValidationResults$Outbound` instead. */ export type Outbound = AddressValidationResults$Outbound; } + +export function addressValidationResultsToJSON( + addressValidationResults: AddressValidationResults, +): string { + return JSON.stringify( + AddressValidationResults$outboundSchema.parse(addressValidationResults), + ); +} + +export function addressValidationResultsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressValidationResults$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressValidationResults' from JSON`, + ); +} diff --git a/src/models/components/addressvalidationresultsmessage.ts b/src/models/components/addressvalidationresultsmessage.ts index e3a026c9..cdcc1fbb 100644 --- a/src/models/components/addressvalidationresultsmessage.ts +++ b/src/models/components/addressvalidationresultsmessage.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AddressValidationResultsMessage = { /** @@ -61,3 +64,23 @@ export namespace AddressValidationResultsMessage$ { /** @deprecated use `AddressValidationResultsMessage$Outbound` instead. */ export type Outbound = AddressValidationResultsMessage$Outbound; } + +export function addressValidationResultsMessageToJSON( + addressValidationResultsMessage: AddressValidationResultsMessage, +): string { + return JSON.stringify( + AddressValidationResultsMessage$outboundSchema.parse( + addressValidationResultsMessage, + ), + ); +} + +export function addressValidationResultsMessageFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressValidationResultsMessage$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressValidationResultsMessage' from JSON`, + ); +} diff --git a/src/models/components/alcohol.ts b/src/models/components/alcohol.ts index de819841..c09bc07a 100644 --- a/src/models/components/alcohol.ts +++ b/src/models/components/alcohol.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Mandatory for Fedex only. License type of the recipient of the Alcohol Package. @@ -98,3 +101,17 @@ export namespace Alcohol$ { /** @deprecated use `Alcohol$Outbound` instead. */ export type Outbound = Alcohol$Outbound; } + +export function alcoholToJSON(alcohol: Alcohol): string { + return JSON.stringify(Alcohol$outboundSchema.parse(alcohol)); +} + +export function alcoholFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Alcohol$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Alcohol' from JSON`, + ); +} diff --git a/src/models/components/batch.ts b/src/models/components/batch.ts index 73d44b96..9f3cc466 100644 --- a/src/models/components/batch.ts +++ b/src/models/components/batch.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BatchShipmentPaginatedList, BatchShipmentPaginatedList$inboundSchema, @@ -179,6 +182,20 @@ export namespace ObjectResults$ { export type Outbound = ObjectResults$Outbound; } +export function objectResultsToJSON(objectResults: ObjectResults): string { + return JSON.stringify(ObjectResults$outboundSchema.parse(objectResults)); +} + +export function objectResultsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ObjectResults$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ObjectResults' from JSON`, + ); +} + /** @internal */ export const BatchStatus$inboundSchema: z.ZodNativeEnum = z .nativeEnum(BatchStatus); @@ -292,3 +309,17 @@ export namespace Batch$ { /** @deprecated use `Batch$Outbound` instead. */ export type Outbound = Batch$Outbound; } + +export function batchToJSON(batch: Batch): string { + return JSON.stringify(Batch$outboundSchema.parse(batch)); +} + +export function batchFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Batch$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Batch' from JSON`, + ); +} diff --git a/src/models/components/batchcreaterequest.ts b/src/models/components/batchcreaterequest.ts index 8be1270e..ae84c2d6 100644 --- a/src/models/components/batchcreaterequest.ts +++ b/src/models/components/batchcreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BatchShipmentCreateRequest, BatchShipmentCreateRequest$inboundSchema, @@ -111,3 +114,21 @@ export namespace BatchCreateRequest$ { /** @deprecated use `BatchCreateRequest$Outbound` instead. */ export type Outbound = BatchCreateRequest$Outbound; } + +export function batchCreateRequestToJSON( + batchCreateRequest: BatchCreateRequest, +): string { + return JSON.stringify( + BatchCreateRequest$outboundSchema.parse(batchCreateRequest), + ); +} + +export function batchCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => BatchCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'BatchCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/batchshipment.ts b/src/models/components/batchshipment.ts index 5f5c96db..4ae97d66 100644 --- a/src/models/components/batchshipment.ts +++ b/src/models/components/batchshipment.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * `INVALID` batch shipments cannot be purchased and will have to be removed, fixed, and added to the batch again.
@@ -164,3 +167,17 @@ export namespace BatchShipment$ { /** @deprecated use `BatchShipment$Outbound` instead. */ export type Outbound = BatchShipment$Outbound; } + +export function batchShipmentToJSON(batchShipment: BatchShipment): string { + return JSON.stringify(BatchShipment$outboundSchema.parse(batchShipment)); +} + +export function batchShipmentFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => BatchShipment$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'BatchShipment' from JSON`, + ); +} diff --git a/src/models/components/batchshipmentcreaterequest.ts b/src/models/components/batchshipmentcreaterequest.ts index e39a5d73..5994e27d 100644 --- a/src/models/components/batchshipmentcreaterequest.ts +++ b/src/models/components/batchshipmentcreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ShipmentCreateRequest, ShipmentCreateRequest$inboundSchema, @@ -88,3 +91,21 @@ export namespace BatchShipmentCreateRequest$ { /** @deprecated use `BatchShipmentCreateRequest$Outbound` instead. */ export type Outbound = BatchShipmentCreateRequest$Outbound; } + +export function batchShipmentCreateRequestToJSON( + batchShipmentCreateRequest: BatchShipmentCreateRequest, +): string { + return JSON.stringify( + BatchShipmentCreateRequest$outboundSchema.parse(batchShipmentCreateRequest), + ); +} + +export function batchShipmentCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => BatchShipmentCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'BatchShipmentCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/batchshipmentpaginatedlist.ts b/src/models/components/batchshipmentpaginatedlist.ts index 126e9ec1..b9d19a24 100644 --- a/src/models/components/batchshipmentpaginatedlist.ts +++ b/src/models/components/batchshipmentpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BatchShipment, BatchShipment$inboundSchema, @@ -63,3 +66,21 @@ export namespace BatchShipmentPaginatedList$ { /** @deprecated use `BatchShipmentPaginatedList$Outbound` instead. */ export type Outbound = BatchShipmentPaginatedList$Outbound; } + +export function batchShipmentPaginatedListToJSON( + batchShipmentPaginatedList: BatchShipmentPaginatedList, +): string { + return JSON.stringify( + BatchShipmentPaginatedList$outboundSchema.parse(batchShipmentPaginatedList), + ); +} + +export function batchShipmentPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => BatchShipmentPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'BatchShipmentPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/billing.ts b/src/models/components/billing.ts index 58ab5ffa..4ae27bbb 100644 --- a/src/models/components/billing.ts +++ b/src/models/components/billing.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Party to be billed. (Leave blank for DHL Germany.) @@ -119,3 +122,17 @@ export namespace Billing$ { /** @deprecated use `Billing$Outbound` instead. */ export type Outbound = Billing$Outbound; } + +export function billingToJSON(billing: Billing): string { + return JSON.stringify(Billing$outboundSchema.parse(billing)); +} + +export function billingFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Billing$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Billing' from JSON`, + ); +} diff --git a/src/models/components/carrieraccount.ts b/src/models/components/carrieraccount.ts index 88f4d3c1..873b67ce 100644 --- a/src/models/components/carrieraccount.ts +++ b/src/models/components/carrieraccount.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierAccountServiceLevel, CarrierAccountServiceLevel$inboundSchema, @@ -118,6 +121,24 @@ export namespace CarrierAccountParameters$ { export type Outbound = CarrierAccountParameters$Outbound; } +export function carrierAccountParametersToJSON( + carrierAccountParameters: CarrierAccountParameters, +): string { + return JSON.stringify( + CarrierAccountParameters$outboundSchema.parse(carrierAccountParameters), + ); +} + +export function carrierAccountParametersFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountParameters$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccount$inboundSchema: z.ZodType< CarrierAccount, @@ -213,3 +234,17 @@ export namespace CarrierAccount$ { /** @deprecated use `CarrierAccount$Outbound` instead. */ export type Outbound = CarrierAccount$Outbound; } + +export function carrierAccountToJSON(carrierAccount: CarrierAccount): string { + return JSON.stringify(CarrierAccount$outboundSchema.parse(carrierAccount)); +} + +export function carrierAccountFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccount$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccount' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountbase.ts b/src/models/components/carrieraccountbase.ts index 083d223b..2c86096f 100644 --- a/src/models/components/carrieraccountbase.ts +++ b/src/models/components/carrieraccountbase.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { FedExConnectExistingOwnAccountParameters, FedExConnectExistingOwnAccountParameters$inboundSchema, @@ -93,6 +96,26 @@ export namespace CarrierAccountBaseParameters$ { export type Outbound = CarrierAccountBaseParameters$Outbound; } +export function carrierAccountBaseParametersToJSON( + carrierAccountBaseParameters: CarrierAccountBaseParameters, +): string { + return JSON.stringify( + CarrierAccountBaseParameters$outboundSchema.parse( + carrierAccountBaseParameters, + ), + ); +} + +export function carrierAccountBaseParametersFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountBaseParameters$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountBaseParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountBase$inboundSchema: z.ZodType< CarrierAccountBase, @@ -157,3 +180,21 @@ export namespace CarrierAccountBase$ { /** @deprecated use `CarrierAccountBase$Outbound` instead. */ export type Outbound = CarrierAccountBase$Outbound; } + +export function carrierAccountBaseToJSON( + carrierAccountBase: CarrierAccountBase, +): string { + return JSON.stringify( + CarrierAccountBase$outboundSchema.parse(carrierAccountBase), + ); +} + +export function carrierAccountBaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountBase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountBase' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountcanadapostcreateparameters.ts b/src/models/components/carrieraccountcanadapostcreateparameters.ts index 898862ef..febb0e19 100644 --- a/src/models/components/carrieraccountcanadapostcreateparameters.ts +++ b/src/models/components/carrieraccountcanadapostcreateparameters.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountCanadaPostCreateParameters = { /** @@ -78,3 +81,30 @@ export namespace CarrierAccountCanadaPostCreateParameters$ { /** @deprecated use `CarrierAccountCanadaPostCreateParameters$Outbound` instead. */ export type Outbound = CarrierAccountCanadaPostCreateParameters$Outbound; } + +export function carrierAccountCanadaPostCreateParametersToJSON( + carrierAccountCanadaPostCreateParameters: + CarrierAccountCanadaPostCreateParameters, +): string { + return JSON.stringify( + CarrierAccountCanadaPostCreateParameters$outboundSchema.parse( + carrierAccountCanadaPostCreateParameters, + ), + ); +} + +export function carrierAccountCanadaPostCreateParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountCanadaPostCreateParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountCanadaPostCreateParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountCanadaPostCreateParameters' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountcanadapostcreaterequest.ts b/src/models/components/carrieraccountcanadapostcreaterequest.ts index cbebf29c..213046f0 100644 --- a/src/models/components/carrieraccountcanadapostcreaterequest.ts +++ b/src/models/components/carrieraccountcanadapostcreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierAccountCanadaPostCreateParameters, CarrierAccountCanadaPostCreateParameters$inboundSchema, @@ -55,3 +58,24 @@ export namespace CarrierAccountCanadaPostCreateRequest$ { /** @deprecated use `CarrierAccountCanadaPostCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountCanadaPostCreateRequest$Outbound; } + +export function carrierAccountCanadaPostCreateRequestToJSON( + carrierAccountCanadaPostCreateRequest: CarrierAccountCanadaPostCreateRequest, +): string { + return JSON.stringify( + CarrierAccountCanadaPostCreateRequest$outboundSchema.parse( + carrierAccountCanadaPostCreateRequest, + ), + ); +} + +export function carrierAccountCanadaPostCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + CarrierAccountCanadaPostCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountCanadaPostCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountchronopostcreaterequest.ts b/src/models/components/carrieraccountchronopostcreaterequest.ts index 5b8fb993..f7a6f472 100644 --- a/src/models/components/carrieraccountchronopostcreaterequest.ts +++ b/src/models/components/carrieraccountchronopostcreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountChronopostCreateRequestParameters = {}; @@ -46,6 +49,33 @@ export namespace CarrierAccountChronopostCreateRequestParameters$ { CarrierAccountChronopostCreateRequestParameters$Outbound; } +export function carrierAccountChronopostCreateRequestParametersToJSON( + carrierAccountChronopostCreateRequestParameters: + CarrierAccountChronopostCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountChronopostCreateRequestParameters$outboundSchema.parse( + carrierAccountChronopostCreateRequestParameters, + ), + ); +} + +export function carrierAccountChronopostCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountChronopostCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountChronopostCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountChronopostCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountChronopostCreateRequest$inboundSchema: z.ZodType< CarrierAccountChronopostCreateRequest, @@ -90,3 +120,24 @@ export namespace CarrierAccountChronopostCreateRequest$ { /** @deprecated use `CarrierAccountChronopostCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountChronopostCreateRequest$Outbound; } + +export function carrierAccountChronopostCreateRequestToJSON( + carrierAccountChronopostCreateRequest: CarrierAccountChronopostCreateRequest, +): string { + return JSON.stringify( + CarrierAccountChronopostCreateRequest$outboundSchema.parse( + carrierAccountChronopostCreateRequest, + ), + ); +} + +export function carrierAccountChronopostCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + CarrierAccountChronopostCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountChronopostCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountcolissimocreaterequest.ts b/src/models/components/carrieraccountcolissimocreaterequest.ts index 6f1b3e7b..67572085 100644 --- a/src/models/components/carrieraccountcolissimocreaterequest.ts +++ b/src/models/components/carrieraccountcolissimocreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountColissimoCreateRequestParameters = {}; @@ -46,6 +49,33 @@ export namespace CarrierAccountColissimoCreateRequestParameters$ { CarrierAccountColissimoCreateRequestParameters$Outbound; } +export function carrierAccountColissimoCreateRequestParametersToJSON( + carrierAccountColissimoCreateRequestParameters: + CarrierAccountColissimoCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountColissimoCreateRequestParameters$outboundSchema.parse( + carrierAccountColissimoCreateRequestParameters, + ), + ); +} + +export function carrierAccountColissimoCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountColissimoCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountColissimoCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountColissimoCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountColissimoCreateRequest$inboundSchema: z.ZodType< CarrierAccountColissimoCreateRequest, @@ -90,3 +120,24 @@ export namespace CarrierAccountColissimoCreateRequest$ { /** @deprecated use `CarrierAccountColissimoCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountColissimoCreateRequest$Outbound; } + +export function carrierAccountColissimoCreateRequestToJSON( + carrierAccountColissimoCreateRequest: CarrierAccountColissimoCreateRequest, +): string { + return JSON.stringify( + CarrierAccountColissimoCreateRequest$outboundSchema.parse( + carrierAccountColissimoCreateRequest, + ), + ); +} + +export function carrierAccountColissimoCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + CarrierAccountColissimoCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountColissimoCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountcorreoscreaterequest.ts b/src/models/components/carrieraccountcorreoscreaterequest.ts index c55402d0..19afb83b 100644 --- a/src/models/components/carrieraccountcorreoscreaterequest.ts +++ b/src/models/components/carrieraccountcorreoscreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountCorreosCreateRequestParameters = {}; @@ -45,6 +48,33 @@ export namespace CarrierAccountCorreosCreateRequestParameters$ { export type Outbound = CarrierAccountCorreosCreateRequestParameters$Outbound; } +export function carrierAccountCorreosCreateRequestParametersToJSON( + carrierAccountCorreosCreateRequestParameters: + CarrierAccountCorreosCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountCorreosCreateRequestParameters$outboundSchema.parse( + carrierAccountCorreosCreateRequestParameters, + ), + ); +} + +export function carrierAccountCorreosCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountCorreosCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountCorreosCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountCorreosCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountCorreosCreateRequest$inboundSchema: z.ZodType< CarrierAccountCorreosCreateRequest, @@ -88,3 +118,24 @@ export namespace CarrierAccountCorreosCreateRequest$ { /** @deprecated use `CarrierAccountCorreosCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountCorreosCreateRequest$Outbound; } + +export function carrierAccountCorreosCreateRequestToJSON( + carrierAccountCorreosCreateRequest: CarrierAccountCorreosCreateRequest, +): string { + return JSON.stringify( + CarrierAccountCorreosCreateRequest$outboundSchema.parse( + carrierAccountCorreosCreateRequest, + ), + ); +} + +export function carrierAccountCorreosCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + CarrierAccountCorreosCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountCorreosCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountdeutschepostcreaterequest.ts b/src/models/components/carrieraccountdeutschepostcreaterequest.ts index 13fa1742..7b8e5fdf 100644 --- a/src/models/components/carrieraccountdeutschepostcreaterequest.ts +++ b/src/models/components/carrieraccountdeutschepostcreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountDeutschePostCreateRequestParameters = {}; @@ -46,6 +49,33 @@ export namespace CarrierAccountDeutschePostCreateRequestParameters$ { CarrierAccountDeutschePostCreateRequestParameters$Outbound; } +export function carrierAccountDeutschePostCreateRequestParametersToJSON( + carrierAccountDeutschePostCreateRequestParameters: + CarrierAccountDeutschePostCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountDeutschePostCreateRequestParameters$outboundSchema.parse( + carrierAccountDeutschePostCreateRequestParameters, + ), + ); +} + +export function carrierAccountDeutschePostCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountDeutschePostCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountDeutschePostCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountDeutschePostCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountDeutschePostCreateRequest$inboundSchema: z.ZodType< CarrierAccountDeutschePostCreateRequest, @@ -90,3 +120,30 @@ export namespace CarrierAccountDeutschePostCreateRequest$ { /** @deprecated use `CarrierAccountDeutschePostCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountDeutschePostCreateRequest$Outbound; } + +export function carrierAccountDeutschePostCreateRequestToJSON( + carrierAccountDeutschePostCreateRequest: + CarrierAccountDeutschePostCreateRequest, +): string { + return JSON.stringify( + CarrierAccountDeutschePostCreateRequest$outboundSchema.parse( + carrierAccountDeutschePostCreateRequest, + ), + ); +} + +export function carrierAccountDeutschePostCreateRequestFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountDeutschePostCreateRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountDeutschePostCreateRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountDeutschePostCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountdhlexpresscreaterequest.ts b/src/models/components/carrieraccountdhlexpresscreaterequest.ts index 7cf61175..30f9005f 100644 --- a/src/models/components/carrieraccountdhlexpresscreaterequest.ts +++ b/src/models/components/carrieraccountdhlexpresscreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierAccountDHLExpressCreateRequestParameters, CarrierAccountDHLExpressCreateRequestParameters$inboundSchema, @@ -55,3 +58,24 @@ export namespace CarrierAccountDHLExpressCreateRequest$ { /** @deprecated use `CarrierAccountDHLExpressCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountDHLExpressCreateRequest$Outbound; } + +export function carrierAccountDHLExpressCreateRequestToJSON( + carrierAccountDHLExpressCreateRequest: CarrierAccountDHLExpressCreateRequest, +): string { + return JSON.stringify( + CarrierAccountDHLExpressCreateRequest$outboundSchema.parse( + carrierAccountDHLExpressCreateRequest, + ), + ); +} + +export function carrierAccountDHLExpressCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + CarrierAccountDHLExpressCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountDHLExpressCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountdhlexpresscreaterequestparameters.ts b/src/models/components/carrieraccountdhlexpresscreaterequestparameters.ts index 6006ed55..b98f292c 100644 --- a/src/models/components/carrieraccountdhlexpresscreaterequestparameters.ts +++ b/src/models/components/carrieraccountdhlexpresscreaterequestparameters.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountDHLExpressCreateRequestParameters = { /** @@ -60,3 +63,30 @@ export namespace CarrierAccountDHLExpressCreateRequestParameters$ { export type Outbound = CarrierAccountDHLExpressCreateRequestParameters$Outbound; } + +export function carrierAccountDHLExpressCreateRequestParametersToJSON( + carrierAccountDHLExpressCreateRequestParameters: + CarrierAccountDHLExpressCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountDHLExpressCreateRequestParameters$outboundSchema.parse( + carrierAccountDHLExpressCreateRequestParameters, + ), + ); +} + +export function carrierAccountDHLExpressCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountDHLExpressCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountDHLExpressCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountDHLExpressCreateRequestParameters' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountdpddecreaterequest.ts b/src/models/components/carrieraccountdpddecreaterequest.ts index a209cb65..4b930e2c 100644 --- a/src/models/components/carrieraccountdpddecreaterequest.ts +++ b/src/models/components/carrieraccountdpddecreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountDpdDeCreateRequestParameters = {}; @@ -42,6 +45,33 @@ export namespace CarrierAccountDpdDeCreateRequestParameters$ { export type Outbound = CarrierAccountDpdDeCreateRequestParameters$Outbound; } +export function carrierAccountDpdDeCreateRequestParametersToJSON( + carrierAccountDpdDeCreateRequestParameters: + CarrierAccountDpdDeCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountDpdDeCreateRequestParameters$outboundSchema.parse( + carrierAccountDpdDeCreateRequestParameters, + ), + ); +} + +export function carrierAccountDpdDeCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountDpdDeCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountDpdDeCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountDpdDeCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountDpdDeCreateRequest$inboundSchema: z.ZodType< CarrierAccountDpdDeCreateRequest, @@ -84,3 +114,23 @@ export namespace CarrierAccountDpdDeCreateRequest$ { /** @deprecated use `CarrierAccountDpdDeCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountDpdDeCreateRequest$Outbound; } + +export function carrierAccountDpdDeCreateRequestToJSON( + carrierAccountDpdDeCreateRequest: CarrierAccountDpdDeCreateRequest, +): string { + return JSON.stringify( + CarrierAccountDpdDeCreateRequest$outboundSchema.parse( + carrierAccountDpdDeCreateRequest, + ), + ); +} + +export function carrierAccountDpdDeCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountDpdDeCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountDpdDeCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountdpdukcreaterequest.ts b/src/models/components/carrieraccountdpdukcreaterequest.ts index 058d4216..0f7fe459 100644 --- a/src/models/components/carrieraccountdpdukcreaterequest.ts +++ b/src/models/components/carrieraccountdpdukcreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountDPDUKCreateRequestParameters = {}; @@ -42,6 +45,33 @@ export namespace CarrierAccountDPDUKCreateRequestParameters$ { export type Outbound = CarrierAccountDPDUKCreateRequestParameters$Outbound; } +export function carrierAccountDPDUKCreateRequestParametersToJSON( + carrierAccountDPDUKCreateRequestParameters: + CarrierAccountDPDUKCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountDPDUKCreateRequestParameters$outboundSchema.parse( + carrierAccountDPDUKCreateRequestParameters, + ), + ); +} + +export function carrierAccountDPDUKCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountDPDUKCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountDPDUKCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountDPDUKCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountDPDUKCreateRequest$inboundSchema: z.ZodType< CarrierAccountDPDUKCreateRequest, @@ -84,3 +114,23 @@ export namespace CarrierAccountDPDUKCreateRequest$ { /** @deprecated use `CarrierAccountDPDUKCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountDPDUKCreateRequest$Outbound; } + +export function carrierAccountDPDUKCreateRequestToJSON( + carrierAccountDPDUKCreateRequest: CarrierAccountDPDUKCreateRequest, +): string { + return JSON.stringify( + CarrierAccountDPDUKCreateRequest$outboundSchema.parse( + carrierAccountDPDUKCreateRequest, + ), + ); +} + +export function carrierAccountDPDUKCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountDPDUKCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountDPDUKCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountfedexcreaterequest.ts b/src/models/components/carrieraccountfedexcreaterequest.ts index 24a89b73..64abd8b1 100644 --- a/src/models/components/carrieraccountfedexcreaterequest.ts +++ b/src/models/components/carrieraccountfedexcreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountFedExCreateRequestParameters = {}; @@ -42,6 +45,33 @@ export namespace CarrierAccountFedExCreateRequestParameters$ { export type Outbound = CarrierAccountFedExCreateRequestParameters$Outbound; } +export function carrierAccountFedExCreateRequestParametersToJSON( + carrierAccountFedExCreateRequestParameters: + CarrierAccountFedExCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountFedExCreateRequestParameters$outboundSchema.parse( + carrierAccountFedExCreateRequestParameters, + ), + ); +} + +export function carrierAccountFedExCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountFedExCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountFedExCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountFedExCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountFedExCreateRequest$inboundSchema: z.ZodType< CarrierAccountFedExCreateRequest, @@ -84,3 +114,23 @@ export namespace CarrierAccountFedExCreateRequest$ { /** @deprecated use `CarrierAccountFedExCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountFedExCreateRequest$Outbound; } + +export function carrierAccountFedExCreateRequestToJSON( + carrierAccountFedExCreateRequest: CarrierAccountFedExCreateRequest, +): string { + return JSON.stringify( + CarrierAccountFedExCreateRequest$outboundSchema.parse( + carrierAccountFedExCreateRequest, + ), + ); +} + +export function carrierAccountFedExCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountFedExCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountFedExCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccounthermesukcreaterequest.ts b/src/models/components/carrieraccounthermesukcreaterequest.ts index d521be1b..eb7384b5 100644 --- a/src/models/components/carrieraccounthermesukcreaterequest.ts +++ b/src/models/components/carrieraccounthermesukcreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountHermesUKCreateRequestParameters = {}; @@ -45,6 +48,33 @@ export namespace CarrierAccountHermesUKCreateRequestParameters$ { export type Outbound = CarrierAccountHermesUKCreateRequestParameters$Outbound; } +export function carrierAccountHermesUKCreateRequestParametersToJSON( + carrierAccountHermesUKCreateRequestParameters: + CarrierAccountHermesUKCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountHermesUKCreateRequestParameters$outboundSchema.parse( + carrierAccountHermesUKCreateRequestParameters, + ), + ); +} + +export function carrierAccountHermesUKCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountHermesUKCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountHermesUKCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountHermesUKCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountHermesUKCreateRequest$inboundSchema: z.ZodType< CarrierAccountHermesUKCreateRequest, @@ -89,3 +119,24 @@ export namespace CarrierAccountHermesUKCreateRequest$ { /** @deprecated use `CarrierAccountHermesUKCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountHermesUKCreateRequest$Outbound; } + +export function carrierAccountHermesUKCreateRequestToJSON( + carrierAccountHermesUKCreateRequest: CarrierAccountHermesUKCreateRequest, +): string { + return JSON.stringify( + CarrierAccountHermesUKCreateRequest$outboundSchema.parse( + carrierAccountHermesUKCreateRequest, + ), + ); +} + +export function carrierAccountHermesUKCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + CarrierAccountHermesUKCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountHermesUKCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountmondialrelaycreaterequest.ts b/src/models/components/carrieraccountmondialrelaycreaterequest.ts index d81df3c6..9fbe50a8 100644 --- a/src/models/components/carrieraccountmondialrelaycreaterequest.ts +++ b/src/models/components/carrieraccountmondialrelaycreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountMondialRelayCreateRequestParameters = {}; @@ -46,6 +49,33 @@ export namespace CarrierAccountMondialRelayCreateRequestParameters$ { CarrierAccountMondialRelayCreateRequestParameters$Outbound; } +export function carrierAccountMondialRelayCreateRequestParametersToJSON( + carrierAccountMondialRelayCreateRequestParameters: + CarrierAccountMondialRelayCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountMondialRelayCreateRequestParameters$outboundSchema.parse( + carrierAccountMondialRelayCreateRequestParameters, + ), + ); +} + +export function carrierAccountMondialRelayCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountMondialRelayCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountMondialRelayCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountMondialRelayCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountMondialRelayCreateRequest$inboundSchema: z.ZodType< CarrierAccountMondialRelayCreateRequest, @@ -90,3 +120,30 @@ export namespace CarrierAccountMondialRelayCreateRequest$ { /** @deprecated use `CarrierAccountMondialRelayCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountMondialRelayCreateRequest$Outbound; } + +export function carrierAccountMondialRelayCreateRequestToJSON( + carrierAccountMondialRelayCreateRequest: + CarrierAccountMondialRelayCreateRequest, +): string { + return JSON.stringify( + CarrierAccountMondialRelayCreateRequest$outboundSchema.parse( + carrierAccountMondialRelayCreateRequest, + ), + ); +} + +export function carrierAccountMondialRelayCreateRequestFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountMondialRelayCreateRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountMondialRelayCreateRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountMondialRelayCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountpaginatedlist.ts b/src/models/components/carrieraccountpaginatedlist.ts index 9ab45de0..efd48468 100644 --- a/src/models/components/carrieraccountpaginatedlist.ts +++ b/src/models/components/carrieraccountpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierAccountWithExtraInfo, CarrierAccountWithExtraInfo$inboundSchema, @@ -57,3 +60,23 @@ export namespace CarrierAccountPaginatedList$ { /** @deprecated use `CarrierAccountPaginatedList$Outbound` instead. */ export type Outbound = CarrierAccountPaginatedList$Outbound; } + +export function carrierAccountPaginatedListToJSON( + carrierAccountPaginatedList: CarrierAccountPaginatedList, +): string { + return JSON.stringify( + CarrierAccountPaginatedList$outboundSchema.parse( + carrierAccountPaginatedList, + ), + ); +} + +export function carrierAccountPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountposteitalianecreaterequest.ts b/src/models/components/carrieraccountposteitalianecreaterequest.ts index 9c61a975..dfc8f62c 100644 --- a/src/models/components/carrieraccountposteitalianecreaterequest.ts +++ b/src/models/components/carrieraccountposteitalianecreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountPosteItalianeCreateRequestParameters = {}; @@ -46,6 +49,33 @@ export namespace CarrierAccountPosteItalianeCreateRequestParameters$ { CarrierAccountPosteItalianeCreateRequestParameters$Outbound; } +export function carrierAccountPosteItalianeCreateRequestParametersToJSON( + carrierAccountPosteItalianeCreateRequestParameters: + CarrierAccountPosteItalianeCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountPosteItalianeCreateRequestParameters$outboundSchema.parse( + carrierAccountPosteItalianeCreateRequestParameters, + ), + ); +} + +export function carrierAccountPosteItalianeCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountPosteItalianeCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountPosteItalianeCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountPosteItalianeCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountPosteItalianeCreateRequest$inboundSchema: z.ZodType< CarrierAccountPosteItalianeCreateRequest, @@ -90,3 +120,30 @@ export namespace CarrierAccountPosteItalianeCreateRequest$ { /** @deprecated use `CarrierAccountPosteItalianeCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountPosteItalianeCreateRequest$Outbound; } + +export function carrierAccountPosteItalianeCreateRequestToJSON( + carrierAccountPosteItalianeCreateRequest: + CarrierAccountPosteItalianeCreateRequest, +): string { + return JSON.stringify( + CarrierAccountPosteItalianeCreateRequest$outboundSchema.parse( + carrierAccountPosteItalianeCreateRequest, + ), + ); +} + +export function carrierAccountPosteItalianeCreateRequestFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountPosteItalianeCreateRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountPosteItalianeCreateRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountPosteItalianeCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountregistrationstatus.ts b/src/models/components/carrieraccountregistrationstatus.ts index 94868ee6..5593b722 100644 --- a/src/models/components/carrieraccountregistrationstatus.ts +++ b/src/models/components/carrieraccountregistrationstatus.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountRegistrationStatus = { carrierAccount?: string | undefined; @@ -78,3 +81,23 @@ export namespace CarrierAccountRegistrationStatus$ { /** @deprecated use `CarrierAccountRegistrationStatus$Outbound` instead. */ export type Outbound = CarrierAccountRegistrationStatus$Outbound; } + +export function carrierAccountRegistrationStatusToJSON( + carrierAccountRegistrationStatus: CarrierAccountRegistrationStatus, +): string { + return JSON.stringify( + CarrierAccountRegistrationStatus$outboundSchema.parse( + carrierAccountRegistrationStatus, + ), + ); +} + +export function carrierAccountRegistrationStatusFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountRegistrationStatus$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountRegistrationStatus' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountsendlecreaterequest.ts b/src/models/components/carrieraccountsendlecreaterequest.ts index c57c7b5c..7a40f95d 100644 --- a/src/models/components/carrieraccountsendlecreaterequest.ts +++ b/src/models/components/carrieraccountsendlecreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountSendleCreateRequestParameters = {}; @@ -45,6 +48,33 @@ export namespace CarrierAccountSendleCreateRequestParameters$ { export type Outbound = CarrierAccountSendleCreateRequestParameters$Outbound; } +export function carrierAccountSendleCreateRequestParametersToJSON( + carrierAccountSendleCreateRequestParameters: + CarrierAccountSendleCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountSendleCreateRequestParameters$outboundSchema.parse( + carrierAccountSendleCreateRequestParameters, + ), + ); +} + +export function carrierAccountSendleCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountSendleCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountSendleCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountSendleCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountSendleCreateRequest$inboundSchema: z.ZodType< CarrierAccountSendleCreateRequest, @@ -88,3 +118,23 @@ export namespace CarrierAccountSendleCreateRequest$ { /** @deprecated use `CarrierAccountSendleCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountSendleCreateRequest$Outbound; } + +export function carrierAccountSendleCreateRequestToJSON( + carrierAccountSendleCreateRequest: CarrierAccountSendleCreateRequest, +): string { + return JSON.stringify( + CarrierAccountSendleCreateRequest$outboundSchema.parse( + carrierAccountSendleCreateRequest, + ), + ); +} + +export function carrierAccountSendleCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountSendleCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountSendleCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountservicelevel.ts b/src/models/components/carrieraccountservicelevel.ts index 5824987a..34112f56 100644 --- a/src/models/components/carrieraccountservicelevel.ts +++ b/src/models/components/carrieraccountservicelevel.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Contains details regarding the service level for the carrier account. @@ -80,3 +83,21 @@ export namespace CarrierAccountServiceLevel$ { /** @deprecated use `CarrierAccountServiceLevel$Outbound` instead. */ export type Outbound = CarrierAccountServiceLevel$Outbound; } + +export function carrierAccountServiceLevelToJSON( + carrierAccountServiceLevel: CarrierAccountServiceLevel, +): string { + return JSON.stringify( + CarrierAccountServiceLevel$outboundSchema.parse(carrierAccountServiceLevel), + ); +} + +export function carrierAccountServiceLevelFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountServiceLevel$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountServiceLevel' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountupscreaterequest.ts b/src/models/components/carrieraccountupscreaterequest.ts index 5891c2a6..0c05cff2 100644 --- a/src/models/components/carrieraccountupscreaterequest.ts +++ b/src/models/components/carrieraccountupscreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierAccountUPSCreateRequestParameters, CarrierAccountUPSCreateRequestParameters$inboundSchema, @@ -54,3 +57,23 @@ export namespace CarrierAccountUPSCreateRequest$ { /** @deprecated use `CarrierAccountUPSCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountUPSCreateRequest$Outbound; } + +export function carrierAccountUPSCreateRequestToJSON( + carrierAccountUPSCreateRequest: CarrierAccountUPSCreateRequest, +): string { + return JSON.stringify( + CarrierAccountUPSCreateRequest$outboundSchema.parse( + carrierAccountUPSCreateRequest, + ), + ); +} + +export function carrierAccountUPSCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountUPSCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountUPSCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountupscreaterequestparameters.ts b/src/models/components/carrieraccountupscreaterequestparameters.ts index dc2e7d7a..6ee23425 100644 --- a/src/models/components/carrieraccountupscreaterequestparameters.ts +++ b/src/models/components/carrieraccountupscreaterequestparameters.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountUPSCreateRequestParameters = { billingAddressCity: string; @@ -181,3 +184,30 @@ export namespace CarrierAccountUPSCreateRequestParameters$ { /** @deprecated use `CarrierAccountUPSCreateRequestParameters$Outbound` instead. */ export type Outbound = CarrierAccountUPSCreateRequestParameters$Outbound; } + +export function carrierAccountUPSCreateRequestParametersToJSON( + carrierAccountUPSCreateRequestParameters: + CarrierAccountUPSCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountUPSCreateRequestParameters$outboundSchema.parse( + carrierAccountUPSCreateRequestParameters, + ), + ); +} + +export function carrierAccountUPSCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountUPSCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountUPSCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountUPSCreateRequestParameters' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountuspscreaterequest.ts b/src/models/components/carrieraccountuspscreaterequest.ts index fb896581..cac2f794 100644 --- a/src/models/components/carrieraccountuspscreaterequest.ts +++ b/src/models/components/carrieraccountuspscreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CarrierAccountUSPSCreateRequestParameters = {}; @@ -44,6 +47,33 @@ export namespace CarrierAccountUSPSCreateRequestParameters$ { export type Outbound = CarrierAccountUSPSCreateRequestParameters$Outbound; } +export function carrierAccountUSPSCreateRequestParametersToJSON( + carrierAccountUSPSCreateRequestParameters: + CarrierAccountUSPSCreateRequestParameters, +): string { + return JSON.stringify( + CarrierAccountUSPSCreateRequestParameters$outboundSchema.parse( + carrierAccountUSPSCreateRequestParameters, + ), + ); +} + +export function carrierAccountUSPSCreateRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + CarrierAccountUSPSCreateRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + CarrierAccountUSPSCreateRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'CarrierAccountUSPSCreateRequestParameters' from JSON`, + ); +} + /** @internal */ export const CarrierAccountUSPSCreateRequest$inboundSchema: z.ZodType< CarrierAccountUSPSCreateRequest, @@ -86,3 +116,23 @@ export namespace CarrierAccountUSPSCreateRequest$ { /** @deprecated use `CarrierAccountUSPSCreateRequest$Outbound` instead. */ export type Outbound = CarrierAccountUSPSCreateRequest$Outbound; } + +export function carrierAccountUSPSCreateRequestToJSON( + carrierAccountUSPSCreateRequest: CarrierAccountUSPSCreateRequest, +): string { + return JSON.stringify( + CarrierAccountUSPSCreateRequest$outboundSchema.parse( + carrierAccountUSPSCreateRequest, + ), + ); +} + +export function carrierAccountUSPSCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountUSPSCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountUSPSCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/carrieraccountwithextrainfo.ts b/src/models/components/carrieraccountwithextrainfo.ts index 6b735621..bea8c591 100644 --- a/src/models/components/carrieraccountwithextrainfo.ts +++ b/src/models/components/carrieraccountwithextrainfo.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierAccountServiceLevel, CarrierAccountServiceLevel$inboundSchema, @@ -170,6 +173,20 @@ export namespace ParametersT$ { export type Outbound = ParametersT$Outbound; } +export function parametersToJSON(parametersT: ParametersT): string { + return JSON.stringify(ParametersT$outboundSchema.parse(parametersT)); +} + +export function parametersFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParametersT$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParametersT' from JSON`, + ); +} + /** @internal */ export const CarrierAccountWithExtraInfoType$inboundSchema: z.ZodNativeEnum< typeof CarrierAccountWithExtraInfoType @@ -252,6 +269,20 @@ export namespace Authentication$ { export type Outbound = Authentication$Outbound; } +export function authenticationToJSON(authentication: Authentication): string { + return JSON.stringify(Authentication$outboundSchema.parse(authentication)); +} + +export function authenticationFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Authentication$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Authentication' from JSON`, + ); +} + /** @internal */ export const ObjectInfo$inboundSchema: z.ZodType< ObjectInfo, @@ -288,6 +319,20 @@ export namespace ObjectInfo$ { export type Outbound = ObjectInfo$Outbound; } +export function objectInfoToJSON(objectInfo: ObjectInfo): string { + return JSON.stringify(ObjectInfo$outboundSchema.parse(objectInfo)); +} + +export function objectInfoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ObjectInfo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ObjectInfo' from JSON`, + ); +} + /** @internal */ export const CarrierAccountWithExtraInfo$inboundSchema: z.ZodType< CarrierAccountWithExtraInfo, @@ -388,3 +433,23 @@ export namespace CarrierAccountWithExtraInfo$ { /** @deprecated use `CarrierAccountWithExtraInfo$Outbound` instead. */ export type Outbound = CarrierAccountWithExtraInfo$Outbound; } + +export function carrierAccountWithExtraInfoToJSON( + carrierAccountWithExtraInfo: CarrierAccountWithExtraInfo, +): string { + return JSON.stringify( + CarrierAccountWithExtraInfo$outboundSchema.parse( + carrierAccountWithExtraInfo, + ), + ); +} + +export function carrierAccountWithExtraInfoFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierAccountWithExtraInfo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierAccountWithExtraInfo' from JSON`, + ); +} diff --git a/src/models/components/carrierparceltemplate.ts b/src/models/components/carrierparceltemplate.ts index e4875afa..7cde7742 100644 --- a/src/models/components/carrierparceltemplate.ts +++ b/src/models/components/carrierparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DistanceUnitEnum, DistanceUnitEnum$inboundSchema, @@ -111,3 +114,21 @@ export namespace CarrierParcelTemplate$ { /** @deprecated use `CarrierParcelTemplate$Outbound` instead. */ export type Outbound = CarrierParcelTemplate$Outbound; } + +export function carrierParcelTemplateToJSON( + carrierParcelTemplate: CarrierParcelTemplate, +): string { + return JSON.stringify( + CarrierParcelTemplate$outboundSchema.parse(carrierParcelTemplate), + ); +} + +export function carrierParcelTemplateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierParcelTemplate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierParcelTemplate' from JSON`, + ); +} diff --git a/src/models/components/carrierparceltemplatelist.ts b/src/models/components/carrierparceltemplatelist.ts index b18c827a..5d69c274 100644 --- a/src/models/components/carrierparceltemplatelist.ts +++ b/src/models/components/carrierparceltemplatelist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierParcelTemplate, CarrierParcelTemplate$inboundSchema, @@ -49,3 +52,21 @@ export namespace CarrierParcelTemplateList$ { /** @deprecated use `CarrierParcelTemplateList$Outbound` instead. */ export type Outbound = CarrierParcelTemplateList$Outbound; } + +export function carrierParcelTemplateListToJSON( + carrierParcelTemplateList: CarrierParcelTemplateList, +): string { + return JSON.stringify( + CarrierParcelTemplateList$outboundSchema.parse(carrierParcelTemplateList), + ); +} + +export function carrierParcelTemplateListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CarrierParcelTemplateList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CarrierParcelTemplateList' from JSON`, + ); +} diff --git a/src/models/components/carriersenum.ts b/src/models/components/carriersenum.ts index f98befdf..24344c34 100644 --- a/src/models/components/carriersenum.ts +++ b/src/models/components/carriersenum.ts @@ -27,7 +27,6 @@ import { ClosedEnum } from "../../types/enums.js"; * | collect_plus | CollectPlus| * | correios_br | CorreiosBR| * | correos_espana | Correos España | - * | couriersplease | Couriers Please| * | colissimo | Colissimo| * | deutsche_post | Deutsche Post| * | dhl_benelux | DHL Benelux| @@ -53,7 +52,6 @@ import { ClosedEnum } from "../../types/enums.js"; * | new_zealand_post | New Zealand Post (also used for Pace and CourierPost)| * | nippon_express | Nippon Express| * | ontrac | OnTrac| - * | orangeds | OrangeDS| * | parcelforce | Parcelforce| * | passport | Passport| * | pcf | PCF| @@ -90,7 +88,6 @@ export const CarriersEnum = { CollectPlus: "collect_plus", CorreiosBr: "correios_br", CorreosEspana: "correos_espana", - Couriersplease: "couriersplease", Colissimo: "colissimo", DeutschePost: "deutsche_post", DhlBenelux: "dhl_benelux", @@ -116,7 +113,6 @@ export const CarriersEnum = { NewZealandPost: "new_zealand_post", NipponExpress: "nippon_express", Ontrac: "ontrac", - Orangeds: "orangeds", Parcelforce: "parcelforce", Passport: "passport", Pcf: "pcf", @@ -157,7 +153,6 @@ export const CarriersEnum = { * | collect_plus | CollectPlus| * | correios_br | CorreiosBR| * | correos_espana | Correos España | - * | couriersplease | Couriers Please| * | colissimo | Colissimo| * | deutsche_post | Deutsche Post| * | dhl_benelux | DHL Benelux| @@ -183,7 +178,6 @@ export const CarriersEnum = { * | new_zealand_post | New Zealand Post (also used for Pace and CourierPost)| * | nippon_express | Nippon Express| * | ontrac | OnTrac| - * | orangeds | OrangeDS| * | parcelforce | Parcelforce| * | passport | Passport| * | pcf | PCF| diff --git a/src/models/components/cod.ts b/src/models/components/cod.ts index ceb8cd67..6c1f2e56 100644 --- a/src/models/components/cod.ts +++ b/src/models/components/cod.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Secured funds include money orders, certified cheques and others (see @@ -113,3 +116,17 @@ export namespace Cod$ { /** @deprecated use `Cod$Outbound` instead. */ export type Outbound = Cod$Outbound; } + +export function codToJSON(cod: Cod): string { + return JSON.stringify(Cod$outboundSchema.parse(cod)); +} + +export function codFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Cod$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Cod' from JSON`, + ); +} diff --git a/src/models/components/connectexistingownaccountrequest.ts b/src/models/components/connectexistingownaccountrequest.ts index 91143be8..8f7aba7c 100644 --- a/src/models/components/connectexistingownaccountrequest.ts +++ b/src/models/components/connectexistingownaccountrequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { FedExConnectExistingOwnAccountParameters, FedExConnectExistingOwnAccountParameters$inboundSchema, @@ -76,6 +79,33 @@ export namespace ConnectExistingOwnAccountRequestParameters$ { export type Outbound = ConnectExistingOwnAccountRequestParameters$Outbound; } +export function connectExistingOwnAccountRequestParametersToJSON( + connectExistingOwnAccountRequestParameters: + ConnectExistingOwnAccountRequestParameters, +): string { + return JSON.stringify( + ConnectExistingOwnAccountRequestParameters$outboundSchema.parse( + connectExistingOwnAccountRequestParameters, + ), + ); +} + +export function connectExistingOwnAccountRequestParametersFromJSON( + jsonString: string, +): SafeParseResult< + ConnectExistingOwnAccountRequestParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + ConnectExistingOwnAccountRequestParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'ConnectExistingOwnAccountRequestParameters' from JSON`, + ); +} + /** @internal */ export const ConnectExistingOwnAccountRequest$inboundSchema: z.ZodType< ConnectExistingOwnAccountRequest, @@ -145,3 +175,23 @@ export namespace ConnectExistingOwnAccountRequest$ { /** @deprecated use `ConnectExistingOwnAccountRequest$Outbound` instead. */ export type Outbound = ConnectExistingOwnAccountRequest$Outbound; } + +export function connectExistingOwnAccountRequestToJSON( + connectExistingOwnAccountRequest: ConnectExistingOwnAccountRequest, +): string { + return JSON.stringify( + ConnectExistingOwnAccountRequest$outboundSchema.parse( + connectExistingOwnAccountRequest, + ), + ); +} + +export function connectExistingOwnAccountRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ConnectExistingOwnAccountRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ConnectExistingOwnAccountRequest' from JSON`, + ); +} diff --git a/src/models/components/corerate.ts b/src/models/components/corerate.ts index 836cc5e9..69afc37a 100644 --- a/src/models/components/corerate.ts +++ b/src/models/components/corerate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CoreRate = { /** @@ -135,3 +138,17 @@ export namespace CoreRate$ { /** @deprecated use `CoreRate$Outbound` instead. */ export type Outbound = CoreRate$Outbound; } + +export function coreRateToJSON(coreRate: CoreRate): string { + return JSON.stringify(CoreRate$outboundSchema.parse(coreRate)); +} + +export function coreRateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CoreRate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CoreRate' from JSON`, + ); +} diff --git a/src/models/components/customerreference.ts b/src/models/components/customerreference.ts index 4d33a111..4d87f5e3 100644 --- a/src/models/components/customerreference.ts +++ b/src/models/components/customerreference.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Specify the reference field on the label (FedEx and UPS only). @@ -79,3 +82,21 @@ export namespace CustomerReference$ { /** @deprecated use `CustomerReference$Outbound` instead. */ export type Outbound = CustomerReference$Outbound; } + +export function customerReferenceToJSON( + customerReference: CustomerReference, +): string { + return JSON.stringify( + CustomerReference$outboundSchema.parse(customerReference), + ); +} + +export function customerReferenceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomerReference$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomerReference' from JSON`, + ); +} diff --git a/src/models/components/customsdeclaration.ts b/src/models/components/customsdeclaration.ts index 923f0d70..dcb0d9a5 100644 --- a/src/models/components/customsdeclaration.ts +++ b/src/models/components/customsdeclaration.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomsExporterIdentification, CustomsExporterIdentification$inboundSchema, @@ -289,6 +292,24 @@ export namespace CustomsDeclarationAddress$ { export type Outbound = CustomsDeclarationAddress$Outbound; } +export function customsDeclarationAddressToJSON( + customsDeclarationAddress: CustomsDeclarationAddress, +): string { + return JSON.stringify( + CustomsDeclarationAddress$outboundSchema.parse(customsDeclarationAddress), + ); +} + +export function customsDeclarationAddressFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsDeclarationAddress$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsDeclarationAddress' from JSON`, + ); +} + /** @internal */ export const CustomsDeclarationDutiesPayor$inboundSchema: z.ZodType< CustomsDeclarationDutiesPayor, @@ -331,6 +352,26 @@ export namespace CustomsDeclarationDutiesPayor$ { export type Outbound = CustomsDeclarationDutiesPayor$Outbound; } +export function customsDeclarationDutiesPayorToJSON( + customsDeclarationDutiesPayor: CustomsDeclarationDutiesPayor, +): string { + return JSON.stringify( + CustomsDeclarationDutiesPayor$outboundSchema.parse( + customsDeclarationDutiesPayor, + ), + ); +} + +export function customsDeclarationDutiesPayorFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsDeclarationDutiesPayor$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsDeclarationDutiesPayor' from JSON`, + ); +} + /** @internal */ export const CustomsDeclaration$inboundSchema: z.ZodType< CustomsDeclaration, @@ -512,3 +553,21 @@ export namespace CustomsDeclaration$ { /** @deprecated use `CustomsDeclaration$Outbound` instead. */ export type Outbound = CustomsDeclaration$Outbound; } + +export function customsDeclarationToJSON( + customsDeclaration: CustomsDeclaration, +): string { + return JSON.stringify( + CustomsDeclaration$outboundSchema.parse(customsDeclaration), + ); +} + +export function customsDeclarationFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsDeclaration$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsDeclaration' from JSON`, + ); +} diff --git a/src/models/components/customsdeclarationcreaterequest.ts b/src/models/components/customsdeclarationcreaterequest.ts index 6ee891b1..feac370d 100644 --- a/src/models/components/customsdeclarationcreaterequest.ts +++ b/src/models/components/customsdeclarationcreaterequest.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressImporter, AddressImporter$inboundSchema, @@ -257,6 +260,28 @@ export namespace CustomsDeclarationCreateRequestAddress$ { export type Outbound = CustomsDeclarationCreateRequestAddress$Outbound; } +export function customsDeclarationCreateRequestAddressToJSON( + customsDeclarationCreateRequestAddress: + CustomsDeclarationCreateRequestAddress, +): string { + return JSON.stringify( + CustomsDeclarationCreateRequestAddress$outboundSchema.parse( + customsDeclarationCreateRequestAddress, + ), + ); +} + +export function customsDeclarationCreateRequestAddressFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + CustomsDeclarationCreateRequestAddress$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsDeclarationCreateRequestAddress' from JSON`, + ); +} + /** @internal */ export const DutiesPayor$inboundSchema: z.ZodType< DutiesPayor, @@ -301,6 +326,20 @@ export namespace DutiesPayor$ { export type Outbound = DutiesPayor$Outbound; } +export function dutiesPayorToJSON(dutiesPayor: DutiesPayor): string { + return JSON.stringify(DutiesPayor$outboundSchema.parse(dutiesPayor)); +} + +export function dutiesPayorFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DutiesPayor$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DutiesPayor' from JSON`, + ); +} + /** @internal */ export const CustomsDeclarationCreateRequest$inboundSchema: z.ZodType< CustomsDeclarationCreateRequest, @@ -448,3 +487,23 @@ export namespace CustomsDeclarationCreateRequest$ { /** @deprecated use `CustomsDeclarationCreateRequest$Outbound` instead. */ export type Outbound = CustomsDeclarationCreateRequest$Outbound; } + +export function customsDeclarationCreateRequestToJSON( + customsDeclarationCreateRequest: CustomsDeclarationCreateRequest, +): string { + return JSON.stringify( + CustomsDeclarationCreateRequest$outboundSchema.parse( + customsDeclarationCreateRequest, + ), + ); +} + +export function customsDeclarationCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsDeclarationCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsDeclarationCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/customsdeclarationpaginatedlist.ts b/src/models/components/customsdeclarationpaginatedlist.ts index d0676902..865232a3 100644 --- a/src/models/components/customsdeclarationpaginatedlist.ts +++ b/src/models/components/customsdeclarationpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomsDeclaration, CustomsDeclaration$inboundSchema, @@ -57,3 +60,23 @@ export namespace CustomsDeclarationPaginatedList$ { /** @deprecated use `CustomsDeclarationPaginatedList$Outbound` instead. */ export type Outbound = CustomsDeclarationPaginatedList$Outbound; } + +export function customsDeclarationPaginatedListToJSON( + customsDeclarationPaginatedList: CustomsDeclarationPaginatedList, +): string { + return JSON.stringify( + CustomsDeclarationPaginatedList$outboundSchema.parse( + customsDeclarationPaginatedList, + ), + ); +} + +export function customsDeclarationPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsDeclarationPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsDeclarationPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/customsexporteridentification.ts b/src/models/components/customsexporteridentification.ts index 20dcdcf5..48a4d3b1 100644 --- a/src/models/components/customsexporteridentification.ts +++ b/src/models/components/customsexporteridentification.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomsTaxIdentification, CustomsTaxIdentification$inboundSchema, @@ -80,3 +83,23 @@ export namespace CustomsExporterIdentification$ { /** @deprecated use `CustomsExporterIdentification$Outbound` instead. */ export type Outbound = CustomsExporterIdentification$Outbound; } + +export function customsExporterIdentificationToJSON( + customsExporterIdentification: CustomsExporterIdentification, +): string { + return JSON.stringify( + CustomsExporterIdentification$outboundSchema.parse( + customsExporterIdentification, + ), + ); +} + +export function customsExporterIdentificationFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsExporterIdentification$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsExporterIdentification' from JSON`, + ); +} diff --git a/src/models/components/customsinvoicedcharges.ts b/src/models/components/customsinvoicedcharges.ts index 5997d0f6..21ea5e43 100644 --- a/src/models/components/customsinvoicedcharges.ts +++ b/src/models/components/customsinvoicedcharges.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Additional invoiced charges to be shown on the Customs Declaration Commercial Invoice. @@ -92,3 +95,21 @@ export namespace CustomsInvoicedCharges$ { /** @deprecated use `CustomsInvoicedCharges$Outbound` instead. */ export type Outbound = CustomsInvoicedCharges$Outbound; } + +export function customsInvoicedChargesToJSON( + customsInvoicedCharges: CustomsInvoicedCharges, +): string { + return JSON.stringify( + CustomsInvoicedCharges$outboundSchema.parse(customsInvoicedCharges), + ); +} + +export function customsInvoicedChargesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsInvoicedCharges$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsInvoicedCharges' from JSON`, + ); +} diff --git a/src/models/components/customsitem.ts b/src/models/components/customsitem.ts index 802d0b74..26539737 100644 --- a/src/models/components/customsitem.ts +++ b/src/models/components/customsitem.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ObjectStateEnum, ObjectStateEnum$inboundSchema, @@ -223,3 +226,17 @@ export namespace CustomsItem$ { /** @deprecated use `CustomsItem$Outbound` instead. */ export type Outbound = CustomsItem$Outbound; } + +export function customsItemToJSON(customsItem: CustomsItem): string { + return JSON.stringify(CustomsItem$outboundSchema.parse(customsItem)); +} + +export function customsItemFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsItem' from JSON`, + ); +} diff --git a/src/models/components/customsitemcreaterequest.ts b/src/models/components/customsitemcreaterequest.ts index 646e76f4..6a7dd173 100644 --- a/src/models/components/customsitemcreaterequest.ts +++ b/src/models/components/customsitemcreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WeightUnitEnum, WeightUnitEnum$inboundSchema, @@ -162,3 +165,21 @@ export namespace CustomsItemCreateRequest$ { /** @deprecated use `CustomsItemCreateRequest$Outbound` instead. */ export type Outbound = CustomsItemCreateRequest$Outbound; } + +export function customsItemCreateRequestToJSON( + customsItemCreateRequest: CustomsItemCreateRequest, +): string { + return JSON.stringify( + CustomsItemCreateRequest$outboundSchema.parse(customsItemCreateRequest), + ); +} + +export function customsItemCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsItemCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsItemCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/customsitempaginatedlist.ts b/src/models/components/customsitempaginatedlist.ts index 6ffe8745..aa05ab85 100644 --- a/src/models/components/customsitempaginatedlist.ts +++ b/src/models/components/customsitempaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CustomsItem, CustomsItem$inboundSchema, @@ -57,3 +60,21 @@ export namespace CustomsItemPaginatedList$ { /** @deprecated use `CustomsItemPaginatedList$Outbound` instead. */ export type Outbound = CustomsItemPaginatedList$Outbound; } + +export function customsItemPaginatedListToJSON( + customsItemPaginatedList: CustomsItemPaginatedList, +): string { + return JSON.stringify( + CustomsItemPaginatedList$outboundSchema.parse(customsItemPaginatedList), + ); +} + +export function customsItemPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsItemPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsItemPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/customstaxidentification.ts b/src/models/components/customstaxidentification.ts index befbb8aa..cb2479f1 100644 --- a/src/models/components/customstaxidentification.ts +++ b/src/models/components/customstaxidentification.ts @@ -3,7 +3,10 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Type of tax identification. @@ -115,3 +118,21 @@ export namespace CustomsTaxIdentification$ { /** @deprecated use `CustomsTaxIdentification$Outbound` instead. */ export type Outbound = CustomsTaxIdentification$Outbound; } + +export function customsTaxIdentificationToJSON( + customsTaxIdentification: CustomsTaxIdentification, +): string { + return JSON.stringify( + CustomsTaxIdentification$outboundSchema.parse(customsTaxIdentification), + ); +} + +export function customsTaxIdentificationFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CustomsTaxIdentification$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CustomsTaxIdentification' from JSON`, + ); +} diff --git a/src/models/components/dangerousgoodsbiologicalmaterial.ts b/src/models/components/dangerousgoodsbiologicalmaterial.ts index 4d450576..97b7158f 100644 --- a/src/models/components/dangerousgoodsbiologicalmaterial.ts +++ b/src/models/components/dangerousgoodsbiologicalmaterial.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Container for specifying the presence of biological material. @@ -49,3 +52,23 @@ export namespace DangerousGoodsBiologicalMaterial$ { /** @deprecated use `DangerousGoodsBiologicalMaterial$Outbound` instead. */ export type Outbound = DangerousGoodsBiologicalMaterial$Outbound; } + +export function dangerousGoodsBiologicalMaterialToJSON( + dangerousGoodsBiologicalMaterial: DangerousGoodsBiologicalMaterial, +): string { + return JSON.stringify( + DangerousGoodsBiologicalMaterial$outboundSchema.parse( + dangerousGoodsBiologicalMaterial, + ), + ); +} + +export function dangerousGoodsBiologicalMaterialFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DangerousGoodsBiologicalMaterial$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DangerousGoodsBiologicalMaterial' from JSON`, + ); +} diff --git a/src/models/components/dangerousgoodslithiumbatteries.ts b/src/models/components/dangerousgoodslithiumbatteries.ts index 26bace21..0fd87f6c 100644 --- a/src/models/components/dangerousgoodslithiumbatteries.ts +++ b/src/models/components/dangerousgoodslithiumbatteries.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Container for specifying the presence of lithium batteries. @@ -49,3 +52,23 @@ export namespace DangerousGoodsLithiumBatteries$ { /** @deprecated use `DangerousGoodsLithiumBatteries$Outbound` instead. */ export type Outbound = DangerousGoodsLithiumBatteries$Outbound; } + +export function dangerousGoodsLithiumBatteriesToJSON( + dangerousGoodsLithiumBatteries: DangerousGoodsLithiumBatteries, +): string { + return JSON.stringify( + DangerousGoodsLithiumBatteries$outboundSchema.parse( + dangerousGoodsLithiumBatteries, + ), + ); +} + +export function dangerousGoodsLithiumBatteriesFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DangerousGoodsLithiumBatteries$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DangerousGoodsLithiumBatteries' from JSON`, + ); +} diff --git a/src/models/components/dangerousgoodsobject.ts b/src/models/components/dangerousgoodsobject.ts index dcaa11f2..caa5793f 100644 --- a/src/models/components/dangerousgoodsobject.ts +++ b/src/models/components/dangerousgoodsobject.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DangerousGoodsBiologicalMaterial, DangerousGoodsBiologicalMaterial$inboundSchema, @@ -92,3 +95,21 @@ export namespace DangerousGoodsObject$ { /** @deprecated use `DangerousGoodsObject$Outbound` instead. */ export type Outbound = DangerousGoodsObject$Outbound; } + +export function dangerousGoodsObjectToJSON( + dangerousGoodsObject: DangerousGoodsObject, +): string { + return JSON.stringify( + DangerousGoodsObject$outboundSchema.parse(dangerousGoodsObject), + ); +} + +export function dangerousGoodsObjectFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DangerousGoodsObject$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DangerousGoodsObject' from JSON`, + ); +} diff --git a/src/models/components/defaultparceltemplate.ts b/src/models/components/defaultparceltemplate.ts index 42c9cdeb..51d95fdd 100644 --- a/src/models/components/defaultparceltemplate.ts +++ b/src/models/components/defaultparceltemplate.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { UserParcelTemplate, UserParcelTemplate$inboundSchema, @@ -49,3 +52,21 @@ export namespace DefaultParcelTemplate$ { /** @deprecated use `DefaultParcelTemplate$Outbound` instead. */ export type Outbound = DefaultParcelTemplate$Outbound; } + +export function defaultParcelTemplateToJSON( + defaultParcelTemplate: DefaultParcelTemplate, +): string { + return JSON.stringify( + DefaultParcelTemplate$outboundSchema.parse(defaultParcelTemplate), + ); +} + +export function defaultParcelTemplateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DefaultParcelTemplate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DefaultParcelTemplate' from JSON`, + ); +} diff --git a/src/models/components/defaultparceltemplateupdaterequest.ts b/src/models/components/defaultparceltemplateupdaterequest.ts index 405d8279..4f0234eb 100644 --- a/src/models/components/defaultparceltemplateupdaterequest.ts +++ b/src/models/components/defaultparceltemplateupdaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type DefaultParcelTemplateUpdateRequest = { objectId?: string | undefined; @@ -53,3 +56,24 @@ export namespace DefaultParcelTemplateUpdateRequest$ { /** @deprecated use `DefaultParcelTemplateUpdateRequest$Outbound` instead. */ export type Outbound = DefaultParcelTemplateUpdateRequest$Outbound; } + +export function defaultParcelTemplateUpdateRequestToJSON( + defaultParcelTemplateUpdateRequest: DefaultParcelTemplateUpdateRequest, +): string { + return JSON.stringify( + DefaultParcelTemplateUpdateRequest$outboundSchema.parse( + defaultParcelTemplateUpdateRequest, + ), + ); +} + +export function defaultParcelTemplateUpdateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + DefaultParcelTemplateUpdateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DefaultParcelTemplateUpdateRequest' from JSON`, + ); +} diff --git a/src/models/components/departmentnumber.ts b/src/models/components/departmentnumber.ts index 7d3fb541..9dfd1289 100644 --- a/src/models/components/departmentnumber.ts +++ b/src/models/components/departmentnumber.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Specify the department number field on the label (FedEx and UPS only). @@ -76,3 +79,21 @@ export namespace DepartmentNumber$ { /** @deprecated use `DepartmentNumber$Outbound` instead. */ export type Outbound = DepartmentNumber$Outbound; } + +export function departmentNumberToJSON( + departmentNumber: DepartmentNumber, +): string { + return JSON.stringify( + DepartmentNumber$outboundSchema.parse(departmentNumber), + ); +} + +export function departmentNumberFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DepartmentNumber$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DepartmentNumber' from JSON`, + ); +} diff --git a/src/models/components/dryice.ts b/src/models/components/dryice.ts index 034627e2..3ca7b0fc 100644 --- a/src/models/components/dryice.ts +++ b/src/models/components/dryice.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Specify that the package contains Dry Ice (FedEx, Veho, and UPS only). @@ -62,3 +65,17 @@ export namespace DryIce$ { /** @deprecated use `DryIce$Outbound` instead. */ export type Outbound = DryIce$Outbound; } + +export function dryIceToJSON(dryIce: DryIce): string { + return JSON.stringify(DryIce$outboundSchema.parse(dryIce)); +} + +export function dryIceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DryIce$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DryIce' from JSON`, + ); +} diff --git a/src/models/components/fedexconnectexistingownaccountparameters.ts b/src/models/components/fedexconnectexistingownaccountparameters.ts index fbc449c8..a3ed38f2 100644 --- a/src/models/components/fedexconnectexistingownaccountparameters.ts +++ b/src/models/components/fedexconnectexistingownaccountparameters.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type FedExConnectExistingOwnAccountParameters = { /** @@ -120,3 +123,30 @@ export namespace FedExConnectExistingOwnAccountParameters$ { /** @deprecated use `FedExConnectExistingOwnAccountParameters$Outbound` instead. */ export type Outbound = FedExConnectExistingOwnAccountParameters$Outbound; } + +export function fedExConnectExistingOwnAccountParametersToJSON( + fedExConnectExistingOwnAccountParameters: + FedExConnectExistingOwnAccountParameters, +): string { + return JSON.stringify( + FedExConnectExistingOwnAccountParameters$outboundSchema.parse( + fedExConnectExistingOwnAccountParameters, + ), + ); +} + +export function fedExConnectExistingOwnAccountParametersFromJSON( + jsonString: string, +): SafeParseResult< + FedExConnectExistingOwnAccountParameters, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + FedExConnectExistingOwnAccountParameters$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'FedExConnectExistingOwnAccountParameters' from JSON`, + ); +} diff --git a/src/models/components/index.ts b/src/models/components/index.ts index 0beffbfb..9dc6ce6e 100644 --- a/src/models/components/index.ts +++ b/src/models/components/index.ts @@ -98,7 +98,6 @@ export * from "./parcelextra.js"; export * from "./parcelinsurance.js"; export * from "./parcelpaginatedlist.js"; export * from "./parceltemplatearamexaustraliaenum.js"; -export * from "./parceltemplatecourierspleaseenum.js"; export * from "./parceltemplatedhlecommerceenum.js"; export * from "./parceltemplatedpdukenum.js"; export * from "./parceltemplateenumset.js"; @@ -134,7 +133,6 @@ export * from "./servicelevelcdlenum.js"; export * from "./servicelevelchronopostenum.js"; export * from "./servicelevelcolissimoenum.js"; export * from "./servicelevelcorreosespanaenum.js"; -export * from "./servicelevelcourierspleaseenum.js"; export * from "./serviceleveldeutschepostenum.js"; export * from "./serviceleveldhlecommerceenum.js"; export * from "./serviceleveldhlexpressenum.js"; diff --git a/src/models/components/instanttransactioncreaterequest.ts b/src/models/components/instanttransactioncreaterequest.ts index 9911e02b..e54a2b3c 100644 --- a/src/models/components/instanttransactioncreaterequest.ts +++ b/src/models/components/instanttransactioncreaterequest.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ShipmentCreateRequest, ShipmentCreateRequest$inboundSchema, @@ -121,3 +124,23 @@ export namespace InstantTransactionCreateRequest$ { /** @deprecated use `InstantTransactionCreateRequest$Outbound` instead. */ export type Outbound = InstantTransactionCreateRequest$Outbound; } + +export function instantTransactionCreateRequestToJSON( + instantTransactionCreateRequest: InstantTransactionCreateRequest, +): string { + return JSON.stringify( + InstantTransactionCreateRequest$outboundSchema.parse( + instantTransactionCreateRequest, + ), + ); +} + +export function instantTransactionCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => InstantTransactionCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'InstantTransactionCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/insurance.ts b/src/models/components/insurance.ts index 752a4a74..874cfe0d 100644 --- a/src/models/components/insurance.ts +++ b/src/models/components/insurance.ts @@ -3,7 +3,10 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * To have insurance cover provided by a carrier directly instead of Shippo's provider (XCover), set `provider` to `FEDEX`, `UPS`, or `ONTRAC`. @@ -111,3 +114,17 @@ export namespace Insurance$ { /** @deprecated use `Insurance$Outbound` instead. */ export type Outbound = Insurance$Outbound; } + +export function insuranceToJSON(insurance: Insurance): string { + return JSON.stringify(Insurance$outboundSchema.parse(insurance)); +} + +export function insuranceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Insurance$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Insurance' from JSON`, + ); +} diff --git a/src/models/components/invoicenumber.ts b/src/models/components/invoicenumber.ts index e57ef595..b558f37e 100644 --- a/src/models/components/invoicenumber.ts +++ b/src/models/components/invoicenumber.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Specify the invoice number field on the label (FedEx and UPS only). @@ -79,3 +82,17 @@ export namespace InvoiceNumber$ { /** @deprecated use `InvoiceNumber$Outbound` instead. */ export type Outbound = InvoiceNumber$Outbound; } + +export function invoiceNumberToJSON(invoiceNumber: InvoiceNumber): string { + return JSON.stringify(InvoiceNumber$outboundSchema.parse(invoiceNumber)); +} + +export function invoiceNumberFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => InvoiceNumber$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'InvoiceNumber' from JSON`, + ); +} diff --git a/src/models/components/lineitem.ts b/src/models/components/lineitem.ts index d5c84e34..cb88c532 100644 --- a/src/models/components/lineitem.ts +++ b/src/models/components/lineitem.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WeightUnitEnum, WeightUnitEnum$inboundSchema, @@ -168,3 +171,17 @@ export namespace LineItem$ { /** @deprecated use `LineItem$Outbound` instead. */ export type Outbound = LineItem$Outbound; } + +export function lineItemToJSON(lineItem: LineItem): string { + return JSON.stringify(LineItem$outboundSchema.parse(lineItem)); +} + +export function lineItemFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LineItem$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LineItem' from JSON`, + ); +} diff --git a/src/models/components/lineitembase.ts b/src/models/components/lineitembase.ts index 7adff72b..b2a50bff 100644 --- a/src/models/components/lineitembase.ts +++ b/src/models/components/lineitembase.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WeightUnitEnum, WeightUnitEnum$inboundSchema, @@ -159,3 +162,17 @@ export namespace LineItemBase$ { /** @deprecated use `LineItemBase$Outbound` instead. */ export type Outbound = LineItemBase$Outbound; } + +export function lineItemBaseToJSON(lineItemBase: LineItemBase): string { + return JSON.stringify(LineItemBase$outboundSchema.parse(lineItemBase)); +} + +export function lineItemBaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LineItemBase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LineItemBase' from JSON`, + ); +} diff --git a/src/models/components/liverate.ts b/src/models/components/liverate.ts index 7eaec62b..1f82a04e 100644 --- a/src/models/components/liverate.ts +++ b/src/models/components/liverate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type LiveRate = { /** @@ -100,3 +103,17 @@ export namespace LiveRate$ { /** @deprecated use `LiveRate$Outbound` instead. */ export type Outbound = LiveRate$Outbound; } + +export function liveRateToJSON(liveRate: LiveRate): string { + return JSON.stringify(LiveRate$outboundSchema.parse(liveRate)); +} + +export function liveRateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LiveRate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LiveRate' from JSON`, + ); +} diff --git a/src/models/components/liveratecreaterequest.ts b/src/models/components/liveratecreaterequest.ts index 995a9a05..4e00e4e3 100644 --- a/src/models/components/liveratecreaterequest.ts +++ b/src/models/components/liveratecreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressCompleteCreateRequest, AddressCompleteCreateRequest$inboundSchema, @@ -109,6 +112,26 @@ export namespace LiveRateCreateRequestAddressFrom$ { export type Outbound = LiveRateCreateRequestAddressFrom$Outbound; } +export function liveRateCreateRequestAddressFromToJSON( + liveRateCreateRequestAddressFrom: LiveRateCreateRequestAddressFrom, +): string { + return JSON.stringify( + LiveRateCreateRequestAddressFrom$outboundSchema.parse( + liveRateCreateRequestAddressFrom, + ), + ); +} + +export function liveRateCreateRequestAddressFromFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LiveRateCreateRequestAddressFrom$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LiveRateCreateRequestAddressFrom' from JSON`, + ); +} + /** @internal */ export const LiveRateCreateRequestAddressTo$inboundSchema: z.ZodType< LiveRateCreateRequestAddressTo, @@ -141,6 +164,26 @@ export namespace LiveRateCreateRequestAddressTo$ { export type Outbound = LiveRateCreateRequestAddressTo$Outbound; } +export function liveRateCreateRequestAddressToToJSON( + liveRateCreateRequestAddressTo: LiveRateCreateRequestAddressTo, +): string { + return JSON.stringify( + LiveRateCreateRequestAddressTo$outboundSchema.parse( + liveRateCreateRequestAddressTo, + ), + ); +} + +export function liveRateCreateRequestAddressToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LiveRateCreateRequestAddressTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LiveRateCreateRequestAddressTo' from JSON`, + ); +} + /** @internal */ export const LiveRateCreateRequestParcel$inboundSchema: z.ZodType< LiveRateCreateRequestParcel, @@ -171,6 +214,26 @@ export namespace LiveRateCreateRequestParcel$ { export type Outbound = LiveRateCreateRequestParcel$Outbound; } +export function liveRateCreateRequestParcelToJSON( + liveRateCreateRequestParcel: LiveRateCreateRequestParcel, +): string { + return JSON.stringify( + LiveRateCreateRequestParcel$outboundSchema.parse( + liveRateCreateRequestParcel, + ), + ); +} + +export function liveRateCreateRequestParcelFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LiveRateCreateRequestParcel$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LiveRateCreateRequestParcel' from JSON`, + ); +} + /** @internal */ export const LiveRateCreateRequest$inboundSchema: z.ZodType< LiveRateCreateRequest, @@ -233,3 +296,21 @@ export namespace LiveRateCreateRequest$ { /** @deprecated use `LiveRateCreateRequest$Outbound` instead. */ export type Outbound = LiveRateCreateRequest$Outbound; } + +export function liveRateCreateRequestToJSON( + liveRateCreateRequest: LiveRateCreateRequest, +): string { + return JSON.stringify( + LiveRateCreateRequest$outboundSchema.parse(liveRateCreateRequest), + ); +} + +export function liveRateCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LiveRateCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LiveRateCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/liveratepaginatedlist.ts b/src/models/components/liveratepaginatedlist.ts index af1bad9a..08973272 100644 --- a/src/models/components/liveratepaginatedlist.ts +++ b/src/models/components/liveratepaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { LiveRate, LiveRate$inboundSchema, @@ -61,3 +64,21 @@ export namespace LiveRatePaginatedList$ { /** @deprecated use `LiveRatePaginatedList$Outbound` instead. */ export type Outbound = LiveRatePaginatedList$Outbound; } + +export function liveRatePaginatedListToJSON( + liveRatePaginatedList: LiveRatePaginatedList, +): string { + return JSON.stringify( + LiveRatePaginatedList$outboundSchema.parse(liveRatePaginatedList), + ); +} + +export function liveRatePaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => LiveRatePaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'LiveRatePaginatedList' from JSON`, + ); +} diff --git a/src/models/components/location.ts b/src/models/components/location.ts index 75004014..ecb7590c 100644 --- a/src/models/components/location.ts +++ b/src/models/components/location.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressCompleteCreateRequest, AddressCompleteCreateRequest$inboundSchema, @@ -179,3 +182,17 @@ export namespace Location$ { /** @deprecated use `Location$Outbound` instead. */ export type Outbound = Location$Outbound; } + +export function locationToJSON(location: Location): string { + return JSON.stringify(Location$outboundSchema.parse(location)); +} + +export function locationFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Location$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Location' from JSON`, + ); +} diff --git a/src/models/components/manifest.ts b/src/models/components/manifest.ts index fbaafe66..6ccfbee0 100644 --- a/src/models/components/manifest.ts +++ b/src/models/components/manifest.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Indicates the status of the manifest. @@ -185,3 +188,17 @@ export namespace Manifest$ { /** @deprecated use `Manifest$Outbound` instead. */ export type Outbound = Manifest$Outbound; } + +export function manifestToJSON(manifest: Manifest): string { + return JSON.stringify(Manifest$outboundSchema.parse(manifest)); +} + +export function manifestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Manifest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Manifest' from JSON`, + ); +} diff --git a/src/models/components/manifestcreaterequest.ts b/src/models/components/manifestcreaterequest.ts index e0564eba..d187754b 100644 --- a/src/models/components/manifestcreaterequest.ts +++ b/src/models/components/manifestcreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressCreateRequest, AddressCreateRequest$inboundSchema, @@ -68,6 +71,26 @@ export namespace ManifestCreateRequestAddressFrom$ { export type Outbound = ManifestCreateRequestAddressFrom$Outbound; } +export function manifestCreateRequestAddressFromToJSON( + manifestCreateRequestAddressFrom: ManifestCreateRequestAddressFrom, +): string { + return JSON.stringify( + ManifestCreateRequestAddressFrom$outboundSchema.parse( + manifestCreateRequestAddressFrom, + ), + ); +} + +export function manifestCreateRequestAddressFromFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ManifestCreateRequestAddressFrom$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ManifestCreateRequestAddressFrom' from JSON`, + ); +} + /** @internal */ export const ManifestCreateRequest$inboundSchema: z.ZodType< ManifestCreateRequest, @@ -127,3 +150,21 @@ export namespace ManifestCreateRequest$ { /** @deprecated use `ManifestCreateRequest$Outbound` instead. */ export type Outbound = ManifestCreateRequest$Outbound; } + +export function manifestCreateRequestToJSON( + manifestCreateRequest: ManifestCreateRequest, +): string { + return JSON.stringify( + ManifestCreateRequest$outboundSchema.parse(manifestCreateRequest), + ); +} + +export function manifestCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ManifestCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ManifestCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/manifestpaginatedlist.ts b/src/models/components/manifestpaginatedlist.ts index 9726268f..7b0808bc 100644 --- a/src/models/components/manifestpaginatedlist.ts +++ b/src/models/components/manifestpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Manifest, Manifest$inboundSchema, @@ -57,3 +60,21 @@ export namespace ManifestPaginatedList$ { /** @deprecated use `ManifestPaginatedList$Outbound` instead. */ export type Outbound = ManifestPaginatedList$Outbound; } + +export function manifestPaginatedListToJSON( + manifestPaginatedList: ManifestPaginatedList, +): string { + return JSON.stringify( + ManifestPaginatedList$outboundSchema.parse(manifestPaginatedList), + ); +} + +export function manifestPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ManifestPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ManifestPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/order.ts b/src/models/components/order.ts index f4aec338..7ae2d74a 100644 --- a/src/models/components/order.ts +++ b/src/models/components/order.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, @@ -165,6 +168,20 @@ export namespace Transactions$ { export type Outbound = Transactions$Outbound; } +export function transactionsToJSON(transactions: Transactions): string { + return JSON.stringify(Transactions$outboundSchema.parse(transactions)); +} + +export function transactionsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Transactions$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Transactions' from JSON`, + ); +} + /** @internal */ export const Order$inboundSchema: z.ZodType = z .object({ @@ -292,3 +309,17 @@ export namespace Order$ { /** @deprecated use `Order$Outbound` instead. */ export type Outbound = Order$Outbound; } + +export function orderToJSON(order: Order): string { + return JSON.stringify(Order$outboundSchema.parse(order)); +} + +export function orderFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Order$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Order' from JSON`, + ); +} diff --git a/src/models/components/ordercreaterequest.ts b/src/models/components/ordercreaterequest.ts index fa968cbe..7764c1cf 100644 --- a/src/models/components/ordercreaterequest.ts +++ b/src/models/components/ordercreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressCreateRequest, AddressCreateRequest$inboundSchema, @@ -218,3 +221,21 @@ export namespace OrderCreateRequest$ { /** @deprecated use `OrderCreateRequest$Outbound` instead. */ export type Outbound = OrderCreateRequest$Outbound; } + +export function orderCreateRequestToJSON( + orderCreateRequest: OrderCreateRequest, +): string { + return JSON.stringify( + OrderCreateRequest$outboundSchema.parse(orderCreateRequest), + ); +} + +export function orderCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => OrderCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'OrderCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/orderpaginatedlist.ts b/src/models/components/orderpaginatedlist.ts index 1fe007df..6a1df013 100644 --- a/src/models/components/orderpaginatedlist.ts +++ b/src/models/components/orderpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Order, Order$inboundSchema, @@ -57,3 +60,21 @@ export namespace OrderPaginatedList$ { /** @deprecated use `OrderPaginatedList$Outbound` instead. */ export type Outbound = OrderPaginatedList$Outbound; } + +export function orderPaginatedListToJSON( + orderPaginatedList: OrderPaginatedList, +): string { + return JSON.stringify( + OrderPaginatedList$outboundSchema.parse(orderPaginatedList), + ); +} + +export function orderPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => OrderPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'OrderPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/parcel.ts b/src/models/components/parcel.ts index 47253ca1..a1cdf3e2 100644 --- a/src/models/components/parcel.ts +++ b/src/models/components/parcel.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DistanceUnitEnum, DistanceUnitEnum$inboundSchema, @@ -219,3 +222,17 @@ export namespace Parcel$ { /** @deprecated use `Parcel$Outbound` instead. */ export type Outbound = Parcel$Outbound; } + +export function parcelToJSON(parcel: Parcel): string { + return JSON.stringify(Parcel$outboundSchema.parse(parcel)); +} + +export function parcelFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Parcel$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Parcel' from JSON`, + ); +} diff --git a/src/models/components/parcelcreatefromtemplaterequest.ts b/src/models/components/parcelcreatefromtemplaterequest.ts index 156ed1c1..ec69cef9 100644 --- a/src/models/components/parcelcreatefromtemplaterequest.ts +++ b/src/models/components/parcelcreatefromtemplaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ParcelExtra, ParcelExtra$inboundSchema, @@ -100,3 +103,23 @@ export namespace ParcelCreateFromTemplateRequest$ { /** @deprecated use `ParcelCreateFromTemplateRequest$Outbound` instead. */ export type Outbound = ParcelCreateFromTemplateRequest$Outbound; } + +export function parcelCreateFromTemplateRequestToJSON( + parcelCreateFromTemplateRequest: ParcelCreateFromTemplateRequest, +): string { + return JSON.stringify( + ParcelCreateFromTemplateRequest$outboundSchema.parse( + parcelCreateFromTemplateRequest, + ), + ); +} + +export function parcelCreateFromTemplateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParcelCreateFromTemplateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParcelCreateFromTemplateRequest' from JSON`, + ); +} diff --git a/src/models/components/parcelcreaterequest.ts b/src/models/components/parcelcreaterequest.ts index 40e3ecdf..fbd6dbf6 100644 --- a/src/models/components/parcelcreaterequest.ts +++ b/src/models/components/parcelcreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DistanceUnitEnum, DistanceUnitEnum$inboundSchema, @@ -122,3 +125,21 @@ export namespace ParcelCreateRequest$ { /** @deprecated use `ParcelCreateRequest$Outbound` instead. */ export type Outbound = ParcelCreateRequest$Outbound; } + +export function parcelCreateRequestToJSON( + parcelCreateRequest: ParcelCreateRequest, +): string { + return JSON.stringify( + ParcelCreateRequest$outboundSchema.parse(parcelCreateRequest), + ); +} + +export function parcelCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParcelCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParcelCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/parcelextra.ts b/src/models/components/parcelextra.ts index f6c17091..feb56555 100644 --- a/src/models/components/parcelextra.ts +++ b/src/models/components/parcelextra.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Cod, Cod$inboundSchema, @@ -98,3 +101,17 @@ export namespace ParcelExtra$ { /** @deprecated use `ParcelExtra$Outbound` instead. */ export type Outbound = ParcelExtra$Outbound; } + +export function parcelExtraToJSON(parcelExtra: ParcelExtra): string { + return JSON.stringify(ParcelExtra$outboundSchema.parse(parcelExtra)); +} + +export function parcelExtraFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParcelExtra$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParcelExtra' from JSON`, + ); +} diff --git a/src/models/components/parcelinsurance.ts b/src/models/components/parcelinsurance.ts index 9c4f335e..607503f7 100644 --- a/src/models/components/parcelinsurance.ts +++ b/src/models/components/parcelinsurance.ts @@ -3,7 +3,10 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * To have insurance cover provided by a carrier directly instead of Shippo's provider (XCover), set provider to `FEDEX`, `UPS`, or `ONTRAC`. @@ -107,3 +110,19 @@ export namespace ParcelInsurance$ { /** @deprecated use `ParcelInsurance$Outbound` instead. */ export type Outbound = ParcelInsurance$Outbound; } + +export function parcelInsuranceToJSON( + parcelInsurance: ParcelInsurance, +): string { + return JSON.stringify(ParcelInsurance$outboundSchema.parse(parcelInsurance)); +} + +export function parcelInsuranceFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParcelInsurance$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParcelInsurance' from JSON`, + ); +} diff --git a/src/models/components/parcelpaginatedlist.ts b/src/models/components/parcelpaginatedlist.ts index e85bccc1..5ea46e97 100644 --- a/src/models/components/parcelpaginatedlist.ts +++ b/src/models/components/parcelpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Parcel, Parcel$inboundSchema, @@ -57,3 +60,21 @@ export namespace ParcelPaginatedList$ { /** @deprecated use `ParcelPaginatedList$Outbound` instead. */ export type Outbound = ParcelPaginatedList$Outbound; } + +export function parcelPaginatedListToJSON( + parcelPaginatedList: ParcelPaginatedList, +): string { + return JSON.stringify( + ParcelPaginatedList$outboundSchema.parse(parcelPaginatedList), + ); +} + +export function parcelPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParcelPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParcelPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/parceltemplatecourierspleaseenum.ts b/src/models/components/parceltemplatecourierspleaseenum.ts deleted file mode 100644 index 77868bfa..00000000 --- a/src/models/components/parceltemplatecourierspleaseenum.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../../types/enums.js"; - -/** - * |Token | Name | Dimensions| - * - * @remarks - * |:---|:---|:---| - * | couriersplease_500g_satchel | 500g Satchel | 22.00 x 33.50 x 0.10 cm| - * | couriersplease_1kg_satchel | 1kg Satchel | 28.00 x 35.00 x 0.10 cm| - * | couriersplease_3kg_satchel | 3kg Satchel | 34.00 x 42.00 x 0.10 cm| - * | couriersplease_5kg_satchel | 5kg Satchel | 43.70 x 59.70 x 0.10 cm| - */ -export const ParcelTemplateCouriersPleaseEnum = { - Couriersplease500gSatchel: "couriersplease_500g_satchel", - Couriersplease1kgSatchel: "couriersplease_1kg_satchel", - Couriersplease3kgSatchel: "couriersplease_3kg_satchel", - Couriersplease5kgSatchel: "couriersplease_5kg_satchel", -} as const; -/** - * |Token | Name | Dimensions| - * - * @remarks - * |:---|:---|:---| - * | couriersplease_500g_satchel | 500g Satchel | 22.00 x 33.50 x 0.10 cm| - * | couriersplease_1kg_satchel | 1kg Satchel | 28.00 x 35.00 x 0.10 cm| - * | couriersplease_3kg_satchel | 3kg Satchel | 34.00 x 42.00 x 0.10 cm| - * | couriersplease_5kg_satchel | 5kg Satchel | 43.70 x 59.70 x 0.10 cm| - */ -export type ParcelTemplateCouriersPleaseEnum = ClosedEnum< - typeof ParcelTemplateCouriersPleaseEnum ->; - -/** @internal */ -export const ParcelTemplateCouriersPleaseEnum$inboundSchema: z.ZodNativeEnum< - typeof ParcelTemplateCouriersPleaseEnum -> = z.nativeEnum(ParcelTemplateCouriersPleaseEnum); - -/** @internal */ -export const ParcelTemplateCouriersPleaseEnum$outboundSchema: z.ZodNativeEnum< - typeof ParcelTemplateCouriersPleaseEnum -> = ParcelTemplateCouriersPleaseEnum$inboundSchema; - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ParcelTemplateCouriersPleaseEnum$ { - /** @deprecated use `ParcelTemplateCouriersPleaseEnum$inboundSchema` instead. */ - export const inboundSchema = ParcelTemplateCouriersPleaseEnum$inboundSchema; - /** @deprecated use `ParcelTemplateCouriersPleaseEnum$outboundSchema` instead. */ - export const outboundSchema = ParcelTemplateCouriersPleaseEnum$outboundSchema; -} diff --git a/src/models/components/parceltemplateenumset.ts b/src/models/components/parceltemplateenumset.ts index da5e0f12..a1436562 100644 --- a/src/models/components/parceltemplateenumset.ts +++ b/src/models/components/parceltemplateenumset.ts @@ -3,16 +3,14 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ParcelTemplateAramexAustraliaEnum, ParcelTemplateAramexAustraliaEnum$inboundSchema, ParcelTemplateAramexAustraliaEnum$outboundSchema, } from "./parceltemplatearamexaustraliaenum.js"; -import { - ParcelTemplateCouriersPleaseEnum, - ParcelTemplateCouriersPleaseEnum$inboundSchema, - ParcelTemplateCouriersPleaseEnum$outboundSchema, -} from "./parceltemplatecourierspleaseenum.js"; import { ParcelTemplateDHLeCommerceEnum, ParcelTemplateDHLeCommerceEnum$inboundSchema, @@ -48,7 +46,6 @@ export type ParcelTemplateEnumSet = | ParcelTemplateUSPSEnum | ParcelTemplateDHLeCommerceEnum | ParcelTemplateDPDUKEnum - | ParcelTemplateCouriersPleaseEnum | ParcelTemplateAramexAustraliaEnum; /** @internal */ @@ -62,7 +59,6 @@ export const ParcelTemplateEnumSet$inboundSchema: z.ZodType< ParcelTemplateUSPSEnum$inboundSchema, ParcelTemplateDHLeCommerceEnum$inboundSchema, ParcelTemplateDPDUKEnum$inboundSchema, - ParcelTemplateCouriersPleaseEnum$inboundSchema, ParcelTemplateAramexAustraliaEnum$inboundSchema, ]); @@ -73,7 +69,6 @@ export type ParcelTemplateEnumSet$Outbound = | string | string | string - | string | string; /** @internal */ @@ -87,7 +82,6 @@ export const ParcelTemplateEnumSet$outboundSchema: z.ZodType< ParcelTemplateUSPSEnum$outboundSchema, ParcelTemplateDHLeCommerceEnum$outboundSchema, ParcelTemplateDPDUKEnum$outboundSchema, - ParcelTemplateCouriersPleaseEnum$outboundSchema, ParcelTemplateAramexAustraliaEnum$outboundSchema, ]); @@ -103,3 +97,21 @@ export namespace ParcelTemplateEnumSet$ { /** @deprecated use `ParcelTemplateEnumSet$Outbound` instead. */ export type Outbound = ParcelTemplateEnumSet$Outbound; } + +export function parcelTemplateEnumSetToJSON( + parcelTemplateEnumSet: ParcelTemplateEnumSet, +): string { + return JSON.stringify( + ParcelTemplateEnumSet$outboundSchema.parse(parcelTemplateEnumSet), + ); +} + +export function parcelTemplateEnumSetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ParcelTemplateEnumSet$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ParcelTemplateEnumSet' from JSON`, + ); +} diff --git a/src/models/components/pickup.ts b/src/models/components/pickup.ts index 7041c202..fa1a50b0 100644 --- a/src/models/components/pickup.ts +++ b/src/models/components/pickup.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Location, Location$inboundSchema, @@ -257,3 +260,17 @@ export namespace Pickup$ { /** @deprecated use `Pickup$Outbound` instead. */ export type Outbound = Pickup$Outbound; } + +export function pickupToJSON(pickup: Pickup): string { + return JSON.stringify(Pickup$outboundSchema.parse(pickup)); +} + +export function pickupFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Pickup$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Pickup' from JSON`, + ); +} diff --git a/src/models/components/pickupbase.ts b/src/models/components/pickupbase.ts index 0d47a745..fcc09d63 100644 --- a/src/models/components/pickupbase.ts +++ b/src/models/components/pickupbase.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Location, Location$inboundSchema, @@ -116,3 +119,17 @@ export namespace PickupBase$ { /** @deprecated use `PickupBase$Outbound` instead. */ export type Outbound = PickupBase$Outbound; } + +export function pickupBaseToJSON(pickupBase: PickupBase): string { + return JSON.stringify(PickupBase$outboundSchema.parse(pickupBase)); +} + +export function pickupBaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PickupBase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PickupBase' from JSON`, + ); +} diff --git a/src/models/components/ponumber.ts b/src/models/components/ponumber.ts index ae88322d..c44d392b 100644 --- a/src/models/components/ponumber.ts +++ b/src/models/components/ponumber.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Specify the PO number field on the label (FedEx and UPS only). @@ -79,3 +82,17 @@ export namespace PoNumber$ { /** @deprecated use `PoNumber$Outbound` instead. */ export type Outbound = PoNumber$Outbound; } + +export function poNumberToJSON(poNumber: PoNumber): string { + return JSON.stringify(PoNumber$outboundSchema.parse(poNumber)); +} + +export function poNumberFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PoNumber$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PoNumber' from JSON`, + ); +} diff --git a/src/models/components/rate.ts b/src/models/components/rate.ts index ceb626e5..4163b299 100644 --- a/src/models/components/rate.ts +++ b/src/models/components/rate.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ResponseMessage, ResponseMessage$inboundSchema, @@ -269,3 +272,17 @@ export namespace Rate$ { /** @deprecated use `Rate$Outbound` instead. */ export type Outbound = Rate$Outbound; } + +export function rateToJSON(rate: Rate): string { + return JSON.stringify(Rate$outboundSchema.parse(rate)); +} + +export function rateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Rate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Rate' from JSON`, + ); +} diff --git a/src/models/components/ratepaginatedlist.ts b/src/models/components/ratepaginatedlist.ts index 911d9d51..21026494 100644 --- a/src/models/components/ratepaginatedlist.ts +++ b/src/models/components/ratepaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Rate, Rate$inboundSchema, @@ -57,3 +60,21 @@ export namespace RatePaginatedList$ { /** @deprecated use `RatePaginatedList$Outbound` instead. */ export type Outbound = RatePaginatedList$Outbound; } + +export function ratePaginatedListToJSON( + ratePaginatedList: RatePaginatedList, +): string { + return JSON.stringify( + RatePaginatedList$outboundSchema.parse(ratePaginatedList), + ); +} + +export function ratePaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RatePaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RatePaginatedList' from JSON`, + ); +} diff --git a/src/models/components/refund.ts b/src/models/components/refund.ts index e16fb8ca..a431803f 100644 --- a/src/models/components/refund.ts +++ b/src/models/components/refund.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Indicates the status of the Refund. @@ -138,3 +141,17 @@ export namespace Refund$ { /** @deprecated use `Refund$Outbound` instead. */ export type Outbound = Refund$Outbound; } + +export function refundToJSON(refund: Refund): string { + return JSON.stringify(Refund$outboundSchema.parse(refund)); +} + +export function refundFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Refund$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Refund' from JSON`, + ); +} diff --git a/src/models/components/refundpaginatedlist.ts b/src/models/components/refundpaginatedlist.ts index d54f2fc6..6d19788e 100644 --- a/src/models/components/refundpaginatedlist.ts +++ b/src/models/components/refundpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Refund, Refund$inboundSchema, @@ -57,3 +60,21 @@ export namespace RefundPaginatedList$ { /** @deprecated use `RefundPaginatedList$Outbound` instead. */ export type Outbound = RefundPaginatedList$Outbound; } + +export function refundPaginatedListToJSON( + refundPaginatedList: RefundPaginatedList, +): string { + return JSON.stringify( + RefundPaginatedList$outboundSchema.parse(refundPaginatedList), + ); +} + +export function refundPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RefundPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RefundPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/refundrequestbody.ts b/src/models/components/refundrequestbody.ts index 56abae80..a4372c3d 100644 --- a/src/models/components/refundrequestbody.ts +++ b/src/models/components/refundrequestbody.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type RefundRequestBody = { async?: boolean | undefined; @@ -47,3 +50,21 @@ export namespace RefundRequestBody$ { /** @deprecated use `RefundRequestBody$Outbound` instead. */ export type Outbound = RefundRequestBody$Outbound; } + +export function refundRequestBodyToJSON( + refundRequestBody: RefundRequestBody, +): string { + return JSON.stringify( + RefundRequestBody$outboundSchema.parse(refundRequestBody), + ); +} + +export function refundRequestBodyFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RefundRequestBody$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RefundRequestBody' from JSON`, + ); +} diff --git a/src/models/components/responsemessage.ts b/src/models/components/responsemessage.ts index 6c2ed8f1..5d0ecb0a 100644 --- a/src/models/components/responsemessage.ts +++ b/src/models/components/responsemessage.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Message returned with supporting information from a request. In some cases this can be an error message, @@ -66,3 +69,19 @@ export namespace ResponseMessage$ { /** @deprecated use `ResponseMessage$Outbound` instead. */ export type Outbound = ResponseMessage$Outbound; } + +export function responseMessageToJSON( + responseMessage: ResponseMessage, +): string { + return JSON.stringify(ResponseMessage$outboundSchema.parse(responseMessage)); +} + +export function responseMessageFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ResponseMessage$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ResponseMessage' from JSON`, + ); +} diff --git a/src/models/components/rmanumber.ts b/src/models/components/rmanumber.ts index b96fec9f..e93d378a 100644 --- a/src/models/components/rmanumber.ts +++ b/src/models/components/rmanumber.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Specify the RMA number field on the label (FedEx and UPS only). @@ -76,3 +79,17 @@ export namespace RmaNumber$ { /** @deprecated use `RmaNumber$Outbound` instead. */ export type Outbound = RmaNumber$Outbound; } + +export function rmaNumberToJSON(rmaNumber: RmaNumber): string { + return JSON.stringify(RmaNumber$outboundSchema.parse(rmaNumber)); +} + +export function rmaNumberFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RmaNumber$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RmaNumber' from JSON`, + ); +} diff --git a/src/models/components/security.ts b/src/models/components/security.ts index 0ec990b6..abb07bba 100644 --- a/src/models/components/security.ts +++ b/src/models/components/security.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Security = { apiKeyHeader: string; @@ -52,3 +55,17 @@ export namespace Security$ { /** @deprecated use `Security$Outbound` instead. */ export type Outbound = Security$Outbound; } + +export function securityToJSON(security: Security): string { + return JSON.stringify(Security$outboundSchema.parse(security)); +} + +export function securityFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Security$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Security' from JSON`, + ); +} diff --git a/src/models/components/servicegroup.ts b/src/models/components/servicegroup.ts index e5a6b42b..95e66211 100644 --- a/src/models/components/servicegroup.ts +++ b/src/models/components/servicegroup.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ServiceGroupAccountAndServiceLevel, ServiceGroupAccountAndServiceLevel$inboundSchema, @@ -162,3 +165,17 @@ export namespace ServiceGroup$ { /** @deprecated use `ServiceGroup$Outbound` instead. */ export type Outbound = ServiceGroup$Outbound; } + +export function serviceGroupToJSON(serviceGroup: ServiceGroup): string { + return JSON.stringify(ServiceGroup$outboundSchema.parse(serviceGroup)); +} + +export function serviceGroupFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ServiceGroup$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ServiceGroup' from JSON`, + ); +} diff --git a/src/models/components/servicegroupaccountandservicelevel.ts b/src/models/components/servicegroupaccountandservicelevel.ts index 2bf0a5c8..12a49d70 100644 --- a/src/models/components/servicegroupaccountandservicelevel.ts +++ b/src/models/components/servicegroupaccountandservicelevel.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ServiceGroupAccountAndServiceLevel = { /** @@ -68,3 +71,24 @@ export namespace ServiceGroupAccountAndServiceLevel$ { /** @deprecated use `ServiceGroupAccountAndServiceLevel$Outbound` instead. */ export type Outbound = ServiceGroupAccountAndServiceLevel$Outbound; } + +export function serviceGroupAccountAndServiceLevelToJSON( + serviceGroupAccountAndServiceLevel: ServiceGroupAccountAndServiceLevel, +): string { + return JSON.stringify( + ServiceGroupAccountAndServiceLevel$outboundSchema.parse( + serviceGroupAccountAndServiceLevel, + ), + ); +} + +export function serviceGroupAccountAndServiceLevelFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + ServiceGroupAccountAndServiceLevel$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ServiceGroupAccountAndServiceLevel' from JSON`, + ); +} diff --git a/src/models/components/servicegroupcreaterequest.ts b/src/models/components/servicegroupcreaterequest.ts index 7ca6d15e..f3014af8 100644 --- a/src/models/components/servicegroupcreaterequest.ts +++ b/src/models/components/servicegroupcreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ServiceGroupAccountAndServiceLevel, ServiceGroupAccountAndServiceLevel$inboundSchema, @@ -144,3 +147,21 @@ export namespace ServiceGroupCreateRequest$ { /** @deprecated use `ServiceGroupCreateRequest$Outbound` instead. */ export type Outbound = ServiceGroupCreateRequest$Outbound; } + +export function serviceGroupCreateRequestToJSON( + serviceGroupCreateRequest: ServiceGroupCreateRequest, +): string { + return JSON.stringify( + ServiceGroupCreateRequest$outboundSchema.parse(serviceGroupCreateRequest), + ); +} + +export function serviceGroupCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ServiceGroupCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ServiceGroupCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/servicegroupupdaterequest.ts b/src/models/components/servicegroupupdaterequest.ts index 0e2a5355..28415dcf 100644 --- a/src/models/components/servicegroupupdaterequest.ts +++ b/src/models/components/servicegroupupdaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ServiceGroupAccountAndServiceLevel, ServiceGroupAccountAndServiceLevel$inboundSchema, @@ -162,3 +165,21 @@ export namespace ServiceGroupUpdateRequest$ { /** @deprecated use `ServiceGroupUpdateRequest$Outbound` instead. */ export type Outbound = ServiceGroupUpdateRequest$Outbound; } + +export function serviceGroupUpdateRequestToJSON( + serviceGroupUpdateRequest: ServiceGroupUpdateRequest, +): string { + return JSON.stringify( + ServiceGroupUpdateRequest$outboundSchema.parse(serviceGroupUpdateRequest), + ); +} + +export function serviceGroupUpdateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ServiceGroupUpdateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ServiceGroupUpdateRequest' from JSON`, + ); +} diff --git a/src/models/components/servicelevel.ts b/src/models/components/servicelevel.ts index 4103082a..aecef16a 100644 --- a/src/models/components/servicelevel.ts +++ b/src/models/components/servicelevel.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * Used for some Service Levels to link to the more "generic" version of this Service Level - for example, @@ -94,3 +97,17 @@ export namespace ServiceLevel$ { /** @deprecated use `ServiceLevel$Outbound` instead. */ export type Outbound = ServiceLevel$Outbound; } + +export function serviceLevelToJSON(serviceLevel: ServiceLevel): string { + return JSON.stringify(ServiceLevel$outboundSchema.parse(serviceLevel)); +} + +export function serviceLevelFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ServiceLevel$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ServiceLevel' from JSON`, + ); +} diff --git a/src/models/components/servicelevelcourierspleaseenum.ts b/src/models/components/servicelevelcourierspleaseenum.ts deleted file mode 100644 index b5852afb..00000000 --- a/src/models/components/servicelevelcourierspleaseenum.ts +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. - */ - -import * as z from "zod"; -import { ClosedEnum } from "../../types/enums.js"; - -/** - * |Token | Service name| - * - * @remarks - * |:---|:---| - * | couriersplease_domestic_priority_auth_to_leave | Domestic Priority - Authority To Leave/POPPoints| - * | couriersplease_domestic_priority_sign_required | Domestic Priority - Signature Required| - * | couriersplease_gold_domestic_auth_to_leave | Gold Domestic - Authority To Leave/POPPoints| - * | couriersplease_gold_domestic_sign_required | Gold Domestic - Signature Required| - * | couriersplease_off_peak_auth_to_leave | Off Peak - Authority To Leave/POPPoints| - * | couriersplease_off_peak_sign_required | Off Peak - Signature Required| - * | couriersplease_parcel_auth_to_leave | Parcel - Authority To Leave| - * | couriersplease_parcel_sign_required | Parcel - Signature Required| - * | couriersplease_road_express | Road Express| - * | couriersplease_satchel_auth_to_leave | Satchel - Authority To Leave| - * | couriersplease_satchel_sign_required | Satchel - Signature Required| - */ -export const ServiceLevelCouriersPleaseEnum = { - CourierspleaseDomesticPriorityAuthToLeave: - "couriersplease_domestic_priority_auth_to_leave", - CourierspleaseDomesticPrioritySignRequired: - "couriersplease_domestic_priority_sign_required", - CourierspleaseGoldDomesticAuthToLeave: - "couriersplease_gold_domestic_auth_to_leave", - CourierspleaseGoldDomesticSignRequired: - "couriersplease_gold_domestic_sign_required", - CourierspleaseOffPeakAuthToLeave: "couriersplease_off_peak_auth_to_leave", - CourierspleaseOffPeakSignRequired: "couriersplease_off_peak_sign_required", - CourierspleaseParcelAuthToLeave: "couriersplease_parcel_auth_to_leave", - CourierspleaseParcelSignRequired: "couriersplease_parcel_sign_required", - CourierspleaseRoadExpress: "couriersplease_road_express", - CourierspleaseSatchelAuthToLeave: "couriersplease_satchel_auth_to_leave", - CourierspleaseSatchelSignRequired: "couriersplease_satchel_sign_required", -} as const; -/** - * |Token | Service name| - * - * @remarks - * |:---|:---| - * | couriersplease_domestic_priority_auth_to_leave | Domestic Priority - Authority To Leave/POPPoints| - * | couriersplease_domestic_priority_sign_required | Domestic Priority - Signature Required| - * | couriersplease_gold_domestic_auth_to_leave | Gold Domestic - Authority To Leave/POPPoints| - * | couriersplease_gold_domestic_sign_required | Gold Domestic - Signature Required| - * | couriersplease_off_peak_auth_to_leave | Off Peak - Authority To Leave/POPPoints| - * | couriersplease_off_peak_sign_required | Off Peak - Signature Required| - * | couriersplease_parcel_auth_to_leave | Parcel - Authority To Leave| - * | couriersplease_parcel_sign_required | Parcel - Signature Required| - * | couriersplease_road_express | Road Express| - * | couriersplease_satchel_auth_to_leave | Satchel - Authority To Leave| - * | couriersplease_satchel_sign_required | Satchel - Signature Required| - */ -export type ServiceLevelCouriersPleaseEnum = ClosedEnum< - typeof ServiceLevelCouriersPleaseEnum ->; - -/** @internal */ -export const ServiceLevelCouriersPleaseEnum$inboundSchema: z.ZodNativeEnum< - typeof ServiceLevelCouriersPleaseEnum -> = z.nativeEnum(ServiceLevelCouriersPleaseEnum); - -/** @internal */ -export const ServiceLevelCouriersPleaseEnum$outboundSchema: z.ZodNativeEnum< - typeof ServiceLevelCouriersPleaseEnum -> = ServiceLevelCouriersPleaseEnum$inboundSchema; - -/** - * @internal - * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. - */ -export namespace ServiceLevelCouriersPleaseEnum$ { - /** @deprecated use `ServiceLevelCouriersPleaseEnum$inboundSchema` instead. */ - export const inboundSchema = ServiceLevelCouriersPleaseEnum$inboundSchema; - /** @deprecated use `ServiceLevelCouriersPleaseEnum$outboundSchema` instead. */ - export const outboundSchema = ServiceLevelCouriersPleaseEnum$outboundSchema; -} diff --git a/src/models/components/servicelevelenumset.ts b/src/models/components/servicelevelenumset.ts index c7b34645..e7165148 100644 --- a/src/models/components/servicelevelenumset.ts +++ b/src/models/components/servicelevelenumset.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ServiceLevelAirterraEnum, ServiceLevelAirterraEnum$inboundSchema, @@ -63,11 +66,6 @@ import { ServiceLevelCorreosEspanaEnum$inboundSchema, ServiceLevelCorreosEspanaEnum$outboundSchema, } from "./servicelevelcorreosespanaenum.js"; -import { - ServiceLevelCouriersPleaseEnum, - ServiceLevelCouriersPleaseEnum$inboundSchema, - ServiceLevelCouriersPleaseEnum$outboundSchema, -} from "./servicelevelcourierspleaseenum.js"; import { ServiceLevelDeutschePostEnum, ServiceLevelDeutschePostEnum$inboundSchema, @@ -212,7 +210,6 @@ export type ServiceLevelEnumSet = | ServiceLevelCanadaPostEnum | ServiceLevelCDLEnum | ServiceLevelChronopostEnum - | ServiceLevelCouriersPleaseEnum | ServiceLevelCorreosEspanaEnum | ServiceLevelColissimoEnum | ServiceLevelPurolatorEnum @@ -258,7 +255,6 @@ export const ServiceLevelEnumSet$inboundSchema: z.ZodType< ServiceLevelCanadaPostEnum$inboundSchema, ServiceLevelCDLEnum$inboundSchema, ServiceLevelChronopostEnum$inboundSchema, - ServiceLevelCouriersPleaseEnum$inboundSchema, ServiceLevelCorreosEspanaEnum$inboundSchema, ServiceLevelColissimoEnum$inboundSchema, ServiceLevelPurolatorEnum$inboundSchema, @@ -326,7 +322,6 @@ export type ServiceLevelEnumSet$Outbound = | string | string | string - | string | string; /** @internal */ @@ -347,7 +342,6 @@ export const ServiceLevelEnumSet$outboundSchema: z.ZodType< ServiceLevelCanadaPostEnum$outboundSchema, ServiceLevelCDLEnum$outboundSchema, ServiceLevelChronopostEnum$outboundSchema, - ServiceLevelCouriersPleaseEnum$outboundSchema, ServiceLevelCorreosEspanaEnum$outboundSchema, ServiceLevelColissimoEnum$outboundSchema, ServiceLevelPurolatorEnum$outboundSchema, @@ -388,3 +382,21 @@ export namespace ServiceLevelEnumSet$ { /** @deprecated use `ServiceLevelEnumSet$Outbound` instead. */ export type Outbound = ServiceLevelEnumSet$Outbound; } + +export function serviceLevelEnumSetToJSON( + serviceLevelEnumSet: ServiceLevelEnumSet, +): string { + return JSON.stringify( + ServiceLevelEnumSet$outboundSchema.parse(serviceLevelEnumSet), + ); +} + +export function serviceLevelEnumSetFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ServiceLevelEnumSet$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ServiceLevelEnumSet' from JSON`, + ); +} diff --git a/src/models/components/servicelevelwithparent.ts b/src/models/components/servicelevelwithparent.ts index e078d75d..7ac4bf55 100644 --- a/src/models/components/servicelevelwithparent.ts +++ b/src/models/components/servicelevelwithparent.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ServiceLevel, ServiceLevel$inboundSchema, @@ -101,3 +104,21 @@ export namespace ServiceLevelWithParent$ { /** @deprecated use `ServiceLevelWithParent$Outbound` instead. */ export type Outbound = ServiceLevelWithParent$Outbound; } + +export function serviceLevelWithParentToJSON( + serviceLevelWithParent: ServiceLevelWithParent, +): string { + return JSON.stringify( + ServiceLevelWithParent$outboundSchema.parse(serviceLevelWithParent), + ); +} + +export function serviceLevelWithParentFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ServiceLevelWithParent$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ServiceLevelWithParent' from JSON`, + ); +} diff --git a/src/models/components/shipment.ts b/src/models/components/shipment.ts index 0c4c5da9..803ac960 100644 --- a/src/models/components/shipment.ts +++ b/src/models/components/shipment.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Address, Address$inboundSchema, @@ -289,3 +292,17 @@ export namespace Shipment$ { /** @deprecated use `Shipment$Outbound` instead. */ export type Outbound = Shipment$Outbound; } + +export function shipmentToJSON(shipment: Shipment): string { + return JSON.stringify(Shipment$outboundSchema.parse(shipment)); +} + +export function shipmentFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Shipment$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Shipment' from JSON`, + ); +} diff --git a/src/models/components/shipmentcreaterequest.ts b/src/models/components/shipmentcreaterequest.ts index e6714737..77fa26d9 100644 --- a/src/models/components/shipmentcreaterequest.ts +++ b/src/models/components/shipmentcreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { AddressCreateRequest, AddressCreateRequest$inboundSchema, @@ -114,6 +117,20 @@ export namespace AddressFrom$ { export type Outbound = AddressFrom$Outbound; } +export function addressFromToJSON(addressFrom: AddressFrom): string { + return JSON.stringify(AddressFrom$outboundSchema.parse(addressFrom)); +} + +export function addressFromFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressFrom$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressFrom' from JSON`, + ); +} + /** @internal */ export const AddressReturn$inboundSchema: z.ZodType< AddressReturn, @@ -144,6 +161,20 @@ export namespace AddressReturn$ { export type Outbound = AddressReturn$Outbound; } +export function addressReturnToJSON(addressReturn: AddressReturn): string { + return JSON.stringify(AddressReturn$outboundSchema.parse(addressReturn)); +} + +export function addressReturnFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressReturn$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressReturn' from JSON`, + ); +} + /** @internal */ export const AddressTo$inboundSchema: z.ZodType< AddressTo, @@ -174,6 +205,20 @@ export namespace AddressTo$ { export type Outbound = AddressTo$Outbound; } +export function addressToToJSON(addressTo: AddressTo): string { + return JSON.stringify(AddressTo$outboundSchema.parse(addressTo)); +} + +export function addressToFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddressTo$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddressTo' from JSON`, + ); +} + /** @internal */ export const ShipmentCreateRequestCustomsDeclaration$inboundSchema: z.ZodType< ShipmentCreateRequestCustomsDeclaration, @@ -208,6 +253,33 @@ export namespace ShipmentCreateRequestCustomsDeclaration$ { export type Outbound = ShipmentCreateRequestCustomsDeclaration$Outbound; } +export function shipmentCreateRequestCustomsDeclarationToJSON( + shipmentCreateRequestCustomsDeclaration: + ShipmentCreateRequestCustomsDeclaration, +): string { + return JSON.stringify( + ShipmentCreateRequestCustomsDeclaration$outboundSchema.parse( + shipmentCreateRequestCustomsDeclaration, + ), + ); +} + +export function shipmentCreateRequestCustomsDeclarationFromJSON( + jsonString: string, +): SafeParseResult< + ShipmentCreateRequestCustomsDeclaration, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + ShipmentCreateRequestCustomsDeclaration$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'ShipmentCreateRequestCustomsDeclaration' from JSON`, + ); +} + /** @internal */ export const Parcels$inboundSchema: z.ZodType = z.union([ @@ -246,6 +318,20 @@ export namespace Parcels$ { export type Outbound = Parcels$Outbound; } +export function parcelsToJSON(parcels: Parcels): string { + return JSON.stringify(Parcels$outboundSchema.parse(parcels)); +} + +export function parcelsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Parcels$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Parcels' from JSON`, + ); +} + /** @internal */ export const ShipmentCreateRequest$inboundSchema: z.ZodType< ShipmentCreateRequest, @@ -353,3 +439,21 @@ export namespace ShipmentCreateRequest$ { /** @deprecated use `ShipmentCreateRequest$Outbound` instead. */ export type Outbound = ShipmentCreateRequest$Outbound; } + +export function shipmentCreateRequestToJSON( + shipmentCreateRequest: ShipmentCreateRequest, +): string { + return JSON.stringify( + ShipmentCreateRequest$outboundSchema.parse(shipmentCreateRequest), + ); +} + +export function shipmentCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ShipmentCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ShipmentCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/shipmentextra.ts b/src/models/components/shipmentextra.ts index 208cb69c..83836dd4 100644 --- a/src/models/components/shipmentextra.ts +++ b/src/models/components/shipmentextra.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Alcohol, Alcohol$inboundSchema, @@ -452,6 +455,24 @@ export namespace ReturnServiceType$ { export type Outbound = ReturnServiceType$Outbound; } +export function returnServiceTypeToJSON( + returnServiceType: ReturnServiceType, +): string { + return JSON.stringify( + ReturnServiceType$outboundSchema.parse(returnServiceType), + ); +} + +export function returnServiceTypeFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ReturnServiceType$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ReturnServiceType' from JSON`, + ); +} + /** @internal */ export const SignatureConfirmation$inboundSchema: z.ZodNativeEnum< typeof SignatureConfirmation @@ -767,3 +788,17 @@ export namespace ShipmentExtra$ { /** @deprecated use `ShipmentExtra$Outbound` instead. */ export type Outbound = ShipmentExtra$Outbound; } + +export function shipmentExtraToJSON(shipmentExtra: ShipmentExtra): string { + return JSON.stringify(ShipmentExtra$outboundSchema.parse(shipmentExtra)); +} + +export function shipmentExtraFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ShipmentExtra$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ShipmentExtra' from JSON`, + ); +} diff --git a/src/models/components/shipmentpaginatedlist.ts b/src/models/components/shipmentpaginatedlist.ts index ba918689..fc20b812 100644 --- a/src/models/components/shipmentpaginatedlist.ts +++ b/src/models/components/shipmentpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Shipment, Shipment$inboundSchema, @@ -57,3 +60,21 @@ export namespace ShipmentPaginatedList$ { /** @deprecated use `ShipmentPaginatedList$Outbound` instead. */ export type Outbound = ShipmentPaginatedList$Outbound; } + +export function shipmentPaginatedListToJSON( + shipmentPaginatedList: ShipmentPaginatedList, +): string { + return JSON.stringify( + ShipmentPaginatedList$outboundSchema.parse(shipmentPaginatedList), + ); +} + +export function shipmentPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ShipmentPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ShipmentPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/shippoaccount.ts b/src/models/components/shippoaccount.ts index 1de468cf..acda89d7 100644 --- a/src/models/components/shippoaccount.ts +++ b/src/models/components/shippoaccount.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ShippoAccount = { email: string; @@ -90,3 +93,17 @@ export namespace ShippoAccount$ { /** @deprecated use `ShippoAccount$Outbound` instead. */ export type Outbound = ShippoAccount$Outbound; } + +export function shippoAccountToJSON(shippoAccount: ShippoAccount): string { + return JSON.stringify(ShippoAccount$outboundSchema.parse(shippoAccount)); +} + +export function shippoAccountFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ShippoAccount$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ShippoAccount' from JSON`, + ); +} diff --git a/src/models/components/shippoaccountpaginatedlist.ts b/src/models/components/shippoaccountpaginatedlist.ts index bbfa1498..a52a54cf 100644 --- a/src/models/components/shippoaccountpaginatedlist.ts +++ b/src/models/components/shippoaccountpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ShippoAccount, ShippoAccount$inboundSchema, @@ -57,3 +60,21 @@ export namespace ShippoAccountPaginatedList$ { /** @deprecated use `ShippoAccountPaginatedList$Outbound` instead. */ export type Outbound = ShippoAccountPaginatedList$Outbound; } + +export function shippoAccountPaginatedListToJSON( + shippoAccountPaginatedList: ShippoAccountPaginatedList, +): string { + return JSON.stringify( + ShippoAccountPaginatedList$outboundSchema.parse(shippoAccountPaginatedList), + ); +} + +export function shippoAccountPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ShippoAccountPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ShippoAccountPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/shippoaccountupdaterequest.ts b/src/models/components/shippoaccountupdaterequest.ts index 49ba7457..a6eb38c7 100644 --- a/src/models/components/shippoaccountupdaterequest.ts +++ b/src/models/components/shippoaccountupdaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ShippoAccountUpdateRequest = { email: string; @@ -68,3 +71,21 @@ export namespace ShippoAccountUpdateRequest$ { /** @deprecated use `ShippoAccountUpdateRequest$Outbound` instead. */ export type Outbound = ShippoAccountUpdateRequest$Outbound; } + +export function shippoAccountUpdateRequestToJSON( + shippoAccountUpdateRequest: ShippoAccountUpdateRequest, +): string { + return JSON.stringify( + ShippoAccountUpdateRequest$outboundSchema.parse(shippoAccountUpdateRequest), + ); +} + +export function shippoAccountUpdateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ShippoAccountUpdateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ShippoAccountUpdateRequest' from JSON`, + ); +} diff --git a/src/models/components/track.ts b/src/models/components/track.ts index 17cfbcdf..696c399f 100644 --- a/src/models/components/track.ts +++ b/src/models/components/track.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { ServiceLevelWithParent, ServiceLevelWithParent$inboundSchema, @@ -160,3 +163,17 @@ export namespace Track$ { /** @deprecated use `Track$Outbound` instead. */ export type Outbound = Track$Outbound; } + +export function trackToJSON(track: Track): string { + return JSON.stringify(Track$outboundSchema.parse(track)); +} + +export function trackFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Track$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Track' from JSON`, + ); +} diff --git a/src/models/components/trackingstatus.ts b/src/models/components/trackingstatus.ts index d119a061..afadb8eb 100644 --- a/src/models/components/trackingstatus.ts +++ b/src/models/components/trackingstatus.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { TrackingStatusEnum, TrackingStatusEnum$inboundSchema, @@ -128,3 +131,17 @@ export namespace TrackingStatus$ { /** @deprecated use `TrackingStatus$Outbound` instead. */ export type Outbound = TrackingStatus$Outbound; } + +export function trackingStatusToJSON(trackingStatus: TrackingStatus): string { + return JSON.stringify(TrackingStatus$outboundSchema.parse(trackingStatus)); +} + +export function trackingStatusFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackingStatus$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackingStatus' from JSON`, + ); +} diff --git a/src/models/components/trackingstatuslocationbase.ts b/src/models/components/trackingstatuslocationbase.ts index f3559f49..06903235 100644 --- a/src/models/components/trackingstatuslocationbase.ts +++ b/src/models/components/trackingstatuslocationbase.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type TrackingStatusLocationBase = { city?: string | undefined; @@ -55,3 +58,21 @@ export namespace TrackingStatusLocationBase$ { /** @deprecated use `TrackingStatusLocationBase$Outbound` instead. */ export type Outbound = TrackingStatusLocationBase$Outbound; } + +export function trackingStatusLocationBaseToJSON( + trackingStatusLocationBase: TrackingStatusLocationBase, +): string { + return JSON.stringify( + TrackingStatusLocationBase$outboundSchema.parse(trackingStatusLocationBase), + ); +} + +export function trackingStatusLocationBaseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackingStatusLocationBase$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackingStatusLocationBase' from JSON`, + ); +} diff --git a/src/models/components/trackingstatussubstatus.ts b/src/models/components/trackingstatussubstatus.ts index 2e9c7f0b..22dd93ad 100644 --- a/src/models/components/trackingstatussubstatus.ts +++ b/src/models/components/trackingstatussubstatus.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * A finer-grained classification of the tracking event. @@ -72,3 +75,21 @@ export namespace TrackingStatusSubstatus$ { /** @deprecated use `TrackingStatusSubstatus$Outbound` instead. */ export type Outbound = TrackingStatusSubstatus$Outbound; } + +export function trackingStatusSubstatusToJSON( + trackingStatusSubstatus: TrackingStatusSubstatus, +): string { + return JSON.stringify( + TrackingStatusSubstatus$outboundSchema.parse(trackingStatusSubstatus), + ); +} + +export function trackingStatusSubstatusFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TrackingStatusSubstatus$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TrackingStatusSubstatus' from JSON`, + ); +} diff --git a/src/models/components/tracksrequest.ts b/src/models/components/tracksrequest.ts index 0abbfc26..cbee0ad8 100644 --- a/src/models/components/tracksrequest.ts +++ b/src/models/components/tracksrequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type TracksRequest = { /** @@ -69,3 +72,17 @@ export namespace TracksRequest$ { /** @deprecated use `TracksRequest$Outbound` instead. */ export type Outbound = TracksRequest$Outbound; } + +export function tracksRequestToJSON(tracksRequest: TracksRequest): string { + return JSON.stringify(TracksRequest$outboundSchema.parse(tracksRequest)); +} + +export function tracksRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TracksRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TracksRequest' from JSON`, + ); +} diff --git a/src/models/components/transaction.ts b/src/models/components/transaction.ts index 1e1ef9fa..d80071f2 100644 --- a/src/models/components/transaction.ts +++ b/src/models/components/transaction.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CoreRate, CoreRate$inboundSchema, @@ -216,6 +219,20 @@ export namespace CreatedBy$ { export type Outbound = CreatedBy$Outbound; } +export function createdByToJSON(createdBy: CreatedBy): string { + return JSON.stringify(CreatedBy$outboundSchema.parse(createdBy)); +} + +export function createdByFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatedBy$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatedBy' from JSON`, + ); +} + /** @internal */ export const TransactionRate$inboundSchema: z.ZodType< TransactionRate, @@ -246,6 +263,22 @@ export namespace TransactionRate$ { export type Outbound = TransactionRate$Outbound; } +export function transactionRateToJSON( + transactionRate: TransactionRate, +): string { + return JSON.stringify(TransactionRate$outboundSchema.parse(transactionRate)); +} + +export function transactionRateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TransactionRate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TransactionRate' from JSON`, + ); +} + /** @internal */ export const Transaction$inboundSchema: z.ZodType< Transaction, @@ -374,3 +407,17 @@ export namespace Transaction$ { /** @deprecated use `Transaction$Outbound` instead. */ export type Outbound = Transaction$Outbound; } + +export function transactionToJSON(transaction: Transaction): string { + return JSON.stringify(Transaction$outboundSchema.parse(transaction)); +} + +export function transactionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Transaction$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Transaction' from JSON`, + ); +} diff --git a/src/models/components/transactioncreaterequest.ts b/src/models/components/transactioncreaterequest.ts index b53c5127..39d94c8d 100644 --- a/src/models/components/transactioncreaterequest.ts +++ b/src/models/components/transactioncreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { LabelFileTypeEnum, LabelFileTypeEnum$inboundSchema, @@ -79,3 +82,21 @@ export namespace TransactionCreateRequest$ { /** @deprecated use `TransactionCreateRequest$Outbound` instead. */ export type Outbound = TransactionCreateRequest$Outbound; } + +export function transactionCreateRequestToJSON( + transactionCreateRequest: TransactionCreateRequest, +): string { + return JSON.stringify( + TransactionCreateRequest$outboundSchema.parse(transactionCreateRequest), + ); +} + +export function transactionCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TransactionCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TransactionCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/transactionpaginatedlist.ts b/src/models/components/transactionpaginatedlist.ts index 9a3f5e91..c1e46f8e 100644 --- a/src/models/components/transactionpaginatedlist.ts +++ b/src/models/components/transactionpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Transaction, Transaction$inboundSchema, @@ -57,3 +60,21 @@ export namespace TransactionPaginatedList$ { /** @deprecated use `TransactionPaginatedList$Outbound` instead. */ export type Outbound = TransactionPaginatedList$Outbound; } + +export function transactionPaginatedListToJSON( + transactionPaginatedList: TransactionPaginatedList, +): string { + return JSON.stringify( + TransactionPaginatedList$outboundSchema.parse(transactionPaginatedList), + ); +} + +export function transactionPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => TransactionPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'TransactionPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/upsconnectexistingownaccountparameters.ts b/src/models/components/upsconnectexistingownaccountparameters.ts index b6999436..ba0b33f8 100644 --- a/src/models/components/upsconnectexistingownaccountparameters.ts +++ b/src/models/components/upsconnectexistingownaccountparameters.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; /** * An array of additional parameters for the account, such as e.g. password or token. @@ -215,3 +218,25 @@ export namespace UPSConnectExistingOwnAccountParameters$ { /** @deprecated use `UPSConnectExistingOwnAccountParameters$Outbound` instead. */ export type Outbound = UPSConnectExistingOwnAccountParameters$Outbound; } + +export function upsConnectExistingOwnAccountParametersToJSON( + upsConnectExistingOwnAccountParameters: + UPSConnectExistingOwnAccountParameters, +): string { + return JSON.stringify( + UPSConnectExistingOwnAccountParameters$outboundSchema.parse( + upsConnectExistingOwnAccountParameters, + ), + ); +} + +export function upsConnectExistingOwnAccountParametersFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + UPSConnectExistingOwnAccountParameters$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UPSConnectExistingOwnAccountParameters' from JSON`, + ); +} diff --git a/src/models/components/upsreferencefields.ts b/src/models/components/upsreferencefields.ts index c519c31a..cf904ad3 100644 --- a/src/models/components/upsreferencefields.ts +++ b/src/models/components/upsreferencefields.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UPSReferenceFields = { /** @@ -69,3 +72,21 @@ export namespace UPSReferenceFields$ { /** @deprecated use `UPSReferenceFields$Outbound` instead. */ export type Outbound = UPSReferenceFields$Outbound; } + +export function upsReferenceFieldsToJSON( + upsReferenceFields: UPSReferenceFields, +): string { + return JSON.stringify( + UPSReferenceFields$outboundSchema.parse(upsReferenceFields), + ); +} + +export function upsReferenceFieldsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UPSReferenceFields$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UPSReferenceFields' from JSON`, + ); +} diff --git a/src/models/components/userparceltemplate.ts b/src/models/components/userparceltemplate.ts index ce2242e8..12ddafeb 100644 --- a/src/models/components/userparceltemplate.ts +++ b/src/models/components/userparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CarrierParcelTemplate, CarrierParcelTemplate$inboundSchema, @@ -159,3 +162,21 @@ export namespace UserParcelTemplate$ { /** @deprecated use `UserParcelTemplate$Outbound` instead. */ export type Outbound = UserParcelTemplate$Outbound; } + +export function userParcelTemplateToJSON( + userParcelTemplate: UserParcelTemplate, +): string { + return JSON.stringify( + UserParcelTemplate$outboundSchema.parse(userParcelTemplate), + ); +} + +export function userParcelTemplateFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UserParcelTemplate$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UserParcelTemplate' from JSON`, + ); +} diff --git a/src/models/components/userparceltemplatecreaterequest.ts b/src/models/components/userparceltemplatecreaterequest.ts index f8dfe006..8ff9136f 100644 --- a/src/models/components/userparceltemplatecreaterequest.ts +++ b/src/models/components/userparceltemplatecreaterequest.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { UserParcelTemplateWithCarrierTemplateCreateRequest, UserParcelTemplateWithCarrierTemplateCreateRequest$inboundSchema, @@ -57,3 +60,23 @@ export namespace UserParcelTemplateCreateRequest$ { /** @deprecated use `UserParcelTemplateCreateRequest$Outbound` instead. */ export type Outbound = UserParcelTemplateCreateRequest$Outbound; } + +export function userParcelTemplateCreateRequestToJSON( + userParcelTemplateCreateRequest: UserParcelTemplateCreateRequest, +): string { + return JSON.stringify( + UserParcelTemplateCreateRequest$outboundSchema.parse( + userParcelTemplateCreateRequest, + ), + ); +} + +export function userParcelTemplateCreateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UserParcelTemplateCreateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UserParcelTemplateCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/userparceltemplatelist.ts b/src/models/components/userparceltemplatelist.ts index 0a34dcd5..e6b09d7f 100644 --- a/src/models/components/userparceltemplatelist.ts +++ b/src/models/components/userparceltemplatelist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { UserParcelTemplate, UserParcelTemplate$inboundSchema, @@ -49,3 +52,21 @@ export namespace UserParcelTemplateList$ { /** @deprecated use `UserParcelTemplateList$Outbound` instead. */ export type Outbound = UserParcelTemplateList$Outbound; } + +export function userParcelTemplateListToJSON( + userParcelTemplateList: UserParcelTemplateList, +): string { + return JSON.stringify( + UserParcelTemplateList$outboundSchema.parse(userParcelTemplateList), + ); +} + +export function userParcelTemplateListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UserParcelTemplateList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UserParcelTemplateList' from JSON`, + ); +} diff --git a/src/models/components/userparceltemplateupdaterequest.ts b/src/models/components/userparceltemplateupdaterequest.ts index f74763b2..5775a410 100644 --- a/src/models/components/userparceltemplateupdaterequest.ts +++ b/src/models/components/userparceltemplateupdaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DistanceUnitEnum, DistanceUnitEnum$inboundSchema, @@ -109,3 +112,23 @@ export namespace UserParcelTemplateUpdateRequest$ { /** @deprecated use `UserParcelTemplateUpdateRequest$Outbound` instead. */ export type Outbound = UserParcelTemplateUpdateRequest$Outbound; } + +export function userParcelTemplateUpdateRequestToJSON( + userParcelTemplateUpdateRequest: UserParcelTemplateUpdateRequest, +): string { + return JSON.stringify( + UserParcelTemplateUpdateRequest$outboundSchema.parse( + userParcelTemplateUpdateRequest, + ), + ); +} + +export function userParcelTemplateUpdateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UserParcelTemplateUpdateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UserParcelTemplateUpdateRequest' from JSON`, + ); +} diff --git a/src/models/components/userparceltemplatewithcarriertemplatecreaterequest.ts b/src/models/components/userparceltemplatewithcarriertemplatecreaterequest.ts index 003e2570..97758dff 100644 --- a/src/models/components/userparceltemplatewithcarriertemplatecreaterequest.ts +++ b/src/models/components/userparceltemplatewithcarriertemplatecreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WeightUnitEnum, WeightUnitEnum$inboundSchema, @@ -79,3 +82,30 @@ export namespace UserParcelTemplateWithCarrierTemplateCreateRequest$ { export type Outbound = UserParcelTemplateWithCarrierTemplateCreateRequest$Outbound; } + +export function userParcelTemplateWithCarrierTemplateCreateRequestToJSON( + userParcelTemplateWithCarrierTemplateCreateRequest: + UserParcelTemplateWithCarrierTemplateCreateRequest, +): string { + return JSON.stringify( + UserParcelTemplateWithCarrierTemplateCreateRequest$outboundSchema.parse( + userParcelTemplateWithCarrierTemplateCreateRequest, + ), + ); +} + +export function userParcelTemplateWithCarrierTemplateCreateRequestFromJSON( + jsonString: string, +): SafeParseResult< + UserParcelTemplateWithCarrierTemplateCreateRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + UserParcelTemplateWithCarrierTemplateCreateRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'UserParcelTemplateWithCarrierTemplateCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/userparceltemplatewithoutcarriertemplatecreaterequest.ts b/src/models/components/userparceltemplatewithoutcarriertemplatecreaterequest.ts index 1d77e2ed..b3a2ec09 100644 --- a/src/models/components/userparceltemplatewithoutcarriertemplatecreaterequest.ts +++ b/src/models/components/userparceltemplatewithoutcarriertemplatecreaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { DistanceUnitEnum, DistanceUnitEnum$inboundSchema, @@ -114,3 +117,30 @@ export namespace UserParcelTemplateWithoutCarrierTemplateCreateRequest$ { export type Outbound = UserParcelTemplateWithoutCarrierTemplateCreateRequest$Outbound; } + +export function userParcelTemplateWithoutCarrierTemplateCreateRequestToJSON( + userParcelTemplateWithoutCarrierTemplateCreateRequest: + UserParcelTemplateWithoutCarrierTemplateCreateRequest, +): string { + return JSON.stringify( + UserParcelTemplateWithoutCarrierTemplateCreateRequest$outboundSchema.parse( + userParcelTemplateWithoutCarrierTemplateCreateRequest, + ), + ); +} + +export function userParcelTemplateWithoutCarrierTemplateCreateRequestFromJSON( + jsonString: string, +): SafeParseResult< + UserParcelTemplateWithoutCarrierTemplateCreateRequest, + SDKValidationError +> { + return safeParse( + jsonString, + (x) => + UserParcelTemplateWithoutCarrierTemplateCreateRequest$inboundSchema.parse( + JSON.parse(x), + ), + `Failed to parse 'UserParcelTemplateWithoutCarrierTemplateCreateRequest' from JSON`, + ); +} diff --git a/src/models/components/webhook.ts b/src/models/components/webhook.ts index c0b4afbb..350afa0a 100644 --- a/src/models/components/webhook.ts +++ b/src/models/components/webhook.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type Webhook = { /** @@ -113,3 +116,17 @@ export namespace Webhook$ { /** @deprecated use `Webhook$Outbound` instead. */ export type Outbound = Webhook$Outbound; } + +export function webhookToJSON(webhook: Webhook): string { + return JSON.stringify(Webhook$outboundSchema.parse(webhook)); +} + +export function webhookFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => Webhook$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'Webhook' from JSON`, + ); +} diff --git a/src/models/components/webhookpaginatedlist.ts b/src/models/components/webhookpaginatedlist.ts index 8e6a3ed4..365b57f7 100644 --- a/src/models/components/webhookpaginatedlist.ts +++ b/src/models/components/webhookpaginatedlist.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Webhook, Webhook$inboundSchema, @@ -61,3 +64,21 @@ export namespace WebhookPaginatedList$ { /** @deprecated use `WebhookPaginatedList$Outbound` instead. */ export type Outbound = WebhookPaginatedList$Outbound; } + +export function webhookPaginatedListToJSON( + webhookPaginatedList: WebhookPaginatedList, +): string { + return JSON.stringify( + WebhookPaginatedList$outboundSchema.parse(webhookPaginatedList), + ); +} + +export function webhookPaginatedListFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WebhookPaginatedList$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WebhookPaginatedList' from JSON`, + ); +} diff --git a/src/models/components/webhookpayload.ts b/src/models/components/webhookpayload.ts index b46919f1..aa81f6bf 100644 --- a/src/models/components/webhookpayload.ts +++ b/src/models/components/webhookpayload.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WebhookPayloadBatch, WebhookPayloadBatch$inboundSchema, @@ -115,3 +118,17 @@ export namespace WebhookPayload$ { /** @deprecated use `WebhookPayload$Outbound` instead. */ export type Outbound = WebhookPayload$Outbound; } + +export function webhookPayloadToJSON(webhookPayload: WebhookPayload): string { + return JSON.stringify(WebhookPayload$outboundSchema.parse(webhookPayload)); +} + +export function webhookPayloadFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WebhookPayload$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WebhookPayload' from JSON`, + ); +} diff --git a/src/models/components/webhookpayloadbatch.ts b/src/models/components/webhookpayloadbatch.ts index a2f74f79..a89da59f 100644 --- a/src/models/components/webhookpayloadbatch.ts +++ b/src/models/components/webhookpayloadbatch.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WebhookEventTypeEnum, WebhookEventTypeEnum$inboundSchema, @@ -68,3 +71,21 @@ export namespace WebhookPayloadBatch$ { /** @deprecated use `WebhookPayloadBatch$Outbound` instead. */ export type Outbound = WebhookPayloadBatch$Outbound; } + +export function webhookPayloadBatchToJSON( + webhookPayloadBatch: WebhookPayloadBatch, +): string { + return JSON.stringify( + WebhookPayloadBatch$outboundSchema.parse(webhookPayloadBatch), + ); +} + +export function webhookPayloadBatchFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WebhookPayloadBatch$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WebhookPayloadBatch' from JSON`, + ); +} diff --git a/src/models/components/webhookpayloadtrack.ts b/src/models/components/webhookpayloadtrack.ts index c68ed336..20ed9984 100644 --- a/src/models/components/webhookpayloadtrack.ts +++ b/src/models/components/webhookpayloadtrack.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Track, Track$inboundSchema, @@ -71,3 +74,21 @@ export namespace WebhookPayloadTrack$ { /** @deprecated use `WebhookPayloadTrack$Outbound` instead. */ export type Outbound = WebhookPayloadTrack$Outbound; } + +export function webhookPayloadTrackToJSON( + webhookPayloadTrack: WebhookPayloadTrack, +): string { + return JSON.stringify( + WebhookPayloadTrack$outboundSchema.parse(webhookPayloadTrack), + ); +} + +export function webhookPayloadTrackFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WebhookPayloadTrack$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WebhookPayloadTrack' from JSON`, + ); +} diff --git a/src/models/components/webhookpayloadtransaction.ts b/src/models/components/webhookpayloadtransaction.ts index 65456c74..415fff03 100644 --- a/src/models/components/webhookpayloadtransaction.ts +++ b/src/models/components/webhookpayloadtransaction.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { Transaction, Transaction$inboundSchema, @@ -71,3 +74,21 @@ export namespace WebhookPayloadTransaction$ { /** @deprecated use `WebhookPayloadTransaction$Outbound` instead. */ export type Outbound = WebhookPayloadTransaction$Outbound; } + +export function webhookPayloadTransactionToJSON( + webhookPayloadTransaction: WebhookPayloadTransaction, +): string { + return JSON.stringify( + WebhookPayloadTransaction$outboundSchema.parse(webhookPayloadTransaction), + ); +} + +export function webhookPayloadTransactionFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WebhookPayloadTransaction$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WebhookPayloadTransaction' from JSON`, + ); +} diff --git a/src/models/components/webhookupdaterequest.ts b/src/models/components/webhookupdaterequest.ts index 30b1198d..9057a066 100644 --- a/src/models/components/webhookupdaterequest.ts +++ b/src/models/components/webhookupdaterequest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { WebhookEventTypeEnum, WebhookEventTypeEnum$inboundSchema, @@ -81,3 +84,21 @@ export namespace WebhookUpdateRequest$ { /** @deprecated use `WebhookUpdateRequest$Outbound` instead. */ export type Outbound = WebhookUpdateRequest$Outbound; } + +export function webhookUpdateRequestToJSON( + webhookUpdateRequest: WebhookUpdateRequest, +): string { + return JSON.stringify( + WebhookUpdateRequest$outboundSchema.parse(webhookUpdateRequest), + ); +} + +export function webhookUpdateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => WebhookUpdateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'WebhookUpdateRequest' from JSON`, + ); +} diff --git a/src/models/operations/addshipmentstobatch.ts b/src/models/operations/addshipmentstobatch.ts index 0c224a12..33cbcba3 100644 --- a/src/models/operations/addshipmentstobatch.ts +++ b/src/models/operations/addshipmentstobatch.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type AddShipmentsToBatchGlobals = { /** @@ -68,6 +71,24 @@ export namespace AddShipmentsToBatchGlobals$ { export type Outbound = AddShipmentsToBatchGlobals$Outbound; } +export function addShipmentsToBatchGlobalsToJSON( + addShipmentsToBatchGlobals: AddShipmentsToBatchGlobals, +): string { + return JSON.stringify( + AddShipmentsToBatchGlobals$outboundSchema.parse(addShipmentsToBatchGlobals), + ); +} + +export function addShipmentsToBatchGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddShipmentsToBatchGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddShipmentsToBatchGlobals' from JSON`, + ); +} + /** @internal */ export const AddShipmentsToBatchRequest$inboundSchema: z.ZodType< AddShipmentsToBatchRequest, @@ -116,3 +137,21 @@ export namespace AddShipmentsToBatchRequest$ { /** @deprecated use `AddShipmentsToBatchRequest$Outbound` instead. */ export type Outbound = AddShipmentsToBatchRequest$Outbound; } + +export function addShipmentsToBatchRequestToJSON( + addShipmentsToBatchRequest: AddShipmentsToBatchRequest, +): string { + return JSON.stringify( + AddShipmentsToBatchRequest$outboundSchema.parse(addShipmentsToBatchRequest), + ); +} + +export function addShipmentsToBatchRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => AddShipmentsToBatchRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'AddShipmentsToBatchRequest' from JSON`, + ); +} diff --git a/src/models/operations/createaddress.ts b/src/models/operations/createaddress.ts index edb63cf1..67a4cece 100644 --- a/src/models/operations/createaddress.ts +++ b/src/models/operations/createaddress.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateAddressGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateAddressGlobals$ { /** @deprecated use `CreateAddressGlobals$Outbound` instead. */ export type Outbound = CreateAddressGlobals$Outbound; } + +export function createAddressGlobalsToJSON( + createAddressGlobals: CreateAddressGlobals, +): string { + return JSON.stringify( + CreateAddressGlobals$outboundSchema.parse(createAddressGlobals), + ); +} + +export function createAddressGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateAddressGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateAddressGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createbatch.ts b/src/models/operations/createbatch.ts index 4ddb82fd..2c52fcb1 100644 --- a/src/models/operations/createbatch.ts +++ b/src/models/operations/createbatch.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateBatchGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateBatchGlobals$ { /** @deprecated use `CreateBatchGlobals$Outbound` instead. */ export type Outbound = CreateBatchGlobals$Outbound; } + +export function createBatchGlobalsToJSON( + createBatchGlobals: CreateBatchGlobals, +): string { + return JSON.stringify( + CreateBatchGlobals$outboundSchema.parse(createBatchGlobals), + ); +} + +export function createBatchGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateBatchGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateBatchGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createcarrieraccount.ts b/src/models/operations/createcarrieraccount.ts index 2f35684d..68be66ad 100644 --- a/src/models/operations/createcarrieraccount.ts +++ b/src/models/operations/createcarrieraccount.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateCarrierAccountGlobals = { /** @@ -55,3 +58,23 @@ export namespace CreateCarrierAccountGlobals$ { /** @deprecated use `CreateCarrierAccountGlobals$Outbound` instead. */ export type Outbound = CreateCarrierAccountGlobals$Outbound; } + +export function createCarrierAccountGlobalsToJSON( + createCarrierAccountGlobals: CreateCarrierAccountGlobals, +): string { + return JSON.stringify( + CreateCarrierAccountGlobals$outboundSchema.parse( + createCarrierAccountGlobals, + ), + ); +} + +export function createCarrierAccountGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateCarrierAccountGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateCarrierAccountGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createcustomsdeclaration.ts b/src/models/operations/createcustomsdeclaration.ts index 51d18ca9..11fdd64a 100644 --- a/src/models/operations/createcustomsdeclaration.ts +++ b/src/models/operations/createcustomsdeclaration.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateCustomsDeclarationGlobals = { /** @@ -55,3 +58,23 @@ export namespace CreateCustomsDeclarationGlobals$ { /** @deprecated use `CreateCustomsDeclarationGlobals$Outbound` instead. */ export type Outbound = CreateCustomsDeclarationGlobals$Outbound; } + +export function createCustomsDeclarationGlobalsToJSON( + createCustomsDeclarationGlobals: CreateCustomsDeclarationGlobals, +): string { + return JSON.stringify( + CreateCustomsDeclarationGlobals$outboundSchema.parse( + createCustomsDeclarationGlobals, + ), + ); +} + +export function createCustomsDeclarationGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateCustomsDeclarationGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateCustomsDeclarationGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createcustomsitem.ts b/src/models/operations/createcustomsitem.ts index 89c87b88..6b4fba42 100644 --- a/src/models/operations/createcustomsitem.ts +++ b/src/models/operations/createcustomsitem.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateCustomsItemGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateCustomsItemGlobals$ { /** @deprecated use `CreateCustomsItemGlobals$Outbound` instead. */ export type Outbound = CreateCustomsItemGlobals$Outbound; } + +export function createCustomsItemGlobalsToJSON( + createCustomsItemGlobals: CreateCustomsItemGlobals, +): string { + return JSON.stringify( + CreateCustomsItemGlobals$outboundSchema.parse(createCustomsItemGlobals), + ); +} + +export function createCustomsItemGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateCustomsItemGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateCustomsItemGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createliverate.ts b/src/models/operations/createliverate.ts index 2e26b621..7082821e 100644 --- a/src/models/operations/createliverate.ts +++ b/src/models/operations/createliverate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateLiveRateGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateLiveRateGlobals$ { /** @deprecated use `CreateLiveRateGlobals$Outbound` instead. */ export type Outbound = CreateLiveRateGlobals$Outbound; } + +export function createLiveRateGlobalsToJSON( + createLiveRateGlobals: CreateLiveRateGlobals, +): string { + return JSON.stringify( + CreateLiveRateGlobals$outboundSchema.parse(createLiveRateGlobals), + ); +} + +export function createLiveRateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateLiveRateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateLiveRateGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createmanifest.ts b/src/models/operations/createmanifest.ts index 0e3c2ae0..553c50e4 100644 --- a/src/models/operations/createmanifest.ts +++ b/src/models/operations/createmanifest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateManifestGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateManifestGlobals$ { /** @deprecated use `CreateManifestGlobals$Outbound` instead. */ export type Outbound = CreateManifestGlobals$Outbound; } + +export function createManifestGlobalsToJSON( + createManifestGlobals: CreateManifestGlobals, +): string { + return JSON.stringify( + CreateManifestGlobals$outboundSchema.parse(createManifestGlobals), + ); +} + +export function createManifestGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateManifestGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateManifestGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createorder.ts b/src/models/operations/createorder.ts index a41ea301..4563ffe2 100644 --- a/src/models/operations/createorder.ts +++ b/src/models/operations/createorder.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateOrderGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateOrderGlobals$ { /** @deprecated use `CreateOrderGlobals$Outbound` instead. */ export type Outbound = CreateOrderGlobals$Outbound; } + +export function createOrderGlobalsToJSON( + createOrderGlobals: CreateOrderGlobals, +): string { + return JSON.stringify( + CreateOrderGlobals$outboundSchema.parse(createOrderGlobals), + ); +} + +export function createOrderGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateOrderGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateOrderGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createparcel.ts b/src/models/operations/createparcel.ts index f9e508ab..e38715d3 100644 --- a/src/models/operations/createparcel.ts +++ b/src/models/operations/createparcel.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateParcelGlobals = { /** @@ -64,6 +67,24 @@ export namespace CreateParcelGlobals$ { export type Outbound = CreateParcelGlobals$Outbound; } +export function createParcelGlobalsToJSON( + createParcelGlobals: CreateParcelGlobals, +): string { + return JSON.stringify( + CreateParcelGlobals$outboundSchema.parse(createParcelGlobals), + ); +} + +export function createParcelGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateParcelGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateParcelGlobals' from JSON`, + ); +} + /** @internal */ export const CreateParcelRequestBody$inboundSchema: z.ZodType< CreateParcelRequestBody, @@ -101,3 +122,21 @@ export namespace CreateParcelRequestBody$ { /** @deprecated use `CreateParcelRequestBody$Outbound` instead. */ export type Outbound = CreateParcelRequestBody$Outbound; } + +export function createParcelRequestBodyToJSON( + createParcelRequestBody: CreateParcelRequestBody, +): string { + return JSON.stringify( + CreateParcelRequestBody$outboundSchema.parse(createParcelRequestBody), + ); +} + +export function createParcelRequestBodyFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateParcelRequestBody$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateParcelRequestBody' from JSON`, + ); +} diff --git a/src/models/operations/createpickup.ts b/src/models/operations/createpickup.ts index 4af9852e..98edf6eb 100644 --- a/src/models/operations/createpickup.ts +++ b/src/models/operations/createpickup.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreatePickupGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreatePickupGlobals$ { /** @deprecated use `CreatePickupGlobals$Outbound` instead. */ export type Outbound = CreatePickupGlobals$Outbound; } + +export function createPickupGlobalsToJSON( + createPickupGlobals: CreatePickupGlobals, +): string { + return JSON.stringify( + CreatePickupGlobals$outboundSchema.parse(createPickupGlobals), + ); +} + +export function createPickupGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreatePickupGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreatePickupGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createrefund.ts b/src/models/operations/createrefund.ts index 522c5455..66e8b75e 100644 --- a/src/models/operations/createrefund.ts +++ b/src/models/operations/createrefund.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateRefundGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateRefundGlobals$ { /** @deprecated use `CreateRefundGlobals$Outbound` instead. */ export type Outbound = CreateRefundGlobals$Outbound; } + +export function createRefundGlobalsToJSON( + createRefundGlobals: CreateRefundGlobals, +): string { + return JSON.stringify( + CreateRefundGlobals$outboundSchema.parse(createRefundGlobals), + ); +} + +export function createRefundGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateRefundGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateRefundGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createservicegroup.ts b/src/models/operations/createservicegroup.ts index 1d423de6..e427c49e 100644 --- a/src/models/operations/createservicegroup.ts +++ b/src/models/operations/createservicegroup.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateServiceGroupGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateServiceGroupGlobals$ { /** @deprecated use `CreateServiceGroupGlobals$Outbound` instead. */ export type Outbound = CreateServiceGroupGlobals$Outbound; } + +export function createServiceGroupGlobalsToJSON( + createServiceGroupGlobals: CreateServiceGroupGlobals, +): string { + return JSON.stringify( + CreateServiceGroupGlobals$outboundSchema.parse(createServiceGroupGlobals), + ); +} + +export function createServiceGroupGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateServiceGroupGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateServiceGroupGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createshipment.ts b/src/models/operations/createshipment.ts index e3e43fb3..221ffabb 100644 --- a/src/models/operations/createshipment.ts +++ b/src/models/operations/createshipment.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateShipmentGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateShipmentGlobals$ { /** @deprecated use `CreateShipmentGlobals$Outbound` instead. */ export type Outbound = CreateShipmentGlobals$Outbound; } + +export function createShipmentGlobalsToJSON( + createShipmentGlobals: CreateShipmentGlobals, +): string { + return JSON.stringify( + CreateShipmentGlobals$outboundSchema.parse(createShipmentGlobals), + ); +} + +export function createShipmentGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateShipmentGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateShipmentGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createshippoaccount.ts b/src/models/operations/createshippoaccount.ts index a467905b..592d3591 100644 --- a/src/models/operations/createshippoaccount.ts +++ b/src/models/operations/createshippoaccount.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateShippoAccountGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateShippoAccountGlobals$ { /** @deprecated use `CreateShippoAccountGlobals$Outbound` instead. */ export type Outbound = CreateShippoAccountGlobals$Outbound; } + +export function createShippoAccountGlobalsToJSON( + createShippoAccountGlobals: CreateShippoAccountGlobals, +): string { + return JSON.stringify( + CreateShippoAccountGlobals$outboundSchema.parse(createShippoAccountGlobals), + ); +} + +export function createShippoAccountGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateShippoAccountGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateShippoAccountGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createtrack.ts b/src/models/operations/createtrack.ts index 7355f836..8a78de86 100644 --- a/src/models/operations/createtrack.ts +++ b/src/models/operations/createtrack.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateTrackGlobals = { /** @@ -55,3 +58,21 @@ export namespace CreateTrackGlobals$ { /** @deprecated use `CreateTrackGlobals$Outbound` instead. */ export type Outbound = CreateTrackGlobals$Outbound; } + +export function createTrackGlobalsToJSON( + createTrackGlobals: CreateTrackGlobals, +): string { + return JSON.stringify( + CreateTrackGlobals$outboundSchema.parse(createTrackGlobals), + ); +} + +export function createTrackGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateTrackGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateTrackGlobals' from JSON`, + ); +} diff --git a/src/models/operations/createtransaction.ts b/src/models/operations/createtransaction.ts index d41c99f3..b9a0261d 100644 --- a/src/models/operations/createtransaction.ts +++ b/src/models/operations/createtransaction.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateTransactionGlobals = { /** @@ -64,6 +67,24 @@ export namespace CreateTransactionGlobals$ { export type Outbound = CreateTransactionGlobals$Outbound; } +export function createTransactionGlobalsToJSON( + createTransactionGlobals: CreateTransactionGlobals, +): string { + return JSON.stringify( + CreateTransactionGlobals$outboundSchema.parse(createTransactionGlobals), + ); +} + +export function createTransactionGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateTransactionGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateTransactionGlobals' from JSON`, + ); +} + /** @internal */ export const CreateTransactionRequestBody$inboundSchema: z.ZodType< CreateTransactionRequestBody, @@ -101,3 +122,23 @@ export namespace CreateTransactionRequestBody$ { /** @deprecated use `CreateTransactionRequestBody$Outbound` instead. */ export type Outbound = CreateTransactionRequestBody$Outbound; } + +export function createTransactionRequestBodyToJSON( + createTransactionRequestBody: CreateTransactionRequestBody, +): string { + return JSON.stringify( + CreateTransactionRequestBody$outboundSchema.parse( + createTransactionRequestBody, + ), + ); +} + +export function createTransactionRequestBodyFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateTransactionRequestBody$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateTransactionRequestBody' from JSON`, + ); +} diff --git a/src/models/operations/createuserparceltemplate.ts b/src/models/operations/createuserparceltemplate.ts index 0e649de0..6d367bae 100644 --- a/src/models/operations/createuserparceltemplate.ts +++ b/src/models/operations/createuserparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type CreateUserParcelTemplateGlobals = { /** @@ -55,3 +58,23 @@ export namespace CreateUserParcelTemplateGlobals$ { /** @deprecated use `CreateUserParcelTemplateGlobals$Outbound` instead. */ export type Outbound = CreateUserParcelTemplateGlobals$Outbound; } + +export function createUserParcelTemplateGlobalsToJSON( + createUserParcelTemplateGlobals: CreateUserParcelTemplateGlobals, +): string { + return JSON.stringify( + CreateUserParcelTemplateGlobals$outboundSchema.parse( + createUserParcelTemplateGlobals, + ), + ); +} + +export function createUserParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => CreateUserParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'CreateUserParcelTemplateGlobals' from JSON`, + ); +} diff --git a/src/models/operations/deletedefaultparceltemplate.ts b/src/models/operations/deletedefaultparceltemplate.ts index e2f87c88..3bb9596a 100644 --- a/src/models/operations/deletedefaultparceltemplate.ts +++ b/src/models/operations/deletedefaultparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type DeleteDefaultParcelTemplateGlobals = { /** @@ -59,6 +62,27 @@ export namespace DeleteDefaultParcelTemplateGlobals$ { export type Outbound = DeleteDefaultParcelTemplateGlobals$Outbound; } +export function deleteDefaultParcelTemplateGlobalsToJSON( + deleteDefaultParcelTemplateGlobals: DeleteDefaultParcelTemplateGlobals, +): string { + return JSON.stringify( + DeleteDefaultParcelTemplateGlobals$outboundSchema.parse( + deleteDefaultParcelTemplateGlobals, + ), + ); +} + +export function deleteDefaultParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + DeleteDefaultParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteDefaultParcelTemplateGlobals' from JSON`, + ); +} + /** @internal */ export const DeleteDefaultParcelTemplateRequest$inboundSchema: z.ZodType< DeleteDefaultParcelTemplateRequest, @@ -89,3 +113,24 @@ export namespace DeleteDefaultParcelTemplateRequest$ { /** @deprecated use `DeleteDefaultParcelTemplateRequest$Outbound` instead. */ export type Outbound = DeleteDefaultParcelTemplateRequest$Outbound; } + +export function deleteDefaultParcelTemplateRequestToJSON( + deleteDefaultParcelTemplateRequest: DeleteDefaultParcelTemplateRequest, +): string { + return JSON.stringify( + DeleteDefaultParcelTemplateRequest$outboundSchema.parse( + deleteDefaultParcelTemplateRequest, + ), + ); +} + +export function deleteDefaultParcelTemplateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + DeleteDefaultParcelTemplateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteDefaultParcelTemplateRequest' from JSON`, + ); +} diff --git a/src/models/operations/deleteservicegroup.ts b/src/models/operations/deleteservicegroup.ts index c4120c42..cf321bc4 100644 --- a/src/models/operations/deleteservicegroup.ts +++ b/src/models/operations/deleteservicegroup.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type DeleteServiceGroupGlobals = { /** @@ -63,6 +66,24 @@ export namespace DeleteServiceGroupGlobals$ { export type Outbound = DeleteServiceGroupGlobals$Outbound; } +export function deleteServiceGroupGlobalsToJSON( + deleteServiceGroupGlobals: DeleteServiceGroupGlobals, +): string { + return JSON.stringify( + DeleteServiceGroupGlobals$outboundSchema.parse(deleteServiceGroupGlobals), + ); +} + +export function deleteServiceGroupGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteServiceGroupGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteServiceGroupGlobals' from JSON`, + ); +} + /** @internal */ export const DeleteServiceGroupRequest$inboundSchema: z.ZodType< DeleteServiceGroupRequest, @@ -106,3 +127,21 @@ export namespace DeleteServiceGroupRequest$ { /** @deprecated use `DeleteServiceGroupRequest$Outbound` instead. */ export type Outbound = DeleteServiceGroupRequest$Outbound; } + +export function deleteServiceGroupRequestToJSON( + deleteServiceGroupRequest: DeleteServiceGroupRequest, +): string { + return JSON.stringify( + DeleteServiceGroupRequest$outboundSchema.parse(deleteServiceGroupRequest), + ); +} + +export function deleteServiceGroupRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteServiceGroupRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteServiceGroupRequest' from JSON`, + ); +} diff --git a/src/models/operations/deleteuserparceltemplate.ts b/src/models/operations/deleteuserparceltemplate.ts index 3efada72..25ea0867 100644 --- a/src/models/operations/deleteuserparceltemplate.ts +++ b/src/models/operations/deleteuserparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type DeleteUserParcelTemplateGlobals = { /** @@ -63,6 +66,26 @@ export namespace DeleteUserParcelTemplateGlobals$ { export type Outbound = DeleteUserParcelTemplateGlobals$Outbound; } +export function deleteUserParcelTemplateGlobalsToJSON( + deleteUserParcelTemplateGlobals: DeleteUserParcelTemplateGlobals, +): string { + return JSON.stringify( + DeleteUserParcelTemplateGlobals$outboundSchema.parse( + deleteUserParcelTemplateGlobals, + ), + ); +} + +export function deleteUserParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteUserParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteUserParcelTemplateGlobals' from JSON`, + ); +} + /** @internal */ export const DeleteUserParcelTemplateRequest$inboundSchema: z.ZodType< DeleteUserParcelTemplateRequest, @@ -106,3 +129,23 @@ export namespace DeleteUserParcelTemplateRequest$ { /** @deprecated use `DeleteUserParcelTemplateRequest$Outbound` instead. */ export type Outbound = DeleteUserParcelTemplateRequest$Outbound; } + +export function deleteUserParcelTemplateRequestToJSON( + deleteUserParcelTemplateRequest: DeleteUserParcelTemplateRequest, +): string { + return JSON.stringify( + DeleteUserParcelTemplateRequest$outboundSchema.parse( + deleteUserParcelTemplateRequest, + ), + ); +} + +export function deleteUserParcelTemplateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteUserParcelTemplateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteUserParcelTemplateRequest' from JSON`, + ); +} diff --git a/src/models/operations/deletewebhook.ts b/src/models/operations/deletewebhook.ts index 29be386e..b1314ded 100644 --- a/src/models/operations/deletewebhook.ts +++ b/src/models/operations/deletewebhook.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type DeleteWebhookRequest = { /** @@ -46,3 +49,21 @@ export namespace DeleteWebhookRequest$ { /** @deprecated use `DeleteWebhookRequest$Outbound` instead. */ export type Outbound = DeleteWebhookRequest$Outbound; } + +export function deleteWebhookRequestToJSON( + deleteWebhookRequest: DeleteWebhookRequest, +): string { + return JSON.stringify( + DeleteWebhookRequest$outboundSchema.parse(deleteWebhookRequest), + ); +} + +export function deleteWebhookRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => DeleteWebhookRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'DeleteWebhookRequest' from JSON`, + ); +} diff --git a/src/models/operations/getaddress.ts b/src/models/operations/getaddress.ts index 6b9a6b97..8b7b9e74 100644 --- a/src/models/operations/getaddress.ts +++ b/src/models/operations/getaddress.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetAddressGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetAddressGlobals$ { export type Outbound = GetAddressGlobals$Outbound; } +export function getAddressGlobalsToJSON( + getAddressGlobals: GetAddressGlobals, +): string { + return JSON.stringify( + GetAddressGlobals$outboundSchema.parse(getAddressGlobals), + ); +} + +export function getAddressGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetAddressGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetAddressGlobals' from JSON`, + ); +} + /** @internal */ export const GetAddressRequest$inboundSchema: z.ZodType< GetAddressRequest, @@ -106,3 +127,21 @@ export namespace GetAddressRequest$ { /** @deprecated use `GetAddressRequest$Outbound` instead. */ export type Outbound = GetAddressRequest$Outbound; } + +export function getAddressRequestToJSON( + getAddressRequest: GetAddressRequest, +): string { + return JSON.stringify( + GetAddressRequest$outboundSchema.parse(getAddressRequest), + ); +} + +export function getAddressRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetAddressRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetAddressRequest' from JSON`, + ); +} diff --git a/src/models/operations/getbatch.ts b/src/models/operations/getbatch.ts index 36351296..fc9cf137 100644 --- a/src/models/operations/getbatch.ts +++ b/src/models/operations/getbatch.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetBatchGlobals = { /** @@ -71,6 +74,22 @@ export namespace GetBatchGlobals$ { export type Outbound = GetBatchGlobals$Outbound; } +export function getBatchGlobalsToJSON( + getBatchGlobals: GetBatchGlobals, +): string { + return JSON.stringify(GetBatchGlobals$outboundSchema.parse(getBatchGlobals)); +} + +export function getBatchGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetBatchGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetBatchGlobals' from JSON`, + ); +} + /** @internal */ export const GetBatchRequest$inboundSchema: z.ZodType< GetBatchRequest, @@ -120,3 +139,19 @@ export namespace GetBatchRequest$ { /** @deprecated use `GetBatchRequest$Outbound` instead. */ export type Outbound = GetBatchRequest$Outbound; } + +export function getBatchRequestToJSON( + getBatchRequest: GetBatchRequest, +): string { + return JSON.stringify(GetBatchRequest$outboundSchema.parse(getBatchRequest)); +} + +export function getBatchRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetBatchRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetBatchRequest' from JSON`, + ); +} diff --git a/src/models/operations/getcarrieraccount.ts b/src/models/operations/getcarrieraccount.ts index f6e8dade..20e88b3a 100644 --- a/src/models/operations/getcarrieraccount.ts +++ b/src/models/operations/getcarrieraccount.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetCarrierAccountGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetCarrierAccountGlobals$ { export type Outbound = GetCarrierAccountGlobals$Outbound; } +export function getCarrierAccountGlobalsToJSON( + getCarrierAccountGlobals: GetCarrierAccountGlobals, +): string { + return JSON.stringify( + GetCarrierAccountGlobals$outboundSchema.parse(getCarrierAccountGlobals), + ); +} + +export function getCarrierAccountGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCarrierAccountGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCarrierAccountGlobals' from JSON`, + ); +} + /** @internal */ export const GetCarrierAccountRequest$inboundSchema: z.ZodType< GetCarrierAccountRequest, @@ -106,3 +127,21 @@ export namespace GetCarrierAccountRequest$ { /** @deprecated use `GetCarrierAccountRequest$Outbound` instead. */ export type Outbound = GetCarrierAccountRequest$Outbound; } + +export function getCarrierAccountRequestToJSON( + getCarrierAccountRequest: GetCarrierAccountRequest, +): string { + return JSON.stringify( + GetCarrierAccountRequest$outboundSchema.parse(getCarrierAccountRequest), + ); +} + +export function getCarrierAccountRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCarrierAccountRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCarrierAccountRequest' from JSON`, + ); +} diff --git a/src/models/operations/getcarrierparceltemplate.ts b/src/models/operations/getcarrierparceltemplate.ts index 133469e7..2f0bb2ce 100644 --- a/src/models/operations/getcarrierparceltemplate.ts +++ b/src/models/operations/getcarrierparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetCarrierParcelTemplateGlobals = { /** @@ -63,6 +66,26 @@ export namespace GetCarrierParcelTemplateGlobals$ { export type Outbound = GetCarrierParcelTemplateGlobals$Outbound; } +export function getCarrierParcelTemplateGlobalsToJSON( + getCarrierParcelTemplateGlobals: GetCarrierParcelTemplateGlobals, +): string { + return JSON.stringify( + GetCarrierParcelTemplateGlobals$outboundSchema.parse( + getCarrierParcelTemplateGlobals, + ), + ); +} + +export function getCarrierParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCarrierParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCarrierParcelTemplateGlobals' from JSON`, + ); +} + /** @internal */ export const GetCarrierParcelTemplateRequest$inboundSchema: z.ZodType< GetCarrierParcelTemplateRequest, @@ -106,3 +129,23 @@ export namespace GetCarrierParcelTemplateRequest$ { /** @deprecated use `GetCarrierParcelTemplateRequest$Outbound` instead. */ export type Outbound = GetCarrierParcelTemplateRequest$Outbound; } + +export function getCarrierParcelTemplateRequestToJSON( + getCarrierParcelTemplateRequest: GetCarrierParcelTemplateRequest, +): string { + return JSON.stringify( + GetCarrierParcelTemplateRequest$outboundSchema.parse( + getCarrierParcelTemplateRequest, + ), + ); +} + +export function getCarrierParcelTemplateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCarrierParcelTemplateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCarrierParcelTemplateRequest' from JSON`, + ); +} diff --git a/src/models/operations/getcarrierregistrationstatus.ts b/src/models/operations/getcarrierregistrationstatus.ts index ce8ee724..4dcda353 100644 --- a/src/models/operations/getcarrierregistrationstatus.ts +++ b/src/models/operations/getcarrierregistrationstatus.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetCarrierRegistrationStatusGlobals = { /** @@ -79,6 +82,27 @@ export namespace GetCarrierRegistrationStatusGlobals$ { export type Outbound = GetCarrierRegistrationStatusGlobals$Outbound; } +export function getCarrierRegistrationStatusGlobalsToJSON( + getCarrierRegistrationStatusGlobals: GetCarrierRegistrationStatusGlobals, +): string { + return JSON.stringify( + GetCarrierRegistrationStatusGlobals$outboundSchema.parse( + getCarrierRegistrationStatusGlobals, + ), + ); +} + +export function getCarrierRegistrationStatusGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + GetCarrierRegistrationStatusGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCarrierRegistrationStatusGlobals' from JSON`, + ); +} + /** @internal */ export const Carrier$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Carrier); @@ -135,3 +159,24 @@ export namespace GetCarrierRegistrationStatusRequest$ { /** @deprecated use `GetCarrierRegistrationStatusRequest$Outbound` instead. */ export type Outbound = GetCarrierRegistrationStatusRequest$Outbound; } + +export function getCarrierRegistrationStatusRequestToJSON( + getCarrierRegistrationStatusRequest: GetCarrierRegistrationStatusRequest, +): string { + return JSON.stringify( + GetCarrierRegistrationStatusRequest$outboundSchema.parse( + getCarrierRegistrationStatusRequest, + ), + ); +} + +export function getCarrierRegistrationStatusRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + GetCarrierRegistrationStatusRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCarrierRegistrationStatusRequest' from JSON`, + ); +} diff --git a/src/models/operations/getcustomsdeclaration.ts b/src/models/operations/getcustomsdeclaration.ts index 649ebad9..bb0d998f 100644 --- a/src/models/operations/getcustomsdeclaration.ts +++ b/src/models/operations/getcustomsdeclaration.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetCustomsDeclarationGlobals = { /** @@ -67,6 +70,26 @@ export namespace GetCustomsDeclarationGlobals$ { export type Outbound = GetCustomsDeclarationGlobals$Outbound; } +export function getCustomsDeclarationGlobalsToJSON( + getCustomsDeclarationGlobals: GetCustomsDeclarationGlobals, +): string { + return JSON.stringify( + GetCustomsDeclarationGlobals$outboundSchema.parse( + getCustomsDeclarationGlobals, + ), + ); +} + +export function getCustomsDeclarationGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCustomsDeclarationGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCustomsDeclarationGlobals' from JSON`, + ); +} + /** @internal */ export const GetCustomsDeclarationRequest$inboundSchema: z.ZodType< GetCustomsDeclarationRequest, @@ -113,3 +136,23 @@ export namespace GetCustomsDeclarationRequest$ { /** @deprecated use `GetCustomsDeclarationRequest$Outbound` instead. */ export type Outbound = GetCustomsDeclarationRequest$Outbound; } + +export function getCustomsDeclarationRequestToJSON( + getCustomsDeclarationRequest: GetCustomsDeclarationRequest, +): string { + return JSON.stringify( + GetCustomsDeclarationRequest$outboundSchema.parse( + getCustomsDeclarationRequest, + ), + ); +} + +export function getCustomsDeclarationRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCustomsDeclarationRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCustomsDeclarationRequest' from JSON`, + ); +} diff --git a/src/models/operations/getcustomsitem.ts b/src/models/operations/getcustomsitem.ts index 86ddd369..9608be9d 100644 --- a/src/models/operations/getcustomsitem.ts +++ b/src/models/operations/getcustomsitem.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetCustomsItemGlobals = { /** @@ -67,6 +70,24 @@ export namespace GetCustomsItemGlobals$ { export type Outbound = GetCustomsItemGlobals$Outbound; } +export function getCustomsItemGlobalsToJSON( + getCustomsItemGlobals: GetCustomsItemGlobals, +): string { + return JSON.stringify( + GetCustomsItemGlobals$outboundSchema.parse(getCustomsItemGlobals), + ); +} + +export function getCustomsItemGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCustomsItemGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCustomsItemGlobals' from JSON`, + ); +} + /** @internal */ export const GetCustomsItemRequest$inboundSchema: z.ZodType< GetCustomsItemRequest, @@ -113,3 +134,21 @@ export namespace GetCustomsItemRequest$ { /** @deprecated use `GetCustomsItemRequest$Outbound` instead. */ export type Outbound = GetCustomsItemRequest$Outbound; } + +export function getCustomsItemRequestToJSON( + getCustomsItemRequest: GetCustomsItemRequest, +): string { + return JSON.stringify( + GetCustomsItemRequest$outboundSchema.parse(getCustomsItemRequest), + ); +} + +export function getCustomsItemRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetCustomsItemRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetCustomsItemRequest' from JSON`, + ); +} diff --git a/src/models/operations/getdefaultparceltemplate.ts b/src/models/operations/getdefaultparceltemplate.ts index 1d677c95..02921a7f 100644 --- a/src/models/operations/getdefaultparceltemplate.ts +++ b/src/models/operations/getdefaultparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetDefaultParcelTemplateGlobals = { /** @@ -58,6 +61,26 @@ export namespace GetDefaultParcelTemplateGlobals$ { export type Outbound = GetDefaultParcelTemplateGlobals$Outbound; } +export function getDefaultParcelTemplateGlobalsToJSON( + getDefaultParcelTemplateGlobals: GetDefaultParcelTemplateGlobals, +): string { + return JSON.stringify( + GetDefaultParcelTemplateGlobals$outboundSchema.parse( + getDefaultParcelTemplateGlobals, + ), + ); +} + +export function getDefaultParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetDefaultParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetDefaultParcelTemplateGlobals' from JSON`, + ); +} + /** @internal */ export const GetDefaultParcelTemplateRequest$inboundSchema: z.ZodType< GetDefaultParcelTemplateRequest, @@ -87,3 +110,23 @@ export namespace GetDefaultParcelTemplateRequest$ { /** @deprecated use `GetDefaultParcelTemplateRequest$Outbound` instead. */ export type Outbound = GetDefaultParcelTemplateRequest$Outbound; } + +export function getDefaultParcelTemplateRequestToJSON( + getDefaultParcelTemplateRequest: GetDefaultParcelTemplateRequest, +): string { + return JSON.stringify( + GetDefaultParcelTemplateRequest$outboundSchema.parse( + getDefaultParcelTemplateRequest, + ), + ); +} + +export function getDefaultParcelTemplateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetDefaultParcelTemplateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetDefaultParcelTemplateRequest' from JSON`, + ); +} diff --git a/src/models/operations/getmanifest.ts b/src/models/operations/getmanifest.ts index 6a731aab..52461721 100644 --- a/src/models/operations/getmanifest.ts +++ b/src/models/operations/getmanifest.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetManifestGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetManifestGlobals$ { export type Outbound = GetManifestGlobals$Outbound; } +export function getManifestGlobalsToJSON( + getManifestGlobals: GetManifestGlobals, +): string { + return JSON.stringify( + GetManifestGlobals$outboundSchema.parse(getManifestGlobals), + ); +} + +export function getManifestGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetManifestGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetManifestGlobals' from JSON`, + ); +} + /** @internal */ export const GetManifestRequest$inboundSchema: z.ZodType< GetManifestRequest, @@ -106,3 +127,21 @@ export namespace GetManifestRequest$ { /** @deprecated use `GetManifestRequest$Outbound` instead. */ export type Outbound = GetManifestRequest$Outbound; } + +export function getManifestRequestToJSON( + getManifestRequest: GetManifestRequest, +): string { + return JSON.stringify( + GetManifestRequest$outboundSchema.parse(getManifestRequest), + ); +} + +export function getManifestRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetManifestRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetManifestRequest' from JSON`, + ); +} diff --git a/src/models/operations/getorder.ts b/src/models/operations/getorder.ts index d5d09ada..1b5b4a3f 100644 --- a/src/models/operations/getorder.ts +++ b/src/models/operations/getorder.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetOrderGlobals = { /** @@ -63,6 +66,22 @@ export namespace GetOrderGlobals$ { export type Outbound = GetOrderGlobals$Outbound; } +export function getOrderGlobalsToJSON( + getOrderGlobals: GetOrderGlobals, +): string { + return JSON.stringify(GetOrderGlobals$outboundSchema.parse(getOrderGlobals)); +} + +export function getOrderGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetOrderGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetOrderGlobals' from JSON`, + ); +} + /** @internal */ export const GetOrderRequest$inboundSchema: z.ZodType< GetOrderRequest, @@ -106,3 +125,19 @@ export namespace GetOrderRequest$ { /** @deprecated use `GetOrderRequest$Outbound` instead. */ export type Outbound = GetOrderRequest$Outbound; } + +export function getOrderRequestToJSON( + getOrderRequest: GetOrderRequest, +): string { + return JSON.stringify(GetOrderRequest$outboundSchema.parse(getOrderRequest)); +} + +export function getOrderRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetOrderRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetOrderRequest' from JSON`, + ); +} diff --git a/src/models/operations/getparcel.ts b/src/models/operations/getparcel.ts index ece2b607..eae4be00 100644 --- a/src/models/operations/getparcel.ts +++ b/src/models/operations/getparcel.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetParcelGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetParcelGlobals$ { export type Outbound = GetParcelGlobals$Outbound; } +export function getParcelGlobalsToJSON( + getParcelGlobals: GetParcelGlobals, +): string { + return JSON.stringify( + GetParcelGlobals$outboundSchema.parse(getParcelGlobals), + ); +} + +export function getParcelGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetParcelGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetParcelGlobals' from JSON`, + ); +} + /** @internal */ export const GetParcelRequest$inboundSchema: z.ZodType< GetParcelRequest, @@ -106,3 +127,21 @@ export namespace GetParcelRequest$ { /** @deprecated use `GetParcelRequest$Outbound` instead. */ export type Outbound = GetParcelRequest$Outbound; } + +export function getParcelRequestToJSON( + getParcelRequest: GetParcelRequest, +): string { + return JSON.stringify( + GetParcelRequest$outboundSchema.parse(getParcelRequest), + ); +} + +export function getParcelRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetParcelRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetParcelRequest' from JSON`, + ); +} diff --git a/src/models/operations/getrate.ts b/src/models/operations/getrate.ts index dc31e2a2..91184829 100644 --- a/src/models/operations/getrate.ts +++ b/src/models/operations/getrate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetRateGlobals = { /** @@ -63,6 +66,20 @@ export namespace GetRateGlobals$ { export type Outbound = GetRateGlobals$Outbound; } +export function getRateGlobalsToJSON(getRateGlobals: GetRateGlobals): string { + return JSON.stringify(GetRateGlobals$outboundSchema.parse(getRateGlobals)); +} + +export function getRateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetRateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetRateGlobals' from JSON`, + ); +} + /** @internal */ export const GetRateRequest$inboundSchema: z.ZodType< GetRateRequest, @@ -106,3 +123,17 @@ export namespace GetRateRequest$ { /** @deprecated use `GetRateRequest$Outbound` instead. */ export type Outbound = GetRateRequest$Outbound; } + +export function getRateRequestToJSON(getRateRequest: GetRateRequest): string { + return JSON.stringify(GetRateRequest$outboundSchema.parse(getRateRequest)); +} + +export function getRateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetRateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetRateRequest' from JSON`, + ); +} diff --git a/src/models/operations/getrefund.ts b/src/models/operations/getrefund.ts index b6605eb2..2e8fee41 100644 --- a/src/models/operations/getrefund.ts +++ b/src/models/operations/getrefund.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetRefundGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetRefundGlobals$ { export type Outbound = GetRefundGlobals$Outbound; } +export function getRefundGlobalsToJSON( + getRefundGlobals: GetRefundGlobals, +): string { + return JSON.stringify( + GetRefundGlobals$outboundSchema.parse(getRefundGlobals), + ); +} + +export function getRefundGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetRefundGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetRefundGlobals' from JSON`, + ); +} + /** @internal */ export const GetRefundRequest$inboundSchema: z.ZodType< GetRefundRequest, @@ -106,3 +127,21 @@ export namespace GetRefundRequest$ { /** @deprecated use `GetRefundRequest$Outbound` instead. */ export type Outbound = GetRefundRequest$Outbound; } + +export function getRefundRequestToJSON( + getRefundRequest: GetRefundRequest, +): string { + return JSON.stringify( + GetRefundRequest$outboundSchema.parse(getRefundRequest), + ); +} + +export function getRefundRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetRefundRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetRefundRequest' from JSON`, + ); +} diff --git a/src/models/operations/getshipment.ts b/src/models/operations/getshipment.ts index 1f44c230..6d3ad9b2 100644 --- a/src/models/operations/getshipment.ts +++ b/src/models/operations/getshipment.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetShipmentGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetShipmentGlobals$ { export type Outbound = GetShipmentGlobals$Outbound; } +export function getShipmentGlobalsToJSON( + getShipmentGlobals: GetShipmentGlobals, +): string { + return JSON.stringify( + GetShipmentGlobals$outboundSchema.parse(getShipmentGlobals), + ); +} + +export function getShipmentGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetShipmentGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetShipmentGlobals' from JSON`, + ); +} + /** @internal */ export const GetShipmentRequest$inboundSchema: z.ZodType< GetShipmentRequest, @@ -106,3 +127,21 @@ export namespace GetShipmentRequest$ { /** @deprecated use `GetShipmentRequest$Outbound` instead. */ export type Outbound = GetShipmentRequest$Outbound; } + +export function getShipmentRequestToJSON( + getShipmentRequest: GetShipmentRequest, +): string { + return JSON.stringify( + GetShipmentRequest$outboundSchema.parse(getShipmentRequest), + ); +} + +export function getShipmentRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetShipmentRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetShipmentRequest' from JSON`, + ); +} diff --git a/src/models/operations/getshippoaccount.ts b/src/models/operations/getshippoaccount.ts index 29ccafbf..e9d9269c 100644 --- a/src/models/operations/getshippoaccount.ts +++ b/src/models/operations/getshippoaccount.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetShippoAccountGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetShippoAccountGlobals$ { export type Outbound = GetShippoAccountGlobals$Outbound; } +export function getShippoAccountGlobalsToJSON( + getShippoAccountGlobals: GetShippoAccountGlobals, +): string { + return JSON.stringify( + GetShippoAccountGlobals$outboundSchema.parse(getShippoAccountGlobals), + ); +} + +export function getShippoAccountGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetShippoAccountGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetShippoAccountGlobals' from JSON`, + ); +} + /** @internal */ export const GetShippoAccountRequest$inboundSchema: z.ZodType< GetShippoAccountRequest, @@ -106,3 +127,21 @@ export namespace GetShippoAccountRequest$ { /** @deprecated use `GetShippoAccountRequest$Outbound` instead. */ export type Outbound = GetShippoAccountRequest$Outbound; } + +export function getShippoAccountRequestToJSON( + getShippoAccountRequest: GetShippoAccountRequest, +): string { + return JSON.stringify( + GetShippoAccountRequest$outboundSchema.parse(getShippoAccountRequest), + ); +} + +export function getShippoAccountRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetShippoAccountRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetShippoAccountRequest' from JSON`, + ); +} diff --git a/src/models/operations/gettrack.ts b/src/models/operations/gettrack.ts index c317990c..08096993 100644 --- a/src/models/operations/gettrack.ts +++ b/src/models/operations/gettrack.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetTrackGlobals = { /** @@ -67,6 +70,22 @@ export namespace GetTrackGlobals$ { export type Outbound = GetTrackGlobals$Outbound; } +export function getTrackGlobalsToJSON( + getTrackGlobals: GetTrackGlobals, +): string { + return JSON.stringify(GetTrackGlobals$outboundSchema.parse(getTrackGlobals)); +} + +export function getTrackGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetTrackGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetTrackGlobals' from JSON`, + ); +} + /** @internal */ export const GetTrackRequest$inboundSchema: z.ZodType< GetTrackRequest, @@ -115,3 +134,19 @@ export namespace GetTrackRequest$ { /** @deprecated use `GetTrackRequest$Outbound` instead. */ export type Outbound = GetTrackRequest$Outbound; } + +export function getTrackRequestToJSON( + getTrackRequest: GetTrackRequest, +): string { + return JSON.stringify(GetTrackRequest$outboundSchema.parse(getTrackRequest)); +} + +export function getTrackRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetTrackRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetTrackRequest' from JSON`, + ); +} diff --git a/src/models/operations/gettransaction.ts b/src/models/operations/gettransaction.ts index 807f8a5a..ded83c51 100644 --- a/src/models/operations/gettransaction.ts +++ b/src/models/operations/gettransaction.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetTransactionGlobals = { /** @@ -63,6 +66,24 @@ export namespace GetTransactionGlobals$ { export type Outbound = GetTransactionGlobals$Outbound; } +export function getTransactionGlobalsToJSON( + getTransactionGlobals: GetTransactionGlobals, +): string { + return JSON.stringify( + GetTransactionGlobals$outboundSchema.parse(getTransactionGlobals), + ); +} + +export function getTransactionGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetTransactionGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetTransactionGlobals' from JSON`, + ); +} + /** @internal */ export const GetTransactionRequest$inboundSchema: z.ZodType< GetTransactionRequest, @@ -106,3 +127,21 @@ export namespace GetTransactionRequest$ { /** @deprecated use `GetTransactionRequest$Outbound` instead. */ export type Outbound = GetTransactionRequest$Outbound; } + +export function getTransactionRequestToJSON( + getTransactionRequest: GetTransactionRequest, +): string { + return JSON.stringify( + GetTransactionRequest$outboundSchema.parse(getTransactionRequest), + ); +} + +export function getTransactionRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetTransactionRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetTransactionRequest' from JSON`, + ); +} diff --git a/src/models/operations/getuserparceltemplate.ts b/src/models/operations/getuserparceltemplate.ts index 0837ec5a..5fe0c897 100644 --- a/src/models/operations/getuserparceltemplate.ts +++ b/src/models/operations/getuserparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetUserParcelTemplateGlobals = { /** @@ -63,6 +66,26 @@ export namespace GetUserParcelTemplateGlobals$ { export type Outbound = GetUserParcelTemplateGlobals$Outbound; } +export function getUserParcelTemplateGlobalsToJSON( + getUserParcelTemplateGlobals: GetUserParcelTemplateGlobals, +): string { + return JSON.stringify( + GetUserParcelTemplateGlobals$outboundSchema.parse( + getUserParcelTemplateGlobals, + ), + ); +} + +export function getUserParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetUserParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetUserParcelTemplateGlobals' from JSON`, + ); +} + /** @internal */ export const GetUserParcelTemplateRequest$inboundSchema: z.ZodType< GetUserParcelTemplateRequest, @@ -106,3 +129,23 @@ export namespace GetUserParcelTemplateRequest$ { /** @deprecated use `GetUserParcelTemplateRequest$Outbound` instead. */ export type Outbound = GetUserParcelTemplateRequest$Outbound; } + +export function getUserParcelTemplateRequestToJSON( + getUserParcelTemplateRequest: GetUserParcelTemplateRequest, +): string { + return JSON.stringify( + GetUserParcelTemplateRequest$outboundSchema.parse( + getUserParcelTemplateRequest, + ), + ); +} + +export function getUserParcelTemplateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetUserParcelTemplateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetUserParcelTemplateRequest' from JSON`, + ); +} diff --git a/src/models/operations/getwebhook.ts b/src/models/operations/getwebhook.ts index 686a8896..c1a53407 100644 --- a/src/models/operations/getwebhook.ts +++ b/src/models/operations/getwebhook.ts @@ -3,6 +3,9 @@ */ import * as z from "zod"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetWebhookRequest = { /** @@ -46,3 +49,21 @@ export namespace GetWebhookRequest$ { /** @deprecated use `GetWebhookRequest$Outbound` instead. */ export type Outbound = GetWebhookRequest$Outbound; } + +export function getWebhookRequestToJSON( + getWebhookRequest: GetWebhookRequest, +): string { + return JSON.stringify( + GetWebhookRequest$outboundSchema.parse(getWebhookRequest), + ); +} + +export function getWebhookRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => GetWebhookRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'GetWebhookRequest' from JSON`, + ); +} diff --git a/src/models/operations/initiateoauth2signin.ts b/src/models/operations/initiateoauth2signin.ts index ef37f862..fe64a91d 100644 --- a/src/models/operations/initiateoauth2signin.ts +++ b/src/models/operations/initiateoauth2signin.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type InitiateOauth2SigninGlobals = { /** @@ -75,6 +78,26 @@ export namespace InitiateOauth2SigninGlobals$ { export type Outbound = InitiateOauth2SigninGlobals$Outbound; } +export function initiateOauth2SigninGlobalsToJSON( + initiateOauth2SigninGlobals: InitiateOauth2SigninGlobals, +): string { + return JSON.stringify( + InitiateOauth2SigninGlobals$outboundSchema.parse( + initiateOauth2SigninGlobals, + ), + ); +} + +export function initiateOauth2SigninGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => InitiateOauth2SigninGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'InitiateOauth2SigninGlobals' from JSON`, + ); +} + /** @internal */ export const InitiateOauth2SigninRequest$inboundSchema: z.ZodType< InitiateOauth2SigninRequest, @@ -127,6 +150,26 @@ export namespace InitiateOauth2SigninRequest$ { export type Outbound = InitiateOauth2SigninRequest$Outbound; } +export function initiateOauth2SigninRequestToJSON( + initiateOauth2SigninRequest: InitiateOauth2SigninRequest, +): string { + return JSON.stringify( + InitiateOauth2SigninRequest$outboundSchema.parse( + initiateOauth2SigninRequest, + ), + ); +} + +export function initiateOauth2SigninRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => InitiateOauth2SigninRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'InitiateOauth2SigninRequest' from JSON`, + ); +} + /** @internal */ export const InitiateOauth2SigninResponse$inboundSchema: z.ZodType< InitiateOauth2SigninResponse, @@ -170,3 +213,23 @@ export namespace InitiateOauth2SigninResponse$ { /** @deprecated use `InitiateOauth2SigninResponse$Outbound` instead. */ export type Outbound = InitiateOauth2SigninResponse$Outbound; } + +export function initiateOauth2SigninResponseToJSON( + initiateOauth2SigninResponse: InitiateOauth2SigninResponse, +): string { + return JSON.stringify( + InitiateOauth2SigninResponse$outboundSchema.parse( + initiateOauth2SigninResponse, + ), + ); +} + +export function initiateOauth2SigninResponseFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => InitiateOauth2SigninResponse$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'InitiateOauth2SigninResponse' from JSON`, + ); +} diff --git a/src/models/operations/listaddresses.ts b/src/models/operations/listaddresses.ts index e2ae72ec..29b7a455 100644 --- a/src/models/operations/listaddresses.ts +++ b/src/models/operations/listaddresses.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListAddressesGlobals = { /** @@ -67,6 +70,24 @@ export namespace ListAddressesGlobals$ { export type Outbound = ListAddressesGlobals$Outbound; } +export function listAddressesGlobalsToJSON( + listAddressesGlobals: ListAddressesGlobals, +): string { + return JSON.stringify( + ListAddressesGlobals$outboundSchema.parse(listAddressesGlobals), + ); +} + +export function listAddressesGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListAddressesGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListAddressesGlobals' from JSON`, + ); +} + /** @internal */ export const ListAddressesRequest$inboundSchema: z.ZodType< ListAddressesRequest, @@ -105,3 +126,21 @@ export namespace ListAddressesRequest$ { /** @deprecated use `ListAddressesRequest$Outbound` instead. */ export type Outbound = ListAddressesRequest$Outbound; } + +export function listAddressesRequestToJSON( + listAddressesRequest: ListAddressesRequest, +): string { + return JSON.stringify( + ListAddressesRequest$outboundSchema.parse(listAddressesRequest), + ); +} + +export function listAddressesRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListAddressesRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListAddressesRequest' from JSON`, + ); +} diff --git a/src/models/operations/listcarrieraccounts.ts b/src/models/operations/listcarrieraccounts.ts index e9a10a9a..0614b02a 100644 --- a/src/models/operations/listcarrieraccounts.ts +++ b/src/models/operations/listcarrieraccounts.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListCarrierAccountsGlobals = { /** @@ -80,6 +83,24 @@ export namespace ListCarrierAccountsGlobals$ { export type Outbound = ListCarrierAccountsGlobals$Outbound; } +export function listCarrierAccountsGlobalsToJSON( + listCarrierAccountsGlobals: ListCarrierAccountsGlobals, +): string { + return JSON.stringify( + ListCarrierAccountsGlobals$outboundSchema.parse(listCarrierAccountsGlobals), + ); +} + +export function listCarrierAccountsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCarrierAccountsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCarrierAccountsGlobals' from JSON`, + ); +} + /** @internal */ export const ListCarrierAccountsRequest$inboundSchema: z.ZodType< ListCarrierAccountsRequest, @@ -137,3 +158,21 @@ export namespace ListCarrierAccountsRequest$ { /** @deprecated use `ListCarrierAccountsRequest$Outbound` instead. */ export type Outbound = ListCarrierAccountsRequest$Outbound; } + +export function listCarrierAccountsRequestToJSON( + listCarrierAccountsRequest: ListCarrierAccountsRequest, +): string { + return JSON.stringify( + ListCarrierAccountsRequest$outboundSchema.parse(listCarrierAccountsRequest), + ); +} + +export function listCarrierAccountsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCarrierAccountsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCarrierAccountsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listcarrierparceltemplates.ts b/src/models/operations/listcarrierparceltemplates.ts index 13eebf18..70aaa1f8 100644 --- a/src/models/operations/listcarrierparceltemplates.ts +++ b/src/models/operations/listcarrierparceltemplates.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListCarrierParcelTemplatesGlobals = { /** @@ -82,6 +85,26 @@ export namespace ListCarrierParcelTemplatesGlobals$ { export type Outbound = ListCarrierParcelTemplatesGlobals$Outbound; } +export function listCarrierParcelTemplatesGlobalsToJSON( + listCarrierParcelTemplatesGlobals: ListCarrierParcelTemplatesGlobals, +): string { + return JSON.stringify( + ListCarrierParcelTemplatesGlobals$outboundSchema.parse( + listCarrierParcelTemplatesGlobals, + ), + ); +} + +export function listCarrierParcelTemplatesGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCarrierParcelTemplatesGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCarrierParcelTemplatesGlobals' from JSON`, + ); +} + /** @internal */ export const Include$inboundSchema: z.ZodNativeEnum = z .nativeEnum(Include); @@ -140,3 +163,23 @@ export namespace ListCarrierParcelTemplatesRequest$ { /** @deprecated use `ListCarrierParcelTemplatesRequest$Outbound` instead. */ export type Outbound = ListCarrierParcelTemplatesRequest$Outbound; } + +export function listCarrierParcelTemplatesRequestToJSON( + listCarrierParcelTemplatesRequest: ListCarrierParcelTemplatesRequest, +): string { + return JSON.stringify( + ListCarrierParcelTemplatesRequest$outboundSchema.parse( + listCarrierParcelTemplatesRequest, + ), + ); +} + +export function listCarrierParcelTemplatesRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCarrierParcelTemplatesRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCarrierParcelTemplatesRequest' from JSON`, + ); +} diff --git a/src/models/operations/listcustomsdeclarations.ts b/src/models/operations/listcustomsdeclarations.ts index 136f6c2f..5aeae215 100644 --- a/src/models/operations/listcustomsdeclarations.ts +++ b/src/models/operations/listcustomsdeclarations.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListCustomsDeclarationsGlobals = { /** @@ -67,6 +70,26 @@ export namespace ListCustomsDeclarationsGlobals$ { export type Outbound = ListCustomsDeclarationsGlobals$Outbound; } +export function listCustomsDeclarationsGlobalsToJSON( + listCustomsDeclarationsGlobals: ListCustomsDeclarationsGlobals, +): string { + return JSON.stringify( + ListCustomsDeclarationsGlobals$outboundSchema.parse( + listCustomsDeclarationsGlobals, + ), + ); +} + +export function listCustomsDeclarationsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomsDeclarationsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomsDeclarationsGlobals' from JSON`, + ); +} + /** @internal */ export const ListCustomsDeclarationsRequest$inboundSchema: z.ZodType< ListCustomsDeclarationsRequest, @@ -105,3 +128,23 @@ export namespace ListCustomsDeclarationsRequest$ { /** @deprecated use `ListCustomsDeclarationsRequest$Outbound` instead. */ export type Outbound = ListCustomsDeclarationsRequest$Outbound; } + +export function listCustomsDeclarationsRequestToJSON( + listCustomsDeclarationsRequest: ListCustomsDeclarationsRequest, +): string { + return JSON.stringify( + ListCustomsDeclarationsRequest$outboundSchema.parse( + listCustomsDeclarationsRequest, + ), + ); +} + +export function listCustomsDeclarationsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomsDeclarationsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomsDeclarationsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listcustomsitems.ts b/src/models/operations/listcustomsitems.ts index 05d7453c..92aad303 100644 --- a/src/models/operations/listcustomsitems.ts +++ b/src/models/operations/listcustomsitems.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListCustomsItemsGlobals = { /** @@ -67,6 +70,24 @@ export namespace ListCustomsItemsGlobals$ { export type Outbound = ListCustomsItemsGlobals$Outbound; } +export function listCustomsItemsGlobalsToJSON( + listCustomsItemsGlobals: ListCustomsItemsGlobals, +): string { + return JSON.stringify( + ListCustomsItemsGlobals$outboundSchema.parse(listCustomsItemsGlobals), + ); +} + +export function listCustomsItemsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomsItemsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomsItemsGlobals' from JSON`, + ); +} + /** @internal */ export const ListCustomsItemsRequest$inboundSchema: z.ZodType< ListCustomsItemsRequest, @@ -105,3 +126,21 @@ export namespace ListCustomsItemsRequest$ { /** @deprecated use `ListCustomsItemsRequest$Outbound` instead. */ export type Outbound = ListCustomsItemsRequest$Outbound; } + +export function listCustomsItemsRequestToJSON( + listCustomsItemsRequest: ListCustomsItemsRequest, +): string { + return JSON.stringify( + ListCustomsItemsRequest$outboundSchema.parse(listCustomsItemsRequest), + ); +} + +export function listCustomsItemsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListCustomsItemsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListCustomsItemsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listmanifests.ts b/src/models/operations/listmanifests.ts index a9196baf..b5487495 100644 --- a/src/models/operations/listmanifests.ts +++ b/src/models/operations/listmanifests.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListManifestsGlobals = { /** @@ -67,6 +70,24 @@ export namespace ListManifestsGlobals$ { export type Outbound = ListManifestsGlobals$Outbound; } +export function listManifestsGlobalsToJSON( + listManifestsGlobals: ListManifestsGlobals, +): string { + return JSON.stringify( + ListManifestsGlobals$outboundSchema.parse(listManifestsGlobals), + ); +} + +export function listManifestsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListManifestsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListManifestsGlobals' from JSON`, + ); +} + /** @internal */ export const ListManifestsRequest$inboundSchema: z.ZodType< ListManifestsRequest, @@ -105,3 +126,21 @@ export namespace ListManifestsRequest$ { /** @deprecated use `ListManifestsRequest$Outbound` instead. */ export type Outbound = ListManifestsRequest$Outbound; } + +export function listManifestsRequestToJSON( + listManifestsRequest: ListManifestsRequest, +): string { + return JSON.stringify( + ListManifestsRequest$outboundSchema.parse(listManifestsRequest), + ); +} + +export function listManifestsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListManifestsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListManifestsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listorders.ts b/src/models/operations/listorders.ts index 5fdaa8ba..a74ebf5e 100644 --- a/src/models/operations/listorders.ts +++ b/src/models/operations/listorders.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListOrdersGlobals = { /** @@ -90,6 +93,24 @@ export namespace ListOrdersGlobals$ { export type Outbound = ListOrdersGlobals$Outbound; } +export function listOrdersGlobalsToJSON( + listOrdersGlobals: ListOrdersGlobals, +): string { + return JSON.stringify( + ListOrdersGlobals$outboundSchema.parse(listOrdersGlobals), + ); +} + +export function listOrdersGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListOrdersGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListOrdersGlobals' from JSON`, + ); +} + /** @internal */ export const ListOrdersRequest$inboundSchema: z.ZodType< ListOrdersRequest, @@ -155,3 +176,21 @@ export namespace ListOrdersRequest$ { /** @deprecated use `ListOrdersRequest$Outbound` instead. */ export type Outbound = ListOrdersRequest$Outbound; } + +export function listOrdersRequestToJSON( + listOrdersRequest: ListOrdersRequest, +): string { + return JSON.stringify( + ListOrdersRequest$outboundSchema.parse(listOrdersRequest), + ); +} + +export function listOrdersRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListOrdersRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListOrdersRequest' from JSON`, + ); +} diff --git a/src/models/operations/listparcels.ts b/src/models/operations/listparcels.ts index 2b314652..edad3522 100644 --- a/src/models/operations/listparcels.ts +++ b/src/models/operations/listparcels.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListParcelsGlobals = { /** @@ -67,6 +70,24 @@ export namespace ListParcelsGlobals$ { export type Outbound = ListParcelsGlobals$Outbound; } +export function listParcelsGlobalsToJSON( + listParcelsGlobals: ListParcelsGlobals, +): string { + return JSON.stringify( + ListParcelsGlobals$outboundSchema.parse(listParcelsGlobals), + ); +} + +export function listParcelsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListParcelsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListParcelsGlobals' from JSON`, + ); +} + /** @internal */ export const ListParcelsRequest$inboundSchema: z.ZodType< ListParcelsRequest, @@ -105,3 +126,21 @@ export namespace ListParcelsRequest$ { /** @deprecated use `ListParcelsRequest$Outbound` instead. */ export type Outbound = ListParcelsRequest$Outbound; } + +export function listParcelsRequestToJSON( + listParcelsRequest: ListParcelsRequest, +): string { + return JSON.stringify( + ListParcelsRequest$outboundSchema.parse(listParcelsRequest), + ); +} + +export function listParcelsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListParcelsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListParcelsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listrefunds.ts b/src/models/operations/listrefunds.ts index 16b75970..ea049f02 100644 --- a/src/models/operations/listrefunds.ts +++ b/src/models/operations/listrefunds.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListRefundsGlobals = { /** @@ -58,6 +61,24 @@ export namespace ListRefundsGlobals$ { export type Outbound = ListRefundsGlobals$Outbound; } +export function listRefundsGlobalsToJSON( + listRefundsGlobals: ListRefundsGlobals, +): string { + return JSON.stringify( + ListRefundsGlobals$outboundSchema.parse(listRefundsGlobals), + ); +} + +export function listRefundsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListRefundsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListRefundsGlobals' from JSON`, + ); +} + /** @internal */ export const ListRefundsRequest$inboundSchema: z.ZodType< ListRefundsRequest, @@ -87,3 +108,21 @@ export namespace ListRefundsRequest$ { /** @deprecated use `ListRefundsRequest$Outbound` instead. */ export type Outbound = ListRefundsRequest$Outbound; } + +export function listRefundsRequestToJSON( + listRefundsRequest: ListRefundsRequest, +): string { + return JSON.stringify( + ListRefundsRequest$outboundSchema.parse(listRefundsRequest), + ); +} + +export function listRefundsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListRefundsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListRefundsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listservicegroups.ts b/src/models/operations/listservicegroups.ts index d51ff361..7b8c29f7 100644 --- a/src/models/operations/listservicegroups.ts +++ b/src/models/operations/listservicegroups.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListServiceGroupsGlobals = { /** @@ -58,6 +61,24 @@ export namespace ListServiceGroupsGlobals$ { export type Outbound = ListServiceGroupsGlobals$Outbound; } +export function listServiceGroupsGlobalsToJSON( + listServiceGroupsGlobals: ListServiceGroupsGlobals, +): string { + return JSON.stringify( + ListServiceGroupsGlobals$outboundSchema.parse(listServiceGroupsGlobals), + ); +} + +export function listServiceGroupsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListServiceGroupsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListServiceGroupsGlobals' from JSON`, + ); +} + /** @internal */ export const ListServiceGroupsRequest$inboundSchema: z.ZodType< ListServiceGroupsRequest, @@ -87,3 +108,21 @@ export namespace ListServiceGroupsRequest$ { /** @deprecated use `ListServiceGroupsRequest$Outbound` instead. */ export type Outbound = ListServiceGroupsRequest$Outbound; } + +export function listServiceGroupsRequestToJSON( + listServiceGroupsRequest: ListServiceGroupsRequest, +): string { + return JSON.stringify( + ListServiceGroupsRequest$outboundSchema.parse(listServiceGroupsRequest), + ); +} + +export function listServiceGroupsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListServiceGroupsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListServiceGroupsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listshipmentrates.ts b/src/models/operations/listshipmentrates.ts index ccc9ab3c..a71d9237 100644 --- a/src/models/operations/listshipmentrates.ts +++ b/src/models/operations/listshipmentrates.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListShipmentRatesGlobals = { /** @@ -71,6 +74,24 @@ export namespace ListShipmentRatesGlobals$ { export type Outbound = ListShipmentRatesGlobals$Outbound; } +export function listShipmentRatesGlobalsToJSON( + listShipmentRatesGlobals: ListShipmentRatesGlobals, +): string { + return JSON.stringify( + ListShipmentRatesGlobals$outboundSchema.parse(listShipmentRatesGlobals), + ); +} + +export function listShipmentRatesGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListShipmentRatesGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShipmentRatesGlobals' from JSON`, + ); +} + /** @internal */ export const ListShipmentRatesRequest$inboundSchema: z.ZodType< ListShipmentRatesRequest, @@ -120,3 +141,21 @@ export namespace ListShipmentRatesRequest$ { /** @deprecated use `ListShipmentRatesRequest$Outbound` instead. */ export type Outbound = ListShipmentRatesRequest$Outbound; } + +export function listShipmentRatesRequestToJSON( + listShipmentRatesRequest: ListShipmentRatesRequest, +): string { + return JSON.stringify( + ListShipmentRatesRequest$outboundSchema.parse(listShipmentRatesRequest), + ); +} + +export function listShipmentRatesRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListShipmentRatesRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShipmentRatesRequest' from JSON`, + ); +} diff --git a/src/models/operations/listshipmentratesbycurrencycode.ts b/src/models/operations/listshipmentratesbycurrencycode.ts index f14e9fec..406979d2 100644 --- a/src/models/operations/listshipmentratesbycurrencycode.ts +++ b/src/models/operations/listshipmentratesbycurrencycode.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListShipmentRatesByCurrencyCodeGlobals = { /** @@ -77,6 +80,28 @@ export namespace ListShipmentRatesByCurrencyCodeGlobals$ { export type Outbound = ListShipmentRatesByCurrencyCodeGlobals$Outbound; } +export function listShipmentRatesByCurrencyCodeGlobalsToJSON( + listShipmentRatesByCurrencyCodeGlobals: + ListShipmentRatesByCurrencyCodeGlobals, +): string { + return JSON.stringify( + ListShipmentRatesByCurrencyCodeGlobals$outboundSchema.parse( + listShipmentRatesByCurrencyCodeGlobals, + ), + ); +} + +export function listShipmentRatesByCurrencyCodeGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + ListShipmentRatesByCurrencyCodeGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShipmentRatesByCurrencyCodeGlobals' from JSON`, + ); +} + /** @internal */ export const ListShipmentRatesByCurrencyCodeRequest$inboundSchema: z.ZodType< ListShipmentRatesByCurrencyCodeRequest, @@ -133,3 +158,25 @@ export namespace ListShipmentRatesByCurrencyCodeRequest$ { /** @deprecated use `ListShipmentRatesByCurrencyCodeRequest$Outbound` instead. */ export type Outbound = ListShipmentRatesByCurrencyCodeRequest$Outbound; } + +export function listShipmentRatesByCurrencyCodeRequestToJSON( + listShipmentRatesByCurrencyCodeRequest: + ListShipmentRatesByCurrencyCodeRequest, +): string { + return JSON.stringify( + ListShipmentRatesByCurrencyCodeRequest$outboundSchema.parse( + listShipmentRatesByCurrencyCodeRequest, + ), + ); +} + +export function listShipmentRatesByCurrencyCodeRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + ListShipmentRatesByCurrencyCodeRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShipmentRatesByCurrencyCodeRequest' from JSON`, + ); +} diff --git a/src/models/operations/listshipments.ts b/src/models/operations/listshipments.ts index c7a01989..31e72989 100644 --- a/src/models/operations/listshipments.ts +++ b/src/models/operations/listshipments.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListShipmentsGlobals = { /** @@ -87,6 +90,24 @@ export namespace ListShipmentsGlobals$ { export type Outbound = ListShipmentsGlobals$Outbound; } +export function listShipmentsGlobalsToJSON( + listShipmentsGlobals: ListShipmentsGlobals, +): string { + return JSON.stringify( + ListShipmentsGlobals$outboundSchema.parse(listShipmentsGlobals), + ); +} + +export function listShipmentsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListShipmentsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShipmentsGlobals' from JSON`, + ); +} + /** @internal */ export const ListShipmentsRequest$inboundSchema: z.ZodType< ListShipmentsRequest, @@ -156,3 +177,21 @@ export namespace ListShipmentsRequest$ { /** @deprecated use `ListShipmentsRequest$Outbound` instead. */ export type Outbound = ListShipmentsRequest$Outbound; } + +export function listShipmentsRequestToJSON( + listShipmentsRequest: ListShipmentsRequest, +): string { + return JSON.stringify( + ListShipmentsRequest$outboundSchema.parse(listShipmentsRequest), + ); +} + +export function listShipmentsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListShipmentsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShipmentsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listshippoaccounts.ts b/src/models/operations/listshippoaccounts.ts index 1a7fcec0..94cbdd33 100644 --- a/src/models/operations/listshippoaccounts.ts +++ b/src/models/operations/listshippoaccounts.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListShippoAccountsGlobals = { /** @@ -67,6 +70,24 @@ export namespace ListShippoAccountsGlobals$ { export type Outbound = ListShippoAccountsGlobals$Outbound; } +export function listShippoAccountsGlobalsToJSON( + listShippoAccountsGlobals: ListShippoAccountsGlobals, +): string { + return JSON.stringify( + ListShippoAccountsGlobals$outboundSchema.parse(listShippoAccountsGlobals), + ); +} + +export function listShippoAccountsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListShippoAccountsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShippoAccountsGlobals' from JSON`, + ); +} + /** @internal */ export const ListShippoAccountsRequest$inboundSchema: z.ZodType< ListShippoAccountsRequest, @@ -105,3 +126,21 @@ export namespace ListShippoAccountsRequest$ { /** @deprecated use `ListShippoAccountsRequest$Outbound` instead. */ export type Outbound = ListShippoAccountsRequest$Outbound; } + +export function listShippoAccountsRequestToJSON( + listShippoAccountsRequest: ListShippoAccountsRequest, +): string { + return JSON.stringify( + ListShippoAccountsRequest$outboundSchema.parse(listShippoAccountsRequest), + ); +} + +export function listShippoAccountsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListShippoAccountsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListShippoAccountsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listtransactions.ts b/src/models/operations/listtransactions.ts index dac94e7b..bb4b60a9 100644 --- a/src/models/operations/listtransactions.ts +++ b/src/models/operations/listtransactions.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListTransactionsGlobals = { /** @@ -80,6 +83,24 @@ export namespace ListTransactionsGlobals$ { export type Outbound = ListTransactionsGlobals$Outbound; } +export function listTransactionsGlobalsToJSON( + listTransactionsGlobals: ListTransactionsGlobals, +): string { + return JSON.stringify( + ListTransactionsGlobals$outboundSchema.parse(listTransactionsGlobals), + ); +} + +export function listTransactionsGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListTransactionsGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListTransactionsGlobals' from JSON`, + ); +} + /** @internal */ export const ListTransactionsRequest$inboundSchema: z.ZodType< ListTransactionsRequest, @@ -137,3 +158,21 @@ export namespace ListTransactionsRequest$ { /** @deprecated use `ListTransactionsRequest$Outbound` instead. */ export type Outbound = ListTransactionsRequest$Outbound; } + +export function listTransactionsRequestToJSON( + listTransactionsRequest: ListTransactionsRequest, +): string { + return JSON.stringify( + ListTransactionsRequest$outboundSchema.parse(listTransactionsRequest), + ); +} + +export function listTransactionsRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListTransactionsRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListTransactionsRequest' from JSON`, + ); +} diff --git a/src/models/operations/listuserparceltemplates.ts b/src/models/operations/listuserparceltemplates.ts index 9dd876d9..2a4ac4f8 100644 --- a/src/models/operations/listuserparceltemplates.ts +++ b/src/models/operations/listuserparceltemplates.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ListUserParcelTemplatesGlobals = { /** @@ -58,6 +61,26 @@ export namespace ListUserParcelTemplatesGlobals$ { export type Outbound = ListUserParcelTemplatesGlobals$Outbound; } +export function listUserParcelTemplatesGlobalsToJSON( + listUserParcelTemplatesGlobals: ListUserParcelTemplatesGlobals, +): string { + return JSON.stringify( + ListUserParcelTemplatesGlobals$outboundSchema.parse( + listUserParcelTemplatesGlobals, + ), + ); +} + +export function listUserParcelTemplatesGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListUserParcelTemplatesGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListUserParcelTemplatesGlobals' from JSON`, + ); +} + /** @internal */ export const ListUserParcelTemplatesRequest$inboundSchema: z.ZodType< ListUserParcelTemplatesRequest, @@ -87,3 +110,23 @@ export namespace ListUserParcelTemplatesRequest$ { /** @deprecated use `ListUserParcelTemplatesRequest$Outbound` instead. */ export type Outbound = ListUserParcelTemplatesRequest$Outbound; } + +export function listUserParcelTemplatesRequestToJSON( + listUserParcelTemplatesRequest: ListUserParcelTemplatesRequest, +): string { + return JSON.stringify( + ListUserParcelTemplatesRequest$outboundSchema.parse( + listUserParcelTemplatesRequest, + ), + ); +} + +export function listUserParcelTemplatesRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ListUserParcelTemplatesRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ListUserParcelTemplatesRequest' from JSON`, + ); +} diff --git a/src/models/operations/purchasebatch.ts b/src/models/operations/purchasebatch.ts index 725f9365..6e7cf58b 100644 --- a/src/models/operations/purchasebatch.ts +++ b/src/models/operations/purchasebatch.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PurchaseBatchGlobals = { /** @@ -63,6 +66,24 @@ export namespace PurchaseBatchGlobals$ { export type Outbound = PurchaseBatchGlobals$Outbound; } +export function purchaseBatchGlobalsToJSON( + purchaseBatchGlobals: PurchaseBatchGlobals, +): string { + return JSON.stringify( + PurchaseBatchGlobals$outboundSchema.parse(purchaseBatchGlobals), + ); +} + +export function purchaseBatchGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PurchaseBatchGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PurchaseBatchGlobals' from JSON`, + ); +} + /** @internal */ export const PurchaseBatchRequest$inboundSchema: z.ZodType< PurchaseBatchRequest, @@ -106,3 +127,21 @@ export namespace PurchaseBatchRequest$ { /** @deprecated use `PurchaseBatchRequest$Outbound` instead. */ export type Outbound = PurchaseBatchRequest$Outbound; } + +export function purchaseBatchRequestToJSON( + purchaseBatchRequest: PurchaseBatchRequest, +): string { + return JSON.stringify( + PurchaseBatchRequest$outboundSchema.parse(purchaseBatchRequest), + ); +} + +export function purchaseBatchRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => PurchaseBatchRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'PurchaseBatchRequest' from JSON`, + ); +} diff --git a/src/models/operations/registercarrieraccount.ts b/src/models/operations/registercarrieraccount.ts index c78e06dd..31d708d6 100644 --- a/src/models/operations/registercarrieraccount.ts +++ b/src/models/operations/registercarrieraccount.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type RegisterCarrierAccountGlobals = { /** @@ -77,6 +80,26 @@ export namespace RegisterCarrierAccountGlobals$ { export type Outbound = RegisterCarrierAccountGlobals$Outbound; } +export function registerCarrierAccountGlobalsToJSON( + registerCarrierAccountGlobals: RegisterCarrierAccountGlobals, +): string { + return JSON.stringify( + RegisterCarrierAccountGlobals$outboundSchema.parse( + registerCarrierAccountGlobals, + ), + ); +} + +export function registerCarrierAccountGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RegisterCarrierAccountGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RegisterCarrierAccountGlobals' from JSON`, + ); +} + /** @internal */ export const RegisterCarrierAccountRequestBody$inboundSchema: z.ZodType< RegisterCarrierAccountRequestBody, @@ -154,3 +177,23 @@ export namespace RegisterCarrierAccountRequestBody$ { /** @deprecated use `RegisterCarrierAccountRequestBody$Outbound` instead. */ export type Outbound = RegisterCarrierAccountRequestBody$Outbound; } + +export function registerCarrierAccountRequestBodyToJSON( + registerCarrierAccountRequestBody: RegisterCarrierAccountRequestBody, +): string { + return JSON.stringify( + RegisterCarrierAccountRequestBody$outboundSchema.parse( + registerCarrierAccountRequestBody, + ), + ); +} + +export function registerCarrierAccountRequestBodyFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RegisterCarrierAccountRequestBody$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RegisterCarrierAccountRequestBody' from JSON`, + ); +} diff --git a/src/models/operations/removeshipmentsfrombatch.ts b/src/models/operations/removeshipmentsfrombatch.ts index 62bbf3f9..91bcb222 100644 --- a/src/models/operations/removeshipmentsfrombatch.ts +++ b/src/models/operations/removeshipmentsfrombatch.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type RemoveShipmentsFromBatchGlobals = { /** @@ -67,6 +70,26 @@ export namespace RemoveShipmentsFromBatchGlobals$ { export type Outbound = RemoveShipmentsFromBatchGlobals$Outbound; } +export function removeShipmentsFromBatchGlobalsToJSON( + removeShipmentsFromBatchGlobals: RemoveShipmentsFromBatchGlobals, +): string { + return JSON.stringify( + RemoveShipmentsFromBatchGlobals$outboundSchema.parse( + removeShipmentsFromBatchGlobals, + ), + ); +} + +export function removeShipmentsFromBatchGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RemoveShipmentsFromBatchGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RemoveShipmentsFromBatchGlobals' from JSON`, + ); +} + /** @internal */ export const RemoveShipmentsFromBatchRequest$inboundSchema: z.ZodType< RemoveShipmentsFromBatchRequest, @@ -115,3 +138,23 @@ export namespace RemoveShipmentsFromBatchRequest$ { /** @deprecated use `RemoveShipmentsFromBatchRequest$Outbound` instead. */ export type Outbound = RemoveShipmentsFromBatchRequest$Outbound; } + +export function removeShipmentsFromBatchRequestToJSON( + removeShipmentsFromBatchRequest: RemoveShipmentsFromBatchRequest, +): string { + return JSON.stringify( + RemoveShipmentsFromBatchRequest$outboundSchema.parse( + removeShipmentsFromBatchRequest, + ), + ); +} + +export function removeShipmentsFromBatchRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => RemoveShipmentsFromBatchRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'RemoveShipmentsFromBatchRequest' from JSON`, + ); +} diff --git a/src/models/operations/updatecarrieraccount.ts b/src/models/operations/updatecarrieraccount.ts index 4867f061..dfd81600 100644 --- a/src/models/operations/updatecarrieraccount.ts +++ b/src/models/operations/updatecarrieraccount.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateCarrierAccountGlobals = { /** @@ -68,6 +71,26 @@ export namespace UpdateCarrierAccountGlobals$ { export type Outbound = UpdateCarrierAccountGlobals$Outbound; } +export function updateCarrierAccountGlobalsToJSON( + updateCarrierAccountGlobals: UpdateCarrierAccountGlobals, +): string { + return JSON.stringify( + UpdateCarrierAccountGlobals$outboundSchema.parse( + updateCarrierAccountGlobals, + ), + ); +} + +export function updateCarrierAccountGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCarrierAccountGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCarrierAccountGlobals' from JSON`, + ); +} + /** @internal */ export const UpdateCarrierAccountRequest$inboundSchema: z.ZodType< UpdateCarrierAccountRequest, @@ -116,3 +139,23 @@ export namespace UpdateCarrierAccountRequest$ { /** @deprecated use `UpdateCarrierAccountRequest$Outbound` instead. */ export type Outbound = UpdateCarrierAccountRequest$Outbound; } + +export function updateCarrierAccountRequestToJSON( + updateCarrierAccountRequest: UpdateCarrierAccountRequest, +): string { + return JSON.stringify( + UpdateCarrierAccountRequest$outboundSchema.parse( + updateCarrierAccountRequest, + ), + ); +} + +export function updateCarrierAccountRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateCarrierAccountRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateCarrierAccountRequest' from JSON`, + ); +} diff --git a/src/models/operations/updatedefaultparceltemplate.ts b/src/models/operations/updatedefaultparceltemplate.ts index 1e66563d..fc685641 100644 --- a/src/models/operations/updatedefaultparceltemplate.ts +++ b/src/models/operations/updatedefaultparceltemplate.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateDefaultParcelTemplateGlobals = { /** @@ -56,3 +59,24 @@ export namespace UpdateDefaultParcelTemplateGlobals$ { /** @deprecated use `UpdateDefaultParcelTemplateGlobals$Outbound` instead. */ export type Outbound = UpdateDefaultParcelTemplateGlobals$Outbound; } + +export function updateDefaultParcelTemplateGlobalsToJSON( + updateDefaultParcelTemplateGlobals: UpdateDefaultParcelTemplateGlobals, +): string { + return JSON.stringify( + UpdateDefaultParcelTemplateGlobals$outboundSchema.parse( + updateDefaultParcelTemplateGlobals, + ), + ); +} + +export function updateDefaultParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => + UpdateDefaultParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateDefaultParcelTemplateGlobals' from JSON`, + ); +} diff --git a/src/models/operations/updateservicegroup.ts b/src/models/operations/updateservicegroup.ts index 490cd3e3..054c31d0 100644 --- a/src/models/operations/updateservicegroup.ts +++ b/src/models/operations/updateservicegroup.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateServiceGroupGlobals = { /** @@ -55,3 +58,21 @@ export namespace UpdateServiceGroupGlobals$ { /** @deprecated use `UpdateServiceGroupGlobals$Outbound` instead. */ export type Outbound = UpdateServiceGroupGlobals$Outbound; } + +export function updateServiceGroupGlobalsToJSON( + updateServiceGroupGlobals: UpdateServiceGroupGlobals, +): string { + return JSON.stringify( + UpdateServiceGroupGlobals$outboundSchema.parse(updateServiceGroupGlobals), + ); +} + +export function updateServiceGroupGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateServiceGroupGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateServiceGroupGlobals' from JSON`, + ); +} diff --git a/src/models/operations/updateshippoaccount.ts b/src/models/operations/updateshippoaccount.ts index 5ab47636..6cce7df6 100644 --- a/src/models/operations/updateshippoaccount.ts +++ b/src/models/operations/updateshippoaccount.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateShippoAccountGlobals = { /** @@ -67,6 +70,24 @@ export namespace UpdateShippoAccountGlobals$ { export type Outbound = UpdateShippoAccountGlobals$Outbound; } +export function updateShippoAccountGlobalsToJSON( + updateShippoAccountGlobals: UpdateShippoAccountGlobals, +): string { + return JSON.stringify( + UpdateShippoAccountGlobals$outboundSchema.parse(updateShippoAccountGlobals), + ); +} + +export function updateShippoAccountGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateShippoAccountGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateShippoAccountGlobals' from JSON`, + ); +} + /** @internal */ export const UpdateShippoAccountRequest$inboundSchema: z.ZodType< UpdateShippoAccountRequest, @@ -119,3 +140,21 @@ export namespace UpdateShippoAccountRequest$ { /** @deprecated use `UpdateShippoAccountRequest$Outbound` instead. */ export type Outbound = UpdateShippoAccountRequest$Outbound; } + +export function updateShippoAccountRequestToJSON( + updateShippoAccountRequest: UpdateShippoAccountRequest, +): string { + return JSON.stringify( + UpdateShippoAccountRequest$outboundSchema.parse(updateShippoAccountRequest), + ); +} + +export function updateShippoAccountRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateShippoAccountRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateShippoAccountRequest' from JSON`, + ); +} diff --git a/src/models/operations/updateuserparceltemplate.ts b/src/models/operations/updateuserparceltemplate.ts index 297dd53f..cb6b78bc 100644 --- a/src/models/operations/updateuserparceltemplate.ts +++ b/src/models/operations/updateuserparceltemplate.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateUserParcelTemplateGlobals = { /** @@ -67,6 +70,26 @@ export namespace UpdateUserParcelTemplateGlobals$ { export type Outbound = UpdateUserParcelTemplateGlobals$Outbound; } +export function updateUserParcelTemplateGlobalsToJSON( + updateUserParcelTemplateGlobals: UpdateUserParcelTemplateGlobals, +): string { + return JSON.stringify( + UpdateUserParcelTemplateGlobals$outboundSchema.parse( + updateUserParcelTemplateGlobals, + ), + ); +} + +export function updateUserParcelTemplateGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateUserParcelTemplateGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateUserParcelTemplateGlobals' from JSON`, + ); +} + /** @internal */ export const UpdateUserParcelTemplateRequest$inboundSchema: z.ZodType< UpdateUserParcelTemplateRequest, @@ -119,3 +142,23 @@ export namespace UpdateUserParcelTemplateRequest$ { /** @deprecated use `UpdateUserParcelTemplateRequest$Outbound` instead. */ export type Outbound = UpdateUserParcelTemplateRequest$Outbound; } + +export function updateUserParcelTemplateRequestToJSON( + updateUserParcelTemplateRequest: UpdateUserParcelTemplateRequest, +): string { + return JSON.stringify( + UpdateUserParcelTemplateRequest$outboundSchema.parse( + updateUserParcelTemplateRequest, + ), + ); +} + +export function updateUserParcelTemplateRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateUserParcelTemplateRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateUserParcelTemplateRequest' from JSON`, + ); +} diff --git a/src/models/operations/updatewebhook.ts b/src/models/operations/updatewebhook.ts index 095d62b2..686bd54f 100644 --- a/src/models/operations/updatewebhook.ts +++ b/src/models/operations/updatewebhook.ts @@ -4,7 +4,10 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type UpdateWebhookRequest = { /** @@ -60,3 +63,21 @@ export namespace UpdateWebhookRequest$ { /** @deprecated use `UpdateWebhookRequest$Outbound` instead. */ export type Outbound = UpdateWebhookRequest$Outbound; } + +export function updateWebhookRequestToJSON( + updateWebhookRequest: UpdateWebhookRequest, +): string { + return JSON.stringify( + UpdateWebhookRequest$outboundSchema.parse(updateWebhookRequest), + ); +} + +export function updateWebhookRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => UpdateWebhookRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'UpdateWebhookRequest' from JSON`, + ); +} diff --git a/src/models/operations/validateaddress.ts b/src/models/operations/validateaddress.ts index be9a48f6..20b7a0a7 100644 --- a/src/models/operations/validateaddress.ts +++ b/src/models/operations/validateaddress.ts @@ -4,6 +4,9 @@ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; +import { safeParse } from "../../lib/schemas.js"; +import { Result as SafeParseResult } from "../../types/fp.js"; +import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type ValidateAddressGlobals = { /** @@ -63,6 +66,24 @@ export namespace ValidateAddressGlobals$ { export type Outbound = ValidateAddressGlobals$Outbound; } +export function validateAddressGlobalsToJSON( + validateAddressGlobals: ValidateAddressGlobals, +): string { + return JSON.stringify( + ValidateAddressGlobals$outboundSchema.parse(validateAddressGlobals), + ); +} + +export function validateAddressGlobalsFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ValidateAddressGlobals$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ValidateAddressGlobals' from JSON`, + ); +} + /** @internal */ export const ValidateAddressRequest$inboundSchema: z.ZodType< ValidateAddressRequest, @@ -106,3 +127,21 @@ export namespace ValidateAddressRequest$ { /** @deprecated use `ValidateAddressRequest$Outbound` instead. */ export type Outbound = ValidateAddressRequest$Outbound; } + +export function validateAddressRequestToJSON( + validateAddressRequest: ValidateAddressRequest, +): string { + return JSON.stringify( + ValidateAddressRequest$outboundSchema.parse(validateAddressRequest), + ); +} + +export function validateAddressRequestFromJSON( + jsonString: string, +): SafeParseResult { + return safeParse( + jsonString, + (x) => ValidateAddressRequest$inboundSchema.parse(JSON.parse(x)), + `Failed to parse 'ValidateAddressRequest' from JSON`, + ); +} diff --git a/src/sdk/batches.ts b/src/sdk/batches.ts index f9e8a983..9c0c4227 100644 --- a/src/sdk/batches.ts +++ b/src/sdk/batches.ts @@ -60,14 +60,14 @@ export class Batches extends ClientSDK { * Adds batch shipments to an existing batch. */ async addShipments( - batchId: string, requestBody: Array, + batchId: string, options?: RequestOptions, ): Promise { return unwrapAsync(batchesAddShipments( this, - batchId, requestBody, + batchId, options, )); } @@ -99,14 +99,14 @@ export class Batches extends ClientSDK { * Removes shipments from an existing batch shipment. */ async removeShipments( - batchId: string, requestBody: Array, + batchId: string, options?: RequestOptions, ): Promise { return unwrapAsync(batchesRemoveShipments( this, - batchId, requestBody, + batchId, options, )); } diff --git a/src/sdk/ratesatcheckout.ts b/src/sdk/ratesatcheckout.ts index 0f82882d..90e7a260 100644 --- a/src/sdk/ratesatcheckout.ts +++ b/src/sdk/ratesatcheckout.ts @@ -8,6 +8,7 @@ import { ratesAtCheckoutGetDefaultParcelTemplate } from "../funcs/ratesAtCheckou import { ratesAtCheckoutUpdateDefaultParcelTemplate } from "../funcs/ratesAtCheckoutUpdateDefaultParcelTemplate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class RatesAtCheckout extends ClientSDK { @@ -38,10 +39,12 @@ export class RatesAtCheckout extends ClientSDK { * Retrieve and display the currently configured default parcel template for live rates. */ async getDefaultParcelTemplate( + request: operations.GetDefaultParcelTemplateRequest, options?: RequestOptions, ): Promise { return unwrapAsync(ratesAtCheckoutGetDefaultParcelTemplate( this, + request, options, )); } @@ -53,12 +56,12 @@ export class RatesAtCheckout extends ClientSDK { * Update the currently configured default parcel template for live rates. The object_id in the request payload should identify the user parcel template to be the new default. */ async updateDefaultParcelTemplate( - objectId?: string | undefined, + request?: components.DefaultParcelTemplateUpdateRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(ratesAtCheckoutUpdateDefaultParcelTemplate( this, - objectId, + request, options, )); } @@ -70,10 +73,12 @@ export class RatesAtCheckout extends ClientSDK { * Clears the currently configured default parcel template for live rates. */ async deleteDefaultParcelTemplate( + request: operations.DeleteDefaultParcelTemplateRequest, options?: RequestOptions, ): Promise { return unwrapAsync(ratesAtCheckoutDeleteDefaultParcelTemplate( this, + request, options, )); } diff --git a/src/sdk/refunds.ts b/src/sdk/refunds.ts index 8c77430b..70c9cf88 100644 --- a/src/sdk/refunds.ts +++ b/src/sdk/refunds.ts @@ -7,6 +7,7 @@ import { refundsGet } from "../funcs/refundsGet.js"; import { refundsList } from "../funcs/refundsList.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Refunds extends ClientSDK { @@ -17,14 +18,12 @@ export class Refunds extends ClientSDK { * Creates a new refund object. */ async create( - transaction: string, - async?: boolean | undefined, + request: components.RefundRequestBody, options?: RequestOptions, ): Promise { return unwrapAsync(refundsCreate( this, - transaction, - async, + request, options, )); } @@ -36,10 +35,12 @@ export class Refunds extends ClientSDK { * Returns a list all refund objects. */ async list( + request: operations.ListRefundsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(refundsList( this, + request, options, )); } diff --git a/src/sdk/servicegroups.ts b/src/sdk/servicegroups.ts index 36e04a2a..7786d5aa 100644 --- a/src/sdk/servicegroups.ts +++ b/src/sdk/servicegroups.ts @@ -8,6 +8,7 @@ import { serviceGroupsList } from "../funcs/serviceGroupsList.js"; import { serviceGroupsUpdate } from "../funcs/serviceGroupsUpdate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class ServiceGroups extends ClientSDK { @@ -18,10 +19,12 @@ export class ServiceGroups extends ClientSDK { * Returns a list of service group objects. */ async list( + request: operations.ListServiceGroupsRequest, options?: RequestOptions, ): Promise> { return unwrapAsync(serviceGroupsList( this, + request, options, )); } diff --git a/src/sdk/trackingstatus.ts b/src/sdk/trackingstatus.ts index 37122b8f..f4dfc020 100644 --- a/src/sdk/trackingstatus.ts +++ b/src/sdk/trackingstatus.ts @@ -16,16 +16,12 @@ export class TrackingStatus extends ClientSDK { * Registers a webhook that will send HTTP notifications to you when the status of your tracked package changes. For more details on creating a webhook, see our guides on
Webhooks and Tracking. */ async create( - carrier: string, - trackingNumber: string, - metadata?: string | undefined, + request: components.TracksRequest, options?: RequestOptions, ): Promise { return unwrapAsync(trackingStatusCreate( this, - carrier, - trackingNumber, - metadata, + request, options, )); } diff --git a/src/sdk/userparceltemplates.ts b/src/sdk/userparceltemplates.ts index 0cfa771b..06e436f4 100644 --- a/src/sdk/userparceltemplates.ts +++ b/src/sdk/userparceltemplates.ts @@ -9,6 +9,7 @@ import { userParcelTemplatesList } from "../funcs/userParcelTemplatesList.js"; import { userParcelTemplatesUpdate } from "../funcs/userParcelTemplatesUpdate.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as components from "../models/components/index.js"; +import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class UserParcelTemplates extends ClientSDK { @@ -19,10 +20,12 @@ export class UserParcelTemplates extends ClientSDK { * Returns a list all of all user parcel template objects. */ async list( + request: operations.ListUserParcelTemplatesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(userParcelTemplatesList( this, + request, options, )); } diff --git a/src/sdk/webhooks.ts b/src/sdk/webhooks.ts index f99f47a6..de098a35 100644 --- a/src/sdk/webhooks.ts +++ b/src/sdk/webhooks.ts @@ -68,14 +68,14 @@ export class Webhooks extends ClientSDK { * Updates an existing webhook using the webhook object ID. */ async updateWebhook( - webhookId: string, webhookUpdateRequest: components.WebhookUpdateRequest, + webhookId: string, options?: RequestOptions, ): Promise { return unwrapAsync(webhooksUpdateWebhook( this, - webhookId, webhookUpdateRequest, + webhookId, options, )); } diff --git a/src/types/index.ts b/src/types/index.ts index e124e817..74ee06ce 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -9,3 +9,4 @@ export type { Result } from "./fp.js"; export type { PageIterator, Paginator } from "./operations.js"; export { createPageIterator } from "./operations.js"; export { RFCDate } from "./rfcdate.js"; +export type { WebhookRecipient } from "./webhooks.js"; diff --git a/src/types/operations.ts b/src/types/operations.ts index 0952f6f4..beb81e10 100644 --- a/src/types/operations.ts +++ b/src/types/operations.ts @@ -6,9 +6,10 @@ import { Result } from "./fp.js"; export type Paginator = () => Promise }> | null; -export type PageIterator = V & { +export type PageIterator = V & { next: Paginator; [Symbol.asyncIterator]: () => AsyncIterableIterator; + "~next"?: PageState | undefined; }; export function createPageIterator( @@ -40,7 +41,9 @@ export function createPageIterator( * terminates. It is useful in paginated SDK functions that have early return * paths when things go wrong. */ -export function haltIterator(v: V): PageIterator { +export function haltIterator( + v: V, +): PageIterator { return { ...v, next: () => null, @@ -54,9 +57,9 @@ export function haltIterator(v: V): PageIterator { * Converts an async iterator of `Result` into an async iterator of `V`. * When error results occur, the underlying error value is thrown. */ -export async function unwrapResultIterator( - iteratorPromise: Promise>>, -): Promise> { +export async function unwrapResultIterator( + iteratorPromise: Promise, PageState>>, +): Promise> { const resultIter = await iteratorPromise; if (!resultIter.ok) { @@ -66,6 +69,7 @@ export async function unwrapResultIterator( return { ...resultIter.value, next: unwrapPaginator(resultIter.next), + "~next": resultIter["~next"], [Symbol.asyncIterator]: async function* paginator() { for await (const page of resultIter) { if (!page.ok) { @@ -97,3 +101,5 @@ function unwrapPaginator( }); }; } + +export const URL_OVERRIDE = Symbol("URL_OVERRIDE"); diff --git a/src/types/webhooks.ts b/src/types/webhooks.ts new file mode 100644 index 00000000..9510d20c --- /dev/null +++ b/src/types/webhooks.ts @@ -0,0 +1,7 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +export type WebhookRecipient = { + url: string; +}; diff --git a/tsconfig.json b/tsconfig.json index 7a86d2d9..94d81a34 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,8 +2,9 @@ "compilerOptions": { "incremental": true, "tsBuildInfoFile": ".tsbuildinfo", - "target": "ES2018", + "target": "ES2020", "lib": ["ES2022", "DOM", "DOM.Iterable"], + "jsx": "react-jsx", "module": "Node16", "moduleResolution": "Node16",