ci: regenerated with OpenAPI Doc latest, Speakeasy CLI 1.358.0

This commit is contained in:
speakeasybot
2024-08-09 00:23:51 +00:00
parent f8daadbbe9
commit b93bf162b8
395 changed files with 44768 additions and 26373 deletions

126
src/funcs/postsLockPost.ts Normal file
View File

@@ -0,0 +1,126 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import { SDKCore } from "../core.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,
} from "../sdk/models/errors/httpclienterrors.js";
import { SDKError } from "../sdk/models/errors/sdkerror.js";
import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js";
import * as operations from "../sdk/models/operations/index.js";
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
): Promise<
Result<
operations.LockPostResponseBody,
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>
> {
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 pathParams$ = {
id: encodeSimple$("id", payload$.id, { explode: false, charEncoding: "percent" }),
};
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 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 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$;
}