@flexprice/sdk 2.1.10 → 2.1.11
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/docs/sdk/models/create-invoice-request.md +1 -0
- package/docs/sdk/models/error-code.md +17 -0
- package/docs/sdk/models/error-response.md +5 -6
- package/docs/sdk/models/errors-error-response.md +5 -6
- package/docs/sdk/models/invoice-response.md +1 -0
- package/docs/sdk/models/window-size.md +2 -2
- package/docs/sdks/invoices/README.md +0 -76
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/sdk/invoices.d.ts +0 -7
- package/esm/sdk/invoices.d.ts.map +1 -1
- package/esm/sdk/invoices.js +0 -10
- package/esm/sdk/invoices.js.map +1 -1
- package/esm/sdk/models/create-invoice-request.d.ts +8 -0
- package/esm/sdk/models/create-invoice-request.d.ts.map +1 -1
- package/esm/sdk/models/create-invoice-request.js +2 -0
- package/esm/sdk/models/create-invoice-request.js.map +1 -1
- package/esm/sdk/models/customer-lookup-result.d.ts +1 -1
- package/esm/sdk/models/customer-lookup-result.d.ts.map +1 -1
- package/esm/sdk/models/customer-lookup-result.js +1 -1
- package/esm/sdk/models/customer-lookup-result.js.map +1 -1
- package/esm/sdk/models/error-code.d.ts +20 -0
- package/esm/sdk/models/error-code.d.ts.map +1 -0
- package/esm/sdk/models/error-code.js +21 -0
- package/esm/sdk/models/error-code.js.map +1 -0
- package/esm/sdk/models/error-response.d.ts +13 -0
- package/esm/sdk/models/error-response.d.ts.map +1 -0
- package/esm/sdk/models/error-response.js +22 -0
- package/esm/sdk/models/error-response.js.map +1 -0
- package/esm/sdk/models/errors-error-response.d.ts +3 -42
- package/esm/sdk/models/errors-error-response.d.ts.map +1 -1
- package/esm/sdk/models/errors-error-response.js +2 -42
- package/esm/sdk/models/errors-error-response.js.map +1 -1
- package/esm/sdk/models/failure-point.d.ts +1 -1
- package/esm/sdk/models/failure-point.d.ts.map +1 -1
- package/esm/sdk/models/failure-point.js +1 -1
- package/esm/sdk/models/failure-point.js.map +1 -1
- package/esm/sdk/models/index.d.ts +2 -5
- package/esm/sdk/models/index.d.ts.map +1 -1
- package/esm/sdk/models/index.js +2 -5
- package/esm/sdk/models/index.js.map +1 -1
- package/esm/sdk/models/invoice-response.d.ts +4 -0
- package/esm/sdk/models/invoice-response.d.ts.map +1 -1
- package/esm/sdk/models/invoice-response.js +2 -0
- package/esm/sdk/models/invoice-response.js.map +1 -1
- package/esm/sdk/models/meter-matching-result.d.ts +1 -1
- package/esm/sdk/models/meter-matching-result.d.ts.map +1 -1
- package/esm/sdk/models/meter-matching-result.js +1 -1
- package/esm/sdk/models/meter-matching-result.js.map +1 -1
- package/esm/sdk/models/price-lookup-result.d.ts +1 -1
- package/esm/sdk/models/price-lookup-result.d.ts.map +1 -1
- package/esm/sdk/models/price-lookup-result.js +1 -1
- package/esm/sdk/models/price-lookup-result.js.map +1 -1
- package/esm/sdk/models/subscription-line-item-lookup-result.d.ts +1 -1
- package/esm/sdk/models/subscription-line-item-lookup-result.d.ts.map +1 -1
- package/esm/sdk/models/subscription-line-item-lookup-result.js +1 -1
- package/esm/sdk/models/subscription-line-item-lookup-result.js.map +1 -1
- package/esm/sdk/models/window-size.d.ts +1 -1
- package/esm/sdk/models/window-size.js +1 -1
- package/esm/sdk/models/window-size.js.map +1 -1
- package/esm/sdk/sdk.d.ts +0 -3
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +0 -5
- package/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/sdk/invoices.ts +0 -18
- package/src/sdk/models/create-invoice-request.ts +10 -0
- package/src/sdk/models/customer-lookup-result.ts +1 -1
- package/src/sdk/models/error-code.ts +27 -0
- package/src/sdk/models/error-response.ts +44 -0
- package/src/sdk/models/errors-error-response.ts +4 -87
- package/src/sdk/models/failure-point.ts +1 -1
- package/src/sdk/models/index.ts +2 -5
- package/src/sdk/models/invoice-response.ts +6 -0
- package/src/sdk/models/meter-matching-result.ts +1 -1
- package/src/sdk/models/price-lookup-result.ts +1 -1
- package/src/sdk/models/subscription-line-item-lookup-result.ts +1 -1
- package/src/sdk/models/window-size.ts +1 -1
- package/src/sdk/sdk.ts +0 -6
- package/docs/sdk/models/code.md +0 -17
- package/docs/sdk/models/details.md +0 -14
- package/docs/sdk/models/meter-usage-analytics-request.md +0 -30
- package/docs/sdk/models/meter-usage-analytics-response.md +0 -30
- package/docs/sdk/models/meter-usage-point.md +0 -21
- package/docs/sdk/models/meter-usage-query-request.md +0 -28
- package/docs/sdk/models/meter-usage-query-response.md +0 -30
- package/docs/sdks/meterusage/README.md +0 -182
- package/esm/funcs/invoices-get-meter-usage-preview-invoice.d.ts +0 -17
- package/esm/funcs/invoices-get-meter-usage-preview-invoice.d.ts.map +0 -1
- package/esm/funcs/invoices-get-meter-usage-preview-invoice.js +0 -83
- package/esm/funcs/invoices-get-meter-usage-preview-invoice.js.map +0 -1
- package/esm/funcs/meter-usage-get-meter-usage-analytics.d.ts +0 -17
- package/esm/funcs/meter-usage-get-meter-usage-analytics.d.ts.map +0 -1
- package/esm/funcs/meter-usage-get-meter-usage-analytics.js +0 -83
- package/esm/funcs/meter-usage-get-meter-usage-analytics.js.map +0 -1
- package/esm/funcs/meter-usage-query-meter-usage.d.ts +0 -17
- package/esm/funcs/meter-usage-query-meter-usage.d.ts.map +0 -1
- package/esm/funcs/meter-usage-query-meter-usage.js +0 -83
- package/esm/funcs/meter-usage-query-meter-usage.js.map +0 -1
- package/esm/sdk/meter-usage.d.ts +0 -19
- package/esm/sdk/meter-usage.d.ts.map +0 -1
- package/esm/sdk/meter-usage.js +0 -28
- package/esm/sdk/meter-usage.js.map +0 -1
- package/esm/sdk/models/meter-usage-analytics-request.d.ts +0 -26
- package/esm/sdk/models/meter-usage-analytics-request.d.ts.map +0 -1
- package/esm/sdk/models/meter-usage-analytics-request.js +0 -31
- package/esm/sdk/models/meter-usage-analytics-request.js.map +0 -1
- package/esm/sdk/models/meter-usage-analytics-response.d.ts +0 -11
- package/esm/sdk/models/meter-usage-analytics-response.d.ts.map +0 -1
- package/esm/sdk/models/meter-usage-analytics-response.js +0 -15
- package/esm/sdk/models/meter-usage-analytics-response.js.map +0 -1
- package/esm/sdk/models/meter-usage-point.d.ts +0 -12
- package/esm/sdk/models/meter-usage-point.d.ts.map +0 -1
- package/esm/sdk/models/meter-usage-point.js +0 -21
- package/esm/sdk/models/meter-usage-point.js.map +0 -1
- package/esm/sdk/models/meter-usage-query-request.d.ts +0 -26
- package/esm/sdk/models/meter-usage-query-request.d.ts.map +0 -1
- package/esm/sdk/models/meter-usage-query-request.js +0 -31
- package/esm/sdk/models/meter-usage-query-request.js.map +0 -1
- package/esm/sdk/models/meter-usage-query-response.d.ts +0 -16
- package/esm/sdk/models/meter-usage-query-response.d.ts.map +0 -1
- package/esm/sdk/models/meter-usage-query-response.js +0 -28
- package/esm/sdk/models/meter-usage-query-response.js.map +0 -1
- package/src/funcs/invoices-get-meter-usage-preview-invoice.ts +0 -172
- package/src/funcs/meter-usage-get-meter-usage-analytics.ts +0 -172
- package/src/funcs/meter-usage-query-meter-usage.ts +0 -172
- package/src/sdk/meter-usage.ts +0 -45
- package/src/sdk/models/meter-usage-analytics-request.ts +0 -69
- package/src/sdk/models/meter-usage-analytics-response.ts +0 -35
- package/src/sdk/models/meter-usage-point.ts +0 -43
- package/src/sdk/models/meter-usage-query-request.ts +0 -69
- package/src/sdk/models/meter-usage-query-response.ts +0 -58
package/jsr.json
CHANGED
package/package.json
CHANGED
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "1.0",
|
|
68
|
-
sdkVersion: "2.1.
|
|
69
|
-
genVersion: "2.
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 2.1.
|
|
68
|
+
sdkVersion: "2.1.11",
|
|
69
|
+
genVersion: "2.884.4",
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 2.1.11 2.884.4 1.0 @flexprice/sdk",
|
|
71
71
|
} as const;
|
package/src/sdk/invoices.ts
CHANGED
|
@@ -9,7 +9,6 @@ import { invoicesGetCustomerInvoiceSummary } from "../funcs/invoices-get-custome
|
|
|
9
9
|
import { invoicesGetInvoicePdf } from "../funcs/invoices-get-invoice-pdf.js";
|
|
10
10
|
import { invoicesGetInvoicePreview } from "../funcs/invoices-get-invoice-preview.js";
|
|
11
11
|
import { invoicesGetInvoice } from "../funcs/invoices-get-invoice.js";
|
|
12
|
-
import { invoicesGetMeterUsagePreviewInvoice } from "../funcs/invoices-get-meter-usage-preview-invoice.js";
|
|
13
12
|
import { invoicesQueryInvoice } from "../funcs/invoices-query-invoice.js";
|
|
14
13
|
import { invoicesRecalculateInvoiceV2 } from "../funcs/invoices-recalculate-invoice-v2.js";
|
|
15
14
|
import { invoicesRecalculateInvoice } from "../funcs/invoices-recalculate-invoice.js";
|
|
@@ -56,23 +55,6 @@ export class Invoices extends ClientSDK {
|
|
|
56
55
|
));
|
|
57
56
|
}
|
|
58
57
|
|
|
59
|
-
/**
|
|
60
|
-
* Get invoice preview using meter_usage data
|
|
61
|
-
*
|
|
62
|
-
* @remarks
|
|
63
|
-
* Preview invoice using the meter_usage table for usage data instead of feature_usage.
|
|
64
|
-
*/
|
|
65
|
-
async getMeterUsagePreviewInvoice(
|
|
66
|
-
request: models.GetPreviewInvoiceRequest,
|
|
67
|
-
options?: RequestOptions,
|
|
68
|
-
): Promise<models.InvoiceResponse> {
|
|
69
|
-
return unwrapAsync(invoicesGetMeterUsagePreviewInvoice(
|
|
70
|
-
this,
|
|
71
|
-
request,
|
|
72
|
-
options,
|
|
73
|
-
));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
58
|
/**
|
|
77
59
|
* Get invoice preview
|
|
78
60
|
*
|
|
@@ -95,6 +95,13 @@ export type CreateInvoiceRequest = {
|
|
|
95
95
|
invoicePdfUrl?: string | undefined;
|
|
96
96
|
invoiceStatus?: InvoiceStatus | undefined;
|
|
97
97
|
invoiceType?: InvoiceType | undefined;
|
|
98
|
+
/**
|
|
99
|
+
* issue_date overrides the user-facing date of the invoice.
|
|
100
|
+
*
|
|
101
|
+
* @remarks
|
|
102
|
+
* Defaults to created_at if not provided.
|
|
103
|
+
*/
|
|
104
|
+
issueDate?: Date | undefined;
|
|
98
105
|
/**
|
|
99
106
|
* Invoice Line Item Coupons
|
|
100
107
|
*/
|
|
@@ -160,6 +167,7 @@ export type CreateInvoiceRequest$Outbound = {
|
|
|
160
167
|
invoice_pdf_url?: string | undefined;
|
|
161
168
|
invoice_status?: string | undefined;
|
|
162
169
|
invoice_type?: string | undefined;
|
|
170
|
+
issue_date?: string | undefined;
|
|
163
171
|
line_item_coupons?: Array<InvoiceLineItemCoupon$Outbound> | undefined;
|
|
164
172
|
line_items?: Array<CreateInvoiceLineItemRequest$Outbound> | undefined;
|
|
165
173
|
metadata?: { [k: string]: string } | undefined;
|
|
@@ -196,6 +204,7 @@ export const CreateInvoiceRequest$outboundSchema: z.ZodMiniType<
|
|
|
196
204
|
invoicePdfUrl: z.optional(z.string()),
|
|
197
205
|
invoiceStatus: z.optional(InvoiceStatus$outboundSchema),
|
|
198
206
|
invoiceType: z.optional(InvoiceType$outboundSchema),
|
|
207
|
+
issueDate: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
|
|
199
208
|
lineItemCoupons: z.optional(z.array(InvoiceLineItemCoupon$outboundSchema)),
|
|
200
209
|
lineItems: z.optional(z.array(CreateInvoiceLineItemRequest$outboundSchema)),
|
|
201
210
|
metadata: z.optional(z.record(z.string(), z.string())),
|
|
@@ -226,6 +235,7 @@ export const CreateInvoiceRequest$outboundSchema: z.ZodMiniType<
|
|
|
226
235
|
invoicePdfUrl: "invoice_pdf_url",
|
|
227
236
|
invoiceStatus: "invoice_status",
|
|
228
237
|
invoiceType: "invoice_type",
|
|
238
|
+
issueDate: "issue_date",
|
|
229
239
|
lineItemCoupons: "line_item_coupons",
|
|
230
240
|
lineItems: "line_items",
|
|
231
241
|
paymentStatus: "payment_status",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import * as openEnums from "../../types/enums.js";
|
|
7
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
8
|
+
|
|
9
|
+
export const ErrorCode = {
|
|
10
|
+
HttpClientError: "http_client_error",
|
|
11
|
+
SystemError: "system_error",
|
|
12
|
+
InternalError: "internal_error",
|
|
13
|
+
NotFound: "not_found",
|
|
14
|
+
AlreadyExists: "already_exists",
|
|
15
|
+
VersionConflict: "version_conflict",
|
|
16
|
+
ValidationError: "validation_error",
|
|
17
|
+
InvalidOperation: "invalid_operation",
|
|
18
|
+
PermissionDenied: "permission_denied",
|
|
19
|
+
DatabaseError: "database_error",
|
|
20
|
+
ServiceUnavailable: "service_unavailable",
|
|
21
|
+
TooManyRequests: "too_many_requests",
|
|
22
|
+
} as const;
|
|
23
|
+
export type ErrorCode = OpenEnum<typeof ErrorCode>;
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const ErrorCode$inboundSchema: z.ZodMiniType<ErrorCode, unknown> =
|
|
27
|
+
openEnums.inboundSchema(ErrorCode);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import * as types from "../../types/primitives.js";
|
|
10
|
+
import { ErrorCode, ErrorCode$inboundSchema } from "./error-code.js";
|
|
11
|
+
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
12
|
+
|
|
13
|
+
export type ErrorResponse = {
|
|
14
|
+
code?: ErrorCode | undefined;
|
|
15
|
+
httpStatusCode?: number | undefined;
|
|
16
|
+
message?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const ErrorResponse$inboundSchema: z.ZodMiniType<
|
|
21
|
+
ErrorResponse,
|
|
22
|
+
unknown
|
|
23
|
+
> = z.pipe(
|
|
24
|
+
z.object({
|
|
25
|
+
code: types.optional(ErrorCode$inboundSchema),
|
|
26
|
+
http_status_code: types.optional(types.number()),
|
|
27
|
+
message: types.optional(types.string()),
|
|
28
|
+
}),
|
|
29
|
+
z.transform((v) => {
|
|
30
|
+
return remap$(v, {
|
|
31
|
+
"http_status_code": "httpStatusCode",
|
|
32
|
+
});
|
|
33
|
+
}),
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export function errorResponseFromJSON(
|
|
37
|
+
jsonString: string,
|
|
38
|
+
): SafeParseResult<ErrorResponse, SDKValidationError> {
|
|
39
|
+
return safeParse(
|
|
40
|
+
jsonString,
|
|
41
|
+
(x) => ErrorResponse$inboundSchema.parse(JSON.parse(x)),
|
|
42
|
+
`Failed to parse 'ErrorResponse' from JSON`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -4,41 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v4-mini";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import * as openEnums from "../../types/enums.js";
|
|
9
|
-
import { OpenEnum } from "../../types/enums.js";
|
|
10
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
11
7
|
import * as types from "../../types/primitives.js";
|
|
8
|
+
import { ErrorCode, ErrorCode$inboundSchema } from "./error-code.js";
|
|
12
9
|
import { FlexPriceError } from "./flex-price-error.js";
|
|
13
|
-
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
14
|
-
|
|
15
|
-
export const Code = {
|
|
16
|
-
NotFound: "not_found",
|
|
17
|
-
AlreadyExists: "already_exists",
|
|
18
|
-
VersionConflict: "version_conflict",
|
|
19
|
-
ValidationError: "validation_error",
|
|
20
|
-
InvalidOperation: "invalid_operation",
|
|
21
|
-
PermissionDenied: "permission_denied",
|
|
22
|
-
HttpClientError: "http_client_error",
|
|
23
|
-
DatabaseError: "database_error",
|
|
24
|
-
SystemError: "system_error",
|
|
25
|
-
InternalError: "internal_error",
|
|
26
|
-
ServiceUnavailable: "service_unavailable",
|
|
27
|
-
} as const;
|
|
28
|
-
export type Code = OpenEnum<typeof Code>;
|
|
29
|
-
|
|
30
|
-
export type Details = {};
|
|
31
10
|
|
|
32
11
|
export type ErrorsErrorResponseData = {
|
|
33
|
-
code?:
|
|
34
|
-
details?: { [k: string]: Details } | undefined;
|
|
12
|
+
code?: ErrorCode | undefined;
|
|
35
13
|
httpStatusCode?: number | undefined;
|
|
36
14
|
message?: string | undefined;
|
|
37
15
|
};
|
|
38
16
|
|
|
39
17
|
export class ErrorsErrorResponse extends FlexPriceError {
|
|
40
|
-
code?:
|
|
41
|
-
details?: { [k: string]: Details } | undefined;
|
|
18
|
+
code?: ErrorCode | undefined;
|
|
42
19
|
httpStatusCode?: number | undefined;
|
|
43
20
|
|
|
44
21
|
/** The original data that was passed to this error instance. */
|
|
@@ -52,49 +29,19 @@ export class ErrorsErrorResponse extends FlexPriceError {
|
|
|
52
29
|
super(message, httpMeta);
|
|
53
30
|
this.data$ = err;
|
|
54
31
|
if (err.code != null) this.code = err.code;
|
|
55
|
-
if (err.details != null) this.details = err.details;
|
|
56
32
|
if (err.httpStatusCode != null) this.httpStatusCode = err.httpStatusCode;
|
|
57
33
|
|
|
58
34
|
this.name = "ErrorsErrorResponse";
|
|
59
35
|
}
|
|
60
36
|
}
|
|
61
37
|
|
|
62
|
-
export type ErrorResponse = {
|
|
63
|
-
code?: Code | undefined;
|
|
64
|
-
details?: { [k: string]: Details } | undefined;
|
|
65
|
-
httpStatusCode?: number | undefined;
|
|
66
|
-
message?: string | undefined;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
/** @internal */
|
|
70
|
-
export const Code$inboundSchema: z.ZodMiniType<Code, unknown> = openEnums
|
|
71
|
-
.inboundSchema(Code);
|
|
72
|
-
|
|
73
|
-
/** @internal */
|
|
74
|
-
export const Details$inboundSchema: z.ZodMiniType<Details, unknown> = z.object(
|
|
75
|
-
{},
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
export function detailsFromJSON(
|
|
79
|
-
jsonString: string,
|
|
80
|
-
): SafeParseResult<Details, SDKValidationError> {
|
|
81
|
-
return safeParse(
|
|
82
|
-
jsonString,
|
|
83
|
-
(x) => Details$inboundSchema.parse(JSON.parse(x)),
|
|
84
|
-
`Failed to parse 'Details' from JSON`,
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
38
|
/** @internal */
|
|
89
39
|
export const ErrorsErrorResponse$inboundSchema: z.ZodMiniType<
|
|
90
40
|
ErrorsErrorResponse,
|
|
91
41
|
unknown
|
|
92
42
|
> = z.pipe(
|
|
93
43
|
z.object({
|
|
94
|
-
code: types.optional(
|
|
95
|
-
details: types.optional(
|
|
96
|
-
z.record(z.string(), z.lazy(() => Details$inboundSchema)),
|
|
97
|
-
),
|
|
44
|
+
code: types.optional(ErrorCode$inboundSchema),
|
|
98
45
|
http_status_code: types.optional(types.number()),
|
|
99
46
|
message: types.optional(types.string()),
|
|
100
47
|
request$: z.custom<Request>(x => x instanceof Request),
|
|
@@ -113,33 +60,3 @@ export const ErrorsErrorResponse$inboundSchema: z.ZodMiniType<
|
|
|
113
60
|
});
|
|
114
61
|
}),
|
|
115
62
|
);
|
|
116
|
-
|
|
117
|
-
/** @internal */
|
|
118
|
-
export const ErrorResponse$inboundSchema: z.ZodMiniType<
|
|
119
|
-
ErrorResponse,
|
|
120
|
-
unknown
|
|
121
|
-
> = z.pipe(
|
|
122
|
-
z.object({
|
|
123
|
-
code: types.optional(Code$inboundSchema),
|
|
124
|
-
details: types.optional(
|
|
125
|
-
z.record(z.string(), z.lazy(() => Details$inboundSchema)),
|
|
126
|
-
),
|
|
127
|
-
http_status_code: types.optional(types.number()),
|
|
128
|
-
message: types.optional(types.string()),
|
|
129
|
-
}),
|
|
130
|
-
z.transform((v) => {
|
|
131
|
-
return remap$(v, {
|
|
132
|
-
"http_status_code": "httpStatusCode",
|
|
133
|
-
});
|
|
134
|
-
}),
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
export function errorResponseFromJSON(
|
|
138
|
-
jsonString: string,
|
|
139
|
-
): SafeParseResult<ErrorResponse, SDKValidationError> {
|
|
140
|
-
return safeParse(
|
|
141
|
-
jsonString,
|
|
142
|
-
(x) => ErrorResponse$inboundSchema.parse(JSON.parse(x)),
|
|
143
|
-
`Failed to parse 'ErrorResponse' from JSON`,
|
|
144
|
-
);
|
|
145
|
-
}
|
package/src/sdk/models/index.ts
CHANGED
|
@@ -168,6 +168,8 @@ export * from "./entitlement-usage-reset-period.js";
|
|
|
168
168
|
export * from "./entity-integration-mapping-response.js";
|
|
169
169
|
export * from "./entity-type.js";
|
|
170
170
|
export * from "./environment-type.js";
|
|
171
|
+
export * from "./error-code.js";
|
|
172
|
+
export * from "./error-response.js";
|
|
171
173
|
export * from "./errors-error-response.js";
|
|
172
174
|
export * from "./event-cost-info.js";
|
|
173
175
|
export * from "./event-processing-status-type.js";
|
|
@@ -315,11 +317,6 @@ export * from "./meter-filter.js";
|
|
|
315
317
|
export * from "./meter-matching-result.js";
|
|
316
318
|
export * from "./meter-meter.js";
|
|
317
319
|
export * from "./meter-response.js";
|
|
318
|
-
export * from "./meter-usage-analytics-request.js";
|
|
319
|
-
export * from "./meter-usage-analytics-response.js";
|
|
320
|
-
export * from "./meter-usage-point.js";
|
|
321
|
-
export * from "./meter-usage-query-request.js";
|
|
322
|
-
export * from "./meter-usage-query-response.js";
|
|
323
320
|
export * from "./models-temporal-workflow-result.js";
|
|
324
321
|
export * from "./override-entitlement-request.js";
|
|
325
322
|
export * from "./override-line-item-request.js";
|
|
@@ -123,6 +123,10 @@ export type InvoiceResponse = {
|
|
|
123
123
|
invoicePdfUrl?: string | undefined;
|
|
124
124
|
invoiceStatus?: InvoiceStatus | undefined;
|
|
125
125
|
invoiceType?: InvoiceType | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* issue_date is the user-facing date of the invoice. Defaults to created_at if not set.
|
|
128
|
+
*/
|
|
129
|
+
issueDate?: Date | undefined;
|
|
126
130
|
/**
|
|
127
131
|
* last_computed_at is the timestamp when this invoice was last computed by ComputeInvoice
|
|
128
132
|
*/
|
|
@@ -244,6 +248,7 @@ export const InvoiceResponse$inboundSchema: z.ZodMiniType<
|
|
|
244
248
|
invoice_pdf_url: types.optional(types.string()),
|
|
245
249
|
invoice_status: types.optional(InvoiceStatus$inboundSchema),
|
|
246
250
|
invoice_type: types.optional(InvoiceType$inboundSchema),
|
|
251
|
+
issue_date: types.optional(types.date()),
|
|
247
252
|
last_computed_at: types.optional(types.date()),
|
|
248
253
|
line_items: types.optional(z.array(InvoiceLineItemResponse$inboundSchema)),
|
|
249
254
|
metadata: types.optional(z.record(z.string(), types.string())),
|
|
@@ -293,6 +298,7 @@ export const InvoiceResponse$inboundSchema: z.ZodMiniType<
|
|
|
293
298
|
"invoice_pdf_url": "invoicePdfUrl",
|
|
294
299
|
"invoice_status": "invoiceStatus",
|
|
295
300
|
"invoice_type": "invoiceType",
|
|
301
|
+
"issue_date": "issueDate",
|
|
296
302
|
"last_computed_at": "lastComputedAt",
|
|
297
303
|
"line_items": "lineItems",
|
|
298
304
|
"overpaid_amount": "overpaidAmount",
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
ErrorResponse,
|
|
16
16
|
ErrorResponse$inboundSchema,
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./error-response.js";
|
|
18
18
|
import { MatchedMeter, MatchedMeter$inboundSchema } from "./matched-meter.js";
|
|
19
19
|
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
20
20
|
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
ErrorResponse,
|
|
16
16
|
ErrorResponse$inboundSchema,
|
|
17
|
-
} from "./
|
|
17
|
+
} from "./error-response.js";
|
|
18
18
|
import { MatchedPrice, MatchedPrice$inboundSchema } from "./matched-price.js";
|
|
19
19
|
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
20
20
|
|
|
@@ -7,6 +7,7 @@ import * as openEnums from "../../types/enums.js";
|
|
|
7
7
|
import { OpenEnum } from "../../types/enums.js";
|
|
8
8
|
|
|
9
9
|
export const WindowSize = {
|
|
10
|
+
Month: "MONTH",
|
|
10
11
|
Minute: "MINUTE",
|
|
11
12
|
FifteenMIN: "15MIN",
|
|
12
13
|
ThirtyMIN: "30MIN",
|
|
@@ -16,7 +17,6 @@ export const WindowSize = {
|
|
|
16
17
|
TwelveHOUR: "12HOUR",
|
|
17
18
|
Day: "DAY",
|
|
18
19
|
Week: "WEEK",
|
|
19
|
-
Month: "MONTH",
|
|
20
20
|
} as const;
|
|
21
21
|
export type WindowSize = OpenEnum<typeof WindowSize>;
|
|
22
22
|
|
package/src/sdk/sdk.ts
CHANGED
|
@@ -17,7 +17,6 @@ import { Features } from "./features.js";
|
|
|
17
17
|
import { Groups } from "./groups.js";
|
|
18
18
|
import { Integrations } from "./integrations.js";
|
|
19
19
|
import { Invoices } from "./invoices.js";
|
|
20
|
-
import { MeterUsage } from "./meter-usage.js";
|
|
21
20
|
import { Payments } from "./payments.js";
|
|
22
21
|
import { Plans } from "./plans.js";
|
|
23
22
|
import { PriceUnits } from "./price-units.js";
|
|
@@ -111,11 +110,6 @@ export class Flexprice extends ClientSDK {
|
|
|
111
110
|
return (this._integrations ??= new Integrations(this._options));
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
private _meterUsage?: MeterUsage;
|
|
115
|
-
get meterUsage(): MeterUsage {
|
|
116
|
-
return (this._meterUsage ??= new MeterUsage(this._options));
|
|
117
|
-
}
|
|
118
|
-
|
|
119
113
|
private _payments?: Payments;
|
|
120
114
|
get payments(): Payments {
|
|
121
115
|
return (this._payments ??= new Payments(this._options));
|
package/docs/sdk/models/code.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# Code
|
|
2
|
-
|
|
3
|
-
## Example Usage
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { Code } from "@flexprice/sdk/sdk/models";
|
|
7
|
-
|
|
8
|
-
let value: Code = "not_found";
|
|
9
|
-
|
|
10
|
-
// Open enum: unrecognized values are captured as Unrecognized<string>
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Values
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
"not_found" | "already_exists" | "version_conflict" | "validation_error" | "invalid_operation" | "permission_denied" | "http_client_error" | "database_error" | "system_error" | "internal_error" | "service_unavailable" | Unrecognized<string>
|
|
17
|
-
```
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
# Details
|
|
2
|
-
|
|
3
|
-
## Example Usage
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { Details } from "@flexprice/sdk/sdk/models";
|
|
7
|
-
|
|
8
|
-
let value: Details = {};
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Fields
|
|
12
|
-
|
|
13
|
-
| Field | Type | Required | Description |
|
|
14
|
-
| ----------- | ----------- | ----------- | ----------- |
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# MeterUsageAnalyticsRequest
|
|
2
|
-
|
|
3
|
-
## Example Usage
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { MeterUsageAnalyticsRequest } from "@flexprice/sdk/sdk/models";
|
|
7
|
-
|
|
8
|
-
let value: MeterUsageAnalyticsRequest = {
|
|
9
|
-
aggregationType: "SUM",
|
|
10
|
-
endTime: new Date("2024-02-01T00:00:00Z"),
|
|
11
|
-
externalCustomerId: "cust_123",
|
|
12
|
-
meterIds: [
|
|
13
|
-
"mtr_abc",
|
|
14
|
-
"mtr_def",
|
|
15
|
-
],
|
|
16
|
-
startTime: new Date("2024-01-01T00:00:00Z"),
|
|
17
|
-
};
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## Fields
|
|
21
|
-
|
|
22
|
-
| Field | Type | Required | Description | Example |
|
|
23
|
-
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
24
|
-
| `aggregationType` | [models.AggregationType](../../sdk/models/aggregation-type.md) | :heavy_check_mark: | N/A | |
|
|
25
|
-
| `billingAnchor` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | N/A | |
|
|
26
|
-
| `endTime` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-02-01T00:00:00Z |
|
|
27
|
-
| `externalCustomerId` | *string* | :heavy_check_mark: | N/A | cust_123 |
|
|
28
|
-
| `meterIds` | *string*[] | :heavy_check_mark: | N/A | [<br/>"mtr_abc",<br/>"mtr_def"<br/>] |
|
|
29
|
-
| `startTime` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-01-01T00:00:00Z |
|
|
30
|
-
| `windowSize` | [models.WindowSize](../../sdk/models/window-size.md) | :heavy_minus_sign: | N/A | |
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# MeterUsageAnalyticsResponse
|
|
2
|
-
|
|
3
|
-
## Example Usage
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { MeterUsageAnalyticsResponse } from "@flexprice/sdk/sdk/models";
|
|
7
|
-
|
|
8
|
-
let value: MeterUsageAnalyticsResponse = {
|
|
9
|
-
items: [
|
|
10
|
-
{
|
|
11
|
-
eventCount: 42,
|
|
12
|
-
meterId: "mtr_abc",
|
|
13
|
-
points: [
|
|
14
|
-
{
|
|
15
|
-
eventCount: 10,
|
|
16
|
-
timestamp: "2024-01-01T00:00:00Z",
|
|
17
|
-
value: "100.0000",
|
|
18
|
-
},
|
|
19
|
-
],
|
|
20
|
-
totalValue: "1234.5678",
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
};
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Fields
|
|
27
|
-
|
|
28
|
-
| Field | Type | Required | Description |
|
|
29
|
-
| ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
30
|
-
| `items` | [models.MeterUsageQueryResponse](../../sdk/models/meter-usage-query-response.md)[] | :heavy_minus_sign: | N/A |
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# MeterUsagePoint
|
|
2
|
-
|
|
3
|
-
## Example Usage
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { MeterUsagePoint } from "@flexprice/sdk/sdk/models";
|
|
7
|
-
|
|
8
|
-
let value: MeterUsagePoint = {
|
|
9
|
-
eventCount: 10,
|
|
10
|
-
timestamp: "2024-01-01T00:00:00Z",
|
|
11
|
-
value: "100.0000",
|
|
12
|
-
};
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Fields
|
|
16
|
-
|
|
17
|
-
| Field | Type | Required | Description | Example |
|
|
18
|
-
| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- |
|
|
19
|
-
| `eventCount` | *number* | :heavy_minus_sign: | N/A | 10 |
|
|
20
|
-
| `timestamp` | *string* | :heavy_minus_sign: | N/A | 2024-01-01T00:00:00Z |
|
|
21
|
-
| `value` | *string* | :heavy_minus_sign: | N/A | 100.0000 |
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# MeterUsageQueryRequest
|
|
2
|
-
|
|
3
|
-
## Example Usage
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { MeterUsageQueryRequest } from "@flexprice/sdk/sdk/models";
|
|
7
|
-
|
|
8
|
-
let value: MeterUsageQueryRequest = {
|
|
9
|
-
aggregationType: "MAX",
|
|
10
|
-
billingAnchor: new Date("2024-01-15T00:00:00Z"),
|
|
11
|
-
endTime: new Date("2024-02-01T00:00:00Z"),
|
|
12
|
-
externalCustomerId: "cust_123",
|
|
13
|
-
meterId: "mtr_abc",
|
|
14
|
-
startTime: new Date("2024-01-01T00:00:00Z"),
|
|
15
|
-
};
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Fields
|
|
19
|
-
|
|
20
|
-
| Field | Type | Required | Description | Example |
|
|
21
|
-
| --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
22
|
-
| `aggregationType` | [models.AggregationType](../../sdk/models/aggregation-type.md) | :heavy_check_mark: | N/A | |
|
|
23
|
-
| `billingAnchor` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_minus_sign: | N/A | 2024-01-15T00:00:00Z |
|
|
24
|
-
| `endTime` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-02-01T00:00:00Z |
|
|
25
|
-
| `externalCustomerId` | *string* | :heavy_check_mark: | N/A | cust_123 |
|
|
26
|
-
| `meterId` | *string* | :heavy_check_mark: | N/A | mtr_abc |
|
|
27
|
-
| `startTime` | [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) | :heavy_check_mark: | N/A | 2024-01-01T00:00:00Z |
|
|
28
|
-
| `windowSize` | [models.WindowSize](../../sdk/models/window-size.md) | :heavy_minus_sign: | N/A | |
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# MeterUsageQueryResponse
|
|
2
|
-
|
|
3
|
-
## Example Usage
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
import { MeterUsageQueryResponse } from "@flexprice/sdk/sdk/models";
|
|
7
|
-
|
|
8
|
-
let value: MeterUsageQueryResponse = {
|
|
9
|
-
eventCount: 42,
|
|
10
|
-
meterId: "mtr_abc",
|
|
11
|
-
points: [
|
|
12
|
-
{
|
|
13
|
-
eventCount: 10,
|
|
14
|
-
timestamp: "2024-01-01T00:00:00Z",
|
|
15
|
-
value: "100.0000",
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
totalValue: "1234.5678",
|
|
19
|
-
};
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Fields
|
|
23
|
-
|
|
24
|
-
| Field | Type | Required | Description | Example |
|
|
25
|
-
| ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
26
|
-
| `aggregationType` | [models.AggregationType](../../sdk/models/aggregation-type.md) | :heavy_minus_sign: | N/A | |
|
|
27
|
-
| `eventCount` | *number* | :heavy_minus_sign: | N/A | 42 |
|
|
28
|
-
| `meterId` | *string* | :heavy_minus_sign: | N/A | mtr_abc |
|
|
29
|
-
| `points` | [models.MeterUsagePoint](../../sdk/models/meter-usage-point.md)[] | :heavy_minus_sign: | N/A | |
|
|
30
|
-
| `totalValue` | *string* | :heavy_minus_sign: | N/A | 1234.5678 |
|