@yandex-cloud/function-types
Version:
TypeScript typings for Serverless Functions in Yandex.Cloud
37 lines (36 loc) • 1.1 kB
TypeScript
declare type HttpMethod = "OPTIONS" | "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
export declare namespace Http {
interface Result {
statusCode: number;
headers?: Record<string, string>;
multiValueHeaders?: Record<string, string[]>;
body?: string;
isBase64Encoded?: boolean;
}
interface Event {
httpMethod: HttpMethod;
headers: Record<string, string>;
multiValueHeaders: Record<string, string[]>;
queryStringParameters: Record<string, string>;
multiValueQueryStringParameters: Record<string, string[]>;
requestContext: RequestContext & {
authorizer?: unknown;
apiGateway?: {
operationContext: unknown;
};
};
body: string;
isBase64Encoded: boolean;
}
type RequestContext = {
identity: {
sourceIp: string;
userAgent: string;
};
httpMethod: HttpMethod;
requestId: string;
requestTime: string;
requestTimeEpoch: number;
};
}
export {};