lark-billing 0.0.7 → 0.0.8

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.
Files changed (139) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +7 -2
  4. package/dist/cjs/api/resources/checkout/client/Client.d.ts +1 -1
  5. package/dist/cjs/api/resources/checkout/client/Client.js +1 -1
  6. package/dist/cjs/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.ts +5 -2
  7. package/dist/cjs/api/resources/index.d.ts +4 -1
  8. package/dist/cjs/api/resources/index.js +5 -2
  9. package/dist/cjs/api/resources/invoices/client/Client.d.ts +50 -0
  10. package/dist/cjs/api/resources/invoices/client/Client.js +135 -0
  11. package/dist/cjs/api/resources/invoices/client/index.d.ts +2 -0
  12. package/dist/cjs/api/resources/invoices/client/index.js +17 -0
  13. package/dist/cjs/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.ts +17 -0
  14. package/dist/cjs/api/resources/invoices/client/requests/index.d.ts +1 -0
  15. package/dist/cjs/api/resources/invoices/client/requests/index.js +2 -0
  16. package/dist/cjs/api/resources/invoices/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/invoices/index.js +17 -0
  18. package/dist/cjs/api/resources/pricingMetrics/client/Client.d.ts +13 -0
  19. package/dist/cjs/api/resources/pricingMetrics/client/Client.js +64 -0
  20. package/dist/cjs/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.ts +12 -0
  21. package/dist/cjs/api/resources/pricingMetrics/client/requests/index.d.ts +1 -0
  22. package/dist/cjs/api/resources/rateCards/client/requests/CreateRateCardRequest.d.ts +2 -2
  23. package/dist/cjs/api/resources/rateCards/index.d.ts +1 -0
  24. package/dist/cjs/api/resources/rateCards/index.js +1 -0
  25. package/dist/cjs/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.ts +10 -0
  26. package/dist/cjs/api/resources/rateCards/types/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/rateCards/types/index.js +17 -0
  28. package/dist/cjs/api/resources/subjects/client/requests/CreateSubjectRequest.d.ts +4 -0
  29. package/dist/cjs/api/resources/subjects/client/requests/UpdateSubjectRequest.d.ts +3 -1
  30. package/dist/cjs/api/resources/subscriptions/client/Client.d.ts +28 -2
  31. package/dist/cjs/api/resources/subscriptions/client/Client.js +126 -2
  32. package/dist/cjs/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.ts +13 -0
  33. package/dist/cjs/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.ts +12 -0
  34. package/dist/cjs/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.ts +6 -3
  35. package/dist/cjs/api/resources/subscriptions/client/requests/index.d.ts +2 -0
  36. package/dist/cjs/api/types/Aggregation.d.ts +1 -10
  37. package/dist/cjs/api/types/{CreateFixedRateInterface.d.ts → CreateFixedRateRequest.d.ts} +1 -1
  38. package/dist/cjs/api/types/CreateFixedRateRequest.js +5 -0
  39. package/dist/cjs/api/types/{CreateSimpleUsageBasedRateInterface.d.ts → CreateSimpleUsageBasedRateRequest.d.ts} +2 -2
  40. package/dist/cjs/api/types/CreateSimpleUsageBasedRateRequest.js +5 -0
  41. package/dist/cjs/api/types/CreateSubjectResponse.d.ts +6 -0
  42. package/dist/cjs/api/types/InvoiceLineItemResource.d.ts +10 -0
  43. package/dist/cjs/api/types/InvoiceLineItemResource.js +5 -0
  44. package/dist/cjs/api/types/InvoiceResource.d.ts +25 -0
  45. package/dist/cjs/api/types/InvoiceResource.js +16 -0
  46. package/dist/cjs/api/types/ListInvoicesResponse.d.ts +8 -0
  47. package/dist/cjs/api/types/ListInvoicesResponse.js +5 -0
  48. package/dist/cjs/api/types/ListPricingMetricsResponse.d.ts +8 -0
  49. package/dist/cjs/api/types/ListPricingMetricsResponse.js +5 -0
  50. package/dist/cjs/api/types/PeriodResource.d.ts +9 -0
  51. package/dist/cjs/api/types/PeriodResource.js +5 -0
  52. package/dist/cjs/api/types/PricingMetricResource.d.ts +11 -0
  53. package/dist/cjs/api/types/PricingMetricResource.js +5 -0
  54. package/dist/cjs/api/types/SimpleUsageBasedRateInterface.d.ts +0 -2
  55. package/dist/cjs/api/types/SubjectResource.d.ts +6 -0
  56. package/dist/cjs/api/types/SubscriptionResource.d.ts +6 -2
  57. package/dist/cjs/api/types/SubscriptionResource.js +1 -0
  58. package/dist/cjs/api/types/index.d.ts +8 -5
  59. package/dist/cjs/api/types/index.js +8 -5
  60. package/dist/cjs/version.d.ts +1 -1
  61. package/dist/cjs/version.js +1 -1
  62. package/dist/esm/Client.d.mts +3 -0
  63. package/dist/esm/Client.mjs +7 -2
  64. package/dist/esm/api/resources/checkout/client/Client.d.mts +1 -1
  65. package/dist/esm/api/resources/checkout/client/Client.mjs +1 -1
  66. package/dist/esm/api/resources/checkout/client/requests/CreateSubscriptionCheckoutSessionRequest.d.mts +5 -2
  67. package/dist/esm/api/resources/index.d.mts +4 -1
  68. package/dist/esm/api/resources/index.mjs +4 -1
  69. package/dist/esm/api/resources/invoices/client/Client.d.mts +50 -0
  70. package/dist/esm/api/resources/invoices/client/Client.mjs +98 -0
  71. package/dist/esm/api/resources/invoices/client/index.d.mts +2 -0
  72. package/dist/esm/api/resources/invoices/client/index.mjs +1 -0
  73. package/dist/esm/api/resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.d.mts +17 -0
  74. package/dist/esm/api/resources/invoices/client/requests/index.d.mts +1 -0
  75. package/dist/esm/api/resources/invoices/client/requests/index.mjs +1 -0
  76. package/dist/esm/api/resources/invoices/index.d.mts +1 -0
  77. package/dist/esm/api/resources/invoices/index.mjs +1 -0
  78. package/dist/esm/api/resources/pricingMetrics/client/Client.d.mts +13 -0
  79. package/dist/esm/api/resources/pricingMetrics/client/Client.mjs +64 -0
  80. package/dist/esm/api/resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.d.mts +12 -0
  81. package/dist/esm/api/resources/pricingMetrics/client/requests/index.d.mts +1 -0
  82. package/dist/esm/api/resources/rateCards/client/requests/CreateRateCardRequest.d.mts +2 -2
  83. package/dist/esm/api/resources/rateCards/index.d.mts +1 -0
  84. package/dist/esm/api/resources/rateCards/index.mjs +1 -0
  85. package/dist/esm/api/resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.d.mts +10 -0
  86. package/dist/esm/api/resources/rateCards/types/index.d.mts +1 -0
  87. package/dist/esm/api/resources/rateCards/types/index.mjs +1 -0
  88. package/dist/esm/api/resources/subjects/client/requests/CreateSubjectRequest.d.mts +4 -0
  89. package/dist/esm/api/resources/subjects/client/requests/UpdateSubjectRequest.d.mts +3 -1
  90. package/dist/esm/api/resources/subscriptions/client/Client.d.mts +28 -2
  91. package/dist/esm/api/resources/subscriptions/client/Client.mjs +126 -2
  92. package/dist/esm/api/resources/subscriptions/client/requests/CancelSubscriptionRequest.d.mts +13 -0
  93. package/dist/esm/api/resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.d.mts +12 -0
  94. package/dist/esm/api/resources/subscriptions/client/requests/CreateSubscriptionRequest.d.mts +6 -3
  95. package/dist/esm/api/resources/subscriptions/client/requests/index.d.mts +2 -0
  96. package/dist/esm/api/types/Aggregation.d.mts +1 -10
  97. package/dist/esm/api/types/{CreateFixedRateInterface.d.mts → CreateFixedRateRequest.d.mts} +1 -1
  98. package/dist/esm/api/types/CreateFixedRateRequest.mjs +4 -0
  99. package/dist/esm/api/types/{CreateSimpleUsageBasedRateInterface.d.mts → CreateSimpleUsageBasedRateRequest.d.mts} +2 -2
  100. package/dist/esm/api/types/CreateSimpleUsageBasedRateRequest.mjs +4 -0
  101. package/dist/esm/api/types/CreateSubjectResponse.d.mts +6 -0
  102. package/dist/esm/api/types/InvoiceLineItemResource.d.mts +10 -0
  103. package/dist/esm/api/types/InvoiceLineItemResource.mjs +4 -0
  104. package/dist/esm/api/types/InvoiceResource.d.mts +25 -0
  105. package/dist/esm/api/types/InvoiceResource.mjs +13 -0
  106. package/dist/esm/api/types/ListInvoicesResponse.d.mts +8 -0
  107. package/dist/esm/api/types/ListInvoicesResponse.mjs +4 -0
  108. package/dist/esm/api/types/ListPricingMetricsResponse.d.mts +8 -0
  109. package/dist/esm/api/types/ListPricingMetricsResponse.mjs +4 -0
  110. package/dist/esm/api/types/PeriodResource.d.mts +9 -0
  111. package/dist/esm/api/types/PeriodResource.mjs +4 -0
  112. package/dist/esm/api/types/PricingMetricResource.d.mts +11 -0
  113. package/dist/esm/api/types/PricingMetricResource.mjs +4 -0
  114. package/dist/esm/api/types/SimpleUsageBasedRateInterface.d.mts +0 -2
  115. package/dist/esm/api/types/SubjectResource.d.mts +6 -0
  116. package/dist/esm/api/types/SubscriptionResource.d.mts +6 -2
  117. package/dist/esm/api/types/SubscriptionResource.mjs +1 -0
  118. package/dist/esm/api/types/index.d.mts +8 -5
  119. package/dist/esm/api/types/index.mjs +8 -5
  120. package/dist/esm/version.d.mts +1 -1
  121. package/dist/esm/version.mjs +1 -1
  122. package/package.json +1 -1
  123. package/reference.md +221 -3
  124. package/dist/cjs/api/types/CustomPricingMetricResource.d.ts +0 -6
  125. package/dist/cjs/api/types/LastAggregationPricingMetricResource.d.ts +0 -6
  126. package/dist/cjs/api/types/MaxAggregationPricingMetricResource.d.ts +0 -6
  127. package/dist/esm/api/types/CustomPricingMetricResource.d.mts +0 -6
  128. package/dist/esm/api/types/LastAggregationPricingMetricResource.d.mts +0 -6
  129. package/dist/esm/api/types/MaxAggregationPricingMetricResource.d.mts +0 -6
  130. /package/dist/cjs/api/{types/CreateFixedRateInterface.js → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.js} +0 -0
  131. /package/dist/cjs/api/{types/CreateSimpleUsageBasedRateInterface.js → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.js} +0 -0
  132. /package/dist/cjs/api/{types/CustomPricingMetricResource.js → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.js} +0 -0
  133. /package/dist/cjs/api/{types/LastAggregationPricingMetricResource.js → resources/subscriptions/client/requests/CancelSubscriptionRequest.js} +0 -0
  134. /package/dist/cjs/api/{types/MaxAggregationPricingMetricResource.js → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.js} +0 -0
  135. /package/dist/esm/api/{types/CreateFixedRateInterface.mjs → resources/invoices/client/requests/ListInvoicesInvoicesGetRequest.mjs} +0 -0
  136. /package/dist/esm/api/{types/CreateSimpleUsageBasedRateInterface.mjs → resources/pricingMetrics/client/requests/ListPricingMetricsPricingMetricsGetRequest.mjs} +0 -0
  137. /package/dist/esm/api/{types/CustomPricingMetricResource.mjs → resources/rateCards/types/CreateRateCardRequestUsageBasedRatesItem.mjs} +0 -0
  138. /package/dist/esm/api/{types/LastAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/CancelSubscriptionRequest.mjs} +0 -0
  139. /package/dist/esm/api/{types/MaxAggregationPricingMetricResource.mjs → resources/subscriptions/client/requests/ChangeSubscriptionRateCardRequest.mjs} +0 -0
