slack-edge
Version:
Slack app development framework for edge functions with streamlined TypeScript support
103 lines • 2.89 kB
TypeScript
import { AuthTestResponse, OAuthV2AccessResponse } from "slack-web-api-client";
import { OAuthErrorCode } from "./error-codes";
import { Installation } from "./installation";
import { OAuthCompletionPageRenderer, OAuthErrorPageRenderer, OAuthStartPageRenderer } from "./oauth-page-renderer";
import { LoggingEnv } from "../app-env";
/**
* beforeInstallation args
*/
export interface BeforeInstallationArgs {
env: LoggingEnv;
request: Request;
}
/**
* beforeInstallation hook
*/
export type BeforeInstallation = (args: BeforeInstallationArgs) => Promise<Response | undefined | void>;
/**
* afterInstallation args
*/
export interface AfterInstallationArgs {
env: LoggingEnv;
installation: Installation;
request: Request;
}
/**
* afterInstallation hook
*/
export type AfterInstallation = (args: AfterInstallationArgs) => Promise<Response | undefined | void>;
/**
* onStateValidationError args
*/
export interface OnStateValidationErrorArgs {
env: LoggingEnv;
startPath: string;
request: Request;
}
/**
* onStateValidationError hook
*/
export type OnStateValidationError = (args: OnStateValidationErrorArgs) => Promise<Response>;
/**
* The default onStateValidationError implementation.
*/
export declare function defaultOnStateValidationError(renderer?: OAuthErrorPageRenderer): OnStateValidationError;
/**
* onFailure args
*/
export interface OnFailureArgs {
env: LoggingEnv;
startPath: string;
reason: OAuthErrorCode;
request: Request;
}
/**
* onFailure hook
*/
export type OnFailure = (args: OnFailureArgs) => Promise<Response>;
/**
* The default onFailure implementation.
* @param startPath the path to start the OAuth flow again
* @param reason the error reason code
* @returns response
*/
export declare function defaultOnFailure(renderer?: OAuthErrorPageRenderer): OnFailure;
/**
* OAuthStart args
*/
export interface OAuthStartArgs {
env: LoggingEnv;
authorizeUrl: string;
stateCookieName: string;
stateValue: string;
request: Request;
}
/**
* OAuthStart hook
*/
export type OAuthStart = (args: OAuthStartArgs) => Promise<Response>;
/**
* The default OAuthStart implementation.
*/
export declare function defaultOAuthStart(startImmediateRedirect?: boolean, renderer?: OAuthStartPageRenderer): OAuthStart;
/**
* OAuthCallback args
*/
export interface OAuthCallbackArgs {
env: LoggingEnv;
oauthAccess: OAuthV2AccessResponse;
enterpriseUrl: string | undefined;
stateCookieName: string;
request: Request;
installation: Installation;
authTestResponse: AuthTestResponse;
}
/**
* OAuthCallback hook
*/
export type OAuthCallback = (args: OAuthCallbackArgs) => Promise<Response>;
/**
* The default OAuthCallback implementation.
*/
export declare function defaultOAuthCallback(renderer?: OAuthCompletionPageRenderer): OAuthCallback;
//# sourceMappingURL=hook.d.ts.map