mirror of
https://github.com/LukeHagar/plexjs.git
synced 2025-12-07 20:47:49 +00:00
ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.193.0
This commit is contained in:
68
src/hooks/types.ts
Normal file
68
src/hooks/types.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
import { HTTPClient } from "../lib/http";
|
||||
|
||||
export type HookContext = {
|
||||
operationID: string;
|
||||
};
|
||||
|
||||
export type Awaitable<T> = T | Promise<T>;
|
||||
|
||||
export type BeforeRequestContext = HookContext & {};
|
||||
export type AfterSuccessContext = HookContext & {};
|
||||
export type AfterErrorContext = HookContext & {};
|
||||
|
||||
/**
|
||||
* ClientInitHook is called when the SDK is initializing the HTTP client. The
|
||||
* hook can return a new HTTP client to be used by the SDK.
|
||||
*/
|
||||
export interface ClientInitHook {
|
||||
clientInit: (client: HTTPClient) => HTTPClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* BeforeRequestHook is called before the SDK sends a request. The hook can
|
||||
* modify the request before it is sent or throw an error to stop the request
|
||||
* from being sent.
|
||||
*/
|
||||
export interface BeforeRequestHook {
|
||||
beforeRequest: (hookCtx: BeforeRequestContext, request: Request) => Awaitable<Request>;
|
||||
}
|
||||
|
||||
/**
|
||||
* AfterSuccessHook is called after the SDK receives a response. The hook can
|
||||
* modify the response before it is handled or throw an error to stop the
|
||||
* response from being handled.
|
||||
*/
|
||||
export interface AfterSuccessHook {
|
||||
afterSuccess: (hookCtx: AfterSuccessContext, response: Response) => Awaitable<Response>;
|
||||
}
|
||||
|
||||
/**
|
||||
* AfterErrorHook is called after the SDK encounters an error, or a
|
||||
* non-successful response. The hook can modify the response if available
|
||||
* otherwise modify the error.
|
||||
*/
|
||||
export interface AfterErrorHook {
|
||||
afterError: (
|
||||
hookCtx: AfterErrorContext,
|
||||
response: Response | null,
|
||||
error: unknown
|
||||
) => Awaitable<{
|
||||
response: Response | null;
|
||||
error: unknown;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface Hooks {
|
||||
/** Registers a hook to be used by the SDK for client initialization. */
|
||||
registerClientInitHook(hook: ClientInitHook): void;
|
||||
/** Registers a hook to be used by the SDK for the before request event. */
|
||||
registerBeforeRequestHook(hook: BeforeRequestHook): void;
|
||||
/** Registers a hook to be used by the SDK for the after success event. */
|
||||
registerAfterSuccessHook(hook: AfterSuccessHook): void;
|
||||
/** Registers a hook to be used by the SDK for the after error event. */
|
||||
registerAfterErrorHook(hook: AfterErrorHook): void;
|
||||
}
|
||||
Reference in New Issue
Block a user