Skip to content

Commit

Permalink
add documentation ignore to healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
tatarco committed Jan 17, 2025
1 parent 4d083ec commit 66a5935
Show file tree
Hide file tree
Showing 3 changed files with 526 additions and 0 deletions.
183 changes: 183 additions & 0 deletions src/funcs/generateRandomNumber.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/

import { NovuCore } from "../core.js";
import { encodeSimple } from "../lib/encodings.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { RequestOptions } from "../lib/sdks.js";
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
import { pathToFunc } from "../lib/url.js";
import {
ConnectionError,
InvalidRequestError,
RequestAbortedError,
RequestTimeoutError,
UnexpectedClientError,
} from "../models/errors/httpclienterrors.js";
import * as errors from "../models/errors/index.js";
import { SDKError } from "../models/errors/sdkerror.js";
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
import * as operations from "../models/operations/index.js";
import { Result } from "../types/fp.js";

export async function generateRandomNumber(
client: NovuCore,
idempotencyKey?: string | undefined,
options?: RequestOptions,
): Promise<
Result<
operations.HealthControllerGenerateRandomNumberResponse,
| errors.ErrorDto
| errors.ErrorDto
| errors.ValidationErrorDto
| errors.ErrorDto
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>
> {
const input: operations.HealthControllerGenerateRandomNumberRequest = {
idempotencyKey: idempotencyKey,
};

const parsed = safeParse(
input,
(value) =>
operations.HealthControllerGenerateRandomNumberRequest$outboundSchema
.parse(value),
"Input validation failed",
);
if (!parsed.ok) {
return parsed;
}
const payload = parsed.value;
const body = null;

const path = pathToFunc("/v1/health-check/test-idempotency")();

const headers = new Headers(compactMap({
Accept: "application/json",
"idempotency-key": encodeSimple(
"idempotency-key",
payload["idempotency-key"],
{ explode: false, charEncoding: "none" },
),
}));

const secConfig = await extractSecurity(client._options.apiKey);
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
const requestSecurity = resolveGlobalSecurity(securityInput);

const context = {
operationID: "HealthController_generateRandomNumber",
oAuth2Scopes: [],

resolvedSecurity: requestSecurity,

securitySource: client._options.apiKey,
retryConfig: options?.retries
|| client._options.retryConfig
|| {
strategy: "backoff",
backoff: {
initialInterval: 1000,
maxInterval: 30000,
exponent: 1.5,
maxElapsedTime: 3600000,
},
retryConnectionErrors: true,
}
|| { strategy: "none" },
retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
};

const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
}, options);
if (!requestRes.ok) {
return requestRes;
}
const req = requestRes.value;

const doResult = await client._do(req, {
context,
errorCodes: [
"400",
"401",
"403",
"404",
"405",
"409",
"413",
"414",
"415",
"422",
"429",
"4XX",
"500",
"503",
"5XX",
],
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});
if (!doResult.ok) {
return doResult;
}
const response = doResult.value;

const responseFields = {
HttpMeta: { Response: response, Request: req },
};

const [result] = await M.match<
operations.HealthControllerGenerateRandomNumberResponse,
| errors.ErrorDto
| errors.ErrorDto
| errors.ValidationErrorDto
| errors.ErrorDto
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>(
M.json(
201,
operations.HealthControllerGenerateRandomNumberResponse$inboundSchema,
{ hdrs: true, key: "Result" },
),
M.jsonErr(
[400, 401, 403, 404, 405, 409, 413, 415],
errors.ErrorDto$inboundSchema,
{ hdrs: true },
),
M.jsonErr(414, errors.ErrorDto$inboundSchema),
M.jsonErr(422, errors.ValidationErrorDto$inboundSchema, { hdrs: true }),
M.fail(429),
M.jsonErr(500, errors.ErrorDto$inboundSchema, { hdrs: true }),
M.fail(503),
M.fail("4XX"),
M.fail("5XX"),
)(response, { extraFields: responseFields });
if (!result.ok) {
return result;
}

return result;
}
153 changes: 153 additions & 0 deletions src/funcs/healthControllerHealthCheck.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/

import { NovuCore } from "../core.js";
import { encodeSimple } from "../lib/encodings.js";
import * as M from "../lib/matchers.js";
import { compactMap } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { RequestOptions } from "../lib/sdks.js";
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
import { pathToFunc } from "../lib/url.js";
import {
ConnectionError,
InvalidRequestError,
RequestAbortedError,
RequestTimeoutError,
UnexpectedClientError,
} from "../models/errors/httpclienterrors.js";
import * as errors from "../models/errors/index.js";
import { SDKError } from "../models/errors/sdkerror.js";
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
import * as operations from "../models/operations/index.js";
import { Result } from "../types/fp.js";

export async function healthControllerHealthCheck(
client: NovuCore,
idempotencyKey?: string | undefined,
options?: RequestOptions,
): Promise<
Result<
operations.HealthControllerHealthCheckResponseBody,
| errors.HealthControllerHealthCheckResponseBody
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>
> {
const input: operations.HealthControllerHealthCheckRequest = {
idempotencyKey: idempotencyKey,
};

const parsed = safeParse(
input,
(value) =>
operations.HealthControllerHealthCheckRequest$outboundSchema.parse(value),
"Input validation failed",
);
if (!parsed.ok) {
return parsed;
}
const payload = parsed.value;
const body = null;

const path = pathToFunc("/v1/health-check")();

const headers = new Headers(compactMap({
Accept: "application/json",
"idempotency-key": encodeSimple(
"idempotency-key",
payload["idempotency-key"],
{ explode: false, charEncoding: "none" },
),
}));

const secConfig = await extractSecurity(client._options.apiKey);
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
const requestSecurity = resolveGlobalSecurity(securityInput);

const context = {
operationID: "HealthController_healthCheck",
oAuth2Scopes: [],

resolvedSecurity: requestSecurity,

securitySource: client._options.apiKey,
retryConfig: options?.retries
|| client._options.retryConfig
|| {
strategy: "backoff",
backoff: {
initialInterval: 1000,
maxInterval: 30000,
exponent: 1.5,
maxElapsedTime: 3600000,
},
retryConnectionErrors: true,
}
|| { strategy: "none" },
retryCodes: options?.retryCodes || ["408", "409", "429", "5XX"],
};

const requestRes = client._createRequest(context, {
security: requestSecurity,
method: "GET",
baseURL: options?.serverURL,
path: path,
headers: headers,
body: body,
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
}, options);
if (!requestRes.ok) {
return requestRes;
}
const req = requestRes.value;

const doResult = await client._do(req, {
context,
errorCodes: ["4XX", "503", "5XX"],
retryConfig: context.retryConfig,
retryCodes: context.retryCodes,
});
if (!doResult.ok) {
return doResult;
}
const response = doResult.value;

const responseFields = {
HttpMeta: { Response: response, Request: req },
};

const [result] = await M.match<
operations.HealthControllerHealthCheckResponseBody,
| errors.HealthControllerHealthCheckResponseBody
| SDKError
| SDKValidationError
| UnexpectedClientError
| InvalidRequestError
| RequestAbortedError
| RequestTimeoutError
| ConnectionError
>(
M.json(
200,
operations.HealthControllerHealthCheckResponseBody$inboundSchema,
),
M.jsonErr(
503,
errors.HealthControllerHealthCheckResponseBody$inboundSchema,
),
M.fail("4XX"),
M.fail("5XX"),
)(response, { extraFields: responseFields });
if (!result.ok) {
return result;
}

return result;
}
Loading

0 comments on commit 66a5935

Please sign in to comment.