UNPKG

@scalar/api-client

Version:

the open source API testing client

75 lines 3.25 kB
import type { Request } from '@scalar/oas-utils/entities/spec'; /** Convert path string like '/planets/{planetId}' to regex pattern /\/planets/([^/]+)/ */ export declare const pathToRegex: (path: string) => RegExp; /** * Takes a path and method and returns the request that matches the path and method while taking * path params into account by converting to a regex. Will also return the path params if they exist. * * @example path can be /planets/{planetId} OR /planets/1 */ export declare const findRequestByPathMethod: (path: string, method: string, requests: Request[]) => { request: { type: "request"; uid: string & import("zod").$brand<"operation">; path: string; method: "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace"; servers: (string & import("zod").$brand<"server">)[]; selectedServerUid: (string & import("zod").$brand<"server">) | null; examples: (string & import("zod").$brand<"example">)[]; selectedSecuritySchemeUids: ((string & import("zod").$brand<"securityScheme">) | (string & import("zod").$brand<"securityScheme">)[])[]; description?: string | undefined; summary?: string | undefined; externalDocs?: { url: string; description?: string | undefined; } | undefined; 'x-internal'?: boolean | undefined; 'x-scalar-ignore'?: boolean | undefined; security?: Record<string, string[]>[] | undefined; tags?: string[] | undefined; deprecated?: boolean | undefined; operationId?: string | undefined; requestBody?: any; parameters?: { in: "path" | "cookie" | "query" | "header"; name: string; required: boolean; deprecated: boolean; description?: string | undefined; schema?: unknown; content?: unknown; style?: "matrix" | "label" | "form" | "simple" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined; explode?: boolean | undefined; example?: unknown; examples?: Record<string, { value?: unknown; summary?: string | undefined; externalValue?: string | undefined; }> | unknown[] | undefined; }[] | undefined; responses?: Record<string, any> | undefined; callbacks?: Record<string, Record<string, Record<string, any>>> | undefined; 'x-codeSamples'?: { source: string; lang?: string | undefined; label?: string | undefined; }[] | undefined; 'x-code-samples'?: { source: string; lang?: string | undefined; label?: string | undefined; }[] | undefined; 'x-custom-examples'?: { source: string; lang?: string | undefined; label?: string | undefined; }[] | undefined; 'x-scalar-stability'?: import("@scalar/types").XScalarStability | undefined; 'x-post-response'?: string | undefined; } | undefined; pathParams: { key: string; value: string; }[]; }; //# sourceMappingURL=find-request.d.ts.map