@clientcasa/sdk 0.7.0 → 0.7.1
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 +7 -0
- package/esm/funcs/payments-list.js +1 -0
- package/esm/funcs/payments-list.js.map +1 -1
- package/esm/funcs/sales-get.d.ts +16 -0
- package/esm/funcs/sales-get.d.ts.map +1 -0
- package/esm/funcs/sales-get.js +107 -0
- package/esm/funcs/sales-get.js.map +1 -0
- package/esm/funcs/sales-list.d.ts +18 -0
- package/esm/funcs/sales-list.d.ts.map +1 -0
- package/esm/funcs/sales-list.js +141 -0
- package/esm/funcs/sales-list.js.map +1 -0
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/config.js.map +1 -1
- package/esm/models/index.d.ts +2 -0
- package/esm/models/index.d.ts.map +1 -1
- package/esm/models/index.js +2 -0
- package/esm/models/index.js.map +1 -1
- package/esm/models/operations/get-sale.d.ts +27 -0
- package/esm/models/operations/get-sale.d.ts.map +1 -0
- package/esm/models/operations/get-sale.js +20 -0
- package/esm/models/operations/get-sale.js.map +1 -0
- package/esm/models/operations/index.d.ts +2 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +2 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/list-payments.d.ts +5 -0
- package/esm/models/operations/list-payments.d.ts.map +1 -1
- package/esm/models/operations/list-payments.js +1 -0
- package/esm/models/operations/list-payments.js.map +1 -1
- package/esm/models/operations/list-sales.d.ts +75 -0
- package/esm/models/operations/list-sales.d.ts.map +1 -0
- package/esm/models/operations/list-sales.js +60 -0
- package/esm/models/operations/list-sales.js.map +1 -0
- package/esm/models/operations/list-webhooks.d.ts +15 -2
- package/esm/models/operations/list-webhooks.d.ts.map +1 -1
- package/esm/models/operations/list-webhooks.js +15 -2
- package/esm/models/operations/list-webhooks.js.map +1 -1
- package/esm/models/payment.d.ts +4 -0
- package/esm/models/payment.d.ts.map +1 -1
- package/esm/models/payment.js +1 -0
- package/esm/models/payment.js.map +1 -1
- package/esm/models/sale-list.d.ts +13 -0
- package/esm/models/sale-list.d.ts.map +1 -0
- package/esm/models/sale-list.js +17 -0
- package/esm/models/sale-list.js.map +1 -0
- package/esm/models/sale.d.ts +76 -0
- package/esm/models/sale.d.ts.map +1 -0
- package/esm/models/sale.js +58 -0
- package/esm/models/sale.js.map +1 -0
- package/esm/models/webhook-create.d.ts +15 -2
- package/esm/models/webhook-create.d.ts.map +1 -1
- package/esm/models/webhook-create.js +15 -2
- package/esm/models/webhook-create.js.map +1 -1
- package/esm/models/webhook-update.d.ts +15 -2
- package/esm/models/webhook-update.d.ts.map +1 -1
- package/esm/models/webhook-update.js +15 -2
- package/esm/models/webhook-update.js.map +1 -1
- package/esm/models/webhook.d.ts +15 -2
- package/esm/models/webhook.d.ts.map +1 -1
- package/esm/models/webhook.js +15 -2
- package/esm/models/webhook.js.map +1 -1
- package/esm/sdk/sales.d.ts +17 -0
- package/esm/sdk/sales.d.ts.map +1 -0
- package/esm/sdk/sales.js +23 -0
- package/esm/sdk/sales.js.map +1 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.d.ts.map +1 -1
- package/esm/sdk/sdk.js +5 -0
- package/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/payments-list.ts +1 -0
- package/src/funcs/sales-get.ts +202 -0
- package/src/funcs/sales-list.ts +277 -0
- package/src/lib/config.ts +3 -3
- package/src/models/index.ts +2 -0
- package/src/models/operations/get-sale.ts +55 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/list-payments.ts +6 -0
- package/src/models/operations/list-sales.ts +159 -0
- package/src/models/operations/list-webhooks.ts +15 -2
- package/src/models/payment.ts +5 -0
- package/src/models/sale-list.ts +35 -0
- package/src/models/sale.ts +124 -0
- package/src/models/webhook-create.ts +15 -2
- package/src/models/webhook-update.ts +15 -2
- package/src/models/webhook.ts +15 -2
- package/src/sdk/sales.ts +45 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { ClientCasaCore } from "../core.js";
|
|
7
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { resolveSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import { ClientCasaError } from "../models/errors/client-casa-error.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/http-client-errors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/response-validation-error.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
|
|
26
|
+
import * as operations from "../models/operations/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
28
|
+
import { Result } from "../types/fp.js";
|
|
29
|
+
import {
|
|
30
|
+
createPageIterator,
|
|
31
|
+
haltIterator,
|
|
32
|
+
PageIterator,
|
|
33
|
+
Paginator,
|
|
34
|
+
} from "../types/operations.js";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* List sales
|
|
38
|
+
*/
|
|
39
|
+
export function salesList(
|
|
40
|
+
client: ClientCasaCore,
|
|
41
|
+
security: operations.ListSalesSecurity,
|
|
42
|
+
request?: operations.ListSalesRequest | undefined,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<
|
|
45
|
+
PageIterator<
|
|
46
|
+
Result<
|
|
47
|
+
operations.ListSalesResponse,
|
|
48
|
+
| errors.ApiError
|
|
49
|
+
| ClientCasaError
|
|
50
|
+
| ResponseValidationError
|
|
51
|
+
| ConnectionError
|
|
52
|
+
| RequestAbortedError
|
|
53
|
+
| RequestTimeoutError
|
|
54
|
+
| InvalidRequestError
|
|
55
|
+
| UnexpectedClientError
|
|
56
|
+
| SDKValidationError
|
|
57
|
+
>,
|
|
58
|
+
{ page: number }
|
|
59
|
+
>
|
|
60
|
+
> {
|
|
61
|
+
return new APIPromise($do(
|
|
62
|
+
client,
|
|
63
|
+
security,
|
|
64
|
+
request,
|
|
65
|
+
options,
|
|
66
|
+
));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async function $do(
|
|
70
|
+
client: ClientCasaCore,
|
|
71
|
+
security: operations.ListSalesSecurity,
|
|
72
|
+
request?: operations.ListSalesRequest | undefined,
|
|
73
|
+
options?: RequestOptions,
|
|
74
|
+
): Promise<
|
|
75
|
+
[
|
|
76
|
+
PageIterator<
|
|
77
|
+
Result<
|
|
78
|
+
operations.ListSalesResponse,
|
|
79
|
+
| errors.ApiError
|
|
80
|
+
| ClientCasaError
|
|
81
|
+
| ResponseValidationError
|
|
82
|
+
| ConnectionError
|
|
83
|
+
| RequestAbortedError
|
|
84
|
+
| RequestTimeoutError
|
|
85
|
+
| InvalidRequestError
|
|
86
|
+
| UnexpectedClientError
|
|
87
|
+
| SDKValidationError
|
|
88
|
+
>,
|
|
89
|
+
{ page: number }
|
|
90
|
+
>,
|
|
91
|
+
APICall,
|
|
92
|
+
]
|
|
93
|
+
> {
|
|
94
|
+
const parsed = safeParse(
|
|
95
|
+
request,
|
|
96
|
+
(value) =>
|
|
97
|
+
z.parse(z.optional(operations.ListSalesRequest$outboundSchema), value),
|
|
98
|
+
"Input validation failed",
|
|
99
|
+
);
|
|
100
|
+
if (!parsed.ok) {
|
|
101
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
102
|
+
}
|
|
103
|
+
const payload = parsed.value;
|
|
104
|
+
const body = null;
|
|
105
|
+
|
|
106
|
+
const path = pathToFunc("/api/v1/sales")();
|
|
107
|
+
|
|
108
|
+
const query = encodeFormQuery({
|
|
109
|
+
"businessId": payload?.businessId,
|
|
110
|
+
"channel": payload?.channel,
|
|
111
|
+
"clientId": payload?.clientId,
|
|
112
|
+
"page": payload?.page,
|
|
113
|
+
"pageSize": payload?.pageSize,
|
|
114
|
+
"saleDateFrom": payload?.saleDateFrom,
|
|
115
|
+
"saleDateTo": payload?.saleDateTo,
|
|
116
|
+
"status": payload?.status,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const headers = new Headers(compactMap({
|
|
120
|
+
Accept: "application/json",
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
const requestSecurity = resolveSecurity(
|
|
124
|
+
[
|
|
125
|
+
{
|
|
126
|
+
fieldName: "x-api-key",
|
|
127
|
+
type: "apiKey:header",
|
|
128
|
+
value: security?.apiKey,
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
{
|
|
133
|
+
fieldName: "Authorization",
|
|
134
|
+
type: "http:bearer",
|
|
135
|
+
value: security?.bearer,
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
const context = {
|
|
141
|
+
options: client._options,
|
|
142
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
143
|
+
operationID: "listSales",
|
|
144
|
+
oAuth2Scopes: null,
|
|
145
|
+
|
|
146
|
+
resolvedSecurity: requestSecurity,
|
|
147
|
+
|
|
148
|
+
securitySource: security,
|
|
149
|
+
retryConfig: options?.retries
|
|
150
|
+
|| client._options.retryConfig
|
|
151
|
+
|| {
|
|
152
|
+
strategy: "backoff",
|
|
153
|
+
backoff: {
|
|
154
|
+
initialInterval: 500,
|
|
155
|
+
maxInterval: 30000,
|
|
156
|
+
exponent: 1.5,
|
|
157
|
+
maxElapsedTime: 30000,
|
|
158
|
+
},
|
|
159
|
+
retryConnectionErrors: true,
|
|
160
|
+
}
|
|
161
|
+
|| { strategy: "none" },
|
|
162
|
+
retryCodes: options?.retryCodes || ["429", "5XX"],
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const requestRes = client._createRequest(context, {
|
|
166
|
+
security: requestSecurity,
|
|
167
|
+
method: "GET",
|
|
168
|
+
baseURL: options?.serverURL,
|
|
169
|
+
path: path,
|
|
170
|
+
headers: headers,
|
|
171
|
+
query: query,
|
|
172
|
+
body: body,
|
|
173
|
+
userAgent: client._options.userAgent,
|
|
174
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
175
|
+
}, options);
|
|
176
|
+
if (!requestRes.ok) {
|
|
177
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
178
|
+
}
|
|
179
|
+
const req = requestRes.value;
|
|
180
|
+
|
|
181
|
+
const doResult = await client._do(req, {
|
|
182
|
+
context,
|
|
183
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
184
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
185
|
+
retryConfig: context.retryConfig,
|
|
186
|
+
retryCodes: context.retryCodes,
|
|
187
|
+
});
|
|
188
|
+
if (!doResult.ok) {
|
|
189
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
190
|
+
}
|
|
191
|
+
const response = doResult.value;
|
|
192
|
+
|
|
193
|
+
const responseFields = {
|
|
194
|
+
HttpMeta: { Response: response, Request: req },
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const [result, raw] = await M.match<
|
|
198
|
+
operations.ListSalesResponse,
|
|
199
|
+
| errors.ApiError
|
|
200
|
+
| ClientCasaError
|
|
201
|
+
| ResponseValidationError
|
|
202
|
+
| ConnectionError
|
|
203
|
+
| RequestAbortedError
|
|
204
|
+
| RequestTimeoutError
|
|
205
|
+
| InvalidRequestError
|
|
206
|
+
| UnexpectedClientError
|
|
207
|
+
| SDKValidationError
|
|
208
|
+
>(
|
|
209
|
+
M.json(200, operations.ListSalesResponse$inboundSchema, { key: "Result" }),
|
|
210
|
+
M.jsonErr([400, 401, 403, 429], errors.ApiError$inboundSchema),
|
|
211
|
+
M.jsonErr(500, errors.ApiError$inboundSchema),
|
|
212
|
+
M.fail("4XX"),
|
|
213
|
+
M.fail("5XX"),
|
|
214
|
+
)(response, req, { extraFields: responseFields });
|
|
215
|
+
if (!result.ok) {
|
|
216
|
+
return [haltIterator(result), {
|
|
217
|
+
status: "complete",
|
|
218
|
+
request: req,
|
|
219
|
+
response,
|
|
220
|
+
}];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const nextFunc = (
|
|
224
|
+
responseData: unknown,
|
|
225
|
+
): {
|
|
226
|
+
next: Paginator<
|
|
227
|
+
Result<
|
|
228
|
+
operations.ListSalesResponse,
|
|
229
|
+
| errors.ApiError
|
|
230
|
+
| ClientCasaError
|
|
231
|
+
| ResponseValidationError
|
|
232
|
+
| ConnectionError
|
|
233
|
+
| RequestAbortedError
|
|
234
|
+
| RequestTimeoutError
|
|
235
|
+
| InvalidRequestError
|
|
236
|
+
| UnexpectedClientError
|
|
237
|
+
| SDKValidationError
|
|
238
|
+
>
|
|
239
|
+
>;
|
|
240
|
+
"~next"?: { page: number };
|
|
241
|
+
} => {
|
|
242
|
+
const page = request?.page ?? 1;
|
|
243
|
+
const nextPage = page + 1;
|
|
244
|
+
|
|
245
|
+
if (!responseData) {
|
|
246
|
+
return { next: () => null };
|
|
247
|
+
}
|
|
248
|
+
const results = (responseData as { data: unknown }).data;
|
|
249
|
+
if (!Array.isArray(results) || !results.length) {
|
|
250
|
+
return { next: () => null };
|
|
251
|
+
}
|
|
252
|
+
const limit = request?.pageSize ?? 25;
|
|
253
|
+
if (results.length < limit) {
|
|
254
|
+
return { next: () => null };
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const nextVal = () =>
|
|
258
|
+
salesList(
|
|
259
|
+
client,
|
|
260
|
+
security,
|
|
261
|
+
{
|
|
262
|
+
...request!,
|
|
263
|
+
page: nextPage,
|
|
264
|
+
},
|
|
265
|
+
options,
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
return { next: nextVal, "~next": { page: nextPage } };
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
272
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
273
|
+
status: "complete",
|
|
274
|
+
request: req,
|
|
275
|
+
response,
|
|
276
|
+
}];
|
|
277
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -61,7 +61,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
61
61
|
export const SDK_METADATA = {
|
|
62
62
|
language: "typescript",
|
|
63
63
|
openapiDocVersion: "1.0.0",
|
|
64
|
-
sdkVersion: "0.7.
|
|
65
|
-
genVersion: "2.
|
|
66
|
-
userAgent: "speakeasy-sdk/typescript 0.7.
|
|
64
|
+
sdkVersion: "0.7.1",
|
|
65
|
+
genVersion: "2.933.0",
|
|
66
|
+
userAgent: "speakeasy-sdk/typescript 0.7.1 2.933.0 1.0.0 @clientcasa/sdk",
|
|
67
67
|
} as const;
|
package/src/models/index.ts
CHANGED
|
@@ -64,6 +64,8 @@ export * from "./project-create.js";
|
|
|
64
64
|
export * from "./project-list.js";
|
|
65
65
|
export * from "./project-update.js";
|
|
66
66
|
export * from "./project.js";
|
|
67
|
+
export * from "./sale-list.js";
|
|
68
|
+
export * from "./sale.js";
|
|
67
69
|
export * from "./security.js";
|
|
68
70
|
export * from "./time-entry-create.js";
|
|
69
71
|
export * from "./time-entry-list.js";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
|
|
7
|
+
export type GetSaleSecurity = {
|
|
8
|
+
apiKey?: string | undefined;
|
|
9
|
+
bearer?: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type GetSaleRequest = {
|
|
13
|
+
/**
|
|
14
|
+
* UUID v4
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export type GetSaleSecurity$Outbound = {
|
|
21
|
+
apiKey?: string | undefined;
|
|
22
|
+
bearer?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const GetSaleSecurity$outboundSchema: z.ZodMiniType<
|
|
27
|
+
GetSaleSecurity$Outbound,
|
|
28
|
+
GetSaleSecurity
|
|
29
|
+
> = z.object({
|
|
30
|
+
apiKey: z.optional(z.string()),
|
|
31
|
+
bearer: z.optional(z.string()),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export function getSaleSecurityToJSON(
|
|
35
|
+
getSaleSecurity: GetSaleSecurity,
|
|
36
|
+
): string {
|
|
37
|
+
return JSON.stringify(GetSaleSecurity$outboundSchema.parse(getSaleSecurity));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** @internal */
|
|
41
|
+
export type GetSaleRequest$Outbound = {
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const GetSaleRequest$outboundSchema: z.ZodMiniType<
|
|
47
|
+
GetSaleRequest$Outbound,
|
|
48
|
+
GetSaleRequest
|
|
49
|
+
> = z.object({
|
|
50
|
+
id: z.string(),
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export function getSaleRequestToJSON(getSaleRequest: GetSaleRequest): string {
|
|
54
|
+
return JSON.stringify(GetSaleRequest$outboundSchema.parse(getSaleRequest));
|
|
55
|
+
}
|
|
@@ -52,6 +52,7 @@ export * from "./get-milestone.js";
|
|
|
52
52
|
export * from "./get-payment.js";
|
|
53
53
|
export * from "./get-payout.js";
|
|
54
54
|
export * from "./get-project.js";
|
|
55
|
+
export * from "./get-sale.js";
|
|
55
56
|
export * from "./get-time-entry.js";
|
|
56
57
|
export * from "./get-timeline-item.js";
|
|
57
58
|
export * from "./get-transaction.js";
|
|
@@ -74,6 +75,7 @@ export * from "./list-milestones.js";
|
|
|
74
75
|
export * from "./list-payments.js";
|
|
75
76
|
export * from "./list-payouts.js";
|
|
76
77
|
export * from "./list-projects.js";
|
|
78
|
+
export * from "./list-sales.js";
|
|
77
79
|
export * from "./list-time-entries.js";
|
|
78
80
|
export * from "./list-timeline-items.js";
|
|
79
81
|
export * from "./list-transactions.js";
|
|
@@ -43,6 +43,10 @@ export type ListPaymentsRequest = {
|
|
|
43
43
|
* UUID v4
|
|
44
44
|
*/
|
|
45
45
|
invoiceId?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* UUID v4
|
|
48
|
+
*/
|
|
49
|
+
saleId?: string | undefined;
|
|
46
50
|
status?: ListPaymentsStatus | undefined;
|
|
47
51
|
kind?: ListPaymentsKind | undefined;
|
|
48
52
|
};
|
|
@@ -90,6 +94,7 @@ export type ListPaymentsRequest$Outbound = {
|
|
|
90
94
|
pageSize: number;
|
|
91
95
|
clientId?: string | undefined;
|
|
92
96
|
invoiceId?: string | undefined;
|
|
97
|
+
saleId?: string | undefined;
|
|
93
98
|
status?: string | undefined;
|
|
94
99
|
kind?: string | undefined;
|
|
95
100
|
};
|
|
@@ -103,6 +108,7 @@ export const ListPaymentsRequest$outboundSchema: z.ZodMiniType<
|
|
|
103
108
|
pageSize: z._default(z.int(), 25),
|
|
104
109
|
clientId: z.optional(z.string()),
|
|
105
110
|
invoiceId: z.optional(z.string()),
|
|
111
|
+
saleId: z.optional(z.string()),
|
|
106
112
|
status: z.optional(ListPaymentsStatus$outboundSchema),
|
|
107
113
|
kind: z.optional(ListPaymentsKind$outboundSchema),
|
|
108
114
|
});
|
|
@@ -0,0 +1,159 @@
|
|
|
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 { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdk-validation-error.js";
|
|
11
|
+
import * as models from "../index.js";
|
|
12
|
+
|
|
13
|
+
export type ListSalesSecurity = {
|
|
14
|
+
apiKey?: string | undefined;
|
|
15
|
+
bearer?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const ListSalesStatus = {
|
|
19
|
+
Completed: "completed",
|
|
20
|
+
Refunded: "refunded",
|
|
21
|
+
PartiallyRefunded: "partially-refunded",
|
|
22
|
+
Voided: "voided",
|
|
23
|
+
} as const;
|
|
24
|
+
export type ListSalesStatus = ClosedEnum<typeof ListSalesStatus>;
|
|
25
|
+
|
|
26
|
+
export const Channel = {
|
|
27
|
+
Pos: "pos",
|
|
28
|
+
Manual: "manual",
|
|
29
|
+
Stripe: "stripe",
|
|
30
|
+
Shopify: "shopify",
|
|
31
|
+
Etsy: "etsy",
|
|
32
|
+
SquareImport: "square-import",
|
|
33
|
+
Api: "api",
|
|
34
|
+
} as const;
|
|
35
|
+
export type Channel = ClosedEnum<typeof Channel>;
|
|
36
|
+
|
|
37
|
+
export type ListSalesRequest = {
|
|
38
|
+
page?: number | undefined;
|
|
39
|
+
pageSize?: number | undefined;
|
|
40
|
+
status?: ListSalesStatus | undefined;
|
|
41
|
+
channel?: Channel | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* UUID v4
|
|
44
|
+
*/
|
|
45
|
+
clientId?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* UUID v4
|
|
48
|
+
*/
|
|
49
|
+
businessId?: string | undefined;
|
|
50
|
+
saleDateFrom?: Date | undefined;
|
|
51
|
+
saleDateTo?: Date | undefined;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type ListSalesResponse = {
|
|
55
|
+
result: models.SaleList;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @internal */
|
|
59
|
+
export type ListSalesSecurity$Outbound = {
|
|
60
|
+
apiKey?: string | undefined;
|
|
61
|
+
bearer?: string | undefined;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** @internal */
|
|
65
|
+
export const ListSalesSecurity$outboundSchema: z.ZodMiniType<
|
|
66
|
+
ListSalesSecurity$Outbound,
|
|
67
|
+
ListSalesSecurity
|
|
68
|
+
> = z.object({
|
|
69
|
+
apiKey: z.optional(z.string()),
|
|
70
|
+
bearer: z.optional(z.string()),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export function listSalesSecurityToJSON(
|
|
74
|
+
listSalesSecurity: ListSalesSecurity,
|
|
75
|
+
): string {
|
|
76
|
+
return JSON.stringify(
|
|
77
|
+
ListSalesSecurity$outboundSchema.parse(listSalesSecurity),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @internal */
|
|
82
|
+
export const ListSalesStatus$outboundSchema: z.ZodMiniEnum<
|
|
83
|
+
typeof ListSalesStatus
|
|
84
|
+
> = z.enum(ListSalesStatus);
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export const Channel$outboundSchema: z.ZodMiniEnum<typeof Channel> = z.enum(
|
|
88
|
+
Channel,
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
/** @internal */
|
|
92
|
+
export type ListSalesRequest$Outbound = {
|
|
93
|
+
page: number;
|
|
94
|
+
pageSize: number;
|
|
95
|
+
status?: string | undefined;
|
|
96
|
+
channel?: string | undefined;
|
|
97
|
+
clientId?: string | undefined;
|
|
98
|
+
businessId?: string | undefined;
|
|
99
|
+
saleDateFrom?: string | undefined;
|
|
100
|
+
saleDateTo?: string | undefined;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/** @internal */
|
|
104
|
+
export const ListSalesRequest$outboundSchema: z.ZodMiniType<
|
|
105
|
+
ListSalesRequest$Outbound,
|
|
106
|
+
ListSalesRequest
|
|
107
|
+
> = z.object({
|
|
108
|
+
page: z._default(z.int(), 1),
|
|
109
|
+
pageSize: z._default(z.int(), 25),
|
|
110
|
+
status: z.optional(ListSalesStatus$outboundSchema),
|
|
111
|
+
channel: z.optional(Channel$outboundSchema),
|
|
112
|
+
clientId: z.optional(z.string()),
|
|
113
|
+
businessId: z.optional(z.string()),
|
|
114
|
+
saleDateFrom: z.optional(
|
|
115
|
+
z.pipe(
|
|
116
|
+
z.date(),
|
|
117
|
+
z.transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)),
|
|
118
|
+
),
|
|
119
|
+
),
|
|
120
|
+
saleDateTo: z.optional(
|
|
121
|
+
z.pipe(
|
|
122
|
+
z.date(),
|
|
123
|
+
z.transform(v => v.toISOString().slice(0, "YYYY-MM-DD".length)),
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export function listSalesRequestToJSON(
|
|
129
|
+
listSalesRequest: ListSalesRequest,
|
|
130
|
+
): string {
|
|
131
|
+
return JSON.stringify(
|
|
132
|
+
ListSalesRequest$outboundSchema.parse(listSalesRequest),
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** @internal */
|
|
137
|
+
export const ListSalesResponse$inboundSchema: z.ZodMiniType<
|
|
138
|
+
ListSalesResponse,
|
|
139
|
+
unknown
|
|
140
|
+
> = z.pipe(
|
|
141
|
+
z.object({
|
|
142
|
+
Result: models.SaleList$inboundSchema,
|
|
143
|
+
}),
|
|
144
|
+
z.transform((v) => {
|
|
145
|
+
return remap$(v, {
|
|
146
|
+
"Result": "result",
|
|
147
|
+
});
|
|
148
|
+
}),
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
export function listSalesResponseFromJSON(
|
|
152
|
+
jsonString: string,
|
|
153
|
+
): SafeParseResult<ListSalesResponse, SDKValidationError> {
|
|
154
|
+
return safeParse(
|
|
155
|
+
jsonString,
|
|
156
|
+
(x) => ListSalesResponse$inboundSchema.parse(JSON.parse(x)),
|
|
157
|
+
`Failed to parse 'ListSalesResponse' from JSON`,
|
|
158
|
+
);
|
|
159
|
+
}
|
|
@@ -23,7 +23,6 @@ export const Event = {
|
|
|
23
23
|
InvoicePaymentFailed: "invoice_payment_failed",
|
|
24
24
|
InvoiceDisputed: "invoice_disputed",
|
|
25
25
|
InvoicePaymentReminder: "invoice_payment_reminder",
|
|
26
|
-
InvoiceViewed: "invoice_viewed",
|
|
27
26
|
PaymentReceived: "payment_received",
|
|
28
27
|
PaymentRefunded: "payment_refunded",
|
|
29
28
|
PaymentApplied: "payment_applied",
|
|
@@ -48,6 +47,7 @@ export const Event = {
|
|
|
48
47
|
ClientWon: "client_won",
|
|
49
48
|
ClientLost: "client_lost",
|
|
50
49
|
LeadStatusChanged: "lead_status_changed",
|
|
50
|
+
InvoiceViewed: "invoice_viewed",
|
|
51
51
|
MilestoneApproaching: "milestone_approaching",
|
|
52
52
|
TimerRunningReminder: "timer_running_reminder",
|
|
53
53
|
ContractSent: "contract_sent",
|
|
@@ -58,12 +58,12 @@ export const Event = {
|
|
|
58
58
|
ContractCompleted: "contract_completed",
|
|
59
59
|
ContractExpired: "contract_expired",
|
|
60
60
|
ContractVoided: "contract_voided",
|
|
61
|
+
FormSubmissionCompleted: "form_submission_completed",
|
|
61
62
|
SmartFileSent: "smart_file_sent",
|
|
62
63
|
SmartFileViewed: "smart_file_viewed",
|
|
63
64
|
SmartFileAccepted: "smart_file_accepted",
|
|
64
65
|
SmartFileCompleted: "smart_file_completed",
|
|
65
66
|
SmartFileExpired: "smart_file_expired",
|
|
66
|
-
FormSubmissionCompleted: "form_submission_completed",
|
|
67
67
|
SubscriptionPaymentFailed: "subscription_payment_failed",
|
|
68
68
|
PayoutPaid: "payout_paid",
|
|
69
69
|
PayoutFailed: "payout_failed",
|
|
@@ -72,6 +72,19 @@ export const Event = {
|
|
|
72
72
|
EventDayArchived: "event_day_archived",
|
|
73
73
|
TimelineItemCompleted: "timeline_item_completed",
|
|
74
74
|
TimelineReminderSent: "timeline_reminder_sent",
|
|
75
|
+
InvoiceRefunded: "invoice_refunded",
|
|
76
|
+
ContractAmended: "contract_amended",
|
|
77
|
+
ReceiptViewed: "receipt_viewed",
|
|
78
|
+
FollowUpDue: "follow_up_due",
|
|
79
|
+
PaymentProcessing: "payment_processing",
|
|
80
|
+
ClientReply: "client_reply",
|
|
81
|
+
ClientRevisionRequested: "client_revision_requested",
|
|
82
|
+
EmailDeliveryFailed: "email_delivery_failed",
|
|
83
|
+
SaleCompleted: "sale_completed",
|
|
84
|
+
SaleRefunded: "sale_refunded",
|
|
85
|
+
SaleVoided: "sale_voided",
|
|
86
|
+
SaleReceiptSent: "sale_receipt_sent",
|
|
87
|
+
SaleViewed: "sale_viewed",
|
|
75
88
|
} as const;
|
|
76
89
|
export type Event = ClosedEnum<typeof Event>;
|
|
77
90
|
|
package/src/models/payment.ts
CHANGED
|
@@ -53,6 +53,10 @@ export type Payment = {
|
|
|
53
53
|
* UUID v4
|
|
54
54
|
*/
|
|
55
55
|
invoiceId: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* UUID v4
|
|
58
|
+
*/
|
|
59
|
+
saleId: string | null;
|
|
56
60
|
amount: number;
|
|
57
61
|
currency: string;
|
|
58
62
|
receivedDate: Date;
|
|
@@ -101,6 +105,7 @@ export const Payment$inboundSchema: z.ZodMiniType<Payment, unknown> = z.object({
|
|
|
101
105
|
id: types.string(),
|
|
102
106
|
clientId: types.nullable(types.string()),
|
|
103
107
|
invoiceId: types.nullable(types.string()),
|
|
108
|
+
saleId: types.nullable(types.string()),
|
|
104
109
|
amount: types.number(),
|
|
105
110
|
currency: types.string(),
|
|
106
111
|
receivedDate: types.date(),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v4-mini";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "./errors/sdk-validation-error.js";
|
|
9
|
+
import {
|
|
10
|
+
PaginationMeta,
|
|
11
|
+
PaginationMeta$inboundSchema,
|
|
12
|
+
} from "./pagination-meta.js";
|
|
13
|
+
import { Sale, Sale$inboundSchema } from "./sale.js";
|
|
14
|
+
|
|
15
|
+
export type SaleList = {
|
|
16
|
+
data: Array<Sale>;
|
|
17
|
+
pagination: PaginationMeta;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @internal */
|
|
21
|
+
export const SaleList$inboundSchema: z.ZodMiniType<SaleList, unknown> = z
|
|
22
|
+
.object({
|
|
23
|
+
data: z.array(Sale$inboundSchema),
|
|
24
|
+
pagination: PaginationMeta$inboundSchema,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export function saleListFromJSON(
|
|
28
|
+
jsonString: string,
|
|
29
|
+
): SafeParseResult<SaleList, SDKValidationError> {
|
|
30
|
+
return safeParse(
|
|
31
|
+
jsonString,
|
|
32
|
+
(x) => SaleList$inboundSchema.parse(JSON.parse(x)),
|
|
33
|
+
`Failed to parse 'SaleList' from JSON`,
|
|
34
|
+
);
|
|
35
|
+
}
|