@clientcasa/sdk 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/esm/funcs/venues-create.d.ts +16 -0
- package/esm/funcs/venues-create.d.ts.map +1 -0
- package/esm/funcs/venues-create.js +93 -0
- package/esm/funcs/venues-create.js.map +1 -0
- package/esm/funcs/venues-delete.d.ts +15 -0
- package/esm/funcs/venues-delete.d.ts.map +1 -0
- package/esm/funcs/venues-delete.js +106 -0
- package/esm/funcs/venues-delete.js.map +1 -0
- package/esm/funcs/venues-get.d.ts +16 -0
- package/esm/funcs/venues-get.d.ts.map +1 -0
- package/esm/funcs/venues-get.js +107 -0
- package/esm/funcs/venues-get.js.map +1 -0
- package/esm/funcs/venues-list.d.ts +18 -0
- package/esm/funcs/venues-list.d.ts.map +1 -0
- package/esm/funcs/venues-list.js +136 -0
- package/esm/funcs/venues-list.js.map +1 -0
- package/esm/funcs/venues-update.d.ts +16 -0
- package/esm/funcs/venues-update.d.ts.map +1 -0
- package/esm/funcs/venues-update.js +108 -0
- package/esm/funcs/venues-update.js.map +1 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/index.d.ts +4 -0
- package/esm/models/index.d.ts.map +1 -1
- package/esm/models/index.js +4 -0
- package/esm/models/index.js.map +1 -1
- package/esm/models/operations/create-venue.d.ts +30 -0
- package/esm/models/operations/create-venue.d.ts.map +1 -0
- package/esm/models/operations/create-venue.js +27 -0
- package/esm/models/operations/create-venue.js.map +1 -0
- package/esm/models/operations/delete-venue.d.ts +27 -0
- package/esm/models/operations/delete-venue.d.ts.map +1 -0
- package/esm/models/operations/delete-venue.js +20 -0
- package/esm/models/operations/delete-venue.js.map +1 -0
- package/esm/models/operations/get-venue.d.ts +27 -0
- package/esm/models/operations/get-venue.d.ts.map +1 -0
- package/esm/models/operations/get-venue.js +20 -0
- package/esm/models/operations/get-venue.js.map +1 -0
- package/esm/models/operations/index.d.ts +5 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +5 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/list-venues.d.ts +45 -0
- package/esm/models/operations/list-venues.d.ts.map +1 -0
- package/esm/models/operations/list-venues.js +42 -0
- package/esm/models/operations/list-venues.js.map +1 -0
- package/esm/models/operations/update-venue.d.ts +30 -0
- package/esm/models/operations/update-venue.d.ts.map +1 -0
- package/esm/models/operations/update-venue.js +22 -0
- package/esm/models/operations/update-venue.js.map +1 -0
- package/esm/models/timeline-item-create.d.ts +10 -0
- package/esm/models/timeline-item-create.d.ts.map +1 -1
- package/esm/models/timeline-item-create.js +4 -0
- package/esm/models/timeline-item-create.js.map +1 -1
- package/esm/models/timeline-item-update.d.ts +10 -0
- package/esm/models/timeline-item-update.d.ts.map +1 -1
- package/esm/models/timeline-item-update.js +4 -0
- package/esm/models/timeline-item-update.js.map +1 -1
- package/esm/models/timeline-item.d.ts +10 -0
- package/esm/models/timeline-item.d.ts.map +1 -1
- package/esm/models/timeline-item.js +4 -0
- package/esm/models/timeline-item.js.map +1 -1
- package/esm/models/venue-create.d.ts +88 -0
- package/esm/models/venue-create.d.ts.map +1 -0
- package/esm/models/venue-create.js +58 -0
- package/esm/models/venue-create.js.map +1 -0
- package/esm/models/venue-list.d.ts +13 -0
- package/esm/models/venue-list.d.ts.map +1 -0
- package/esm/models/venue-list.js +17 -0
- package/esm/models/venue-list.js.map +1 -0
- package/esm/models/venue-update.d.ts +88 -0
- package/esm/models/venue-update.d.ts.map +1 -0
- package/esm/models/venue-update.js +58 -0
- package/esm/models/venue-update.js.map +1 -0
- package/esm/models/venue.d.ts +67 -0
- package/esm/models/venue.d.ts.map +1 -0
- package/esm/models/venue.js +65 -0
- package/esm/models/venue.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/esm/sdk/venues.d.ts +29 -0
- package/esm/sdk/venues.d.ts.map +1 -0
- package/esm/sdk/venues.js +44 -0
- package/esm/sdk/venues.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/venues-create.ts +192 -0
- package/src/funcs/venues-delete.ts +201 -0
- package/src/funcs/venues-get.ts +202 -0
- package/src/funcs/venues-list.ts +272 -0
- package/src/funcs/venues-update.ts +203 -0
- package/src/lib/config.ts +2 -2
- package/src/models/index.ts +4 -0
- package/src/models/operations/create-venue.ts +73 -0
- package/src/models/operations/delete-venue.ts +61 -0
- package/src/models/operations/get-venue.ts +59 -0
- package/src/models/operations/index.ts +5 -0
- package/src/models/operations/list-venues.ts +110 -0
- package/src/models/operations/update-venue.ts +65 -0
- package/src/models/timeline-item-create.ts +10 -0
- package/src/models/timeline-item-update.ts +10 -0
- package/src/models/timeline-item.ts +10 -0
- package/src/models/venue-create.ts +172 -0
- package/src/models/venue-list.ts +35 -0
- package/src/models/venue-update.ts +172 -0
- package/src/models/venue.ts +155 -0
- package/src/sdk/sdk.ts +6 -0
- package/src/sdk/venues.ts +96 -0
|
@@ -0,0 +1,201 @@
|
|
|
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 { encodeSimple } 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
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Delete a venue
|
|
32
|
+
*/
|
|
33
|
+
export function venuesDelete(
|
|
34
|
+
client: ClientCasaCore,
|
|
35
|
+
security: operations.DeleteVenueSecurity,
|
|
36
|
+
request: operations.DeleteVenueRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
void,
|
|
41
|
+
| errors.ApiError
|
|
42
|
+
| ClientCasaError
|
|
43
|
+
| ResponseValidationError
|
|
44
|
+
| ConnectionError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| InvalidRequestError
|
|
48
|
+
| UnexpectedClientError
|
|
49
|
+
| SDKValidationError
|
|
50
|
+
>
|
|
51
|
+
> {
|
|
52
|
+
return new APIPromise($do(
|
|
53
|
+
client,
|
|
54
|
+
security,
|
|
55
|
+
request,
|
|
56
|
+
options,
|
|
57
|
+
));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function $do(
|
|
61
|
+
client: ClientCasaCore,
|
|
62
|
+
security: operations.DeleteVenueSecurity,
|
|
63
|
+
request: operations.DeleteVenueRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
void,
|
|
69
|
+
| errors.ApiError
|
|
70
|
+
| ClientCasaError
|
|
71
|
+
| ResponseValidationError
|
|
72
|
+
| ConnectionError
|
|
73
|
+
| RequestAbortedError
|
|
74
|
+
| RequestTimeoutError
|
|
75
|
+
| InvalidRequestError
|
|
76
|
+
| UnexpectedClientError
|
|
77
|
+
| SDKValidationError
|
|
78
|
+
>,
|
|
79
|
+
APICall,
|
|
80
|
+
]
|
|
81
|
+
> {
|
|
82
|
+
const parsed = safeParse(
|
|
83
|
+
request,
|
|
84
|
+
(value) => z.parse(operations.DeleteVenueRequest$outboundSchema, value),
|
|
85
|
+
"Input validation failed",
|
|
86
|
+
);
|
|
87
|
+
if (!parsed.ok) {
|
|
88
|
+
return [parsed, { status: "invalid" }];
|
|
89
|
+
}
|
|
90
|
+
const payload = parsed.value;
|
|
91
|
+
const body = null;
|
|
92
|
+
|
|
93
|
+
const pathParams = {
|
|
94
|
+
id: encodeSimple("id", payload.id, {
|
|
95
|
+
explode: false,
|
|
96
|
+
charEncoding: "percent",
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
const path = pathToFunc("/api/v1/venues/{id}")(pathParams);
|
|
100
|
+
|
|
101
|
+
const headers = new Headers(compactMap({
|
|
102
|
+
Accept: "application/json",
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
const requestSecurity = resolveSecurity(
|
|
106
|
+
[
|
|
107
|
+
{
|
|
108
|
+
fieldName: "x-api-key",
|
|
109
|
+
type: "apiKey:header",
|
|
110
|
+
value: security?.apiKey,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
[
|
|
114
|
+
{
|
|
115
|
+
fieldName: "Authorization",
|
|
116
|
+
type: "http:bearer",
|
|
117
|
+
value: security?.bearer,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const context = {
|
|
123
|
+
options: client._options,
|
|
124
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
125
|
+
operationID: "deleteVenue",
|
|
126
|
+
oAuth2Scopes: null,
|
|
127
|
+
|
|
128
|
+
resolvedSecurity: requestSecurity,
|
|
129
|
+
|
|
130
|
+
securitySource: security,
|
|
131
|
+
retryConfig: options?.retries
|
|
132
|
+
|| client._options.retryConfig
|
|
133
|
+
|| {
|
|
134
|
+
strategy: "backoff",
|
|
135
|
+
backoff: {
|
|
136
|
+
initialInterval: 500,
|
|
137
|
+
maxInterval: 30000,
|
|
138
|
+
exponent: 1.5,
|
|
139
|
+
maxElapsedTime: 30000,
|
|
140
|
+
},
|
|
141
|
+
retryConnectionErrors: true,
|
|
142
|
+
}
|
|
143
|
+
|| { strategy: "none" },
|
|
144
|
+
retryCodes: options?.retryCodes || ["429", "5XX"],
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const requestRes = client._createRequest(context, {
|
|
148
|
+
security: requestSecurity,
|
|
149
|
+
method: "DELETE",
|
|
150
|
+
baseURL: options?.serverURL,
|
|
151
|
+
path: path,
|
|
152
|
+
headers: headers,
|
|
153
|
+
body: body,
|
|
154
|
+
userAgent: client._options.userAgent,
|
|
155
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
156
|
+
}, options);
|
|
157
|
+
if (!requestRes.ok) {
|
|
158
|
+
return [requestRes, { status: "invalid" }];
|
|
159
|
+
}
|
|
160
|
+
const req = requestRes.value;
|
|
161
|
+
|
|
162
|
+
const doResult = await client._do(req, {
|
|
163
|
+
context,
|
|
164
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
165
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
166
|
+
retryConfig: context.retryConfig,
|
|
167
|
+
retryCodes: context.retryCodes,
|
|
168
|
+
});
|
|
169
|
+
if (!doResult.ok) {
|
|
170
|
+
return [doResult, { status: "request-error", request: req }];
|
|
171
|
+
}
|
|
172
|
+
const response = doResult.value;
|
|
173
|
+
|
|
174
|
+
const responseFields = {
|
|
175
|
+
HttpMeta: { Response: response, Request: req },
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const [result] = await M.match<
|
|
179
|
+
void,
|
|
180
|
+
| errors.ApiError
|
|
181
|
+
| ClientCasaError
|
|
182
|
+
| ResponseValidationError
|
|
183
|
+
| ConnectionError
|
|
184
|
+
| RequestAbortedError
|
|
185
|
+
| RequestTimeoutError
|
|
186
|
+
| InvalidRequestError
|
|
187
|
+
| UnexpectedClientError
|
|
188
|
+
| SDKValidationError
|
|
189
|
+
>(
|
|
190
|
+
M.nil(204, z.void()),
|
|
191
|
+
M.jsonErr([401, 403, 404, 429], errors.ApiError$inboundSchema),
|
|
192
|
+
M.jsonErr(500, errors.ApiError$inboundSchema),
|
|
193
|
+
M.fail("4XX"),
|
|
194
|
+
M.fail("5XX"),
|
|
195
|
+
)(response, req, { extraFields: responseFields });
|
|
196
|
+
if (!result.ok) {
|
|
197
|
+
return [result, { status: "complete", request: req, response }];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return [result, { status: "complete", request: req, response }];
|
|
201
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
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 { encodeSimple } 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 models from "../models/index.js";
|
|
27
|
+
import * as operations from "../models/operations/index.js";
|
|
28
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
29
|
+
import { Result } from "../types/fp.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get a venue
|
|
33
|
+
*/
|
|
34
|
+
export function venuesGet(
|
|
35
|
+
client: ClientCasaCore,
|
|
36
|
+
security: operations.GetVenueSecurity,
|
|
37
|
+
request: operations.GetVenueRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
models.Venue,
|
|
42
|
+
| errors.ApiError
|
|
43
|
+
| ClientCasaError
|
|
44
|
+
| ResponseValidationError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| InvalidRequestError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| SDKValidationError
|
|
51
|
+
>
|
|
52
|
+
> {
|
|
53
|
+
return new APIPromise($do(
|
|
54
|
+
client,
|
|
55
|
+
security,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: ClientCasaCore,
|
|
63
|
+
security: operations.GetVenueSecurity,
|
|
64
|
+
request: operations.GetVenueRequest,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<
|
|
67
|
+
[
|
|
68
|
+
Result<
|
|
69
|
+
models.Venue,
|
|
70
|
+
| errors.ApiError
|
|
71
|
+
| ClientCasaError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) => z.parse(operations.GetVenueRequest$outboundSchema, value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = null;
|
|
93
|
+
|
|
94
|
+
const pathParams = {
|
|
95
|
+
id: encodeSimple("id", payload.id, {
|
|
96
|
+
explode: false,
|
|
97
|
+
charEncoding: "percent",
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
const path = pathToFunc("/api/v1/venues/{id}")(pathParams);
|
|
101
|
+
|
|
102
|
+
const headers = new Headers(compactMap({
|
|
103
|
+
Accept: "application/json",
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
const requestSecurity = resolveSecurity(
|
|
107
|
+
[
|
|
108
|
+
{
|
|
109
|
+
fieldName: "x-api-key",
|
|
110
|
+
type: "apiKey:header",
|
|
111
|
+
value: security?.apiKey,
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
{
|
|
116
|
+
fieldName: "Authorization",
|
|
117
|
+
type: "http:bearer",
|
|
118
|
+
value: security?.bearer,
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
const context = {
|
|
124
|
+
options: client._options,
|
|
125
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
126
|
+
operationID: "getVenue",
|
|
127
|
+
oAuth2Scopes: null,
|
|
128
|
+
|
|
129
|
+
resolvedSecurity: requestSecurity,
|
|
130
|
+
|
|
131
|
+
securitySource: security,
|
|
132
|
+
retryConfig: options?.retries
|
|
133
|
+
|| client._options.retryConfig
|
|
134
|
+
|| {
|
|
135
|
+
strategy: "backoff",
|
|
136
|
+
backoff: {
|
|
137
|
+
initialInterval: 500,
|
|
138
|
+
maxInterval: 30000,
|
|
139
|
+
exponent: 1.5,
|
|
140
|
+
maxElapsedTime: 30000,
|
|
141
|
+
},
|
|
142
|
+
retryConnectionErrors: true,
|
|
143
|
+
}
|
|
144
|
+
|| { strategy: "none" },
|
|
145
|
+
retryCodes: options?.retryCodes || ["429", "5XX"],
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const requestRes = client._createRequest(context, {
|
|
149
|
+
security: requestSecurity,
|
|
150
|
+
method: "GET",
|
|
151
|
+
baseURL: options?.serverURL,
|
|
152
|
+
path: path,
|
|
153
|
+
headers: headers,
|
|
154
|
+
body: body,
|
|
155
|
+
userAgent: client._options.userAgent,
|
|
156
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
157
|
+
}, options);
|
|
158
|
+
if (!requestRes.ok) {
|
|
159
|
+
return [requestRes, { status: "invalid" }];
|
|
160
|
+
}
|
|
161
|
+
const req = requestRes.value;
|
|
162
|
+
|
|
163
|
+
const doResult = await client._do(req, {
|
|
164
|
+
context,
|
|
165
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
166
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
167
|
+
retryConfig: context.retryConfig,
|
|
168
|
+
retryCodes: context.retryCodes,
|
|
169
|
+
});
|
|
170
|
+
if (!doResult.ok) {
|
|
171
|
+
return [doResult, { status: "request-error", request: req }];
|
|
172
|
+
}
|
|
173
|
+
const response = doResult.value;
|
|
174
|
+
|
|
175
|
+
const responseFields = {
|
|
176
|
+
HttpMeta: { Response: response, Request: req },
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
const [result] = await M.match<
|
|
180
|
+
models.Venue,
|
|
181
|
+
| errors.ApiError
|
|
182
|
+
| ClientCasaError
|
|
183
|
+
| ResponseValidationError
|
|
184
|
+
| ConnectionError
|
|
185
|
+
| RequestAbortedError
|
|
186
|
+
| RequestTimeoutError
|
|
187
|
+
| InvalidRequestError
|
|
188
|
+
| UnexpectedClientError
|
|
189
|
+
| SDKValidationError
|
|
190
|
+
>(
|
|
191
|
+
M.json(200, models.Venue$inboundSchema),
|
|
192
|
+
M.jsonErr([401, 403, 404, 429], errors.ApiError$inboundSchema),
|
|
193
|
+
M.jsonErr(500, errors.ApiError$inboundSchema),
|
|
194
|
+
M.fail("4XX"),
|
|
195
|
+
M.fail("5XX"),
|
|
196
|
+
)(response, req, { extraFields: responseFields });
|
|
197
|
+
if (!result.ok) {
|
|
198
|
+
return [result, { status: "complete", request: req, response }];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return [result, { status: "complete", request: req, response }];
|
|
202
|
+
}
|
|
@@ -0,0 +1,272 @@
|
|
|
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 venues
|
|
38
|
+
*/
|
|
39
|
+
export function venuesList(
|
|
40
|
+
client: ClientCasaCore,
|
|
41
|
+
security: operations.ListVenuesSecurity,
|
|
42
|
+
request?: operations.ListVenuesRequest | undefined,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<
|
|
45
|
+
PageIterator<
|
|
46
|
+
Result<
|
|
47
|
+
operations.ListVenuesResponse,
|
|
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.ListVenuesSecurity,
|
|
72
|
+
request?: operations.ListVenuesRequest | undefined,
|
|
73
|
+
options?: RequestOptions,
|
|
74
|
+
): Promise<
|
|
75
|
+
[
|
|
76
|
+
PageIterator<
|
|
77
|
+
Result<
|
|
78
|
+
operations.ListVenuesResponse,
|
|
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.ListVenuesRequest$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/venues")();
|
|
107
|
+
|
|
108
|
+
const query = encodeFormQuery({
|
|
109
|
+
"page": payload?.page,
|
|
110
|
+
"pageSize": payload?.pageSize,
|
|
111
|
+
"status": payload?.status,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const headers = new Headers(compactMap({
|
|
115
|
+
Accept: "application/json",
|
|
116
|
+
}));
|
|
117
|
+
|
|
118
|
+
const requestSecurity = resolveSecurity(
|
|
119
|
+
[
|
|
120
|
+
{
|
|
121
|
+
fieldName: "x-api-key",
|
|
122
|
+
type: "apiKey:header",
|
|
123
|
+
value: security?.apiKey,
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
{
|
|
128
|
+
fieldName: "Authorization",
|
|
129
|
+
type: "http:bearer",
|
|
130
|
+
value: security?.bearer,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
const context = {
|
|
136
|
+
options: client._options,
|
|
137
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
138
|
+
operationID: "listVenues",
|
|
139
|
+
oAuth2Scopes: null,
|
|
140
|
+
|
|
141
|
+
resolvedSecurity: requestSecurity,
|
|
142
|
+
|
|
143
|
+
securitySource: security,
|
|
144
|
+
retryConfig: options?.retries
|
|
145
|
+
|| client._options.retryConfig
|
|
146
|
+
|| {
|
|
147
|
+
strategy: "backoff",
|
|
148
|
+
backoff: {
|
|
149
|
+
initialInterval: 500,
|
|
150
|
+
maxInterval: 30000,
|
|
151
|
+
exponent: 1.5,
|
|
152
|
+
maxElapsedTime: 30000,
|
|
153
|
+
},
|
|
154
|
+
retryConnectionErrors: true,
|
|
155
|
+
}
|
|
156
|
+
|| { strategy: "none" },
|
|
157
|
+
retryCodes: options?.retryCodes || ["429", "5XX"],
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
const requestRes = client._createRequest(context, {
|
|
161
|
+
security: requestSecurity,
|
|
162
|
+
method: "GET",
|
|
163
|
+
baseURL: options?.serverURL,
|
|
164
|
+
path: path,
|
|
165
|
+
headers: headers,
|
|
166
|
+
query: query,
|
|
167
|
+
body: body,
|
|
168
|
+
userAgent: client._options.userAgent,
|
|
169
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
170
|
+
}, options);
|
|
171
|
+
if (!requestRes.ok) {
|
|
172
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
173
|
+
}
|
|
174
|
+
const req = requestRes.value;
|
|
175
|
+
|
|
176
|
+
const doResult = await client._do(req, {
|
|
177
|
+
context,
|
|
178
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
179
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
180
|
+
retryConfig: context.retryConfig,
|
|
181
|
+
retryCodes: context.retryCodes,
|
|
182
|
+
});
|
|
183
|
+
if (!doResult.ok) {
|
|
184
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
185
|
+
}
|
|
186
|
+
const response = doResult.value;
|
|
187
|
+
|
|
188
|
+
const responseFields = {
|
|
189
|
+
HttpMeta: { Response: response, Request: req },
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const [result, raw] = await M.match<
|
|
193
|
+
operations.ListVenuesResponse,
|
|
194
|
+
| errors.ApiError
|
|
195
|
+
| ClientCasaError
|
|
196
|
+
| ResponseValidationError
|
|
197
|
+
| ConnectionError
|
|
198
|
+
| RequestAbortedError
|
|
199
|
+
| RequestTimeoutError
|
|
200
|
+
| InvalidRequestError
|
|
201
|
+
| UnexpectedClientError
|
|
202
|
+
| SDKValidationError
|
|
203
|
+
>(
|
|
204
|
+
M.json(200, operations.ListVenuesResponse$inboundSchema, { key: "Result" }),
|
|
205
|
+
M.jsonErr([400, 401, 403, 429], errors.ApiError$inboundSchema),
|
|
206
|
+
M.jsonErr(500, errors.ApiError$inboundSchema),
|
|
207
|
+
M.fail("4XX"),
|
|
208
|
+
M.fail("5XX"),
|
|
209
|
+
)(response, req, { extraFields: responseFields });
|
|
210
|
+
if (!result.ok) {
|
|
211
|
+
return [haltIterator(result), {
|
|
212
|
+
status: "complete",
|
|
213
|
+
request: req,
|
|
214
|
+
response,
|
|
215
|
+
}];
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const nextFunc = (
|
|
219
|
+
responseData: unknown,
|
|
220
|
+
): {
|
|
221
|
+
next: Paginator<
|
|
222
|
+
Result<
|
|
223
|
+
operations.ListVenuesResponse,
|
|
224
|
+
| errors.ApiError
|
|
225
|
+
| ClientCasaError
|
|
226
|
+
| ResponseValidationError
|
|
227
|
+
| ConnectionError
|
|
228
|
+
| RequestAbortedError
|
|
229
|
+
| RequestTimeoutError
|
|
230
|
+
| InvalidRequestError
|
|
231
|
+
| UnexpectedClientError
|
|
232
|
+
| SDKValidationError
|
|
233
|
+
>
|
|
234
|
+
>;
|
|
235
|
+
"~next"?: { page: number };
|
|
236
|
+
} => {
|
|
237
|
+
const page = request?.page ?? 1;
|
|
238
|
+
const nextPage = page + 1;
|
|
239
|
+
|
|
240
|
+
if (!responseData) {
|
|
241
|
+
return { next: () => null };
|
|
242
|
+
}
|
|
243
|
+
const results = (responseData as { data: unknown }).data;
|
|
244
|
+
if (!Array.isArray(results) || !results.length) {
|
|
245
|
+
return { next: () => null };
|
|
246
|
+
}
|
|
247
|
+
const limit = request?.pageSize ?? 25;
|
|
248
|
+
if (results.length < limit) {
|
|
249
|
+
return { next: () => null };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const nextVal = () =>
|
|
253
|
+
venuesList(
|
|
254
|
+
client,
|
|
255
|
+
security,
|
|
256
|
+
{
|
|
257
|
+
...request!,
|
|
258
|
+
page: nextPage,
|
|
259
|
+
},
|
|
260
|
+
options,
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
return { next: nextVal, "~next": { page: nextPage } };
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
267
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
268
|
+
status: "complete",
|
|
269
|
+
request: req,
|
|
270
|
+
response,
|
|
271
|
+
}];
|
|
272
|
+
}
|