@@ -1,12 +1,14 @@
1
+ export * as rateCards from "./rateCards/index.mjs";
2
+ export * from "./rateCards/types/index.mjs";
1
3
  export * as pricingMetrics from "./pricingMetrics/index.mjs";
2
4
  export * from "./pricingMetrics/types/index.mjs";
3
5
  export * as checkout from "./checkout/index.mjs";
4
6
  export * as customerPortal from "./customerPortal/index.mjs";
5
- export * as rateCards from "./rateCards/index.mjs";
6
7
  export * as usageEvents from "./usageEvents/index.mjs";
7
8
  export * as subscriptions from "./subscriptions/index.mjs";
8
9
  export * as subjects from "./subjects/index.mjs";
9
10
  export * as customerAccess from "./customerAccess/index.mjs";
11
+ export * as invoices from "./invoices/index.mjs";
10
12
  export * from "./checkout/client/requests/index.mjs";
11
13
  export * from "./customerPortal/client/requests/index.mjs";
12
14
  export * from "./rateCards/client/requests/index.mjs";
@@ -14,3 +16,4 @@ export * from "./usageEvents/client/requests/index.mjs";
14
16
  export * from "./subscriptions/client/requests/index.mjs";
15
17
  export * from "./subjects/client/requests/index.mjs";
