orb-billing 1.24.2 → 1.26.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 +24 -0
- package/README.md +40 -2
- package/core.d.ts +1 -0
- package/core.d.ts.map +1 -1
- package/core.js +5 -1
- package/core.js.map +1 -1
- package/core.mjs +5 -1
- package/core.mjs.map +1 -1
- package/error.d.ts +7 -0
- package/error.d.ts.map +1 -1
- package/error.js +15 -1
- package/error.js.map +1 -1
- package/error.mjs +13 -0
- package/error.mjs.map +1 -1
- package/index.d.mts +5 -4
- package/index.d.ts +5 -4
- package/index.d.ts.map +1 -1
- package/index.js +4 -3
- package/index.js.map +1 -1
- package/index.mjs +3 -2
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/customers/credits/ledger.d.ts +2 -2
- package/resources/events/events.d.ts +7 -49
- package/resources/events/events.d.ts.map +1 -1
- package/resources/events/events.js +23 -20
- package/resources/events/events.js.map +1 -1
- package/resources/events/events.mjs +23 -20
- package/resources/events/events.mjs.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +2 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/items.d.ts +18 -25
- package/resources/items.d.ts.map +1 -1
- package/resources/items.js +11 -5
- package/resources/items.js.map +1 -1
- package/resources/items.mjs +9 -3
- package/resources/items.mjs.map +1 -1
- package/resources/metrics.d.ts +4 -60
- package/resources/metrics.d.ts.map +1 -1
- package/resources/metrics.js.map +1 -1
- package/resources/metrics.mjs.map +1 -1
- package/resources/subscriptions.d.ts +1 -1
- package/src/core.ts +11 -2
- package/src/error.ts +29 -0
- package/src/index.ts +5 -3
- package/src/resources/customers/credits/ledger.ts +2 -2
- package/src/resources/events/events.ts +8 -88
- package/src/resources/index.ts +1 -1
- package/src/resources/items.ts +23 -42
- package/src/resources/metrics.ts +4 -99
- package/src/resources/subscriptions.ts +1 -1
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/resources/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.TopLevel = exports.SubscriptionFetchScheduleResponsesPage = exports.SubscriptionsPage = exports.Subscriptions = exports.Prices = exports.PricesPage = exports.Plans = exports.PlansPage = exports.Metrics = exports.MetricListResponsesPage = exports.Items = exports.
|
|
18
|
+
exports.TopLevel = exports.SubscriptionFetchScheduleResponsesPage = exports.SubscriptionsPage = exports.Subscriptions = exports.Prices = exports.PricesPage = exports.Plans = exports.PlansPage = exports.Metrics = exports.MetricListResponsesPage = exports.Items = exports.ItemsPage = exports.InvoiceLineItems = exports.Invoices = exports.InvoicesPage = exports.Events = exports.Customers = exports.CustomersPage = exports.CreditNotes = exports.CreditNotesPage = exports.Coupons = exports.CouponsPage = void 0;
|
|
19
19
|
__exportStar(require("./shared.js"), exports);
|
|
20
20
|
var coupons_1 = require("./coupons/coupons.js");
|
|
21
21
|
Object.defineProperty(exports, "CouponsPage", { enumerable: true, get: function () { return coupons_1.CouponsPage; } });
|
|
@@ -34,7 +34,7 @@ Object.defineProperty(exports, "Invoices", { enumerable: true, get: function ()
|
|
|
34
34
|
var invoice_line_items_1 = require("./invoice-line-items.js");
|
|
35
35
|
Object.defineProperty(exports, "InvoiceLineItems", { enumerable: true, get: function () { return invoice_line_items_1.InvoiceLineItems; } });
|
|
36
36
|
var items_1 = require("./items.js");
|
|
37
|
-
Object.defineProperty(exports, "
|
|
37
|
+
Object.defineProperty(exports, "ItemsPage", { enumerable: true, get: function () { return items_1.ItemsPage; } });
|
|
38
38
|
Object.defineProperty(exports, "Items", { enumerable: true, get: function () { return items_1.Items; } });
|
|
39
39
|
var metrics_1 = require("./metrics.js");
|
|
40
40
|
Object.defineProperty(exports, "MetricListResponsesPage", { enumerable: true, get: function () { return metrics_1.MetricListResponsesPage; } });
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;AAErD,8CAAyB;AACzB,gDAAuG;AAAhD,sGAAA,WAAW,OAAA;AAAE,kGAAA,OAAO,OAAA;AAC3E,kDAAgG;AAArD,+GAAA,eAAe,OAAA;AAAE,2GAAA,WAAW,OAAA;AACvE,sDAQ+B;AAF7B,0GAAA,aAAa,OAAA;AACb,sGAAA,SAAS,OAAA;AAEX,6CASyB;AADvB,gGAAA,MAAM,OAAA;AAER,0CASoB;AAFlB,wGAAA,YAAY,OAAA;AACZ,oGAAA,QAAQ,OAAA;AAEV,8DAI8B;AAD5B,sHAAA,gBAAgB,OAAA;AAElB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;AAErD,8CAAyB;AACzB,gDAAuG;AAAhD,sGAAA,WAAW,OAAA;AAAE,kGAAA,OAAO,OAAA;AAC3E,kDAAgG;AAArD,+GAAA,eAAe,OAAA;AAAE,2GAAA,WAAW,OAAA;AACvE,sDAQ+B;AAF7B,0GAAA,aAAa,OAAA;AACb,sGAAA,SAAS,OAAA;AAEX,6CASyB;AADvB,gGAAA,MAAM,OAAA;AAER,0CASoB;AAFlB,wGAAA,YAAY,OAAA;AACZ,oGAAA,QAAQ,OAAA;AAEV,8DAI8B;AAD5B,sHAAA,gBAAgB,OAAA;AAElB,oCAAmF;AAAlC,kGAAA,SAAS,OAAA;AAAE,8FAAA,KAAK,OAAA;AACjE,wCAQmB;AAFjB,kHAAA,uBAAuB,OAAA;AACvB,kGAAA,OAAO,OAAA;AAET,0CAA2G;AAAxC,kGAAA,SAAS,OAAA;AAAE,8FAAA,KAAK,OAAA;AACnF,6CAAgG;AAA5C,oGAAA,UAAU,OAAA;AAAE,gGAAA,MAAM,OAAA;AACtE,oDAmByB;AAhBvB,8GAAA,aAAa,OAAA;AAcb,kHAAA,iBAAiB,OAAA;AACjB,uIAAA,sCAAsC,OAAA;AAExC,4CAA6D;AAA9B,qGAAA,QAAQ,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ export { CustomersPage, Customers, } from "./customers/customers.mjs";
|
|
|
6
6
|
export { Events, } from "./events/events.mjs";
|
|
7
7
|
export { InvoicesPage, Invoices, } from "./invoices.mjs";
|
|
8
8
|
export { InvoiceLineItems, } from "./invoice-line-items.mjs";
|
|
9
|
-
export {
|
|
9
|
+
export { ItemsPage, Items } from "./items.mjs";
|
|
10
10
|
export { MetricListResponsesPage, Metrics, } from "./metrics.mjs";
|
|
11
11
|
export { PlansPage, Plans } from "./plans/plans.mjs";
|
|
12
12
|
export { PricesPage, Prices } from "./prices/prices.mjs";
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;;OAG9C,EAAgD,WAAW,EAAE,OAAO,EAAE;OACtE,EAAoC,eAAe,EAAE,WAAW,EAAE;OAClE,EAML,aAAa,EACb,SAAS,GACV;OACM,EAQL,MAAM,GACP;OACM,EAOL,YAAY,EACZ,QAAQ,GACT;OACM,EAGL,gBAAgB,GACjB;OACM,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;;OAG9C,EAAgD,WAAW,EAAE,OAAO,EAAE;OACtE,EAAoC,eAAe,EAAE,WAAW,EAAE;OAClE,EAML,aAAa,EACb,SAAS,GACV;OACM,EAQL,MAAM,GACP;OACM,EAOL,YAAY,EACZ,QAAQ,GACT;OACM,EAGL,gBAAgB,GACjB;OACM,EAA0C,SAAS,EAAE,KAAK,EAAE;OAC5D,EAML,uBAAuB,EACvB,OAAO,GACR;OACM,EAA4D,SAAS,EAAE,KAAK,EAAE;OAC9E,EAA6C,UAAU,EAAE,MAAM,EAAE;OACjE,EAGL,aAAa,EAcb,iBAAiB,EACjB,sCAAsC,GACvC;OACM,EAAwB,QAAQ,EAAE"}
|
package/resources/items.d.ts
CHANGED
|
@@ -3,59 +3,52 @@ import { APIResource } from 'orb-billing/resource';
|
|
|
3
3
|
import * as ItemsAPI from 'orb-billing/resources/items';
|
|
4
4
|
import { Page, type PageParams } from 'orb-billing/pagination';
|
|
5
5
|
export declare class Items extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* This endpoint is used to create an [Item](../guides/concepts#item).
|
|
8
|
+
*/
|
|
9
|
+
create(body: ItemCreateParams, options?: Core.RequestOptions): Core.APIPromise<Item>;
|
|
6
10
|
/**
|
|
7
11
|
* This endpoint returns a list of all Items, ordered in descending order by
|
|
8
12
|
* creation time.
|
|
9
13
|
*/
|
|
10
|
-
list(query?: ItemListParams, options?: Core.RequestOptions): Core.PagePromise<
|
|
11
|
-
list(options?: Core.RequestOptions): Core.PagePromise<
|
|
14
|
+
list(query?: ItemListParams, options?: Core.RequestOptions): Core.PagePromise<ItemsPage, Item>;
|
|
15
|
+
list(options?: Core.RequestOptions): Core.PagePromise<ItemsPage, Item>;
|
|
12
16
|
/**
|
|
13
17
|
* This endpoint returns an item identified by its item_id.
|
|
14
18
|
*/
|
|
15
|
-
fetch(itemId: string, options?: Core.RequestOptions): Core.APIPromise<
|
|
19
|
+
fetch(itemId: string, options?: Core.RequestOptions): Core.APIPromise<Item>;
|
|
16
20
|
}
|
|
17
|
-
export declare class
|
|
21
|
+
export declare class ItemsPage extends Page<Item> {
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
24
|
* The Item resource represents a sellable product or good. Items are associated
|
|
21
25
|
* with all line items, billable metrics, and prices and are used for defining
|
|
22
26
|
* external sync behavior for invoices and tax calculation purposes.
|
|
23
27
|
*/
|
|
24
|
-
export interface
|
|
28
|
+
export interface Item {
|
|
25
29
|
id: string;
|
|
26
30
|
created_at: string;
|
|
27
|
-
external_connections: Array<
|
|
31
|
+
external_connections: Array<Item.ExternalConnection>;
|
|
28
32
|
name: string;
|
|
29
33
|
}
|
|
30
|
-
export declare namespace
|
|
34
|
+
export declare namespace Item {
|
|
31
35
|
interface ExternalConnection {
|
|
32
36
|
external_connection_name: 'stripe' | 'quickbooks' | 'bill.com' | 'netsuite' | 'taxjar' | 'avalara' | 'anrok';
|
|
33
37
|
external_entity_id: string;
|
|
34
38
|
}
|
|
35
39
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*/
|
|
41
|
-
export interface ItemFetchResponse {
|
|
42
|
-
id: string;
|
|
43
|
-
created_at: string;
|
|
44
|
-
external_connections: Array<ItemFetchResponse.ExternalConnection>;
|
|
40
|
+
export interface ItemCreateParams {
|
|
41
|
+
/**
|
|
42
|
+
* The name of the item.
|
|
43
|
+
*/
|
|
45
44
|
name: string;
|
|
46
45
|
}
|
|
47
|
-
export declare namespace ItemFetchResponse {
|
|
48
|
-
interface ExternalConnection {
|
|
49
|
-
external_connection_name: 'stripe' | 'quickbooks' | 'bill.com' | 'netsuite' | 'taxjar' | 'avalara' | 'anrok';
|
|
50
|
-
external_entity_id: string;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
46
|
export interface ItemListParams extends PageParams {
|
|
54
47
|
}
|
|
55
48
|
export declare namespace Items {
|
|
56
|
-
export import
|
|
57
|
-
export import
|
|
58
|
-
export import
|
|
49
|
+
export import Item = ItemsAPI.Item;
|
|
50
|
+
export import ItemsPage = ItemsAPI.ItemsPage;
|
|
51
|
+
export import ItemCreateParams = ItemsAPI.ItemCreateParams;
|
|
59
52
|
export import ItemListParams = ItemsAPI.ItemListParams;
|
|
60
53
|
}
|
|
61
54
|
//# sourceMappingURL=items.d.ts.map
|
package/resources/items.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../src/resources/items.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE/D,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;OAGG;IACH,IAAI,
|
|
1
|
+
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../src/resources/items.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,QAAQ,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,KAAK,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE/D,qBAAa,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAIpF;;;OAGG;IACH,IAAI,CAAC,KAAK,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC;IAC9F,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC;IAWtE;;OAEG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;CAG5E;AAED,qBAAa,SAAU,SAAQ,IAAI,CAAC,IAAI,CAAC;CAAG;AAE5C;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IAEX,UAAU,EAAE,MAAM,CAAC;IAEnB,oBAAoB,EAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAErD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,yBAAiB,IAAI,CAAC;IACpB,UAAiB,kBAAkB;QACjC,wBAAwB,EACpB,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,GACT,OAAO,CAAC;QAEZ,kBAAkB,EAAE,MAAM,CAAC;KAC5B;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU;CAAG;AAErD,yBAAiB,KAAK,CAAC;IACrB,MAAM,QAAQ,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;IACnC,MAAM,QAAQ,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;IAC7C,MAAM,QAAQ,gBAAgB,GAAG,QAAQ,CAAC,gBAAgB,CAAC;IAC3D,MAAM,QAAQ,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAC;CACxD"}
|
package/resources/items.js
CHANGED
|
@@ -24,17 +24,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
return result;
|
|
25
25
|
};
|
|
26
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.
|
|
27
|
+
exports.ItemsPage = exports.Items = void 0;
|
|
28
28
|
const resource_1 = require("orb-billing/resource");
|
|
29
29
|
const core_1 = require("orb-billing/core");
|
|
30
30
|
const ItemsAPI = __importStar(require("orb-billing/resources/items"));
|
|
31
31
|
const pagination_1 = require("orb-billing/pagination");
|
|
32
32
|
class Items extends resource_1.APIResource {
|
|
33
|
+
/**
|
|
34
|
+
* This endpoint is used to create an [Item](../guides/concepts#item).
|
|
35
|
+
*/
|
|
36
|
+
create(body, options) {
|
|
37
|
+
return this.post('/items', { body, ...options });
|
|
38
|
+
}
|
|
33
39
|
list(query = {}, options) {
|
|
34
40
|
if ((0, core_1.isRequestOptions)(query)) {
|
|
35
41
|
return this.list({}, query);
|
|
36
42
|
}
|
|
37
|
-
return this.getAPIList('/items',
|
|
43
|
+
return this.getAPIList('/items', ItemsPage, { query, ...options });
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
46
|
* This endpoint returns an item identified by its item_id.
|
|
@@ -44,10 +50,10 @@ class Items extends resource_1.APIResource {
|
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
exports.Items = Items;
|
|
47
|
-
class
|
|
53
|
+
class ItemsPage extends pagination_1.Page {
|
|
48
54
|
}
|
|
49
|
-
exports.
|
|
55
|
+
exports.ItemsPage = ItemsPage;
|
|
50
56
|
(function (Items) {
|
|
51
|
-
Items.
|
|
57
|
+
Items.ItemsPage = ItemsAPI.ItemsPage;
|
|
52
58
|
})(Items = exports.Items || (exports.Items = {}));
|
|
53
59
|
//# sourceMappingURL=items.js.map
|
package/resources/items.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.js","sourceRoot":"","sources":["../src/resources/items.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGrD,mDAAmD;AACnD,2CAAoD;AACpD,sEAAwD;AACxD,uDAA+D;AAE/D,MAAa,KAAM,SAAQ,sBAAW;
|
|
1
|
+
{"version":3,"file":"items.js","sourceRoot":"","sources":["../src/resources/items.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGrD,mDAAmD;AACnD,2CAAoD;AACpD,sEAAwD;AACxD,uDAA+D;AAE/D,MAAa,KAAM,SAAQ,sBAAW;IACpC;;OAEG;IACH,MAAM,CAAC,IAAsB,EAAE,OAA6B;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;IAQD,IAAI,CACF,QAA8C,EAAE,EAChD,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,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAc,EAAE,OAA6B;QACjD,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF;AA9BD,sBA8BC;AAED,MAAa,SAAU,SAAQ,iBAAU;CAAG;AAA5C,8BAA4C;AAyC5C,WAAiB,KAAK;IAEN,eAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AAG/C,CAAC,EALgB,KAAK,GAAL,aAAK,KAAL,aAAK,QAKrB"}
|
package/resources/items.mjs
CHANGED
|
@@ -4,11 +4,17 @@ import { isRequestOptions } from 'orb-billing/core';
|
|
|
4
4
|
import * as ItemsAPI from 'orb-billing/resources/items';
|
|
5
5
|
import { Page } from 'orb-billing/pagination';
|
|
6
6
|
export class Items extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* This endpoint is used to create an [Item](../guides/concepts#item).
|
|
9
|
+
*/
|
|
10
|
+
create(body, options) {
|
|
11
|
+
return this.post('/items', { body, ...options });
|
|
12
|
+
}
|
|
7
13
|
list(query = {}, options) {
|
|
8
14
|
if (isRequestOptions(query)) {
|
|
9
15
|
return this.list({}, query);
|
|
10
16
|
}
|
|
11
|
-
return this.getAPIList('/items',
|
|
17
|
+
return this.getAPIList('/items', ItemsPage, { query, ...options });
|
|
12
18
|
}
|
|
13
19
|
/**
|
|
14
20
|
* This endpoint returns an item identified by its item_id.
|
|
@@ -17,9 +23,9 @@ export class Items extends APIResource {
|
|
|
17
23
|
return this.get(`/items/${itemId}`, options);
|
|
18
24
|
}
|
|
19
25
|
}
|
|
20
|
-
export class
|
|
26
|
+
export class ItemsPage extends Page {
|
|
21
27
|
}
|
|
22
28
|
(function (Items) {
|
|
23
|
-
Items.
|
|
29
|
+
Items.ItemsPage = ItemsAPI.ItemsPage;
|
|
24
30
|
})(Items || (Items = {}));
|
|
25
31
|
//# sourceMappingURL=items.mjs.map
|
package/resources/items.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"items.mjs","sourceRoot":"","sources":["../src/resources/items.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAC3C,EAAE,gBAAgB,EAAE,MAAM,kBAAkB;OAC5C,KAAK,QAAQ,MAAM,6BAA6B;OAChD,EAAE,IAAI,EAAmB,MAAM,wBAAwB;AAE9D,MAAM,OAAO,KAAM,SAAQ,WAAW;
|
|
1
|
+
{"version":3,"file":"items.mjs","sourceRoot":"","sources":["../src/resources/items.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAC3C,EAAE,gBAAgB,EAAE,MAAM,kBAAkB;OAC5C,KAAK,QAAQ,MAAM,6BAA6B;OAChD,EAAE,IAAI,EAAmB,MAAM,wBAAwB;AAE9D,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,MAAM,CAAC,IAAsB,EAAE,OAA6B;QAC1D,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnD,CAAC;IAQD,IAAI,CACF,QAA8C,EAAE,EAChD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAc,EAAE,OAA6B;QACjD,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,OAAO,SAAU,SAAQ,IAAU;CAAG;AAyC5C,WAAiB,KAAK;IAEN,eAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AAG/C,CAAC,EALgB,KAAK,KAAL,KAAK,QAKrB"}
|
package/resources/metrics.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Core from 'orb-billing/core';
|
|
2
2
|
import { APIResource } from 'orb-billing/resource';
|
|
3
3
|
import * as MetricsAPI from 'orb-billing/resources/metrics';
|
|
4
|
+
import * as ItemsAPI from 'orb-billing/resources/items';
|
|
4
5
|
import { Page, type PageParams } from 'orb-billing/pagination';
|
|
5
6
|
export declare class Metrics extends APIResource {
|
|
6
7
|
/**
|
|
@@ -38,30 +39,11 @@ export interface MetricCreateResponse {
|
|
|
38
39
|
* with all line items, billable metrics, and prices and are used for defining
|
|
39
40
|
* external sync behavior for invoices and tax calculation purposes.
|
|
40
41
|
*/
|
|
41
|
-
item:
|
|
42
|
+
item: ItemsAPI.Item;
|
|
42
43
|
metadata: Record<string, string>;
|
|
43
44
|
name: string;
|
|
44
45
|
status: 'active' | 'draft' | 'archived';
|
|
45
46
|
}
|
|
46
|
-
export declare namespace MetricCreateResponse {
|
|
47
|
-
/**
|
|
48
|
-
* The Item resource represents a sellable product or good. Items are associated
|
|
49
|
-
* with all line items, billable metrics, and prices and are used for defining
|
|
50
|
-
* external sync behavior for invoices and tax calculation purposes.
|
|
51
|
-
*/
|
|
52
|
-
interface Item {
|
|
53
|
-
id: string;
|
|
54
|
-
created_at: string;
|
|
55
|
-
external_connections: Array<Item.ExternalConnection>;
|
|
56
|
-
name: string;
|
|
57
|
-
}
|
|
58
|
-
namespace Item {
|
|
59
|
-
interface ExternalConnection {
|
|
60
|
-
external_connection_name: 'stripe' | 'quickbooks' | 'bill.com' | 'netsuite' | 'taxjar' | 'avalara' | 'anrok';
|
|
61
|
-
external_entity_id: string;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
47
|
/**
|
|
66
48
|
* The Metric resource represents a calculation of a quantity based on events.
|
|
67
49
|
* Metrics are defined by the query that transforms raw usage events into
|
|
@@ -75,30 +57,11 @@ export interface MetricListResponse {
|
|
|
75
57
|
* with all line items, billable metrics, and prices and are used for defining
|
|
76
58
|
* external sync behavior for invoices and tax calculation purposes.
|
|
77
59
|
*/
|
|
78
|
-
item:
|
|
60
|
+
item: ItemsAPI.Item;
|
|
79
61
|
metadata: Record<string, string>;
|
|
80
62
|
name: string;
|
|
81
63
|
status: 'active' | 'draft' | 'archived';
|
|
82
64
|
}
|
|
83
|
-
export declare namespace MetricListResponse {
|
|
84
|
-
/**
|
|
85
|
-
* The Item resource represents a sellable product or good. Items are associated
|
|
86
|
-
* with all line items, billable metrics, and prices and are used for defining
|
|
87
|
-
* external sync behavior for invoices and tax calculation purposes.
|
|
88
|
-
*/
|
|
89
|
-
interface Item {
|
|
90
|
-
id: string;
|
|
91
|
-
created_at: string;
|
|
92
|
-
external_connections: Array<Item.ExternalConnection>;
|
|
93
|
-
name: string;
|
|
94
|
-
}
|
|
95
|
-
namespace Item {
|
|
96
|
-
interface ExternalConnection {
|
|
97
|
-
external_connection_name: 'stripe' | 'quickbooks' | 'bill.com' | 'netsuite' | 'taxjar' | 'avalara' | 'anrok';
|
|
98
|
-
external_entity_id: string;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
65
|
/**
|
|
103
66
|
* The Metric resource represents a calculation of a quantity based on events.
|
|
104
67
|
* Metrics are defined by the query that transforms raw usage events into
|
|
@@ -112,30 +75,11 @@ export interface MetricFetchResponse {
|
|
|
112
75
|
* with all line items, billable metrics, and prices and are used for defining
|
|
113
76
|
* external sync behavior for invoices and tax calculation purposes.
|
|
114
77
|
*/
|
|
115
|
-
item:
|
|
78
|
+
item: ItemsAPI.Item;
|
|
116
79
|
metadata: Record<string, string>;
|
|
117
80
|
name: string;
|
|
118
81
|
status: 'active' | 'draft' | 'archived';
|
|
119
82
|
}
|
|
120
|
-
export declare namespace MetricFetchResponse {
|
|
121
|
-
/**
|
|
122
|
-
* The Item resource represents a sellable product or good. Items are associated
|
|
123
|
-
* with all line items, billable metrics, and prices and are used for defining
|
|
124
|
-
* external sync behavior for invoices and tax calculation purposes.
|
|
125
|
-
*/
|
|
126
|
-
interface Item {
|
|
127
|
-
id: string;
|
|
128
|
-
created_at: string;
|
|
129
|
-
external_connections: Array<Item.ExternalConnection>;
|
|
130
|
-
name: string;
|
|
131
|
-
}
|
|
132
|
-
namespace Item {
|
|
133
|
-
interface ExternalConnection {
|
|
134
|
-
external_connection_name: 'stripe' | 'quickbooks' | 'bill.com' | 'netsuite' | 'taxjar' | 'avalara' | 'anrok';
|
|
135
|
-
external_entity_id: string;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
83
|
export interface MetricCreateParams {
|
|
140
84
|
/**
|
|
141
85
|
* A description of the metric.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,KAAK,UAAU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AU,CAAC,kBAAkB,CAAC;IACjE,MAAM,QAAQ,gBAAgB,GAAG,UAAU,CAAC,gBAAgB,CAAC;CAC9D"}
|
package/resources/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGrD,mDAAmD;AACnD,2CAAoD;AACpD,0EAA4D;
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;;;;;;;;;;;;;;;;;;;;;;;;AAGrD,mDAAmD;AACnD,2CAAoD;AACpD,0EAA4D;AAE5D,uDAA+D;AAE/D,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;OAKG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAYD,IAAI,CACF,QAAgD,EAAE,EAClD,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,UAAU,EAAE,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAgB,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAtCD,0BAsCC;AAED,MAAa,uBAAwB,SAAQ,iBAAwB;CAAG;AAAxE,0DAAwE;AAgHxE,WAAiB,OAAO;IAIR,+BAAuB,GAAG,UAAU,CAAC,uBAAuB,CAAC;AAG7E,CAAC,EAPgB,OAAO,GAAP,eAAO,KAAP,eAAO,QAOvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.mjs","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAC3C,EAAE,gBAAgB,EAAE,MAAM,kBAAkB;OAC5C,KAAK,UAAU,MAAM,+BAA+B;
|
|
1
|
+
{"version":3,"file":"metrics.mjs","sourceRoot":"","sources":["../src/resources/metrics.ts"],"names":[],"mappings":"AAAA,qDAAqD;OAG9C,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAC3C,EAAE,gBAAgB,EAAE,MAAM,kBAAkB;OAC5C,KAAK,UAAU,MAAM,+BAA+B;OAEpD,EAAE,IAAI,EAAmB,MAAM,wBAAwB;AAE9D,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;OAKG;IACH,MAAM,CAAC,IAAwB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;IAYD,IAAI,CACF,QAAgD,EAAE,EAClD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,uBAAuB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrF,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAgB,EAAE,OAA6B;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;CACF;AAED,MAAM,OAAO,uBAAwB,SAAQ,IAAwB;CAAG;AAgHxE,WAAiB,OAAO;IAIR,+BAAuB,GAAG,UAAU,CAAC,uBAAuB,CAAC;AAG7E,CAAC,EAPgB,OAAO,KAAP,OAAO,QAOvB"}
|
|
@@ -395,7 +395,7 @@ export declare class Subscriptions extends APIResource {
|
|
|
395
395
|
* Orb supports invoicing for a subscription when a preconfigured usage threshold
|
|
396
396
|
* is hit. To enable threshold billing, pass in an `invoicing_threshold`, which is
|
|
397
397
|
* specified in the subscription's invoicing currency, when creating a
|
|
398
|
-
* subscription.
|
|
398
|
+
* subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit
|
|
399
399
|
* $10.00 for a subscription that invoices in USD.
|
|
400
400
|
*/
|
|
401
401
|
create(body?: SubscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise<Subscription>;
|
package/src/core.ts
CHANGED
|
@@ -43,6 +43,10 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
|
|
|
43
43
|
return null as T;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
if (props.options.__binaryResponse) {
|
|
47
|
+
return response as unknown as T;
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
const contentType = response.headers.get('content-type');
|
|
47
51
|
if (contentType?.includes('application/json')) {
|
|
48
52
|
const json = await response.json();
|
|
@@ -52,10 +56,11 @@ async function defaultParseResponse<T>(props: APIResponseProps): Promise<T> {
|
|
|
52
56
|
return json as T;
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
// TODO handle blob, arraybuffer, other content types, etc.
|
|
56
59
|
const text = await response.text();
|
|
57
60
|
debug('response', response.status, response.url, response.headers, text);
|
|
58
|
-
|
|
61
|
+
|
|
62
|
+
// TODO handle blob, arraybuffer, other content types, etc.
|
|
63
|
+
return text as unknown as T;
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
/**
|
|
@@ -720,6 +725,8 @@ export type RequestOptions<Req extends {} = Record<string, unknown> | Readable>
|
|
|
720
725
|
httpAgent?: Agent;
|
|
721
726
|
signal?: AbortSignal | undefined | null;
|
|
722
727
|
idempotencyKey?: string;
|
|
728
|
+
|
|
729
|
+
__binaryResponse?: boolean | undefined;
|
|
723
730
|
};
|
|
724
731
|
|
|
725
732
|
// This is required so that we can determine if a given object matches the RequestOptions
|
|
@@ -738,6 +745,8 @@ const requestOptionsKeys: KeysEnum<RequestOptions> = {
|
|
|
738
745
|
httpAgent: true,
|
|
739
746
|
signal: true,
|
|
740
747
|
idempotencyKey: true,
|
|
748
|
+
|
|
749
|
+
__binaryResponse: true,
|
|
741
750
|
};
|
|
742
751
|
|
|
743
752
|
export const isRequestOptions = (obj: unknown): obj is RequestOptions<Record<string, unknown> | Readable> => {
|
package/src/error.ts
CHANGED
|
@@ -55,6 +55,10 @@ export class APIError extends OrbError {
|
|
|
55
55
|
|
|
56
56
|
const type = error?.['type'];
|
|
57
57
|
|
|
58
|
+
if (type === 'https://docs.withorb.com/reference/error-responses#400-constraint-violation') {
|
|
59
|
+
return new ConstraintViolation(status, error, message, headers);
|
|
60
|
+
}
|
|
61
|
+
|
|
58
62
|
if (type === 'https://docs.withorb.com/reference/error-responses#400-duplicate-resource-creation') {
|
|
59
63
|
return new DuplicateResourceCreation(status, error, message, headers);
|
|
60
64
|
}
|
|
@@ -190,6 +194,31 @@ export class RateLimitError extends APIError {
|
|
|
190
194
|
|
|
191
195
|
export class InternalServerError extends APIError {}
|
|
192
196
|
|
|
197
|
+
export class ConstraintViolation extends BadRequestError {
|
|
198
|
+
override status: 400;
|
|
199
|
+
|
|
200
|
+
type: 'https://docs.withorb.com/reference/error-responses#400-constraint-violation';
|
|
201
|
+
|
|
202
|
+
detail?: string | null;
|
|
203
|
+
|
|
204
|
+
title?: string | null;
|
|
205
|
+
|
|
206
|
+
constructor(
|
|
207
|
+
status: number | undefined,
|
|
208
|
+
error: Object | undefined,
|
|
209
|
+
message: string | undefined,
|
|
210
|
+
headers: Headers | undefined,
|
|
211
|
+
) {
|
|
212
|
+
const data = error as Record<string, any>;
|
|
213
|
+
super(status, error, message, headers);
|
|
214
|
+
|
|
215
|
+
this.status = data?.['status'];
|
|
216
|
+
this.type = data?.['type'];
|
|
217
|
+
this.detail = data?.['detail'];
|
|
218
|
+
this.title = data?.['title'];
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
193
222
|
export class DuplicateResourceCreation extends BadRequestError {
|
|
194
223
|
override status: 400;
|
|
195
224
|
|
package/src/index.ts
CHANGED
|
@@ -164,6 +164,7 @@ export class Orb extends Core.APIClient {
|
|
|
164
164
|
static ResourceTooLarge = Errors.ResourceTooLarge;
|
|
165
165
|
static AuthenticationError = Errors.AuthenticationError;
|
|
166
166
|
static InternalServerError = Errors.InternalServerError;
|
|
167
|
+
static ConstraintViolation = Errors.ConstraintViolation;
|
|
167
168
|
static FeatureNotAvailable = Errors.FeatureNotAvailable;
|
|
168
169
|
static PermissionDeniedError = Errors.PermissionDeniedError;
|
|
169
170
|
static RequestValidationError = Errors.RequestValidationError;
|
|
@@ -191,6 +192,7 @@ export const {
|
|
|
191
192
|
ResourceTooLarge,
|
|
192
193
|
AuthenticationError,
|
|
193
194
|
InternalServerError,
|
|
195
|
+
ConstraintViolation,
|
|
194
196
|
FeatureNotAvailable,
|
|
195
197
|
PermissionDeniedError,
|
|
196
198
|
RequestValidationError,
|
|
@@ -259,9 +261,9 @@ export namespace Orb {
|
|
|
259
261
|
export import InvoiceMarkPaidParams = API.InvoiceMarkPaidParams;
|
|
260
262
|
|
|
261
263
|
export import Items = API.Items;
|
|
262
|
-
export import
|
|
263
|
-
export import
|
|
264
|
-
export import
|
|
264
|
+
export import Item = API.Item;
|
|
265
|
+
export import ItemsPage = API.ItemsPage;
|
|
266
|
+
export import ItemCreateParams = API.ItemCreateParams;
|
|
265
267
|
export import ItemListParams = API.ItemListParams;
|
|
266
268
|
|
|
267
269
|
export import Metrics = API.Metrics;
|
|
@@ -46,7 +46,7 @@ export class Ledger extends APIResource {
|
|
|
46
46
|
* deductions take place from a non-expiring credit block.
|
|
47
47
|
*
|
|
48
48
|
* If there are multiple blocks with the same expiration date, Orb will deduct from
|
|
49
|
-
* the block with the _lower cost basis_ first (
|
|
49
|
+
* the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
|
|
50
50
|
* basis before paid credits with a $5.00 cost basis).
|
|
51
51
|
*
|
|
52
52
|
* It's also possible for a single usage event's deduction to _span_ credit blocks.
|
|
@@ -393,7 +393,7 @@ export class Ledger extends APIResource {
|
|
|
393
393
|
* deductions take place from a non-expiring credit block.
|
|
394
394
|
*
|
|
395
395
|
* If there are multiple blocks with the same expiration date, Orb will deduct from
|
|
396
|
-
* the block with the _lower cost basis_ first (
|
|
396
|
+
* the block with the _lower cost basis_ first (e.g. trial credits with a $0 cost
|
|
397
397
|
* basis before paid credits with a $5.00 cost basis).
|
|
398
398
|
*
|
|
399
399
|
* It's also possible for a single usage event's deduction to _span_ credit blocks.
|