mirror of
https://github.com/LukeHagar/discoursejs.git
synced 2025-12-11 04:19:48 +00:00
ci: regenerated with OpenAPI Doc latest, Speakeasy CLI 1.394.0
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
import * as z from "zod";
|
||||
import { SDKCore } from "../core.js";
|
||||
import { encodeSimple as encodeSimple$ } from "../lib/encodings.js";
|
||||
import * as m$ from "../lib/matchers.js";
|
||||
@@ -9,104 +10,109 @@ 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";
|
||||
import * as operations from "../sdk/models/operations/index.js";
|
||||
import { Result } from "../sdk/types/fp.js";
|
||||
import * as z from "zod";
|
||||
|
||||
/**
|
||||
* List replies to a post
|
||||
*/
|
||||
export async function postsPostReplies(
|
||||
client$: SDKCore,
|
||||
id: string,
|
||||
options?: RequestOptions
|
||||
client$: SDKCore,
|
||||
id: string,
|
||||
options?: RequestOptions,
|
||||
): Promise<
|
||||
Result<
|
||||
Array<operations.PostRepliesResponseBody>,
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>
|
||||
Result<
|
||||
Array<operations.PostRepliesResponseBody>,
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>
|
||||
> {
|
||||
const input$: operations.PostRepliesRequest = {
|
||||
id: id,
|
||||
};
|
||||
const input$: operations.PostRepliesRequest = {
|
||||
id: id,
|
||||
};
|
||||
|
||||
const parsed$ = schemas$.safeParse(
|
||||
input$,
|
||||
(value$) => operations.PostRepliesRequest$outboundSchema.parse(value$),
|
||||
"Input validation failed"
|
||||
);
|
||||
if (!parsed$.ok) {
|
||||
return parsed$;
|
||||
}
|
||||
const payload$ = parsed$.value;
|
||||
const body$ = null;
|
||||
const parsed$ = schemas$.safeParse(
|
||||
input$,
|
||||
(value$) => operations.PostRepliesRequest$outboundSchema.parse(value$),
|
||||
"Input validation failed",
|
||||
);
|
||||
if (!parsed$.ok) {
|
||||
return parsed$;
|
||||
}
|
||||
const payload$ = parsed$.value;
|
||||
const body$ = null;
|
||||
|
||||
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}/replies.json")(pathParams$);
|
||||
const path$ = pathToFunc("/posts/{id}/replies.json")(pathParams$);
|
||||
|
||||
const headers$ = new Headers({
|
||||
Accept: "application/json",
|
||||
});
|
||||
const headers$ = new Headers({
|
||||
Accept: "application/json",
|
||||
});
|
||||
|
||||
const context = { operationID: "postReplies", oAuth2Scopes: [], securitySource: null };
|
||||
const context = {
|
||||
operationID: "postReplies",
|
||||
oAuth2Scopes: [],
|
||||
securitySource: null,
|
||||
};
|
||||
|
||||
const requestRes = client$.createRequest$(
|
||||
context,
|
||||
{
|
||||
method: "GET",
|
||||
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: "GET",
|
||||
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<
|
||||
Array<operations.PostRepliesResponseBody>,
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>(m$.json(200, z.array(operations.PostRepliesResponseBody$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<
|
||||
Array<operations.PostRepliesResponseBody>,
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>(
|
||||
m$.json(200, z.array(operations.PostRepliesResponseBody$inboundSchema)),
|
||||
)(response);
|
||||
if (!result$.ok) {
|
||||
return result$;
|
||||
}
|
||||
|
||||
return result$;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user