16
18
  export * from "./pricingMetrics/client/requests/index.mjs";
19
+ export * from "./invoices/client/requests/index.mjs";
@@ -1,12 +1,14 @@
1
+ export * as rateCards from "./rateCards/index.mjs";
2
+ export * from "./rateCards/types/index.mjs";
1
3
  export * as pricingMetrics from "./pricingMetrics/index.mjs";
2
4
  export * from "./pricingMetrics/types/index.mjs";
3
5
  export * as checkout from "./checkout/index.mjs";
4
6
  export * as customerPortal from "./customerPortal/index.mjs";
5
- export * as rateCards from "./rateCards/index.mjs";
6
7
  export * as usageEvents from "./usageEvents/index.mjs";
7
8
  export * as subscriptions from "./subscriptions/index.mjs";
8
9
  export * as subjects from "./subjects/index.mjs";
9
10
  export * as customerAccess from "./customerAccess/index.mjs";
11
+ export * as invoices from "./invoices/index.mjs";
10
12
  export * from "./checkout/client/requests/index.mjs";
11
13
  export * from "./customerPortal/client/requests/index.mjs";
12
14
  export * from "./rateCards/client/requests/index.mjs";
@@ -14,3 +16,4 @@ export * from "./usageEvents/client/requests/index.mjs";
14
16
  export * from "./subscriptions/client/requests/index.mjs";
