mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-06 12:37: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,115 +29,113 @@ import { Result } from "../sdk/types/fp.js";
|
||||
* Delete a library using a specific section id
|
||||
*/
|
||||
export async function libraryDeleteLibrary(
|
||||
client$: PlexAPICore,
|
||||
sectionKey: number,
|
||||
options?: RequestOptions
|
||||
client$: PlexAPICore,
|
||||
sectionKey: number,
|
||||
options?: RequestOptions,
|
||||
): Promise<
|
||||
Result<
|
||||
operations.DeleteLibraryResponse,
|
||||
| errors.DeleteLibraryResponseBody
|
||||
| errors.DeleteLibraryLibraryResponseBody
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>
|
||||
Result<
|
||||
operations.DeleteLibraryResponse,
|
||||
| errors.DeleteLibraryBadRequest
|
||||
| errors.DeleteLibraryUnauthorized
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>
|
||||
> {
|
||||
const input$: operations.DeleteLibraryRequest = {
|
||||
sectionKey: sectionKey,
|
||||
};
|
||||
const input$: operations.DeleteLibraryRequest = {
|
||||
sectionKey: sectionKey,
|
||||
};
|
||||
|
||||
const parsed$ = schemas$.safeParse(
|
||||
input$,
|
||||
(value$) => operations.DeleteLibraryRequest$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.DeleteLibraryRequest$outboundSchema.parse(value$),
|
||||
"Input validation failed",
|
||||
);
|
||||
if (!parsed$.ok) {
|
||||
return parsed$;
|
||||
}
|
||||
const payload$ = parsed$.value;
|
||||
const body$ = null;
|
||||
|
||||
const pathParams$ = {
|
||||
sectionKey: encodeSimple$("sectionKey", payload$.sectionKey, {
|
||||
explode: false,
|
||||
charEncoding: "percent",
|
||||
}),
|
||||
};
|
||||
const pathParams$ = {
|
||||
sectionKey: encodeSimple$("sectionKey", payload$.sectionKey, {
|
||||
explode: false,
|
||||
charEncoding: "percent",
|
||||
}),
|
||||
};
|
||||
|
||||
const path$ = pathToFunc("/library/sections/{sectionKey}")(pathParams$);
|
||||
const path$ = pathToFunc("/library/sections/{sectionKey}")(pathParams$);
|
||||
|
||||
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: "deleteLibrary",
|
||||
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: "deleteLibrary",
|
||||
oAuth2Scopes: [],
|
||||
securitySource: client$.options$.accessToken,
|
||||
};
|
||||
const securitySettings$ = resolveGlobalSecurity(security$);
|
||||
|
||||
const requestRes = client$.createRequest$(
|
||||
context,
|
||||
{
|
||||
security: securitySettings$,
|
||||
method: "DELETE",
|
||||
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, {
|
||||
security: securitySettings$,
|
||||
method: "DELETE",
|
||||
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: ["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.DeleteLibraryResponse,
|
||||
| errors.DeleteLibraryResponseBody
|
||||
| errors.DeleteLibraryLibraryResponseBody
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>(
|
||||
m$.nil(200, operations.DeleteLibraryResponse$inboundSchema),
|
||||
m$.jsonErr(400, errors.DeleteLibraryResponseBody$inboundSchema),
|
||||
m$.jsonErr(401, errors.DeleteLibraryLibraryResponseBody$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.DeleteLibraryResponse,
|
||||
| errors.DeleteLibraryBadRequest
|
||||
| errors.DeleteLibraryUnauthorized
|
||||
| SDKError
|
||||
| SDKValidationError
|
||||
| UnexpectedClientError
|
||||
| InvalidRequestError
|
||||
| RequestAbortedError
|
||||
| RequestTimeoutError
|
||||
| ConnectionError
|
||||
>(
|
||||
m$.nil(200, operations.DeleteLibraryResponse$inboundSchema),
|
||||
m$.jsonErr(400, errors.DeleteLibraryBadRequest$inboundSchema),
|
||||
m$.jsonErr(401, errors.DeleteLibraryUnauthorized$inboundSchema),
|
||||
m$.fail(["4XX", "5XX"]),
|
||||
)(response, { extraFields: responseFields$ });
|
||||
if (!result$.ok) {
|
||||
return result$;
|
||||
}
|
||||
|
||||
return result$;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user