@paygentic/sdk 0.7.0 → 0.7.2
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/README.md +13 -3
- package/dist/commonjs/funcs/billableMetricsListEvents.js +1 -0
- package/dist/commonjs/funcs/billableMetricsListEvents.js.map +1 -1
- package/dist/commonjs/funcs/invoicesV2List.js +1 -0
- package/dist/commonjs/funcs/invoicesV2List.js.map +1 -1
- package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.d.ts +18 -0
- package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.d.ts.map +1 -0
- package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.js +127 -0
- package/dist/commonjs/funcs/paymentSessionsListPaymentSessions.js.map +1 -0
- package/dist/commonjs/funcs/profitabilityGetProfitability.d.ts +19 -0
- package/dist/commonjs/funcs/profitabilityGetProfitability.d.ts.map +1 -0
- package/dist/commonjs/funcs/profitabilityGetProfitability.js +127 -0
- package/dist/commonjs/funcs/profitabilityGetProfitability.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/index.d.ts +4 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +4 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/meterevent.d.ts +4 -0
- package/dist/commonjs/models/meterevent.d.ts.map +1 -1
- package/dist/commonjs/models/meterevent.js +1 -0
- package/dist/commonjs/models/meterevent.js.map +1 -1
- package/dist/commonjs/models/offsetpagination.d.ts +4 -4
- package/dist/commonjs/models/offsetpagination.d.ts.map +1 -1
- package/dist/commonjs/models/offsetpagination.js +3 -3
- package/dist/commonjs/models/offsetpagination.js.map +1 -1
- package/dist/commonjs/models/operations/createplan.d.ts +5 -0
- package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createplan.js +2 -0
- package/dist/commonjs/models/operations/createplan.js.map +1 -1
- package/dist/commonjs/models/operations/getprofitability.d.ts +55 -0
- package/dist/commonjs/models/operations/getprofitability.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getprofitability.js +64 -0
- package/dist/commonjs/models/operations/getprofitability.js.map +1 -0
- package/dist/commonjs/models/operations/getrevenue.d.ts +4 -4
- package/dist/commonjs/models/operations/getrevenue.d.ts.map +1 -1
- package/dist/commonjs/models/operations/getrevenue.js +4 -5
- package/dist/commonjs/models/operations/getrevenue.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listbillablemetricevents.d.ts +5 -0
- package/dist/commonjs/models/operations/listbillablemetricevents.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listbillablemetricevents.js +1 -0
- package/dist/commonjs/models/operations/listbillablemetricevents.js.map +1 -1
- package/dist/commonjs/models/operations/listinvoices.d.ts +9 -0
- package/dist/commonjs/models/operations/listinvoices.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listinvoices.js +2 -0
- package/dist/commonjs/models/operations/listinvoices.js.map +1 -1
- package/dist/commonjs/models/operations/listpaymentsessions.d.ts +36 -10
- package/dist/commonjs/models/operations/listpaymentsessions.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listpaymentsessions.js +19 -4
- package/dist/commonjs/models/operations/listpaymentsessions.js.map +1 -1
- package/dist/commonjs/models/operations/updateplan.d.ts +5 -0
- package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateplan.js +2 -0
- package/dist/commonjs/models/operations/updateplan.js.map +1 -1
- package/dist/commonjs/models/paymentsession.d.ts +68 -0
- package/dist/commonjs/models/paymentsession.d.ts.map +1 -0
- package/dist/commonjs/models/paymentsession.js +78 -0
- package/dist/commonjs/models/paymentsession.js.map +1 -0
- package/dist/commonjs/models/plan.d.ts +4 -0
- package/dist/commonjs/models/plan.d.ts.map +1 -1
- package/dist/commonjs/models/plan.js +1 -0
- package/dist/commonjs/models/plan.js.map +1 -1
- package/dist/commonjs/models/profitabilityrow.d.ts +38 -0
- package/dist/commonjs/models/profitabilityrow.d.ts.map +1 -0
- package/dist/commonjs/models/profitabilityrow.js +57 -0
- package/dist/commonjs/models/profitabilityrow.js.map +1 -0
- package/dist/commonjs/models/profitabilitysummaryresponse.d.ts +26 -0
- package/dist/commonjs/models/profitabilitysummaryresponse.d.ts.map +1 -0
- package/dist/commonjs/models/profitabilitysummaryresponse.js +54 -0
- package/dist/commonjs/models/profitabilitysummaryresponse.js.map +1 -0
- package/dist/commonjs/models/profitabilitytrend.d.ts +17 -0
- package/dist/commonjs/models/profitabilitytrend.d.ts.map +1 -0
- package/dist/commonjs/models/profitabilitytrend.js +51 -0
- package/dist/commonjs/models/profitabilitytrend.js.map +1 -0
- package/dist/commonjs/models/purchasegrantresponse.d.ts +4 -4
- package/dist/commonjs/models/purchasegrantresponse.d.ts.map +1 -1
- package/dist/commonjs/models/purchasegrantresponse.js +6 -6
- package/dist/commonjs/models/purchasegrantresponse.js.map +1 -1
- package/dist/commonjs/sdk/paymentsessions.d.ts +12 -0
- package/dist/commonjs/sdk/paymentsessions.d.ts.map +1 -0
- package/dist/commonjs/sdk/paymentsessions.js +22 -0
- package/dist/commonjs/sdk/paymentsessions.js.map +1 -0
- package/dist/commonjs/sdk/profitability.d.ts +13 -0
- package/dist/commonjs/sdk/profitability.d.ts.map +1 -0
- package/dist/commonjs/sdk/profitability.js +22 -0
- package/dist/commonjs/sdk/profitability.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +6 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +8 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/billableMetricsListEvents.js +1 -0
- package/dist/esm/funcs/billableMetricsListEvents.js.map +1 -1
- package/dist/esm/funcs/invoicesV2List.js +1 -0
- package/dist/esm/funcs/invoicesV2List.js.map +1 -1
- package/dist/esm/funcs/paymentSessionsListPaymentSessions.d.ts +18 -0
- package/dist/esm/funcs/paymentSessionsListPaymentSessions.d.ts.map +1 -0
- package/dist/esm/funcs/paymentSessionsListPaymentSessions.js +91 -0
- package/dist/esm/funcs/paymentSessionsListPaymentSessions.js.map +1 -0
- package/dist/esm/funcs/profitabilityGetProfitability.d.ts +19 -0
- package/dist/esm/funcs/profitabilityGetProfitability.d.ts.map +1 -0
- package/dist/esm/funcs/profitabilityGetProfitability.js +91 -0
- package/dist/esm/funcs/profitabilityGetProfitability.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/index.d.ts +4 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +4 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/meterevent.d.ts +4 -0
- package/dist/esm/models/meterevent.d.ts.map +1 -1
- package/dist/esm/models/meterevent.js +1 -0
- package/dist/esm/models/meterevent.js.map +1 -1
- package/dist/esm/models/offsetpagination.d.ts +4 -4
- package/dist/esm/models/offsetpagination.d.ts.map +1 -1
- package/dist/esm/models/offsetpagination.js +3 -3
- package/dist/esm/models/offsetpagination.js.map +1 -1
- package/dist/esm/models/operations/createplan.d.ts +5 -0
- package/dist/esm/models/operations/createplan.d.ts.map +1 -1
- package/dist/esm/models/operations/createplan.js +2 -0
- package/dist/esm/models/operations/createplan.js.map +1 -1
- package/dist/esm/models/operations/getprofitability.d.ts +55 -0
- package/dist/esm/models/operations/getprofitability.d.ts.map +1 -0
- package/dist/esm/models/operations/getprofitability.js +27 -0
- package/dist/esm/models/operations/getprofitability.js.map +1 -0
- package/dist/esm/models/operations/getrevenue.d.ts +4 -4
- package/dist/esm/models/operations/getrevenue.d.ts.map +1 -1
- package/dist/esm/models/operations/getrevenue.js +3 -4
- package/dist/esm/models/operations/getrevenue.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listbillablemetricevents.d.ts +5 -0
- package/dist/esm/models/operations/listbillablemetricevents.d.ts.map +1 -1
- package/dist/esm/models/operations/listbillablemetricevents.js +1 -0
- package/dist/esm/models/operations/listbillablemetricevents.js.map +1 -1
- package/dist/esm/models/operations/listinvoices.d.ts +9 -0
- package/dist/esm/models/operations/listinvoices.d.ts.map +1 -1
- package/dist/esm/models/operations/listinvoices.js +2 -0
- package/dist/esm/models/operations/listinvoices.js.map +1 -1
- package/dist/esm/models/operations/listpaymentsessions.d.ts +36 -10
- package/dist/esm/models/operations/listpaymentsessions.d.ts.map +1 -1
- package/dist/esm/models/operations/listpaymentsessions.js +18 -3
- package/dist/esm/models/operations/listpaymentsessions.js.map +1 -1
- package/dist/esm/models/operations/updateplan.d.ts +5 -0
- package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
- package/dist/esm/models/operations/updateplan.js +2 -0
- package/dist/esm/models/operations/updateplan.js.map +1 -1
- package/dist/esm/models/paymentsession.d.ts +68 -0
- package/dist/esm/models/paymentsession.d.ts.map +1 -0
- package/dist/esm/models/paymentsession.js +41 -0
- package/dist/esm/models/paymentsession.js.map +1 -0
- package/dist/esm/models/plan.d.ts +4 -0
- package/dist/esm/models/plan.d.ts.map +1 -1
- package/dist/esm/models/plan.js +1 -0
- package/dist/esm/models/plan.js.map +1 -1
- package/dist/esm/models/profitabilityrow.d.ts +38 -0
- package/dist/esm/models/profitabilityrow.d.ts.map +1 -0
- package/dist/esm/models/profitabilityrow.js +20 -0
- package/dist/esm/models/profitabilityrow.js.map +1 -0
- package/dist/esm/models/profitabilitysummaryresponse.d.ts +26 -0
- package/dist/esm/models/profitabilitysummaryresponse.d.ts.map +1 -0
- package/dist/esm/models/profitabilitysummaryresponse.js +17 -0
- package/dist/esm/models/profitabilitysummaryresponse.js.map +1 -0
- package/dist/esm/models/profitabilitytrend.d.ts +17 -0
- package/dist/esm/models/profitabilitytrend.d.ts.map +1 -0
- package/dist/esm/models/profitabilitytrend.js +14 -0
- package/dist/esm/models/profitabilitytrend.js.map +1 -0
- package/dist/esm/models/purchasegrantresponse.d.ts +4 -4
- package/dist/esm/models/purchasegrantresponse.d.ts.map +1 -1
- package/dist/esm/models/purchasegrantresponse.js +4 -4
- package/dist/esm/models/purchasegrantresponse.js.map +1 -1
- package/dist/esm/sdk/paymentsessions.d.ts +12 -0
- package/dist/esm/sdk/paymentsessions.d.ts.map +1 -0
- package/dist/esm/sdk/paymentsessions.js +18 -0
- package/dist/esm/sdk/paymentsessions.js.map +1 -0
- package/dist/esm/sdk/profitability.d.ts +13 -0
- package/dist/esm/sdk/profitability.d.ts.map +1 -0
- package/dist/esm/sdk/profitability.js +18 -0
- package/dist/esm/sdk/profitability.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +6 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +8 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/billableMetricsListEvents.ts +1 -0
- package/src/funcs/invoicesV2List.ts +1 -0
- package/src/funcs/paymentSessionsListPaymentSessions.ts +183 -0
- package/src/funcs/profitabilityGetProfitability.ts +184 -0
- package/src/lib/config.ts +2 -2
- package/src/models/index.ts +4 -0
- package/src/models/meterevent.ts +5 -0
- package/src/models/offsetpagination.ts +7 -7
- package/src/models/operations/createplan.ts +7 -0
- package/src/models/operations/getprofitability.ts +85 -0
- package/src/models/operations/getrevenue.ts +7 -6
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/listbillablemetricevents.ts +6 -0
- package/src/models/operations/listinvoices.ts +11 -0
- package/src/models/operations/listpaymentsessions.ts +43 -12
- package/src/models/operations/updateplan.ts +7 -0
- package/src/models/paymentsession.ts +109 -0
- package/src/models/plan.ts +7 -0
- package/src/models/profitabilityrow.ts +68 -0
- package/src/models/profitabilitysummaryresponse.ts +53 -0
- package/src/models/profitabilitytrend.ts +39 -0
- package/src/models/purchasegrantresponse.ts +12 -9
- package/src/sdk/paymentsessions.ts +27 -0
- package/src/sdk/profitability.ts +28 -0
- package/src/sdk/sdk.ts +12 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Time bucket granularity for the per-customer revenue trend. When omitted, the server picks a reasonable bucket from the window length.
|
|
10
|
+
*/
|
|
11
|
+
export const GetProfitabilityBucketWidth = {
|
|
12
|
+
Hour: "hour",
|
|
13
|
+
Day: "day",
|
|
14
|
+
Week: "week",
|
|
15
|
+
} as const;
|
|
16
|
+
/**
|
|
17
|
+
* Time bucket granularity for the per-customer revenue trend. When omitted, the server picks a reasonable bucket from the window length.
|
|
18
|
+
*/
|
|
19
|
+
export type GetProfitabilityBucketWidth = ClosedEnum<
|
|
20
|
+
typeof GetProfitabilityBucketWidth
|
|
21
|
+
>;
|
|
22
|
+
|
|
23
|
+
export type GetProfitabilityRequest = {
|
|
24
|
+
/**
|
|
25
|
+
* Merchant whose customers to summarize
|
|
26
|
+
*/
|
|
27
|
+
merchantId: string;
|
|
28
|
+
/**
|
|
29
|
+
* Start of the time range (ISO 8601 format)
|
|
30
|
+
*/
|
|
31
|
+
from: Date;
|
|
32
|
+
/**
|
|
33
|
+
* End of the time range (ISO 8601 format)
|
|
34
|
+
*/
|
|
35
|
+
to: Date;
|
|
36
|
+
/**
|
|
37
|
+
* Number of top customers (by profit) to return individually. The rest are rolled into a single 'Other' row.
|
|
38
|
+
*/
|
|
39
|
+
topN?: number | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* ISO 4217 currency code to scope the summary. Defaults to the merchant's primary currency.
|
|
42
|
+
*/
|
|
43
|
+
currency?: string | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Time bucket granularity for the per-customer revenue trend. When omitted, the server picks a reasonable bucket from the window length.
|
|
46
|
+
*/
|
|
47
|
+
bucketWidth?: GetProfitabilityBucketWidth | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/** @internal */
|
|
51
|
+
export const GetProfitabilityBucketWidth$outboundSchema: z.ZodNativeEnum<
|
|
52
|
+
typeof GetProfitabilityBucketWidth
|
|
53
|
+
> = z.nativeEnum(GetProfitabilityBucketWidth);
|
|
54
|
+
|
|
55
|
+
/** @internal */
|
|
56
|
+
export type GetProfitabilityRequest$Outbound = {
|
|
57
|
+
merchantId: string;
|
|
58
|
+
from: string;
|
|
59
|
+
to: string;
|
|
60
|
+
topN: number;
|
|
61
|
+
currency?: string | undefined;
|
|
62
|
+
bucketWidth: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
/** @internal */
|
|
66
|
+
export const GetProfitabilityRequest$outboundSchema: z.ZodType<
|
|
67
|
+
GetProfitabilityRequest$Outbound,
|
|
68
|
+
z.ZodTypeDef,
|
|
69
|
+
GetProfitabilityRequest
|
|
70
|
+
> = z.object({
|
|
71
|
+
merchantId: z.string(),
|
|
72
|
+
from: z.date().transform(v => v.toISOString()),
|
|
73
|
+
to: z.date().transform(v => v.toISOString()),
|
|
74
|
+
topN: z.number().int().default(10),
|
|
75
|
+
currency: z.string().optional(),
|
|
76
|
+
bucketWidth: GetProfitabilityBucketWidth$outboundSchema.default("day"),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export function getProfitabilityRequestToJSON(
|
|
80
|
+
getProfitabilityRequest: GetProfitabilityRequest,
|
|
81
|
+
): string {
|
|
82
|
+
return JSON.stringify(
|
|
83
|
+
GetProfitabilityRequest$outboundSchema.parse(getProfitabilityRequest),
|
|
84
|
+
);
|
|
85
|
+
}
|
|
@@ -8,7 +8,7 @@ import { ClosedEnum } from "../../types/enums.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Time bucket granularity for trend data
|
|
10
10
|
*/
|
|
11
|
-
export const
|
|
11
|
+
export const GetRevenueBucketWidth = {
|
|
12
12
|
Hour: "hour",
|
|
13
13
|
Day: "day",
|
|
14
14
|
Week: "week",
|
|
@@ -16,7 +16,7 @@ export const BucketWidth = {
|
|
|
16
16
|
/**
|
|
17
17
|
* Time bucket granularity for trend data
|
|
18
18
|
*/
|
|
19
|
-
export type
|
|
19
|
+
export type GetRevenueBucketWidth = ClosedEnum<typeof GetRevenueBucketWidth>;
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Group invoice data by dimension. Allowed values: 'plan' (max 5 groups, top 4 + 'other' when exceeding), 'customer' (max 25 groups, top 24 + 'other' when exceeding, sorted by revenue descending), 'currency' (one entry per currency, primary currency first then alphabetical). Note: groupBy values are mutually exclusive — combining them returns a 400 error. When groupBy=currency is active, top-level netRevenue, invoices, and payments fields are omitted; currencyBreakdown is the sole data source.
|
|
@@ -43,7 +43,7 @@ export type GetRevenueRequest = {
|
|
|
43
43
|
/**
|
|
44
44
|
* Time bucket granularity for trend data
|
|
45
45
|
*/
|
|
46
|
-
bucketWidth?:
|
|
46
|
+
bucketWidth?: GetRevenueBucketWidth | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* Filter by merchant ID. At least one of merchantId, subscriptionIds, or customerId must be provided.
|
|
49
49
|
*/
|
|
@@ -67,8 +67,9 @@ export type GetRevenueRequest = {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
/** @internal */
|
|
70
|
-
export const
|
|
71
|
-
|
|
70
|
+
export const GetRevenueBucketWidth$outboundSchema: z.ZodNativeEnum<
|
|
71
|
+
typeof GetRevenueBucketWidth
|
|
72
|
+
> = z.nativeEnum(GetRevenueBucketWidth);
|
|
72
73
|
|
|
73
74
|
/** @internal */
|
|
74
75
|
export const GroupBy$outboundSchema: z.ZodNativeEnum<typeof GroupBy> = z
|
|
@@ -94,7 +95,7 @@ export const GetRevenueRequest$outboundSchema: z.ZodType<
|
|
|
94
95
|
> = z.object({
|
|
95
96
|
startTime: z.date().transform(v => v.toISOString()),
|
|
96
97
|
endTime: z.date().transform(v => v.toISOString()),
|
|
97
|
-
bucketWidth:
|
|
98
|
+
bucketWidth: GetRevenueBucketWidth$outboundSchema.default("day"),
|
|
98
99
|
merchantId: z.string().optional(),
|
|
99
100
|
customerId: z.string().optional(),
|
|
100
101
|
subscriptionIds: z.array(z.string()).optional(),
|
|
@@ -45,6 +45,7 @@ export * from "./getpayment.js";
|
|
|
45
45
|
export * from "./getplan.js";
|
|
46
46
|
export * from "./getprice.js";
|
|
47
47
|
export * from "./getproduct.js";
|
|
48
|
+
export * from "./getprofitability.js";
|
|
48
49
|
export * from "./getrevenue.js";
|
|
49
50
|
export * from "./getsource.js";
|
|
50
51
|
export * from "./getsourcerule.js";
|
|
@@ -64,6 +65,7 @@ export * from "./listfees.js";
|
|
|
64
65
|
export * from "./listinvoices.js";
|
|
65
66
|
export * from "./listlineitems.js";
|
|
66
67
|
export * from "./listpayments.js";
|
|
68
|
+
export * from "./listpaymentsessions.js";
|
|
67
69
|
export * from "./listplans.js";
|
|
68
70
|
export * from "./listprices.js";
|
|
69
71
|
export * from "./listproducts.js";
|
|
@@ -26,6 +26,10 @@ export type ListBillableMetricEventsRequest = {
|
|
|
26
26
|
* Number of events to skip
|
|
27
27
|
*/
|
|
28
28
|
offset?: number | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Filter by external identifier. Alphanumeric characters, hyphens, and underscores only.
|
|
31
|
+
*/
|
|
32
|
+
externalId?: string | undefined;
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
/** @internal */
|
|
@@ -36,6 +40,7 @@ export type ListBillableMetricEventsRequest$Outbound = {
|
|
|
36
40
|
subject?: string | undefined;
|
|
37
41
|
limit: number;
|
|
38
42
|
offset: number;
|
|
43
|
+
externalId?: string | undefined;
|
|
39
44
|
};
|
|
40
45
|
|
|
41
46
|
/** @internal */
|
|
@@ -50,6 +55,7 @@ export const ListBillableMetricEventsRequest$outboundSchema: z.ZodType<
|
|
|
50
55
|
subject: z.string().optional(),
|
|
51
56
|
limit: z.number().int().default(20),
|
|
52
57
|
offset: z.number().int().default(0),
|
|
58
|
+
externalId: z.string().optional(),
|
|
53
59
|
});
|
|
54
60
|
|
|
55
61
|
export function listBillableMetricEventsRequestToJSON(
|
|
@@ -46,6 +46,10 @@ export type ListInvoicesRequest = {
|
|
|
46
46
|
* Maximum number of invoices to return
|
|
47
47
|
*/
|
|
48
48
|
limit?: number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Number of invoices to skip for pagination
|
|
51
|
+
*/
|
|
52
|
+
offset?: number | undefined;
|
|
49
53
|
/**
|
|
50
54
|
* Filter for invoices ready for processing (platform only)
|
|
51
55
|
*/
|
|
@@ -75,6 +79,10 @@ export type ListInvoicesObject = ClosedEnum<typeof ListInvoicesObject>;
|
|
|
75
79
|
export type ListInvoicesResponse = {
|
|
76
80
|
object: ListInvoicesObject;
|
|
77
81
|
data: Array<models.Invoice>;
|
|
82
|
+
/**
|
|
83
|
+
* Offset-based pagination response.
|
|
84
|
+
*/
|
|
85
|
+
pagination?: models.OffsetPagination | undefined;
|
|
78
86
|
};
|
|
79
87
|
|
|
80
88
|
/** @internal */
|
|
@@ -89,6 +97,7 @@ export const ListInvoicesStatus$outboundSchema: z.ZodNativeEnum<
|
|
|
89
97
|
/** @internal */
|
|
90
98
|
export type ListInvoicesRequest$Outbound = {
|
|
91
99
|
limit: number;
|
|
100
|
+
offset: number;
|
|
92
101
|
nextActionAt?: string | undefined;
|
|
93
102
|
status?: string | undefined;
|
|
94
103
|
subscriptionId?: string | undefined;
|
|
@@ -102,6 +111,7 @@ export const ListInvoicesRequest$outboundSchema: z.ZodType<
|
|
|
102
111
|
ListInvoicesRequest
|
|
103
112
|
> = z.object({
|
|
104
113
|
limit: z.number().int().default(10),
|
|
114
|
+
offset: z.number().int().default(0),
|
|
105
115
|
nextActionAt: NextActionAt$outboundSchema.optional(),
|
|
106
116
|
status: ListInvoicesStatus$outboundSchema.optional(),
|
|
107
117
|
subscriptionId: z.string().optional(),
|
|
@@ -129,6 +139,7 @@ export const ListInvoicesResponse$inboundSchema: z.ZodType<
|
|
|
129
139
|
> = z.object({
|
|
130
140
|
object: ListInvoicesObject$inboundSchema,
|
|
131
141
|
data: z.array(models.Invoice$inboundSchema),
|
|
142
|
+
pagination: models.OffsetPagination$inboundSchema.optional(),
|
|
132
143
|
});
|
|
133
144
|
|
|
134
145
|
export function listInvoicesResponseFromJSON(
|
|
@@ -10,41 +10,64 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
|
10
10
|
import * as models from "../index.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Filter by payment status.
|
|
13
|
+
* Filter by payment session status.
|
|
14
14
|
*/
|
|
15
15
|
export const ListPaymentSessionsStatus = {
|
|
16
16
|
Pending: "pending",
|
|
17
17
|
Processing: "processing",
|
|
18
18
|
Completed: "completed",
|
|
19
|
+
Failed: "failed",
|
|
19
20
|
Expired: "expired",
|
|
20
21
|
Cancelled: "cancelled",
|
|
21
22
|
} as const;
|
|
22
23
|
/**
|
|
23
|
-
* Filter by payment status.
|
|
24
|
+
* Filter by payment session status.
|
|
24
25
|
*/
|
|
25
26
|
export type ListPaymentSessionsStatus = ClosedEnum<
|
|
26
27
|
typeof ListPaymentSessionsStatus
|
|
27
28
|
>;
|
|
28
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Filter by the kind of entity the session pays for.
|
|
32
|
+
*/
|
|
33
|
+
export const EntityType = {
|
|
34
|
+
Invoice: "invoice",
|
|
35
|
+
Subscription: "subscription",
|
|
36
|
+
Payment: "payment",
|
|
37
|
+
Topup: "topup",
|
|
38
|
+
} as const;
|
|
39
|
+
/**
|
|
40
|
+
* Filter by the kind of entity the session pays for.
|
|
41
|
+
*/
|
|
42
|
+
export type EntityType = ClosedEnum<typeof EntityType>;
|
|
43
|
+
|
|
29
44
|
export type ListPaymentSessionsRequest = {
|
|
30
45
|
/**
|
|
31
46
|
* Merchant organization ID. Required when using an API key that is not scoped to a single merchant.
|
|
32
47
|
*/
|
|
33
48
|
merchantId?: string | undefined;
|
|
34
49
|
/**
|
|
35
|
-
* Filter
|
|
50
|
+
* Filter to sessions linked to this subscription (its own activation session plus all of its invoices' sessions).
|
|
36
51
|
*/
|
|
37
|
-
|
|
52
|
+
subscriptionId?: string | undefined;
|
|
38
53
|
/**
|
|
39
|
-
* Filter
|
|
54
|
+
* Filter to sessions linked to a payment for this customer.
|
|
40
55
|
*/
|
|
41
56
|
customerId?: string | undefined;
|
|
42
57
|
/**
|
|
43
|
-
*
|
|
58
|
+
* Filter by payment session status.
|
|
59
|
+
*/
|
|
60
|
+
status?: ListPaymentSessionsStatus | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Filter by the kind of entity the session pays for.
|
|
63
|
+
*/
|
|
64
|
+
entityType?: EntityType | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Number of sessions to return.
|
|
44
67
|
*/
|
|
45
68
|
limit?: number | undefined;
|
|
46
69
|
/**
|
|
47
|
-
* Number of
|
|
70
|
+
* Number of sessions to skip.
|
|
48
71
|
*/
|
|
49
72
|
offset?: number | undefined;
|
|
50
73
|
};
|
|
@@ -57,11 +80,11 @@ export type ListPaymentSessionsObject = ClosedEnum<
|
|
|
57
80
|
>;
|
|
58
81
|
|
|
59
82
|
/**
|
|
60
|
-
* List of
|
|
83
|
+
* List of payment sessions
|
|
61
84
|
*/
|
|
62
85
|
export type ListPaymentSessionsResponse = {
|
|
63
86
|
object: ListPaymentSessionsObject;
|
|
64
|
-
data: Array<models.
|
|
87
|
+
data: Array<models.PaymentSession>;
|
|
65
88
|
/**
|
|
66
89
|
* Offset-based pagination response.
|
|
67
90
|
*/
|
|
@@ -73,11 +96,17 @@ export const ListPaymentSessionsStatus$outboundSchema: z.ZodNativeEnum<
|
|
|
73
96
|
typeof ListPaymentSessionsStatus
|
|
74
97
|
> = z.nativeEnum(ListPaymentSessionsStatus);
|
|
75
98
|
|
|
99
|
+
/** @internal */
|
|
100
|
+
export const EntityType$outboundSchema: z.ZodNativeEnum<typeof EntityType> = z
|
|
101
|
+
.nativeEnum(EntityType);
|
|
102
|
+
|
|
76
103
|
/** @internal */
|
|
77
104
|
export type ListPaymentSessionsRequest$Outbound = {
|
|
78
105
|
merchantId?: string | undefined;
|
|
79
|
-
|
|
106
|
+
subscriptionId?: string | undefined;
|
|
80
107
|
customerId?: string | undefined;
|
|
108
|
+
status?: string | undefined;
|
|
109
|
+
entityType?: string | undefined;
|
|
81
110
|
limit: number;
|
|
82
111
|
offset: number;
|
|
83
112
|
};
|
|
@@ -89,8 +118,10 @@ export const ListPaymentSessionsRequest$outboundSchema: z.ZodType<
|
|
|
89
118
|
ListPaymentSessionsRequest
|
|
90
119
|
> = z.object({
|
|
91
120
|
merchantId: z.string().optional(),
|
|
92
|
-
|
|
121
|
+
subscriptionId: z.string().optional(),
|
|
93
122
|
customerId: z.string().optional(),
|
|
123
|
+
status: ListPaymentSessionsStatus$outboundSchema.optional(),
|
|
124
|
+
entityType: EntityType$outboundSchema.optional(),
|
|
94
125
|
limit: z.number().int().default(10),
|
|
95
126
|
offset: z.number().int().default(0),
|
|
96
127
|
});
|
|
@@ -115,7 +146,7 @@ export const ListPaymentSessionsResponse$inboundSchema: z.ZodType<
|
|
|
115
146
|
unknown
|
|
116
147
|
> = z.object({
|
|
117
148
|
object: ListPaymentSessionsObject$inboundSchema,
|
|
118
|
-
data: z.array(models.
|
|
149
|
+
data: z.array(models.PaymentSession$inboundSchema),
|
|
119
150
|
pagination: models.OffsetPagination$inboundSchema,
|
|
120
151
|
});
|
|
121
152
|
|
|
@@ -94,6 +94,10 @@ export type UpdatePlanRequestBody = {
|
|
|
94
94
|
* Number of days before renewal to send the reminder email
|
|
95
95
|
*/
|
|
96
96
|
renewalReminderDays?: number | undefined;
|
|
97
|
+
/**
|
|
98
|
+
* ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. Set to null to clear the anchor and revert to start-time-based anchoring.
|
|
99
|
+
*/
|
|
100
|
+
billingAnchor?: Date | null | undefined;
|
|
97
101
|
};
|
|
98
102
|
|
|
99
103
|
export type UpdatePlanRequest = {
|
|
@@ -132,6 +136,7 @@ export type UpdatePlanRequestBody$Outbound = {
|
|
|
132
136
|
taxBehavior?: string | undefined;
|
|
133
137
|
renewalReminderEnabled?: boolean | undefined;
|
|
134
138
|
renewalReminderDays?: number | undefined;
|
|
139
|
+
billingAnchor?: string | null | undefined;
|
|
135
140
|
};
|
|
136
141
|
|
|
137
142
|
/** @internal */
|
|
@@ -151,6 +156,8 @@ export const UpdatePlanRequestBody$outboundSchema: z.ZodType<
|
|
|
151
156
|
taxBehavior: UpdatePlanTaxBehavior$outboundSchema.optional(),
|
|
152
157
|
renewalReminderEnabled: z.boolean().optional(),
|
|
153
158
|
renewalReminderDays: z.number().int().optional(),
|
|
159
|
+
billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
|
|
160
|
+
.optional(),
|
|
154
161
|
});
|
|
155
162
|
|
|
156
163
|
export function updatePlanRequestBodyToJSON(
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export const PaymentSessionObject = {
|
|
12
|
+
PaymentSession: "payment_session",
|
|
13
|
+
} as const;
|
|
14
|
+
export type PaymentSessionObject = ClosedEnum<typeof PaymentSessionObject>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Lifecycle status of the session.
|
|
18
|
+
*/
|
|
19
|
+
export const PaymentSessionStatus = {
|
|
20
|
+
Pending: "pending",
|
|
21
|
+
Processing: "processing",
|
|
22
|
+
Completed: "completed",
|
|
23
|
+
Failed: "failed",
|
|
24
|
+
Expired: "expired",
|
|
25
|
+
Cancelled: "cancelled",
|
|
26
|
+
} as const;
|
|
27
|
+
/**
|
|
28
|
+
* Lifecycle status of the session.
|
|
29
|
+
*/
|
|
30
|
+
export type PaymentSessionStatus = ClosedEnum<typeof PaymentSessionStatus>;
|
|
31
|
+
|
|
32
|
+
export type PaymentSession = {
|
|
33
|
+
object: PaymentSessionObject;
|
|
34
|
+
/**
|
|
35
|
+
* Payment session ID (ps_*).
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
/**
|
|
39
|
+
* Type of entity the session pays for (invoice, subscription, payment, topup).
|
|
40
|
+
*/
|
|
41
|
+
entityType: string;
|
|
42
|
+
/**
|
|
43
|
+
* ID of the entity the session pays for.
|
|
44
|
+
*/
|
|
45
|
+
entityId: string;
|
|
46
|
+
/**
|
|
47
|
+
* Amount in decimal dollars.
|
|
48
|
+
*/
|
|
49
|
+
amount: string;
|
|
50
|
+
/**
|
|
51
|
+
* ISO 4217 currency code.
|
|
52
|
+
*/
|
|
53
|
+
currency: string;
|
|
54
|
+
/**
|
|
55
|
+
* Lifecycle status of the session.
|
|
56
|
+
*/
|
|
57
|
+
status: PaymentSessionStatus;
|
|
58
|
+
/**
|
|
59
|
+
* Stripe Connect account ID (acct_*) when the session is routed to a connected account.
|
|
60
|
+
*/
|
|
61
|
+
merchantPaymentAccountId?: string | null | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Timestamp the session reached terminal completion. Null until the session completes.
|
|
64
|
+
*/
|
|
65
|
+
completedAt?: Date | null | undefined;
|
|
66
|
+
createdAt: Date;
|
|
67
|
+
updatedAt: Date;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** @internal */
|
|
71
|
+
export const PaymentSessionObject$inboundSchema: z.ZodNativeEnum<
|
|
72
|
+
typeof PaymentSessionObject
|
|
73
|
+
> = z.nativeEnum(PaymentSessionObject);
|
|
74
|
+
|
|
75
|
+
/** @internal */
|
|
76
|
+
export const PaymentSessionStatus$inboundSchema: z.ZodNativeEnum<
|
|
77
|
+
typeof PaymentSessionStatus
|
|
78
|
+
> = z.nativeEnum(PaymentSessionStatus);
|
|
79
|
+
|
|
80
|
+
/** @internal */
|
|
81
|
+
export const PaymentSession$inboundSchema: z.ZodType<
|
|
82
|
+
PaymentSession,
|
|
83
|
+
z.ZodTypeDef,
|
|
84
|
+
unknown
|
|
85
|
+
> = z.object({
|
|
86
|
+
object: PaymentSessionObject$inboundSchema,
|
|
87
|
+
id: z.string(),
|
|
88
|
+
entityType: z.string(),
|
|
89
|
+
entityId: z.string(),
|
|
90
|
+
amount: z.string(),
|
|
91
|
+
currency: z.string(),
|
|
92
|
+
status: PaymentSessionStatus$inboundSchema,
|
|
93
|
+
merchantPaymentAccountId: z.nullable(z.string()).optional(),
|
|
94
|
+
completedAt: z.nullable(
|
|
95
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
96
|
+
).optional(),
|
|
97
|
+
createdAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
98
|
+
updatedAt: z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export function paymentSessionFromJSON(
|
|
102
|
+
jsonString: string,
|
|
103
|
+
): SafeParseResult<PaymentSession, SDKValidationError> {
|
|
104
|
+
return safeParse(
|
|
105
|
+
jsonString,
|
|
106
|
+
(x) => PaymentSession$inboundSchema.parse(JSON.parse(x)),
|
|
107
|
+
`Failed to parse 'PaymentSession' from JSON`,
|
|
108
|
+
);
|
|
109
|
+
}
|
package/src/models/plan.ts
CHANGED
|
@@ -106,6 +106,10 @@ export type Plan = {
|
|
|
106
106
|
* Billing engine version. Managed by Paygentic support.
|
|
107
107
|
*/
|
|
108
108
|
billingVersion?: number | undefined;
|
|
109
|
+
/**
|
|
110
|
+
* ISO 8601 datetime reference point for billing period alignment. Must be in the past or present at the time of creation or update. When set, all subscriptions created under this plan align their first billing period to the next recurrence of this anchor. Null means each subscription uses its own start time (hour-rounded) as the anchor.
|
|
111
|
+
*/
|
|
112
|
+
billingAnchor?: Date | null | undefined;
|
|
109
113
|
};
|
|
110
114
|
|
|
111
115
|
/** @internal */
|
|
@@ -175,6 +179,9 @@ export const Plan$inboundSchema: z.ZodType<Plan, z.ZodTypeDef, unknown> = z
|
|
|
175
179
|
renewalReminderEnabled: z.boolean().optional(),
|
|
176
180
|
renewalReminderDays: z.number().int().optional(),
|
|
177
181
|
billingVersion: z.number().int().optional(),
|
|
182
|
+
billingAnchor: z.nullable(
|
|
183
|
+
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
184
|
+
).optional(),
|
|
178
185
|
});
|
|
179
186
|
|
|
180
187
|
export function planFromJSON(
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
ProfitabilityTrend,
|
|
11
|
+
ProfitabilityTrend$inboundSchema,
|
|
12
|
+
} from "./profitabilitytrend.js";
|
|
13
|
+
|
|
14
|
+
export type ProfitabilityRow = {
|
|
15
|
+
/**
|
|
16
|
+
* Customer ID, or the literal 'other' for the overflow row.
|
|
17
|
+
*/
|
|
18
|
+
customerId: string;
|
|
19
|
+
/**
|
|
20
|
+
* Display name for the row. 'Other' for the overflow row.
|
|
21
|
+
*/
|
|
22
|
+
customerName: string;
|
|
23
|
+
/**
|
|
24
|
+
* Net revenue (paid + outstanding) in unit currency, with two decimals.
|
|
25
|
+
*/
|
|
26
|
+
netRevenue: string;
|
|
27
|
+
/**
|
|
28
|
+
* Aggregated cost in unit currency, with two decimals.
|
|
29
|
+
*/
|
|
30
|
+
totalCost: string;
|
|
31
|
+
/**
|
|
32
|
+
* Profit (revenue − cost) in unit currency, with two decimals. May be negative.
|
|
33
|
+
*/
|
|
34
|
+
profit: string;
|
|
35
|
+
/**
|
|
36
|
+
* Margin percent (profit / revenue × 100), with two decimals. Null when revenue is zero.
|
|
37
|
+
*/
|
|
38
|
+
marginPct: string | null;
|
|
39
|
+
/**
|
|
40
|
+
* Per-customer revenue trend over the period. Null for the 'Other' row and when there's insufficient data.
|
|
41
|
+
*/
|
|
42
|
+
trend: ProfitabilityTrend | null;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const ProfitabilityRow$inboundSchema: z.ZodType<
|
|
47
|
+
ProfitabilityRow,
|
|
48
|
+
z.ZodTypeDef,
|
|
49
|
+
unknown
|
|
50
|
+
> = z.object({
|
|
51
|
+
customerId: z.string(),
|
|
52
|
+
customerName: z.string(),
|
|
53
|
+
netRevenue: z.string(),
|
|
54
|
+
totalCost: z.string(),
|
|
55
|
+
profit: z.string(),
|
|
56
|
+
marginPct: z.nullable(z.string()),
|
|
57
|
+
trend: z.nullable(ProfitabilityTrend$inboundSchema),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export function profitabilityRowFromJSON(
|
|
61
|
+
jsonString: string,
|
|
62
|
+
): SafeParseResult<ProfitabilityRow, SDKValidationError> {
|
|
63
|
+
return safeParse(
|
|
64
|
+
jsonString,
|
|
65
|
+
(x) => ProfitabilityRow$inboundSchema.parse(JSON.parse(x)),
|
|
66
|
+
`Failed to parse 'ProfitabilityRow' from JSON`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
ProfitabilityRow,
|
|
11
|
+
ProfitabilityRow$inboundSchema,
|
|
12
|
+
} from "./profitabilityrow.js";
|
|
13
|
+
|
|
14
|
+
export type ProfitabilitySummaryResponse = {
|
|
15
|
+
/**
|
|
16
|
+
* Object type identifier
|
|
17
|
+
*/
|
|
18
|
+
object: "profitability_summary";
|
|
19
|
+
/**
|
|
20
|
+
* ISO 4217 currency code applied to revenue and cost values
|
|
21
|
+
*/
|
|
22
|
+
currency: string;
|
|
23
|
+
/**
|
|
24
|
+
* Top-N customer rows by profit descending, optionally followed by a single 'Other' row when more than topN customers contributed.
|
|
25
|
+
*/
|
|
26
|
+
rows: Array<ProfitabilityRow>;
|
|
27
|
+
/**
|
|
28
|
+
* Non-fatal warnings collected during cost discovery (e.g. an individual cost query failed). Empty array on a clean run.
|
|
29
|
+
*/
|
|
30
|
+
warnings?: Array<string> | undefined;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const ProfitabilitySummaryResponse$inboundSchema: z.ZodType<
|
|
35
|
+
ProfitabilitySummaryResponse,
|
|
36
|
+
z.ZodTypeDef,
|
|
37
|
+
unknown
|
|
38
|
+
> = z.object({
|
|
39
|
+
object: z.literal("profitability_summary"),
|
|
40
|
+
currency: z.string(),
|
|
41
|
+
rows: z.array(ProfitabilityRow$inboundSchema),
|
|
42
|
+
warnings: z.array(z.string()).optional(),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export function profitabilitySummaryResponseFromJSON(
|
|
46
|
+
jsonString: string,
|
|
47
|
+
): SafeParseResult<ProfitabilitySummaryResponse, SDKValidationError> {
|
|
48
|
+
return safeParse(
|
|
49
|
+
jsonString,
|
|
50
|
+
(x) => ProfitabilitySummaryResponse$inboundSchema.parse(JSON.parse(x)),
|
|
51
|
+
`Failed to parse 'ProfitabilitySummaryResponse' from JSON`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type ProfitabilityTrend = {
|
|
11
|
+
/**
|
|
12
|
+
* Revenue values per time bucket, oldest first, in unit currency with two decimals.
|
|
13
|
+
*/
|
|
14
|
+
values: Array<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Period-over-period % change (current half vs prior half). Null when prior is zero.
|
|
17
|
+
*/
|
|
18
|
+
periodChange: number | null;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const ProfitabilityTrend$inboundSchema: z.ZodType<
|
|
23
|
+
ProfitabilityTrend,
|
|
24
|
+
z.ZodTypeDef,
|
|
25
|
+
unknown
|
|
26
|
+
> = z.object({
|
|
27
|
+
values: z.array(z.string()),
|
|
28
|
+
periodChange: z.nullable(z.number()),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export function profitabilityTrendFromJSON(
|
|
32
|
+
jsonString: string,
|
|
33
|
+
): SafeParseResult<ProfitabilityTrend, SDKValidationError> {
|
|
34
|
+
return safeParse(
|
|
35
|
+
jsonString,
|
|
36
|
+
(x) => ProfitabilityTrend$inboundSchema.parse(JSON.parse(x)),
|
|
37
|
+
`Failed to parse 'ProfitabilityTrend' from JSON`,
|
|
38
|
+
);
|
|
39
|
+
}
|