diff --git a/.eslintignore b/.eslintignore index 73270f08b..d2b87fc6a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,4 +2,5 @@ dist /docs examples node_modules +types types/demo diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a01aadc2..bf23ddb41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: with: node-version: ${{ matrix.node-version }} - run: EASYPOST_TEST_API_KEY=123 EASYPOST_PROD_API_KEY=123 just test-node-compatibility - # typescript checks that the our Typescript definitions can be compiled without errors + # typescript checks that TypeScript declarations and compatibility tests compile without errors typescript: runs-on: ubuntu-latest steps: @@ -44,11 +44,7 @@ jobs: - uses: actions/setup-node@v7 with: node-version: 24 - - run: | - cd types/demo - npm install - cd ../../ - just install typescript + - run: just install typescript lint: runs-on: ubuntu-latest steps: diff --git a/.npmignore b/.npmignore index ede4dd4da..f5efe921a 100644 --- a/.npmignore +++ b/.npmignore @@ -10,10 +10,7 @@ !/prop_types.js !/README.md !/src/**/* -!/types/**/* !/UPGRADE_GUIDE.md # Here we exclude files that we pulled in from above that should be removed .DS_Store -types/.eslintrc -types/demo diff --git a/.prettierignore b/.prettierignore index 07356dd88..34b7584b3 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,5 +11,6 @@ examples official/fixtures/ package-lock.json style_guides/ +types/ vendor/ venv/ diff --git a/package.json b/package.json index af1fcb82f..43b486d6e 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,14 @@ "homepage": "https://easypost.com", "exports": { ".": { - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "import": "./dist/easypost.mjs", "require": "./dist/easypost.js" } }, "main": "./dist/easypost.js", "module": "./dist/easypost.mjs", - "types": "./types/index.d.ts", + "types": "./dist/types/index.d.ts", "repository": { "type": "git", "url": "git://github.com/easypost/easypost-node.git" @@ -31,12 +31,12 @@ "formatCheck": "prettier --check .", "lint": "eslint --ext .js,.ts --ignore-pattern 'examples/**' .", "lintFix": "eslint --ext .js,.ts --ignore-pattern 'examples/**' --fix .", - "prepublishOnly": "npm run clean && npm run build && npm run test && npm run lint && npm run formatCheck", + "prepublishOnly": "npm run clean && npm run build && npm run typescript:declarations && npm run test && npm run lint && npm run formatCheck", "scan": "npx audit-ci -m --config ./audit-ci.jsonc", "test": "cross-env NODE_ENV=test vitest run", "test:node-compatibility": "cross-env NODE_ENV=test node ./test/node_compatibility", "typescript": "npm run typescript:declarations && npm run typescript:source && npm run typescript:compat", - "typescript:declarations": "npx tsc -p tsconfig.json", + "typescript:declarations": "rm -rf ./dist/types && npx tsc -p tsconfig.json", "typescript:source": "npx tsc -p tsconfig.build.json", "typescript:compat": "npx tsc -p tsconfig.type-tests.json", "watch": "vite build --watch" diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 000000000..5e70bb213 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,3 @@ +import EasyPostClient from './easypost'; + +export default EasyPostClient; diff --git a/test/services/claim.test.js b/test/services/claim.test.js index b3f04fb8b..879539598 100644 --- a/test/services/claim.test.js +++ b/test/services/claim.test.js @@ -7,7 +7,7 @@ import Claim from '../../src/models/claim'; import Fixture from '../helpers/fixture'; import * as setupPolly from '../helpers/setup_polly'; -/** @typedef {import("../../types/EasyPost").default} Client */ +/** @typedef {import("../../src/easypost").default} Client */ const CLAIM_AMOUNT = 100; diff --git a/tsconfig.json b/tsconfig.json index 1f0f4c7ed..e2377ec65 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,15 @@ { "extends": "./tsconfig.base.json", "compilerOptions": { - "noEmit": true + "allowJs": true, + "checkJs": false, + "noImplicitAny": false, + "declaration": true, + "emitDeclarationOnly": true, + "rootDir": "./src", + "outDir": "./dist/types", + "noEmit": false }, - "include": ["types"] + "include": ["src/**/*.js", "src/**/*.ts"], + "exclude": ["dist/**", "docs/**", "coverage/**", "node_modules/**"] } diff --git a/types/.eslintrc b/types/.eslintrc deleted file mode 100644 index bbe18a1d1..000000000 --- a/types/.eslintrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "root": true, - "parser": "@typescript-eslint/parser", - "plugins": ["@typescript-eslint"], - "extends": ["eslint:recommended", "plugin:@typescript-eslint/eslint-recommended"], - "rules": { - "no-unused-vars": "off" - } -} diff --git a/types/Address/Address.d.ts b/types/Address/Address.d.ts deleted file mode 100644 index 07c7e183f..000000000 --- a/types/Address/Address.d.ts +++ /dev/null @@ -1,194 +0,0 @@ -import { IObjectWithId } from '../base'; -import { DeepPartial } from '../utils'; -import { IAddressCreateParameters } from './AddressCreateParameters'; -import { IAddressListParameters } from './AddressListParameters'; -import { IVerifications } from './Verifications'; - -/** - * Address objects are used to represent people, places, and organizations in a number of contexts. - * For example, a Shipment requires a to_address and from_address to accurately calculate rates and generate postage. - * - * Additionally, EasyPost offers several verification tools that can be used to detect deliverability issues, correct minor errors in spelling/formatting, and determine if an Address is residential or not (which has a significant effect on Shipment rating for many carriers). - * - * @see https://docs.easypost.com/docs/addresses#address-object - */ -export declare interface IAddress extends IObjectWithId<'Address'> { - /** - * First line of the address - */ - street1?: string | null; - - /** - * Second line of the address - */ - street2?: string | null; - - /** - * City the address is located in - */ - city?: string | null; - - /** - * State or province the address is located in - */ - state?: string | null; - - /** - * ZIP or postal code the address is located in - */ - zip: string; - - /** - * ISO 3166 country code for the country the address is located in - */ - country: string; - - /** - * Whether or not this address would be considered residential - */ - residential?: boolean | null; - - /** - * The specific designation for the address (only relevant if the address is a carrier facility) - */ - carrier_facility?: string | null; - - /** - * Name of the person. Both name and company can be included - */ - name?: string | null; - - /** - * Name of the organization. Both name and company can be included - */ - company?: string | null; - - /** - * Phone number to reach the person or organization - */ - phone?: string | null; - - /** - * Email to reach the person or organization - */ - email?: string | null; - - /** - * Federal tax identifier of the person or organization - */ - federal_tax_id?: string | null; - - /** - * State tax identifier of the person or organization - */ - state_tax_id?: string | null; - - /** - * The result of any verifications requested - */ - verifications: IVerifications; -} - -declare class Address implements IAddress { - public constructor(input: DeepPartial); - - id: string; - mode: 'test' | 'production'; - object: 'Address'; - street1?: string | null; - street2?: string | null; - city?: string | null; - state?: string | null; - zip: string; - country: string; - residential?: boolean | null; - carrier_facility?: string | null; - name?: string | null; - company?: string | null; - phone?: string | null; - email?: string | null; - federal_tax_id?: string | null; - state_tax_id?: string | null; - verifications: IVerifications; - - /** - * Create an {@link Address address}. - * @see https://docs.easypost.com/docs/addresses#create-an-address - * @param {Object} params - Parameters for the address to be created. - * @returns {Address} - The created address. - */ - static create(params: Object): Promise
; - - /** - * Retrieve a list of all Addresses. - * - * The Address List is a paginated list of all {@link Address} objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The has_more attribute indicates whether additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/addresses#retrieve-all-addresses - * - * @param {Object} params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Address addresses} and pagination information. - */ - static all(params?: IAddressListParameters): Promise<{ addresses: Address[]; has_more: boolean }>; - - /** - * Create and verify a new {@link Address} in one API call. - * - * Verify an {@link Address} - * - Verifying an {@link Address} before you ship is a great way to reduce issues with delivery. - * Creating a verified Address is as simple as including an enumerated list of the verifications you'd like EasyPost to perform in the `verify` or `verify_strict` url parameters. - * If any of the verification checks included in the `verify_strict` list fail an error will be returned from the API. - * The example below demonstrates the most common verification: "delivery", which checks that the address is deliverable and sets its residential delivery indicator. - * - * - The most effective time to perform address verification is when your customer, or the person entering the delivery address, is present. - * When designing a shopping cart it is recommended to ask the shopper for their address and verify it on the spot. - * If verification fails, ask them to double-check their input; if they confirm that their data is correct, assume they know their address more correctly than the verification process. - * - * @see https://docs.easypost.com/docs/addresses#verify-an-address - * - * @param {Object} params The parameters to create an {@link Address} with. - * @returns {Promise
} The created and verified {@link Address}. - */ - static createAndVerify(params: Object): Promise
; - - /** - * Verify an {@link Address}. - * - * @see https://docs.easypost.com/docs/addresses#verify-an-address - * - * @param addressId Unique, begins with "adr_" - * @returns {Promise
} The verified {@link Address}. - */ - static verifyAddress(addressId: string): Promise
; - - /** - * An Address can be retrieved by its id. - * - * @see https://docs.easypost.com/docs/addresses#retrieve-an-address - * - * @param addressId Unique, begins with "adr_" - * @returns {Promise
} The verified {@link Address} address. - */ - static retrieve(addressId: string): Promise
; - - /** - * Retrieve the next page of {@link Address addresses}. - * - * This automatically reuses the parameters from the previous call or the original {@link Address.all} call. - * - * @see https://docs.easypost.com/docs/addresses#retrieve-all-addresses - * - * @param {Object} addresses - The previous page of addresses (the response from the last {@link Address.getNextPage} or {@link Address.all} call). - * @param {number} [pageSize] - The number of addresses to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Address addresses} and pagination information. - */ - static getNextPage( - addresses: Object, - pageSize?: number, - ): Promise<{ addresses: Address[]; has_more: boolean }>; -} - -export type { Address }; diff --git a/types/Address/AddressCreateParameters.d.ts b/types/Address/AddressCreateParameters.d.ts deleted file mode 100644 index 6b79f0e97..000000000 --- a/types/Address/AddressCreateParameters.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { ParametersToOmitOnCreate } from '../utils'; -import { IAddress } from './Address'; - -/** - * @see https://docs.easypost.com/docs/addresses#verify-an-address - */ -export declare interface IAddressCreateParameters extends Omit< - IAddress, - ParametersToOmitOnCreate | 'verifications' -> { - /** - * The verifications to perform when creating. - * verify_strict takes precedence. - * true will perform both delivery and zip code. - */ - verify?: boolean | null; - - /** - * The verifications to perform when creating. - * The failure of any of these verifications causes the whole request to fail. - * true will perform both delivery and zip code. - */ - verify_strict?: boolean | null; - - /** - * The verifications to perform when creating. - * Define either UPS or FedEx as the carrier to verify against. - */ - verify_carrier?: string | null; -} diff --git a/types/Address/AddressListParameters.d.ts b/types/Address/AddressListParameters.d.ts deleted file mode 100644 index 08cbc90ff..000000000 --- a/types/Address/AddressListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/addresses#retrieve-all-addresses - */ -export declare interface IAddressListParameters extends IAllMethodParameters {} diff --git a/types/Address/Verification.d.ts b/types/Address/Verification.d.ts deleted file mode 100644 index 2b9966345..000000000 --- a/types/Address/Verification.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { IAddressVerificationFieldError } from '../errors'; -import { IVerificationDetails } from './VerificationDetails'; - -/** - * @see https://docs.easypost.com/docs/addresses#verification-object - */ -export declare interface IVerification { - /** - * The success of the verification - */ - success: boolean; - - /** - * All errors that caused the verification to fail - */ - errors: IAddressVerificationFieldError[]; - - /** - * Extra data related to the verification - */ - details: IVerificationDetails; -} diff --git a/types/Address/VerificationDetails.d.ts b/types/Address/VerificationDetails.d.ts deleted file mode 100644 index 5e55ad6e1..000000000 --- a/types/Address/VerificationDetails.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @see https://docs.easypost.com/docs/addresses#verificationdetails-object - */ -export declare interface IVerificationDetails { - /** - * The latitude of an Address. - */ - latitude: number; - - /** - * The longitude of an Address. - */ - longitude: number; - - /** - * The time zone the address is located in, IE: America/Los_Angeles - */ - time_zone: string; -} diff --git a/types/Address/Verifications.d.ts b/types/Address/Verifications.d.ts deleted file mode 100644 index 0ddbfed2a..000000000 --- a/types/Address/Verifications.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { IVerification } from './Verification'; - -/** - * @see https://docs.easypost.com/docs/addresses#verification-object - */ -export declare interface IVerifications { - /** - * Only applicable to US addresses - checks and sets the ZIP+4 - */ - zip4: IVerification; - /** - * Checks that the address is deliverable and makes minor corrections to spelling/format. US addresses will also have their "residential" status checked and set. - */ - delivery: IVerification; -} diff --git a/types/Address/index.d.ts b/types/Address/index.d.ts deleted file mode 100644 index 645d630e4..000000000 --- a/types/Address/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export * from './Address'; -export * from './AddressCreateParameters'; -export * from './Verification'; -export * from './VerificationDetails'; -export * from './Verifications'; diff --git a/types/ApiKey/ApiKey.d.ts b/types/ApiKey/ApiKey.d.ts deleted file mode 100644 index 67aeea2c0..000000000 --- a/types/ApiKey/ApiKey.d.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { IObjectWithId } from '../base'; - -export declare interface IApiKey extends IObjectWithId<'ApiKey'> { - /** - * The actual key value to use for authentication - */ - key: string; - - /** - * When the API key was created - */ - created_at: string; - - /** - * Whether the API key is active or not - */ - active: boolean; -} - -declare class ApiKey implements IApiKey { - id: string; - mode: 'test' | 'production'; - object: 'ApiKey'; - key: string; - created_at: string; - active: boolean; - - /** - * Retrieve API Keys for a specified User. - * Both production and test keys will be returned for a User and all of its children. - * If the request is authenticated as a Child, only the API Keys for that Child will be returned. - * - * @see https://docs.easypost.com/docs/api-keys#retrieve-an-api-key - * - * @param {string} id - The ID of the user to retrieve keys for. - * @returns {Promise} - List of associated API Keys. - */ - static retrieveApiKeysForUser(id: string): Promise; - - /** - * Retrieve all API keys associated with the current authenticated user. - * - * @see https://docs.easypost.com/docs/api-keys#retrieve-an-api-key - * - * @param {Object} [params] - Optional parameters for the request. - * @returns {Promise} - An object containing the API keys associated with the current authenticated user and its child users. - */ - static all(params?: Object): Promise; - - /** - * Create an API key for a child or referral customer user. - * - * @see https://docs.easypost.com/docs/api-keys#create-an-api-key - * - * @param {string} mode - The mode for the API key (either "production" or "test"). - * @returns {Promise} - The created API key. - */ - static create(mode: string): Promise; - - /** - * Delete an API key for a child or referral customer user. - * - * @see https://docs.easypost.com/docs/api-keys#delete-an-api-key - * - * @param {string} id - The ID of the API key to delete. - */ - static delete(id: string): void; - - /** - * Enable a child or referral customer API key. - * - * @see https://docs.easypost.com/docs/api-keys#enable-an-api-key - * - * @param {string} id - The ID of the API key to enable. - * @returns {Promise} - The enabled API key. - */ - static enable(id: string): Promise; - - /** - * Disable a child or referral customer API key. - * - * @see https://docs.easypost.com/docs/api-keys#disable-an-api-key - * - * @param {string} id - The ID of the API key to disable. - * @returns {Promise} - The disabled API key. - */ - static disable(id: string): Promise; -} - -export type { ApiKey }; diff --git a/types/ApiKey/index.d.ts b/types/ApiKey/index.d.ts deleted file mode 100644 index 3af301f48..000000000 --- a/types/ApiKey/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ApiKey'; diff --git a/types/Batch/Batch.d.ts b/types/Batch/Batch.d.ts deleted file mode 100644 index ec4e72963..000000000 --- a/types/Batch/Batch.d.ts +++ /dev/null @@ -1,181 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; -import { IPickup } from '../Pickup'; -import { IScanForm } from '../ScanForm'; -import { LabelFormat } from '../Shipment'; -import { IBatchCreateParameters } from './BatchCreateParameters'; -import { IBatchListParameters } from './BatchListParameters'; -import { IBatchShipment } from './BatchShipment'; -import { TBatchState } from './BatchState'; -import { TBatchStatuses } from './BatchStatuses'; - -/** - * The Batch object allows you to perform operations on multiple Shipments at once. - * This includes scheduling a Pickup, creating a ScanForm and consolidating labels. - * Operations performed on Batches are asynchronous and take advantage of our webhook infrastructure. - * - * @see https://docs.easypost.com/docs/batches#batch-object - */ -export declare interface IBatch extends IObjectWithId<'Batch'>, IDatedObject { - /** - * An optional field that may be used in place of ID in some API endpoints - */ - reference?: string | null; - - /** - * The overall state. Possible values are "creating", "creation_failed", "created", "purchasing", "purchase_failed", "purchased", "label_generating", and "label_generated" - */ - state: TBatchState; - - /** - * The number of shipments added - */ - num_shipments: number; - - /** - * An array of batch shipments - */ - shipments: IBatchShipment[]; - - /** - * A map of BatchShipment statuses to the count of BatchShipments with that status. Valid statuses are "postage_purchased", "postage_purchase_failed", "queued_for_purchase", and "creation_failed" - */ - status: TBatchStatuses; - - /** - * The label image url - */ - label_url?: string | null; - - /** - * The created ScanForm - */ - scan_form: IScanForm; - - /** - * The created Pickup - */ - pickup: IPickup; -} - -declare class Batch implements IBatch { - public constructor(input: IBatchCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Batch'; - reference?: string | null; - state: TBatchState; - num_shipments: number; - shipments: IBatchShipment[]; - status: TBatchStatuses; - label_url?: string | null; - scan_form: IScanForm; - pickup: IPickup; - created_at: string; - updated_at: string; - - /** - * A Batch can be created with or without Shipments. - * When created with Shipments the initial state will be creating. - * Once the state changes to created a webhook Event will be sent. - * When created with no Shipments the initial state will be created and webhook will be sent. - * - * @see https://docs.easypost.com/docs/batches#create-a-batch - * - * @param {Object} params The parameters to create an {@link Batch} with. - * @returns {Promise} The {@link Batch}. - */ - static create(params: Object): Promise; - - /** - * A Batch can be retrieved by its id. - * - * @see https://docs.easypost.com/docs/batches#retrieve-batch - * - * @param batchId Unique, begins with "batch_" - * - * @returns {Promise} The {@link Batch}. - */ - static retrieve(batchId: string): Promise; - - /** - * Shipments can be added to a Batch throughout its life cycle. - * Just remember that the state change of a Batch is asynchronous and will fire a webhook Event when the state change is completed. - * - * @see https://docs.easypost.com/docs/batches#add-shipments-to-a-batch - * - * @param id Unique, begins with "batch_" - * @param shipments An array of shipments - * - * @returns {Promise} The {@link Batch}. - */ - static addShipments(id: string, shipments: IBatchCreateParameters['shipments']): Promise; - - /** - * There could be times when a Shipment needs to be removed from the Batch during its life cycle. - * Removing a Shipment does not remove it from the consolidated label or ScanForm. - * - * @see https://docs.easypost.com/docs/batches#remove-shipments-from-a-batch - * - * @param id Unique, begins with "batch_" - * @param shipments An array of shipments - * - * @returns {Promise} The {@link Batch}. - */ - static removeShipments( - id: string, - shipments: IBatchCreateParameters['shipments'], - ): Promise; - - /** - * One of the advantages of processing Shipments in batches is the ability to consolidate the PostageLabel into one file. - * This can only be done once for each batch and all Shipments must have a status of postage_purchased. - * - * Available label formats are 'pdf', 'zpl' or 'epl2' format. - * Like converting a PostageLabel format, if this process will change the format of the labels they must have been created as PNGs. - * - * @see https://docs.easypost.com/docs/batches#batch-labels - * - * @param id Unique, begins with "batch_" - * @param labelFormat The format of label - * - * @returns {Promise} The {@link Batch}. - */ - static generateLabel(id: string, labelFormat: LabelFormat): Promise; - - /** - * See [Scan Form](https://docs.easypost.com/docs/scan-form) rules and [Object Definition](https://docs.easypost.com/docs/scan-form-object). - * - * @see https://docs.easypost.com/docs/batches#manifesting-scan-form - * - * @param id Unique, begins with "batch_" - * - * @returns {Promise} The {@link Batch}. - */ - static createScanForm(id: string): Promise; - - /** - * Once you have added all of your Shipments to a Batch, issue a buy request to enqueue a background job to purchase the shipments and generate all necessary labels. - * Purchasing may take anywhere from a few seconds to an hour, depending on the size of the batch, the carrier, and Internet weather. - * - * @see https://docs.easypost.com/docs/batches#buy-a-batch - * - * @param id Unique, begins with "batch_" - * @returns {Promise} The {@link Batch}. - */ - static buy(id: string): Promise; - - /** - * The Batch List is a paginated list of all Batch objects associated with the given API Key. - * See the Pagination section of our docs for more details on retrieving all records when - * multiple pages are available. - * - * @see https://docs.easypost.com/docs/batches#retrieve-all-batches - * - * @param {Object} params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Batch batches} and pagination information. - */ - static all(params?: IBatchListParameters): Promise<{ batches: Batch[]; has_more: boolean }>; -} - -export type { Batch }; diff --git a/types/Batch/BatchCreateParameters.d.ts b/types/Batch/BatchCreateParameters.d.ts deleted file mode 100644 index 92849b98e..000000000 --- a/types/Batch/BatchCreateParameters.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Shipment } from '../Shipment'; - -export declare interface IBatchCreateParameters { - shipments?: Array; -} diff --git a/types/Batch/BatchListParameters.d.ts b/types/Batch/BatchListParameters.d.ts deleted file mode 100644 index a6e0fc7a4..000000000 --- a/types/Batch/BatchListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/batches#retrieve-all-batches - */ -export declare interface IBatchListParameters extends IAllMethodParameters {} diff --git a/types/Batch/BatchShipment.d.ts b/types/Batch/BatchShipment.d.ts deleted file mode 100644 index 9368ef1ec..000000000 --- a/types/Batch/BatchShipment.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { TBatchStatus } from './BatchStatus'; - -/** - * @see https://docs.easypost.com/docs/batches#batchshipment-object - */ -export declare interface IBatchShipment { - /** - * The id of the Shipment. Unique, begins with "shp_" - */ - id: string; - - /** - * An optional field that may be used in place of ID in some API endpoints - */ - reference?: string | null; - - /** - * The current status. Possible values are "postage_purchased", "postage_purchase_failed", "queued_for_purchase", "creation_failed", and "created" - */ - batch_status: TBatchStatus; - - /** - * A human readable message for any errors that occurred during the Batch's life cycle - */ - batch_message: string; -} diff --git a/types/Batch/BatchState.d.ts b/types/Batch/BatchState.d.ts deleted file mode 100644 index 7de25d436..000000000 --- a/types/Batch/BatchState.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export declare type TBatchState = - | 'creating' - | 'creation_failed' - | 'created' - | 'purchasing' - | 'purchase_failed' - | 'purchased' - | 'label_generating' - | 'label_generated'; diff --git a/types/Batch/BatchStatus.d.ts b/types/Batch/BatchStatus.d.ts deleted file mode 100644 index ecd5eb553..000000000 --- a/types/Batch/BatchStatus.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export declare type TBatchStatus = - | 'postage_purchased' - | 'postage_purchase_failed' - | 'queued_for_purchase' - | 'creation_failed' - | 'created'; diff --git a/types/Batch/BatchStatuses.d.ts b/types/Batch/BatchStatuses.d.ts deleted file mode 100644 index 24e6470ca..000000000 --- a/types/Batch/BatchStatuses.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { TBatchStatus } from './BatchStatus'; - -export declare type TBatchStatuses = { [key in TBatchStatus]: number }; diff --git a/types/Batch/index.d.ts b/types/Batch/index.d.ts deleted file mode 100644 index 00cf085aa..000000000 --- a/types/Batch/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './Batch'; -export * from './BatchState'; -export * from './BatchStatus'; -export * from './BatchStatuses'; -export * from './BatchShipment'; -export * from './BatchCreateParameters'; diff --git a/types/Billing/Billing.d.ts b/types/Billing/Billing.d.ts deleted file mode 100644 index 02c214912..000000000 --- a/types/Billing/Billing.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/** - * The Billing class allow you to fund wallet by using primary or secondary payment method, - * delete a existing payment method, and retrieve all payment methods associated to the user. - * - * @see https://docs.easypost.com/docs/users/billing - */ -declare class Billing { - /** - * Fund your EasyPost wallet by charging your primary or secondary payment method on file. - * - * @see https://docs.easypost.com/docs/users/billing#add-funds-to-your-wallet-one-time-charge - * @requires production API Key. - * - * @param amount Amount in cents to be deposited into the user's wallet. Amount must be greater than or equal to the user's current balance. - * @param priority The payment method from your account, either primary or secondary. - */ - static fundWallet(amount: string, priority?: string): void; - - /** - * Delete a payment method from your account. - * @see https://docs.easypost.com/docs/users/billing#delete-a-payment-method - * @requires production API Key. - * - * @param priority The payment method from your account, either primary or secondary. - */ - static deletePaymentMethod(priority: string): void; - - /** - * Retrieve all payment methods. - * - * @see https://docs.easypost.com/docs/users/billing#retrieve-payment-methods - * @requires production API Key. - */ - static retrievePaymentMethods(): object; -} - -export type { Billing }; diff --git a/types/Billing/index.d.ts b/types/Billing/index.d.ts deleted file mode 100644 index 6da3db555..000000000 --- a/types/Billing/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Billing'; diff --git a/types/Brand/Brand.d.ts b/types/Brand/Brand.d.ts deleted file mode 100644 index 201879887..000000000 --- a/types/Brand/Brand.d.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { IObjectWithId } from '../base'; - -/** - * The Brand class represents the public-accessible information about a user's brand, including logos, colors and themes. - * - * @see https://docs.easypost.com/docs/users/brand - */ -export declare interface IBrand extends IObjectWithId<'Brand'> { - /** - * The background color of the brand, as a hex code. - */ - background_color: string; - - /** - * The primary color of the brand, as a hex code. - */ - color: string; - - /** - * The logo of the brand, as a base64-encoded PNG, GIF, JPEG or SVG. - */ - logo: string; - - /** - * The URL of the brand's logo. - */ - logo_href: string; - - /** - * The banner ad of the brand, as a base64-encoded PNG, GIF, JPEG or SVG. - */ - ad: string; - - /** - * The URL of the brand's banner ad. - */ - ad_href: string; - - /** - * The ID of the brand's associated User. - */ - user_id: string; - - /** - * The name of the current theme. - */ - theme: 'theme1' | 'theme2'; -} - -declare class Brand implements IBrand { - id: string; - mode: 'test' | 'production'; - object: 'Brand'; - reference?: string | null; - ad: string; - ad_href: string; - background_color: string; - color: string; - logo: string; - logo_href: string; - theme: 'theme1' | 'theme2'; - user_id: string; - - /** - * Update the brand of the current authenticated user. - * - * @see https://docs.easypost.com/docs/users/brand#update-a-brand - * - * @param params The parameters to update the {@link Brand} with - * @returns {Promise} The updated Brand. - */ - static updateBrand(params: object): Promise; -} - -export type { Brand }; diff --git a/types/Brand/index.d.ts b/types/Brand/index.d.ts deleted file mode 100644 index 731d929af..000000000 --- a/types/Brand/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Brand'; diff --git a/types/Carrier/CarrierAccount/CarrierAccount.d.ts b/types/Carrier/CarrierAccount/CarrierAccount.d.ts deleted file mode 100644 index 18dc7fe01..000000000 --- a/types/Carrier/CarrierAccount/CarrierAccount.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../../base'; -import { DeepPartial } from '../../utils'; -import { ICarrierAccountCreateParameters } from './CarrierAccountCreateParameters'; -import { ICarrierAccountFields } from './CarrierAccountFields'; - -/** - * A CarrierAccount encapsulates your credentials with the carrier. - * The CarrierAccount object provides CRUD operations for all CarrierAccounts. - * - * Each EasyPost account is automatically provided a USPS account managed by EasyPost. - * - * Other operations, such as Shipment creation, can reference CarrierAccounts to reduce the scope of data returned. - * For instance, you may have multiple warehouses that need to use distinct FedEx SmartPost credentials to request the correct rates. - * Rate objects will include a `carrier_account_id` field which can be used to determine the account used for rating. - * - * @see https://docs.easypost.com/docs/carrier-accounts#carrieraccount-object - */ -export declare interface ICarrierAccount extends IObjectWithId<'CarrierAccount'>, IDatedObject { - /** - * The name of the carrier type. - */ - type: string; - - /** - * Contains "credentials" and/or "test_credentials", or may be empty - */ - fields: ICarrierAccountFields; - - /** - * If clone is true, only the reference and description are possible to update - */ - clone?: boolean | null; - - /** - * An optional, user-readable field to help distinguish accounts - */ - description?: string | null; - - /** - * An optional field that may be used in place of carrier_account_id in other API endpoints - */ - reference?: string | null; - - /** - * The name used when displaying a readable value for the type of the account - */ - readable: string; - - /** - * Unlike the "credentials" object contained in "fields", this nullable object contains just raw credential pairs for client library consumption - */ - credentials?: object | null; - - /** - * Unlike the "test_credentials" object contained in "fields", this nullable object contains just raw test_credential pairs for client library consumption - */ - test_credentials?: object | null; - - /** - * Billing type of the carrier account - */ - billing_type: string | null; -} - -declare class CarrierAccount implements ICarrierAccount { - public constructor(input: DeepPartial); - - id: string; - mode: 'test' | 'production'; - object: 'CarrierAccount'; - type: string; - fields: ICarrierAccountFields; - clone?: boolean | null; - description?: string | null; - reference?: string | null; - readable: string; - credentials?: object | null; - test_credentials?: object | null; - billing_type: string | null; - created_at: string; - updated_at: string; - - /** - * CarrierAccount objects may be managed through the EasyPost API using the Production mode API key only. - * Multiple accounts can be added for a single carrier. - * - * The CarrierType of the preferred CarrierAccount should be consulted before attempting to create a new CarrierAccount, as it will inform you of the field names expected by a certain carrier. - * - * @see https://docs.easypost.com/docs/carrier-accounts#create-a-carrieraccount - * @requires production API Key. - * - * @param {Object} params The parameters to create an {@link CarrierAccount} with - * @returns {Promise} The created and verified {@link CarrierAccount}. - */ - static create(params: Object): Promise; - - /** - * @see https://docs.easypost.com/docs/carrier-accounts#update-a-carrieraccount - * - * @param carrierAccountId Unique, begins with "ca_" - * @param {Object} params The parameters to create an {@link CarrierAccount} with - * @returns {Promise} The created and verified {@link CarrierAccount}. - */ - static update(carrierAccountId: string, params: Object): Promise; - - /** - * Retrieve an unpaginated list of all CarrierAccounts available to the authenticated account. - * Only Production API keys may be used to retrieve this list, as there is no test mode equivalent. - * - * @see https://docs.easypost.com/docs/carrier-accounts#retrieve-all-carrieraccounts - * @requires production API Key. - * - * @returns {Object} - An object containing a list of {@link CarrierAccount carrier accounts}. - */ - static all(): Promise; - - /** - * Retrieve a CarrierAccount by either its id or reference. - * However it is recommended to use EasyPost's provided identifiers because we do not enforce a unique reference. - * - * @param carrierAccountId Unique, begins with "ca_" - * - * @see https://docs.easypost.com/docs/carrier-accounts#retrieve-a-carrieraccount - * @requires production API Key. - * - * @returns {Promise} The {@link CarrierAccount} object. - */ - static retrieve(carrierAccountId: string): Promise; - - /** - * CarrierAccount objects may be removed from your account when they become out of date or no longer useful. - * - * @see https://docs.easypost.com/docs/carrier-accounts#delete-a-carrieraccount - * @requires production API Key. - * - * @param carrierAccountId Unique, begins with "ca_" - */ - static delete(carrierAccountId: string): void; -} - -export type { CarrierAccount }; diff --git a/types/Carrier/CarrierAccount/CarrierAccountCreateParameters.d.ts b/types/Carrier/CarrierAccount/CarrierAccountCreateParameters.d.ts deleted file mode 100644 index a313ce045..000000000 --- a/types/Carrier/CarrierAccount/CarrierAccountCreateParameters.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ParametersToOmitOnCreate } from '../../utils'; -import { ICarrierAccount } from './CarrierAccount'; - -export declare interface ICarrierAccountCreateParameters extends Omit< - ICarrierAccount, - ParametersToOmitOnCreate -> {} diff --git a/types/Carrier/CarrierAccount/CarrierAccountField.d.ts b/types/Carrier/CarrierAccount/CarrierAccountField.d.ts deleted file mode 100644 index d6c103a3d..000000000 --- a/types/Carrier/CarrierAccount/CarrierAccountField.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -/** - * @see https://docs.easypost.com/docs/carrier-accounts#fields-object - */ -export declare interface ICarrierAccountField { - /** - * Each key in the sub-objects of a CarrierAccount's fields is the name of a settable field - */ - key: string; - - /** - * The visibility value is used to control form field types, and is discussed in the CarrierType section - */ - visibility: string; - - /** - * The label value is used in form rendering to display a more precise field name - */ - label: string; - - /** - * Checkbox fields use "0" and "1" as False and True, all other field types present plaintext, partly-masked, or masked credential data for reference - */ - value: string; -} diff --git a/types/Carrier/CarrierAccount/CarrierAccountFields.d.ts b/types/Carrier/CarrierAccount/CarrierAccountFields.d.ts deleted file mode 100644 index 13a74a63a..000000000 --- a/types/Carrier/CarrierAccount/CarrierAccountFields.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ICarrierAccountField } from './CarrierAccountField'; - -/** - * @see https://docs.easypost.com/docs/carrier-accounts#fields-object - */ -export declare interface ICarrierAccountFields { - /** - * Credentials used in the production environment. - */ - credentials: ICarrierAccountField; - - /** - * Credentials used in the test environment. - */ - test_credentials: ICarrierAccountField; - - /** - * For USPS this designates that no credentials are required. - */ - auto_link: boolean; - - /** - * When present, a separate authentication process will be required through the UI to link this account type. - */ - custom_workflow: boolean; -} diff --git a/types/Carrier/CarrierAccount/index.d.ts b/types/Carrier/CarrierAccount/index.d.ts deleted file mode 100644 index 054b8b901..000000000 --- a/types/Carrier/CarrierAccount/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './CarrierAccount'; -export * from './CarrierAccountFields'; -export * from './CarrierAccountField'; -export * from './CarrierAccountCreateParameters'; diff --git a/types/Carrier/CarrierMetadata/CarrierMetadata.d.ts b/types/Carrier/CarrierMetadata/CarrierMetadata.d.ts deleted file mode 100644 index c92e3b416..000000000 --- a/types/Carrier/CarrierMetadata/CarrierMetadata.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * The Carrier Metadata endpoint returns information about all the carriers available on the EasyPost platform. - * This information may include service levels, predefined packages, shipment options, supported features, and - * more that are available per carrier. This metadata can be useful during onboarding and integration or when - * determining the ideal carrier mix for your setup. - * - * @see https://docs.easypost.com/docs/carrier-metadata#carriermetadata-object - */ -export declare interface ICarrierMetadata { - /** - * The single-word name of a carrier such as "royalmail" - */ - carrier: string; - - /** - * The human-readable name of the carrier - */ - human_readable?: string | null; - - /** - * A list of service level objects for this carrier - */ - service_levels?: Array | null; - - /** - * A list of predefined package objects for this carrier - */ - predefined_packages?: Array | null; - - /** - * A list of supported feature objects for this carrier - */ - supported_features?: Array | null; - - /** - * A list of shipment option objects for this carrier - */ - shipment_options?: Array | null; -} - -declare class CarrierMetadata implements ICarrierMetadata { - carrier: string; - human_readable?: string | null; - service_levels?: Array | null; - predefined_packages?: Array | null; - supported_features?: Array | null; - shipment_options?: Array | null; - - /** - * Retrieve all Carrier Metadata for all carriers on the EasyPost platform. Optionally, - * filter the response by specifying a list of carriers or metadata types. - * - * @param {Array} carriers A comma-delimited list of single-word carriers you'd like to filter the response by - * @param {Array} types A comma-delimited list of the metadata types you'd like to filter the response by - * - * @see https://docs.easypost.com/docs/carrier-metadata#retrieve-carrier-metadata - * - * @returns {Promise} The {@link CarrierMetadata} object. - */ - static retrieve(carriers: Array, types: Array): Promise; -} - -export type { CarrierMetadata }; diff --git a/types/Carrier/CarrierMetadata/index.d.ts b/types/Carrier/CarrierMetadata/index.d.ts deleted file mode 100644 index 109e687de..000000000 --- a/types/Carrier/CarrierMetadata/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './CarrierMetadata'; diff --git a/types/Carrier/CarrierType/CarrierType.d.ts b/types/Carrier/CarrierType/CarrierType.d.ts deleted file mode 100644 index d00c32e2b..000000000 --- a/types/Carrier/CarrierType/CarrierType.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { IBaseObject } from '../../base'; -import { ICarrierTypeFields } from './CarrierTypeFields'; - -/** - * The CarrierType object provides an export declare interface for determining the valid fields of a CarrierAccount. - * The list of CarrierType objects only changes when a new carrier is added to EasyPost. - * - * The CarrierType objects consist of their top level attributes as well as a fields object that contains credentials and sometimes test_credentials sub-objects, - * which themselves are collections of attributes for CarrierAccount creation as well as metadata about presentation and the naming of said attributes. - * - * There are a couple special case CarrierAccounts, with structures differing somewhat from the norm. - * For instance, instead of credentials for UspsAccount, it has only auto_link: true, which indicates that it is an account that can be added or removed without any carrier-specific fields. - * - * The other custom option in the fields list is custom_workflow: true, which indicates that the EasyPost website export declare interface includes special processing for signups for the associated CarrierType. - * Carriers with a custom workflow will also present their normal credential rules, but it is considered unsafe to directly add a CarrierAccount of this type with these attributes filled out via another source than the EasyPost custom workflow. - * - * @see https://docs.easypost.com/docs/carrier-types#carriertype-object - */ -export declare interface ICarrierType extends IBaseObject<'CarrierType'> { - /** - * Specifies the CarrierAccount type. - */ - type: string; - - /** - * Contains at least one of the following keys: "auto_link", "credentials", "test_credentials", and "custom_workflow" - */ - fields: ICarrierTypeFields; -} - -declare class CarrierType implements ICarrierType { - type: string; - fields: ICarrierTypeFields; - object: 'CarrierType'; - - /** - * The CarrierType list is an unpaginated list of all carrier types available to the account of the given API key. - * - * @see https://docs.easypost.com/docs/carrier-types#retrieve-available-carrier-types - * @requires production API Key. - * - * @returns {Object} - An object containing a list of {@link CarrierType carrier types}. - */ - static all(): Promise; -} - -export type { CarrierType }; diff --git a/types/Carrier/CarrierType/CarrierTypeCredentials.d.ts b/types/Carrier/CarrierType/CarrierTypeCredentials.d.ts deleted file mode 100644 index 671c0470a..000000000 --- a/types/Carrier/CarrierType/CarrierTypeCredentials.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @see https://docs.easypost.com/docs/carrier-types#credentials-object - */ -export declare interface ICarrierTypeCredentials { - /** - * The key for each attribute sub-object within credentials is the name of the attribute for submission on CarrierAccounts - */ - name: string; - - /** - * There are five possible values, which encode the security need and storage type for each attribute: "visible", "checkbox", "fake", "password", and "masked" - */ - visibility: 'visible' | 'checkbox' | 'fake' | 'password' | 'masked'; - - /** - * Most attributes have generic names, so for clarity a "label" value is provided for clearer representation when rendering forms - */ - label: string; -} diff --git a/types/Carrier/CarrierType/CarrierTypeFields.d.ts b/types/Carrier/CarrierType/CarrierTypeFields.d.ts deleted file mode 100644 index 663f32034..000000000 --- a/types/Carrier/CarrierType/CarrierTypeFields.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { ICarrierTypeCredentials } from './CarrierTypeCredentials'; - -/** - * @see https://docs.easypost.com/docs/carrier-types#fields-object - */ -export declare interface ICarrierTypeFields { - /** - * If this key is present with the value of true, no other attributes are needed for CarrierAccount creation - */ - auto_link: boolean; - - /** - * If this key is present with the value of true, CarrierAccount creation of this type requires extra work not handled by the CarrierAccount standard API - */ - custom_workflow: boolean; - - /** - * If this object is present, required attribute names and their metadata are presented inside - */ - credentials: ICarrierTypeCredentials; - - /** - * If this object is present, it contains attribute names and metadata just as the credentials object. - * It is not required for CarrierAccount creation if you do not plan on using the carrier account for test mode - */ - test_credentials: ICarrierTypeCredentials; -} diff --git a/types/Carrier/CarrierType/index.d.ts b/types/Carrier/CarrierType/index.d.ts deleted file mode 100644 index 58e4783b4..000000000 --- a/types/Carrier/CarrierType/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './CarrierType'; -export * from './CarrierTypeFields'; -export * from './CarrierTypeCredentials'; diff --git a/types/Carrier/index.d.ts b/types/Carrier/index.d.ts deleted file mode 100644 index 8a86777f2..000000000 --- a/types/Carrier/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './CarrierAccount'; -export * from './CarrierMetadata'; -export * from './CarrierType'; diff --git a/types/Claim/Claim.d.ts b/types/Claim/Claim.d.ts deleted file mode 100644 index 7c00d5237..000000000 --- a/types/Claim/Claim.d.ts +++ /dev/null @@ -1,158 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; -import { IAllMethodParameters } from '../utils'; -import { IClaimCreateParameters } from './ClaimCreateParameters'; -import { TClaimHistory } from './ClaimHistory'; -import { TClaimPaymentMethod } from './ClaimPaymentMethod'; -import { TClaimType } from './ClaimType'; - -/** - * Class representing an EasyPost claim object. - * - */ -export declare interface IClaim extends IObjectWithId<'Claim'>, IDatedObject { - /** The amount that has been approved for reimbursement */ - approved_amount: string | null; - - /** A list of links to attachments associated with the claim */ - attachments: string[]; - - /** The address to which the reimbursement check should be sent */ - check_delivery_address: string | null; - - /** The email to contact if more information is needed on this claim */ - contact_email: string; - - /** The description of the claim */ - description: string; - - /** A list of status updates for this claim */ - history: TClaimHistory[]; - - /** The amount of insurance that was purchased for the rate associated with the claim */ - insurance_amount: string; - - /** The id associated with the insurance purchased for this claim */ - insurance_id: string; - - /** The way the claim will be payed out */ - payment_method: TClaimPaymentMethod; - - /** The name of the person who was to receive the shipment */ - recipient_name: null; - - /** An optional value that may be used in place of ID when doing Retrieve calls for this claim. */ - reference: string | null; - - /** The amount the claim is for */ - requested_amount: string; - - /** The salvage value of the damaged goods */ - salvage_value: null; - - /** The shipment id that is associated with this claim */ - shipment_id: string; - - /** The current status of the claim */ - status: string; - - /** Details about the current status of the claim */ - status_detail: string; - - /** When the status was last updated */ - status_timestamp: string; - - /** The tracking_code associated with the rate this claim was made for */ - tracking_code: string; - - /** The reason the package was in an unacceptable state and that this claim was made */ - type: TClaimType; -} - -declare class Claim implements IClaim { - public constructor(input: IClaimCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Claim'; - approved_amount: string | null; - attachments: string[]; - check_delivery_address: string | null; - contact_email: string; - description: string; - history: TClaimHistory[]; - insurance_amount: string; - insurance_id: string; - payment_method: TClaimPaymentMethod; - recipient_name: null; - requested_amount: string; - salvage_value: null; - shipment_id: string; - reference: string | null; - status: string; - status_detail: string; - status_timestamp: string; - tracking_code: string; - type: TClaimType; - created_at: string; - updated_at: string; - - /** - * Create a claim - * - * @see https://docs.easypost.com/docs/insurance/claims#create-a-claim - * - * @param {Object} params The parameters to create an {@link Claim} with. - * @returns {Promise} The created and verified {@link Claim}. - */ - static create(params: Object): Promise; - - /** - * The Claim List is a paginated list of all Claim objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The has_more attribute indicates whether or not additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/insurance/claims#retrieve-all-claims - * - * @returns {Object} - An object containing a list of {@link Claim claim} and pagination information. - */ - static all(params?: IAllMethodParameters): Promise<{ claims: Claim[]; has_more: boolean }>; - - /** - * Retrieve an Claim by id. - * - * @see https://docs.easypost.com/docs/insurance/claims#retrieve-a-claim - * - * @param claimId Unique, starts with "clm_" - * @returns {Promise} The retrieved {@link Claim}. - */ - static retrieve(claimId: string): Promise; - - /** - * Retrieve the next page of {@link Claim claims}. - * - * This automatically reuses the parameters from the previous call or the original {@link Claim.all} call. - * - * @see https://docs.easypost.com/docs/insurance/claims#retrieve-all-claims - * - * @param {Object} claims - The previous page of claims (the response from the last {@link Claim.getNextPage} or {@link Claim.all} call). - * @param {number} [pageSize] - The number of claims to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Claim claims} and pagination information. - */ - static getNextPage( - claims: Object, - pageSize?: number, - ): Promise<{ claims: Claim[]; has_more: boolean }>; - - /** - * Cancel an Claim by id. - * - * @see https://docs.easypost.com/docs/insurance/claims#cancel-a-claim - * - * @param claimId Unique, starts with "clm_" - * @returns {Promise} The refunded {@link Claim}. - */ - static cancel(claimId: string): Promise; -} - -export type { Claim }; diff --git a/types/Claim/ClaimCreateParameters.d.ts b/types/Claim/ClaimCreateParameters.d.ts deleted file mode 100644 index 6cb7f1e8f..000000000 --- a/types/Claim/ClaimCreateParameters.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { TClaimPaymentMethod } from './ClaimPaymentMethod'; -import { TClaimType } from './ClaimType'; - -export declare interface IClaimCreateParameters { - /** The tracking code of the shipment to file a claim for. */ - tracking_code: string; - - /** The type of claim to file. */ - type: TClaimType; - - /** The amount being claimed for reimbursement. */ - amount: string; - - /** - * Email-based files to attach to the claim for evidence. Each file must be a - * base64-encoded string. - */ - email_evidence_attachments?: string[]; - - /** - * Invoices to attach to the claim for evidence. Each file must be a - * base64-encoded string. - */ - invoice_attachments?: string[]; - - /** - * Additional supporting documents to attach to the claim. Required if the - * type is damage or theft. Each file must be a base64-encoded string. - */ - supporting_documentation_attachments?: string[]; - - /** Detailed description of the claim. */ - description: string; - - /** The name of the recipient of the reimbursement. */ - recipient_name: string; - - /** The email address of the contact for the claim. */ - contact_email: string; - - /** The payment method for the claim reimbursement. */ - payment_method: TClaimPaymentMethod; -} diff --git a/types/Claim/ClaimHistory.d.ts b/types/Claim/ClaimHistory.d.ts deleted file mode 100644 index aea875180..000000000 --- a/types/Claim/ClaimHistory.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -export declare type TClaimHistory = { - /** The status of the claim at the time of this history entry. */ - status: string; - - /** The reason for the status of the claim at the time of this history entry. */ - status_detail: string; - - /** The date and time of the history entry. */ - timestamp: string; -}; diff --git a/types/Claim/ClaimPaymentMethod.d.ts b/types/Claim/ClaimPaymentMethod.d.ts deleted file mode 100644 index c4b90a45b..000000000 --- a/types/Claim/ClaimPaymentMethod.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare type TClaimPaymentMethod = 'mailed_check' | 'easypost_wallet'; diff --git a/types/Claim/ClaimType.d.ts b/types/Claim/ClaimType.d.ts deleted file mode 100644 index 0161c9a95..000000000 --- a/types/Claim/ClaimType.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare type TClaimType = 'damage' | 'loss' | 'theft'; diff --git a/types/Claim/index.d.ts b/types/Claim/index.d.ts deleted file mode 100644 index b0a544356..000000000 --- a/types/Claim/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './Claim'; -export * from './ClaimCreateParameters'; -export * from './ClaimHistory'; -export * from './ClaimType'; diff --git a/types/CustomerPortal/CustomerPortalAccountLink.d.ts b/types/CustomerPortal/CustomerPortalAccountLink.d.ts deleted file mode 100644 index 991007826..000000000 --- a/types/CustomerPortal/CustomerPortalAccountLink.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { ICustomerPortalAccountLinkCreateParameters } from './CustomerPortalAccountLinkCreateParameters'; - -/** - * Class representing an EasyPost CustomerPortalAccountLink object. - * - */ -export declare interface ICustomerPortalAccountLink { - /** Always returns "CustomerPortalAccountLink". */ - object: string; - - /** One-time-use session URL for initiating the Customer Portal. */ - link: string; - - /** One-time-use session URL for initiating the Customer Portal. */ - created_at: string; - - /** ISO 8601 timestamp when the link will expire (5 minutes from creation). */ - expires_at: string; -} - -declare class CustomerPortalAccountLink implements ICustomerPortalAccountLink { - public constructor(input: ICustomerPortalAccountLinkCreateParameters); - - object: 'CustomerPortalAccountLink'; - link: string; - created_at: string; - expires_at: string; - - /** - * Create a Portal Session. - * - * @see https://docs.easypost.com/docs/customer-portals#creating-a-portal-session - * - * @param {Object} params The parameters to create a {@link CustomerPortalAccountLink} with. - * @returns {Promise} The {@link CustomerPortalAccountLink}. - */ - static createAccountLink(params: Object): Promise; -} - -export type { CustomerPortalAccountLink }; diff --git a/types/CustomerPortal/CustomerPortalAccountLinkCreateParameters.d.ts b/types/CustomerPortal/CustomerPortalAccountLinkCreateParameters.d.ts deleted file mode 100644 index 44af038d3..000000000 --- a/types/CustomerPortal/CustomerPortalAccountLinkCreateParameters.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -export declare interface ICustomerPortalAccountLinkCreateParameters { - /** Type of Customer Portal session. */ - session_type: 'account_onboarding' | 'account_management'; - - /** The User ID of the sub account for which the portal session is being created. */ - user_id: string; - - /** The URL to which the sub account will be redirected if the session URL is expired, reused, or otherwise invalid. This should trigger a new session request. */ - refresh_url: string; - - /** - * The URL to which the sub account will be redirected after exiting the Customer Portal session. - * This does not confirm completion of the flow; webhook or API polling is recommended for confirmation. - */ - return_url: string; - - /** - * Used to configure the Customer Portal session. - */ - metadata?: object; -} diff --git a/types/CustomerPortal/index.d.ts b/types/CustomerPortal/index.d.ts deleted file mode 100644 index 42c938ef8..000000000 --- a/types/CustomerPortal/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './CustomerPortalAccountLink'; -export * from './CustomerPortalAccountLinkCreateParameters'; diff --git a/types/Customs/CustomsInfo/CustomsInfo.d.ts b/types/Customs/CustomsInfo/CustomsInfo.d.ts deleted file mode 100644 index 0c724e564..000000000 --- a/types/Customs/CustomsInfo/CustomsInfo.d.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../../base'; -import { DeepPartial } from '../../utils'; -import { ICustomsItem } from '../CustomsItem/CustomsItem'; -import { ICustomsInfoCreateParameters } from './CustomsInfoCreateParameters'; - -/** - * CustomsInfo objects contain CustomsItem objects and all necessary information for the generation of customs forms required for international shipping. - * - * Please see the Shipments documentation for examples of including a CustomsInfo object in a shipment. - * - * @see https://docs.easypost.com/docs/customs-infos#customsinfo-object - */ -export declare interface ICustomsInfo extends IObjectWithId<'CustomsInfo'>, IDatedObject { - /** - * "EEL" or "PFC" - * value less than $2500: "NOEEI 30.37(a)" - * value greater than $2500: see [Customs Guide](https://docs.easypost.com/guides/customs-guide) - */ - eel_pfc?: string | null; - - /** - * "documents", "gift", "merchandise", "returned_goods", "sample", or "other" - */ - contents_type?: string | null; - - /** - * (max 255 characters) Human readable description of content. - * Required for certain carriers and always required if contents_type is "other" - */ - contents_explanation?: string | null; - - /** - * Electronically certify the information provided - */ - customs_certify?: boolean | null; - - /** - * Required if customs_certify is true - */ - customs_signer?: string | null; - - /** - * "abandon" or "return", defaults to "return" - */ - non_delivery_option?: 'abandon' | 'return' | null; - - /** - * "none", "other", "quarantine", or "sanitary_phytosanitary_inspection" - */ - restriction_type?: 'none' | 'other' | 'quarantine' | 'sanitary_phytosanitary_inspection' | null; - - /** - * Required if restriction_type is not "none" - */ - restriction_comments?: string | null; - - /** - * Describes the products being shipped - */ - customs_items: ICustomsItem[]; - - /** - * A customs declaration message, available for eligible carriers - */ - declaration?: string | null; -} - -declare class CustomsInfo implements ICustomsInfo { - public constructor(input: DeepPartial); - - id: string; - mode: 'test' | 'production'; - object: 'CustomsInfo'; - eel_pfc?: string | null; - contents_type?: string | null; - contents_explanation?: string | null; - customs_certify?: boolean | null; - customs_signer?: string | null; - non_delivery_option?: 'abandon' | 'return' | null; - restriction_type?: 'none' | 'other' | 'quarantine' | 'sanitary_phytosanitary_inspection' | null; - restriction_comments?: string | null; - customs_items: ICustomsItem[]; - declaration?: string | null; - created_at: string; - updated_at: string; - - /** - * A CustomsInfo object contains all administrative information for processing customs, as well as a list of CustomsItems. When creating a CustomsInfo, you may store the ID from the response for use later in shipment creation. - * - * @see https://docs.easypost.com/docs/customs-infos#create-a-customsinfo - * - * @param {Object} params The parameters to create an {@link CustomsInfo} with. - * @returns {Promise} The {@link CustomsInfo}. - */ - static create(params: Object): Promise; - - /** - * A CustomsInfo can be retrieved by its id. - * - * @param CustomsInfoId Unique, begins with "cstinfo_" - * - * @see https://docs.easypost.com/docs/customs-infos#retrieve-a-customsinfo - * - * @returns {Promise} The {@link CustomsInfo}. - */ - static retrieve(CustomsInfoId: string): Promise; -} - -export type { CustomsInfo }; diff --git a/types/Customs/CustomsInfo/CustomsInfoCreateParameters.d.ts b/types/Customs/CustomsInfo/CustomsInfoCreateParameters.d.ts deleted file mode 100644 index ce85ff6de..000000000 --- a/types/Customs/CustomsInfo/CustomsInfoCreateParameters.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ParametersToOmitOnCreate } from '../../utils'; -import { ICustomsInfo } from './CustomsInfo'; - -export declare interface ICustomsInfoCreateParameters extends Omit< - ICustomsInfo, - ParametersToOmitOnCreate -> {} diff --git a/types/Customs/CustomsInfo/index.d.ts b/types/Customs/CustomsInfo/index.d.ts deleted file mode 100644 index 2f558baf3..000000000 --- a/types/Customs/CustomsInfo/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './CustomsInfo'; diff --git a/types/Customs/CustomsItem/CustomsItem.d.ts b/types/Customs/CustomsItem/CustomsItem.d.ts deleted file mode 100644 index 3aa912134..000000000 --- a/types/Customs/CustomsItem/CustomsItem.d.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../../base'; -import { DeepPartial } from '../../utils'; -import { ICustomsItemCreateParameters } from './CustomsItemCreateParameters'; - -/** - * A CustomsItem object describes goods for international shipment and should be created then included in a CustomsInfo object. - * - * @see https://docs.easypost.com/docs/customs-items-object - */ -export declare interface ICustomsItem extends IObjectWithId<'CustomsItem'>, IDatedObject { - /** - * Required, description of item being shipped - */ - description: string; - - /** - * Required, greater than zero - * float - */ - quantity: number; - - /** - * Required, greater than zero, total value (unit value * quantity) - * float (USD) - */ - value: number; - - /** - * Required, greater than zero, total weight (unit weight * quantity) - * float (oz) - */ - weight: number; - - /** - * Harmonized Tariff Schedule, e.g. "6109.10.0012" for Men's T-shirts - * - * @see https://hts.usitc.gov/ - */ - hs_tariff_number?: string | null; - - /** - * SKU/UPC or other product identifier - */ - code?: string | null; - - /** - * Required, 2 char country code - */ - origin_country: string; - - /** - * 3 char currency code, default USD - */ - currency?: string | null; -} - -declare class CustomsItem implements ICustomsItem { - public constructor(input: DeepPartial); - - id: string; - mode: 'test' | 'production'; - object: 'CustomsItem'; - description: string; - quantity: number; - value: number; - weight: number; - hs_tariff_number?: string | null; - code?: string | null; - origin_country: string; - currency?: string | null; - created_at: string; - updated_at: string; - - /** - * A CustomsItem contains information relating to each product within the package. When creating a customs item, you may store the ID from the response for use later in CustomsInfo creation. - * - * @see https://docs.easypost.com/docs/customs-items#create-a-customsitem - * - * @param {Object} params The parameters to create an {@link CustomsItem} with. - * @returns {Promise} The {@link CustomsItem}. - */ - static create(params: Object): Promise; - - /** - * A CustomsItem can be retrieved by its id. - * - * @param CustomsItemId Unique, begins with "cstitem_" - * - * @see https://docs.easypost.com/docs/customs-items#retrieve-a-customsitem - * - * @returns {Promise} The {@link CustomsItem}. - */ - static retrieve(CustomsItemId: string): Promise; -} - -export type { CustomsItem }; diff --git a/types/Customs/CustomsItem/CustomsItemCreateParameters.d.ts b/types/Customs/CustomsItem/CustomsItemCreateParameters.d.ts deleted file mode 100644 index 17f92ab83..000000000 --- a/types/Customs/CustomsItem/CustomsItemCreateParameters.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ParametersToOmitOnCreate } from '../../utils'; -import { ICustomsItem } from './CustomsItem'; - -export declare interface ICustomsItemCreateParameters extends Omit< - ICustomsItem, - ParametersToOmitOnCreate -> {} diff --git a/types/Customs/CustomsItem/index.d.ts b/types/Customs/CustomsItem/index.d.ts deleted file mode 100644 index 38bfcd6b0..000000000 --- a/types/Customs/CustomsItem/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './CustomsItem'; diff --git a/types/Customs/index.d.ts b/types/Customs/index.d.ts deleted file mode 100644 index f1640b6d8..000000000 --- a/types/Customs/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './CustomsInfo'; -export * from './CustomsItem'; diff --git a/types/EasyPost.d.ts b/types/EasyPost.d.ts deleted file mode 100644 index 3c4315840..000000000 --- a/types/EasyPost.d.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { Address } from './Address'; -import { ApiKey } from './ApiKey'; -import { Batch } from './Batch'; -import { Billing } from './Billing'; -import { Brand } from './Brand'; -import { CarrierAccount, CarrierMetadata, CarrierType } from './Carrier'; -import { Claim } from './Claim'; -import { CustomerPortalAccountLink } from './CustomerPortal'; -import { CustomsInfo, CustomsItem } from './Customs'; -import { EmbeddablesSession } from './Embeddable'; -import { EndShipper } from './EndShipper'; -import { Event } from './Event'; -import { FedExRegistration } from './FedExRegistration'; -import { Fee } from './Fee'; -import { Insurance } from './Insurance'; -import { Luma } from './Luma'; -import { Order } from './Order'; -import { Parcel } from './Parcel'; -import { PaymentMethod } from './PaymentMethod'; -import { Pickup } from './Pickup'; -import { Rate } from './Rate'; -import { Referral } from './Referral'; -import { Refund } from './Refund'; -import { Report } from './Report'; -import { ScanForm } from './ScanForm'; -import { Shipment } from './Shipment'; -import { SmartRate } from './SmartRate'; -import { Tracker } from './Tracker'; -import { User } from './User'; -import { Utils } from './Utility'; -import { Webhook } from './Webhook'; - -export interface IEasyPostRequest { - method: 'get' | 'post' | 'put' | 'patch' | 'delete'; - path: string; - requestBody: any; - headers: Record; - requestTimestamp: number; - requestUUID: string; -} -export interface IEasyPostResponse extends IEasyPostRequest { - httpStatus: number; - responseBody: any; - responseTimestamp: number; -} - -export interface IEasyPostOptions { - /** - * Time in milliseconds that should fail requests. - */ - timeout?: number; - - /** - * Change the base URL that the API library uses. Useful if you proxy requests from a frontend through a server. - * @example https://api.easypost.com/v2/ - */ - baseUrl?: string; - - /** - * Disable using the API key. Useful if you proxy requests from a frontend through a server. - */ - useProxy?: boolean; - - /** - * Function that wraps the HTTP transport function. - * Backward-compatibility alias retained from the pre-fetch transport implementation. - */ - httpMiddleware?: (httpClient: any) => any; - - /** - * Function that wraps the HTTP transport function. - */ - httpClient?: (input: string, init?: Record) => Promise; - - /** - * Function that takes a compatibility request object and returns it. - * Supports legacy middleware patterns with `auth`, `query`, and `send` methods. - */ - requestMiddleware?: (request: any) => any; -} - -export default class EasyPost { - public Address: typeof Address; - public ApiKey: typeof ApiKey; - public Batch: typeof Batch; - public Billing: typeof Billing; - public Brand: typeof Brand; - public CarrierAccount: typeof CarrierAccount; - public CarrierMetadata: typeof CarrierMetadata; - public CarrierType: typeof CarrierType; - public Claim: typeof Claim; - public CustomerPortal: typeof CustomerPortalAccountLink; - public CustomsInfo: typeof CustomsInfo; - public CustomsItem: typeof CustomsItem; - public Embeddable: typeof EmbeddablesSession; - public EndShipper: typeof EndShipper; - public Event: typeof Event; - public FedExRegistration: typeof FedExRegistration; - public Fee: typeof Fee; // TODO: Fix IFee - public Insurance: typeof Insurance; - public Luma: typeof Luma; - public Order: typeof Order; - public Parcel: typeof Parcel; - public PaymentMethod: typeof PaymentMethod; - public Pickup: typeof Pickup; - public Rate: typeof Rate; - public ReferralCustomer: typeof Referral; - public Refund: typeof Refund; - public Report: typeof Report; - public ScanForm: typeof ScanForm; - public Shipment: typeof Shipment; - public SmartRate: typeof SmartRate; - public Tracker: typeof Tracker; - public User: typeof User; - public Utils: typeof Utils; - public Webhook: typeof Webhook; - - public constructor(apiKey: string, options?: IEasyPostOptions); - - /** - * Adds a request hook to the EasyPost client. Useful for logging or debugging. - */ - public addRequestHook(fn: (config: IEasyPostRequest) => void): void; - - /** - * Removes a request hook from the EasyPost client. - */ - public removeRequestHook(fn: (config: IEasyPostRequest) => void): void; - - /** - * Clears all request hooks from the EasyPost client. - */ - public clearRequestHooks(): void; - - /** - * Adds a response hook to the EasyPost client. Useful for logging or debugging. - */ - public addResponseHook(fn: (config: IEasyPostResponse) => void): void; - - /** - * Removes a response hook from the EasyPost client. - */ - public removeResponseHook(fn: (config: IEasyPostResponse) => void): void; - - /** - * Clears all response hooks from the EasyPost client. - */ - public clearResponseHooks(): void; - - /** - * Make an API call to the EasyPost API. - * - * This public, generic interface is useful for making arbitrary API calls to the EasyPost API that - * are not yet supported by the client library's services. When possible, the service for your use case - * should be used instead as it provides a more convenient and higher-level interface depending on the endpoint. - */ - public makeApiCall( - method: 'get' | 'post' | 'put' | 'patch' | 'delete', - endpoint: string, - params?: Record, - ): Promise>; -} diff --git a/types/Embeddable/EmbeddablesSession.d.ts b/types/Embeddable/EmbeddablesSession.d.ts deleted file mode 100644 index abfdfbff5..000000000 --- a/types/Embeddable/EmbeddablesSession.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { IEmbeddablesSessionCreateParameters } from './EmbeddablesSessionCreateParameters'; - -/** - * Class representing an EasyPost EmbeddablesSession object. - * - */ -export declare interface IEmbeddablesSession { - /** Always returns "EmbeddablesSession". */ - object: string; - - /** Short-lived, one-time-use token that authorizes an Embeddables Components session. Must be provided to the client-side Embeddables script to initialize the component. */ - session_id: string; - - /** ISO 8601 timestamp indicating when the session was created. */ - created_at: string; - - /** ISO 8601 timestamp indicating when the session expires. */ - expires_at: string; -} - -declare class EmbeddablesSession implements IEmbeddablesSession { - public constructor(input: IEmbeddablesSessionCreateParameters); - - object: 'EmbeddablesSession'; - session_id: string; - created_at: string; - expires_at: string; - - /** - * Create a Portal Session. - * - * @see https://docs.easypost.com/docs/embeddables#create-an-embeddable-session - * - * @param {Object} params The parameters to create a {@link EmbeddablesSession} with. - * @returns {Promise} The {@link EmbeddablesSession}. - */ - static createSession(params: Object): Promise; -} - -export type { EmbeddablesSession }; diff --git a/types/Embeddable/EmbeddablesSessionCreateParameters.d.ts b/types/Embeddable/EmbeddablesSessionCreateParameters.d.ts deleted file mode 100644 index a8f4c8126..000000000 --- a/types/Embeddable/EmbeddablesSessionCreateParameters.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare interface IEmbeddablesSessionCreateParameters { - /** The integrator’s domain in bare-host format (e.g., example.com), excluding protocol and subdomains. */ - origin_host: string; - - /** The User ID of the sub account for which the embeddable session is being created. */ - user_id: string; -} diff --git a/types/Embeddable/index.d.ts b/types/Embeddable/index.d.ts deleted file mode 100644 index db2293987..000000000 --- a/types/Embeddable/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './EmbeddablesSession'; -export * from './EmbeddablesSessionCreateParameters'; diff --git a/types/EndShipper/EndShipper.d.ts b/types/EndShipper/EndShipper.d.ts deleted file mode 100644 index 290c1af1b..000000000 --- a/types/EndShipper/EndShipper.d.ts +++ /dev/null @@ -1,132 +0,0 @@ -import { IObjectWithId } from '../base'; -import { DeepPartial } from '../utils'; -import { IEndShipperCreateParameters } from './EndShipperCreateParameters'; -import { IEndShipperListParameters } from './EndShipperListParameters'; - -/** - * The EndShipper API is for platforms purchasing postage on behalf of their users, the EndShipper. - * Platforms must assert the EndShipper details, as the EndShipper is ultimately responsible for what is in the box. - * Multiple labels purchased for the same EndShipper must use the same EndShipper identity (API object). - * EndShipper objects must be created prior to buying a Shipment. Once EndShipper objects have been created, - * you must keep track of their public id in order to use them during a label buy. - * - * @see https://docs.easypost.com/docs/endshippers - */ -export declare interface IEndshipper extends IObjectWithId<'EndShipper'> { - /** - * Name of responsible person (conditionally required) - */ - name?: string | null; - - /** - * Name of responsible company (conditionally required) - */ - company?: string | null; - - /** - * First line of the address - */ - street1?: string | null; - - /** - * Second line of the address - */ - street2?: string | null; - - /** - * City the address is located in - */ - city?: string | null; - - /** - * State or province the address is located in - */ - state?: string | null; - - /** - * ZIP or postal code the address is located in - */ - zip: string; - - /** - * ISO 3166 country code for the country the address is located in - */ - country?: string; - - /** - * Phone number to reach the person or organization - */ - phone?: string | null; - - /** - * Email to reach the person or organization - */ - email?: string | null; -} - -declare class EndShipper implements IEndshipper { - public constructor(input: DeepPartial); - id: string; - mode: 'test' | 'production'; - object: 'EndShipper'; - street1?: string | null; - street2?: string | null; - city?: string | null; - state?: string | null; - zip: string; - country: string; - name?: string | null; - company?: string | null; - phone?: string | null; - email?: string | null; - - /** - * The EndShipper object is meant to represent the person or business entity responsible for the - * shipment and not necessarily the shipping location. - * EndShipper objects are fully-qualified Address objects and require every field to be filled with two exceptions: - * name and company fields. At least one of these fields must be filled (when both are present, name will take precedence). - * street2 field. This fieldcan be empty if the address does not include multiple lines. - * - * @see https://docs.easypost.com/docs/endshippers#create-an-endshipper - * - * @param {Object} params The parameters to create an {@link EndShipper} with. - * @returns {Promise} The created and verified {@link EndShipper}. - */ - static create(params: Object): Promise; - - /** - * An EndShipper object may be updated using the EndShipper API. - * All required fields for creating an EndShipper are required in an update request. Partial updates are not supported. - * - * @see https://docs.easypost.com/docs/endshippers#update-an-endshipper - * - * @param id Unique, start with "es_". - * @param params The parameters to update an {@link EndShipper} with. - * @returns {Promise} The updated {@link EndShipper}. - */ - static update(id: string, params: Object): Promise; - - /** - * Similar to retrieving a list of EndShippers, you can retrieve an individual EndShipper. - * - * @see https://docs.easypost.com/docs/endshippers#retrieve-an-endshipper - * - * @param id Unique, start with "es_". - * @returns {Promise} The retrieved {@link EndShipper}. - */ - static retrieve(id: string): Promise; - - /** - * List the EndShippers that have been created. - * - * @see https://docs.easypost.com/docs/endshippers#retrieve-all-endshippers - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link EndShipper endshippers} and pagination information. - */ - static all( - params: IEndShipperListParameters, - ): Promise<{ endshippers: EndShipper[]; has_more: boolean }>; -} - -export type { EndShipper }; diff --git a/types/EndShipper/EndShipperCreateParameters.d.ts b/types/EndShipper/EndShipperCreateParameters.d.ts deleted file mode 100644 index 7f156be4d..000000000 --- a/types/EndShipper/EndShipperCreateParameters.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ParametersToOmitOnCreate } from '../utils'; -import { IEndshipper } from './EndShipper'; - -export declare interface IEndShipperCreateParameters extends Omit< - IEndshipper, - ParametersToOmitOnCreate -> {} diff --git a/types/EndShipper/EndShipperListParameters.d.ts b/types/EndShipper/EndShipperListParameters.d.ts deleted file mode 100644 index c31f2e038..000000000 --- a/types/EndShipper/EndShipperListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/endshippers - */ -export declare interface IEndShipperListParameters extends IAllMethodParameters {} diff --git a/types/EndShipper/index.d.ts b/types/EndShipper/index.d.ts deleted file mode 100644 index 8cccc97ed..000000000 --- a/types/EndShipper/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './EndShipper'; -export * from './EndShipperCreateParameters'; diff --git a/types/Event/Event.d.ts b/types/Event/Event.d.ts deleted file mode 100644 index bd274122e..000000000 --- a/types/Event/Event.d.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; -import { IEventListParameters } from './EventListParameters'; - -/** - * Webhook Events are triggered by changes in objects you've created via the API. - * Every time an Event related to one of your objects is created, EasyPost guarantees at least one POST request will be sent to each of the webhook URLs set up for your account. - * For this reason, we strongly encourage your webhook handler to be idempotent. - * See the webhooks guide for more information. - * - * @see https://docs.easypost.com/docs/events - */ -export declare interface IEvent extends IObjectWithId<'Event'>, IDatedObject { - /** - * Result type and event name, see the "Possible Event Types" section for more information - */ - description: string; - - /** - * Previous values of relevant result attributes - */ - previous_attributes: any; - - /** - * The object associated with the Event. See the "object" attribute on the result to determine its specific type. - * This field will not be returned when retrieving events directly from the API - */ - result: any; - - /** - * The current status of the event. Possible values are "completed", "failed", "in_queue", "retrying", or "pending" (deprecated) - * - * @deprecated - */ - status: 'completed' | 'failed' | 'in_queue' | 'retrying' | 'pending'; - - /** - * Webhook URLs that have not yet been successfully notified as of the time this webhook event was sent. - * The URL receiving the Event will still be listed in pending_urls, as will any other URLs that receive the Event at the same time - */ - pending_urls: string[]; - - /** - * Webhook URLs that have already been successfully notified as of the time this webhook was sent - */ - completed_urls: string[]; -} - -declare class Event implements IEvent { - id: string; - mode: 'test' | 'production'; - object: 'Event'; - description: string; - previous_attributes: any; - result: any; - status: 'completed' | 'failed' | 'in_queue' | 'retrying' | 'pending'; - pending_urls: string[]; - completed_urls: string[]; - created_at: string; - updated_at: string; - - /** - * Events can be retrieved by their ID. - * - * @param eventId the ID of the event object. - * @returns {Promise} The retrieved {@link Event}. - */ - static retrieve(eventId: string): Promise; - - /** - * Retrieve all event objects. - * - * @param {Object} params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Event events} and pagination information. - */ - static all(params: IEventListParameters): Promise<{ events: Event[]; has_more: boolean }>; - - /** - * Retrieve the next page of {@link Event events}. - * - * This automatically reuses the parameters from the previous call or the original {@link Event.all} call. - * - * @see https://docs.easypost.com/docs/events#retrieve-all-events - * - * @param {Object} events - The previous page of events (the response from the last {@link Event.getNextPage} or {@link Event.all} call). - * @param {number} [pageSize] - The number of events to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Event events} and pagination information. - */ - static getNextPage( - events: Object, - pageSize?: number, - ): Promise<{ events: Event[]; has_more: boolean }>; -} - -export type { Event }; diff --git a/types/Event/EventListParameters.d.ts b/types/Event/EventListParameters.d.ts deleted file mode 100644 index 30a2e6419..000000000 --- a/types/Event/EventListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/events#retrieve-all-events - */ -export declare interface IEventListParameters extends IAllMethodParameters {} diff --git a/types/Event/Payload/Payload.d.ts b/types/Event/Payload/Payload.d.ts deleted file mode 100644 index 49130e93b..000000000 --- a/types/Event/Payload/Payload.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../../base'; -import { IPayloadListParameters } from './PayloadListParameters'; - -/** - * A Payload represents an attempt by EasyPost to send an Event to a Webhook. - * An Event can have multiple Payloads. For instance, if there is a failure to deliver a Webhook, - * an Event would have multiple payloads, one for each attempt to deliver the Event to the Webhook. - * Payload can be useful for debugging webhook delivery and when initially setting up EasyPost webhooks. - */ -export declare interface IPayload extends IObjectWithId<'Payload'>, IDatedObject { - /** - * The body of the Payload response - */ - response_body: string | null; -} - -declare class Payload implements IPayload { - id: string; - mode: 'test' | 'production'; - object: 'Payload'; - response_body: string; - created_at: string; - updated_at: string; - - /** - * Payload can be retrieved by their ID. - * - * @see https://docs.easypost.com/docs/events/payloads#retrieve-a-payload - * - * @param eventId the ID of the event object. - * @param payloadId the ID of the payload. - * @returns {Promise} The retrieved {@link Payload payload}. - */ - static retrieve(eventId: string, payloadId: string): Promise; - - /** - * Retrieve all payload objects. - * - * @see https://docs.easypost.com/docs/events/payloads#retrieve-all-payloads - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Payload payloads} and pagination information. - */ - static all(params: IPayloadListParameters): Promise<{ payloads: Payload[] }>; -} - -export type { Payload }; diff --git a/types/Event/Payload/PayloadListParameters.d.ts b/types/Event/Payload/PayloadListParameters.d.ts deleted file mode 100644 index 22f2f7170..000000000 --- a/types/Event/Payload/PayloadListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../../utils'; - -/** - * @see https://docs.easypost.com/docs/events/payloads#retrieve-all-payloads - */ -export declare interface IPayloadListParameters extends IAllMethodParameters {} diff --git a/types/Event/Payload/index.d.ts b/types/Event/Payload/index.d.ts deleted file mode 100644 index b1fd98702..000000000 --- a/types/Event/Payload/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Payload'; diff --git a/types/Event/index.d.ts b/types/Event/index.d.ts deleted file mode 100644 index e59a11981..000000000 --- a/types/Event/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Event'; diff --git a/types/FedExRegistration/FedExRegistration.d.ts b/types/FedExRegistration/FedExRegistration.d.ts deleted file mode 100644 index 98a121ba9..000000000 --- a/types/FedExRegistration/FedExRegistration.d.ts +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Interface for FedEx Account Validation Response returned during initial validation steps. - */ -export declare interface IFedExAccountValidationResponse { - /** - * Email address for PIN delivery (if applicable) - */ - email_address?: string | null; - - /** - * Available PIN delivery options (SMS, CALL, EMAIL, INVOICE) - */ - options?: Array | null; - - /** - * Phone number for PIN delivery (if applicable) - */ - phone_number?: string | null; - - /** - * Carrier account ID (returned upon successful validation) - */ - id?: string | null; - - /** - * Object type (returned upon successful validation) - */ - object?: string | null; - - /** - * Carrier account type (returned upon successful validation) - */ - type?: string | null; - - /** - * Carrier account credentials (returned upon successful validation) - */ - credentials?: Record | null; -} - -/** - * Interface for FedEx Request PIN Response. - */ -export declare interface IFedExRequestPinResponse { - /** - * Confirmation message that PIN was sent - */ - message?: string | null; -} - -/** - * The FedEx Registration service provides methods for registering FedEx carrier accounts with multi-factor authentication. - * - * @see https://support.easypost.com/hc/en-us/articles/35262738410253-FedEx-Multi-Factor-Authentication - */ -declare class FedExRegistration { - /** - * Register the billing address for a FedEx account. - * - * @param fedexAccountNumber The FedEx account number. - * @param params Parameters including address_validation and optional easypost_details. - * @returns {Promise} Response object with next steps (PIN or invoice validation). - */ - static registerAddress( - fedexAccountNumber: string, - params: { - address_validation: { - name?: string; - street1: string; - city: string; - state: string; - postal_code: string; - country_code: string; - }; - easypost_details?: { - action?: string; - type?: string; - carrier_account_id?: string; - }; - }, - ): Promise; - - /** - * Request a PIN for FedEx account verification. - * - * @param fedexAccountNumber The FedEx account number. - * @param pinMethodOption The PIN delivery method: "SMS", "CALL", or "EMAIL". - * @param params Parameters including easypost_details. - * @returns {Promise} Response object confirming PIN was sent. - */ - static requestPin( - fedexAccountNumber: string, - pinMethodOption: string, - params: { - easypost_details?: { - action?: string; - type?: string; - carrier_account_id?: string; - }; - }, - ): Promise; - - /** - * Validate the PIN entered by the user for FedEx account verification. - * - * @param fedexAccountNumber The FedEx account number. - * @param params Parameters including pin_validation and optional easypost_details. - * @returns {Promise} Response object with carrier account credentials. - */ - static validatePin( - fedexAccountNumber: string, - params: { - pin_validation: { - pin_code: string; - name?: string; - }; - easypost_details?: { - action?: string; - type?: string; - carrier_account_id?: string; - }; - }, - ): Promise; - - /** - * Submit invoice information to complete FedEx account registration. - * - * @param fedexAccountNumber The FedEx account number. - * @param params Parameters including invoice_validation and optional easypost_details. - * @returns {Promise} Response object with carrier account credentials. - */ - static submitInvoice( - fedexAccountNumber: string, - params: { - invoice_validation: { - name?: string; - invoice_number: string; - invoice_date: string; - invoice_amount: string; - invoice_currency: string; - }; - easypost_details?: { - action?: string; - type?: string; - carrier_account_id?: string; - }; - }, - ): Promise; -} - -export type { FedExRegistration }; diff --git a/types/FedExRegistration/index.d.ts b/types/FedExRegistration/index.d.ts deleted file mode 100644 index 3279c547f..000000000 --- a/types/FedExRegistration/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './FedExRegistration'; diff --git a/types/Fee/Fee.d.ts b/types/Fee/Fee.d.ts deleted file mode 100644 index 7dee8fd93..000000000 --- a/types/Fee/Fee.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { IBaseObject } from '../base'; -import { TFeeType } from './FeeType'; - -/** - * Fee objects are used to represent the breakdown of charges made when purchasing an item on EasyPost. - * Shipments and Trackers both have associations to Fee objects. - * - * Each Shipment object will have a Fee of type "LabelFee" to represent the label fee charged by EasyPost for the service. - * Shipments with postage collected by EasyPost (as opposed to shipments with postage collected directly by the carrier) will have a "PostageFee" according to the postage amount. - * Insurance on a Shipment will add an "InsuranceFee" with the insurance premium (not the covered value) for the amount. - * Tracker objects will have a "TrackerFee" with the price, even when a Tracker is free. - * - * @see https://docs.easypost.com/docs/fees#fee-object - */ -export declare interface IFee extends IBaseObject<'Fee'> { - /** - * The name of the category of fee. Possible types are "LabelFee", "PostageFee", "InsuranceFee", and "TrackerFee" - */ - type: TFeeType; - - /** - * USD value with sub-cent precision - */ - amount: string; - - /** - * Whether EasyPost has successfully charged your account for the fee - */ - charged: boolean; - - /** - * Whether the Fee has been refunded successfully - */ - refunded: boolean; -} - -declare class Fee implements IFee { - object: 'Fee'; - type: TFeeType; - amount: string; - charged: boolean; - refunded: boolean; -} - -export type { Fee }; diff --git a/types/Fee/FeeType.d.ts b/types/Fee/FeeType.d.ts deleted file mode 100644 index 04fe55530..000000000 --- a/types/Fee/FeeType.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare type TFeeType = 'InsuranceFee' | 'LabelFee' | 'PostageFee' | 'TrackerFee'; diff --git a/types/Fee/index.d.ts b/types/Fee/index.d.ts deleted file mode 100644 index bcaf739f4..000000000 --- a/types/Fee/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Fee'; -export * from './FeeType'; diff --git a/types/Insurance/Insurance.d.ts b/types/Insurance/Insurance.d.ts deleted file mode 100644 index 4b55ced06..000000000 --- a/types/Insurance/Insurance.d.ts +++ /dev/null @@ -1,176 +0,0 @@ -import { IAddress } from '../Address'; -import { IDatedObject, IObjectWithId } from '../base'; -import { IFee } from '../Fee'; -import { ITracker } from '../Tracker'; -import { IAllMethodParameters } from '../utils'; -import { IInsuranceCreateParameters } from './InsuranceCreateParameters'; -import { TInsuranceStatus } from './InsuranceStatus'; - -/** - * An Insurance object represents insurance for packages purchased both via the EasyPost API as well as shipments purchased through third parties and later registered with EasyPost. - * An Insurance is created automatically whenever you buy a Shipment through EasyPost and pass insurance options during the Buy call or in a later call to Insure a Shipment. - * - * Insurance purchased through the Shipment Buy or Insure endpoints is immediately insured - there is no possibility of rejection based on tracking information, as the package was just created. - * On the other hand, Insurance purchased on shipments purchased outside of EasyPost requires creation with a tracking code so that EasyPost may confirm the package existence and current shipping status at the time of purchase. - * - * Standalone insurance is created in a pending state to help distinguish it from insurance purchased for an EasyPost Shipment. - * Both kinds of Insurance use the Tracking system to receive periodic updates, and will report those updates to any appropriate Webhooks on file. - * Standalone insurance will cancel itself if the tracking information for the given tracking code shows evidence of having been shipped anytime before the insurance was purchased. - * - * Unlike Shipments within EasyPost, Insurance objects register To and From Address objects according to the destination and ship-from locations of the package. - * This means that a Shipment with "is_return: true" actually ships to the listed From Address. - * Insurance does not have a concept of "is_return", so all insurance records refer to their true package destination as "to_address", regardless of whether or not the shipment is a return. - * - * @see https://docs.easypost.com/docs/insurance#insurance-object - */ -export declare interface IInsurance extends IObjectWithId<'Insurance'>, IDatedObject { - /** - * The unique reference for this Insurance, if any - */ - reference?: string | null; - - /** - * USD value of insured goods with sub-cent precision - */ - amount: string; - - /** - * The insurance provider used by EasyPost - */ - provider: string; - - /** - * An identifying number for some insurance providers used by EasyPost - */ - provider_id: string; - - /** - * The ID of the Shipment in EasyPost, if postage was purchased via EasyPost - */ - shipment_id: string; - - /** - * The tracking code of either the shipment within EasyPost, or provided by you during creation - */ - tracking_code: string; - - /** - * The current status of the insurance, possible values are "new", "pending", "purchased", "failed", or "cancelled" - */ - status: TInsuranceStatus; - - /** - * The associated Tracker object - */ - tracker: ITracker; - - /** - * The associated Address object for destination - */ - to_address: IAddress; - - /** - * The associated Address object for origin - */ - from_address: IAddress; - - /** - * The associated InsuranceFee object if any - */ - fee: IFee; - - /** - * The list of errors encountered during attempted purchase of the insurance - */ - messages: string[]; -} - -declare class Insurance implements IInsurance { - public constructor(input: IInsuranceCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Insurance'; - reference?: string | null; - amount: string; - provider: string; - provider_id: string; - shipment_id: string; - tracking_code: string; - status: TInsuranceStatus; - tracker: ITracker; - to_address: IAddress; - from_address: IAddress; - fee: IFee; - messages: string[]; - created_at: string; - updated_at: string; - - /** - * An Insurance created via this endpoint must belong to a shipment purchased outside of EasyPost. - * Insurance for Shipments created within EasyPost must be created via the Shipment Buy or Insure endpoints. - * When creating Insurance for a non-EasyPost shipment, you must provide `to_address`, `from_address`, `tracking_code`, and `amount` information. - * Optionally, you can provide the carrier parameter, which will help EasyPost identify the carrier the package was shipped with. - * If no carrier is provided, EasyPost will attempt to determine the carrier based on the tracking_code provided. - * Providing a carrier parameter is recommended, since some tracking_codes are ambiguous and may match with more than one carrier. - * In addition, not having to auto-match the carrier will significantly speed up the response time. - * - * @see https://docs.easypost.com/docs/insurance#create-an-insurance - * - * @param {Object} params The parameters to create an {@link Insurance} with. - * @returns {Promise} The created and verified {@link Insurance}. - */ - static create(params: Object): Promise; - - /** - * The Insurance List is a paginated list of all Insurance objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The has_more attribute indicates whether or not additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/insurance#retrieve-all-insurances - * - * @returns {Object} - An object containing a list of {@link Insurance insurance} and pagination information. - */ - static all( - params?: IAllMethodParameters, - ): Promise<{ insurances: Insurance[]; has_more: boolean }>; - - /** - * Retrieve an Insurance by id. - * - * @see https://docs.easypost.com/docs/insurance#retrieve-an-insurance - * - * @param insuranceId Unique, starts with "ins_" - * @returns {Promise} The retrieved {@link Insurance}. - */ - static retrieve(insuranceId: string): Promise; - - /** - * Retrieve the next page of {@link Insurance insurances}. - * - * This automatically reuses the parameters from the previous call or the original {@link Insurance.all} call. - * - * @see https://docs.easypost.com/docs/insurance#retrieve-all-insurances - * - * @param {Object} insurances - The previous page of insurances (the response from the last {@link Insurance.getNextPage} or {@link Insurance.all} call). - * @param {number} [pageSize] - The number of insurances to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Insurance insurances} and pagination information. - */ - static getNextPage( - insurances: Object, - pageSize?: number, - ): Promise<{ insurances: Insurance[]; has_more: boolean }>; - - /** - * Refund an Insurance by id. - * - * @see https://docs.easypost.com/docs/insurance#refund-an-insurance - * - * @param insuranceId Unique, starts with "ins_" - * @returns {Promise} The refunded {@link Insurance}. - */ - static refund(insuranceId: string): Promise; -} - -export type { Insurance }; diff --git a/types/Insurance/InsuranceCreateParameters.d.ts b/types/Insurance/InsuranceCreateParameters.d.ts deleted file mode 100644 index e467ef25c..000000000 --- a/types/Insurance/InsuranceCreateParameters.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IAddress } from '../Address'; - -export declare interface IInsuranceCreateParameters { - reference?: string | null; - to_address: IAddress | string; - from_address: IAddress | string; - - /** - * The carrier associated with the tracking_code you provided. - * The carrier will get auto-detected if none is provided - */ - carrier?: string | null; - - /** - * The tracking code associated with the non-EasyPost-purchased package you'd like to insure. - */ - tracking_code: string; - - /** - * The USD value of contents you would like to insure. - * Currently the maximum is $5000 - * - * @example 100.00 - */ - amount: string; -} diff --git a/types/Insurance/InsuranceStatus.d.ts b/types/Insurance/InsuranceStatus.d.ts deleted file mode 100644 index 80ad8f4ef..000000000 --- a/types/Insurance/InsuranceStatus.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare type TInsuranceStatus = 'new' | 'pending' | 'purchased' | 'failed' | 'cancelled'; diff --git a/types/Insurance/index.d.ts b/types/Insurance/index.d.ts deleted file mode 100644 index 198f8684d..000000000 --- a/types/Insurance/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './Insurance'; -export * from './InsuranceStatus'; -export * from './InsuranceCreateParameters'; diff --git a/types/Luma/Luma.d.ts b/types/Luma/Luma.d.ts deleted file mode 100644 index d870df72e..000000000 --- a/types/Luma/Luma.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Interface representing an EasyPost Luma promise object. - * - * @see https://docs.easypost.com/docs/luma - */ -export declare interface ILumaPromise { - /** Always returns "LumaInfo". */ - object: string; - - /** The delivery date and time commitment. */ - delivery_datetime: string | null; - - /** The delivery date commitment. */ - delivery_date: string | null; - - /** The pickup date and time commitment. */ - pickup_datetime: string | null; - - /** The pickup date commitment. */ - pickup_date: string | null; - - /** The carrier account used for the promise. */ - carrier_account_id: string | null; - - /** The service level used for the promise. */ - service: string | null; - - /** The carrier used for the promise. */ - carrier: string | null; -} - -/** - * The Luma class interacts with the Luma API to provide service recommendations. - * - * @see https://docs.easypost.com/docs/luma - */ -declare class Luma { - /** - * Get service recommendations from Luma that meet the criteria of your ruleset. - * - * @see https://docs.easypost.com/docs/luma - * - * @param params - The parameters to get a Luma promise with (shipment parameters). - * @returns {Promise} - An object containing the Luma promise. - */ - static getPromise(params: object): Promise; -} - -export type { Luma }; diff --git a/types/Luma/index.d.ts b/types/Luma/index.d.ts deleted file mode 100644 index 24ea27a16..000000000 --- a/types/Luma/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Luma'; diff --git a/types/Order/Order.d.ts b/types/Order/Order.d.ts deleted file mode 100644 index 529c3611d..000000000 --- a/types/Order/Order.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -import { IAddress } from '../Address'; -import { IDatedObject, IObjectWithId } from '../base'; -import { IRate } from '../Rate'; -import { IMessage, IShipment } from '../Shipment'; -import { IOrderCreateParameters } from './OrderCreateParameters'; - -/** - * The Order object represents a collection of packages and can be used for Multi-Piece Shipments. - * Like a single Shipment each Order consists of a "to" and "from" Address to be used for each Shipment within the Order. - * These Addresses will be copied to each Shipment so there is no need to specify them multiple times. - * Each Shipment must then specify its Parcel, Options, and CustomsInfo. - * - * An Order created with valid Address Objects and Parcel data nested within the Order's Shipment object will automatically retrieve available shipping Rate options. - * - * @see https://docs.easypost.com/docs/orders#order-object - */ -export declare interface IOrder extends IObjectWithId<'Order'>, IDatedObject { - /** - * An optional field that may be used in place of id in other API endpoints - */ - reference?: string | null; - - /** - * The destination address - */ - to_address: IAddress; - - /** - * The origin address - */ - from_address: IAddress; - - /** - * The shipper's address, defaults to from_address - */ - return_address?: IAddress | null; - - /** - * The buyer's address, defaults to to_address - */ - buyer_address?: IAddress | null; - - /** - * All associated Shipment objects. Maximum of 100. - */ - shipments: IShipment[]; - - /** - * All associated Rate objects - */ - rates: IRate[]; - - /** - * Any carrier errors encountered during rating - */ - messages: IMessage[]; - - /** - * Set true to create as a return - */ - is_return?: boolean | null; -} - -declare class Order implements IOrder { - public constructor(input: IOrderCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Order'; - reference?: string | null; - to_address: IAddress; - from_address: IAddress; - return_address?: IAddress | null; - buyer_address?: IAddress | null; - shipments: IShipment[]; - rates: IRate[]; - messages: IMessage[]; - is_return?: boolean | null; - created_at: string; - updated_at: string; - - /** - * An Order is almost exclusively a container for other objects, and thus an Order may reuse many of these objects. - * Alternatively, all the objects contained within an Order may be created at the same time. - * - * You can limit the CarrierAccounts to use for rating by passing the carrier_accounts parameter. - * - * @see https://docs.easypost.com/docs/orders#create-an-order - * - * @param {Object} params The parameters to create an {@link Order} with. - * @returns {Promise} The created and verified {@link Order}. - */ - static create(params: Object): Promise; - - /** - * An Order can be retrieved by either its id or reference. - * However it is recommended to use EasyPost's provided identifiers because uniqueness on reference is not enforced. - * - * @see https://docs.easypost.com/docs/orders#retrieve-an-order - * - * @param orderId Unique, begins with "order_" - * @returns {Promise} The retrieved {@link Order}. - */ - static retrieve(orderId: string): Promise; - - /** - * To purchase an Order you only need to specify the carrier and service to purchase. - * This operation populates the `tracking_code` and `postage_label` attributes of each Shipment. - * - * @see https://docs.easypost.com/docs/orders#buy-an-order - * - * @param orderId Unique, begins with "order_" - * @param carrier Carrier (UPS, FedEx, USPS) - * @param service Service of the carrier - * - * @returns {Promise} The {@link Order} object. - */ - static buy(orderId: string, carrier: string, service: string): Promise; - - /** - * Returns the rates of an Order. - * - * @param orderId Unique, begins with "order_" - * @returns {Promise} The list of {@link IRate[]}. - */ - static getRates(orderId: string): Promise; - - /** - * - * @param carriers a list of carriers to filter rates for. - * @param services a list of services to filter rates for. - * @returns {Rate} The lowest {@link Rate}. - */ - lowestRate(carriers?: string[], services?: string[]): IRate; -} - -export type { Order }; diff --git a/types/Order/OrderCreateParameters.d.ts b/types/Order/OrderCreateParameters.d.ts deleted file mode 100644 index 05fce62b9..000000000 --- a/types/Order/OrderCreateParameters.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IAddress } from '../Address'; -import { Shipment } from '../Shipment'; - -export declare interface IOrderCreateParameters { - reference?: string | null; - to_address: IAddress | string; - from_address: IAddress | string; - shipments: Shipment[]; - - /** - * optional array of ids that begin with "ca_" - */ - carrier_accounts?: string[] | null; -} diff --git a/types/Order/index.d.ts b/types/Order/index.d.ts deleted file mode 100644 index aead5d7cb..000000000 --- a/types/Order/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Order'; -export * from './OrderCreateParameters'; diff --git a/types/Parcel/Parcel.d.ts b/types/Parcel/Parcel.d.ts deleted file mode 100644 index cd1dd5af0..000000000 --- a/types/Parcel/Parcel.d.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; -import { DeepPartial } from '../utils'; -import { IParcelCreateParameters } from './ParcelCreateParameters'; - -/** - * Parcel objects represent the physical container being shipped. - * Dimensions can be supplied either as length, width, and height dimensions, or a predefined_package string. - * Only weight is required, but since many carriers charge different rates for packages with large dimensions, we strongly recommend including all dimensions if available. - * - * Weights are in OUNCES (OZ) and go to one decimal point. - * Dimensions are in INCHES (IN) and go to one decimal point. - * - * @see https://docs.easypost.com/docs/parcels#parcel-object - */ -export declare interface IParcel extends IObjectWithId<'Parcel'>, IDatedObject { - /** - * Required if width and/or height are present - * float (inches) - */ - length?: number | null; - - /** - * Required if width and/or height are present - * float (inches) - */ - width?: number | null; - - /** - * Required if width and/or height are present - * float (inches) - */ - height?: number | null; - - /** - * Always required - * float (oz) - */ - weight: number; - - /** - * Optional, one of our predefined_packages - */ - predefined_package?: string | null; -} - -declare class Parcel implements IParcel { - public constructor(input: DeepPartial); - - id: string; - mode: 'test' | 'production'; - object: 'Parcel'; - length?: number | null; - width?: number | null; - height?: number | null; - predefined_package?: string | null; - weight: number; - created_at: string; - updated_at: string; - - /** - * Include the `weight`, and either a `predefined_package` or `length`, `width` and `height` if applicable. - * - * @see https://docs.easypost.com/docs/parcels#create-a-parcel - * - * @param {Object} params The parameters to create an {@link Parcel} with. - * @returns {Promise} The created and verified {@link Parcel}. - */ - static create(params: Object): Promise; - - /** - * Get a Parcel by its id. - * In general you should not need to use this in your automated solution. - * A Parcel's id can be inlined into the creation call to other objects. - * This allows you to only create one Parcel for each package you will be using. - * - * @see https://docs.easypost.com/docs/parcels#retrieve-a-parcel - * - * @param parcelId Unique, begins with "prcl_" - * @returns {Promise} The retrieved {@link Parcel}. - */ - static retrieve(parcelId: string): Promise; -} - -export type { Parcel }; diff --git a/types/Parcel/ParcelCreateParameters.d.ts b/types/Parcel/ParcelCreateParameters.d.ts deleted file mode 100644 index 22e3ae711..000000000 --- a/types/Parcel/ParcelCreateParameters.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ParametersToOmitOnCreate } from '../utils'; -import { IParcel } from './Parcel'; - -export declare interface IParcelCreateParameters extends Omit { - /** - * Required if width and/or height are present - * float (inches) - */ - length?: number | null; - - /** - * Required if width and/or height are present - * float (inches) - */ - width?: number | null; - - /** - * Required if width and/or height are present - * float (inches) - */ - height?: number | null; - - /** - * Always required - * float (oz) - */ - weight: number; -} diff --git a/types/Parcel/index.d.ts b/types/Parcel/index.d.ts deleted file mode 100644 index f4ffd66ec..000000000 --- a/types/Parcel/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Parcel'; diff --git a/types/PaymentMethod/PaymentMethod.d.ts b/types/PaymentMethod/PaymentMethod.d.ts deleted file mode 100644 index 82c76d12b..000000000 --- a/types/PaymentMethod/PaymentMethod.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { IObjectWithId } from '../base'; - -/** - * The Payment method object can be either credit card or bank account. - */ -export declare interface IPaymentMethod extends IObjectWithId<'PaymentMethod'> { - /** - * Country of the bank account - */ - country: string; - - /** - * Name of the bank - */ - bank_name: string; - - /** - * Brand of the credit card - */ - brand: string; - - /** - * Whether the payment method(credit card or bank account) is disabled or not - */ - disabled_at: string; - - /** - * Expiration month of the credit card - */ - exp_month: number; - - /** - * Expiration year of the credit card - */ - exp_year: number; - - /** - * Last four of the credit card - */ - last4: string; - - /** - * Name of the credit card - */ - name: string; - - /** - * Whether the bank account is verified or not - */ - verified: boolean; -} - -declare class PaymentMethod implements IPaymentMethod { - id: string; - mode: 'test' | 'production'; - object: 'PaymentMethod'; - country: string; - bank_name: string; - brand: string; - disabled_at: string; - exp_month: number; - exp_year: number; - last4: string; - name: string; - verified: boolean; -} - -export type { PaymentMethod }; diff --git a/types/PaymentMethod/index.d.ts b/types/PaymentMethod/index.d.ts deleted file mode 100644 index ce53190ca..000000000 --- a/types/PaymentMethod/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './PaymentMethod'; diff --git a/types/Pickup/Pickup.d.ts b/types/Pickup/Pickup.d.ts deleted file mode 100644 index 401424042..000000000 --- a/types/Pickup/Pickup.d.ts +++ /dev/null @@ -1,201 +0,0 @@ -import { IAddress } from '../Address'; -import { IDatedObject, IObjectWithId } from '../base'; -import { ICarrierAccount } from '../Carrier'; -import { IRate } from '../Rate'; -import { IMessage, IShipment } from '../Shipment'; -import { IPickupCreateParameters } from './PickupCreateParameters'; -import { IPickupListParameters } from './PickupListParameters'; -import { IPickupRate } from './PickupRate'; - -/** - * The Pickup object allows you to schedule a pickup from your carrier from your customer's residence or place of business. - * Supported carriers include: - * - Canada Post - * - Canpar - * - DHL Express - * - FedEx - * - Lasership - * - Loomis Express - * - LSO - * - Ontrac - * - UPS - * - USPS - * - Veho - * - * After a Pickup is successfully created, it will automatically fetch PickupRates for each CarrierAccount specified that supports scheduled pickups. - * Then a PickupRate must be selected and purchased before the pickup can be successfully scheduled. - * - * @see https://docs.easypost.com/docs/pickups#pickup-object - */ -export declare interface IPickup extends IObjectWithId<'Pickup'>, IDatedObject { - /** - * An optional field that may be used in place of ID in some API endpoints - */ - reference?: string | null; - - /** - * One of: "unknown", "scheduled", or "canceled" - */ - status: 'unknown' | 'scheduled' | 'canceled'; - - /** - * The earliest time at which the package is available to pick up - */ - min_datetime: string; - - /** - * The latest time at which the package is available to pick up. - * Must be later than the min_datetime - */ - max_datetime: string; - - /** - * Is the pickup address the account's address? - */ - is_account_address?: boolean | null; - - /** - * Additional text to help the driver successfully obtain the package - */ - instructions?: string | null; - - /** - * A list of messages containing carrier errors encountered during pickup rate generation - */ - messages: IMessage[]; - - /** - * The confirmation number for a booked pickup from the carrier - */ - confirmation: string; - - /** - * The associated Shipment - */ - shipment: IShipment; - - /** - * The associated Address - */ - address: IAddress; - - /** - * The list of carriers (if empty, all carriers were used) used to generate pickup rates - */ - carrier_accounts?: ICarrierAccount[] | null; - - /** - * The list of different pickup rates across valid carrier accounts for the shipment - */ - pickup_rates: IPickupRate[]; -} - -declare class Pickup implements IPickup { - public constructor(input: IPickupCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Pickup'; - reference?: string | null; - status: 'unknown' | 'scheduled' | 'canceled'; - min_datetime: string; - max_datetime: string; - is_account_address?: boolean | null; - instructions?: string | null; - messages: IMessage[]; - confirmation: string; - shipment: IShipment; - address: IAddress; - carrier_accounts?: ICarrierAccount[] | null; - pickup_rates: IPickupRate[]; - created_at: string; - updated_at: string; - - /** - * Creating a Pickup will automatically fetch rates for the given time frame and location. - * - * Pickups work with existing shipments or a batch and either a fully-specified Address object or id. - * The examples below assume that a shipment and address have both already been created. - * - * @see https://docs.easypost.com/docs/pickups#create-a-pickup - * - * @param {Object} params The parameters to create an {@link Pickup} with. - * @returns {Promise} The created and verified {@link Pickup}. - */ - static create(params: Object): Promise; - - /** - * The Pickup List is a paginated list of all Pickup objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The has_more attribute indicates whether additional pages can be requested. - * The recommended way of paginating is to use either the before_id or after_id parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/pickups#retrieve-all-pickups - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Pickup pickups} and pagination information. - */ - static all(params?: IPickupListParameters): Promise<{ pickups: Pickup[]; has_more: boolean }>; - - /** - * A Pickup object can be retrieved by either an id or reference. - * However it is recommended to use EasyPost's provided identifiers because uniqueness on reference is not enforced. - * - * @see https://docs.easypost.com/docs/pickups#retrieve-a-pickup - * - * @param pickupId Unique, starts with "pickup_" - * @returns {Promise} The created and verified {@link Pickup}. - */ - static retrieve(pickupId: string): Promise; - - /** - * To purchase a Pickup a PickupRate must be specified by its carrier and service name, instead of its id. - * The client libraries will handle this automatically if a PickupRate is provided. - * - * @see https://docs.easypost.com/docs/pickups#buy-a-pickup - * - * @param pickupId Unique, begins with "pickup_" - * @param carrier Carrier (UPS, FedEx, USPS) - * @param service Service of the carrier - * @returns {Promise} The created and verified {@link Pickup}. - */ - static buy(pickupId: string, carrier: string, service: string): Promise; - - /** - * You may cancel a Pickup anytime before it has been completed. - * It requires no additional parameters other than the id or reference. - * The status will change to "canceled" on success. - * - * @see https://docs.easypost.com/docs/pickups#cancel-a-pickup - * - * @param pickupId Unique, begins with "pickup_" - * @returns {Promise} The created and verified {@link Pickup}. - */ - static cancel(pickupId: string): Promise; - - /** - * Retrieve the next page of {@link Pickup pickups}. - * - * This automatically reuses the parameters from the previous call or the original {@link Pickup.all} call. - * - * @see https://docs.easypost.com/docs/pickups#retrieve-all-pickups - * - * @param {Object} pickups - The previous page of pickups (the response from the last {@link Pickup.getNextPage} or {@link Pickup.all} call). - * @param {number} [pageSize] - The number of pickups to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Pickup pickups} and pagination information. - */ - static getNextPage( - pickups: Object, - pageSize?: number, - ): Promise<{ pickups: Pickup[]; has_more: boolean }>; - - /** - * - * @param carriers a list of carriers to filter rates for. - * @param services a list of services to filter rates for. - * @returns {Rate} The lowest {@link Rate}. - */ - lowestRate(carriers?: string[], services?: string[]): IRate; -} - -export type { Pickup }; diff --git a/types/Pickup/PickupCreateParameters.d.ts b/types/Pickup/PickupCreateParameters.d.ts deleted file mode 100644 index 109fe09bc..000000000 --- a/types/Pickup/PickupCreateParameters.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { IPickupRate } from './PickupRate'; -import { Address } from '../Address'; -import { Batch } from '../Batch'; -import { CarrierAccount } from '../Carrier'; -import { Shipment } from '../Shipment'; - -interface BasePickupCreateParameters { - address: Address | string; - carrier_accounts?: CarrierAccount[] | null; - confirmation?: string | null; - instructions?: string | null; - is_account_address?: boolean | null; - max_datetime: string; - min_datetime: string; - pickup_rates: IPickupRate; - reference?: string | null; - status: string; -} - -interface ShipmentPickupCreateParameters extends BasePickupCreateParameters { - shipment?: Shipment | string | null; -} - -interface BatchPickupCreateParameters extends BasePickupCreateParameters { - batch?: Batch | string | null; -} - -export type IPickupCreateParameters = ShipmentPickupCreateParameters | BatchPickupCreateParameters; diff --git a/types/Pickup/PickupListParameters.d.ts b/types/Pickup/PickupListParameters.d.ts deleted file mode 100644 index d43400459..000000000 --- a/types/Pickup/PickupListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/pickups#retrieve-all-pickups - */ -export declare interface IPickupListParameters extends IAllMethodParameters {} diff --git a/types/Pickup/PickupRate.d.ts b/types/Pickup/PickupRate.d.ts deleted file mode 100644 index b308dd240..000000000 --- a/types/Pickup/PickupRate.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; - -/** - * @see https://docs.easypost.com/docs/pickups#pickuprate-object - */ -export declare interface IPickupRate extends IObjectWithId<'PickupRate'>, IDatedObject { - /** - * service name - */ - service: string; - - /** - * name of carrier - */ - carrier: string; - - /** - * the actual rate quote for this service - */ - rate: string; - - /** - * currency for the rate - */ - currency: string; - - /** - * the ID of the pickup this is a quote for - */ - pickup_id: string; -} diff --git a/types/Pickup/index.d.ts b/types/Pickup/index.d.ts deleted file mode 100644 index 99968d8e0..000000000 --- a/types/Pickup/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './Pickup'; -export * from './PickupRate'; -export * from './PickupCreateParameters'; diff --git a/types/Rate/Rate.d.ts b/types/Rate/Rate.d.ts deleted file mode 100644 index a0cc8389d..000000000 --- a/types/Rate/Rate.d.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; - -/** - * The Rate class represents a summary of the price and details of a delivery service quote. - * - * @see https://docs.easypost.com/docs/shipments/rates - */ -export declare interface IRate extends IObjectWithId<'Rate'>, IDatedObject { - /** - * The service level of the rate. - */ - service: string; - /** - * The carrier of the rate. - */ - carrier: string; - /** - * The ID of the carrier account associated with this rate. - */ - carrier_account_id: string; - /** - * The ID of the shipment associated with this rate. - */ - shipment_id: string; - /** - * The quote price of the rate. - */ - rate: string; - /** - * The currency of the rate. - */ - currency: string; - /** - * The in-store retail rate given with no account. - */ - retail_rate: string; - /** - * The currency of the retail rate. - */ - retail_currency: string; - /** - * The non-negotiated rate given for having an account with the carrier. - */ - list_rate: string; - /** - * The currency of the list rate. - */ - list_currency: string; - /** - * The number of days in transit for this rate. - */ - delivery_days: number; - /** - * The delivery date for this rate. - */ - delivery_date: string; - /** - * Whether the delivery window is guaranteed. - */ - delivery_date_guaranteed: boolean; - /** - * The earliest delivery date for this rate. - * This is deprecated and should be ignored. - */ - est_delivery_days: number; - /** - * The billing type of the rate. - */ - billing_type: string; -} - -declare class Rate implements IRate { - billing_type: string; - carrier: string; - carrier_account_id: string; - created_at: string; - currency: string; - delivery_date: string; - delivery_date_guaranteed: boolean; - delivery_days: number; - est_delivery_days: number; - id: string; - list_currency: string; - list_rate: string; - mode: 'test' | 'production'; - object: 'Rate'; - rate: string; - retail_currency: string; - retail_rate: string; - service: string; - shipment_id: string; - updated_at: string; -} - -export type { Rate }; diff --git a/types/Rate/index.d.ts b/types/Rate/index.d.ts deleted file mode 100644 index 9ef03ab5e..000000000 --- a/types/Rate/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Rate'; diff --git a/types/Referral/Referral.d.ts b/types/Referral/Referral.d.ts deleted file mode 100644 index c4bba244f..000000000 --- a/types/Referral/Referral.d.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { IApiKey } from '../ApiKey'; -import { IUser } from '../User'; -import { IReferralCreateParameters } from './ReferralCreateParameters'; -import { IReferralListParameters } from './ReferralListParameters'; - -/** - * A Referral represents a sub-user under a Partner or white-label account. - * - * @see https://docs.easypost.com/docs/users/referral-customers - */ -export declare interface IReferral extends IUser { - /** - * API keys for the referral customer (only returned on creation). - * Contains both test and production API keys. - * These keys should be saved securely as they cannot be retrieved again later. - */ - api_keys?: IApiKey[]; -} - -declare class Referral implements IReferral { - public constructor(input: IReferralCreateParameters); - - id: string; - mode: 'test' | 'production'; - // @ts-ignore Suppress warning about "object" override - object: 'Referral'; - reference?: string | null; - parent_id: string; - name: string; - email: string; - phone_number?: string | null; - balance: string; - recharge_amount: string; - secondary_recharge_amount: string; - recharge_threshold: string; - children: IUser[]; - api_keys?: IApiKey[]; - - /** - * Creates a referral customer. - * - * @see https://docs.easypost.com/docs/users/referral-customers#create-a-referralcustomer - * - * @param {Object} params The parameters to create an {@link Referral} with. - * @returns {Promise} The created Referral. - */ - static create(params: Object): Promise; - - /** - * The Referral List is a paginated list of all Referral objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The `has_more` attribute indicates whether additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/users/referral-customers#retrieve-all-referralcustomers - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Referral referral customers} and pagination information. - */ - static all( - params?: IReferralListParameters, - ): Promise<{ referral_customers: Referral[]; has_more: boolean }>; - - /** - * Update a Referral's email address. - * - * @see https://docs.easypost.com/docs/users/referral-customers#update-a-referralcustomer - * - * @param {string} referralUserId ID of the referral user to update - * @param {string} email New email address for the referral user - * @returns {Promise} Whether the update was successful - */ - static updateEmail(referralUserId: string, email: string): Promise; - - /** - * Add Stripe payment method to referral customer. - * - * @see https://docs.easypost.com/docs/users/referral-customers#add-payment-method-to-referralcustomer - * - * @param {string} stripeCustomerId Stripe customer ID - * @param {string} paymentMethodReference Reference for the Stripe payment method - * @param {string} priority Whether the payment method is primary or secondary - * @returns {object} Object representing the newly-added payment method - */ - static addPaymentMethod( - stripeCustomerId: string, - paymentMethodReference: string, - priority?: string, - ): object; - - /** - * Refund by amount for a recent payment. - * @see https://docs.easypost.com/docs/users/referral-customers#refund-a-referralcustomer - * - * @param {number} refundAmount Amount to refund - * @returns {object} Object representing the newly-added payment method - */ - static refundByAmount(refundAmount: number): object; - - /** - * Refund a payment by a payment log ID. - * @see https://docs.easypost.com/docs/users/referral-customers#refund-a-referralcustomer - * - * @param {string} paymentLogId ID of the payment log to refund - * @returns {object} Object representing the newly-added payment method - */ - static refundByPaymentLog(paymentLogId: string): object; - - /** - * Retrieve the next page of {@link Referral referrals}. - * - * This automatically reuses the parameters from the previous call or the original {@link Referral.all} call. - * - * @see https://docs.easypost.com/docs/users/referral-customers#retrieve-all-referralcustomers - * - * @param {Object} referralCustomers - The previous page of referrals (the response from the last {@link Referral.getNextPage} or {@link Referral.all} call). - * @param {number} [pageSize] - The number of referrals to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Referral referrals} and pagination information. - */ - static getNextPage( - referralCustomers: Object, - pageSize?: number, - ): Promise<{ referral_customers: Referral[]; has_more: boolean }>; -} - -export type { Referral }; diff --git a/types/Referral/ReferralCreateParameters.d.ts b/types/Referral/ReferralCreateParameters.d.ts deleted file mode 100644 index a9a8d5b33..000000000 --- a/types/Referral/ReferralCreateParameters.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ParametersToOmitOnCreate } from '../utils'; -import { IReferral } from './Referral'; - -export declare interface IReferralCreateParameters extends Omit< - IReferral, - ParametersToOmitOnCreate -> {} diff --git a/types/Referral/ReferralListParameters.d.ts b/types/Referral/ReferralListParameters.d.ts deleted file mode 100644 index 5ebd59f20..000000000 --- a/types/Referral/ReferralListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/users/referral-customers#retrieve-all-referralcustomers - */ -export declare interface IReferralListParameters extends IAllMethodParameters {} diff --git a/types/Referral/index.d.ts b/types/Referral/index.d.ts deleted file mode 100644 index 4f93470e0..000000000 --- a/types/Referral/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Referral'; -export * from './ReferralCreateParameters'; diff --git a/types/Refund/Refund.d.ts b/types/Refund/Refund.d.ts deleted file mode 100644 index c8ff8fdc0..000000000 --- a/types/Refund/Refund.d.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; -import { IRefundCreateParameters } from './RefundCreateParameters'; -import { IRefundListParameters } from './RefundListParameters'; - -/** - * The Refund object represents a refunded shipment, and includes details about the related Shipment and tracking code. - * USPS shipping labels can be refunded if requested within 30 days of generation. - * The processing time is at least 15 days, after which the funds will return to your EasyPost balance. - * EasyPost fees will also be refunded. To qualify, a shipment must not have been scanned by the USPS. - * UPS and FedEx shipping labels may be refunded within 90 days of creation. - */ -export declare interface IRefund extends IObjectWithId<'Refund'>, IDatedObject { - /** - * The tracking code of the related Shipment - */ - tracking_code: string; - - /** - * The confirmation number for the refund request to the carrier - */ - confirmation_number: string; - - /** - * The status of the refund request, reported by the carrier. Possible values are "submitted", "refunded", or "rejected" - */ - status: 'submitted' | 'refunded' | 'rejected'; - - /** - * The carrier the refund request was submitted to - */ - carrier: string; - - /** - * The ID of the related Shipment being refunded - */ - shipment_id: string; -} - -declare class Refund implements IRefund { - public constructor(input: IRefundCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Refund'; - tracking_code: string; - confirmation_number: string; - status: 'submitted' | 'refunded' | 'rejected'; - carrier: string; - shipment_id: string; - created_at: string; - updated_at: string; - - /** - * This endpoint is intended to be used to bulk-process multiple refunds; as a result, this endpoint will return a list of Refund objects. - * To refund a single shipment, use the Refund a Shipment endpoint instead. - * - * @see https://docs.easypost.com/docs/refunds#create-a-refund - * - * @param {Object} params The parameters to create an {@link Refund} with. - * @returns {Promise} The created and verified {@link Refund}. - */ - static create(params: Object): Promise; - - /** - * Retrieve a paginated list of all Refunds associated with the given API Key. - * See the Pagination section of our docs for more details on retrieving all records when multiple pages are available. - * - * @see https://docs.easypost.com/docs/refunds#retrieve-all-refunds - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Refund refunds} and pagination information. - */ - static all(params?: IRefundListParameters): Promise<{ refunds: Refund[]; has_more: boolean }>; - - /** - * Retrieve a Refund by id. - * - * @see https://docs.easypost.com/docs/refunds#retrieve-a-refund - * - * @param refundId Unique, starts with "refund_" - * @returns {Promise} The created and verified {@link Refund}. - */ - static retrieve(refundId: string): Promise; - - /** - * Retrieve the next page of {@link Refund refunds}. - * - * This automatically reuses the parameters from the previous call or the original {@link Refund.all} call. - * - * @see https://docs.easypost.com/docs/refunds#retrieve-all-refunds - * - * @param {Object} refunds - The previous page of refunds (the response from the last {@link Refund.getNextPage} or {@link Refund.all} call). - * @param {number} [pageSize] - The number of refunds to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Refund refunds} and pagination information. - */ - static getNextPage( - refunds: Object, - pageSize?: number, - ): Promise<{ refunds: Refund[]; has_more: boolean }>; -} - -export type { Refund }; diff --git a/types/Refund/RefundCreateParameters.d.ts b/types/Refund/RefundCreateParameters.d.ts deleted file mode 100644 index e4d498e68..000000000 --- a/types/Refund/RefundCreateParameters.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @see https://docs.easypost.com/docs/refunds#create-a-refund - */ -export declare interface IRefundCreateParameters { - /** - * The carrier to request a refund from - */ - carrier: string; - - /** - * A list of tracking codes to request refunds for. Even for a single tracking code, it needs to be submitted as a list. - */ - tracking_codes: string[]; -} diff --git a/types/Refund/RefundListParameters.d.ts b/types/Refund/RefundListParameters.d.ts deleted file mode 100644 index 6210bf30b..000000000 --- a/types/Refund/RefundListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/refunds#retrieve-all-refunds - */ -export declare interface IRefundListParameters extends IAllMethodParameters {} diff --git a/types/Refund/index.d.ts b/types/Refund/index.d.ts deleted file mode 100644 index 109195cc5..000000000 --- a/types/Refund/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Refund'; -export * from './RefundCreateParameters'; diff --git a/types/Report/Report.d.ts b/types/Report/Report.d.ts deleted file mode 100644 index 4495848ef..000000000 --- a/types/Report/Report.d.ts +++ /dev/null @@ -1,135 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; -import { IReportCreateParameters } from './ReportCreateParameters'; -import { IReportListParameters } from './ReportListParameters'; -import { TReportObjectType } from './ReportObjectType'; - -/** - * A Report contains a csv that is a log of all the objects created within a certain time frame. - * - * Reports can be generated using the Reports Endpoint. - * You can create and view Reports created between any time frame defined between the start_date and end_date. - * - * The Report api can be categorized into several types. - * These types determine which EasyPost Object to produce a Report for, and should be passed as the type in our libraries: - * - cash_flow - * - insurance - * - payment_log - * - refund - * - shipment - * - shipment_invoice - * - tracker - * - * @see https://docs.easypost.com/docs/reports#report-object - */ -export declare interface IReport extends IObjectWithId, IDatedObject { - /** - * "new", "available", "failed", or null - */ - status: 'new' | 'available' | 'failed' | null; - - /** - * A date string in YYYY-MM-DD form eg: "2016-02-02" - */ - start_date: string; - - /** - * A date string in YYYY-MM-DD form eg: "2016-02-03" - */ - end_date: string; - - /** - * Set true if you would like to include Refunds /Shipments /Trackers created by child users - */ - include_children?: boolean | null; - - /** - * A url that contains a link to the Report. - * Expires 30 seconds after retrieving this object - */ - url: string; - - /** - * Url expiring time - */ - url_expires_at: string; - - /** - * Set true if you would like to send an email containing the Report - */ - send_email?: boolean | null; -} - -declare class Report implements IReport { - public constructor(input: IReportCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: TReportObjectType; - status: 'new' | 'available' | 'failed' | null; - start_date: 'unknown' | 'scheduled' | 'canceled'; - end_date: string; - include_children?: boolean | null; - url: string; - url_expires_at: string; - send_email?: boolean | null; - created_at: string; - updated_at: string; - - /** - * To create a Report, provide a `start_date` and `end_date` that are less than 31 days apart along with any other - * optional parameter that you would like to specify. A detailed list of Report Object attributes are provided below. - * - * The expiry on url is 30 seconds. The default status on each new Report is "new". It changes to "available" if the - * csv file is created successfully or to "failed" when csv creation is unsuccessful, or to "empty" if the report - * does not include any data for the specified date range. Additionally, null could also be a status. - * - * When a Report's status changes, a webhook will be created. See our Webhooks Guide for help on Event handling. - * - * @see https://docs.easypost.com/docs/reports#create-a-report - * - * @param {Object} params The parameters to create an {@link Report} with. - * @returns {Promise} The created and verified {@link Report}. - */ - static create(params: Object): Promise; - - /** - * The Report List is a paginated list of all Report objects associated with the given API Key. It accepts a variety of - * parameters which can be used to modify the scope. The `has_more` attribute indicates whether or not additional pages can - * be requested. The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where - * the next page begins. - * - * @see https://docs.easypost.com/docs/reports#retrieve-all-reports - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Report reports} and pagination information. - */ - static all(params?: IReportListParameters): Promise<{ reports: Report[]; has_more: boolean }>; - - /** - * Retrieve a Report by id. - * - * @param reportId Unique, starts with the prefix for that particular report, - * eg: "cfrep_", "plrep_", "refrep_", "shprep_", "shpinvrep_", "trkrep_" - * - * @see https://docs.easypost.com/docs/reports#retrieve-a-report - */ - static retrieve(reportId: string): Promise; - - /** - * Retrieve the next page of {@link Report reports}. - * - * This automatically reuses the parameters from the previous call or the original {@link Report.all} call. - * - * @see https://docs.easypost.com/docs/reports#retrieve-all-reports - * - * @param {Object} reports - The previous page of reports (the response from the last {@link Report.getNextPage} or {@link Report.all} call). - * @param {number} [pageSize] - The number of reports to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Report reports} and pagination information. - */ - static getNextPage( - reports: Object, - pageSize?: number, - ): Promise<{ reports: Report[]; has_more: boolean }>; -} - -export type { Report }; diff --git a/types/Report/ReportCreateParameters.d.ts b/types/Report/ReportCreateParameters.d.ts deleted file mode 100644 index 43ec64bad..000000000 --- a/types/Report/ReportCreateParameters.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -export declare interface IReportCreateParameters { - start_date: string | null; - end_date?: string | null; - include_children?: boolean | null; - send_email?: boolean | null; - columns?: string[] | null; - additional_columns?: string[] | null; -} diff --git a/types/Report/ReportListParameters.d.ts b/types/Report/ReportListParameters.d.ts deleted file mode 100644 index deaefc273..000000000 --- a/types/Report/ReportListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/refunds#retrieve-all-refunds - */ -export declare interface IReportListParameters extends IAllMethodParameters {} diff --git a/types/Report/ReportObjectType.d.ts b/types/Report/ReportObjectType.d.ts deleted file mode 100644 index c9cc99059..000000000 --- a/types/Report/ReportObjectType.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export declare type TReportObjectType = - | 'CashFlowReport' - | 'PaymentLogReport' - | 'RefundReport' - | 'ShipmentReport' - | 'ShipmentInvoiceReport' - | 'TrackerReport'; diff --git a/types/Report/index.d.ts b/types/Report/index.d.ts deleted file mode 100644 index d0c66d61c..000000000 --- a/types/Report/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Report'; -export * from './ReportObjectType'; diff --git a/types/ScanForm/ScanForm.d.ts b/types/ScanForm/ScanForm.d.ts deleted file mode 100644 index 4b5b9a9ac..000000000 --- a/types/ScanForm/ScanForm.d.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { IAddress } from '../Address'; -import { IDatedObject, IObjectWithId } from '../base'; -import { IScanFormCreateParameters } from './ScanFormCreateParameters'; -import { IScanFormListParameters } from './ScanFormListParameters'; - -/** - * A ScanForm can be created to speed up and simplify the carrier pickup process. - * The ScanForm is one document that can be scanned to mark all included tracking codes as "Accepted for Shipment" by the carrier. - * The following criteria must met before creation: - * - Refunded Shipments cannot be added - * - Each Shipment must have the same origin address - * - Shipments must all be dated (using the label_date option) on or after the date the form is generated - * - Shipments cannot be added to more than one ScanForm - * - Existing ScanForms may not be updated with additional Shipments. If a ScanForm already exists, and new Shipments need to be added, a new ScanForm must be created. - * - Shipments should be provided in the form of an array - * - * @see https://docs.easypost.com/docs/scan-form-object - */ -export declare interface IScanForm extends IObjectWithId<'ScanForm'>, IDatedObject { - /** - * Current status. - * Possible values are "creating", "created" and "failed" - */ - status: 'creating' | 'created' | 'failed'; - - /** - * Human-readable message explaining any failures - */ - message: string; - - /** - * Address that the Shipments will be shipped from - */ - address: IAddress; - - /** - * Tracking codes included on the ScanForm - */ - tracking_codes: string[]; - - /** - * Url of the document - */ - form_url: string; - - /** - * File format of the document - */ - form_file_type: string; - - /** - * The id of the associated Batch. Unique, starts with "batch_" - */ - batch_id: string; -} - -declare class ScanForm implements IScanForm { - public constructor(input: IScanFormCreateParameters); - - address: IAddress; - batch_id: string; - created_at: string; - form_file_type: string; - form_url: string; - id: string; - message: string; - mode: 'test' | 'production'; - object: 'ScanForm'; - status: 'creating' | 'created' | 'failed'; - tracking_codes: string[]; - updated_at: string; - - /** - * A ScanForm can be created to speed up and simplify the carrier pickup process. - * The Scan Form is one document that can be scanned to mark all included tracking codes as "Accepted for Shipment" by the carrier. - * - * @see https://docs.easypost.com/docs/scan-form - * - * @returns {Promise} The created ScanForm - * - * @param {Object} params The parameters to create an {@link ScanForm} with. - * @returns {Promise} The created and verified {@link ScanForm}. - */ - static create(params: Object): Promise; - - /** - * The ScanForm List is a paginated list of all ScanForm objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The `has_more` attribute indicates whether additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/scan-form#retrieve-all-scanforms - * - * @param {object} params The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link ScanForm scanforms} and pagination information. - */ - static all( - params?: IScanFormListParameters, - ): Promise<{ scan_forms: ScanForm[]; has_more: boolean }>; - - /** - * A ScanForm can be retrieved by either its id or reference. - * However, it is recommended to use EasyPost's provided identifiers because uniqueness on reference is not enforced. - * - * @see https://docs.easypost.com/docs/scan-form#retrieve-a-scanform - * - * @param {string} scanFormId Unique, begins with "sf_". - */ - static retrieve(scanFormId: string): Promise; - - /** - * Retrieve the next page of {@link ScanForm scan forms}. - * - * This automatically reuses the parameters from the previous call or the original {@link ScanForm.all} call. - * - * @see https://docs.easypost.com/docs/scan-form#retrieve-all-scanforms - * - * @param {Object} scanforms - The previous page of scan forms (the response from the last {@link ScanForm.getNextPage} or {@link ScanForm.all} call). - * @param {number} [pageSize] - The number of scan forms to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link ScanForm scan forms} and pagination information. - */ - static getNextPage( - scanforms: Object, - pageSize?: number, - ): Promise<{ scan_forms: ScanForm[]; has_more: boolean }>; -} - -export type { ScanForm }; diff --git a/types/ScanForm/ScanFormCreateParameters.d.ts b/types/ScanForm/ScanFormCreateParameters.d.ts deleted file mode 100644 index e5cc97a1e..000000000 --- a/types/ScanForm/ScanFormCreateParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { DeepPartial } from '../utils'; -import { IShipmentCreateParameters } from '../Shipment'; - -export declare interface IScanFormCreateParameters { - shipments: Array>; -} diff --git a/types/ScanForm/ScanFormListParameters.d.ts b/types/ScanForm/ScanFormListParameters.d.ts deleted file mode 100644 index f2b5f77ad..000000000 --- a/types/ScanForm/ScanFormListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/scan-form#retrieve-all-scanforms - */ -export declare interface IScanFormListParameters extends IAllMethodParameters {} diff --git a/types/ScanForm/index.d.ts b/types/ScanForm/index.d.ts deleted file mode 100644 index 3851190d8..000000000 --- a/types/ScanForm/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './ScanForm'; diff --git a/types/Shipment/Form.d.ts b/types/Shipment/Form.d.ts deleted file mode 100644 index a6c7e14ca..000000000 --- a/types/Shipment/Form.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; - -/** - * @see https://docs.easypost.com/docs/shipments/forms#form-object - */ -export declare interface IForm extends IObjectWithId<'Form'>, IDatedObject { - /** - * The type of form that we returned, can be one of "cn22", "cod_return_label", "commercial_invoice", "high_value_report", "label_qr_code", "nafta_certificate_of_origin", "order_summary", "return_packing_slip", "rma_qr_code" - */ - form_type: - | 'cn22' - | 'cod_return_label' - | 'commercial_invoice' - | 'high_value_report' - | 'label_qr_code' - | 'nafta_certificate_of_origin' - | 'order_summary' - | 'return_packing_slip' - | 'rma_qr_code'; - - /** - * The address we return the form back at - */ - form_url: string; - - /** - * If we have submitted the form to the carrier on behalf of the customer - */ - submitted_electronically: boolean; -} diff --git a/types/Shipment/Message.d.ts b/types/Shipment/Message.d.ts deleted file mode 100644 index 042733380..000000000 --- a/types/Shipment/Message.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/** - * When rating a Shipment or Pickup, some carriers may fail to generate rates. - * These failures are returned as part of the Shipment or Pickup as part of their messages attribute, and follow a common object structure. - * - * It is important to note that the message value for any member of this list comes directly from the carrier, not from EasyPost. - * This means that if you see an authentication or other non-shipping error here, it is not an issue between you and EasyPost, it is an issue between you and the carrier, or an issue with the given data. - * - * @see https://docs.easypost.com/docs/shipments/messages#message-object - */ -export declare interface IMessage { - /** - * the name of the carrier generating the error, e.g. "UPS" - */ - carrier: string; - - /** - * the category of error that occurred. Most frequently "rate_error" - */ - type: string; - - /** - * the string from the carrier explaining the problem - */ - message: string; - - /** - * the account id of the carrier. Useful if you have multiple accounts with the same carrier - */ - carrier_account_id: string; -} diff --git a/types/Shipment/Options/LabelFormat.d.ts b/types/Shipment/Options/LabelFormat.d.ts deleted file mode 100644 index cc3a84031..000000000 --- a/types/Shipment/Options/LabelFormat.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare type LabelFormat = 'PNG' | 'PDF' | 'ZPL' | 'EPL2'; diff --git a/types/Shipment/Options/Options.d.ts b/types/Shipment/Options/Options.d.ts deleted file mode 100644 index 3d2668626..000000000 --- a/types/Shipment/Options/Options.d.ts +++ /dev/null @@ -1,365 +0,0 @@ -import { LabelFormat } from './LabelFormat'; -import { TPrintCustomCode } from './PrintCustomCode'; - -/** - * Shipments can have a variety of additional options which you can specify when creating a shipment. - * The Options object can be populated with the keys below. - * - * @see https://docs.easypost.com/docs/shipments/options#options-object - */ -export declare interface IOptions { - /** - * Setting this option to true, will add an additional handling charge. - * An Additional Handling charge may be applied to the following: - * - Any article that is encased in an outside shipping container made of metal or wood. - * - Any item, such as a barrel, drum, pail or tire, that is not fully encased in a corrugated cardboard shipping container. - * - Any package with the longest side exceeding 60 inches or its second longest side exceeding 30 inches. - * - Any package with an actual weight greater than 70 pounds. - */ - additional_handling?: boolean | null; - - /** - * Setting this option to "0", will allow the minimum amount of address information to pass the validation check. - * Only for USPS postage. - */ - address_validation_level?: string | null; - - /** - * Set this option to true if your shipment contains alcohol. - * - UPS - only supported for US Domestic shipments - * - FedEx - only supported for US Domestic shipments - * - Canada Post - Requires adult signature 19 years or older. If you want adult signature 18 years or older, instead use delivery_confirmation: ADULT_SIGNATURE - */ - alcohol?: boolean | null; - - /** - * Setting this option to true will indicate to the carrier to prefer delivery by drone, if the carrier supports drone delivery. - */ - by_drone?: boolean | null; - - /** - * Setting this to true will add a charge to reduce carbon emissions. - */ - carbon_neutral?: boolean | null; - - /** - * Adding an amount will have the carrier collect the specified amount from the recipient. - */ - cod_amount?: string | null; - - /** - * Method for payment. "CASH", "CHECK", "MONEY_ORDER" - */ - cod_method?: 'CASH' | 'CHECK' | 'MONEY_ORDER' | null; - - /** - * The ID of the Address to which the COD payment should be returned. - * Defaults to the origin address. - * Only available on FedEx shipments. - */ - cod_address_id?: string | null; - - /** - * A description of the content of the shipment. - */ - content_description?: string | null; - - /** - * Which currency this shipment will show for rates if carrier allows. - */ - currency?: string | null; - - /** - * If you want to request a signature, you can pass "ADULT_SIGNATURE" or "SIGNATURE". - * You may also request "NO_SIGNATURE" to leave the package at the door. - * - All - some options may be limited for international shipments - * - FedEx - "INDIRECT_SIGNATURE" is also an option - * - USPS - additional options - * - "ADULT_SIGNATURE_RESTRICTED" - * - "SIGNATURE_RESTRICTED" - * - Canada Post - "DO_NOT_SAFE_DROP" - Tells the carrier to not hide the package ("safe drop"). - * - GSO - "STANDARD_SIGNATURE". - * - DHL Express - option mapping - * - "SIGNATURE" - DHL Express Direct Signature - * - "NO_SIGNATURE" - DHL Express Signature Release - */ - delivery_confirmation?: - | 'ADULT_SIGNATURE' - | 'SIGNATURE' - | 'NO_SIGNATURE' - | 'INDIRECT_SIGNATURE' - | 'ADULT_SIGNATURE_RESTRICTED' - | 'SIGNATURE_RESTRICTED' - | null; - - /** - * Method the customer will use to transfer the package to the carrier. - * "REGULAR_PICKUP", "SCHEDULED_PICKUP", "RETAIL_LOCATION", "STATION" or "DROP_BOX". - * Supported carriers and their corresponding carrier dropoff codes: - * - FedEx - * - "REGULAR_PICKUP" - "REGULAR_PICKUP" (default) - * - "SCHEDULED_PICKUP" - "REQUEST_COURIER" - * - "RETAIL_LOCATION" - "BUSINESS_SERVICE_CENTER" - * - "STATION" - "STATION" - * - "DROP_BOX" - "DROP_BOX" - */ - dropoff_type?: - | 'REGULAR_PICKUP' - | 'SCHEDULED_PICKUP' - | 'RETAIL_LOCATION' - | 'STATION' - | 'DROP_BOX' - | 'REQUEST_COURIER' - | 'BUSINESS_SERVICE_CENTER' - | null; - - /** - * Package contents contain dry ice. - * - UPS - Need dry_ice_weight to be set - * - UPS MailInnovations - Need dry_ice_weight to be set - * - FedEx - Need dry_ice_weight to be set - */ - dry_ice?: boolean | null; - - /** - * If the dry ice is for medical use, set this option to true. - * - UPS - Need dry_ice_weight to be set - * - UPS MailInnovations - Need dry_ice_weight to be set - */ - dry_ice_medical?: boolean | null; - - /** - * Weight of the dry ice in ounces. - * - UPS - Need dry_ice to be set - * - UPS MailInnovations - Need dry_ice to be set - * - FedEx - Need dry_ice to be set - */ - dry_ice_weight?: string | null; - - /** - * Setting duty_payment type to bill the correct account for purchasing postage. - * This option is only available with FedEx and UPS. - * - type - (string) Supported values are "THIRD_PARTY", and "RECEIVER". - * - account - (string) Setting account number. - * - country - (string) Setting country code that the account is based in. - * - postal_code - (string) Setting postal code that the account is based in. - */ - duty_payment: object | null; - - /** - * Possible values "ADDRESS_SERVICE_REQUESTED", "FORWARDING_SERVICE_REQUESTED", "CHANGE_SERVICE_REQUESTED", "RETURN_SERVICE_REQUESTED", "LEAVE_IF_NO_RESPONSE" - */ - endorsement?: - | 'ADDRESS_SERVICE_REQUESTED' - | 'FORWARDING_SERVICE_REQUESTED' - | 'CHANGE_SERVICE_REQUESTED' - | 'RETURN_SERVICE_REQUESTED' - | 'LEAVE_IF_NO_RESPONSE' - | null; - - /** - * Specify the responsible EndShipper for the shipment by passing in an EndShipper ID. - */ - end_shipper_id: string | null; - - /** - * Additional cost to be added to the invoice of this shipment. - * Only applies to UPS currently. - */ - freight_charge?: number | null; - - /** - * This is to designate special instructions for the carrier like "Do not drop!". - */ - handling_instructions?: string | null; - - /** - * Dangerous goods indicator. - * Possible values are "PRIMARY_CONTAINED", "PRIMARY_PACKED", "PRIMARY", "SECONDARY_CONTAINED", "SECONDARY_PACKED", "SECONDARY", "ORMD", "LIMITED_QUANTITY", "LITHIUM". - * Applies to USPS, FedEx and DHL eCommerce. - */ - hazmat?: - | 'PRIMARY_CONTAINED' - | 'PRIMARY_PACKED' - | 'PRIMARY' - | 'SECONDARY_CONTAINED' - | 'SECONDARY_PACKED' - | 'SECONDARY' - | 'ORMD' - | 'LIMITED_QUANTITY' - | 'LITHIUM' - | null; - - /** - * Package will wait at carrier facility for pickup. - */ - hold_for_pickup?: boolean | null; - - /** - * Incoterm negotiated for shipment. - * Supported values are "EXW", "FCA", "CPT", "CIP", "DAT", "DAP", "DDP", "FAS", "FOB", "CFR", and "CIF". - * Setting this value to anything other than "DDP" will pass the cost and responsibility of duties on to the recipient of the package(s), as specified by Incoterms rules - */ - incoterm?: - 'EXW' | 'FCA' | 'CPT' | 'CIP' | 'DAT' | 'DAP' | 'DDP' | 'FAS' | 'FOB' | 'CFR' | 'CIF' | null; - - /** - * This will print an invoice number on the postage label. - */ - invoice_number?: string | null; - - /** - * Set the date that will appear on the postage label. - * Accepts ISO 8601 formatted string including time zone offset. - * EasyPost stores all dates as UTC time. - */ - label_date?: string | null; - - /** - * Supported label formats include "PNG", "PDF", "ZPL", and "EPL2". - * "PNG" is the only format that allows for conversion. - * - * @see https://docs.easypost.com/docs/shipments#converting-the-label-format-of-a-shipment - */ - label_format?: LabelFormat | null; - - /** - * Whether or not the parcel can be processed by the carriers equipment. - */ - machinable?: boolean | null; - - /** - * Setting payment type to bill the correct account for purchasing postage. - */ - payment: { - /** - * Supported values are "SENDER", "THIRD_PARTY", "RECEIVER", "COLLECT". Defaults to SENDER. - */ - type?: 'SENDER' | 'THIRD_PARTY' | 'RECEIVER' | 'COLLECT' | null; - - /** - * Setting account number. - * Required for RECEIVER and THIRD_PARTY. - */ - account?: string | null; - - /** - * Setting country code that the account is based in. - * Required for THIRD_PARTY. - */ - country?: string | null; - - /** - * Setting postal code that the account is based in. - * Required for RECEIVER and THIRD_PARTY. - */ - postal_code?: string | null; - }; - - /** - * The earliest a package should be picked up. Supported carriers vary. - */ - pickup_min_datetime: string | null; - - /** - * The latest a package should be picked up. Supported carriers vary. - */ - pickup_max_datetime: string | null; - - /** - * You can optionally print custom messages on labels. - * The locations of these fields show up on different spots on the carrier's labels. - */ - print_custom_1?: string | null; - - /** - * An additional message on the label. Same restrictions as print_custom_1 - */ - print_custom_2?: string | null; - - /** - * An additional message on the label. Same restrictions as print_custom_1 - */ - print_custom_3?: string | null; - - /** - * Create a barcode for this custom reference if supported by carrier. - */ - print_custom_1_barcode?: boolean | null; - - /** - * Create a barcode for this custom reference if supported by carrier. - */ - print_custom_2_barcode?: boolean | null; - - /** - * Create a barcode for this custom reference if supported by carrier. - */ - print_custom_3_barcode?: boolean | null; - - /** - * Specify the type of print_custom_1. - */ - print_custom_1_code?: TPrintCustomCode | null; - - /** - * Specify the type of print_custom_2. - */ - print_custom_2_code?: TPrintCustomCode | null; - - /** - * Specify the type of print_custom_3. - */ - print_custom_3_code?: TPrintCustomCode | null; - - /** - * Set this value to true for delivery on Saturday. - * When setting the saturday_delivery option, you will only get rates for services that are eligible for saturday delivery. - * If no services are available for saturday delivery, then you will not be returned any rates. - * You may need to create 2 shipments, one with the saturday_delivery option set on one without to get all your eligible rates. - */ - saturday_delivery?: boolean | null; - - /** - * This option allows you to request restrictive rates from USPS. - * Can set to 'USPS.MEDIAMAIL' or 'USPS.LIBRARYMAIL'. - */ - special_rates_eligibility?: 'USPS.MEDIAMAIL' | 'USPS.LIBRARYMAIL' | null; - - /** - * You can use this to override the hub ID you have on your account. - */ - smartpost_hub?: string | null; - - /** - * The manifest ID is used to group SmartPost packages onto a manifest for each trailer. - */ - smartpost_manifest?: string | null; - - /** - * A reference ID for aggregating DHL eCommerce billing data. - */ - billing_ref?: string | null; - - /** - * Certified Mail provides the sender with a mailing receipt and, upon request, electronic verification that an article was delivered or that a delivery attempt was made. - */ - certified_mail?: boolean | null; - - /** - * Registered Mail is the most secure service that the USPS offers. - * It incorporates a system of receipts to monitor the movement of the mail from the point of acceptance to delivery - */ - registered_mail?: boolean | null; - - /** - * The value of the package contents - */ - registered_mail_amount?: number | null; - - /** - * An electronic return receipt may be purchased at the time of mailing and provides a shipper with evidence of delivery (to whom the mail was delivered and date of delivery), and information about the recipient's actual delivery address. - * Only applies to the USPS. - */ - return_receipt?: boolean | null; -} diff --git a/types/Shipment/Options/PrintCustomCode.d.ts b/types/Shipment/Options/PrintCustomCode.d.ts deleted file mode 100644 index 4933056eb..000000000 --- a/types/Shipment/Options/PrintCustomCode.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * - FedEx - * - (null) - If print_custom_1_code is not provided it defaults to Customer Reference - * - PO - Purchase Order Number - * - DP - Department Number - * - RMA - Return Merchandise Authorization - * - UPS - * - AJ - Accounts Receivable Customer Account - * - AT - Appropriation Number - * - BM - Bill of Lading Number - * - 9V - Collect on Delivery (COD) Number - * - ON - Dealer Order Number - * - DP - Department Number - * - 3Q - Food and Drug Administration (FDA) Product Code - * - IK - Invoice Number - * - MK - Manifest Key Number - * - MJ - Model Number - * - PM - Part Number - * - PC - Production Code - * - PO - Purchase Order Number - * - RQ - Purchase Request Number - * - RZ - Return Authorization Number - * - SA - Salesperson Number - * - SE - Serial Number - * - ST - Store Number - * - TN - Transaction Reference Number - * - EI - Employer's ID Number - * - TJ - Federal Taxpayer ID No. - */ -export declare type TPrintCustomCode = - | 'PO' - | 'DP' - | 'RMA' - | 'AJ' - | 'AT' - | 'BM' - | '9V' - | 'ON' - | '3Q' - | 'IK' - | 'MK' - | 'MJ' - | 'PM' - | 'PC' - | 'RQ' - | 'RZ' - | 'SA' - | 'SE' - | 'ST' - | 'TN' - | 'EI' - | 'TJ'; diff --git a/types/Shipment/Options/index.d.ts b/types/Shipment/Options/index.d.ts deleted file mode 100644 index 349426b0d..000000000 --- a/types/Shipment/Options/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './LabelFormat'; -export * from './Options'; -export * from './PrintCustomCode'; diff --git a/types/Shipment/PostageLabel.d.ts b/types/Shipment/PostageLabel.d.ts deleted file mode 100644 index 9f8717b97..000000000 --- a/types/Shipment/PostageLabel.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; - -/** - * PostageLabel Object - */ -export declare interface IPostageLabel extends IObjectWithId<'PostageLabel'>, IDatedObject { - date_advance: number; - integrated_form: string; - label_date: string; - label_resolution: number; - label_size: string; - label_type: string; - label_url: string; - label_file_type: string; - label_pdf_url: string; - label_epl2_url: string; - label_zpl_url: string; -} diff --git a/types/Shipment/Shipment.d.ts b/types/Shipment/Shipment.d.ts deleted file mode 100644 index 0485fa593..000000000 --- a/types/Shipment/Shipment.d.ts +++ /dev/null @@ -1,368 +0,0 @@ -import { IAddress } from '../Address'; -import { IDatedObject, IObjectWithId } from '../base'; -import { TBatchStatus } from '../Batch'; -import { ICustomsInfo } from '../Customs'; -import { IFee } from '../Fee'; -import { IInsurance } from '../Insurance'; -import { IParcel } from '../Parcel'; -import { IRate } from '../Rate'; -import { IScanForm } from '../ScanForm'; -import { ITracker } from '../Tracker'; -import { IForm } from './Form'; -import { IMessage } from './Message'; -import { IOptions, LabelFormat } from './Options'; -import { IPostageLabel } from './PostageLabel'; -import { IShipmentCreateParameters } from './ShipmentCreateParameters'; -import { IShipmentListParameters } from './ShipmentListParameters'; -import { ITaxIdentifier } from './TaxIdentifier'; - -/** - * The workhorse of the EasyPost API, a Shipment is made up of a "to" and "from" Address, the Parcel being shipped, and any customs forms required for international deliveries. - * Once created a Shipment object is used to retrieve shipping Rates and purchase a label. - * - * A Shipment created with a valid to_address, from_address, and parcel will automatically populate its rates attribute. - * - * @see https://docs.easypost.com/docs/shipments#shipment-object - */ -export declare interface IShipment extends IObjectWithId<'Shipment'>, IDatedObject { - /** - * An optional field that may be used in place of id in other API endpoints - */ - reference?: string | null; - - /** - * The destination address - */ - to_address: IAddress; - - /** - * The origin address - */ - from_address: IAddress; - - /** - * The shipper's address, defaults to from_address - */ - return_address?: IAddress | null; - - /** - * The buyer's address, defaults to to_address - */ - buyer_address?: IAddress | null; - - /** - * The dimensions and weight of the package - */ - parcel: IParcel; - - /** - * Information for the processing of customs - */ - customs_info?: ICustomsInfo | null; - - /** - * Tax identifiers for the shipment - */ - tax_identifiers?: ITaxIdentifier[]; - - /** - * Document created to manifest and scan multiple shipments - */ - scan_form: IScanForm; - - /** - * All associated Form objects - */ - forms: IForm[]; - - /** - * The associated Insurance object - */ - insurance: IInsurance; - - /** - * All associated Rate objects - */ - rates: IRate[]; - - /** - * The specific rate purchased for the shipment, or null if unpurchased or purchased through another mechanism - */ - selected_rate: IRate; - - /** - * The associated PostageLabel object - */ - postage_label: IPostageLabel; - - /** - * Any carrier errors encountered during rating, discussed in more depth below - */ - messages: IMessage[]; - - /** - * All the options passed to the shipment, discussed in more depth below - */ - options?: IOptions | null; - - /** - * Set true to create as a return, discussed in more depth below - */ - is_return?: boolean | null; - - /** - * If purchased, the tracking code will appear here as well as within the Tracker object - */ - tracking_code: string; - - /** - * The USPS zone of the shipment, if purchased with USPS - */ - usps_zone: string; - - /** - * The current tracking status of the shipment - */ - status: string; - - /** - * The associated Tracker object - */ - tracker: ITracker; - - /** - * The associated Fee objects charged to the billing user account - */ - fees: IFee[]; - - /** - * The current status of the shipment refund process. Possible values are "submitted", "refunded", "rejected". - */ - refund_status: 'submitted' | 'refunded' | 'rejected'; - - /** - * The ID of the batch that contains this shipment, if any - */ - batch_id: string; - - /** - * The current status of the associated BatchShipment - */ - batch_status: TBatchStatus; - - /** - * The current message of the associated BatchShipment - */ - batch_message: string; -} - -declare class Shipment implements IShipment { - public constructor(input: IShipmentCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Shipment'; - reference?: string | null; - to_address: IAddress; - from_address: IAddress; - return_address?: IAddress | null; - buyer_address?: IAddress | null; - parcel: IParcel; - customs_info?: ICustomsInfo | null; - scan_form: IScanForm; - forms: IForm[]; - insurance: IInsurance; - rates: IRate[]; - selected_rate: IRate; - postage_label: IPostageLabel; - messages: IMessage[]; - options?: IOptions | null; - is_return?: boolean | null; - tracking_code: string; - usps_zone: string; - status: string; - tracker: ITracker; - fees: IFee[]; - refund_status: 'submitted' | 'refunded' | 'rejected'; - batch_id: string; - batch_status: TBatchStatus; - batch_message: string; - created_at: string; - updated_at: string; - - /** - * A Shipment is almost exclusively a container for other objects, and thus a Shipment may reuse many of these objects. - * Additionally, all the objects contained within a Shipment may be created at the same time. - * - * The origin/destination Address and Parcel are required for rating. - * CustomsInfo is required to rate an international Shipment, this includes when the destination is a US Territory. - * The associated Tracker, Fees, and Rates are generated by EasyPost and cannot be modified by the user. - * - * You can limit the CarrierAccounts to use for rating by passing the carrier_accounts parameter. - * - * @see https://docs.easypost.com/docs/shipments#create-a-shipment - * - * @param {Object} params The parameters to create an {@link Shipment} with. - * @returns {Promise} The created {@link Shipment}. - */ - static create(params: Object): Promise; - - /** - * The Shipment List is a paginated list of all Shipment objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The `has_more` attribute indicates whether additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/shipments#retrieve-all-shipments - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Shipment shipments} and pagination information. - */ - static all( - params?: IShipmentListParameters, - ): Promise<{ shipments: Shipment[]; has_more: boolean }>; - - /** - * A Shipment can be retrieved by either its id or reference. - * However, it is recommended to use EasyPost's provided identifiers because uniqueness on reference is not enforced. - * - * @see https://docs.easypost.com/docs/shipments#retrieve-a-shipment - * - * @param {string} id Unique, begins with "shp_". - * @returns {Promise} The created {@link Shipment}. - */ - static retrieve(id: string): Promise; - - /** - * To purchase a Shipment you only need to specify the Rate to purchase. - * This operation populates the `tracking_code` and `postage_label` attributes. - * The default image format of the associated PostageLabel is PNG. - * To change this default see the label_format option. - * - * Additionally, insurance may be added during the purchase. - * To specify an amount to insure, pass the insurance attribute as a string. - * The currency of all insurance is USD. - * - * @see https://docs.easypost.com/docs/shipments#buy-a-shipment - * - * @param id shipment id (begins with "shp_"). - * @param rate rate id (begins with "rate_") or rate object. - * @param insuranceAmount amount to insure the shipment for. - * @param endShipperId The ID of the end shipper to purchase the shipment with. - * @returns {Promise} The created {@link Shipment}. - */ - static buy( - id: string, - rate: string | IRate, - insuranceAmount?: number, - endShipperId?: string, - ): Promise; - - /** - * Refunding a Shipment is available for many carriers supported by EasyPost. - * Once the refund has been submitted, refund_status attribute of the Shipment will be populated with one of the possible values: "submitted", "refunded", "rejected". - * The most common initial status is "submitted". - * Many carriers require that the refund be processed before the `refund_status` will move to "refunded". - * The length of this process depends on the carrier, but no greater than 30 days. - * - * Refunds created very shortly after a label is generated may be improperly flagged as invalid, but you may retry a refund with the "rejected" status by submitting the same request again. - * Carriers that are bill-on-scan tend to have refunds attempts return as "not_applicable", which will not change with multiple retries. - * - * @see https://docs.easypost.com/docs/shipments/shipping-refund#refund-a-shipment - * - * @param id shipment id (begins with "shp_"). - * @returns {Promise} The created {@link Shipment}. - */ - static refund(id: string): Promise; - - /** - * - * @param carriers a list of carriers to filter rates for. - * @param services a list of services to filter rates for. - * @returns {Rate} The lowest {@link Rate}. - */ - lowestRate(carriers?: string[], services?: string[]): IRate; - - /** - * A Shipment's PostageLabel can be converted from PNG to other formats. - * If the PostageLabel was originally generated in a format other than PNG it cannot be converted. - * - * @see https://docs.easypost.com/docs/shipments#converting-the-label-format-of-a-shipment - * - * @param id shipment id (begins with "shp_"). - * @param format Format of the label ("PNG", "PDF", "ZPL", and "EPL2"). - * @returns {Promise} The created {@link Shipment}. - */ - static convertLabelFormat(id: string, format: LabelFormat): Promise; - - /** - * You can update the Rates of a Shipment at any time. - * This operation respects the `carrier_accounts` attribute. - * - * @see https://docs.easypost.com/docs/shipments/rates#regenerate-rates-for-a-shipment - * - * @param id shipment id (begins with "shp_"). - * @returns {Promise} The created {@link Shipment}. - */ - static regenerateRates(id: string): Promise; - - /** - * Insuring your Shipment is as simple as sending us the value of the contents. - * We charge 1% of the value, with a $1 minimum, and handle all the claims. - * All our claims are paid out within 10 days. - * - * To buy insurance, first purchase the Shipment, then make the insurance call before the package begins being handled by the carrier. - * - * @see https://docs.easypost.com/docs/shipments/shipping-insurance#insure-a-shipment - * - * @param id shipment id (begins with "shp_"). - * @param amount amount to insure the shipment for. - * @returns {Promise} The created {@link Shipment}. - */ - static insure(id: string, amount: number): Promise; - - /** - * Generate a specific type of form for the Shipment, using the provided form options. - * - * @param id shipment id (begins with "shp_"). - * @param formType The type of form to generate. - * @param formOptions Additional options to use when generating the form. - * @returns {Promise} The created {@link Shipment}. - */ - static generateForm(id: string, formType: string, formOptions?: object): Promise; - - /** - * Retrieve the estimated delivery date of each Rate via SmartRate. - * - * @param id shipment id (begins with "shp_"). - * @param plannedShipDate The planned ship date in format YYYY-MM-DD - * @returns {Promise>} The array of estimated delivery dates and rates. - */ - static retrieveEstimatedDeliveryDate(id: string, plannedShipDate: string): Promise>; - - /** - * Retrieve a recommended ship date for a {@link Shipment shipment} via the Precision Shipping API, based on a specific desired delivery date. - * @param id - The ID of the shipment to retrieve the recommended ship date for. - * @param desiredDeliveryDate - The desired delivery date for the shipment. - * @returns {Array} - An array of the recommended ship date and rates. - */ - static recommendShipDate(id: string, desiredDeliveryDate: string): Promise>; - - /** - * Retrieve the next page of {@link Shipment shipments}. - * - * This automatically reuses the parameters from the previous call or the original {@link Shipment.all} call. - * - * @see https://docs.easypost.com/docs/shipments#retrieve-all-shipments - * - * @param {Object} shipments - The previous page of shipments (the response from the last {@link Shipment.getNextPage} or {@link Shipment.all} call). - * @param {number} [pageSize] - The number of shipments to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Shipment shipments} and pagination information. - */ - static getNextPage( - shipments: Object, - pageSize?: number, - ): Promise<{ shipments: Shipment[]; has_more: boolean }>; -} - -export type { Shipment }; diff --git a/types/Shipment/ShipmentCreateParameters.d.ts b/types/Shipment/ShipmentCreateParameters.d.ts deleted file mode 100644 index 3aae0378e..000000000 --- a/types/Shipment/ShipmentCreateParameters.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IAddressCreateParameters } from '../Address'; -import { ICustomsInfo } from '../Customs/CustomsInfo/CustomsInfo'; -import { IParcelCreateParameters } from '../Parcel/ParcelCreateParameters'; -import { DeepPartial } from '../utils'; -import { IOptions } from './Options'; -import { ITaxIdentifier } from './TaxIdentifier'; - -export declare interface IShipmentCreateParameters { - reference?: string | null; - to_address: DeepPartial | string; - from_address: DeepPartial | string; - parcel: Partial | string; - - /** - * optional array of ids that begin with "ca_" - */ - carrier_accounts?: string[] | null; - - customs_info?: DeepPartial | null; - tax_identifiers?: ITaxIdentifier[] | null; - options?: DeepPartial | null; - line_items?: Array<{ - total_line_value: string; - item_description: string; - }>; -} diff --git a/types/Shipment/ShipmentListParameters.d.ts b/types/Shipment/ShipmentListParameters.d.ts deleted file mode 100644 index 8117a2c1a..000000000 --- a/types/Shipment/ShipmentListParameters.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/shipments#retrieve-all-shipments - */ -export declare interface IShipmentListParameters extends IAllMethodParameters { - /** - * Only include Shipments that have been purchased. - * Default is true - */ - purchased?: boolean | null; - - /** - * Also include Shipments created by Child Users. - * Defaults to false - */ - include_children?: boolean | null; -} diff --git a/types/Shipment/TaxIdentifier.d.ts b/types/Shipment/TaxIdentifier.d.ts deleted file mode 100644 index 277170f15..000000000 --- a/types/Shipment/TaxIdentifier.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Interface representing a TaxIdentifier object, an embedded object within a Shipment. - * - * @see https://docs.easypost.com/docs/shipments/tax-identifiers - */ -export declare interface ITaxIdentifier { - /** The entity type (e.g., "SENDER", "RECEIVER"). */ - entity: string; - - /** The tax identification number. */ - tax_id: string; - - /** The type of tax identifier (e.g., "IOSS", "VAT", "EIN", etc.). */ - tax_id_type: string; - - /** The two-letter ISO country code of the country that issued the tax ID. */ - issuing_country: string; -} diff --git a/types/Shipment/index.d.ts b/types/Shipment/index.d.ts deleted file mode 100644 index 1dd95a59d..000000000 --- a/types/Shipment/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -export * from './Form'; -export * from './Message'; -export * from './Options'; -export * from './PostageLabel'; -export { IRate, Rate } from '../Rate'; -export * from './Shipment'; -export * from './ShipmentCreateParameters'; -export * from './ShipmentListParameters'; -export * from './TaxIdentifier'; diff --git a/types/SmartRate/SmartRate.d.ts b/types/SmartRate/SmartRate.d.ts deleted file mode 100644 index 12e1fb5d8..000000000 --- a/types/SmartRate/SmartRate.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** - * The SmartRate class interacts with the SmartRate API to provide optimized shipping rates and estimates. - * - * @see https://docs.easypost.com/docs/smartrate - */ -declare class SmartRate { - /** - * Retrieve the estimated delivery date of each carrier-service level combination via the Smart Deliver By API, based on a specific ship date and origin-destination postal code pair. - * @param params - The parameters to estimate the delivery date with. - * @returns {Object} - Estimates and related metadata. - */ - static estimateDeliveryDate(params: object): object; - - /** - * Retrieve a recommended ship date for each carrier-service level combination via the Smart Deliver On API, based on a specific delivery date and origin-destination postal code pair. - * @param params - The parameters to recommend the ship date with. - * @returns {Object} - Recommendation and related metadata. - */ - static recommendShipDate(params: object): object; -} - -export type { SmartRate }; diff --git a/types/SmartRate/index.d.ts b/types/SmartRate/index.d.ts deleted file mode 100644 index e8db4933d..000000000 --- a/types/SmartRate/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './SmartRate'; diff --git a/types/Tracker/CarrierDetail.d.ts b/types/Tracker/CarrierDetail.d.ts deleted file mode 100644 index 9d3136878..000000000 --- a/types/Tracker/CarrierDetail.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { IBaseObject } from '../base'; -import { ITrackingLocation } from './TrackingLocation'; - -/** - * @see https://docs.easypost.com/docs/trackers#carrierdetail-object - */ -export declare interface ICarrierDetail extends IBaseObject<'CarrierDetail'> { - /** - * The service level the associated shipment was shipped with (if available) - */ - service: string; - - /** - * The type of container the associated shipment was shipped in (if available) - */ - container_type: string; - - /** - * The estimated delivery date as provided by the carrier, in the local time zone (if available) - */ - est_delivery_date_local: string; - - /** - * The estimated delivery time as provided by the carrier, in the local time zone (if available) - */ - est_delivery_time_local: string; - - /** - * The location from which the package originated, stringified for presentation (if available) - */ - origin_location: string; - - /** - * The location from which the package originated, broken down by city/state/country/zip (if available) - */ - origin_tracking_location: ITrackingLocation; - - /** - * The location to which the package is being sent, stringified for presentation (if available) - */ - destination_location: string; - - /** - * The location to which the package is being sent, broken down by city/state/country/zip (if available) - */ - destination_tracking_location: ITrackingLocation; - - /** - * The date and time the carrier guarantees the package to be delivered by (if available) - */ - guaranteed_delivery_date: string; - - /** - * The alternate identifier for this package as provided by the carrier (if available) - */ - alternate_identifier: string; - - /** - * The date and time of the first attempt by the carrier to deliver the package (if available) - */ - initial_delivery_attempt: string; -} diff --git a/types/Tracker/Tracker.d.ts b/types/Tracker/Tracker.d.ts deleted file mode 100644 index 18e650b8a..000000000 --- a/types/Tracker/Tracker.d.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { IDatedObject, IObjectWithId } from '../base'; -import { IFee } from '../Fee'; -import { ICarrierDetail } from './CarrierDetail'; -import { ITrackerCreateParameters } from './TrackerCreateParameters'; -import { ITrackerListParameters } from './TrackerListParameters'; -import { ITrackerStatus } from './TrackerStatus'; -import { ITrackerStatusDetail } from './TrackerStatusDetail'; -import { ITrackingDetail } from './TrackingDetail'; - -/** - * A Tracker object contains all the tracking information for a package. - * A Tracker is created automatically whenever you buy a Shipment through EasyPost. - * If you don't use EasyPost to purchase your shipping labels, you can still track packages through our API by creating a Tracker object directly. - * Each Tracker is continually updated in the background as the package moves through its life cycle, regardless of whether or not the label was purchased through EasyPost. - * - * After creation, a Tracker object will be updated periodically based on when the carrier provides EasyPost with new tracking information. - * This information can be consumed by using our webhooks infrastructure. - * Every time a Tracker is updated a webhook Event will be sent. - * - * The Tracker object contains both the current information about the package and previous updates. - * All the previous updates are stored in the tracking_details array. - * Each TrackingDetail object contains the status, the message from the carrier, and a TrackingLocation. - * - * The TrackingLocation contains city, state, country, and zip information about the location where the package was scanned. - * The information each carrier provides is different, so some carriers may not make use of all these fields. - * - * Some Tracker objects may also contain a CarrierDetail, which stores some additional information about the Tracker that the carrier has made available to EasyPost. - * The CarrierDetail object contains the service and container_type of the package. - * Additionally, it also stores the `est_delivery_date_local` and `est_delivery_time_local`, which provide information about the local delivery time. - * - * It's worth noting that tracking_codes are not globally unique. - * Each carrier promises uniqueness for a given `tracking_code` for a certain period of time, but the length of time varies greatly based on the specific carrier and service level. - * The carriers do eventually recycle `tracking_codes`, and for this reason enforcing uniqueness on the `tracking_code` field is not recommended. - * EasyPost does, however, prevent the creation of duplicate Trackers based on tracking_code and carrier; duplicate requests by the same User will simply return the original Tracker. - * - * @see https://docs.easypost.com/docs/trackers#tracker-object - */ -export declare interface ITracker extends IObjectWithId<'Tracker'>, IDatedObject { - /** - * The tracking code provided by the carrier - */ - tracking_code: string; - - /** - * The current status of the package, possible values are "unknown", "pre_transit", "in_transit", "out_for_delivery", "delivered", "available_for_pickup", "return_to_sender", "failure", "cancelled" or "error" - */ - status: ITrackerStatus; - - /** - * Additional details about the current status, possible values are "unknown", "status_update", "departed_facility", "arrived_at_facility", "out_for_delivery", "arrived_at_destination" - */ - status_detail: ITrackerStatusDetail; - - /** - * The name of the person who signed for the package (if available) - */ - signed_by: string; - - /** - * The weight of the package as measured by the carrier in ounces (if available) - * float (oz) - */ - weight: number; - - /** - * The estimated delivery date provided by the carrier (if available) - */ - est_delivery_date: string; // TODO maybe type should be Date? - - /** - * The id of the EasyPost Shipment object associated with the Tracker (if any) - */ - shipment_id: string; - - /** - * The name of the carrier handling the shipment - */ - carrier: string; - - /** - * Array of the associated TrackingDetail objects - */ - tracking_details: ITrackingDetail[]; - - /** - * The associated CarrierDetail object (if available) - */ - carrier_detail: ICarrierDetail; - - /** - * URL to a publicly-accessible html page that shows tracking details for this tracker - */ - public_url: string; - - /** - * Array of the associated Fee objects - */ - fees: IFee[]; - - finalized: boolean; - - is_return: boolean; -} - -declare class Tracker implements ITracker { - public constructor(input: ITrackerCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'Tracker'; - tracking_code: string; - status: ITrackerStatus; - status_detail: ITrackerStatusDetail; - signed_by: string; - weight: number; - est_delivery_date: string; - shipment_id: string; - carrier: string; - tracking_details: ITrackingDetail[]; - carrier_detail: ICarrierDetail; - public_url: string; - fees: IFee[]; - finalized: boolean; - is_return: boolean; - created_at: string; - updated_at: string; - - /** - * A Tracker can be created with only a tracking_code. - * Optionally, you can provide the carrier parameter, which indicates the carrier the package was shipped with. - * If no carrier is provided, EasyPost will attempt to determine the carrier based on the tracking_code provided. - * Providing a carrier parameter is recommended, since some tracking_codes are ambiguous and may match with more than one carrier. - * In addition, not having to auto-match the carrier will significantly speed up the response time. - * - * In an effort to reduce wasted resources, EasyPost prevents the creation of duplicate Trackers. - * A Tracker is considered to be a duplicate if another Tracker with the same tracking_code and carrier was created by the same User in the last three months. - * In the case where a duplicate request is submitted, the original Tracker will be returned. - * - * @see https://docs.easypost.com/docs/trackers#create-a-tracker - * - * @param {Object} params The parameters to create an {@link Tracker} with. - * @returns {Promise} The {@link Tracker}. - */ - static create(params: Object): Promise; - - /** - * The Tracker List is a paginated list of all Tracker objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The `has_more` attribute indicates whether or not additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * Using the Tracker List endpoint is the recommended way of retrieving a Tracker by `tracking_code` or `carrier`. - * Unlike the retrieving a Tracker using the Retrieve endpoint, which accepts an id, the List endpoint accepts the tracking_code as the search parameter. - * Normally, you'll only have one Tracker with a given `tracking_code`, but it is also possible to further filter those results by including the carrier parameter in your request. - * - * @see https://docs.easypost.com/docs/trackers#retrieve-all-trackers - * - * @param params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Tracker trackers} and pagination information. - */ - static all(params?: ITrackerListParameters): Promise<{ trackers: Tracker[]; has_more: boolean }>; - - /** - * Retrieve a Tracker by id. - * - * @param trackerId Unique, starts with "trk_" - * - * @see https://docs.easypost.com/docs/trackers#retrieve-a-tracker - * - * @param trackerId The id of tracker, starts with "trk_" - * @returns {Promise} The retrieved {@link Tracker}. - */ - static retrieve(trackerId: string): Promise; - - /** - * Retrieve the next page of {@link Tracker trackers}. - * - * This automatically reuses the parameters from the previous call or the original {@link Tracker.all} call. - * - * @see https://docs.easypost.com/docs/trackers#retrieve-all-trackers - * - * @param {Object} trackers - The previous page of trackers (the response from the last {@link Tracker.getNextPage} or {@link Tracker.all} call). - * @param {number} [pageSize] - The number of trackers to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link Tracker trackers} and pagination information. - */ - static getNextPage( - trackers: Object, - pageSize?: number, - ): Promise<{ trackers: Tracker[]; has_more: boolean }>; - - /** - * Delete a Tracker. - * - * @see https://docs.easypost.com/docs/trackers#delete-a-tracker - * - * @param {string} id - The id of the tracker to delete, starts with "trk_" - * @returns {Promise} - */ - static delete(id: string): Promise; -} - -export type { Tracker }; diff --git a/types/Tracker/TrackerCreateParameters.d.ts b/types/Tracker/TrackerCreateParameters.d.ts deleted file mode 100644 index 7a46b5275..000000000 --- a/types/Tracker/TrackerCreateParameters.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export declare interface ITrackerCreateParameters { - /** - * The tracking code associated with the package you'd like to track - */ - tracking_code: string; - - /** - * The carrier associated with the tracking_code you provided. - * The carrier will get auto-detected if none is provided - */ - carrier?: string; -} diff --git a/types/Tracker/TrackerListParameters.d.ts b/types/Tracker/TrackerListParameters.d.ts deleted file mode 100644 index cdf301653..000000000 --- a/types/Tracker/TrackerListParameters.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -export declare interface ITrackerListParameters extends IAllMethodParameters { - /** - * Only returns Trackers with the given tracking_code. - * Useful for retrieving an individual Tracker by tracking_code rather than by ID - */ - tracking_code?: string | null; - - /** - * Only returns Trackers with the given carrier value - */ - carrier?: string | null; -} diff --git a/types/Tracker/TrackerStatus.d.ts b/types/Tracker/TrackerStatus.d.ts deleted file mode 100644 index 2b2291981..000000000 --- a/types/Tracker/TrackerStatus.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -export declare type ITrackerStatus = - | 'unknown' - | 'pre_transit' - | 'in_transit' - | 'out_for_delivery' - | 'delivered' - | 'available_for_pickup' - | 'return_to_sender' - | 'failure' - | 'cancelled' - | 'error'; diff --git a/types/Tracker/TrackerStatusDetail.d.ts b/types/Tracker/TrackerStatusDetail.d.ts deleted file mode 100644 index 7f7d5e3a8..000000000 --- a/types/Tracker/TrackerStatusDetail.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export declare type ITrackerStatusDetail = - | 'address_correction' - | 'arrived_at_destination' - | 'arrived_at_facility' - | 'arrived_at_pickup_location' - | 'awaiting_information' - | 'cancelled' - | 'damaged' - | 'delayed' - | 'delivery_exception' - | 'departed_facility' - | 'departed_origin_facility' - | 'expired' - | 'failure' - | 'held' - | 'in_transit' - | 'label_created' - | 'lost' - | 'missorted' - | 'out_for_delivery' - | 'received_at_destination_facility' - | 'received_at_origin_facility' - | 'refused' - | 'return' - | 'status_update' - | 'transferred_to_destination_carrier' - | 'transit_exception' - | 'unknown' - | 'weather_delay'; diff --git a/types/Tracker/TrackingDetail.d.ts b/types/Tracker/TrackingDetail.d.ts deleted file mode 100644 index b27ff7a26..000000000 --- a/types/Tracker/TrackingDetail.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { IBaseObject } from '../base'; -import { ITrackerStatus } from './TrackerStatus'; -import { ITrackingLocation } from './TrackingLocation'; - -/** - * @see https://docs.easypost.com/docs/trackers#trackingdetail-object - */ -export declare interface ITrackingDetail extends IBaseObject<'TrackingDetail'> { - /** - * Description of the scan event - */ - message: string; - - description: string; - - /** - * Status of the package at the time of the scan event, possible values are "unknown", "pre_transit", "in_transit", "out_for_delivery", "delivered", "available_for_pickup", "return_to_sender", "failure", "cancelled" or "error" - */ - status: ITrackerStatus; - - status_detail: string; - - /** - * The timestamp when the tracking scan occurred - */ - datetime: string; - - /** - * The original source of the information for this scan event, usually the carrier - */ - source: string; - - carrier_code: string; - - /** - * The location associated with the scan event - */ - tracking_location: ITrackingLocation; -} diff --git a/types/Tracker/TrackingLocation.d.ts b/types/Tracker/TrackingLocation.d.ts deleted file mode 100644 index a094ddbc6..000000000 --- a/types/Tracker/TrackingLocation.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { IBaseObject } from '../base'; - -/** - * @see https://docs.easypost.com/docs/trackers#trackinglocation-object - */ -export declare interface ITrackingLocation extends IBaseObject<'TrackingLocation'> { - /** - * The city where the scan event occurred (if available) - */ - city: string; - - /** - * The state where the scan event occurred (if available) - */ - state: string; - - /** - * The country where the scan event occurred (if available) - */ - country: string; - - /** - * The postal code where the scan event occurred (if available) - */ - zip: string; -} diff --git a/types/Tracker/index.d.ts b/types/Tracker/index.d.ts deleted file mode 100644 index 984c3f378..000000000 --- a/types/Tracker/index.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export * from './CarrierDetail'; -export * from './Tracker'; -export * from './TrackerStatus'; -export * from './TrackingDetail'; -export * from './TrackingLocation'; -export * from './TrackerCreateParameters'; -export * from './TrackerListParameters'; diff --git a/types/User/User.d.ts b/types/User/User.d.ts deleted file mode 100644 index 6afb17d31..000000000 --- a/types/User/User.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -import { IObjectWithId } from '../base'; -import { IUserCreateParameters } from './UserCreateParameters'; - -/** - * The User object can be used to manage your own account and to create child accounts. - * Only a Production mode API key can be used to make requests against the Users API. - * - * Balance and recharge values on User objects are expressed in higher precision USD. - * - * @see https://docs.easypost.com/docs/users-object - */ -export declare interface IUser extends IObjectWithId<'User'> { - /** - * An optional field that may be used in place of id in other API endpoints - */ - reference?: string | null; - - /** - * The ID of the parent user object. - * Top-level users are defined as users with no parent - */ - parent_id: string; - - /** - * First and last name required - */ - name: string; - - /** - * Required - */ - email: string; - - /** - * Optional - */ - phone_number?: string | null; - - /** - * Formatted as string "XX.XXXXX" - */ - balance: string; - - /** - * Cost per shipment purchase, formatted as string "XX.XXXXX" - */ - price_per_shipment: string; - /** - * USD formatted dollars and cents, delimited by a decimal point - */ - recharge_amount: string; - - /** - * USD formatted dollars and cents, delimited by a decimal point - */ - secondary_recharge_amount: string; - - /** - * Number of cents USD that when your balance drops below, we automatically recharge your account with your primary payment method. - */ - recharge_threshold: string; - - /** - * The fee rate for convenience fees - */ - cc_fee_rate: string; - - /** - * The fee rate for insurance purchases - */ - insurance_fee_rate: string; - - /** - * The minimum cost for insurance purchases - */ - insurance_fee_minimum: string; - - /** - * All associated children - */ - children: IUser[]; -} - -declare class User implements IUser { - public constructor(input: IUserCreateParameters); - - id: string; - mode: 'test' | 'production'; - object: 'User'; - reference?: string | null; - parent_id: string; - name: string; - email: string; - phone_number?: string | null; - balance: string; - price_per_shipment: string; - recharge_amount: string; - secondary_recharge_amount: string; - recharge_threshold: string; - cc_fee_rate: string; - insurance_fee_rate: string; - insurance_fee_minimum: string; - children: IUser[]; - - /** - * Creates a child user. - * - * @see https://docs.easypost.com/docs/users/child-users#create-a-child-user - * @requires production API Key. - * - * @param {Object} params The parameters to create an {@link User} with. - * @returns {Promise} The created User. - */ - static create(params: Object): Promise; - - /** - * Retrieve a child user. - * @requires production API Key. - * - * @see https://docs.easypost.com/docs/users#retrieve-a-user - * - * @param {string} id ID of the child user to retrieve - * @param urlPrefix Override the prefix to use for the request URL, optional - * @returns {Promise} The associated User. - */ - static retrieve(id: string, urlPrefix: string): Promise; - - /** - * Retrieve the current authenticated user. - * @requires production API Key. - * - * @see https://docs.easypost.com/docs/users#retrieve-a-user - * - * @returns {Promise} The current authenticated user. - */ - static retrieveMe(): Promise; - - /** - * Just like retrieving a User they can be updated using the same patterns. - * Passing an id will allow the update of a child or the authenticated User. - * Passing no id will update the authenticated User. - * Since children also have the ability to authenticate themselves they can be updated without passing an id. - * Children may only have their "name" field updated, all other fields are ignored. - * Update requests for Users are partial updates. Only attributes specifically passed in will be updated. - * The current_password attribute is required when updating email or password. - * - * @see https://docs.easypost.com/docs/users#update-a-user - * @requires production API Key. - * - * @param id The id of the user - * @param params The parameters to update the {@link User} with - * @returns {Promise} The associated User. - */ - static update(id: string, params: Object): Promise; - - /** - * Childen may be removed from its parent. The parent account's Production API key must be used for the request, - * a child may not remove itself from its parent. - * A successful delete will return HTTP status 204 and an empty object for JSON content. - * @param id The id of the users - * @requires production API Key. - */ - static delete(id: string): void; - - /** - * Retrieve a list of all children user. - * - * The Children List is a paginated list of all {@link User} objects associated with the given API Key. - * It accepts a variety of parameters which can be used to modify the scope. - * The has_more attribute indicates whether additional pages can be requested. - * The recommended way of paginating is to use either the `before_id` or `after_id` parameter to specify where the next page begins. - * - * @see https://docs.easypost.com/docs/users/child-users#retrieve-all-child-users - * - * @param {Object} params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Children children} and pagination information. - */ - static allChildren(params: Object): Promise<{ children: User[]; has_more: boolean }>; - - /** - * Retrieve the next page of {@link User child users}. - * - * This automatically reuses the parameters from the previous call or the original {@link User.allChildren} call. - * - * @see https://docs.easypost.com/docs/users/child-users#retrieve-all-child-users - * - * @param {Object} children - The previous page of child users (the response from the last {@link User.getNextPage} or {@link User.allChildren} call). - * @param {number} [pageSize] - The number of child users to retrieve per page, optional. Defaults to server-side default. - * @returns {Object} - An object containing a list of {@link User child users} and pagination information. - */ - static getNextPage( - children: Object, - pageSize?: number, - ): Promise<{ children: User[]; has_more: boolean }>; -} - -export type { User }; diff --git a/types/User/UserCreateParameters.d.ts b/types/User/UserCreateParameters.d.ts deleted file mode 100644 index d9bc3cc78..000000000 --- a/types/User/UserCreateParameters.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ParametersToOmitOnCreate } from '../utils'; -import { IUser } from './User'; - -export declare interface IUserCreateParameters extends Omit {} diff --git a/types/User/index.d.ts b/types/User/index.d.ts deleted file mode 100644 index f6b9f36c6..000000000 --- a/types/User/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './User'; diff --git a/types/Utility/Utils.d.ts b/types/Utility/Utils.d.ts deleted file mode 100644 index 0d1a18a51..000000000 --- a/types/Utility/Utils.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Rate } from '../Rate'; - -/** - * The Utils class represents a number of helper methods for the client library. - */ -declare class Utils { - /** - * Get the lowest SmartRate from a provided list of SmartRates. - * @public - * @param smartrates List of SmartRates to filter through - * @param deliveryDays The maximum number of days allowed for delivery - * @param deliveryAccuracy The target level of accuracy for the delivery days (e.g. 'percentile_95') - * @returns The lowest SmartRate - * @throws FilteringError If no applicable rates are found - * @throws InvalidParameterError If the deliveryAccuracy value is invalid - */ - static getLowestSmartRate( - smartrates: Rate[], - deliveryDays: number, - deliveryAccuracy: string, - ): Rate; - - /** - * Get the lowest rate from a provided list of rates. - * @public - * @param rates List of rates to filter through - * @param carriers List of carriers to filter by - * @param services List of services to filter by - * @returns The lowest rate - * @throws FilteringError If no applicable rates are found - */ - static getLowestRate(rates: Rate[], carriers?: string[], services?: string[]): Rate; - - /** - * Validate a webhook by comparing the HMAC signature header sent from EasyPost to your shared secret. - * If the signatures do not match, an error will be raised signifying the webhook either did not originate - * from EasyPost or the secrets do not match. If the signatures do match, the `event_body` will be returned - * as JSON. - * @public - * @param eventBody The raw body of the webhook event - * @param headers The headers of the webhook HTTP request - * @param webhookSecret The webhook secret shared between EasyPost and your application - * @returns The JSON-parsed webhook event body if the signature could be verified - * @throws SignatureVerificationError If the signature could not be verified - */ - static validateWebhook(eventBody: Buffer, headers: object, webhookSecret: string): object; -} - -export type { Utils }; diff --git a/types/Utility/index.d.ts b/types/Utility/index.d.ts deleted file mode 100644 index 6a46623dc..000000000 --- a/types/Utility/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './Utils'; diff --git a/types/Webhook/Webhook.d.ts b/types/Webhook/Webhook.d.ts deleted file mode 100644 index f03f511ae..000000000 --- a/types/Webhook/Webhook.d.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { IObjectWithId } from '../base'; -import { IWebhookCreateParameters } from './WebhookCreateParameters'; -import { IWebhookListParameters } from './WebhookListParameters'; - -/** - * Each Webhook contains the url which EasyPost will notify whenever an object in our system updates. - * Several types of objects are processed asynchronously in the EasyPost system, so whenever an object updates, an Event is sent via HTTP POST to each configured webhook URL. - * The Webhook object provides CRUD operations for all Webhooks. - * - * Currently, our recommended best practice for securing Webhooks involves using basic authentication and HTTPS on your endpoint. - * This will help prevent any altering of any information communicated to you by EasyPost, prevent any third parties from seeing your webhooks in transit, and will prevent any third parties from masquerading as EasyPost and sending fraudulent data. - * EasyPost performs certificate validation and requires any TLS-enabled (HTTPS) webhook recipients to have a certificate signed by a public trusted certification authority. - * We do not support sending webhooks to over SSLv2, SSLv3, or any connection using so-called export-grade ciphers. - * For documentation on how to set up your server with TLS, we recommend Mozilla's guide to Server-Side TLS and Qualys's SSL/TLS deployment best practices guide. - * - * In general, a Webhook's endpoint should return a status code of 2XX. - * A 200 is preferred, but any 2XX status will indicate to our system that the Webhook request was successful. - * Endpoints that return a large volume and rate of failures over a period of time will get automatically disabled by the system; a disabled Webhook can be re-enabled using the Webhook update endpoint. - * - * @see https://docs.easypost.com/docs/webhooks#webhook-object - */ -export declare interface IWebhook extends IObjectWithId<'Webhook'> { - /** - * http://example.com - */ - url: string; - - /** - * the timestamp at which the webhook was most recently disabled (if any) - */ - disabled_at: string; - - /** - * custom headers to add to your webhook - */ - custom_headers: Array<{ key: string; value: string }>; -} - -declare class Webhook implements IWebhook { - public constructor(input: IWebhookCreateParameters); - - url: string; - disabled_at: string; - id: string; - mode: 'test' | 'production'; - object: 'Webhook'; - custom_headers: { key: string; value: string }[]; - - /** - * To create a Webhook, you simply need to provide a url parameter that you wish to receive notifications to. - * - * @see https://docs.easypost.com/docs/webhooks#create-a-webhook - * - * @param {Object} params The parameters to create an {@link Webhook} with - * @returns {Promise} The created and verified {@link Webhook} - */ - static create(params: Object): Promise; - - /** - * Enables a Webhook that has been disabled. You can also secure your webhook by adding a webhook_secret. - * - * @see https://docs.easypost.com/docs/webhooks#update-a-webhook - * - * @param webhookId Unique, starts with "hook_" - * @param params The parameters to update an {@link Webhook} with - * @returns {Promise} The created and verified {@link Webhook} - */ - static update(webhookId: string, params: Object): Promise; - - /** - * Retrieve an unpaginated list of all Webhooks available to the authenticated account. - * - * @see https://docs.easypost.com/docs/webhooks#retrieve-all-webhooks - * - * @param {Object} params - The parameters to use for the request. - * @returns {Object} - An object containing a list of {@link Webhook webhooks} and pagination information. - */ - static all(params?: IWebhookListParameters): Promise<{ webhooks: Webhook[] }>; - - /** - * Retrieve a Webhook by id. - * - * @param webhookId Unique, starts with "hook_" - * - * @see https://docs.easypost.com/docs/webhooks#retrieve-a-webhook - * - * @returns {Promise} The created and verified {@link Webhook} - */ - static retrieve(webhookId: string): Promise; - - /** - * Delete a Webhook by id. - * - * @param webhookId Unique, starts with "hook_" - * - * @see https://docs.easypost.com/docs/webhooks#delete-a-webhook - */ - static delete(webhookId: string): void; -} - -export type { Webhook }; diff --git a/types/Webhook/WebhookCreateParameters.d.ts b/types/Webhook/WebhookCreateParameters.d.ts deleted file mode 100644 index d0b73daf1..000000000 --- a/types/Webhook/WebhookCreateParameters.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare interface IWebhookCreateParameters { - url: string; - webhook_secret?: string; - custom_headers?: Array<{ key: string; value: string }>; -} diff --git a/types/Webhook/WebhookListParameters.d.ts b/types/Webhook/WebhookListParameters.d.ts deleted file mode 100644 index 1fb245edd..000000000 --- a/types/Webhook/WebhookListParameters.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IAllMethodParameters } from '../utils'; - -/** - * @see https://docs.easypost.com/docs/webhooks#retrieve-all-webhooks - */ -export declare interface IWebhookListParameters extends IAllMethodParameters {} diff --git a/types/Webhook/index.d.ts b/types/Webhook/index.d.ts deleted file mode 100644 index 38a45b80b..000000000 --- a/types/Webhook/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Webhook'; -export * from './WebhookCreateParameters'; diff --git a/types/base.d.ts b/types/base.d.ts deleted file mode 100644 index 3a47f43c7..000000000 --- a/types/base.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -export declare interface IDatedObject { - /** - * Date ISO String - */ - created_at: string; - - /** - * Date ISO String - */ - updated_at: string; -} - -export declare interface IBaseObject { - object: ObjectName; -} - -export declare interface IObjectWithId extends IBaseObject { - /** - * Unique identifier, begins with "adr_" / "prcl_" / "ins_" / "trk_" / "batch_" / "cstinfo_" / etc - */ - id: string; - - /** - * Set based on which api-key you used, either "test" or "production" - */ - mode: 'test' | 'production'; - - /** - * The object name, e.g. "Address", "Rate", "Shipment", etc - */ - object: ObjectName; -} diff --git a/types/demo/README.md b/types/demo/README.md deleted file mode 100644 index 61eb856f1..000000000 --- a/types/demo/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Typescript Demo - -This is a simple project to demonstrate and test how to use the EasyPost Typescript definitions. diff --git a/types/demo/index.ts b/types/demo/index.ts deleted file mode 100644 index 8924c9fec..000000000 --- a/types/demo/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import EasyPostClient from '@easypost/api'; - -// This file is intended to demo how you could use the EasyPost Typescript definitions. -(async () => { - const client = new EasyPostClient(process.env.EASYPOST_TEST_API_KEY || ''); - - const customsInfo = await client.CustomsInfo.retrieve('cstinfo_...'); - - console.log(customsInfo); -})(); diff --git a/types/demo/package-lock.json b/types/demo/package-lock.json deleted file mode 100644 index 84ca6ffe2..000000000 --- a/types/demo/package-lock.json +++ /dev/null @@ -1,227 +0,0 @@ -{ - "name": "demo", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "demo", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@easypost/api": "file:../" - }, - "devDependencies": { - "ts-node": "10.7.0", - "typescript": "~5.3.0" - } - }, - "..": {}, - "node_modules/@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 12" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-consumer": "0.8.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@easypost/api": { - "resolved": "..", - "link": true - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.12", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.12.tgz", - "integrity": "sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "25.3.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.3.0.tgz", - "integrity": "sha512-4K3bqJpXpqfg2XKGK9bpDTc6xO/xoUP/RBWS7AtRMug6zZFaRekiLzjVtAoZMquxoAbzBvy5nxQ7veS5eYzf8A==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "undici-types": "~7.18.0" - } - }, - "node_modules/acorn": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", - "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.5", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz", - "integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==", - "dev": true, - "license": "MIT", - "dependencies": { - "acorn": "^8.11.0" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true, - "license": "MIT" - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/diff": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.4.tgz", - "integrity": "sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true, - "license": "ISC" - }, - "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "7.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", - "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", - "dev": true, - "license": "MIT", - "peer": true - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true, - "license": "MIT" - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - } - } -} diff --git a/types/demo/package.json b/types/demo/package.json deleted file mode 100644 index dfd3c7c97..000000000 --- a/types/demo/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "demo", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "ts-node src/index.ts" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "@easypost/api": "file:../" - }, - "devDependencies": { - "typescript": "~5.3.0", - "ts-node": "10.7.0" - } -} diff --git a/types/errors/AddressVerificationFieldError.d.ts b/types/errors/AddressVerificationFieldError.d.ts deleted file mode 100644 index 09c2456bc..000000000 --- a/types/errors/AddressVerificationFieldError.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { TErrorCode } from './ErrorCode'; - -/** - * @see https://docs.easypost.com/docs/errors#addressverificationfielderror-object - */ -export declare interface IAddressVerificationFieldError { - /** - * Machine readable description of the problem - */ - code: TErrorCode; - - /** - * Field of the request that the error describes - */ - field: string; - - /** - * Human readable description of the problem - */ - message: string; - - /** - * Occasional insight on how to correct the error - */ - suggestion?: string; -} diff --git a/types/errors/Error.d.ts b/types/errors/Error.d.ts deleted file mode 100644 index ea944154d..000000000 --- a/types/errors/Error.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { TErrorCode } from './ErrorCode'; -import { IFieldError } from './FieldError'; - -/** - * In the event of a client or server error, the response will contain the standard 4xx or 5xx respectively, accompanied by a well-formed JSON body describing the issue, e.g., a required field was omitted, a purchase failed, etc. - * - * Each client library will encapsulate these errors and raise an exception, in addition to other exceptional cases, such as network failures. - * It is recommended to handle exceptions gracefully and to report any issues to support@easypost.com. - * - * @see https://docs.easypost.com/docs/errors - */ -export declare interface IError { - /** - * Machine readable description of the problem - */ - code: TErrorCode; - - /** - * Human readable description of the problem - */ - message: string; - - /** - * Breakdown of errors for specific fields in the request - */ - errors: IFieldError[]; -} diff --git a/types/errors/ErrorCode.d.ts b/types/errors/ErrorCode.d.ts deleted file mode 100644 index a7da3f95f..000000000 --- a/types/errors/ErrorCode.d.ts +++ /dev/null @@ -1,173 +0,0 @@ -export declare type TErrorCode = - | 'ADDRESS.COUNTRY.INVALID' - | 'ADDRESS.PARAMETERS.INVALID_CHARACTER' - | 'ADDRESS.PARAMETERS.INVALID' - | 'ADDRESS.VERIFICATION.FAILURE' - | 'ADDRESS.VERIFICATION.INVALID' - | 'ADDRESS.VERIFICATION.NOT_FOUND' - | 'ADDRESS.VERIFY.CARRIER_INVALID' - | 'ADDRESS.VERIFY.FAILURE' - | 'ADDRESS.VERIFY.INTL_NOT_ENABLED' - | 'ADDRESS.VERIFY.MISSING_CITY_STATE_ZIP' - | 'ADDRESS.VERIFY.MISSING_STREET' - | 'ADDRESS.VERIFY.ONLY_US' - | 'ADDRESS.VERIFY.UNAVAILABLE' - | 'ADDRESS.VERIFY.UPSTREAM_UNAVAILABLE' - | 'BAD_REQUEST' - | 'BANK_ACCOUNT.CHARGE.FAILURE' - | 'BANK_ACCOUNT.VERIFY.FAILURE' - /** - * The typo "FORAMT" is in both the docs and api error response. - * @link https://github.com/EasyPost/easypost-node/pull/156#discussion_r819811282 - */ - | 'BATCH.FILE_FORAMT.INVALID' - | 'BATCH.PARAMS.INVALID' - | 'BATCH.SHIPMENT.MISSING' - | 'BATCH.SHIPMENT.TOO_LARGE' - | 'BATCH.SHIPMENTS.REQUIRED' - | 'BATCH.STATE.ALREADY_PURCHASED' - | 'BATCH.STATE.CREATING' - | 'BATCH.STATE.CREATION_FAILED' - | 'BATCH.STATE.NOT_PURCHASED' - | 'CARRIER_ACCOUNT.INVALID' - | 'CARRIER_ACCOUNT.PARAMETERS.INVALID' - | 'CARRIER_ACCOUNT.REGISTRATION.FAILED' - | 'CARRIER_ACCOUNT.TYPE.EXISTS' - | 'CARRIER_ACCOUNT.TYPE.UNKNOWN' - | 'CONTAINER.DIMENSION.REQUIRED' - | 'CONTAINER.NAME.REQUIRED' - | 'CONTAINER.TYPE.INVALID' - | 'CREDIT_CARD.CHARGE.FAILURE' - | 'CREDIT_CARD.INVALID' - | 'CUSTOMS_INFO.PARAMETERS.INVALID' - | 'CUSTOMS_ITEM.CURRENCY.ONE_CURRENCY_SUPPORTED' - | 'CUSTOMS_ITEM.ORIGIN_COUNTRY.REQUIRED' - | 'CUSTOMS_ITEM.PARAMETERS.INVALID' - | 'DATE.PARSE.FAILURE' - | 'DHLGM.ACCESS_TOKEN.GENERATION_FAILED' - | 'DHLGM.GIRTH_MAX' - | 'DHLGM.LABEL.FAILURE' - | 'DHLGM.LETTER_NOT_SUPPORTED' - | 'DHLGM.NO_ALCOHOL' - | 'DHLGM.NO_INTERNATIONAL' - | 'DHLGM.RATE_TABLE.NOT_FOUND' - | 'DHLGM.RETURN.AUTHORIZATION_NUMBER_REQUIRED' - | 'DHLGM.SCAN_FORM.GENERATION_FAILED' - | 'DOCUMENT.COMMERCIAL_INVOICE.FAILURE' - | 'DOCUMENT.CONVERSION.FAILURE' - | 'EMAIL_VERIFICATION.EXPIRED' - | 'EMAIL_VERIFICATION.NOT_FOUND' - | 'EMAIL_VERIFICATION.USED' - | 'FORBIDDEN' - | 'IMAGE.CONVERSION.FAILURE' - | 'IMAGE.WIDTH.INVALID' - | 'INSURANCE.AMOUNT.ABOVE_MAXIMUM' - | 'INSURANCE.AMOUNT.BELOW_MINIMUM' - | 'INSURANCE.AMOUNT.REQUIRED' - | 'INSURANCE.CREATE.FAILURE' - | 'INSURANCE.PARAMETERS.INVALID' - | 'INSURANCE.PURCHASE.FAILED' - | 'INSURANCE.PURCHASE.NOT_ALLOWED' - | 'INTERNAL_SERVER_ERROR' - | 'ITEM.HEIGHT.REQUIRED' - | 'ITEM.LENGTH.REQUIRED' - | 'ITEM.NAME.REQUIRED' - | 'ITEM.VALUE.REQUIRED' - | 'ITEM.WEIGHT.REQUIRED' - | 'ITEM.WIDTH.REQUIRED' - | 'MODE.CONFLICT' - | 'MODE.UNAUTHORIZED' - | 'NOT_ACCEPTABLE' - | 'NOT_FOUND' - | 'ORDER.CARRIER_ACCOUNTS.CONFLICT' - | 'ORDER.CARRIER.REQUIRED' - | 'ORDER.FROM_ADDRESS.REQUIRED' - | 'ORDER.INVALID' - | 'ORDER.LABEL_DATE.INVALID' - | 'ORDER.OPTIONS.INVALID' - | 'ORDER.PARAMS.REQUIRED' - | 'ORDER.RATE.UNAVAILABLE' - | 'ORDER.SERVICE.REQUIRED' - | 'ORDER.SHIPMENTS.REQUIRED' - | 'ORDER.TO_ADDRESS.REQUIRED' - | 'PARAMETER.FORBIDDEN' - | 'PARAMETER.REQUIRED' - | 'PARCEL.PARAMETERS.INVALID' - | 'PARCEL.PREDEFINED_PACKAGE.INVALID' - | 'PAYMENT_GATEWAY.ERROR' - | 'PAYMENT_REQUIRED' - | 'PICKUP.ADDRESS.INVALID' - | 'PICKUP.ADDRESS.REQUIRED' - | 'PICKUP.BATCH_CARRIER.INCONSISTENT' - | 'PICKUP.BATCH.INVALID' - | 'PICKUP.BATCH.REQUIRED' - | 'PICKUP.BUY.FAILED' - | 'PICKUP.BUY.FORBIDDEN' - | 'PICKUP.BUY.NO_MATCHING_RATES' - | 'PICKUP.CANCEL.FAILED' - | 'PICKUP.CARRIER.REQUIRED' - | 'PICKUP.IS_ACCOUNT_ADDRESS.REQUIRED' - | 'PICKUP.MAX_DATETIME.REQUIRED' - | 'PICKUP.MIN_DATETIME.REQUIRED' - | 'PICKUP.REQUEST.INVALID' - | 'PICKUP.SERVICE.REQUIRED' - | 'PICKUP.SHIPMENT_COUNTRY.INVALID' - | 'PICKUP.SHIPMENT_SERVICE.INVALID' - | 'PICKUP.STATUS.INVALID' - | 'REFUND.FAILURE' - | 'REFUND.NO_RESPONSE' - | 'REFUND.TRACKING_CODE.NOT_FOUND' - | 'REFUND.TRACKING_CODES.INVALID' - | 'SCAN_FORM.BATCH.MULTIPLE_CARRIERS' - | 'SCAN_FORM.BATCH.NOT_PURCHASED' - | 'SCAN_FORM.CREATE.CARRIER_NOT_SUPPORTED' - | 'SCAN_FORM.CREATE.FAILURE' - | 'SCAN_FORM.FAILURE' - | 'SCAN_FORM.SHIPMENTS.INVALID' - | 'SCAN_FORM.SHIPMENTS.REQUIRED' - | 'SHIPMENT_REPORT.ALREADY_IN_PROGRESS' - | 'SHIPMENT_REPORT.DATE_RANGE.INVALID' - | 'SHIPMENT_REPORT.DATE_RANGE.TOO_LONG' - | 'SHIPMENT.CARRIER_ACCOUNTS.CONFLICT' - | 'SHIPMENT.CUSTOMS_INFO.DESCRIPTION_REQUIRED' - | 'SHIPMENT.CUSTOMS_INFO.REQUIRED' - | 'SHIPMENT.INSURANCE.ALREADY_PURCHASED' - | 'SHIPMENT.INVALID_PARAMS' - | 'SHIPMENT.INVALID' - | 'SHIPMENT.MISSING_INFORMATION' - | 'SHIPMENT.MISSING_RATE' - | 'SHIPMENT.OPTIONS.INVALID' - | 'SHIPMENT.POSTAGE.ASCII' - | 'SHIPMENT.POSTAGE.EXISTS' - | 'SHIPMENT.POSTAGE.FAILURE' - | 'SHIPMENT.POSTAGE.FORMAT_UNAVAILABLE' - | 'SHIPMENT.POSTAGE.INVALID_FORMAT' - | 'SHIPMENT.POSTAGE.NO_RESPONSE' - | 'SHIPMENT.POSTAGE.REQUIRED' - | 'SHIPMENT.PURCHASE.FAILURE' - | 'SHIPMENT.PURCHASE.IN_PROGRESS' - | 'SHIPMENT.RATE.BARCODE_UNAVAILABLE' - | 'SHIPMENT.RATE.CARRIER_ACCOUNT_INVALID' - | 'SHIPMENT.RATE.STAMP_UNAVAILABLE' - | 'SHIPMENT.RATES.UNAVAILABLE' - | 'SHIPMENT.REFUND.FAILURE' - | 'SHIPMENT.REFUND.UNAVAILABLE' - | 'SHIPMENT.TRACKING_CODE.INVALID_CARRIER' - | 'TRACKER.CARRIER_CODE_MISMATCH' - | 'TRACKER.CREATE.ERROR' - | 'TRACKER.INVALID_PARAMS' - | 'TRACKER.INVALID_TEST_CODE' - | 'TRACKER.MULTIPLE_CARRIERS_FOR_CODE' - | 'TRACKER.NO_CARRIER_ACCOUNT' - | 'TRACKER.NO_CARRIER_FOR_CODE' - | 'TRACKER.NOT_FOUND' - | 'TRACKER.RETRIEVE.ERROR' - | 'TRACKER.RUN.ERROR' - | 'TRACKER.UNSUPPORTED_CARRIER' - | 'UNAUTHORIZED' - | 'USER.CHARGE.NOT_ALLOWED' - | 'USER.INVALID' - | 'USER.PARENT.INVALID' - | 'USER.UNAUTHORIZED' - | 'WEBHOOK.EVENT.INVALID' - | 'WEBHOOK.INVALID'; diff --git a/types/errors/FieldError.d.ts b/types/errors/FieldError.d.ts deleted file mode 100644 index 2448b13de..000000000 --- a/types/errors/FieldError.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export declare interface IFieldError { - /** - * Field of the request that the error describes - */ - field: string; - - /** - * Human readable description of the problem - */ - message: string; - - /** - * Occasional insight on how to correct the error - */ - suggestion?: string; -} diff --git a/types/errors/index.d.ts b/types/errors/index.d.ts deleted file mode 100644 index d76c4718b..000000000 --- a/types/errors/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './AddressVerificationFieldError'; -export * from './Error'; -export * from './ErrorCode'; -export * from './FieldError'; diff --git a/types/index.d.ts b/types/index.d.ts deleted file mode 100644 index 1e1481dbb..000000000 --- a/types/index.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export * from './Address'; -export * from './Batch'; -export * from './Billing'; -export * from './Brand'; -export * from './Carrier'; -export * from './Claim'; -export * from './CustomerPortal'; -export * from './Customs'; -export { IEasyPostOptions } from './EasyPost'; -export * from './Embeddable'; -export * from './EndShipper'; -export * from './errors'; -export * from './Event'; -export * from './Fee'; -export * from './Insurance'; -export * from './Luma'; -export * from './Order'; -export * from './Parcel'; -export * from './PaymentMethod'; -export * from './Pickup'; -export * from './Referral'; -export * from './Refund'; -export * from './Report'; -export * from './ScanForm'; -export * from './Shipment'; -export * from './SmartRate'; -export * from './Tracker'; -export * from './User'; -export * from './Utility'; -export * from './utils'; -export * from './Webhook'; - -declare const EasyPostClient: typeof import('./EasyPost').default; -export default EasyPostClient; -export as namespace MainClient; - -declare module 'easypost' { - export default EasyPostClient; -} diff --git a/types/utils.d.ts b/types/utils.d.ts deleted file mode 100644 index 0346ce471..000000000 --- a/types/utils.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -export type DeepPartial = { - [P in keyof T]?: DeepPartial; -}; - -export type ParametersToOmitOnCreate = 'id' | 'object' | 'mode' | 'created_at' | 'updated_at'; - -export declare interface IAllMethodParameters { - /** - * Optional pagination parameter. - * Only records created before the given ID will be included. - * May not be used with after_id - */ - before_id?: string; - - /** - * Optional pagination parameter. - * Only records created after the given ID will be included. - * May not be used with before_id - */ - after_id?: string; - - /** - * Only return records created after this timestamp. - * Defaults to 1 month ago, or 1 month before a passed end_datetime - */ - start_datetime?: string; - - /** - * Only return records created before this timestamp. - * Defaults to end of the current day, or 1 month after a passed start_datetime - */ - end_datetime?: string; - - /** - * The number of records to return on each page. - * The maximum value is 100 - */ - page_size?: number; -}