15
17
  export * from "./subjects/client/requests/index.mjs";
16
18
  export * from "./pricingMetrics/client/requests/index.mjs";
19
+ export * from "./invoices/client/requests/index.mjs";
@@ -0,0 +1,50 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as environments from "../../../../environments.mjs";
5
+ import * as core from "../../../../core/index.mjs";
6
+ import * as Lark from "../../../index.mjs";
7
+ export declare namespace Invoices {
8
+ interface Options {
9
+ environment?: core.Supplier<environments.LarkEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
12
+ apiKey: core.Supplier<string>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
15
+ }
16
+ interface RequestOptions {
17
+ /** The maximum time to wait for a response in seconds. */
18
+ timeoutInSeconds?: number;
19
+ /** The number of times to retry the request. Defaults to 2. */
20
+ maxRetries?: number;
21
+ /** A hook to abort the request. */
22
+ abortSignal?: AbortSignal;
23
+ /** Additional query string parameters to include in the request. */
24
+ queryParams?: Record<string, unknown>;
25
+ /** Additional headers to include in the request. */
26
+ headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
27
+ }
28
+ }
29
+ export declare class Invoices {
30
+ protected readonly _options: Invoices.Options;
31
+ constructor(_options: Invoices.Options);
32
+ /**
33
+ * @param {Lark.ListInvoicesInvoicesGetRequest} request
34
+ * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @throws {@link Lark.UnprocessableEntityError}
37
+ *
38
+ * @example
39
+ * await client.invoices.listInvoices({
40
+ * subject_id: "subject_id",
41
+ * limit: 1,
42
+ * offset: 1
43
+ * })
44
+ */
45
+ listInvoices(request: Lark.ListInvoicesInvoicesGetRequest, requestOptions?: Invoices.RequestOptions): core.HttpResponsePromise<Lark.ListInvoicesResponse>;
46
+ private __listInvoices;
47
+ protected _getCustomAuthorizationHeaders(): Promise<{
48
+ "X-API-Key": string;
49
+ }>;
50
+ }
@@ -0,0 +1,98 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
5
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6
+ return new (P || (P = Promise))(function (resolve, reject) {
7
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
8
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
9
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11
+ });
12
+ };
13
+ import * as environments from "../../../../environments.mjs";
14
+ import * as core from "../../../../core/index.mjs";
15
+ import * as Lark from "../../../index.mjs";
16
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
17
+ import * as errors from "../../../../errors/index.mjs";
18
+ export class Invoices {
19
+ constructor(_options) {
20
+ this._options = _options;
21
+ }
22
+ /**
23
+ * @param {Lark.ListInvoicesInvoicesGetRequest} request
24
+ * @param {Invoices.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Lark.UnprocessableEntityError}
27
+ *
28
+ * @example
29
+ * await client.invoices.listInvoices({
30
+ * subject_id: "subject_id",
31
+ * limit: 1,
32
+ * offset: 1
33
+ * })
34
+ */
35
+ listInvoices(request, requestOptions) {
36
+ return core.HttpResponsePromise.fromPromise(this.__listInvoices(request, requestOptions));
37
+ }
38
+ __listInvoices(request, requestOptions) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ var _a, _b, _c;
41
+ const { subject_id: subjectId, limit, offset } = request;
42
+ const _queryParams = {};
43
+ _queryParams["subject_id"] = subjectId;
44
+ if (limit != null) {
45
+ _queryParams["limit"] = limit.toString();
46
+ }
47
+ if (offset != null) {
48
+ _queryParams["offset"] = offset.toString();
49
+ }
50
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
51
+ const _response = yield core.fetcher({
52
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LarkEnvironment.Default, "invoices"),
53
+ method: "GET",
54
+ headers: _headers,
55
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
56
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
57
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
58
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
59
+ });
60
+ if (_response.ok) {
61
+ return { data: _response.body, rawResponse: _response.rawResponse };
62
+ }
63
+ if (_response.error.reason === "status-code") {
64
+ switch (_response.error.statusCode) {
65
+ case 422:
66
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
67
+ default:
68
+ throw new errors.LarkError({
69
+ statusCode: _response.error.statusCode,
70
+ body: _response.error.body,
71
+ rawResponse: _response.rawResponse,
72
+ });
73
+ }
74
+ }
75
+ switch (_response.error.reason) {
76
+ case "non-json":
77
+ throw new errors.LarkError({
78
+ statusCode: _response.error.statusCode,
79
+ body: _response.error.rawBody,
80
+ rawResponse: _response.rawResponse,
81
+ });
82
+ case "timeout":
83
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling GET /invoices.");
84
+ case "unknown":
85
+ throw new errors.LarkError({
86
+ message: _response.error.errorMessage,
87
+ rawResponse: _response.rawResponse,
88
+ });
89
+ }
90
+ });
91
+ }
92
+ _getCustomAuthorizationHeaders() {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
95
+ return { "X-API-Key": apiKeyValue };
96
+ });
97
+ }
98
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * subject_id: "subject_id",
8
+ * limit: 1,
9
+ * offset: 1
10
+ * }
11
+ */
12
+ export interface ListInvoicesInvoicesGetRequest {
13
+ /** The ID of the subject to list invoices for. */
14
+ subject_id: string;
15
+ limit?: number;
16
+ offset?: number;
17
+ }
@@ -0,0 +1 @@
1
+ export { type ListInvoicesInvoicesGetRequest } from "./ListInvoicesInvoicesGetRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -29,6 +29,19 @@ export declare namespace PricingMetrics {
29
29
  export declare class PricingMetrics {
30
30
  protected readonly _options: PricingMetrics.Options;
31
31
  constructor(_options: PricingMetrics.Options);
32
+ /**
33
+ * @param {Lark.ListPricingMetricsPricingMetricsGetRequest} request
34
+ * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @throws {@link Lark.UnprocessableEntityError}
37
+ *
38
+ * @example
39
+ * await client.pricingMetrics.listPricingMetrics({
40
+ * limit: 1
41
+ * })
42
+ */
43
+ listPricingMetrics(request?: Lark.ListPricingMetricsPricingMetricsGetRequest, requestOptions?: PricingMetrics.RequestOptions): core.HttpResponsePromise<Lark.ListPricingMetricsResponse>;
44
+ private __listPricingMetrics;
32
45
  /**
33
46
  * @param {Lark.CreatePricingMetricRequest} request
34
47
  * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
@@ -19,6 +19,70 @@ export class PricingMetrics {
19
19
  constructor(_options) {
20
20
  this._options = _options;
21
21
  }
22
+ /**
23
+ * @param {Lark.ListPricingMetricsPricingMetricsGetRequest} request
24
+ * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Lark.UnprocessableEntityError}
27
+ *
28
+ * @example
29
+ * await client.pricingMetrics.listPricingMetrics({
30
+ * limit: 1
31
+ * })
32
+ */
33
+ listPricingMetrics(request = {}, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__listPricingMetrics(request, requestOptions));
35
+ }
36
+ __listPricingMetrics() {
37
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
+ var _a, _b, _c;
39
+ const { limit } = request;
40
+ const _queryParams = {};
41
+ if (limit != null) {
42
+ _queryParams["limit"] = limit.toString();
43
+ }
44
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
45
+ const _response = yield core.fetcher({
46
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LarkEnvironment.Default, "pricing-metrics"),
47
+ method: "GET",
48
+ headers: _headers,
49
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
50
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
51
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
52
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
53
+ });
54
+ if (_response.ok) {
55
+ return { data: _response.body, rawResponse: _response.rawResponse };
56
+ }
57
+ if (_response.error.reason === "status-code") {
58
+ switch (_response.error.statusCode) {
59
+ case 422:
60
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
61
+ default:
62
+ throw new errors.LarkError({
63
+ statusCode: _response.error.statusCode,
64
+ body: _response.error.body,
65
+ rawResponse: _response.rawResponse,
66
+ });
67
+ }
68
+ }
69
+ switch (_response.error.reason) {
70
+ case "non-json":
71
+ throw new errors.LarkError({
72
+ statusCode: _response.error.statusCode,
73
+ body: _response.error.rawBody,
74
+ rawResponse: _response.rawResponse,
75
+ });
76
+ case "timeout":
77
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling GET /pricing-metrics.");
78
+ case "unknown":
79
+ throw new errors.LarkError({
80
+ message: _response.error.errorMessage,
81
+ rawResponse: _response.rawResponse,
82
+ });
83
+ }
84
+ });
85
+ }
22
86
  /**
23
87
  * @param {Lark.CreatePricingMetricRequest} request
24
88
  * @param {PricingMetrics.RequestOptions} requestOptions - Request-specific configuration.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * limit: 1
8
+ * }
9
+ */
10
+ export interface ListPricingMetricsPricingMetricsGetRequest {
11
+ limit?: number;
12
+ }
@@ -1 +1,2 @@
1
+ export { type ListPricingMetricsPricingMetricsGetRequest } from "./ListPricingMetricsPricingMetricsGetRequest.mjs";
1
2
  export { type CreatePricingMetricRequest } from "./CreatePricingMetricRequest.mjs";
