increase 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/README.md +29 -9
- package/_shims/fetch.d.ts +8 -1
- package/_shims/fetch.node.d.ts +11 -1
- package/core.d.ts +75 -27
- package/core.d.ts.map +1 -1
- package/core.js +112 -49
- package/core.js.map +1 -1
- package/core.mjs +108 -49
- package/core.mjs.map +1 -1
- package/package.json +1 -1
- package/pagination.d.ts +2 -2
- package/pagination.d.ts.map +1 -1
- package/pagination.js +4 -4
- package/pagination.js.map +1 -1
- package/pagination.mjs +4 -4
- package/pagination.mjs.map +1 -1
- package/resources/account-numbers.d.ts +8 -8
- package/resources/account-numbers.d.ts.map +1 -1
- package/resources/account-numbers.js.map +1 -1
- package/resources/account-numbers.mjs.map +1 -1
- package/resources/account-statements.d.ts +3 -6
- package/resources/account-statements.d.ts.map +1 -1
- package/resources/account-statements.js.map +1 -1
- package/resources/account-statements.mjs.map +1 -1
- package/resources/account-transfers.d.ts +6 -18
- package/resources/account-transfers.d.ts.map +1 -1
- package/resources/account-transfers.js.map +1 -1
- package/resources/account-transfers.mjs.map +1 -1
- package/resources/accounts.d.ts +6 -6
- package/resources/accounts.d.ts.map +1 -1
- package/resources/ach-prenotifications.d.ts +51 -7
- package/resources/ach-prenotifications.d.ts.map +1 -1
- package/resources/ach-prenotifications.js.map +1 -1
- package/resources/ach-prenotifications.mjs.map +1 -1
- package/resources/ach-transfers.d.ts +16 -9
- package/resources/ach-transfers.d.ts.map +1 -1
- package/resources/ach-transfers.js.map +1 -1
- package/resources/ach-transfers.mjs.map +1 -1
- package/resources/balance-lookups.d.ts +1 -1
- package/resources/balance-lookups.d.ts.map +1 -1
- package/resources/bookkeeping-accounts.d.ts +3 -3
- package/resources/bookkeeping-accounts.d.ts.map +1 -1
- package/resources/bookkeeping-entries.d.ts +2 -2
- package/resources/bookkeeping-entries.d.ts.map +1 -1
- package/resources/bookkeeping-entry-sets.d.ts +1 -1
- package/resources/bookkeeping-entry-sets.d.ts.map +1 -1
- package/resources/card-disputes.d.ts +7 -7
- package/resources/card-disputes.d.ts.map +1 -1
- package/resources/card-disputes.js.map +1 -1
- package/resources/card-disputes.mjs.map +1 -1
- package/resources/card-profiles.d.ts +15 -7
- package/resources/card-profiles.d.ts.map +1 -1
- package/resources/card-profiles.js +6 -0
- package/resources/card-profiles.js.map +1 -1
- package/resources/card-profiles.mjs +6 -0
- package/resources/card-profiles.mjs.map +1 -1
- package/resources/card-purchase-supplements.d.ts +3 -3
- package/resources/card-purchase-supplements.d.ts.map +1 -1
- package/resources/cards.d.ts +6 -13
- package/resources/cards.d.ts.map +1 -1
- package/resources/cards.js.map +1 -1
- package/resources/cards.mjs.map +1 -1
- package/resources/check-deposits.d.ts +7 -7
- package/resources/check-deposits.d.ts.map +1 -1
- package/resources/check-deposits.js.map +1 -1
- package/resources/check-deposits.mjs.map +1 -1
- package/resources/check-transfers.d.ts +15 -10
- package/resources/check-transfers.d.ts.map +1 -1
- package/resources/check-transfers.js.map +1 -1
- package/resources/check-transfers.mjs.map +1 -1
- package/resources/declined-transactions.d.ts +25 -28
- package/resources/declined-transactions.d.ts.map +1 -1
- package/resources/declined-transactions.js.map +1 -1
- package/resources/declined-transactions.mjs.map +1 -1
- package/resources/digital-wallet-tokens.d.ts +3 -6
- package/resources/digital-wallet-tokens.d.ts.map +1 -1
- package/resources/digital-wallet-tokens.js.map +1 -1
- package/resources/digital-wallet-tokens.mjs.map +1 -1
- package/resources/documents.d.ts +3 -3
- package/resources/documents.d.ts.map +1 -1
- package/resources/entities/beneficial-owners.d.ts +4 -8
- package/resources/entities/beneficial-owners.d.ts.map +1 -1
- package/resources/entities/beneficial-owners.js.map +1 -1
- package/resources/entities/beneficial-owners.mjs.map +1 -1
- package/resources/entities/entities.d.ts +11 -11
- package/resources/entities/entities.d.ts.map +1 -1
- package/resources/entities/entities.js +6 -0
- package/resources/entities/entities.js.map +1 -1
- package/resources/entities/entities.mjs +6 -0
- package/resources/entities/entities.mjs.map +1 -1
- package/resources/entities/supplemental-documents.d.ts +2 -2
- package/resources/entities/supplemental-documents.d.ts.map +1 -1
- package/resources/event-subscriptions.d.ts +5 -8
- package/resources/event-subscriptions.d.ts.map +1 -1
- package/resources/event-subscriptions.js.map +1 -1
- package/resources/event-subscriptions.mjs.map +1 -1
- package/resources/events.d.ts +7 -5
- package/resources/events.d.ts.map +1 -1
- package/resources/events.js.map +1 -1
- package/resources/events.mjs.map +1 -1
- package/resources/exports.d.ts +4 -4
- package/resources/exports.d.ts.map +1 -1
- package/resources/external-accounts.d.ts +5 -11
- package/resources/external-accounts.d.ts.map +1 -1
- package/resources/external-accounts.js.map +1 -1
- package/resources/external-accounts.mjs.map +1 -1
- package/resources/files.d.ts +9 -4
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +2 -2
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +2 -2
- package/resources/files.mjs.map +1 -1
- package/resources/groups.d.ts +1 -1
- package/resources/groups.d.ts.map +1 -1
- package/resources/inbound-ach-transfer-returns.d.ts +6 -4
- package/resources/inbound-ach-transfer-returns.d.ts.map +1 -1
- package/resources/inbound-ach-transfer-returns.js.map +1 -1
- package/resources/inbound-ach-transfer-returns.mjs.map +1 -1
- package/resources/inbound-wire-drawdown-requests.d.ts +5 -3
- package/resources/inbound-wire-drawdown-requests.d.ts.map +1 -1
- package/resources/inbound-wire-drawdown-requests.js.map +1 -1
- package/resources/inbound-wire-drawdown-requests.mjs.map +1 -1
- package/resources/limits.d.ts +5 -9
- package/resources/limits.d.ts.map +1 -1
- package/resources/limits.js.map +1 -1
- package/resources/limits.mjs.map +1 -1
- package/resources/oauth-connections.d.ts +3 -6
- package/resources/oauth-connections.d.ts.map +1 -1
- package/resources/oauth-connections.js.map +1 -1
- package/resources/oauth-connections.mjs.map +1 -1
- package/resources/pending-transactions.d.ts +28 -37
- package/resources/pending-transactions.d.ts.map +1 -1
- package/resources/pending-transactions.js.map +1 -1
- package/resources/pending-transactions.mjs.map +1 -1
- package/resources/programs.d.ts +3 -3
- package/resources/programs.d.ts.map +1 -1
- package/resources/real-time-decisions.d.ts +2 -5
- package/resources/real-time-decisions.d.ts.map +1 -1
- package/resources/real-time-decisions.js.map +1 -1
- package/resources/real-time-decisions.mjs.map +1 -1
- package/resources/real-time-payments-transfers.d.ts +6 -4
- package/resources/real-time-payments-transfers.d.ts.map +1 -1
- package/resources/real-time-payments-transfers.js.map +1 -1
- package/resources/real-time-payments-transfers.mjs.map +1 -1
- package/resources/routing-numbers.d.ts +4 -1
- package/resources/routing-numbers.d.ts.map +1 -1
- package/resources/routing-numbers.js.map +1 -1
- package/resources/routing-numbers.mjs.map +1 -1
- package/resources/simulations/account-statements.d.ts +1 -1
- package/resources/simulations/account-statements.d.ts.map +1 -1
- package/resources/simulations/account-transfers.d.ts +1 -1
- package/resources/simulations/account-transfers.d.ts.map +1 -1
- package/resources/simulations/ach-transfers.d.ts +124 -138
- package/resources/simulations/ach-transfers.d.ts.map +1 -1
- package/resources/simulations/ach-transfers.js.map +1 -1
- package/resources/simulations/ach-transfers.mjs.map +1 -1
- package/resources/simulations/card-disputes.d.ts +1 -1
- package/resources/simulations/card-disputes.d.ts.map +1 -1
- package/resources/simulations/card-profiles.d.ts +1 -4
- package/resources/simulations/card-profiles.d.ts.map +1 -1
- package/resources/simulations/card-profiles.js.map +1 -1
- package/resources/simulations/card-profiles.mjs.map +1 -1
- package/resources/simulations/card-refunds.d.ts +1 -1
- package/resources/simulations/card-refunds.d.ts.map +1 -1
- package/resources/simulations/cards.d.ts +49 -58
- package/resources/simulations/cards.d.ts.map +1 -1
- package/resources/simulations/cards.js.map +1 -1
- package/resources/simulations/cards.mjs.map +1 -1
- package/resources/simulations/check-deposits.d.ts +3 -12
- package/resources/simulations/check-deposits.d.ts.map +1 -1
- package/resources/simulations/check-transfers.d.ts +2 -2
- package/resources/simulations/check-transfers.d.ts.map +1 -1
- package/resources/simulations/digital-wallet-token-requests.d.ts +1 -1
- package/resources/simulations/digital-wallet-token-requests.d.ts.map +1 -1
- package/resources/simulations/documents.d.ts +1 -4
- package/resources/simulations/documents.d.ts.map +1 -1
- package/resources/simulations/documents.js.map +1 -1
- package/resources/simulations/documents.mjs.map +1 -1
- package/resources/simulations/inbound-funds-holds.d.ts +1 -1
- package/resources/simulations/inbound-funds-holds.d.ts.map +1 -1
- package/resources/simulations/inbound-wire-drawdown-requests.d.ts +1 -1
- package/resources/simulations/inbound-wire-drawdown-requests.d.ts.map +1 -1
- package/resources/simulations/interest-payments.d.ts +100 -108
- package/resources/simulations/interest-payments.d.ts.map +1 -1
- package/resources/simulations/interest-payments.js.map +1 -1
- package/resources/simulations/interest-payments.mjs.map +1 -1
- package/resources/simulations/programs.d.ts +1 -4
- package/resources/simulations/programs.d.ts.map +1 -1
- package/resources/simulations/programs.js.map +1 -1
- package/resources/simulations/programs.mjs.map +1 -1
- package/resources/simulations/real-time-payments-transfers.d.ts +123 -134
- package/resources/simulations/real-time-payments-transfers.d.ts.map +1 -1
- package/resources/simulations/real-time-payments-transfers.js.map +1 -1
- package/resources/simulations/real-time-payments-transfers.mjs.map +1 -1
- package/resources/simulations/wire-transfers.d.ts +100 -108
- package/resources/simulations/wire-transfers.d.ts.map +1 -1
- package/resources/simulations/wire-transfers.js.map +1 -1
- package/resources/simulations/wire-transfers.mjs.map +1 -1
- package/resources/transactions.d.ts +105 -110
- package/resources/transactions.d.ts.map +1 -1
- package/resources/transactions.js.map +1 -1
- package/resources/transactions.mjs.map +1 -1
- package/resources/wire-drawdown-requests.d.ts +4 -4
- package/resources/wire-drawdown-requests.d.ts.map +1 -1
- package/resources/wire-transfers.d.ts +11 -11
- package/resources/wire-transfers.d.ts.map +1 -1
- package/resources/wire-transfers.js.map +1 -1
- package/resources/wire-transfers.mjs.map +1 -1
- package/src/_shims/fetch.d.ts +8 -1
- package/src/_shims/fetch.node.d.ts +11 -1
- package/src/core.ts +167 -70
- package/src/pagination.ts +5 -5
- package/src/resources/account-numbers.ts +9 -9
- package/src/resources/account-statements.ts +4 -7
- package/src/resources/account-transfers.ts +7 -19
- package/src/resources/accounts.ts +7 -7
- package/src/resources/ach-prenotifications.ts +56 -8
- package/src/resources/ach-transfers.ts +18 -10
- package/src/resources/balance-lookups.ts +1 -1
- package/src/resources/bookkeeping-accounts.ts +4 -4
- package/src/resources/bookkeeping-entries.ts +3 -3
- package/src/resources/bookkeeping-entry-sets.ts +1 -1
- package/src/resources/card-disputes.ts +8 -8
- package/src/resources/card-profiles.ts +20 -8
- package/src/resources/card-purchase-supplements.ts +4 -4
- package/src/resources/cards.ts +7 -14
- package/src/resources/check-deposits.ts +8 -8
- package/src/resources/check-transfers.ts +17 -11
- package/src/resources/declined-transactions.ts +26 -29
- package/src/resources/digital-wallet-tokens.ts +4 -7
- package/src/resources/documents.ts +4 -4
- package/src/resources/entities/beneficial-owners.ts +4 -8
- package/src/resources/entities/entities.ts +15 -12
- package/src/resources/entities/supplemental-documents.ts +2 -2
- package/src/resources/event-subscriptions.ts +6 -9
- package/src/resources/events.ts +8 -6
- package/src/resources/exports.ts +5 -5
- package/src/resources/external-accounts.ts +6 -12
- package/src/resources/files.ts +11 -6
- package/src/resources/groups.ts +1 -1
- package/src/resources/inbound-ach-transfer-returns.ts +7 -5
- package/src/resources/inbound-wire-drawdown-requests.ts +6 -4
- package/src/resources/limits.ts +6 -10
- package/src/resources/oauth-connections.ts +4 -7
- package/src/resources/pending-transactions.ts +29 -38
- package/src/resources/programs.ts +4 -4
- package/src/resources/real-time-decisions.ts +2 -5
- package/src/resources/real-time-payments-transfers.ts +7 -5
- package/src/resources/routing-numbers.ts +4 -1
- package/src/resources/simulations/account-statements.ts +1 -1
- package/src/resources/simulations/account-transfers.ts +1 -1
- package/src/resources/simulations/ach-transfers.ts +124 -138
- package/src/resources/simulations/card-disputes.ts +1 -1
- package/src/resources/simulations/card-profiles.ts +1 -4
- package/src/resources/simulations/card-refunds.ts +1 -1
- package/src/resources/simulations/cards.ts +49 -58
- package/src/resources/simulations/check-deposits.ts +3 -3
- package/src/resources/simulations/check-transfers.ts +2 -2
- package/src/resources/simulations/digital-wallet-token-requests.ts +1 -1
- package/src/resources/simulations/documents.ts +1 -4
- package/src/resources/simulations/inbound-funds-holds.ts +1 -1
- package/src/resources/simulations/inbound-wire-drawdown-requests.ts +1 -1
- package/src/resources/simulations/interest-payments.ts +100 -108
- package/src/resources/simulations/programs.ts +1 -4
- package/src/resources/simulations/real-time-payments-transfers.ts +123 -134
- package/src/resources/simulations/wire-transfers.ts +100 -108
- package/src/resources/transactions.ts +106 -111
- package/src/resources/wire-drawdown-requests.ts +5 -5
- package/src/resources/wire-transfers.ts +12 -12
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-transfers.d.ts","sourceRoot":"","sources":["../src/resources/wire-transfers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEvD,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"wire-transfers.d.ts","sourceRoot":"","sources":["../src/resources/wire-transfers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,GAAG,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEvD,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;OAEG;IACH,MAAM,CAAC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,iBAAiB,GAAG,kBAAkB,CAAC;IACnD,MAAM,QAAQ,wBAAwB,GAAG,GAAG,CAAC,wBAAwB,CAAC;IACtE,MAAM,QAAQ,sBAAsB,GAAG,GAAG,CAAC,sBAAsB,CAAC;CACnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-transfers.js","sourceRoot":"","sources":["../src/resources/wire-transfers.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,gDAAgD;AAChD,wCAAiD;AAEjD,oDAAuD;AAEvD,MAAa,aAAc,SAAQ,sBAAW;IAC5C;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"wire-transfers.js","sourceRoot":"","sources":["../src/resources/wire-transfers.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAGrD,gDAAgD;AAChD,wCAAiD;AAEjD,oDAAuD;AAEvD,MAAa,aAAc,SAAQ,sBAAW;IAC5C;;OAEG;IACH,MAAM,CAAC,IAA8B,EAAE,OAA6B;QAClE,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,cAAsB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,GAAG,CAAC,mBAAmB,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAUD,IAAI,CACF,QAAsD,EAAE,EACxD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,cAAsB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,cAAc,UAAU,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,cAAsB,EAAE,OAA6B;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,cAAc,SAAS,EAAE,OAAO,CAAC,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,cAAsB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,IAAI,CAAC,+BAA+B,cAAc,UAAU,EAAE,OAAO,CAAC,CAAC;IACrF,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,cAAsB,EAAE,OAA6B;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,+BAA+B,cAAc,SAAS,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;CACF;AAjED,sCAiEC;AAED,MAAa,iBAAkB,SAAQ,iBAAkB;CAAG;AAA5D,8CAA4D;AA8Y5D,WAAiB,aAAa;AAK9B,CAAC,EALgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAK7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wire-transfers.mjs","sourceRoot":"","sources":["../src/resources/wire-transfers.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,mBAAmB;OACxC,EAAE,gBAAgB,EAAE,MAAM,eAAe;OAEzC,EAAE,IAAI,EAAc,MAAM,qBAAqB;AAEtD,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C;;OAEG;IACH,MAAM,
|
|
1
|
+
{"version":3,"file":"wire-transfers.mjs","sourceRoot":"","sources":["../src/resources/wire-transfers.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,mBAAmB;OACxC,EAAE,gBAAgB,EAAE,MAAM,eAAe;OAEzC,EAAE,IAAI,EAAc,MAAM,qBAAqB;AAEtD,MAAM,OAAO,aAAc,SAAQ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AA8Y5D,WAAiB,aAAa;AAK9B,CAAC,EALgB,aAAa,KAAb,aAAa,QAK7B"}
|
package/src/_shims/fetch.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ type _Response = unknown extends Response ? never : Response;
|
|
|
26
26
|
// @ts-ignore
|
|
27
27
|
type _ResponseInit = unknown extends ResponseInit ? never : ResponseInit;
|
|
28
28
|
// @ts-ignore
|
|
29
|
+
type _ResponseType = unknown extends ResponseType ? never : ResponseType;
|
|
30
|
+
// @ts-ignore
|
|
29
31
|
type _BodyInit = unknown extends BodyInit ? never : BodyInit;
|
|
30
32
|
// @ts-ignore
|
|
31
33
|
type _Headers = unknown extends Headers ? never : Headers;
|
|
@@ -49,4 +51,9 @@ declare const _Headers: {
|
|
|
49
51
|
export const isPolyfilled = false;
|
|
50
52
|
|
|
51
53
|
export { _fetch as fetch, _Request as Request, _Response as Response, _Headers as Headers };
|
|
52
|
-
export type {
|
|
54
|
+
export type {
|
|
55
|
+
_RequestInit as RequestInit,
|
|
56
|
+
_RequestInfo as RequestInfo,
|
|
57
|
+
_ResponseType as ResponseType,
|
|
58
|
+
_BodyInit as BodyInit,
|
|
59
|
+
};
|
|
@@ -26,6 +26,11 @@ type _RequestInit = unknown extends RequestInit ? nf.RequestInit : RequestInit;
|
|
|
26
26
|
type _Response = unknown extends Response ? nf.Response : Response;
|
|
27
27
|
// @ts-ignore
|
|
28
28
|
type _ResponseInit = unknown extends ResponseInit ? nf.ResponseInit : ResponseInit;
|
|
29
|
+
type _ResponseType =
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
unknown extends ResponseType ? 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'
|
|
32
|
+
: // @ts-ignore
|
|
33
|
+
ResponseType;
|
|
29
34
|
// @ts-ignore
|
|
30
35
|
type _BodyInit = unknown extends BodyInit ? nf.BodyInit : BodyInit;
|
|
31
36
|
// @ts-ignore
|
|
@@ -50,4 +55,9 @@ declare const _Headers: {
|
|
|
50
55
|
export const isPolyfilled = false;
|
|
51
56
|
|
|
52
57
|
export { _fetch as fetch, _Request as Request, _Response as Response, _Headers as Headers };
|
|
53
|
-
export type {
|
|
58
|
+
export type {
|
|
59
|
+
_RequestInit as RequestInit,
|
|
60
|
+
_RequestInfo as RequestInfo,
|
|
61
|
+
_ResponseType as ResponseType,
|
|
62
|
+
_BodyInit as BodyInit,
|
|
63
|
+
};
|
package/src/core.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
type RequestInit,
|
|
10
10
|
type Response,
|
|
11
11
|
} from './_shims/fetch.js';
|
|
12
|
+
export { type Response };
|
|
12
13
|
import { isMultipartBody } from './uploads';
|
|
13
14
|
export {
|
|
14
15
|
maybeMultipartFormRequestOptions,
|
|
@@ -21,6 +22,100 @@ const MAX_RETRIES = 2;
|
|
|
21
22
|
|
|
22
23
|
export type Fetch = (url: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
23
24
|
|
|
25
|
+
type PromiseOrValue<T> = T | Promise<T>;
|
|
26
|
+
|
|
27
|
+
type APIResponseProps = {
|
|
28
|
+
response: Response;
|
|
29
|
+
options: FinalRequestOptions;
|
|
30
|
+
controller: AbortController;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
|
|
34
|
+
const { response } = props;
|
|
35
|
+
const contentType = response.headers.get('content-type');
|
|
36
|
+
if (contentType?.includes('application/json')) {
|
|
37
|
+
const json = await response.json();
|
|
38
|
+
|
|
39
|
+
debug('response', response.status, response.url, response.headers, json);
|
|
40
|
+
|
|
41
|
+
return json as T;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// TODO handle blob, arraybuffer, other content types, etc.
|
|
45
|
+
const text = await response.text();
|
|
46
|
+
debug('response', response.status, response.url, response.headers, text);
|
|
47
|
+
return text as T;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* A subclass of `Promise` providing additional helper methods
|
|
52
|
+
* for interacting with the SDK.
|
|
53
|
+
*/
|
|
54
|
+
export class APIPromise<T> extends Promise<T> {
|
|
55
|
+
private parsedPromise: Promise<T> | undefined;
|
|
56
|
+
|
|
57
|
+
constructor(
|
|
58
|
+
private responsePromise: Promise<APIResponseProps>,
|
|
59
|
+
private parseResponse: (props: APIResponseProps) => PromiseOrValue<T> = defaultParseResponse,
|
|
60
|
+
) {
|
|
61
|
+
super((resolve) => {
|
|
62
|
+
// this is maybe a bit weird but this has to be a no-op to not implicitly
|
|
63
|
+
// parse the response body; instead .then, .catch, .finally are overridden
|
|
64
|
+
// to parse the response
|
|
65
|
+
resolve(null as any);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
_thenUnwrap<U>(transform: (data: T) => U): APIPromise<U> {
|
|
70
|
+
return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props)));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Gets the raw `Response` instance instead of parsing the response
|
|
75
|
+
* data.
|
|
76
|
+
*
|
|
77
|
+
* If you want to parse the response body but still get the `Response`
|
|
78
|
+
* instance, you can use {@link withResponse()}.
|
|
79
|
+
*/
|
|
80
|
+
asResponse(): Promise<Response> {
|
|
81
|
+
return this.responsePromise.then((p) => p.response);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Gets the parsed response data and the raw `Response` instance.
|
|
85
|
+
*
|
|
86
|
+
* If you just want to get the raw `Response` instance without parsing it,
|
|
87
|
+
* you can use {@link asResponse()}.
|
|
88
|
+
*/
|
|
89
|
+
async withResponse(): Promise<{ data: T; response: Response }> {
|
|
90
|
+
const [data, response] = await Promise.all([this.parse(), this.asResponse()]);
|
|
91
|
+
return { data, response };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private parse(): Promise<T> {
|
|
95
|
+
if (!this.parsedPromise) {
|
|
96
|
+
this.parsedPromise = this.responsePromise.then(this.parseResponse);
|
|
97
|
+
}
|
|
98
|
+
return this.parsedPromise;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
override then<TResult1 = T, TResult2 = never>(
|
|
102
|
+
onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
|
|
103
|
+
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
|
|
104
|
+
): Promise<TResult1 | TResult2> {
|
|
105
|
+
return this.parse().then(onfulfilled, onrejected);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
override catch<TResult = never>(
|
|
109
|
+
onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
|
|
110
|
+
): Promise<T | TResult> {
|
|
111
|
+
return this.parse().catch(onrejected);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
override finally(onfinally?: (() => void) | undefined | null): Promise<T> {
|
|
115
|
+
return this.parse().finally(onfinally);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
24
119
|
export abstract class APIClient {
|
|
25
120
|
baseURL: string;
|
|
26
121
|
maxRetries: number;
|
|
@@ -84,27 +179,39 @@ export abstract class APIClient {
|
|
|
84
179
|
return `stainless-node-retry-${uuid4()}`;
|
|
85
180
|
}
|
|
86
181
|
|
|
87
|
-
get<Req extends {}, Rsp>(path: string, opts?: RequestOptions<Req
|
|
88
|
-
return this.
|
|
182
|
+
get<Req extends {}, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
183
|
+
return this.methodRequest('get', path, opts);
|
|
89
184
|
}
|
|
90
|
-
|
|
91
|
-
|
|
185
|
+
|
|
186
|
+
post<Req extends {}, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
187
|
+
return this.methodRequest('post', path, opts);
|
|
92
188
|
}
|
|
93
|
-
|
|
94
|
-
|
|
189
|
+
|
|
190
|
+
patch<Req extends {}, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
191
|
+
return this.methodRequest('patch', path, opts);
|
|
95
192
|
}
|
|
96
|
-
|
|
97
|
-
|
|
193
|
+
|
|
194
|
+
put<Req extends {}, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
195
|
+
return this.methodRequest('put', path, opts);
|
|
98
196
|
}
|
|
99
|
-
|
|
100
|
-
|
|
197
|
+
|
|
198
|
+
delete<Req extends {}, Rsp>(path: string, opts?: PromiseOrValue<RequestOptions<Req>>): APIPromise<Rsp> {
|
|
199
|
+
return this.methodRequest('delete', path, opts);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
private methodRequest<Req extends {}, Rsp>(
|
|
203
|
+
method: HTTPMethod,
|
|
204
|
+
path: string,
|
|
205
|
+
opts?: PromiseOrValue<RequestOptions<Req>>,
|
|
206
|
+
): APIPromise<Rsp> {
|
|
207
|
+
return this.request(Promise.resolve(opts).then((opts) => ({ method, path, ...opts })));
|
|
101
208
|
}
|
|
102
209
|
|
|
103
210
|
getAPIList<Item, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(
|
|
104
211
|
path: string,
|
|
105
212
|
Page: new (...args: any[]) => PageClass,
|
|
106
213
|
opts?: RequestOptions<any>,
|
|
107
|
-
): PagePromise<PageClass> {
|
|
214
|
+
): PagePromise<PageClass, Item> {
|
|
108
215
|
return this.requestAPIList(Page, { method: 'get', path, ...opts });
|
|
109
216
|
}
|
|
110
217
|
|
|
@@ -198,14 +305,27 @@ export abstract class APIClient {
|
|
|
198
305
|
return APIError.generate(status, error, message, headers);
|
|
199
306
|
}
|
|
200
307
|
|
|
201
|
-
|
|
202
|
-
options: FinalRequestOptions<Req
|
|
203
|
-
|
|
204
|
-
):
|
|
308
|
+
request<Req extends {}, Rsp>(
|
|
309
|
+
options: PromiseOrValue<FinalRequestOptions<Req>>,
|
|
310
|
+
remainingRetries: number | null = null,
|
|
311
|
+
): APIPromise<Rsp> {
|
|
312
|
+
return new APIPromise(this.makeRequest(options, remainingRetries));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
private async makeRequest<T>(
|
|
316
|
+
optionsInput: PromiseOrValue<FinalRequestOptions>,
|
|
317
|
+
retriesRemaining: number | null,
|
|
318
|
+
): Promise<{ response: Response; options: FinalRequestOptions; controller: AbortController }> {
|
|
319
|
+
const options = await optionsInput;
|
|
320
|
+
if (retriesRemaining == null) {
|
|
321
|
+
retriesRemaining = options.maxRetries ?? this.maxRetries;
|
|
322
|
+
}
|
|
323
|
+
|
|
205
324
|
const { req, url, timeout } = this.buildRequest(options);
|
|
325
|
+
|
|
206
326
|
await this.prepareRequest(req, { url });
|
|
207
327
|
|
|
208
|
-
|
|
328
|
+
debug('request', url, options, req.headers);
|
|
209
329
|
|
|
210
330
|
if (options.signal?.aborted) {
|
|
211
331
|
throw new APIUserAbortError();
|
|
@@ -238,42 +358,21 @@ export abstract class APIClient {
|
|
|
238
358
|
const errJSON = safeJSON(errText);
|
|
239
359
|
const errMessage = errJSON ? undefined : errText;
|
|
240
360
|
|
|
241
|
-
|
|
361
|
+
debug('response', response.status, url, responseHeaders, errMessage);
|
|
242
362
|
|
|
243
363
|
const err = this.makeStatusError(response.status, errJSON, errMessage, responseHeaders);
|
|
244
364
|
throw err;
|
|
245
365
|
}
|
|
246
366
|
|
|
247
|
-
|
|
248
|
-
if (contentType?.includes('application/json')) {
|
|
249
|
-
const json = await response.json();
|
|
250
|
-
|
|
251
|
-
if (typeof json === 'object' && json != null) {
|
|
252
|
-
/** @deprecated – we expect to change this interface in the near future. */
|
|
253
|
-
Object.defineProperty(json, 'responseHeaders', {
|
|
254
|
-
enumerable: false,
|
|
255
|
-
writable: false,
|
|
256
|
-
value: responseHeaders,
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
this.debug('response', response.status, url, responseHeaders, json);
|
|
261
|
-
|
|
262
|
-
return json as APIResponse<Rsp>;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// TODO handle blob, arraybuffer, other content types, etc.
|
|
266
|
-
const text = response.text();
|
|
267
|
-
this.debug('response', response.status, url, responseHeaders, text);
|
|
268
|
-
return text as Promise<any>;
|
|
367
|
+
return { response, options, controller };
|
|
269
368
|
}
|
|
270
369
|
|
|
271
370
|
requestAPIList<Item = unknown, PageClass extends AbstractPage<Item> = AbstractPage<Item>>(
|
|
272
371
|
Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass,
|
|
273
372
|
options: FinalRequestOptions,
|
|
274
|
-
): PagePromise<PageClass> {
|
|
275
|
-
const
|
|
276
|
-
return new PagePromise(this,
|
|
373
|
+
): PagePromise<PageClass, Item> {
|
|
374
|
+
const request = this.makeRequest(options, null);
|
|
375
|
+
return new PagePromise<PageClass, Item>(this, request, Page);
|
|
277
376
|
}
|
|
278
377
|
|
|
279
378
|
buildURL<Req>(path: string, query: Req | undefined): string {
|
|
@@ -401,12 +500,6 @@ export abstract class APIClient {
|
|
|
401
500
|
private getUserAgent(): string {
|
|
402
501
|
return `${this.constructor.name}/JS ${VERSION}`;
|
|
403
502
|
}
|
|
404
|
-
|
|
405
|
-
private debug(action: string, ...args: any[]) {
|
|
406
|
-
if (typeof process !== 'undefined' && process.env['DEBUG'] === 'true') {
|
|
407
|
-
console.log(`${this.constructor.name}:DEBUG:${action}`, ...args);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
503
|
}
|
|
411
504
|
|
|
412
505
|
export class APIResource {
|
|
@@ -436,9 +529,14 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
436
529
|
#client: APIClient;
|
|
437
530
|
protected options: FinalRequestOptions;
|
|
438
531
|
|
|
439
|
-
|
|
532
|
+
protected response: Response;
|
|
533
|
+
protected body: unknown;
|
|
534
|
+
|
|
535
|
+
constructor(client: APIClient, response: Response, body: unknown, options: FinalRequestOptions) {
|
|
440
536
|
this.#client = client;
|
|
441
537
|
this.options = options;
|
|
538
|
+
this.response = response;
|
|
539
|
+
this.body = body;
|
|
442
540
|
}
|
|
443
541
|
|
|
444
542
|
/**
|
|
@@ -495,35 +593,33 @@ export abstract class AbstractPage<Item> implements AsyncIterable<Item> {
|
|
|
495
593
|
}
|
|
496
594
|
}
|
|
497
595
|
|
|
596
|
+
/**
|
|
597
|
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
598
|
+
*
|
|
599
|
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
600
|
+
*
|
|
601
|
+
* for await (const item of client.items.list()) {
|
|
602
|
+
* console.log(item)
|
|
603
|
+
* }
|
|
604
|
+
*/
|
|
498
605
|
export class PagePromise<
|
|
499
606
|
PageClass extends AbstractPage<Item>,
|
|
500
607
|
Item = ReturnType<PageClass['getPaginatedItems']>[number],
|
|
501
608
|
>
|
|
502
|
-
extends
|
|
609
|
+
extends APIPromise<PageClass>
|
|
503
610
|
implements AsyncIterable<Item>
|
|
504
611
|
{
|
|
505
|
-
/**
|
|
506
|
-
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
507
|
-
*/
|
|
508
612
|
constructor(
|
|
509
613
|
client: APIClient,
|
|
510
|
-
|
|
511
|
-
options: FinalRequestOptions,
|
|
614
|
+
request: Promise<APIResponseProps>,
|
|
512
615
|
Page: new (...args: ConstructorParameters<typeof AbstractPage>) => PageClass,
|
|
513
616
|
) {
|
|
514
|
-
super(
|
|
515
|
-
|
|
617
|
+
super(
|
|
618
|
+
request,
|
|
619
|
+
async (props) => new Page(client, props.response, await defaultParseResponse(props), props.options),
|
|
516
620
|
);
|
|
517
621
|
}
|
|
518
622
|
|
|
519
|
-
/**
|
|
520
|
-
* Enable subclassing Promise.
|
|
521
|
-
* Ref: https://stackoverflow.com/a/60328122
|
|
522
|
-
*/
|
|
523
|
-
static get [Symbol.species]() {
|
|
524
|
-
return Promise;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
623
|
/**
|
|
528
624
|
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
529
625
|
*
|
|
@@ -610,11 +706,6 @@ export type FinalRequestOptions<Req extends {} = Record<string, unknown> | Reada
|
|
|
610
706
|
path: string;
|
|
611
707
|
};
|
|
612
708
|
|
|
613
|
-
export type APIResponse<T> = T & {
|
|
614
|
-
/** @deprecated - we plan to add a different way to access raw response information shortly. */
|
|
615
|
-
responseHeaders: Headers;
|
|
616
|
-
};
|
|
617
|
-
|
|
618
709
|
declare const Deno: any;
|
|
619
710
|
declare const EdgeRuntime: any;
|
|
620
711
|
type Arch = 'x32' | 'x64' | 'arm' | 'arm64' | `other:${string}` | 'unknown';
|
|
@@ -877,6 +968,12 @@ export function hasOwn(obj: Object, key: string): boolean {
|
|
|
877
968
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
878
969
|
}
|
|
879
970
|
|
|
971
|
+
export function debug(action: string, ...args: any[]) {
|
|
972
|
+
if (typeof process !== 'undefined' && process.env['DEBUG'] === 'true') {
|
|
973
|
+
console.log(`Increase:DEBUG:${action}`, ...args);
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
880
977
|
/**
|
|
881
978
|
* https://stackoverflow.com/a/2117523
|
|
882
979
|
*/
|
package/src/pagination.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless.
|
|
2
2
|
|
|
3
|
-
import { AbstractPage,
|
|
3
|
+
import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from './core';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A list of Account objects
|
|
@@ -35,11 +35,11 @@ export class Page<Item> extends AbstractPage<Item> implements PageResponse<Item>
|
|
|
35
35
|
*/
|
|
36
36
|
next_cursor: string | null;
|
|
37
37
|
|
|
38
|
-
constructor(client: APIClient, response:
|
|
39
|
-
super(client, response, options);
|
|
38
|
+
constructor(client: APIClient, response: Response, body: PageResponse<Item>, options: FinalRequestOptions) {
|
|
39
|
+
super(client, response, body, options);
|
|
40
40
|
|
|
41
|
-
this.data =
|
|
42
|
-
this.next_cursor =
|
|
41
|
+
this.data = body.data;
|
|
42
|
+
this.next_cursor = body.next_cursor;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
getPaginatedItems(): Item[] {
|
|
@@ -10,17 +10,14 @@ export class AccountNumbers extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Create an Account Number
|
|
12
12
|
*/
|
|
13
|
-
create(
|
|
14
|
-
body: AccountNumberCreateParams,
|
|
15
|
-
options?: Core.RequestOptions,
|
|
16
|
-
): Promise<Core.APIResponse<AccountNumber>> {
|
|
13
|
+
create(body: AccountNumberCreateParams, options?: Core.RequestOptions): Core.APIPromise<AccountNumber> {
|
|
17
14
|
return this.post('/account_numbers', { body, ...options });
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* Retrieve an Account Number
|
|
22
19
|
*/
|
|
23
|
-
retrieve(accountNumberId: string, options?: Core.RequestOptions):
|
|
20
|
+
retrieve(accountNumberId: string, options?: Core.RequestOptions): Core.APIPromise<AccountNumber> {
|
|
24
21
|
return this.get(`/account_numbers/${accountNumberId}`, options);
|
|
25
22
|
}
|
|
26
23
|
|
|
@@ -31,19 +28,22 @@ export class AccountNumbers extends APIResource {
|
|
|
31
28
|
accountNumberId: string,
|
|
32
29
|
body: AccountNumberUpdateParams,
|
|
33
30
|
options?: Core.RequestOptions,
|
|
34
|
-
):
|
|
31
|
+
): Core.APIPromise<AccountNumber> {
|
|
35
32
|
return this.patch(`/account_numbers/${accountNumberId}`, { body, ...options });
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
/**
|
|
39
36
|
* List Account Numbers
|
|
40
37
|
*/
|
|
41
|
-
list(
|
|
42
|
-
|
|
38
|
+
list(
|
|
39
|
+
query?: AccountNumberListParams,
|
|
40
|
+
options?: Core.RequestOptions,
|
|
41
|
+
): Core.PagePromise<AccountNumbersPage, AccountNumber>;
|
|
42
|
+
list(options?: Core.RequestOptions): Core.PagePromise<AccountNumbersPage, AccountNumber>;
|
|
43
43
|
list(
|
|
44
44
|
query: AccountNumberListParams | Core.RequestOptions = {},
|
|
45
45
|
options?: Core.RequestOptions,
|
|
46
|
-
): Core.PagePromise<AccountNumbersPage> {
|
|
46
|
+
): Core.PagePromise<AccountNumbersPage, AccountNumber> {
|
|
47
47
|
if (isRequestOptions(query)) {
|
|
48
48
|
return this.list({}, query);
|
|
49
49
|
}
|
|
@@ -10,10 +10,7 @@ export class AccountStatements extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Retrieve an Account Statement
|
|
12
12
|
*/
|
|
13
|
-
retrieve(
|
|
14
|
-
accountStatementId: string,
|
|
15
|
-
options?: Core.RequestOptions,
|
|
16
|
-
): Promise<Core.APIResponse<AccountStatement>> {
|
|
13
|
+
retrieve(accountStatementId: string, options?: Core.RequestOptions): Core.APIPromise<AccountStatement> {
|
|
17
14
|
return this.get(`/account_statements/${accountStatementId}`, options);
|
|
18
15
|
}
|
|
19
16
|
|
|
@@ -23,12 +20,12 @@ export class AccountStatements extends APIResource {
|
|
|
23
20
|
list(
|
|
24
21
|
query?: AccountStatementListParams,
|
|
25
22
|
options?: Core.RequestOptions,
|
|
26
|
-
): Core.PagePromise<AccountStatementsPage>;
|
|
27
|
-
list(options?: Core.RequestOptions): Core.PagePromise<AccountStatementsPage>;
|
|
23
|
+
): Core.PagePromise<AccountStatementsPage, AccountStatement>;
|
|
24
|
+
list(options?: Core.RequestOptions): Core.PagePromise<AccountStatementsPage, AccountStatement>;
|
|
28
25
|
list(
|
|
29
26
|
query: AccountStatementListParams | Core.RequestOptions = {},
|
|
30
27
|
options?: Core.RequestOptions,
|
|
31
|
-
): Core.PagePromise<AccountStatementsPage> {
|
|
28
|
+
): Core.PagePromise<AccountStatementsPage, AccountStatement> {
|
|
32
29
|
if (isRequestOptions(query)) {
|
|
33
30
|
return this.list({}, query);
|
|
34
31
|
}
|
|
@@ -10,20 +10,14 @@ export class AccountTransfers extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Create an Account Transfer
|
|
12
12
|
*/
|
|
13
|
-
create(
|
|
14
|
-
body: AccountTransferCreateParams,
|
|
15
|
-
options?: Core.RequestOptions,
|
|
16
|
-
): Promise<Core.APIResponse<AccountTransfer>> {
|
|
13
|
+
create(body: AccountTransferCreateParams, options?: Core.RequestOptions): Core.APIPromise<AccountTransfer> {
|
|
17
14
|
return this.post('/account_transfers', { body, ...options });
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* Retrieve an Account Transfer
|
|
22
19
|
*/
|
|
23
|
-
retrieve(
|
|
24
|
-
accountTransferId: string,
|
|
25
|
-
options?: Core.RequestOptions,
|
|
26
|
-
): Promise<Core.APIResponse<AccountTransfer>> {
|
|
20
|
+
retrieve(accountTransferId: string, options?: Core.RequestOptions): Core.APIPromise<AccountTransfer> {
|
|
27
21
|
return this.get(`/account_transfers/${accountTransferId}`, options);
|
|
28
22
|
}
|
|
29
23
|
|
|
@@ -33,12 +27,12 @@ export class AccountTransfers extends APIResource {
|
|
|
33
27
|
list(
|
|
34
28
|
query?: AccountTransferListParams,
|
|
35
29
|
options?: Core.RequestOptions,
|
|
36
|
-
): Core.PagePromise<AccountTransfersPage>;
|
|
37
|
-
list(options?: Core.RequestOptions): Core.PagePromise<AccountTransfersPage>;
|
|
30
|
+
): Core.PagePromise<AccountTransfersPage, AccountTransfer>;
|
|
31
|
+
list(options?: Core.RequestOptions): Core.PagePromise<AccountTransfersPage, AccountTransfer>;
|
|
38
32
|
list(
|
|
39
33
|
query: AccountTransferListParams | Core.RequestOptions = {},
|
|
40
34
|
options?: Core.RequestOptions,
|
|
41
|
-
): Core.PagePromise<AccountTransfersPage> {
|
|
35
|
+
): Core.PagePromise<AccountTransfersPage, AccountTransfer> {
|
|
42
36
|
if (isRequestOptions(query)) {
|
|
43
37
|
return this.list({}, query);
|
|
44
38
|
}
|
|
@@ -48,20 +42,14 @@ export class AccountTransfers extends APIResource {
|
|
|
48
42
|
/**
|
|
49
43
|
* Approve an Account Transfer
|
|
50
44
|
*/
|
|
51
|
-
approve(
|
|
52
|
-
accountTransferId: string,
|
|
53
|
-
options?: Core.RequestOptions,
|
|
54
|
-
): Promise<Core.APIResponse<AccountTransfer>> {
|
|
45
|
+
approve(accountTransferId: string, options?: Core.RequestOptions): Core.APIPromise<AccountTransfer> {
|
|
55
46
|
return this.post(`/account_transfers/${accountTransferId}/approve`, options);
|
|
56
47
|
}
|
|
57
48
|
|
|
58
49
|
/**
|
|
59
50
|
* Cancel an Account Transfer
|
|
60
51
|
*/
|
|
61
|
-
cancel(
|
|
62
|
-
accountTransferId: string,
|
|
63
|
-
options?: Core.RequestOptions,
|
|
64
|
-
): Promise<Core.APIResponse<AccountTransfer>> {
|
|
52
|
+
cancel(accountTransferId: string, options?: Core.RequestOptions): Core.APIPromise<AccountTransfer> {
|
|
65
53
|
return this.post(`/account_transfers/${accountTransferId}/cancel`, options);
|
|
66
54
|
}
|
|
67
55
|
}
|
|
@@ -10,14 +10,14 @@ export class Accounts extends APIResource {
|
|
|
10
10
|
/**
|
|
11
11
|
* Create an Account
|
|
12
12
|
*/
|
|
13
|
-
create(body: AccountCreateParams, options?: Core.RequestOptions):
|
|
13
|
+
create(body: AccountCreateParams, options?: Core.RequestOptions): Core.APIPromise<Account> {
|
|
14
14
|
return this.post('/accounts', { body, ...options });
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Retrieve an Account
|
|
19
19
|
*/
|
|
20
|
-
retrieve(accountId: string, options?: Core.RequestOptions):
|
|
20
|
+
retrieve(accountId: string, options?: Core.RequestOptions): Core.APIPromise<Account> {
|
|
21
21
|
return this.get(`/accounts/${accountId}`, options);
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -28,19 +28,19 @@ export class Accounts extends APIResource {
|
|
|
28
28
|
accountId: string,
|
|
29
29
|
body: AccountUpdateParams,
|
|
30
30
|
options?: Core.RequestOptions,
|
|
31
|
-
):
|
|
31
|
+
): Core.APIPromise<Account> {
|
|
32
32
|
return this.patch(`/accounts/${accountId}`, { body, ...options });
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* List Accounts
|
|
37
37
|
*/
|
|
38
|
-
list(query?: AccountListParams, options?: Core.RequestOptions): Core.PagePromise<AccountsPage>;
|
|
39
|
-
list(options?: Core.RequestOptions): Core.PagePromise<AccountsPage>;
|
|
38
|
+
list(query?: AccountListParams, options?: Core.RequestOptions): Core.PagePromise<AccountsPage, Account>;
|
|
39
|
+
list(options?: Core.RequestOptions): Core.PagePromise<AccountsPage, Account>;
|
|
40
40
|
list(
|
|
41
41
|
query: AccountListParams | Core.RequestOptions = {},
|
|
42
42
|
options?: Core.RequestOptions,
|
|
43
|
-
): Core.PagePromise<AccountsPage> {
|
|
43
|
+
): Core.PagePromise<AccountsPage, Account> {
|
|
44
44
|
if (isRequestOptions(query)) {
|
|
45
45
|
return this.list({}, query);
|
|
46
46
|
}
|
|
@@ -50,7 +50,7 @@ export class Accounts extends APIResource {
|
|
|
50
50
|
/**
|
|
51
51
|
* Close an Account
|
|
52
52
|
*/
|
|
53
|
-
close(accountId: string, options?: Core.RequestOptions):
|
|
53
|
+
close(accountId: string, options?: Core.RequestOptions): Core.APIPromise<Account> {
|
|
54
54
|
return this.post(`/accounts/${accountId}/close`, options);
|
|
55
55
|
}
|
|
56
56
|
}
|