@apideck/unify 0.43.10 → 0.44.0
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 +8 -1
- package/funcs/accountingAttachmentsList.d.ts.map +1 -1
- package/funcs/accountingAttachmentsList.js +4 -2
- package/funcs/accountingAttachmentsList.js.map +1 -1
- package/funcs/accountingCategoriesList.js +1 -0
- package/funcs/accountingCategoriesList.js.map +1 -1
- package/funcs/accountingCompaniesList.d.ts.map +1 -1
- package/funcs/accountingCompaniesList.js +4 -2
- package/funcs/accountingCompaniesList.js.map +1 -1
- package/funcs/accountingDepartmentsList.js +1 -0
- package/funcs/accountingDepartmentsList.js.map +1 -1
- package/funcs/accountingEmployeesList.js +1 -0
- package/funcs/accountingEmployeesList.js.map +1 -1
- package/funcs/accountingExpenseCategoriesList.js +1 -0
- package/funcs/accountingExpenseCategoriesList.js.map +1 -1
- package/funcs/accountingExpenseReportsList.js +1 -0
- package/funcs/accountingExpenseReportsList.js.map +1 -1
- package/funcs/accountingExpensesList.js +1 -0
- package/funcs/accountingExpensesList.js.map +1 -1
- package/funcs/accountingLocationsList.js +1 -0
- package/funcs/accountingLocationsList.js.map +1 -1
- package/funcs/accountingQuotesList.js +1 -0
- package/funcs/accountingQuotesList.js.map +1 -1
- package/funcs/accountingSubsidiariesList.d.ts.map +1 -1
- package/funcs/accountingSubsidiariesList.js +4 -2
- package/funcs/accountingSubsidiariesList.js.map +1 -1
- package/funcs/crmListsGet.d.ts +18 -0
- package/funcs/crmListsGet.d.ts.map +1 -0
- package/funcs/crmListsGet.js +146 -0
- package/funcs/crmListsGet.js.map +1 -0
- package/funcs/crmListsList.d.ts +21 -0
- package/funcs/crmListsList.d.ts.map +1 -0
- package/funcs/crmListsList.js +168 -0
- package/funcs/crmListsList.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +4 -4
- package/lib/config.js +4 -4
- package/lib/config.js.map +1 -1
- package/lib/http.d.ts +1 -1
- package/lib/http.d.ts.map +1 -1
- package/lib/http.js +1 -1
- package/lib/http.js.map +1 -1
- package/lib/security.d.ts +5 -4
- package/lib/security.d.ts.map +1 -1
- package/lib/security.js +6 -7
- package/lib/security.js.map +1 -1
- package/models/components/billsfilter.d.ts +10 -0
- package/models/components/billsfilter.d.ts.map +1 -1
- package/models/components/billsfilter.js +4 -0
- package/models/components/billsfilter.js.map +1 -1
- package/models/components/connection.d.ts +33 -9
- package/models/components/connection.d.ts.map +1 -1
- package/models/components/connection.js +32 -3
- package/models/components/connection.js.map +1 -1
- package/models/components/connector.d.ts +5 -0
- package/models/components/connector.d.ts.map +1 -1
- package/models/components/connector.js +2 -0
- package/models/components/connector.js.map +1 -1
- package/models/components/connectoroverview.d.ts +188 -0
- package/models/components/connectoroverview.d.ts.map +1 -0
- package/models/components/connectoroverview.js +148 -0
- package/models/components/connectoroverview.js.map +1 -0
- package/models/components/consumerconnection.d.ts +16 -3
- package/models/components/consumerconnection.d.ts.map +1 -1
- package/models/components/consumerconnection.js +14 -2
- package/models/components/consumerconnection.js.map +1 -1
- package/models/components/expensereport.d.ts +9 -0
- package/models/components/expensereport.d.ts.map +1 -1
- package/models/components/expensereport.js +2 -0
- package/models/components/expensereport.js.map +1 -1
- package/models/components/getlistresponse.d.ts +45 -0
- package/models/components/getlistresponse.d.ts.map +1 -0
- package/models/components/getlistresponse.js +66 -0
- package/models/components/getlistresponse.js.map +1 -0
- package/models/components/getlistsresponse.d.ts +50 -0
- package/models/components/getlistsresponse.d.ts.map +1 -0
- package/models/components/getlistsresponse.js +68 -0
- package/models/components/getlistsresponse.js.map +1 -0
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/ledgeraccountsfilter.d.ts +3 -3
- package/models/components/ledgeraccountsfilter.js +1 -1
- package/models/components/list.d.ts +114 -0
- package/models/components/list.d.ts.map +1 -0
- package/models/components/list.js +110 -0
- package/models/components/list.js.map +1 -0
- package/models/components/webhookeventlogsfilter.d.ts +35 -0
- package/models/components/webhookeventlogsfilter.d.ts.map +1 -1
- package/models/components/webhookeventlogsfilter.js +13 -0
- package/models/components/webhookeventlogsfilter.js.map +1 -1
- package/models/components/webhookeventtype.d.ts +6 -0
- package/models/components/webhookeventtype.d.ts.map +1 -1
- package/models/components/webhookeventtype.js +6 -0
- package/models/components/webhookeventtype.js.map +1 -1
- package/models/operations/accountingattachmentsall.d.ts +9 -0
- package/models/operations/accountingattachmentsall.d.ts.map +1 -1
- package/models/operations/accountingattachmentsall.js +2 -0
- package/models/operations/accountingattachmentsall.js.map +1 -1
- package/models/operations/accountingcategoriesall.d.ts +9 -0
- package/models/operations/accountingcategoriesall.d.ts.map +1 -1
- package/models/operations/accountingcategoriesall.js +5 -0
- package/models/operations/accountingcategoriesall.js.map +1 -1
- package/models/operations/accountingcompaniesall.d.ts +9 -0
- package/models/operations/accountingcompaniesall.d.ts.map +1 -1
- package/models/operations/accountingcompaniesall.js +5 -0
- package/models/operations/accountingcompaniesall.js.map +1 -1
- package/models/operations/accountingdepartmentsall.d.ts +9 -0
- package/models/operations/accountingdepartmentsall.d.ts.map +1 -1
- package/models/operations/accountingdepartmentsall.js +5 -0
- package/models/operations/accountingdepartmentsall.js.map +1 -1
- package/models/operations/accountingemployeesall.d.ts +9 -0
- package/models/operations/accountingemployeesall.d.ts.map +1 -1
- package/models/operations/accountingemployeesall.js +5 -0
- package/models/operations/accountingemployeesall.js.map +1 -1
- package/models/operations/accountingexpensecategoriesall.d.ts +9 -0
- package/models/operations/accountingexpensecategoriesall.d.ts.map +1 -1
- package/models/operations/accountingexpensecategoriesall.js +5 -0
- package/models/operations/accountingexpensecategoriesall.js.map +1 -1
- package/models/operations/accountingexpensereportsall.d.ts +9 -0
- package/models/operations/accountingexpensereportsall.d.ts.map +1 -1
- package/models/operations/accountingexpensereportsall.js +5 -0
- package/models/operations/accountingexpensereportsall.js.map +1 -1
- package/models/operations/accountingexpensesall.d.ts +9 -0
- package/models/operations/accountingexpensesall.d.ts.map +1 -1
- package/models/operations/accountingexpensesall.js +5 -0
- package/models/operations/accountingexpensesall.js.map +1 -1
- package/models/operations/accountinglocationsall.d.ts +9 -0
- package/models/operations/accountinglocationsall.d.ts.map +1 -1
- package/models/operations/accountinglocationsall.js +5 -0
- package/models/operations/accountinglocationsall.js.map +1 -1
- package/models/operations/accountingquotesall.d.ts +9 -0
- package/models/operations/accountingquotesall.d.ts.map +1 -1
- package/models/operations/accountingquotesall.js +5 -0
- package/models/operations/accountingquotesall.js.map +1 -1
- package/models/operations/accountingsubsidiariesall.d.ts +9 -0
- package/models/operations/accountingsubsidiariesall.d.ts.map +1 -1
- package/models/operations/accountingsubsidiariesall.js +5 -0
- package/models/operations/accountingsubsidiariesall.js.map +1 -1
- package/models/operations/crmlistsall.d.ts +81 -0
- package/models/operations/crmlistsall.d.ts.map +1 -0
- package/models/operations/crmlistsall.js +80 -0
- package/models/operations/crmlistsall.js.map +1 -0
- package/models/operations/crmlistsone.d.ts +67 -0
- package/models/operations/crmlistsone.d.ts.map +1 -0
- package/models/operations/crmlistsone.js +74 -0
- package/models/operations/crmlistsone.js.map +1 -0
- package/models/operations/index.d.ts +2 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +2 -0
- package/models/operations/index.js.map +1 -1
- package/package.json +1 -1
- package/sdk/crm.d.ts +3 -0
- package/sdk/crm.d.ts.map +1 -1
- package/sdk/crm.js +4 -0
- package/sdk/crm.js.map +1 -1
- package/sdk/lists.d.ts +22 -0
- package/sdk/lists.d.ts.map +1 -0
- package/sdk/lists.js +33 -0
- package/sdk/lists.js.map +1 -0
- package/src/__tests__/companies.test.ts +3 -0
- package/src/__tests__/connections.test.ts +48 -32
- package/src/__tests__/connectionsettings.test.ts +18 -12
- package/src/__tests__/consumers.test.ts +48 -32
- package/src/__tests__/employees.test.ts +3 -0
- package/src/__tests__/expensecategories.test.ts +3 -0
- package/src/__tests__/expensereports.test.ts +6 -0
- package/src/__tests__/quotes.test.ts +3 -0
- package/src/funcs/accountingAttachmentsList.ts +17 -7
- package/src/funcs/accountingCategoriesList.ts +1 -0
- package/src/funcs/accountingCompaniesList.ts +17 -7
- package/src/funcs/accountingDepartmentsList.ts +1 -0
- package/src/funcs/accountingEmployeesList.ts +1 -0
- package/src/funcs/accountingExpenseCategoriesList.ts +1 -0
- package/src/funcs/accountingExpenseReportsList.ts +1 -0
- package/src/funcs/accountingExpensesList.ts +1 -0
- package/src/funcs/accountingLocationsList.ts +1 -0
- package/src/funcs/accountingQuotesList.ts +1 -0
- package/src/funcs/accountingSubsidiariesList.ts +17 -7
- package/src/funcs/crmListsGet.ts +228 -0
- package/src/funcs/crmListsList.ts +303 -0
- package/src/lib/config.ts +4 -4
- package/src/lib/http.ts +3 -1
- package/src/lib/security.ts +10 -5
- package/src/models/components/billsfilter.ts +18 -0
- package/src/models/components/connection.ts +85 -6
- package/src/models/components/connector.ts +9 -0
- package/src/models/components/connectoroverview.ts +346 -0
- package/src/models/components/consumerconnection.ts +44 -3
- package/src/models/components/expensereport.ts +11 -0
- package/src/models/components/getlistresponse.ts +78 -0
- package/src/models/components/getlistsresponse.ts +84 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/ledgeraccountsfilter.ts +3 -3
- package/src/models/components/list.ts +181 -0
- package/src/models/components/webhookeventlogsfilter.ts +48 -0
- package/src/models/components/webhookeventtype.ts +6 -0
- package/src/models/operations/accountingattachmentsall.ts +7 -0
- package/src/models/operations/accountingcategoriesall.ts +10 -0
- package/src/models/operations/accountingcompaniesall.ts +10 -0
- package/src/models/operations/accountingdepartmentsall.ts +10 -0
- package/src/models/operations/accountingemployeesall.ts +10 -0
- package/src/models/operations/accountingexpensecategoriesall.ts +10 -0
- package/src/models/operations/accountingexpensereportsall.ts +10 -0
- package/src/models/operations/accountingexpensesall.ts +10 -0
- package/src/models/operations/accountinglocationsall.ts +10 -0
- package/src/models/operations/accountingquotesall.ts +10 -0
- package/src/models/operations/accountingsubsidiariesall.ts +10 -0
- package/src/models/operations/crmlistsall.ts +138 -0
- package/src/models/operations/crmlistsone.ts +122 -0
- package/src/models/operations/index.ts +2 -0
- package/src/sdk/crm.ts +6 -0
- package/src/sdk/lists.ts +46 -0
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { ApideckCore } from "../core.js";
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
encodeDeepObjectQuery,
|
|
8
|
+
encodeFormQuery,
|
|
9
|
+
encodeSimple,
|
|
10
|
+
queryJoin,
|
|
11
|
+
} from "../lib/encodings.js";
|
|
7
12
|
import { matchStatusCode } from "../lib/http.js";
|
|
8
13
|
import * as M from "../lib/matchers.js";
|
|
9
14
|
import { compactMap } from "../lib/primitives.js";
|
|
@@ -112,12 +117,17 @@ async function $do(
|
|
|
112
117
|
|
|
113
118
|
const path = pathToFunc("/accounting/subsidiaries")();
|
|
114
119
|
|
|
115
|
-
const query =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
const query = queryJoin(
|
|
121
|
+
encodeDeepObjectQuery({
|
|
122
|
+
"pass_through": payload.pass_through,
|
|
123
|
+
}),
|
|
124
|
+
encodeFormQuery({
|
|
125
|
+
"cursor": payload.cursor,
|
|
126
|
+
"fields": payload.fields,
|
|
127
|
+
"limit": payload.limit,
|
|
128
|
+
"raw": payload.raw,
|
|
129
|
+
}),
|
|
130
|
+
);
|
|
121
131
|
|
|
122
132
|
const headers = new Headers(compactMap({
|
|
123
133
|
Accept: "application/json",
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { ApideckCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { ApideckError } from "../models/errors/apideckerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get list
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Get list
|
|
34
|
+
*/
|
|
35
|
+
export function crmListsGet(
|
|
36
|
+
client: ApideckCore,
|
|
37
|
+
request: operations.CrmListsOneRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
operations.CrmListsOneResponse,
|
|
42
|
+
| errors.BadRequestResponse
|
|
43
|
+
| errors.UnauthorizedResponse
|
|
44
|
+
| errors.PaymentRequiredResponse
|
|
45
|
+
| errors.NotFoundResponse
|
|
46
|
+
| errors.UnprocessableResponse
|
|
47
|
+
| ApideckError
|
|
48
|
+
| ResponseValidationError
|
|
49
|
+
| ConnectionError
|
|
50
|
+
| RequestAbortedError
|
|
51
|
+
| RequestTimeoutError
|
|
52
|
+
| InvalidRequestError
|
|
53
|
+
| UnexpectedClientError
|
|
54
|
+
| SDKValidationError
|
|
55
|
+
>
|
|
56
|
+
> {
|
|
57
|
+
return new APIPromise($do(
|
|
58
|
+
client,
|
|
59
|
+
request,
|
|
60
|
+
options,
|
|
61
|
+
));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async function $do(
|
|
65
|
+
client: ApideckCore,
|
|
66
|
+
request: operations.CrmListsOneRequest,
|
|
67
|
+
options?: RequestOptions,
|
|
68
|
+
): Promise<
|
|
69
|
+
[
|
|
70
|
+
Result<
|
|
71
|
+
operations.CrmListsOneResponse,
|
|
72
|
+
| errors.BadRequestResponse
|
|
73
|
+
| errors.UnauthorizedResponse
|
|
74
|
+
| errors.PaymentRequiredResponse
|
|
75
|
+
| errors.NotFoundResponse
|
|
76
|
+
| errors.UnprocessableResponse
|
|
77
|
+
| ApideckError
|
|
78
|
+
| ResponseValidationError
|
|
79
|
+
| ConnectionError
|
|
80
|
+
| RequestAbortedError
|
|
81
|
+
| RequestTimeoutError
|
|
82
|
+
| InvalidRequestError
|
|
83
|
+
| UnexpectedClientError
|
|
84
|
+
| SDKValidationError
|
|
85
|
+
>,
|
|
86
|
+
APICall,
|
|
87
|
+
]
|
|
88
|
+
> {
|
|
89
|
+
const parsed = safeParse(
|
|
90
|
+
request,
|
|
91
|
+
(value) => operations.CrmListsOneRequest$outboundSchema.parse(value),
|
|
92
|
+
"Input validation failed",
|
|
93
|
+
);
|
|
94
|
+
if (!parsed.ok) {
|
|
95
|
+
return [parsed, { status: "invalid" }];
|
|
96
|
+
}
|
|
97
|
+
const payload = parsed.value;
|
|
98
|
+
const body = null;
|
|
99
|
+
|
|
100
|
+
const pathParams = {
|
|
101
|
+
id: encodeSimple("id", payload.id, {
|
|
102
|
+
explode: false,
|
|
103
|
+
charEncoding: "percent",
|
|
104
|
+
}),
|
|
105
|
+
};
|
|
106
|
+
const path = pathToFunc("/crm/lists/{id}")(pathParams);
|
|
107
|
+
|
|
108
|
+
const query = encodeFormQuery({
|
|
109
|
+
"fields": payload.fields,
|
|
110
|
+
"raw": payload.raw,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const headers = new Headers(compactMap({
|
|
114
|
+
Accept: "application/json",
|
|
115
|
+
"x-apideck-app-id": encodeSimple(
|
|
116
|
+
"x-apideck-app-id",
|
|
117
|
+
payload.appId ?? client._options.appId,
|
|
118
|
+
{ explode: false, charEncoding: "none" },
|
|
119
|
+
),
|
|
120
|
+
"x-apideck-consumer-id": encodeSimple(
|
|
121
|
+
"x-apideck-consumer-id",
|
|
122
|
+
payload.consumerId ?? client._options.consumerId,
|
|
123
|
+
{ explode: false, charEncoding: "none" },
|
|
124
|
+
),
|
|
125
|
+
"x-apideck-service-id": encodeSimple(
|
|
126
|
+
"x-apideck-service-id",
|
|
127
|
+
payload.serviceId,
|
|
128
|
+
{ explode: false, charEncoding: "none" },
|
|
129
|
+
),
|
|
130
|
+
}));
|
|
131
|
+
|
|
132
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
133
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
134
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
135
|
+
|
|
136
|
+
const context = {
|
|
137
|
+
options: client._options,
|
|
138
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
139
|
+
operationID: "crm.listsOne",
|
|
140
|
+
oAuth2Scopes: null,
|
|
141
|
+
|
|
142
|
+
resolvedSecurity: requestSecurity,
|
|
143
|
+
|
|
144
|
+
securitySource: client._options.apiKey,
|
|
145
|
+
retryConfig: options?.retries
|
|
146
|
+
|| client._options.retryConfig
|
|
147
|
+
|| {
|
|
148
|
+
strategy: "backoff",
|
|
149
|
+
backoff: {
|
|
150
|
+
initialInterval: 500,
|
|
151
|
+
maxInterval: 60000,
|
|
152
|
+
exponent: 1.5,
|
|
153
|
+
maxElapsedTime: 900000,
|
|
154
|
+
},
|
|
155
|
+
retryConnectionErrors: true,
|
|
156
|
+
}
|
|
157
|
+
|| { strategy: "none" },
|
|
158
|
+
retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const requestRes = client._createRequest(context, {
|
|
162
|
+
security: requestSecurity,
|
|
163
|
+
method: "GET",
|
|
164
|
+
baseURL: options?.serverURL,
|
|
165
|
+
path: path,
|
|
166
|
+
headers: headers,
|
|
167
|
+
query: query,
|
|
168
|
+
body: body,
|
|
169
|
+
userAgent: client._options.userAgent,
|
|
170
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
171
|
+
}, options);
|
|
172
|
+
if (!requestRes.ok) {
|
|
173
|
+
return [requestRes, { status: "invalid" }];
|
|
174
|
+
}
|
|
175
|
+
const req = requestRes.value;
|
|
176
|
+
|
|
177
|
+
const doResult = await client._do(req, {
|
|
178
|
+
context,
|
|
179
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
180
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
181
|
+
retryConfig: context.retryConfig,
|
|
182
|
+
retryCodes: context.retryCodes,
|
|
183
|
+
});
|
|
184
|
+
if (!doResult.ok) {
|
|
185
|
+
return [doResult, { status: "request-error", request: req }];
|
|
186
|
+
}
|
|
187
|
+
const response = doResult.value;
|
|
188
|
+
|
|
189
|
+
const responseFields = {
|
|
190
|
+
HttpMeta: { Response: response, Request: req },
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const [result] = await M.match<
|
|
194
|
+
operations.CrmListsOneResponse,
|
|
195
|
+
| errors.BadRequestResponse
|
|
196
|
+
| errors.UnauthorizedResponse
|
|
197
|
+
| errors.PaymentRequiredResponse
|
|
198
|
+
| errors.NotFoundResponse
|
|
199
|
+
| errors.UnprocessableResponse
|
|
200
|
+
| ApideckError
|
|
201
|
+
| ResponseValidationError
|
|
202
|
+
| ConnectionError
|
|
203
|
+
| RequestAbortedError
|
|
204
|
+
| RequestTimeoutError
|
|
205
|
+
| InvalidRequestError
|
|
206
|
+
| UnexpectedClientError
|
|
207
|
+
| SDKValidationError
|
|
208
|
+
>(
|
|
209
|
+
M.json(200, operations.CrmListsOneResponse$inboundSchema, {
|
|
210
|
+
key: "GetListResponse",
|
|
211
|
+
}),
|
|
212
|
+
M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
|
|
213
|
+
M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
|
|
214
|
+
M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
|
|
215
|
+
M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
|
|
216
|
+
M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
|
|
217
|
+
M.fail("4XX"),
|
|
218
|
+
M.fail("5XX"),
|
|
219
|
+
M.json("default", operations.CrmListsOneResponse$inboundSchema, {
|
|
220
|
+
key: "UnexpectedErrorResponse",
|
|
221
|
+
}),
|
|
222
|
+
)(response, req, { extraFields: responseFields });
|
|
223
|
+
if (!result.ok) {
|
|
224
|
+
return [result, { status: "complete", request: req, response }];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return [result, { status: "complete", request: req, response }];
|
|
228
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { ApideckCore } from "../core.js";
|
|
6
|
+
import {
|
|
7
|
+
encodeDeepObjectQuery,
|
|
8
|
+
encodeFormQuery,
|
|
9
|
+
encodeSimple,
|
|
10
|
+
queryJoin,
|
|
11
|
+
} from "../lib/encodings.js";
|
|
12
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
13
|
+
import * as M from "../lib/matchers.js";
|
|
14
|
+
import { compactMap } from "../lib/primitives.js";
|
|
15
|
+
import { safeParse } from "../lib/schemas.js";
|
|
16
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
17
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
18
|
+
import { pathToFunc } from "../lib/url.js";
|
|
19
|
+
import { ApideckError } from "../models/errors/apideckerror.js";
|
|
20
|
+
import {
|
|
21
|
+
ConnectionError,
|
|
22
|
+
InvalidRequestError,
|
|
23
|
+
RequestAbortedError,
|
|
24
|
+
RequestTimeoutError,
|
|
25
|
+
UnexpectedClientError,
|
|
26
|
+
} from "../models/errors/httpclienterrors.js";
|
|
27
|
+
import * as errors from "../models/errors/index.js";
|
|
28
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
29
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
30
|
+
import * as operations from "../models/operations/index.js";
|
|
31
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
32
|
+
import { Result } from "../types/fp.js";
|
|
33
|
+
import {
|
|
34
|
+
createPageIterator,
|
|
35
|
+
haltIterator,
|
|
36
|
+
PageIterator,
|
|
37
|
+
Paginator,
|
|
38
|
+
} from "../types/operations.js";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* List lists
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* List lists
|
|
45
|
+
*/
|
|
46
|
+
export function crmListsList(
|
|
47
|
+
client: ApideckCore,
|
|
48
|
+
request: operations.CrmListsAllRequest,
|
|
49
|
+
options?: RequestOptions,
|
|
50
|
+
): APIPromise<
|
|
51
|
+
PageIterator<
|
|
52
|
+
Result<
|
|
53
|
+
operations.CrmListsAllResponse,
|
|
54
|
+
| errors.BadRequestResponse
|
|
55
|
+
| errors.UnauthorizedResponse
|
|
56
|
+
| errors.PaymentRequiredResponse
|
|
57
|
+
| errors.NotFoundResponse
|
|
58
|
+
| errors.UnprocessableResponse
|
|
59
|
+
| ApideckError
|
|
60
|
+
| ResponseValidationError
|
|
61
|
+
| ConnectionError
|
|
62
|
+
| RequestAbortedError
|
|
63
|
+
| RequestTimeoutError
|
|
64
|
+
| InvalidRequestError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| SDKValidationError
|
|
67
|
+
>,
|
|
68
|
+
{ cursor: string }
|
|
69
|
+
>
|
|
70
|
+
> {
|
|
71
|
+
return new APIPromise($do(
|
|
72
|
+
client,
|
|
73
|
+
request,
|
|
74
|
+
options,
|
|
75
|
+
));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function $do(
|
|
79
|
+
client: ApideckCore,
|
|
80
|
+
request: operations.CrmListsAllRequest,
|
|
81
|
+
options?: RequestOptions,
|
|
82
|
+
): Promise<
|
|
83
|
+
[
|
|
84
|
+
PageIterator<
|
|
85
|
+
Result<
|
|
86
|
+
operations.CrmListsAllResponse,
|
|
87
|
+
| errors.BadRequestResponse
|
|
88
|
+
| errors.UnauthorizedResponse
|
|
89
|
+
| errors.PaymentRequiredResponse
|
|
90
|
+
| errors.NotFoundResponse
|
|
91
|
+
| errors.UnprocessableResponse
|
|
92
|
+
| ApideckError
|
|
93
|
+
| ResponseValidationError
|
|
94
|
+
| ConnectionError
|
|
95
|
+
| RequestAbortedError
|
|
96
|
+
| RequestTimeoutError
|
|
97
|
+
| InvalidRequestError
|
|
98
|
+
| UnexpectedClientError
|
|
99
|
+
| SDKValidationError
|
|
100
|
+
>,
|
|
101
|
+
{ cursor: string }
|
|
102
|
+
>,
|
|
103
|
+
APICall,
|
|
104
|
+
]
|
|
105
|
+
> {
|
|
106
|
+
const parsed = safeParse(
|
|
107
|
+
request,
|
|
108
|
+
(value) => operations.CrmListsAllRequest$outboundSchema.parse(value),
|
|
109
|
+
"Input validation failed",
|
|
110
|
+
);
|
|
111
|
+
if (!parsed.ok) {
|
|
112
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
113
|
+
}
|
|
114
|
+
const payload = parsed.value;
|
|
115
|
+
const body = null;
|
|
116
|
+
|
|
117
|
+
const path = pathToFunc("/crm/lists")();
|
|
118
|
+
|
|
119
|
+
const query = queryJoin(
|
|
120
|
+
encodeDeepObjectQuery({
|
|
121
|
+
"pass_through": payload.pass_through,
|
|
122
|
+
}),
|
|
123
|
+
encodeFormQuery({
|
|
124
|
+
"cursor": payload.cursor,
|
|
125
|
+
"fields": payload.fields,
|
|
126
|
+
"limit": payload.limit,
|
|
127
|
+
"raw": payload.raw,
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
const headers = new Headers(compactMap({
|
|
132
|
+
Accept: "application/json",
|
|
133
|
+
"x-apideck-app-id": encodeSimple(
|
|
134
|
+
"x-apideck-app-id",
|
|
135
|
+
payload.appId ?? client._options.appId,
|
|
136
|
+
{ explode: false, charEncoding: "none" },
|
|
137
|
+
),
|
|
138
|
+
"x-apideck-consumer-id": encodeSimple(
|
|
139
|
+
"x-apideck-consumer-id",
|
|
140
|
+
payload.consumerId ?? client._options.consumerId,
|
|
141
|
+
{ explode: false, charEncoding: "none" },
|
|
142
|
+
),
|
|
143
|
+
"x-apideck-service-id": encodeSimple(
|
|
144
|
+
"x-apideck-service-id",
|
|
145
|
+
payload.serviceId,
|
|
146
|
+
{ explode: false, charEncoding: "none" },
|
|
147
|
+
),
|
|
148
|
+
}));
|
|
149
|
+
|
|
150
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
151
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
152
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
153
|
+
|
|
154
|
+
const context = {
|
|
155
|
+
options: client._options,
|
|
156
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
157
|
+
operationID: "crm.listsAll",
|
|
158
|
+
oAuth2Scopes: null,
|
|
159
|
+
|
|
160
|
+
resolvedSecurity: requestSecurity,
|
|
161
|
+
|
|
162
|
+
securitySource: client._options.apiKey,
|
|
163
|
+
retryConfig: options?.retries
|
|
164
|
+
|| client._options.retryConfig
|
|
165
|
+
|| {
|
|
166
|
+
strategy: "backoff",
|
|
167
|
+
backoff: {
|
|
168
|
+
initialInterval: 500,
|
|
169
|
+
maxInterval: 60000,
|
|
170
|
+
exponent: 1.5,
|
|
171
|
+
maxElapsedTime: 900000,
|
|
172
|
+
},
|
|
173
|
+
retryConnectionErrors: true,
|
|
174
|
+
}
|
|
175
|
+
|| { strategy: "none" },
|
|
176
|
+
retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const requestRes = client._createRequest(context, {
|
|
180
|
+
security: requestSecurity,
|
|
181
|
+
method: "GET",
|
|
182
|
+
baseURL: options?.serverURL,
|
|
183
|
+
path: path,
|
|
184
|
+
headers: headers,
|
|
185
|
+
query: query,
|
|
186
|
+
body: body,
|
|
187
|
+
userAgent: client._options.userAgent,
|
|
188
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
189
|
+
}, options);
|
|
190
|
+
if (!requestRes.ok) {
|
|
191
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
192
|
+
}
|
|
193
|
+
const req = requestRes.value;
|
|
194
|
+
|
|
195
|
+
const doResult = await client._do(req, {
|
|
196
|
+
context,
|
|
197
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
198
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
199
|
+
retryConfig: context.retryConfig,
|
|
200
|
+
retryCodes: context.retryCodes,
|
|
201
|
+
});
|
|
202
|
+
if (!doResult.ok) {
|
|
203
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
204
|
+
}
|
|
205
|
+
const response = doResult.value;
|
|
206
|
+
|
|
207
|
+
const responseFields = {
|
|
208
|
+
HttpMeta: { Response: response, Request: req },
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const [result, raw] = await M.match<
|
|
212
|
+
operations.CrmListsAllResponse,
|
|
213
|
+
| errors.BadRequestResponse
|
|
214
|
+
| errors.UnauthorizedResponse
|
|
215
|
+
| errors.PaymentRequiredResponse
|
|
216
|
+
| errors.NotFoundResponse
|
|
217
|
+
| errors.UnprocessableResponse
|
|
218
|
+
| ApideckError
|
|
219
|
+
| ResponseValidationError
|
|
220
|
+
| ConnectionError
|
|
221
|
+
| RequestAbortedError
|
|
222
|
+
| RequestTimeoutError
|
|
223
|
+
| InvalidRequestError
|
|
224
|
+
| UnexpectedClientError
|
|
225
|
+
| SDKValidationError
|
|
226
|
+
>(
|
|
227
|
+
M.json(200, operations.CrmListsAllResponse$inboundSchema, {
|
|
228
|
+
key: "GetListsResponse",
|
|
229
|
+
}),
|
|
230
|
+
M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
|
|
231
|
+
M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
|
|
232
|
+
M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
|
|
233
|
+
M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
|
|
234
|
+
M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
|
|
235
|
+
M.fail("4XX"),
|
|
236
|
+
M.fail("5XX"),
|
|
237
|
+
M.json("default", operations.CrmListsAllResponse$inboundSchema, {
|
|
238
|
+
key: "UnexpectedErrorResponse",
|
|
239
|
+
}),
|
|
240
|
+
)(response, req, { extraFields: responseFields });
|
|
241
|
+
if (!result.ok) {
|
|
242
|
+
return [haltIterator(result), {
|
|
243
|
+
status: "complete",
|
|
244
|
+
request: req,
|
|
245
|
+
response,
|
|
246
|
+
}];
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const nextFunc = (
|
|
250
|
+
responseData: unknown,
|
|
251
|
+
): {
|
|
252
|
+
next: Paginator<
|
|
253
|
+
Result<
|
|
254
|
+
operations.CrmListsAllResponse,
|
|
255
|
+
| errors.BadRequestResponse
|
|
256
|
+
| errors.UnauthorizedResponse
|
|
257
|
+
| errors.PaymentRequiredResponse
|
|
258
|
+
| errors.NotFoundResponse
|
|
259
|
+
| errors.UnprocessableResponse
|
|
260
|
+
| ApideckError
|
|
261
|
+
| ResponseValidationError
|
|
262
|
+
| ConnectionError
|
|
263
|
+
| RequestAbortedError
|
|
264
|
+
| RequestTimeoutError
|
|
265
|
+
| InvalidRequestError
|
|
266
|
+
| UnexpectedClientError
|
|
267
|
+
| SDKValidationError
|
|
268
|
+
>
|
|
269
|
+
>;
|
|
270
|
+
"~next"?: { cursor: string };
|
|
271
|
+
} => {
|
|
272
|
+
const nextCursor =
|
|
273
|
+
(responseData as
|
|
274
|
+
| { meta?: { cursors?: { next?: unknown } } }
|
|
275
|
+
| null
|
|
276
|
+
| undefined)?.meta?.cursors?.next;
|
|
277
|
+
if (typeof nextCursor !== "string") {
|
|
278
|
+
return { next: () => null };
|
|
279
|
+
}
|
|
280
|
+
if (nextCursor.trim() === "") {
|
|
281
|
+
return { next: () => null };
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const nextVal = () =>
|
|
285
|
+
crmListsList(
|
|
286
|
+
client,
|
|
287
|
+
{
|
|
288
|
+
...request,
|
|
289
|
+
cursor: nextCursor,
|
|
290
|
+
},
|
|
291
|
+
options,
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
return { next: nextVal, "~next": { cursor: nextCursor } };
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
298
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
299
|
+
status: "complete",
|
|
300
|
+
request: req,
|
|
301
|
+
response,
|
|
302
|
+
}];
|
|
303
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -67,8 +67,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
67
67
|
|
|
68
68
|
export const SDK_METADATA = {
|
|
69
69
|
language: "typescript",
|
|
70
|
-
openapiDocVersion: "10.
|
|
71
|
-
sdkVersion: "0.
|
|
72
|
-
genVersion: "2.
|
|
73
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
70
|
+
openapiDocVersion: "10.28.1",
|
|
71
|
+
sdkVersion: "0.44.0",
|
|
72
|
+
genVersion: "2.924.0",
|
|
73
|
+
userAgent: "speakeasy-sdk/typescript 0.44.0 2.924.0 10.28.1 @apideck/unify",
|
|
74
74
|
} as const;
|
package/src/lib/http.ts
CHANGED
|
@@ -45,8 +45,10 @@ export class HTTPClient {
|
|
|
45
45
|
private requestHooks: BeforeRequestHook[] = [];
|
|
46
46
|
private requestErrorHooks: RequestErrorHook[] = [];
|
|
47
47
|
private responseHooks: ResponseHook[] = [];
|
|
48
|
+
private options: HTTPClientOptions;
|
|
48
49
|
|
|
49
|
-
constructor(
|
|
50
|
+
constructor(options: HTTPClientOptions = {}) {
|
|
51
|
+
this.options = options;
|
|
50
52
|
this.fetcher = options.fetcher || DEFAULT_FETCHER;
|
|
51
53
|
}
|
|
52
54
|
|
package/src/lib/security.ts
CHANGED
|
@@ -13,17 +13,22 @@ type OAuth2PasswordFlow = {
|
|
|
13
13
|
tokenURL: string;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
export
|
|
17
|
-
Incomplete
|
|
18
|
-
UnrecognisedSecurityType
|
|
19
|
-
}
|
|
16
|
+
export const SecurityErrorCode = {
|
|
17
|
+
Incomplete: "incomplete",
|
|
18
|
+
UnrecognisedSecurityType: "unrecognized_security_type",
|
|
19
|
+
} as const;
|
|
20
|
+
export type SecurityErrorCode =
|
|
21
|
+
(typeof SecurityErrorCode)[keyof typeof SecurityErrorCode];
|
|
20
22
|
|
|
21
23
|
export class SecurityError extends Error {
|
|
24
|
+
public code: SecurityErrorCode;
|
|
25
|
+
|
|
22
26
|
constructor(
|
|
23
|
-
|
|
27
|
+
code: SecurityErrorCode,
|
|
24
28
|
message: string,
|
|
25
29
|
) {
|
|
26
30
|
super(message);
|
|
31
|
+
this.code = code;
|
|
27
32
|
this.name = "SecurityError";
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -26,6 +26,14 @@ export type BillsFilter = {
|
|
|
26
26
|
*/
|
|
27
27
|
idSince?: string | undefined;
|
|
28
28
|
updatedSince?: Date | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Return bills with a document date (`bill_date`) on or after the given date (YYYY-MM-DD).
|
|
31
|
+
*/
|
|
32
|
+
billedSince?: Date | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Return bills with a due date (`due_date`) on or after the given date (YYYY-MM-DD).
|
|
35
|
+
*/
|
|
36
|
+
dueSince?: Date | undefined;
|
|
29
37
|
/**
|
|
30
38
|
* Filter by bill status
|
|
31
39
|
*/
|
|
@@ -47,6 +55,8 @@ export const BillsFilterStatus$outboundSchema: z.ZodType<
|
|
|
47
55
|
export type BillsFilter$Outbound = {
|
|
48
56
|
id_since?: string | undefined;
|
|
49
57
|
updated_since?: string | undefined;
|
|
58
|
+
billed_since?: string | undefined;
|
|
59
|
+
due_since?: string | undefined;
|
|
50
60
|
status?: string | undefined;
|
|
51
61
|
subsidiary_id?: string | undefined;
|
|
52
62
|
};
|
|
@@ -59,12 +69,20 @@ export const BillsFilter$outboundSchema: z.ZodType<
|
|
|
59
69
|
> = z.object({
|
|
60
70
|
idSince: z.string().optional(),
|
|
61
71
|
updatedSince: z.date().transform(v => v.toISOString()).optional(),
|
|
72
|
+
billedSince: z.date().transform(v =>
|
|
73
|
+
v.toISOString().slice(0, "YYYY-MM-DD".length)
|
|
74
|
+
).optional(),
|
|
75
|
+
dueSince: z.date().transform(v =>
|
|
76
|
+
v.toISOString().slice(0, "YYYY-MM-DD".length)
|
|
77
|
+
).optional(),
|
|
62
78
|
status: BillsFilterStatus$outboundSchema.optional(),
|
|
63
79
|
subsidiaryId: z.string().optional(),
|
|
64
80
|
}).transform((v) => {
|
|
65
81
|
return remap$(v, {
|
|
66
82
|
idSince: "id_since",
|
|
67
83
|
updatedSince: "updated_since",
|
|
84
|
+
billedSince: "billed_since",
|
|
85
|
+
dueSince: "due_since",
|
|
68
86
|
subsidiaryId: "subsidiary_id",
|
|
69
87
|
});
|
|
70
88
|
});
|