@@ -12,8 +12,8 @@ import * as Lark from "../../../../index.mjs";
12
12
  export interface CreateRateCardRequest {
13
13
  name: string;
14
14
  description?: string;
15
- usage_based_rates?: Lark.CreateSimpleUsageBasedRateInterface[];
16
- fixed_rates?: Lark.CreateFixedRateInterface[];
15
+ usage_based_rates?: Lark.CreateRateCardRequestUsageBasedRatesItem[];
16
+ fixed_rates?: Lark.CreateFixedRateRequest[];
17
17
  billing_interval: CreateRateCardRequest.BillingInterval;
18
18
  metadata?: Record<string, string>;
19
19
  }
@@ -1 +1,2 @@
1
+ export * from "./types/index.mjs";
1
2
  export * from "./client/index.mjs";
@@ -1 +1,2 @@
1
+ export * from "./types/index.mjs";
1
2
  export * from "./client/index.mjs";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ import * as Lark from "../../../index.mjs";
5
+ export type CreateRateCardRequestUsageBasedRatesItem = Lark.CreateRateCardRequestUsageBasedRatesItem.Simple;
6
+ export declare namespace CreateRateCardRequestUsageBasedRatesItem {
7
+ interface Simple extends Lark.CreateSimpleUsageBasedRateRequest {
8
+ usage_based_rate_type: "simple";
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ export * from "./CreateRateCardRequestUsageBasedRatesItem.mjs";
@@ -0,0 +1 @@
1
+ export * from "./CreateRateCardRequestUsageBasedRatesItem.mjs";
@@ -6,8 +6,12 @@
6
6
  * {}
7
7
  */
8
8
  export interface CreateSubjectRequest {
9
+ /** The ID of the subject in your system. If provided, you may use pass it to the API in place of the subject ID. Must be unique. */
9
10
  external_id?: string;
11
+ /** The name of the subject. Used for display in the dashboard. */
10
12
  name?: string;
13
+ /** The email of the subject. Must be a valid email address. */
11
14
  email?: string;
15
+ /** Additional metadata about the subject. You may use this to store any custom data about the subject. */
12
16
  metadata?: Record<string, string>;
13
17
  }
@@ -6,8 +6,10 @@
6
6
  * {}
7
7
  */
8
8
  export interface UpdateSubjectRequest {
9
- external_id?: string;
9
+ /** The name of the subject. Used for display in the dashboard. */
10
10
  name?: string;
11
+ /** The email of the subject. Must be a valid email address. */
11
12
  email?: string;
13
+ /** Additional metadata about the subject. You may use this to store any custom data about the subject. */
12
14
  metadata?: Record<string, string | undefined>;
13
15
  }
@@ -52,8 +52,8 @@ export declare class Subscriptions {
52
52
  *
53
53
  * @example
54
54
  * await client.subscriptions.createSubscription({
55
- * rate_card_id: "rate_card_id",
56
- * subject_id: "subject_id"
55
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
56
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
57
57
  * })
58
58
  */
59
59
  createSubscription(request: Lark.CreateSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
@@ -69,6 +69,32 @@ export declare class Subscriptions {
69
69
  */
70
70
  getSubscription(subscriptionId: string, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
71
71
  private __getSubscription;
72
+ /**
73
+ * @param {string} subscriptionId
74
+ * @param {Lark.CancelSubscriptionRequest} request
75
+ * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
76
+ *
77
+ * @throws {@link Lark.UnprocessableEntityError}
78
+ *
79
+ * @example
80
+ * await client.subscriptions.cancelSubscription("subscription_id")
81
+ */
82
+ cancelSubscription(subscriptionId: string, request?: Lark.CancelSubscriptionRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
83
+ private __cancelSubscription;
84
+ /**
85
+ * @param {string} subscriptionId
86
+ * @param {Lark.ChangeSubscriptionRateCardRequest} request
87
+ * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
88
+ *
89
+ * @throws {@link Lark.UnprocessableEntityError}
90
+ *
91
+ * @example
92
+ * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
93
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
94
+ * })
95
+ */
96
+ changeSubscriptionRateCard(subscriptionId: string, request: Lark.ChangeSubscriptionRateCardRequest, requestOptions?: Subscriptions.RequestOptions): core.HttpResponsePromise<Lark.SubscriptionResource>;
97
+ private __changeSubscriptionRateCard;
72
98
  protected _getCustomAuthorizationHeaders(): Promise<{
73
99
  "X-API-Key": string;
74
100
  }>;
@@ -99,8 +99,8 @@ export class Subscriptions {
99
99
  *
100
100
  * @example
101
101
  * await client.subscriptions.createSubscription({
102
- * rate_card_id: "rate_card_id",
103
- * subject_id: "subject_id"
102
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
103
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
104
104
  * })
105
105
  */
106
106
  createSubscription(request, requestOptions) {
@@ -211,6 +211,130 @@ export class Subscriptions {
211
211
  }
212
212
  });
213
213
  }
214
+ /**
215
+ * @param {string} subscriptionId
216
+ * @param {Lark.CancelSubscriptionRequest} request
217
+ * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
218
+ *
219
+ * @throws {@link Lark.UnprocessableEntityError}
220
+ *
221
+ * @example
222
+ * await client.subscriptions.cancelSubscription("subscription_id")
223
+ */
224
+ cancelSubscription(subscriptionId, request = {}, requestOptions) {
225
+ return core.HttpResponsePromise.fromPromise(this.__cancelSubscription(subscriptionId, request, requestOptions));
226
+ }
227
+ __cancelSubscription(subscriptionId_1) {
228
+ return __awaiter(this, arguments, void 0, function* (subscriptionId, request = {}, requestOptions) {
229
+ var _a, _b, _c;
230
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
231
+ const _response = yield core.fetcher({
232
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LarkEnvironment.Default, `subscriptions/${encodeURIComponent(subscriptionId)}/cancel`),
233
+ method: "POST",
234
+ headers: _headers,
235
+ contentType: "application/json",
236
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
237
+ requestType: "json",
238
+ body: request,
239
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
240
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
241
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
242
+ });
243
+ if (_response.ok) {
244
+ return { data: _response.body, rawResponse: _response.rawResponse };
245
+ }
246
+ if (_response.error.reason === "status-code") {
247
+ switch (_response.error.statusCode) {
248
+ case 422:
249
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
250
+ default:
251
+ throw new errors.LarkError({
252
+ statusCode: _response.error.statusCode,
253
+ body: _response.error.body,
254
+ rawResponse: _response.rawResponse,
255
+ });
256
+ }
257
+ }
258
+ switch (_response.error.reason) {
259
+ case "non-json":
260
+ throw new errors.LarkError({
261
+ statusCode: _response.error.statusCode,
262
+ body: _response.error.rawBody,
263
+ rawResponse: _response.rawResponse,
264
+ });
265
+ case "timeout":
266
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /subscriptions/{subscription_id}/cancel.");
267
+ case "unknown":
268
+ throw new errors.LarkError({
269
+ message: _response.error.errorMessage,
270
+ rawResponse: _response.rawResponse,
271
+ });
272
+ }
273
+ });
274
+ }
275
+ /**
276
+ * @param {string} subscriptionId
277
+ * @param {Lark.ChangeSubscriptionRateCardRequest} request
278
+ * @param {Subscriptions.RequestOptions} requestOptions - Request-specific configuration.
279
+ *
280
+ * @throws {@link Lark.UnprocessableEntityError}
281
+ *
282
+ * @example
283
+ * await client.subscriptions.changeSubscriptionRateCard("subscription_id", {
284
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
285
+ * })
286
+ */
287
+ changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
288
+ return core.HttpResponsePromise.fromPromise(this.__changeSubscriptionRateCard(subscriptionId, request, requestOptions));
289
+ }
290
+ __changeSubscriptionRateCard(subscriptionId, request, requestOptions) {
291
+ return __awaiter(this, void 0, void 0, function* () {
292
+ var _a, _b, _c;
293
+ let _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders(Object.assign({}, (yield this._getCustomAuthorizationHeaders()))), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
294
+ const _response = yield core.fetcher({
295
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LarkEnvironment.Default, `subscriptions/${encodeURIComponent(subscriptionId)}/change-rate-card`),
296
+ method: "POST",
297
+ headers: _headers,
298
+ contentType: "application/json",
299
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
300
+ requestType: "json",
301
+ body: request,
302
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
303
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
304
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
305
+ });
306
+ if (_response.ok) {
307
+ return { data: _response.body, rawResponse: _response.rawResponse };
308
+ }
309
+ if (_response.error.reason === "status-code") {
310
+ switch (_response.error.statusCode) {
311
+ case 422:
312
+ throw new Lark.UnprocessableEntityError(_response.error.body, _response.rawResponse);
313
+ default:
314
+ throw new errors.LarkError({
315
+ statusCode: _response.error.statusCode,
316
+ body: _response.error.body,
317
+ rawResponse: _response.rawResponse,
318
+ });
319
+ }
320
+ }
321
+ switch (_response.error.reason) {
322
+ case "non-json":
323
+ throw new errors.LarkError({
324
+ statusCode: _response.error.statusCode,
325
+ body: _response.error.rawBody,
326
+ rawResponse: _response.rawResponse,
327
+ });
328
+ case "timeout":
329
+ throw new errors.LarkTimeoutError("Timeout exceeded when calling POST /subscriptions/{subscription_id}/change-rate-card.");
330
+ case "unknown":
331
+ throw new errors.LarkError({
332
+ message: _response.error.errorMessage,
333
+ rawResponse: _response.rawResponse,
334
+ });
335
+ }
336
+ });
337
+ }
214
338
  _getCustomAuthorizationHeaders() {
215
339
  return __awaiter(this, void 0, void 0, function* () {
216
340
  const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
@@ -0,0 +1,13 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {}
7
+ */
8
+ export interface CancelSubscriptionRequest {
9
+ /** The reason for cancelling the subscription. */
10
+ reason?: string;
11
+ /** Whether to cancel the subscription at end of cycle. */
12
+ cancel_at_end_of_cycle?: boolean;
13
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB"
8
+ * }
9
+ */
10
+ export interface ChangeSubscriptionRateCardRequest {
11
+ rate_card_id: string;
12
+ }
@@ -4,12 +4,15 @@
4
4
  /**
5
5
  * @example
6
6
  * {
7
- * rate_card_id: "rate_card_id",
8
- * subject_id: "subject_id"
7
+ * rate_card_id: "rc_AJWMxR81jxoRlli6p13uf3JB",
8
+ * subject_id: "subj_VyX6Q96h5avMho8O7QWlKeXE"
9
9
  * }
10
10
  */
11
11
  export interface CreateSubscriptionRequest {
12
+ /** The ID of the rate card to use for the subscription. */
12
13
  rate_card_id: string;
14
+ /** The ID of the subject to create the subscription for. */
13
15
  subject_id: string;
14
- metadata?: Record<string, string | undefined>;
16
+ /** Additional metadata about the subscription. You may use this to store any custom data about the subscription. */
17
+ metadata?: Record<string, string>;
15
18
  }
@@ -1,2 +1,4 @@
1
1
  export { type ListSubscriptionsSubscriptionsGetRequest } from "./ListSubscriptionsSubscriptionsGetRequest.mjs";
2
2
  export { type CreateSubscriptionRequest } from "./CreateSubscriptionRequest.mjs";
3
+ export { type CancelSubscriptionRequest } from "./CancelSubscriptionRequest.mjs";
4
+ export { type ChangeSubscriptionRateCardRequest } from "./ChangeSubscriptionRateCardRequest.mjs";