@greensecurity/javascript-sdk 0.44.0-beta.1 → 0.44.0-beta.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 +3 -0
- package/dist/commonjs/__tests__/companies.test.js +34 -0
- package/dist/commonjs/__tests__/companies.test.js.map +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +3 -24
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/companiesListCompanyCredits.d.ts +23 -0
- package/dist/commonjs/funcs/companiesListCompanyCredits.d.ts.map +1 -0
- package/dist/commonjs/funcs/companiesListCompanyCredits.js +167 -0
- package/dist/commonjs/funcs/companiesListCompanyCredits.js.map +1 -0
- package/dist/commonjs/funcs/usersGetCurrentUser.d.ts +1 -0
- package/dist/commonjs/funcs/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/commonjs/funcs/usersGetCurrentUser.js +1 -0
- package/dist/commonjs/funcs/usersGetCurrentUser.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/expand.d.ts +2 -0
- package/dist/commonjs/models/components/expand.d.ts.map +1 -1
- package/dist/commonjs/models/components/expand.js +2 -0
- package/dist/commonjs/models/components/expand.js.map +1 -1
- package/dist/commonjs/models/components/paymentprofile.d.ts +8 -8
- package/dist/commonjs/models/components/paymentprofile.d.ts.map +1 -1
- package/dist/commonjs/models/components/paymentprofile.js +12 -13
- package/dist/commonjs/models/components/paymentprofile.js.map +1 -1
- package/dist/commonjs/models/components/userdetails.d.ts +36 -0
- package/dist/commonjs/models/components/userdetails.d.ts.map +1 -1
- package/dist/commonjs/models/components/userdetails.js +50 -1
- package/dist/commonjs/models/components/userdetails.js.map +1 -1
- package/dist/commonjs/models/components/zone.d.ts +5 -5
- package/dist/commonjs/models/components/zone.d.ts.map +1 -1
- package/dist/commonjs/models/components/zone.js +10 -8
- package/dist/commonjs/models/components/zone.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listcompanycredits.d.ts +127 -0
- package/dist/commonjs/models/operations/listcompanycredits.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listcompanycredits.js +128 -0
- package/dist/commonjs/models/operations/listcompanycredits.js.map +1 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.core.d.ts +38 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.core.js +95 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.core.js.map +1 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.d.ts +62 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.d.ts.map +1 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.js +104 -0
- package/dist/commonjs/react-query/companiesListCompanyCredits.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/usersGetCurrentUser.d.ts +2 -0
- package/dist/commonjs/react-query/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/commonjs/react-query/usersGetCurrentUser.js +2 -0
- package/dist/commonjs/react-query/usersGetCurrentUser.js.map +1 -1
- package/dist/commonjs/sdk/companies.d.ts +9 -0
- package/dist/commonjs/sdk/companies.d.ts.map +1 -1
- package/dist/commonjs/sdk/companies.js +10 -0
- package/dist/commonjs/sdk/companies.js.map +1 -1
- package/dist/commonjs/sdk/users.d.ts +1 -0
- package/dist/commonjs/sdk/users.d.ts.map +1 -1
- package/dist/commonjs/sdk/users.js +1 -0
- package/dist/commonjs/sdk/users.js.map +1 -1
- package/dist/esm/__tests__/companies.test.js +34 -0
- package/dist/esm/__tests__/companies.test.js.map +1 -1
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/__tests__/webhooks.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +3 -24
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/companiesListCompanyCredits.d.ts +23 -0
- package/dist/esm/funcs/companiesListCompanyCredits.d.ts.map +1 -0
- package/dist/esm/funcs/companiesListCompanyCredits.js +131 -0
- package/dist/esm/funcs/companiesListCompanyCredits.js.map +1 -0
- package/dist/esm/funcs/usersGetCurrentUser.d.ts +1 -0
- package/dist/esm/funcs/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/esm/funcs/usersGetCurrentUser.js +1 -0
- package/dist/esm/funcs/usersGetCurrentUser.js.map +1 -1
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/expand.d.ts +2 -0
- package/dist/esm/models/components/expand.d.ts.map +1 -1
- package/dist/esm/models/components/expand.js +2 -0
- package/dist/esm/models/components/expand.js.map +1 -1
- package/dist/esm/models/components/paymentprofile.d.ts +8 -8
- package/dist/esm/models/components/paymentprofile.d.ts.map +1 -1
- package/dist/esm/models/components/paymentprofile.js +9 -10
- package/dist/esm/models/components/paymentprofile.js.map +1 -1
- package/dist/esm/models/components/userdetails.d.ts +36 -0
- package/dist/esm/models/components/userdetails.d.ts.map +1 -1
- package/dist/esm/models/components/userdetails.js +45 -0
- package/dist/esm/models/components/userdetails.js.map +1 -1
- package/dist/esm/models/components/zone.d.ts +5 -5
- package/dist/esm/models/components/zone.d.ts.map +1 -1
- package/dist/esm/models/components/zone.js +8 -6
- package/dist/esm/models/components/zone.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listcompanycredits.d.ts +127 -0
- package/dist/esm/models/operations/listcompanycredits.d.ts.map +1 -0
- package/dist/esm/models/operations/listcompanycredits.js +88 -0
- package/dist/esm/models/operations/listcompanycredits.js.map +1 -0
- package/dist/esm/react-query/companiesListCompanyCredits.core.d.ts +38 -0
- package/dist/esm/react-query/companiesListCompanyCredits.core.d.ts.map +1 -0
- package/dist/esm/react-query/companiesListCompanyCredits.core.js +87 -0
- package/dist/esm/react-query/companiesListCompanyCredits.core.js.map +1 -0
- package/dist/esm/react-query/companiesListCompanyCredits.d.ts +62 -0
- package/dist/esm/react-query/companiesListCompanyCredits.d.ts.map +1 -0
- package/dist/esm/react-query/companiesListCompanyCredits.js +89 -0
- package/dist/esm/react-query/companiesListCompanyCredits.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/usersGetCurrentUser.d.ts +2 -0
- package/dist/esm/react-query/usersGetCurrentUser.d.ts.map +1 -1
- package/dist/esm/react-query/usersGetCurrentUser.js +2 -0
- package/dist/esm/react-query/usersGetCurrentUser.js.map +1 -1
- package/dist/esm/sdk/companies.d.ts +9 -0
- package/dist/esm/sdk/companies.d.ts.map +1 -1
- package/dist/esm/sdk/companies.js +10 -0
- package/dist/esm/sdk/companies.js.map +1 -1
- package/dist/esm/sdk/users.d.ts +1 -0
- package/dist/esm/sdk/users.d.ts.map +1 -1
- package/dist/esm/sdk/users.js +1 -0
- package/dist/esm/sdk/users.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/companies.test.ts +37 -0
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +3 -24
- package/src/funcs/companiesListCompanyCredits.ts +261 -0
- package/src/funcs/usersGetCurrentUser.ts +1 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/expand.ts +2 -0
- package/src/models/components/paymentprofile.ts +22 -19
- package/src/models/components/userdetails.ts +116 -0
- package/src/models/components/zone.ts +20 -14
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listcompanycredits.ts +233 -0
- package/src/react-query/companiesListCompanyCredits.core.ts +197 -0
- package/src/react-query/companiesListCompanyCredits.ts +268 -0
- package/src/react-query/index.ts +1 -0
- package/src/react-query/usersGetCurrentUser.ts +2 -0
- package/src/sdk/companies.ts +20 -0
- package/src/sdk/users.ts +1 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { dlv } from "../lib/dlv.js";
|
|
7
|
+
import { encodeFormQuery, encodeSimple, queryJoin } 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 { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.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 credits related to a company
|
|
38
|
+
*
|
|
39
|
+
* @remarks
|
|
40
|
+
* Returns a paginated list of credits associated with the specified company, including incoming and outgoing transactions.
|
|
41
|
+
*
|
|
42
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
43
|
+
*/
|
|
44
|
+
export function companiesListCompanyCredits(
|
|
45
|
+
client: GreenSecurityCore,
|
|
46
|
+
request: operations.ListCompanyCreditsRequest,
|
|
47
|
+
options?: RequestOptions,
|
|
48
|
+
): APIPromise<
|
|
49
|
+
PageIterator<
|
|
50
|
+
Result<
|
|
51
|
+
operations.ListCompanyCreditsResponse,
|
|
52
|
+
| errors.ApiErrorResponse
|
|
53
|
+
| GreenSecurityError
|
|
54
|
+
| ResponseValidationError
|
|
55
|
+
| ConnectionError
|
|
56
|
+
| RequestAbortedError
|
|
57
|
+
| RequestTimeoutError
|
|
58
|
+
| InvalidRequestError
|
|
59
|
+
| UnexpectedClientError
|
|
60
|
+
| SDKValidationError
|
|
61
|
+
>,
|
|
62
|
+
{ page: number }
|
|
63
|
+
>
|
|
64
|
+
> {
|
|
65
|
+
return new APIPromise($do(
|
|
66
|
+
client,
|
|
67
|
+
request,
|
|
68
|
+
options,
|
|
69
|
+
));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function $do(
|
|
73
|
+
client: GreenSecurityCore,
|
|
74
|
+
request: operations.ListCompanyCreditsRequest,
|
|
75
|
+
options?: RequestOptions,
|
|
76
|
+
): Promise<
|
|
77
|
+
[
|
|
78
|
+
PageIterator<
|
|
79
|
+
Result<
|
|
80
|
+
operations.ListCompanyCreditsResponse,
|
|
81
|
+
| errors.ApiErrorResponse
|
|
82
|
+
| GreenSecurityError
|
|
83
|
+
| ResponseValidationError
|
|
84
|
+
| ConnectionError
|
|
85
|
+
| RequestAbortedError
|
|
86
|
+
| RequestTimeoutError
|
|
87
|
+
| InvalidRequestError
|
|
88
|
+
| UnexpectedClientError
|
|
89
|
+
| SDKValidationError
|
|
90
|
+
>,
|
|
91
|
+
{ page: number }
|
|
92
|
+
>,
|
|
93
|
+
APICall,
|
|
94
|
+
]
|
|
95
|
+
> {
|
|
96
|
+
const parsed = safeParse(
|
|
97
|
+
request,
|
|
98
|
+
(value) => operations.ListCompanyCreditsRequest$outboundSchema.parse(value),
|
|
99
|
+
"Input validation failed",
|
|
100
|
+
);
|
|
101
|
+
if (!parsed.ok) {
|
|
102
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
103
|
+
}
|
|
104
|
+
const payload = parsed.value;
|
|
105
|
+
const body = null;
|
|
106
|
+
|
|
107
|
+
const pathParams = {
|
|
108
|
+
id: encodeSimple("id", payload.id, {
|
|
109
|
+
explode: false,
|
|
110
|
+
charEncoding: "percent",
|
|
111
|
+
}),
|
|
112
|
+
};
|
|
113
|
+
const path = pathToFunc("/companies/{id}/credits")(pathParams);
|
|
114
|
+
|
|
115
|
+
const query = queryJoin(
|
|
116
|
+
encodeFormQuery({
|
|
117
|
+
"expand": payload.expand,
|
|
118
|
+
}, { explode: false }),
|
|
119
|
+
encodeFormQuery({
|
|
120
|
+
"desc": payload.desc,
|
|
121
|
+
"items_per_page": payload.items_per_page,
|
|
122
|
+
"page": payload.page,
|
|
123
|
+
"sort": payload.sort,
|
|
124
|
+
}),
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const headers = new Headers(compactMap({
|
|
128
|
+
Accept: "application/json",
|
|
129
|
+
}));
|
|
130
|
+
|
|
131
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
132
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
|
|
133
|
+
|
|
134
|
+
const context = {
|
|
135
|
+
options: client._options,
|
|
136
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
137
|
+
operationID: "listCompanyCredits",
|
|
138
|
+
oAuth2Scopes: null,
|
|
139
|
+
|
|
140
|
+
resolvedSecurity: requestSecurity,
|
|
141
|
+
|
|
142
|
+
securitySource: client._options.security,
|
|
143
|
+
retryConfig: options?.retries
|
|
144
|
+
|| client._options.retryConfig
|
|
145
|
+
|| { strategy: "none" },
|
|
146
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const requestRes = client._createRequest(context, {
|
|
150
|
+
security: requestSecurity,
|
|
151
|
+
method: "GET",
|
|
152
|
+
baseURL: options?.serverURL,
|
|
153
|
+
path: path,
|
|
154
|
+
headers: headers,
|
|
155
|
+
query: query,
|
|
156
|
+
body: body,
|
|
157
|
+
userAgent: client._options.userAgent,
|
|
158
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
159
|
+
}, options);
|
|
160
|
+
if (!requestRes.ok) {
|
|
161
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
162
|
+
}
|
|
163
|
+
const req = requestRes.value;
|
|
164
|
+
|
|
165
|
+
const doResult = await client._do(req, {
|
|
166
|
+
context,
|
|
167
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
168
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
169
|
+
retryConfig: context.retryConfig,
|
|
170
|
+
retryCodes: context.retryCodes,
|
|
171
|
+
});
|
|
172
|
+
if (!doResult.ok) {
|
|
173
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
174
|
+
}
|
|
175
|
+
const response = doResult.value;
|
|
176
|
+
|
|
177
|
+
const responseFields = {
|
|
178
|
+
HttpMeta: { Response: response, Request: req },
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
const [result, raw] = await M.match<
|
|
182
|
+
operations.ListCompanyCreditsResponse,
|
|
183
|
+
| errors.ApiErrorResponse
|
|
184
|
+
| GreenSecurityError
|
|
185
|
+
| ResponseValidationError
|
|
186
|
+
| ConnectionError
|
|
187
|
+
| RequestAbortedError
|
|
188
|
+
| RequestTimeoutError
|
|
189
|
+
| InvalidRequestError
|
|
190
|
+
| UnexpectedClientError
|
|
191
|
+
| SDKValidationError
|
|
192
|
+
>(
|
|
193
|
+
M.json(200, operations.ListCompanyCreditsResponse$inboundSchema, {
|
|
194
|
+
key: "Result",
|
|
195
|
+
}),
|
|
196
|
+
M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
|
|
197
|
+
M.fail("4XX"),
|
|
198
|
+
M.fail([500, "5XX"]),
|
|
199
|
+
)(response, req, { extraFields: responseFields });
|
|
200
|
+
if (!result.ok) {
|
|
201
|
+
return [haltIterator(result), {
|
|
202
|
+
status: "complete",
|
|
203
|
+
request: req,
|
|
204
|
+
response,
|
|
205
|
+
}];
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const nextFunc = (
|
|
209
|
+
responseData: unknown,
|
|
210
|
+
): {
|
|
211
|
+
next: Paginator<
|
|
212
|
+
Result<
|
|
213
|
+
operations.ListCompanyCreditsResponse,
|
|
214
|
+
| errors.ApiErrorResponse
|
|
215
|
+
| GreenSecurityError
|
|
216
|
+
| ResponseValidationError
|
|
217
|
+
| ConnectionError
|
|
218
|
+
| RequestAbortedError
|
|
219
|
+
| RequestTimeoutError
|
|
220
|
+
| InvalidRequestError
|
|
221
|
+
| UnexpectedClientError
|
|
222
|
+
| SDKValidationError
|
|
223
|
+
>
|
|
224
|
+
>;
|
|
225
|
+
"~next"?: { page: number };
|
|
226
|
+
} => {
|
|
227
|
+
const page = request?.page ?? 1;
|
|
228
|
+
const nextPage = page + 1;
|
|
229
|
+
|
|
230
|
+
if (!responseData) {
|
|
231
|
+
return { next: () => null };
|
|
232
|
+
}
|
|
233
|
+
const results = dlv(responseData, "items");
|
|
234
|
+
if (!Array.isArray(results) || !results.length) {
|
|
235
|
+
return { next: () => null };
|
|
236
|
+
}
|
|
237
|
+
const limit = request?.itemsPerPage ?? 0;
|
|
238
|
+
if (results.length < limit) {
|
|
239
|
+
return { next: () => null };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const nextVal = () =>
|
|
243
|
+
companiesListCompanyCredits(
|
|
244
|
+
client,
|
|
245
|
+
{
|
|
246
|
+
...request,
|
|
247
|
+
page: nextPage,
|
|
248
|
+
},
|
|
249
|
+
options,
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
return { next: nextVal, "~next": { page: nextPage } };
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
256
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
257
|
+
status: "complete",
|
|
258
|
+
request: req,
|
|
259
|
+
response,
|
|
260
|
+
}];
|
|
261
|
+
}
|
|
@@ -39,6 +39,7 @@ import { Result } from "../types/fp.js";
|
|
|
39
39
|
* Supported `expand` values:
|
|
40
40
|
* - `user` — return the full user record, including all profile fields stored against the user (sensitive columns such as passwords, MFA codes, and payment-provider IDs are always omitted)
|
|
41
41
|
* - `user.email_preferences` — include the user's `email_preferences` block (notification recipients and weekly email flags)
|
|
42
|
+
* - `user.payment_profile` — include the user's `payment_profile` block (card type, last four digits, validity flags) when expanded; if no payment profile is associated with the user, the response returns `payment_profile: null`
|
|
42
43
|
* - `company.location`, `company.vendor_type_restrictions`, `company.vendor_fields` — only valid for Company Manager users; embed extra fields on the user's company
|
|
43
44
|
*
|
|
44
45
|
* Multiple values can be combined with commas, e.g.
|
package/src/lib/config.ts
CHANGED
|
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
80
80
|
export const SDK_METADATA = {
|
|
81
81
|
language: "typescript",
|
|
82
82
|
openapiDocVersion: "0.43.1",
|
|
83
|
-
sdkVersion: "0.44.0-beta.
|
|
84
|
-
genVersion: "2.884.
|
|
83
|
+
sdkVersion: "0.44.0-beta.2",
|
|
84
|
+
genVersion: "2.884.7",
|
|
85
85
|
userAgent:
|
|
86
|
-
"speakeasy-sdk/typescript 0.44.0-beta.
|
|
86
|
+
"speakeasy-sdk/typescript 0.44.0-beta.2 2.884.7 0.43.1 @greensecurity/javascript-sdk",
|
|
87
87
|
} as const;
|
|
@@ -10,6 +10,8 @@ import { ClosedEnum } from "../../types/enums.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export const Expand = {
|
|
12
12
|
User: "user",
|
|
13
|
+
UserEmailPreferences: "user.email_preferences",
|
|
14
|
+
UserPaymentProfile: "user.payment_profile",
|
|
13
15
|
CompanyLocation: "company.location",
|
|
14
16
|
CompanyVendorFields: "company.vendor_fields",
|
|
15
17
|
CompanyVendorTypeRestrictions: "company.vendor_type_restrictions",
|
|
@@ -10,11 +10,11 @@ import * as types from "../../types/primitives.js";
|
|
|
10
10
|
import { smartUnion } from "../../types/smartUnion.js";
|
|
11
11
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
12
12
|
|
|
13
|
-
export type
|
|
13
|
+
export type PaymentProfile22 = {};
|
|
14
14
|
|
|
15
|
-
export type PaymentProfile2 = number |
|
|
15
|
+
export type PaymentProfile2 = number | PaymentProfile22;
|
|
16
16
|
|
|
17
|
-
export type
|
|
17
|
+
export type PaymentProfile3 = {
|
|
18
18
|
id?: number | undefined;
|
|
19
19
|
isValid?: boolean | null | undefined;
|
|
20
20
|
cardType?: string | null | undefined;
|
|
@@ -26,19 +26,22 @@ export type PaymentProfile1 = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Reduced list of attributes of the Payment Profile record
|
|
28
28
|
*/
|
|
29
|
-
export type PaymentProfile =
|
|
29
|
+
export type PaymentProfile = PaymentProfile3 | number | PaymentProfile22;
|
|
30
30
|
|
|
31
31
|
/** @internal */
|
|
32
|
-
export const
|
|
33
|
-
|
|
32
|
+
export const PaymentProfile22$inboundSchema: z.ZodType<
|
|
33
|
+
PaymentProfile22,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
unknown
|
|
36
|
+
> = z.object({});
|
|
34
37
|
|
|
35
|
-
export function
|
|
38
|
+
export function paymentProfile22FromJSON(
|
|
36
39
|
jsonString: string,
|
|
37
|
-
): SafeParseResult<
|
|
40
|
+
): SafeParseResult<PaymentProfile22, SDKValidationError> {
|
|
38
41
|
return safeParse(
|
|
39
42
|
jsonString,
|
|
40
|
-
(x) =>
|
|
41
|
-
`Failed to parse '
|
|
43
|
+
(x) => PaymentProfile22$inboundSchema.parse(JSON.parse(x)),
|
|
44
|
+
`Failed to parse 'PaymentProfile22' from JSON`,
|
|
42
45
|
);
|
|
43
46
|
}
|
|
44
47
|
|
|
@@ -47,7 +50,7 @@ export const PaymentProfile2$inboundSchema: z.ZodType<
|
|
|
47
50
|
PaymentProfile2,
|
|
48
51
|
z.ZodTypeDef,
|
|
49
52
|
unknown
|
|
50
|
-
> = smartUnion([types.number(), z.lazy(() =>
|
|
53
|
+
> = smartUnion([types.number(), z.lazy(() => PaymentProfile22$inboundSchema)]);
|
|
51
54
|
|
|
52
55
|
export function paymentProfile2FromJSON(
|
|
53
56
|
jsonString: string,
|
|
@@ -60,8 +63,8 @@ export function paymentProfile2FromJSON(
|
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
/** @internal */
|
|
63
|
-
export const
|
|
64
|
-
|
|
66
|
+
export const PaymentProfile3$inboundSchema: z.ZodType<
|
|
67
|
+
PaymentProfile3,
|
|
65
68
|
z.ZodTypeDef,
|
|
66
69
|
unknown
|
|
67
70
|
> = z.object({
|
|
@@ -81,13 +84,13 @@ export const PaymentProfile1$inboundSchema: z.ZodType<
|
|
|
81
84
|
});
|
|
82
85
|
});
|
|
83
86
|
|
|
84
|
-
export function
|
|
87
|
+
export function paymentProfile3FromJSON(
|
|
85
88
|
jsonString: string,
|
|
86
|
-
): SafeParseResult<
|
|
89
|
+
): SafeParseResult<PaymentProfile3, SDKValidationError> {
|
|
87
90
|
return safeParse(
|
|
88
91
|
jsonString,
|
|
89
|
-
(x) =>
|
|
90
|
-
`Failed to parse '
|
|
92
|
+
(x) => PaymentProfile3$inboundSchema.parse(JSON.parse(x)),
|
|
93
|
+
`Failed to parse 'PaymentProfile3' from JSON`,
|
|
91
94
|
);
|
|
92
95
|
}
|
|
93
96
|
|
|
@@ -97,8 +100,8 @@ export const PaymentProfile$inboundSchema: z.ZodType<
|
|
|
97
100
|
z.ZodTypeDef,
|
|
98
101
|
unknown
|
|
99
102
|
> = smartUnion([
|
|
100
|
-
z.lazy(() =>
|
|
101
|
-
smartUnion([types.number(), z.lazy(() =>
|
|
103
|
+
z.lazy(() => PaymentProfile3$inboundSchema),
|
|
104
|
+
smartUnion([types.number(), z.lazy(() => PaymentProfile22$inboundSchema)]),
|
|
102
105
|
]);
|
|
103
106
|
|
|
104
107
|
export function paymentProfileFromJSON(
|
|
@@ -9,6 +9,7 @@ import * as openEnums from "../../types/enums.js";
|
|
|
9
9
|
import { OpenEnum } from "../../types/enums.js";
|
|
10
10
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
11
11
|
import * as types from "../../types/primitives.js";
|
|
12
|
+
import { smartUnion } from "../../types/smartUnion.js";
|
|
12
13
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
13
14
|
import {
|
|
14
15
|
EmailPreferences,
|
|
@@ -36,6 +37,24 @@ export const UserType = {
|
|
|
36
37
|
*/
|
|
37
38
|
export type UserType = OpenEnum<typeof UserType>;
|
|
38
39
|
|
|
40
|
+
export type Two2 = {};
|
|
41
|
+
|
|
42
|
+
export type Two = number | Two2;
|
|
43
|
+
|
|
44
|
+
export type PaymentProfile1 = {
|
|
45
|
+
id?: number | undefined;
|
|
46
|
+
isValid?: boolean | null | undefined;
|
|
47
|
+
cardType?: string | null | undefined;
|
|
48
|
+
cardLast4?: string | null | undefined;
|
|
49
|
+
isDummy?: boolean | null | undefined;
|
|
50
|
+
profileType?: string | null | undefined;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Reduced list of attributes of the Payment Profile record
|
|
55
|
+
*/
|
|
56
|
+
export type UserDetailsPaymentProfile = PaymentProfile1 | number | Two2;
|
|
57
|
+
|
|
39
58
|
/**
|
|
40
59
|
* Core user profile fields returned by user detail and update endpoints.
|
|
41
60
|
*/
|
|
@@ -90,6 +109,16 @@ export type UserDetails = {
|
|
|
90
109
|
* the migration window but are deprecated.
|
|
91
110
|
*/
|
|
92
111
|
emailPreferences?: EmailPreferences | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* The user's payment profile. Returned only when the request
|
|
114
|
+
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* includes `expand=user.payment_profile` on `GET /users/me`.
|
|
117
|
+
* When expanded, this property is `null` if the user has no
|
|
118
|
+
* payment profile on file, or a populated `PaymentProfile`
|
|
119
|
+
* object if one exists. When not expanded, this property is omitted.
|
|
120
|
+
*/
|
|
121
|
+
paymentProfile?: PaymentProfile1 | number | Two2 | null | undefined;
|
|
93
122
|
};
|
|
94
123
|
|
|
95
124
|
/** @internal */
|
|
@@ -99,6 +128,86 @@ export const UserType$inboundSchema: z.ZodType<
|
|
|
99
128
|
unknown
|
|
100
129
|
> = openEnums.inboundSchema(UserType);
|
|
101
130
|
|
|
131
|
+
/** @internal */
|
|
132
|
+
export const Two2$inboundSchema: z.ZodType<Two2, z.ZodTypeDef, unknown> = z
|
|
133
|
+
.object({});
|
|
134
|
+
|
|
135
|
+
export function two2FromJSON(
|
|
136
|
+
jsonString: string,
|
|
137
|
+
): SafeParseResult<Two2, SDKValidationError> {
|
|
138
|
+
return safeParse(
|
|
139
|
+
jsonString,
|
|
140
|
+
(x) => Two2$inboundSchema.parse(JSON.parse(x)),
|
|
141
|
+
`Failed to parse 'Two2' from JSON`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/** @internal */
|
|
146
|
+
export const Two$inboundSchema: z.ZodType<Two, z.ZodTypeDef, unknown> =
|
|
147
|
+
smartUnion([types.number(), z.lazy(() => Two2$inboundSchema)]);
|
|
148
|
+
|
|
149
|
+
export function twoFromJSON(
|
|
150
|
+
jsonString: string,
|
|
151
|
+
): SafeParseResult<Two, SDKValidationError> {
|
|
152
|
+
return safeParse(
|
|
153
|
+
jsonString,
|
|
154
|
+
(x) => Two$inboundSchema.parse(JSON.parse(x)),
|
|
155
|
+
`Failed to parse 'Two' from JSON`,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** @internal */
|
|
160
|
+
export const PaymentProfile1$inboundSchema: z.ZodType<
|
|
161
|
+
PaymentProfile1,
|
|
162
|
+
z.ZodTypeDef,
|
|
163
|
+
unknown
|
|
164
|
+
> = z.object({
|
|
165
|
+
id: types.optional(types.number()),
|
|
166
|
+
is_valid: z.nullable(types.boolean()).optional(),
|
|
167
|
+
card_type: z.nullable(types.string()).optional(),
|
|
168
|
+
card_last4: z.nullable(types.string()).optional(),
|
|
169
|
+
is_dummy: z.nullable(types.boolean()).optional(),
|
|
170
|
+
profile_type: z.nullable(types.string()).optional(),
|
|
171
|
+
}).transform((v) => {
|
|
172
|
+
return remap$(v, {
|
|
173
|
+
"is_valid": "isValid",
|
|
174
|
+
"card_type": "cardType",
|
|
175
|
+
"card_last4": "cardLast4",
|
|
176
|
+
"is_dummy": "isDummy",
|
|
177
|
+
"profile_type": "profileType",
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
export function paymentProfile1FromJSON(
|
|
182
|
+
jsonString: string,
|
|
183
|
+
): SafeParseResult<PaymentProfile1, SDKValidationError> {
|
|
184
|
+
return safeParse(
|
|
185
|
+
jsonString,
|
|
186
|
+
(x) => PaymentProfile1$inboundSchema.parse(JSON.parse(x)),
|
|
187
|
+
`Failed to parse 'PaymentProfile1' from JSON`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** @internal */
|
|
192
|
+
export const UserDetailsPaymentProfile$inboundSchema: z.ZodType<
|
|
193
|
+
UserDetailsPaymentProfile,
|
|
194
|
+
z.ZodTypeDef,
|
|
195
|
+
unknown
|
|
196
|
+
> = smartUnion([
|
|
197
|
+
z.lazy(() => PaymentProfile1$inboundSchema),
|
|
198
|
+
smartUnion([types.number(), z.lazy(() => Two2$inboundSchema)]),
|
|
199
|
+
]);
|
|
200
|
+
|
|
201
|
+
export function userDetailsPaymentProfileFromJSON(
|
|
202
|
+
jsonString: string,
|
|
203
|
+
): SafeParseResult<UserDetailsPaymentProfile, SDKValidationError> {
|
|
204
|
+
return safeParse(
|
|
205
|
+
jsonString,
|
|
206
|
+
(x) => UserDetailsPaymentProfile$inboundSchema.parse(JSON.parse(x)),
|
|
207
|
+
`Failed to parse 'UserDetailsPaymentProfile' from JSON`,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
102
211
|
/** @internal */
|
|
103
212
|
export const UserDetails$inboundSchema: z.ZodType<
|
|
104
213
|
UserDetails,
|
|
@@ -119,6 +228,12 @@ export const UserDetails$inboundSchema: z.ZodType<
|
|
|
119
228
|
image_urls: z.nullable(ImageSet$inboundSchema).optional(),
|
|
120
229
|
location: z.nullable(UserLocation$inboundSchema).optional(),
|
|
121
230
|
email_preferences: types.optional(EmailPreferences$inboundSchema),
|
|
231
|
+
payment_profile: z.nullable(
|
|
232
|
+
smartUnion([
|
|
233
|
+
z.lazy(() => PaymentProfile1$inboundSchema),
|
|
234
|
+
smartUnion([types.number(), z.lazy(() => Two2$inboundSchema)]),
|
|
235
|
+
]),
|
|
236
|
+
).optional(),
|
|
122
237
|
}).transform((v) => {
|
|
123
238
|
return remap$(v, {
|
|
124
239
|
"first_name": "firstName",
|
|
@@ -129,6 +244,7 @@ export const UserDetails$inboundSchema: z.ZodType<
|
|
|
129
244
|
"user_type": "userType",
|
|
130
245
|
"image_urls": "imageUrls",
|
|
131
246
|
"email_preferences": "emailPreferences",
|
|
247
|
+
"payment_profile": "paymentProfile",
|
|
132
248
|
});
|
|
133
249
|
});
|
|
134
250
|
|
|
@@ -13,12 +13,12 @@ import { Department, Department$inboundSchema } from "./department.js";
|
|
|
13
13
|
import { Facility, Facility$inboundSchema } from "./facility.js";
|
|
14
14
|
import { ZoneConfig, ZoneConfig$inboundSchema } from "./zoneconfig.js";
|
|
15
15
|
|
|
16
|
-
export type
|
|
16
|
+
export type Facility2 = {
|
|
17
17
|
id?: number | undefined;
|
|
18
18
|
name?: string | undefined;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export type ZoneFacility = Facility |
|
|
21
|
+
export type ZoneFacility = Facility | Facility2;
|
|
22
22
|
|
|
23
23
|
export type ZoneDepartment = Department | number;
|
|
24
24
|
|
|
@@ -91,7 +91,7 @@ export type GpsCheckinPolicy = {
|
|
|
91
91
|
*/
|
|
92
92
|
export type Zone = {
|
|
93
93
|
id?: number | undefined;
|
|
94
|
-
facility?: Facility |
|
|
94
|
+
facility?: Facility | Facility2 | null | undefined;
|
|
95
95
|
department?: Department | number | null | undefined;
|
|
96
96
|
name?: string | null | undefined;
|
|
97
97
|
shortName?: string | null | undefined;
|
|
@@ -109,19 +109,22 @@ export type Zone = {
|
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
/** @internal */
|
|
112
|
-
export const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
112
|
+
export const Facility2$inboundSchema: z.ZodType<
|
|
113
|
+
Facility2,
|
|
114
|
+
z.ZodTypeDef,
|
|
115
|
+
unknown
|
|
116
|
+
> = z.object({
|
|
117
|
+
id: types.optional(types.number()),
|
|
118
|
+
name: types.optional(types.string()),
|
|
119
|
+
});
|
|
117
120
|
|
|
118
|
-
export function
|
|
121
|
+
export function facility2FromJSON(
|
|
119
122
|
jsonString: string,
|
|
120
|
-
): SafeParseResult<
|
|
123
|
+
): SafeParseResult<Facility2, SDKValidationError> {
|
|
121
124
|
return safeParse(
|
|
122
125
|
jsonString,
|
|
123
|
-
(x) =>
|
|
124
|
-
`Failed to parse '
|
|
126
|
+
(x) => Facility2$inboundSchema.parse(JSON.parse(x)),
|
|
127
|
+
`Failed to parse 'Facility2' from JSON`,
|
|
125
128
|
);
|
|
126
129
|
}
|
|
127
130
|
|
|
@@ -130,7 +133,7 @@ export const ZoneFacility$inboundSchema: z.ZodType<
|
|
|
130
133
|
ZoneFacility,
|
|
131
134
|
z.ZodTypeDef,
|
|
132
135
|
unknown
|
|
133
|
-
> = smartUnion([Facility$inboundSchema, z.lazy(() =>
|
|
136
|
+
> = smartUnion([Facility$inboundSchema, z.lazy(() => Facility2$inboundSchema)]);
|
|
134
137
|
|
|
135
138
|
export function zoneFacilityFromJSON(
|
|
136
139
|
jsonString: string,
|
|
@@ -383,7 +386,10 @@ export const Zone$inboundSchema: z.ZodType<Zone, z.ZodTypeDef, unknown> = z
|
|
|
383
386
|
.object({
|
|
384
387
|
id: types.optional(types.number()),
|
|
385
388
|
facility: z.nullable(
|
|
386
|
-
smartUnion([
|
|
389
|
+
smartUnion([
|
|
390
|
+
Facility$inboundSchema,
|
|
391
|
+
z.lazy(() => Facility2$inboundSchema),
|
|
392
|
+
]),
|
|
387
393
|
).optional(),
|
|
388
394
|
department: z.nullable(
|
|
389
395
|
smartUnion([Department$inboundSchema, types.number()]),
|
|
@@ -59,6 +59,7 @@ export * from "./getwebhookendpoint.js";
|
|
|
59
59
|
export * from "./invoicesexport.js";
|
|
60
60
|
export * from "./listalerts.js";
|
|
61
61
|
export * from "./listallwebhookendpoints.js";
|
|
62
|
+
export * from "./listcompanycredits.js";
|
|
62
63
|
export * from "./listcompanymanagers.js";
|
|
63
64
|
export * from "./listfeed.js";
|
|
64
65
|
export * from "./listinvoices.js";
|