dodopayments 0.11.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 +22 -0
- package/LICENSE +201 -0
- package/README.md +362 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +89 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +241 -0
- package/core.d.ts.map +1 -0
- package/core.js +899 -0
- package/core.js.map +1 -0
- package/core.mjs +867 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +47 -0
- package/error.d.ts.map +1 -0
- package/error.js +113 -0
- package/error.js.map +1 -0
- package/error.mjs +97 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +152 -0
- package/index.d.ts +152 -0
- package/index.d.ts.map +1 -0
- package/index.js +165 -0
- package/index.js.map +1 -0
- package/index.mjs +122 -0
- package/index.mjs.map +1 -0
- package/package.json +103 -0
- package/pagination.d.ts +16 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +33 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +29 -0
- package/pagination.mjs.map +1 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/customers.d.ts +24 -0
- package/resources/customers.d.ts.map +1 -0
- package/resources/customers.js +24 -0
- package/resources/customers.js.map +1 -0
- package/resources/customers.mjs +19 -0
- package/resources/customers.mjs.map +1 -0
- package/resources/disputes.d.ts +26 -0
- package/resources/disputes.d.ts.map +1 -0
- package/resources/disputes.js +24 -0
- package/resources/disputes.js.map +1 -0
- package/resources/disputes.mjs +19 -0
- package/resources/disputes.mjs.map +1 -0
- package/resources/index.d.ts +10 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +30 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +11 -0
- package/resources/index.mjs.map +1 -0
- package/resources/misc/index.d.ts +3 -0
- package/resources/misc/index.d.ts.map +1 -0
- package/resources/misc/index.js +9 -0
- package/resources/misc/index.js.map +1 -0
- package/resources/misc/index.mjs +4 -0
- package/resources/misc/index.mjs.map +1 -0
- package/resources/misc/misc.d.ts +10 -0
- package/resources/misc/misc.d.ts.map +1 -0
- package/resources/misc/misc.js +39 -0
- package/resources/misc/misc.js.map +1 -0
- package/resources/misc/misc.mjs +12 -0
- package/resources/misc/misc.mjs.map +1 -0
- package/resources/misc/supported-countries.d.ts +14 -0
- package/resources/misc/supported-countries.d.ts.map +1 -0
- package/resources/misc/supported-countries.js +12 -0
- package/resources/misc/supported-countries.js.map +1 -0
- package/resources/misc/supported-countries.mjs +8 -0
- package/resources/misc/supported-countries.mjs.map +1 -0
- package/resources/payments.d.ts +124 -0
- package/resources/payments.d.ts.map +1 -0
- package/resources/payments.js +30 -0
- package/resources/payments.js.map +1 -0
- package/resources/payments.mjs +25 -0
- package/resources/payments.mjs.map +1 -0
- package/resources/payouts.d.ts +32 -0
- package/resources/payouts.d.ts.map +1 -0
- package/resources/payouts.js +24 -0
- package/resources/payouts.js.map +1 -0
- package/resources/payouts.mjs +19 -0
- package/resources/payouts.mjs.map +1 -0
- package/resources/products/images.d.ts +12 -0
- package/resources/products/images.d.ts.map +1 -0
- package/resources/products/images.js +12 -0
- package/resources/products/images.js.map +1 -0
- package/resources/products/images.mjs +8 -0
- package/resources/products/images.mjs.map +1 -0
- package/resources/products/index.d.ts +3 -0
- package/resources/products/index.d.ts.map +1 -0
- package/resources/products/index.js +10 -0
- package/resources/products/index.js.map +1 -0
- package/resources/products/index.mjs +4 -0
- package/resources/products/index.mjs.map +1 -0
- package/resources/products/products.d.ts +164 -0
- package/resources/products/products.d.ts.map +1 -0
- package/resources/products/products.js +67 -0
- package/resources/products/products.js.map +1 -0
- package/resources/products/products.mjs +39 -0
- package/resources/products/products.mjs.map +1 -0
- package/resources/refunds.d.ts +32 -0
- package/resources/refunds.d.ts.map +1 -0
- package/resources/refunds.js +27 -0
- package/resources/refunds.js.map +1 -0
- package/resources/refunds.mjs +22 -0
- package/resources/refunds.mjs.map +1 -0
- package/resources/subscriptions.d.ts +87 -0
- package/resources/subscriptions.d.ts.map +1 -0
- package/resources/subscriptions.js +33 -0
- package/resources/subscriptions.js.map +1 -0
- package/resources/subscriptions.mjs +28 -0
- package/resources/subscriptions.mjs.map +1 -0
- package/resources/webhook-events.d.ts +38 -0
- package/resources/webhook-events.d.ts.map +1 -0
- package/resources/webhook-events.js +19 -0
- package/resources/webhook-events.js.map +1 -0
- package/resources/webhook-events.mjs +15 -0
- package/resources/webhook-events.mjs.map +1 -0
- package/shims/node.d.ts +30 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +81 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1191 -0
- package/src/error.ts +130 -0
- package/src/index.ts +366 -0
- package/src/lib/.keep +4 -0
- package/src/pagination.ts +52 -0
- package/src/resource.ts +11 -0
- package/src/resources/customers.ts +55 -0
- package/src/resources/disputes.ts +66 -0
- package/src/resources/index.ts +62 -0
- package/src/resources/misc/index.ts +8 -0
- package/src/resources/misc/misc.ts +21 -0
- package/src/resources/misc/supported-countries.ts +273 -0
- package/src/resources/payments.ts +533 -0
- package/src/resources/payouts.ts +219 -0
- package/src/resources/products/images.ts +18 -0
- package/src/resources/products/index.ts +13 -0
- package/src/resources/products/products.ts +1155 -0
- package/src/resources/refunds.ts +218 -0
- package/src/resources/subscriptions.ts +318 -0
- package/src/resources/webhook-events.ts +73 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +255 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +171 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +158 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,SAAS,CAAC;AAClC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,KAAK,iCAAiC,EAAE,mCAAmC,EAAE,MAAM,cAAc,CAAC;AAC3G,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,mBAAmB,CAAC;AACzC,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,SAAS,EACT,oCAAoC,EACrC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,QAAQ,EACR,mCAAmC,EACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,+CAA+C,EAC/C,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,8CAA8C,EAC9C,OAAO,EACR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,OAAO,EACP,kCAAkC,EACnC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,Y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AC5C,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,8CAA8C,IAAI,8CAA8C,EAChG,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;IAEF,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;IAEF,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,+CAA+C,IAAI,+CAA+C,EAClG,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;IAEF,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;CACzB;AAED,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,SAAS,CAAC;AAEjB,eAAe,YAAY,CAAC"}
|
package/index.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
var _a;
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.DodoPaymentsError = exports.fileFromPath = exports.toFile = exports.DodoPayments = void 0;
|
|
29
|
+
const Core = __importStar(require("./core.js"));
|
|
30
|
+
const Errors = __importStar(require("./error.js"));
|
|
31
|
+
const Pagination = __importStar(require("./pagination.js"));
|
|
32
|
+
const Uploads = __importStar(require("./uploads.js"));
|
|
33
|
+
const API = __importStar(require("./resources/index.js"));
|
|
34
|
+
const customers_1 = require("./resources/customers.js");
|
|
35
|
+
const disputes_1 = require("./resources/disputes.js");
|
|
36
|
+
const payments_1 = require("./resources/payments.js");
|
|
37
|
+
const payouts_1 = require("./resources/payouts.js");
|
|
38
|
+
const refunds_1 = require("./resources/refunds.js");
|
|
39
|
+
const subscriptions_1 = require("./resources/subscriptions.js");
|
|
40
|
+
const webhook_events_1 = require("./resources/webhook-events.js");
|
|
41
|
+
const misc_1 = require("./resources/misc/misc.js");
|
|
42
|
+
const products_1 = require("./resources/products/products.js");
|
|
43
|
+
const environments = {
|
|
44
|
+
live_mode: 'https://live.dodopayments.com/',
|
|
45
|
+
test_mode: 'https://test.dodopayments.com/',
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* API Client for interfacing with the Dodo Payments API.
|
|
49
|
+
*/
|
|
50
|
+
class DodoPayments extends Core.APIClient {
|
|
51
|
+
/**
|
|
52
|
+
* API Client for interfacing with the Dodo Payments API.
|
|
53
|
+
*
|
|
54
|
+
* @param {string | undefined} [opts.bearerToken=process.env['DOOD_PAYMENTS_API_KEY'] ?? undefined]
|
|
55
|
+
* @param {Environment} [opts.environment=live_mode] - Specifies the environment URL to use for the API.
|
|
56
|
+
* @param {string} [opts.baseURL=process.env['DODO_PAYMENTS_BASE_URL'] ?? https://live.dodopayments.com/] - Override the default base URL for the API.
|
|
57
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
58
|
+
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
59
|
+
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
60
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
61
|
+
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
62
|
+
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
63
|
+
*/
|
|
64
|
+
constructor({ baseURL = Core.readEnv('DODO_PAYMENTS_BASE_URL'), bearerToken = Core.readEnv('DOOD_PAYMENTS_API_KEY'), ...opts } = {}) {
|
|
65
|
+
if (bearerToken === undefined) {
|
|
66
|
+
throw new Errors.DodoPaymentsError("The DOOD_PAYMENTS_API_KEY environment variable is missing or empty; either provide it, or instantiate the DodoPayments client with an bearerToken option, like new DodoPayments({ bearerToken: 'My Bearer Token' }).");
|
|
67
|
+
}
|
|
68
|
+
const options = {
|
|
69
|
+
bearerToken,
|
|
70
|
+
...opts,
|
|
71
|
+
baseURL,
|
|
72
|
+
environment: opts.environment ?? 'live_mode',
|
|
73
|
+
};
|
|
74
|
+
if (baseURL && opts.environment) {
|
|
75
|
+
throw new Errors.DodoPaymentsError('Ambiguous URL; The `baseURL` option (or DODO_PAYMENTS_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null');
|
|
76
|
+
}
|
|
77
|
+
super({
|
|
78
|
+
baseURL: options.baseURL || environments[options.environment || 'live_mode'],
|
|
79
|
+
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
80
|
+
httpAgent: options.httpAgent,
|
|
81
|
+
maxRetries: options.maxRetries,
|
|
82
|
+
fetch: options.fetch,
|
|
83
|
+
});
|
|
84
|
+
this.payments = new API.Payments(this);
|
|
85
|
+
this.subscriptions = new API.Subscriptions(this);
|
|
86
|
+
this.customers = new API.Customers(this);
|
|
87
|
+
this.refunds = new API.Refunds(this);
|
|
88
|
+
this.disputes = new API.Disputes(this);
|
|
89
|
+
this.payouts = new API.Payouts(this);
|
|
90
|
+
this.webhookEvents = new API.WebhookEvents(this);
|
|
91
|
+
this.products = new API.Products(this);
|
|
92
|
+
this.misc = new API.Misc(this);
|
|
93
|
+
this._options = options;
|
|
94
|
+
this.bearerToken = bearerToken;
|
|
95
|
+
}
|
|
96
|
+
defaultQuery() {
|
|
97
|
+
return this._options.defaultQuery;
|
|
98
|
+
}
|
|
99
|
+
defaultHeaders(opts) {
|
|
100
|
+
return {
|
|
101
|
+
...super.defaultHeaders(opts),
|
|
102
|
+
...this._options.defaultHeaders,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
authHeaders(opts) {
|
|
106
|
+
return { Authorization: `Bearer ${this.bearerToken}` };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.DodoPayments = DodoPayments;
|
|
110
|
+
_a = DodoPayments;
|
|
111
|
+
DodoPayments.DodoPayments = _a;
|
|
112
|
+
DodoPayments.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
113
|
+
DodoPayments.DodoPaymentsError = Errors.DodoPaymentsError;
|
|
114
|
+
DodoPayments.APIError = Errors.APIError;
|
|
115
|
+
DodoPayments.APIConnectionError = Errors.APIConnectionError;
|
|
116
|
+
DodoPayments.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
117
|
+
DodoPayments.APIUserAbortError = Errors.APIUserAbortError;
|
|
118
|
+
DodoPayments.NotFoundError = Errors.NotFoundError;
|
|
119
|
+
DodoPayments.ConflictError = Errors.ConflictError;
|
|
120
|
+
DodoPayments.RateLimitError = Errors.RateLimitError;
|
|
121
|
+
DodoPayments.BadRequestError = Errors.BadRequestError;
|
|
122
|
+
DodoPayments.AuthenticationError = Errors.AuthenticationError;
|
|
123
|
+
DodoPayments.InternalServerError = Errors.InternalServerError;
|
|
124
|
+
DodoPayments.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
125
|
+
DodoPayments.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
126
|
+
DodoPayments.toFile = Uploads.toFile;
|
|
127
|
+
DodoPayments.fileFromPath = Uploads.fileFromPath;
|
|
128
|
+
DodoPayments.Payments = payments_1.Payments;
|
|
129
|
+
DodoPayments.PaymentListResponsesDefaultPageNumberPagination =
|
|
130
|
+
payments_1.PaymentListResponsesDefaultPageNumberPagination;
|
|
131
|
+
DodoPayments.Subscriptions = subscriptions_1.Subscriptions;
|
|
132
|
+
DodoPayments.SubscriptionsDefaultPageNumberPagination = subscriptions_1.SubscriptionsDefaultPageNumberPagination;
|
|
133
|
+
DodoPayments.Customers = customers_1.Customers;
|
|
134
|
+
DodoPayments.CustomersDefaultPageNumberPagination = customers_1.CustomersDefaultPageNumberPagination;
|
|
135
|
+
DodoPayments.Refunds = refunds_1.Refunds;
|
|
136
|
+
DodoPayments.RefundsDefaultPageNumberPagination = refunds_1.RefundsDefaultPageNumberPagination;
|
|
137
|
+
DodoPayments.Disputes = disputes_1.Disputes;
|
|
138
|
+
DodoPayments.DisputesDefaultPageNumberPagination = disputes_1.DisputesDefaultPageNumberPagination;
|
|
139
|
+
DodoPayments.Payouts = payouts_1.Payouts;
|
|
140
|
+
DodoPayments.PayoutListResponsesDefaultPageNumberPagination = payouts_1.PayoutListResponsesDefaultPageNumberPagination;
|
|
141
|
+
DodoPayments.WebhookEvents = webhook_events_1.WebhookEvents;
|
|
142
|
+
DodoPayments.Products = products_1.Products;
|
|
143
|
+
DodoPayments.ProductListResponsesDefaultPageNumberPagination =
|
|
144
|
+
products_1.ProductListResponsesDefaultPageNumberPagination;
|
|
145
|
+
DodoPayments.Misc = misc_1.Misc;
|
|
146
|
+
var uploads_1 = require("./uploads.js");
|
|
147
|
+
Object.defineProperty(exports, "toFile", { enumerable: true, get: function () { return uploads_1.toFile; } });
|
|
148
|
+
Object.defineProperty(exports, "fileFromPath", { enumerable: true, get: function () { return uploads_1.fileFromPath; } });
|
|
149
|
+
var error_1 = require("./error.js");
|
|
150
|
+
Object.defineProperty(exports, "DodoPaymentsError", { enumerable: true, get: function () { return error_1.DodoPaymentsError; } });
|
|
151
|
+
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
|
152
|
+
Object.defineProperty(exports, "APIConnectionError", { enumerable: true, get: function () { return error_1.APIConnectionError; } });
|
|
153
|
+
Object.defineProperty(exports, "APIConnectionTimeoutError", { enumerable: true, get: function () { return error_1.APIConnectionTimeoutError; } });
|
|
154
|
+
Object.defineProperty(exports, "APIUserAbortError", { enumerable: true, get: function () { return error_1.APIUserAbortError; } });
|
|
155
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return error_1.NotFoundError; } });
|
|
156
|
+
Object.defineProperty(exports, "ConflictError", { enumerable: true, get: function () { return error_1.ConflictError; } });
|
|
157
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_1.RateLimitError; } });
|
|
158
|
+
Object.defineProperty(exports, "BadRequestError", { enumerable: true, get: function () { return error_1.BadRequestError; } });
|
|
159
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return error_1.AuthenticationError; } });
|
|
160
|
+
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
161
|
+
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
162
|
+
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
163
|
+
exports = module.exports = DodoPayments;
|
|
164
|
+
exports.default = DodoPayments;
|
|
165
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtF,gDAA+B;AAC/B,mDAAkC;AAClC,4DAA2C;AAE3C,sDAAqC;AACrC,0DAAyC;AACzC,wDAK+B;AAC/B,sDAK8B;AAC9B,sDAQ8B;AAC9B,oDAK6B;AAC7B,oDAM6B;AAC7B,gEAQmC;AACnC,kEAKoC;AACpC,mDAA6C;AAC7C,+DASuC;AAEvC,MAAM,YAAY,GAAG;IACnB,SAAS,EAAE,gCAAgC;IAC3C,SAAS,EAAE,gCAAgC;CAC5C,CAAC;AA0EF;;GAEG;AACH,MAAa,YAAa,SAAQ,IAAI,CAAC,SAAS;IAK9C;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,EAChD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC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,YAAY,CAAC"}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
var _a;
|
|
3
|
+
import * as Core from "./core.mjs";
|
|
4
|
+
import * as Errors from "./error.mjs";
|
|
5
|
+
import * as Pagination from "./pagination.mjs";
|
|
6
|
+
import * as Uploads from "./uploads.mjs";
|
|
7
|
+
import * as API from "./resources/index.mjs";
|
|
8
|
+
import { Customers, CustomersDefaultPageNumberPagination, } from "./resources/customers.mjs";
|
|
9
|
+
import { Disputes, DisputesDefaultPageNumberPagination, } from "./resources/disputes.mjs";
|
|
10
|
+
import { PaymentListResponsesDefaultPageNumberPagination, Payments, } from "./resources/payments.mjs";
|
|
11
|
+
import { PayoutListResponsesDefaultPageNumberPagination, Payouts, } from "./resources/payouts.mjs";
|
|
12
|
+
import { Refunds, RefundsDefaultPageNumberPagination, } from "./resources/refunds.mjs";
|
|
13
|
+
import { Subscriptions, SubscriptionsDefaultPageNumberPagination, } from "./resources/subscriptions.mjs";
|
|
14
|
+
import { WebhookEvents, } from "./resources/webhook-events.mjs";
|
|
15
|
+
import { Misc } from "./resources/misc/misc.mjs";
|
|
16
|
+
import { ProductListResponsesDefaultPageNumberPagination, Products, } from "./resources/products/products.mjs";
|
|
17
|
+
const environments = {
|
|
18
|
+
live_mode: 'https://live.dodopayments.com/',
|
|
19
|
+
test_mode: 'https://test.dodopayments.com/',
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* API Client for interfacing with the Dodo Payments API.
|
|
23
|
+
*/
|
|
24
|
+
export class DodoPayments extends Core.APIClient {
|
|
25
|
+
/**
|
|
26
|
+
* API Client for interfacing with the Dodo Payments API.
|
|
27
|
+
*
|
|
28
|
+
* @param {string | undefined} [opts.bearerToken=process.env['DOOD_PAYMENTS_API_KEY'] ?? undefined]
|
|
29
|
+
* @param {Environment} [opts.environment=live_mode] - Specifies the environment URL to use for the API.
|
|
30
|
+
* @param {string} [opts.baseURL=process.env['DODO_PAYMENTS_BASE_URL'] ?? https://live.dodopayments.com/] - Override the default base URL for the API.
|
|
31
|
+
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
32
|
+
* @param {number} [opts.httpAgent] - An HTTP agent used to manage HTTP(s) connections.
|
|
33
|
+
* @param {Core.Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
34
|
+
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
|
|
35
|
+
* @param {Core.Headers} opts.defaultHeaders - Default headers to include with every request to the API.
|
|
36
|
+
* @param {Core.DefaultQuery} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
37
|
+
*/
|
|
38
|
+
constructor({ baseURL = Core.readEnv('DODO_PAYMENTS_BASE_URL'), bearerToken = Core.readEnv('DOOD_PAYMENTS_API_KEY'), ...opts } = {}) {
|
|
39
|
+
if (bearerToken === undefined) {
|
|
40
|
+
throw new Errors.DodoPaymentsError("The DOOD_PAYMENTS_API_KEY environment variable is missing or empty; either provide it, or instantiate the DodoPayments client with an bearerToken option, like new DodoPayments({ bearerToken: 'My Bearer Token' }).");
|
|
41
|
+
}
|
|
42
|
+
const options = {
|
|
43
|
+
bearerToken,
|
|
44
|
+
...opts,
|
|
45
|
+
baseURL,
|
|
46
|
+
environment: opts.environment ?? 'live_mode',
|
|
47
|
+
};
|
|
48
|
+
if (baseURL && opts.environment) {
|
|
49
|
+
throw new Errors.DodoPaymentsError('Ambiguous URL; The `baseURL` option (or DODO_PAYMENTS_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null');
|
|
50
|
+
}
|
|
51
|
+
super({
|
|
52
|
+
baseURL: options.baseURL || environments[options.environment || 'live_mode'],
|
|
53
|
+
timeout: options.timeout ?? 60000 /* 1 minute */,
|
|
54
|
+
httpAgent: options.httpAgent,
|
|
55
|
+
maxRetries: options.maxRetries,
|
|
56
|
+
fetch: options.fetch,
|
|
57
|
+
});
|
|
58
|
+
this.payments = new API.Payments(this);
|
|
59
|
+
this.subscriptions = new API.Subscriptions(this);
|
|
60
|
+
this.customers = new API.Customers(this);
|
|
61
|
+
this.refunds = new API.Refunds(this);
|
|
62
|
+
this.disputes = new API.Disputes(this);
|
|
63
|
+
this.payouts = new API.Payouts(this);
|
|
64
|
+
this.webhookEvents = new API.WebhookEvents(this);
|
|
65
|
+
this.products = new API.Products(this);
|
|
66
|
+
this.misc = new API.Misc(this);
|
|
67
|
+
this._options = options;
|
|
68
|
+
this.bearerToken = bearerToken;
|
|
69
|
+
}
|
|
70
|
+
defaultQuery() {
|
|
71
|
+
return this._options.defaultQuery;
|
|
72
|
+
}
|
|
73
|
+
defaultHeaders(opts) {
|
|
74
|
+
return {
|
|
75
|
+
...super.defaultHeaders(opts),
|
|
76
|
+
...this._options.defaultHeaders,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
authHeaders(opts) {
|
|
80
|
+
return { Authorization: `Bearer ${this.bearerToken}` };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
_a = DodoPayments;
|
|
84
|
+
DodoPayments.DodoPayments = _a;
|
|
85
|
+
DodoPayments.DEFAULT_TIMEOUT = 60000; // 1 minute
|
|
86
|
+
DodoPayments.DodoPaymentsError = Errors.DodoPaymentsError;
|
|
87
|
+
DodoPayments.APIError = Errors.APIError;
|
|
88
|
+
DodoPayments.APIConnectionError = Errors.APIConnectionError;
|
|
89
|
+
DodoPayments.APIConnectionTimeoutError = Errors.APIConnectionTimeoutError;
|
|
90
|
+
DodoPayments.APIUserAbortError = Errors.APIUserAbortError;
|
|
91
|
+
DodoPayments.NotFoundError = Errors.NotFoundError;
|
|
92
|
+
DodoPayments.ConflictError = Errors.ConflictError;
|
|
93
|
+
DodoPayments.RateLimitError = Errors.RateLimitError;
|
|
94
|
+
DodoPayments.BadRequestError = Errors.BadRequestError;
|
|
95
|
+
DodoPayments.AuthenticationError = Errors.AuthenticationError;
|
|
96
|
+
DodoPayments.InternalServerError = Errors.InternalServerError;
|
|
97
|
+
DodoPayments.PermissionDeniedError = Errors.PermissionDeniedError;
|
|
98
|
+
DodoPayments.UnprocessableEntityError = Errors.UnprocessableEntityError;
|
|
99
|
+
DodoPayments.toFile = Uploads.toFile;
|
|
100
|
+
DodoPayments.fileFromPath = Uploads.fileFromPath;
|
|
101
|
+
DodoPayments.Payments = Payments;
|
|
102
|
+
DodoPayments.PaymentListResponsesDefaultPageNumberPagination =
|
|
103
|
+
PaymentListResponsesDefaultPageNumberPagination;
|
|
104
|
+
DodoPayments.Subscriptions = Subscriptions;
|
|
105
|
+
DodoPayments.SubscriptionsDefaultPageNumberPagination = SubscriptionsDefaultPageNumberPagination;
|
|
106
|
+
DodoPayments.Customers = Customers;
|
|
107
|
+
DodoPayments.CustomersDefaultPageNumberPagination = CustomersDefaultPageNumberPagination;
|
|
108
|
+
DodoPayments.Refunds = Refunds;
|
|
109
|
+
DodoPayments.RefundsDefaultPageNumberPagination = RefundsDefaultPageNumberPagination;
|
|
110
|
+
DodoPayments.Disputes = Disputes;
|
|
111
|
+
DodoPayments.DisputesDefaultPageNumberPagination = DisputesDefaultPageNumberPagination;
|
|
112
|
+
DodoPayments.Payouts = Payouts;
|
|
113
|
+
DodoPayments.PayoutListResponsesDefaultPageNumberPagination = PayoutListResponsesDefaultPageNumberPagination;
|
|
114
|
+
DodoPayments.WebhookEvents = WebhookEvents;
|
|
115
|
+
DodoPayments.Products = Products;
|
|
116
|
+
DodoPayments.ProductListResponsesDefaultPageNumberPagination =
|
|
117
|
+
ProductListResponsesDefaultPageNumberPagination;
|
|
118
|
+
DodoPayments.Misc = Misc;
|
|
119
|
+
export { toFile, fileFromPath } from "./uploads.mjs";
|
|
120
|
+
export { DodoPaymentsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./error.mjs";
|
|
121
|
+
export default DodoPayments;
|
|
122
|
+
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;;OAG/E,KAAK,IAAI;OACT,KAAK,MAAM;OACX,KAAK,UAAU;OAEf,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAGL,SAAS,EACT,oCAAoC,GACrC;OACM,EAGL,QAAQ,EACR,mCAAmC,GACpC;OACM,EAML,+CAA+C,EAC/C,QAAQ,GACT;OACM,EAGL,8CAA8C,EAC9C,OAAO,GACR;OACM,EAIL,OAAO,EACP,kCAAkC,GACnC;OACM,EAML,aAAa,EACb,wCAAwC,GACzC;OACM,EAIL,aAAa,GACd;OACM,EAAE,IAAI,EAAE;OACR,EAML,+CAA+C,EAE/C,QAAQ,GACT;AAED,MAAM,YAAY,GAAG;IACnB,SAAS,EAAE,gCAAgC;IAC3C,SAAS,EAAE,gCAAgC;CAC5C,CAAC;AA0EF;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,SAAS;IAK9C;;;;;;;;;;;;OAYG;IACH,YAAY,EACV,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,EAChD,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,EACnD,GAAG,IAAI,KACU,EAAE;QACnB,IAAI,WAAW,KAAK,SAAS,EAAE;YAC7B,MAAM,IAAI,MAAM,CAAC,iBAAiB,CAChC,sNAAsN,CACvN,CAAC;SACH;QAED,MAAM,OAAO,GAAkB;YAC7B,WAAW;YACX,GAAG,IAAI;YACP,OAAO;YACP,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,WAAW;SAC7C,CAAC;QAEF,IAAI,OAAO,IAAI,IAAI,CAAC,WAAW,EAAE;YAC/B,MAAM,IAAI,MAAM,CAAC,iBAAiB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,CAAC;AAC/B,YAAY,CAAC,kCAAkC,GAAG,kCAAkC,CAAC;AACrF,YAAY,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACjC,YAAY,CAAC,mCAAmC,GAAG,mCAAmC,CAAC;AACvF,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;AAC/B,YAAY,CAAC,8CAA8C,GAAG,8CAA8C,CAAC;AAC7G,YAAY,CAAC,aAAa,GAAG,aAAa,CAAC;AAC3C,YAAY,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACjC,YAAY,CAAC,+CAA+C;IAC1D,+CAA+C,CAAC;AAClD,YAAY,CAAC,IAAI,GAAG,IAAI,CAAC;OAgFlB,EAAE,MAAM,EAAE,YAAY,EAAE;OACxB,EACL,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB;AAED,eAAe,YAAY,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dodopayments",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"description": "The official TypeScript library for the Dodo Payments API",
|
|
5
|
+
"author": "Dodo Payments <founders@dodopayments.com>",
|
|
6
|
+
"types": "./index.d.ts",
|
|
7
|
+
"main": "./index.js",
|
|
8
|
+
"type": "commonjs",
|
|
9
|
+
"repository": "github:dodopayments/dodopayments-node",
|
|
10
|
+
"license": "Apache-2.0",
|
|
11
|
+
"packageManager": "yarn@1.22.22",
|
|
12
|
+
"files": [
|
|
13
|
+
"**/*"
|
|
14
|
+
],
|
|
15
|
+
"private": false,
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "./scripts/test",
|
|
18
|
+
"build": "./scripts/build",
|
|
19
|
+
"format": "prettier --write --cache --cache-strategy metadata . !dist",
|
|
20
|
+
"tsn": "ts-node -r tsconfig-paths/register",
|
|
21
|
+
"lint": "./scripts/lint",
|
|
22
|
+
"fix": "./scripts/format"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@types/node": "^18.11.18",
|
|
26
|
+
"@types/node-fetch": "^2.6.4",
|
|
27
|
+
"abort-controller": "^3.0.0",
|
|
28
|
+
"agentkeepalive": "^4.2.1",
|
|
29
|
+
"form-data-encoder": "1.7.2",
|
|
30
|
+
"formdata-node": "^4.3.2",
|
|
31
|
+
"node-fetch": "^2.6.7"
|
|
32
|
+
},
|
|
33
|
+
"sideEffects": [
|
|
34
|
+
"./_shims/index.js",
|
|
35
|
+
"./_shims/index.mjs",
|
|
36
|
+
"./shims/node.js",
|
|
37
|
+
"./shims/node.mjs",
|
|
38
|
+
"./shims/web.js",
|
|
39
|
+
"./shims/web.mjs"
|
|
40
|
+
],
|
|
41
|
+
"imports": {
|
|
42
|
+
"dodopayments": ".",
|
|
43
|
+
"dodopayments/*": "./src/*"
|
|
44
|
+
},
|
|
45
|
+
"exports": {
|
|
46
|
+
"./_shims/auto/*": {
|
|
47
|
+
"deno": {
|
|
48
|
+
"types": "./_shims/auto/*.d.ts",
|
|
49
|
+
"require": "./_shims/auto/*.js",
|
|
50
|
+
"default": "./_shims/auto/*.mjs"
|
|
51
|
+
},
|
|
52
|
+
"bun": {
|
|
53
|
+
"types": "./_shims/auto/*.d.ts",
|
|
54
|
+
"require": "./_shims/auto/*-bun.js",
|
|
55
|
+
"default": "./_shims/auto/*-bun.mjs"
|
|
56
|
+
},
|
|
57
|
+
"browser": {
|
|
58
|
+
"types": "./_shims/auto/*.d.ts",
|
|
59
|
+
"require": "./_shims/auto/*.js",
|
|
60
|
+
"default": "./_shims/auto/*.mjs"
|
|
61
|
+
},
|
|
62
|
+
"worker": {
|
|
63
|
+
"types": "./_shims/auto/*.d.ts",
|
|
64
|
+
"require": "./_shims/auto/*.js",
|
|
65
|
+
"default": "./_shims/auto/*.mjs"
|
|
66
|
+
},
|
|
67
|
+
"workerd": {
|
|
68
|
+
"types": "./_shims/auto/*.d.ts",
|
|
69
|
+
"require": "./_shims/auto/*.js",
|
|
70
|
+
"default": "./_shims/auto/*.mjs"
|
|
71
|
+
},
|
|
72
|
+
"node": {
|
|
73
|
+
"types": "./_shims/auto/*-node.d.ts",
|
|
74
|
+
"require": "./_shims/auto/*-node.js",
|
|
75
|
+
"default": "./_shims/auto/*-node.mjs"
|
|
76
|
+
},
|
|
77
|
+
"types": "./_shims/auto/*.d.ts",
|
|
78
|
+
"require": "./_shims/auto/*.js",
|
|
79
|
+
"default": "./_shims/auto/*.mjs"
|
|
80
|
+
},
|
|
81
|
+
".": {
|
|
82
|
+
"require": {
|
|
83
|
+
"types": "./index.d.ts",
|
|
84
|
+
"default": "./index.js"
|
|
85
|
+
},
|
|
86
|
+
"types": "./index.d.mts",
|
|
87
|
+
"default": "./index.mjs"
|
|
88
|
+
},
|
|
89
|
+
"./*.mjs": {
|
|
90
|
+
"types": "./*.d.ts",
|
|
91
|
+
"default": "./*.mjs"
|
|
92
|
+
},
|
|
93
|
+
"./*.js": {
|
|
94
|
+
"types": "./*.d.ts",
|
|
95
|
+
"default": "./*.js"
|
|
96
|
+
},
|
|
97
|
+
"./*": {
|
|
98
|
+
"types": "./*.d.ts",
|
|
99
|
+
"require": "./*.js",
|
|
100
|
+
"default": "./*.mjs"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
package/pagination.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractPage, Response, APIClient, FinalRequestOptions, PageInfo } from "./core.js";
|
|
2
|
+
export interface DefaultPageNumberPaginationResponse<Item> {
|
|
3
|
+
items: Array<Item>;
|
|
4
|
+
}
|
|
5
|
+
export interface DefaultPageNumberPaginationParams {
|
|
6
|
+
page_number?: number;
|
|
7
|
+
page_size?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class DefaultPageNumberPagination<Item> extends AbstractPage<Item> implements DefaultPageNumberPaginationResponse<Item> {
|
|
10
|
+
items: Array<Item>;
|
|
11
|
+
constructor(client: APIClient, response: Response, body: DefaultPageNumberPaginationResponse<Item>, options: FinalRequestOptions);
|
|
12
|
+
getPaginatedItems(): Item[];
|
|
13
|
+
nextPageParams(): Partial<DefaultPageNumberPaginationParams> | null;
|
|
14
|
+
nextPageInfo(): PageInfo | null;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAE1F,MAAM,WAAW,mCAAmC,CAAC,IAAI;IACvD,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,2BAA2B,CAAC,IAAI,CAC3C,SAAQ,YAAY,CAAC,IAAI,CACzB,YAAW,mCAAmC,CAAC,IAAI,CAAC;IAEpD,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;gBAGjB,MAAM,EAAE,SAAS,EACjB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,mCAAmC,CAAC,IAAI,CAAC,EAC/C,OAAO,EAAE,mBAAmB;IAO9B,iBAAiB,IAAI,IAAI,EAAE;IAK3B,cAAc,IAAI,OAAO,CAAC,iCAAiC,CAAC,GAAG,IAAI;IASnE,YAAY,IAAI,QAAQ,GAAG,IAAI;CAMhC"}
|
package/pagination.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.DefaultPageNumberPagination = void 0;
|
|
5
|
+
const core_1 = require("./core.js");
|
|
6
|
+
class DefaultPageNumberPagination extends core_1.AbstractPage {
|
|
7
|
+
constructor(client, response, body, options) {
|
|
8
|
+
super(client, response, body, options);
|
|
9
|
+
this.items = body.items || [];
|
|
10
|
+
}
|
|
11
|
+
getPaginatedItems() {
|
|
12
|
+
return this.items ?? [];
|
|
13
|
+
}
|
|
14
|
+
// @deprecated Please use `nextPageInfo()` instead
|
|
15
|
+
nextPageParams() {
|
|
16
|
+
const info = this.nextPageInfo();
|
|
17
|
+
if (!info)
|
|
18
|
+
return null;
|
|
19
|
+
if ('params' in info)
|
|
20
|
+
return info.params;
|
|
21
|
+
const params = Object.fromEntries(info.url.searchParams);
|
|
22
|
+
if (!Object.keys(params).length)
|
|
23
|
+
return null;
|
|
24
|
+
return params;
|
|
25
|
+
}
|
|
26
|
+
nextPageInfo() {
|
|
27
|
+
const query = this.options.query;
|
|
28
|
+
const currentPage = query?.page_number ?? 1;
|
|
29
|
+
return { params: { page_number: currentPage + 1 } };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.DefaultPageNumberPagination = DefaultPageNumberPagination;
|
|
33
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAA0F;AAY1F,MAAa,2BACX,SAAQ,mBAAkB;IAK1B,YACE,MAAiB,EACjB,QAAkB,EAClB,IAA+C,EAC/C,OAA4B;QAE5B,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAClD,cAAc;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,QAAQ,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,YAAY;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAA0C,CAAC;QACtE,MAAM,WAAW,GAAG,KAAK,EAAE,WAAW,IAAI,CAAC,CAAC;QAE5C,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,EAAE,EAAE,CAAC;IACtD,CAAC;CACF;AArCD,kEAqCC"}
|
package/pagination.mjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { AbstractPage } from "./core.mjs";
|
|
3
|
+
export class DefaultPageNumberPagination extends AbstractPage {
|
|
4
|
+
constructor(client, response, body, options) {
|
|
5
|
+
super(client, response, body, options);
|
|
6
|
+
this.items = body.items || [];
|
|
7
|
+
}
|
|
8
|
+
getPaginatedItems() {
|
|
9
|
+
return this.items ?? [];
|
|
10
|
+
}
|
|
11
|
+
// @deprecated Please use `nextPageInfo()` instead
|
|
12
|
+
nextPageParams() {
|
|
13
|
+
const info = this.nextPageInfo();
|
|
14
|
+
if (!info)
|
|
15
|
+
return null;
|
|
16
|
+
if ('params' in info)
|
|
17
|
+
return info.params;
|
|
18
|
+
const params = Object.fromEntries(info.url.searchParams);
|
|
19
|
+
if (!Object.keys(params).length)
|
|
20
|
+
return null;
|
|
21
|
+
return params;
|
|
22
|
+
}
|
|
23
|
+
nextPageInfo() {
|
|
24
|
+
const query = this.options.query;
|
|
25
|
+
const currentPage = query?.page_number ?? 1;
|
|
26
|
+
return { params: { page_number: currentPage + 1 } };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=pagination.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,YAAY,EAAsD;AAY3E,MAAM,OAAO,2BACX,SAAQ,YAAkB;IAK1B,YACE,MAAiB,EACjB,QAAkB,EAClB,IAA+C,EAC/C,OAA4B;QAE5B,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEvC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAChC,CAAC;IAED,iBAAiB;QACf,OAAO,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;IAC1B,CAAC;IAED,kDAAkD;IAClD,cAAc;QACZ,MAAM,IAAI,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACjC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QACvB,IAAI,QAAQ,IAAI,IAAI;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC7C,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,YAAY;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAA0C,CAAC;QACtE,MAAM,WAAW,GAAG,KAAK,EAAE,WAAW,IAAI,CAAC,CAAC;QAE5C,OAAO,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,WAAW,GAAG,CAAC,EAAE,EAAE,CAAC;IACtD,CAAC;CACF"}
|
package/resource.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,qBAAa,WAAW;IACtB,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;gBAEpB,MAAM,EAAE,YAAY;CAGjC"}
|
package/resource.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.APIResource = void 0;
|
|
5
|
+
class APIResource {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this._client = client;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.APIResource = APIResource;
|
|
11
|
+
//# sourceMappingURL=resource.js.map
|
package/resource.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.js","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAItF,MAAa,WAAW;IAGtB,YAAY,MAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF;AAND,kCAMC"}
|
package/resource.mjs
ADDED
package/resource.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.mjs","sourceRoot":"","sources":["src/resource.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAItF,MAAM,OAAO,WAAW;IAGtB,YAAY,MAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { APIResource } from "../resource.js";
|
|
2
|
+
import * as Core from "../core.js";
|
|
3
|
+
import { DefaultPageNumberPagination, type DefaultPageNumberPaginationParams } from "../pagination.js";
|
|
4
|
+
export declare class Customers extends APIResource {
|
|
5
|
+
retrieve(customerId: string, options?: Core.RequestOptions): Core.APIPromise<Customer>;
|
|
6
|
+
list(query?: CustomerListParams, options?: Core.RequestOptions): Core.PagePromise<CustomersDefaultPageNumberPagination, Customer>;
|
|
7
|
+
list(options?: Core.RequestOptions): Core.PagePromise<CustomersDefaultPageNumberPagination, Customer>;
|
|
8
|
+
}
|
|
9
|
+
export declare class CustomersDefaultPageNumberPagination extends DefaultPageNumberPagination<Customer> {
|
|
10
|
+
}
|
|
11
|
+
export interface Customer {
|
|
12
|
+
business_id: string;
|
|
13
|
+
created_at: string;
|
|
14
|
+
customer_id: string;
|
|
15
|
+
email: string;
|
|
16
|
+
name: string;
|
|
17
|
+
phone_number?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface CustomerListParams extends DefaultPageNumberPaginationParams {
|
|
20
|
+
}
|
|
21
|
+
export declare namespace Customers {
|
|
22
|
+
export { type Customer as Customer, CustomersDefaultPageNumberPagination as CustomersDefaultPageNumberPagination, type CustomerListParams as CustomerListParams, };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=customers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../src/resources/customers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,KAAK,iCAAiC,EAAE,MAAM,eAAe,CAAC;AAEpG,qBAAa,SAAU,SAAQ,WAAW;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;IAItF,IAAI,CACF,KAAK,CAAC,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,WAAW,CAAC,oCAAoC,EAAE,QAAQ,CAAC;IACnE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,oCAAoC,EAAE,QAAQ,CAAC;CAUtG;AAED,qBAAa,oCAAqC,SAAQ,2BAA2B,CAAC,QAAQ,CAAC;CAAG;AAElG,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IAEpB,UAAU,EAAE,MAAM,CAAC;IAEnB,WAAW,EAAE,MAAM,CAAC;IAEpB,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,MAAM,CAAC;IAEb,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,kBAAmB,SAAQ,iCAAiC;CAAG;AAIhF,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,OAAO,EACL,KAAK,QAAQ,IAAI,QAAQ,EACzB,oCAAoC,IAAI,oCAAoC,EAC5E,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CustomersDefaultPageNumberPagination = exports.Customers = void 0;
|
|
5
|
+
const resource_1 = require("../resource.js");
|
|
6
|
+
const core_1 = require("../core.js");
|
|
7
|
+
const pagination_1 = require("../pagination.js");
|
|
8
|
+
class Customers extends resource_1.APIResource {
|
|
9
|
+
retrieve(customerId, options) {
|
|
10
|
+
return this._client.get(`/customers/${customerId}`, options);
|
|
11
|
+
}
|
|
12
|
+
list(query = {}, options) {
|
|
13
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
|
14
|
+
return this.list({}, query);
|
|
15
|
+
}
|
|
16
|
+
return this._client.getAPIList('/customers', CustomersDefaultPageNumberPagination, { query, ...options });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Customers = Customers;
|
|
20
|
+
class CustomersDefaultPageNumberPagination extends pagination_1.DefaultPageNumberPagination {
|
|
21
|
+
}
|
|
22
|
+
exports.CustomersDefaultPageNumberPagination = CustomersDefaultPageNumberPagination;
|
|
23
|
+
Customers.CustomersDefaultPageNumberPagination = CustomersDefaultPageNumberPagination;
|
|
24
|
+
//# sourceMappingURL=customers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customers.js","sourceRoot":"","sources":["../src/resources/customers.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAC1C,qCAA2C;AAE3C,iDAAoG;AAEpG,MAAa,SAAU,SAAQ,sBAAW;IACxC,QAAQ,CAAC,UAAkB,EAAE,OAA6B;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAOD,IAAI,CACF,QAAkD,EAAE,EACpD,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,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE,oCAAoC,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5G,CAAC;CACF;AAnBD,8BAmBC;AAED,MAAa,oCAAqC,SAAQ,wCAAqC;CAAG;AAAlG,oFAAkG;AAkBlG,SAAS,CAAC,oCAAoC,GAAG,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../resource.mjs";
|
|
3
|
+
import { isRequestOptions } from "../core.mjs";
|
|
4
|
+
import { DefaultPageNumberPagination } from "../pagination.mjs";
|
|
5
|
+
export class Customers extends APIResource {
|
|
6
|
+
retrieve(customerId, options) {
|
|
7
|
+
return this._client.get(`/customers/${customerId}`, options);
|
|
8
|
+
}
|
|
9
|
+
list(query = {}, options) {
|
|
10
|
+
if (isRequestOptions(query)) {
|
|
11
|
+
return this.list({}, query);
|
|
12
|
+
}
|
|
13
|
+
return this._client.getAPIList('/customers', CustomersDefaultPageNumberPagination, { query, ...options });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class CustomersDefaultPageNumberPagination extends DefaultPageNumberPagination {
|
|
17
|
+
}
|
|
18
|
+
Customers.CustomersDefaultPageNumberPagination = CustomersDefaultPageNumberPagination;
|
|
19
|
+
//# sourceMappingURL=customers.mjs.map
|