ci: regenerated with OpenAPI Doc latest, Speakeasy CLI 1.394.0

This commit is contained in:
speakeasybot
2024-09-10 00:24:56 +00:00
parent 7c0e1dc7ef
commit d287d140e9
481 changed files with 38528 additions and 37165 deletions

View File

@@ -3,17 +3,20 @@
*/
import { SDKCore } from "../core.js";
import { encodeJSON as encodeJSON$, encodeSimple as encodeSimple$ } from "../lib/encodings.js";
import {
encodeJSON as encodeJSON$,
encodeSimple as encodeSimple$,
} from "../lib/encodings.js";
import * as m$ from "../lib/matchers.js";
import * as schemas$ from "../lib/schemas.js";
import { RequestOptions } from "../lib/sdks.js";
import { pathToFunc } from "../lib/url.js";
import {
ConnectionError,
InvalidRequestError,
RequestAbortedError,
RequestTimeoutError,
UnexpectedClientError,
ConnectionError,
InvalidRequestError,
RequestAbortedError,
RequestTimeoutError,
UnexpectedClientError,
} from "../sdk/models/errors/httpclienterrors.js";
import { SDKError } from "../sdk/models/errors/sdkerror.js";
import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js";
@@ -24,103 +27,109 @@ import { Result } from "../sdk/types/fp.js";
* Lock a post from being edited
*/
export async function postsLockPost(
client$: SDKCore,
apiKey: string,
apiUsername: string,
id: string,
requestBody?: operations.LockPostRequestBody | undefined,
options?: RequestOptions
client$: SDKCore,
apiKey: string,
apiUsername: string,
id: string,
requestBody?: operations.LockPostRequestBody | undefined,
options?: RequestOptions,
): Promise<
Result<
operations.LockPostResponseBody,
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>
Result<
operations.LockPostResponseBody,
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>
> {
const input$: operations.LockPostRequest = {
apiKey: apiKey,
apiUsername: apiUsername,
requestBody: requestBody,
id: id,
};
const input$: operations.LockPostRequest = {
apiKey: apiKey,
apiUsername: apiUsername,
requestBody: requestBody,
id: id,
};
const parsed$ = schemas$.safeParse(
input$,
(value$) => operations.LockPostRequest$outboundSchema.parse(value$),
"Input validation failed"
);
if (!parsed$.ok) {
return parsed$;
}
const payload$ = parsed$.value;
const body$ = encodeJSON$("body", payload$.RequestBody, { explode: true });
const parsed$ = schemas$.safeParse(
input$,
(value$) => operations.LockPostRequest$outboundSchema.parse(value$),
"Input validation failed",
);
if (!parsed$.ok) {
return parsed$;
}
const payload$ = parsed$.value;
const body$ = encodeJSON$("body", payload$.RequestBody, { explode: true });
const pathParams$ = {
id: encodeSimple$("id", payload$.id, { explode: false, charEncoding: "percent" }),
};
const pathParams$ = {
id: encodeSimple$("id", payload$.id, {
explode: false,
charEncoding: "percent",
}),
};
const path$ = pathToFunc("/posts/{id}/locked.json")(pathParams$);
const path$ = pathToFunc("/posts/{id}/locked.json")(pathParams$);
const headers$ = new Headers({
"Content-Type": "application/json",
Accept: "application/json",
"Api-Key": encodeSimple$("Api-Key", payload$["Api-Key"], {
explode: false,
charEncoding: "none",
}),
"Api-Username": encodeSimple$("Api-Username", payload$["Api-Username"], {
explode: false,
charEncoding: "none",
}),
});
const headers$ = new Headers({
"Content-Type": "application/json",
Accept: "application/json",
"Api-Key": encodeSimple$("Api-Key", payload$["Api-Key"], {
explode: false,
charEncoding: "none",
}),
"Api-Username": encodeSimple$("Api-Username", payload$["Api-Username"], {
explode: false,
charEncoding: "none",
}),
});
const context = { operationID: "lockPost", oAuth2Scopes: [], securitySource: null };
const context = {
operationID: "lockPost",
oAuth2Scopes: [],
securitySource: null,
};
const requestRes = client$.createRequest$(
context,
{
method: "PUT",
path: path$,
headers: headers$,
body: body$,
timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1,
},
options
);
if (!requestRes.ok) {
return requestRes;
}
const request$ = requestRes.value;
const requestRes = client$.createRequest$(context, {
method: "PUT",
path: path$,
headers: headers$,
body: body$,
timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1,
}, options);
if (!requestRes.ok) {
return requestRes;
}
const request$ = requestRes.value;
const doResult = await client$.do$(request$, {
context,
errorCodes: [],
retryConfig: options?.retries || client$.options$.retryConfig,
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
});
if (!doResult.ok) {
return doResult;
}
const response = doResult.value;
const [result$] = await m$.match<
operations.LockPostResponseBody,
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>(m$.json(200, operations.LockPostResponseBody$inboundSchema))(response);
if (!result$.ok) {
return result$;
}
const doResult = await client$.do$(request$, {
context,
errorCodes: [],
retryConfig: options?.retries
|| client$.options$.retryConfig,
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
});
if (!doResult.ok) {
return doResult;
}
const response = doResult.value;
const [result$] = await m$.match<
operations.LockPostResponseBody,
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>(
m$.json(200, operations.LockPostResponseBody$inboundSchema),
)(response);
if (!result$.ok) {
return result$;
}
return result$;
}