mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 04:20:46 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.394.0
This commit is contained in:
@@ -10,11 +10,11 @@ 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,
|
||||
ConnectionError,
|
||||
InvalidRequestError,
|
||||
RequestAbortedError,
|
||||
RequestTimeoutError,
|
||||
UnexpectedClientError,
|
||||
} from "../sdk/models/errors/httpclienterrors.js";
|
||||
import * as errors from "../sdk/models/errors/index.js";
|
||||
import { SDKError } from "../sdk/models/errors/sdkerror.js";
|
||||
@@ -29,113 +29,114 @@ import { Result } from "../sdk/types/fp.js";
|
||||
* This will return the bandwidth statistics for the server
|
||||
*/
|
||||
export async function statisticsGetBandwidthStatistics(
|
||||
client$: PlexAPICore,
|
||||
timespan?: number | undefined,
|
||||
options?: RequestOptions
|
||||
client$: PlexAPICore,
|
||||
timespan?: number | undefined,
|
||||
options?: RequestOptions,
|
||||
): Promise<
|
||||
Result<
|
||||
operations.GetBandwidthStatisticsResponse,
|
||||
| errors.GetBandwidthStatisticsResponseBody
|
||||
| errors.GetBandwidthStatisticsStatisticsResponseBody
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>
|
||||
Result<
|
||||
operations.GetBandwidthStatisticsResponse,
|
||||
| errors.GetBandwidthStatisticsBadRequest
|
||||
| errors.GetBandwidthStatisticsUnauthorized
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>
|
||||
> {
|
||||
const input$: operations.GetBandwidthStatisticsRequest = {
|
||||
timespan: timespan,
|
||||
};
|
||||
const input$: operations.GetBandwidthStatisticsRequest = {
|
||||
timespan: timespan,
|
||||
};
|
||||
|
||||
const parsed$ = schemas$.safeParse(
|
||||
input$,
|
||||
(value$) => operations.GetBandwidthStatisticsRequest$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.GetBandwidthStatisticsRequest$outboundSchema.parse(value$),
|
||||
"Input validation failed",
|
||||
);
|
||||
if (!parsed$.ok) {
|
||||
return parsed$;
|
||||
}
|
||||
const payload$ = parsed$.value;
|
||||
const body$ = null;
|
||||
|
||||
const path$ = pathToFunc("/statistics/bandwidth")();
|
||||
const path$ = pathToFunc("/statistics/bandwidth")();
|
||||
|
||||
const query$ = encodeFormQuery$({
|
||||
Timespan: payload$.Timespan,
|
||||
});
|
||||
const query$ = encodeFormQuery$({
|
||||
"Timespan": payload$.Timespan,
|
||||
});
|
||||
|
||||
const headers$ = new Headers({
|
||||
Accept: "application/json",
|
||||
});
|
||||
const headers$ = new Headers({
|
||||
Accept: "application/json",
|
||||
});
|
||||
|
||||
const accessToken$ = await extractSecurity(client$.options$.accessToken);
|
||||
const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ };
|
||||
const context = {
|
||||
operationID: "getBandwidthStatistics",
|
||||
oAuth2Scopes: [],
|
||||
securitySource: client$.options$.accessToken,
|
||||
};
|
||||
const securitySettings$ = resolveGlobalSecurity(security$);
|
||||
const accessToken$ = await extractSecurity(client$.options$.accessToken);
|
||||
const security$ = accessToken$ == null ? {} : { accessToken: accessToken$ };
|
||||
const context = {
|
||||
operationID: "getBandwidthStatistics",
|
||||
oAuth2Scopes: [],
|
||||
securitySource: client$.options$.accessToken,
|
||||
};
|
||||
const securitySettings$ = resolveGlobalSecurity(security$);
|
||||
|
||||
const requestRes = client$.createRequest$(
|
||||
context,
|
||||
{
|
||||
security: securitySettings$,
|
||||
method: "GET",
|
||||
path: path$,
|
||||
headers: headers$,
|
||||
query: query$,
|
||||
body: body$,
|
||||
timeoutMs: options?.timeoutMs || client$.options$.timeoutMs || -1,
|
||||
},
|
||||
options
|
||||
);
|
||||
if (!requestRes.ok) {
|
||||
return requestRes;
|
||||
}
|
||||
const request$ = requestRes.value;
|
||||
const requestRes = client$.createRequest$(context, {
|
||||
security: securitySettings$,
|
||||
method: "GET",
|
||||
path: path$,
|
||||
headers: headers$,
|
||||
query: query$,
|
||||
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: ["400", "401", "4XX", "5XX"],
|
||||
retryConfig: options?.retries || client$.options$.retryConfig,
|
||||
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
||||
});
|
||||
if (!doResult.ok) {
|
||||
return doResult;
|
||||
}
|
||||
const response = doResult.value;
|
||||
const doResult = await client$.do$(request$, {
|
||||
context,
|
||||
errorCodes: ["400", "401", "4XX", "5XX"],
|
||||
retryConfig: options?.retries
|
||||
|| client$.options$.retryConfig,
|
||||
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
||||
});
|
||||
if (!doResult.ok) {
|
||||
return doResult;
|
||||
}
|
||||
const response = doResult.value;
|
||||
|
||||
const responseFields$ = {
|
||||
ContentType: response.headers.get("content-type") ?? "application/octet-stream",
|
||||
StatusCode: response.status,
|
||||
RawResponse: response,
|
||||
Headers: {},
|
||||
};
|
||||
|
||||
const [result$] = await m$.match<
|
||||
operations.GetBandwidthStatisticsResponse,
|
||||
| errors.GetBandwidthStatisticsResponseBody
|
||||
| errors.GetBandwidthStatisticsStatisticsResponseBody
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>(
|
||||
m$.json(200, operations.GetBandwidthStatisticsResponse$inboundSchema, { key: "object" }),
|
||||
m$.jsonErr(400, errors.GetBandwidthStatisticsResponseBody$inboundSchema),
|
||||
m$.jsonErr(401, errors.GetBandwidthStatisticsStatisticsResponseBody$inboundSchema),
|
||||
m$.fail(["4XX", "5XX"])
|
||||
)(response, { extraFields: responseFields$ });
|
||||
if (!result$.ok) {
|
||||
return result$;
|
||||
}
|
||||
const responseFields$ = {
|
||||
ContentType: response.headers.get("content-type")
|
||||
?? "application/octet-stream",
|
||||
StatusCode: response.status,
|
||||
RawResponse: response,
|
||||
Headers: {},
|
||||
};
|
||||
|
||||
const [result$] = await m$.match<
|
||||
operations.GetBandwidthStatisticsResponse,
|
||||
| errors.GetBandwidthStatisticsBadRequest
|
||||
| errors.GetBandwidthStatisticsUnauthorized
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>(
|
||||
m$.json(200, operations.GetBandwidthStatisticsResponse$inboundSchema, {
|
||||
key: "object",
|
||||
}),
|
||||
m$.jsonErr(400, errors.GetBandwidthStatisticsBadRequest$inboundSchema),
|
||||
m$.jsonErr(401, errors.GetBandwidthStatisticsUnauthorized$inboundSchema),
|
||||
m$.fail(["4XX", "5XX"]),
|
||||
)(response, { extraFields: responseFields$ });
|
||||
if (!result$.ok) {
|
||||
return result$;
|
||||
}
|
||||
|
||||
return result$;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user