import { HttpStatus } from "http-status"; import { paths } from "./liljudd"; export type MyPaths = keyof paths; export type Methods = keyof paths[Path]; export type Responses< Path extends MyPaths, Method extends Methods, > = "responses" extends keyof paths[Path][Method] ? paths[Path][Method]["responses"] : never; type StatusCodes

> = { [CodeName in keyof HttpStatus]: HttpStatus[CodeName] extends number ? HttpStatus[CodeName] extends keyof Responses ? CodeName : never : never; }[keyof HttpStatus]; export type ResponseSchemas< Path extends MyPaths, Method extends Methods, Code extends StatusCodes, > = Code extends keyof HttpStatus ? HttpStatus[Code] extends keyof Responses ? "content" extends keyof Responses[HttpStatus[Code]] ? "application/json" extends keyof Responses< Path, Method >[HttpStatus[Code]]["content"] ? Responses< Path, Method >[HttpStatus[Code]]["content"]["application/json"] extends never ? null : Responses< Path, Method >[HttpStatus[Code]]["content"]["application/json"] : never : never : never : never; export type Parameters< Path extends MyPaths, Method extends Methods, > = "parameters" extends keyof paths[Path][Method] ? "path" extends keyof paths[Path][Method]["parameters"] ? paths[Path][Method]["parameters"]["path"] : never : never; export type RequestBody< Path extends MyPaths, Method extends Methods, > = "requestBody" extends keyof paths[Path][Method] ? "content" extends keyof paths[Path][Method]["requestBody"] ? "application/json" extends keyof paths[Path][Method]["requestBody"]["content"] ? paths[Path][Method]["requestBody"]["content"]["application/json"] : never : never : never; // eslint-disable-next-line @typescript-eslint/no-unused-vars export interface APIResponse> extends Response {}