UNPKG

curlconverter

Version:

convert curl commands to Python, JavaScript, Go, PHP and more

201 lines (200 loc) 5.58 kB
import { Word } from "./shell/Word.js"; import type { Warnings, Support } from "./Warnings.js"; import type { GlobalConfig } from "./curl/opts.js"; import { Headers } from "./Headers.js"; import type { Cookies } from "./Headers.js"; import { type AuthType } from "./curl/auth.js"; export { AuthType } from "./curl/auth.js"; import { type Curl_URL } from "./curl/url.js"; import type { QueryList, QueryDict } from "./Query.js"; import type { FormParam } from "./curl/form.js"; export type FileParamType = "data" | "binary" | "urlencode" | "json"; export type DataType = FileParamType | "raw"; export type FileDataParam = { filetype: FileParamType; name?: Word; filename: Word; }; export type DataParam = Word | FileDataParam; export interface RequestUrl { originalUrl: Word; url: Word; queryReadsFile?: string; urlObj: Curl_URL; urlWithoutQueryList: Word; queryList?: QueryList; queryDict?: QueryDict; urlWithoutQueryArray: Word; urlWithOriginalQuery: Word; queryArray?: DataParam[]; urlQueryArray?: DataParam[]; uploadFile?: Word; output?: Word; method: Word; auth?: [Word, Word]; } export type ProxyType = "http1" | "http2" | "socks4" | "socks4a" | "socks5" | "socks5-hostname"; export interface Request { urls: RequestUrl[]; globoff?: boolean; disallowUsernameInUrl?: boolean; pathAsIs?: boolean; queryArray?: DataParam[]; authType: AuthType; proxyAuthType: AuthType; awsSigV4?: Word; oauth2Bearer?: Word; delegation?: Word; krb?: Word; saslAuthzid?: Word; saslIr?: boolean; serviceName?: Word; headers: Headers; proxyHeaders: Headers; refererAuto?: boolean; cookies?: Cookies; cookieFiles?: Word[]; cookieJar?: Word; junkSessionCookies?: boolean; compressed?: boolean; transferEncoding?: boolean; include?: boolean; multipartUploads?: FormParam[]; multipartUploadsDoesntRoundtrip?: boolean; formEscape?: boolean; dataArray?: DataParam[]; data?: Word; dataReadsFile?: string; isDataBinary?: boolean; isDataRaw?: boolean; ipv4?: boolean; ipv6?: boolean; proto?: Word; protoRedir?: Word; protoDefault?: Word; tcpFastopen?: boolean; localPort?: [Word, Word | null]; ignoreContentLength?: boolean; interface?: Word; ciphers?: Word; curves?: Word; insecure?: boolean; certStatus?: boolean; cert?: [Word, Word | null]; certType?: Word; key?: Word; keyType?: Word; pass?: Word; cacert?: Word; caNative?: boolean; sslAllowBeast?: boolean; capath?: Word; crlfile?: Word; pinnedpubkey?: Word; randomFile?: Word; egdFile?: Word; hsts?: Word[]; alpn?: boolean; tlsVersion?: "1" | "1.0" | "1.1" | "1.2" | "1.3"; tlsMax?: Word; tls13Ciphers?: Word; tlsauthtype?: Word; tlspassword?: Word; tlsuser?: Word; sslAutoClientCert?: boolean; sslNoRevoke?: boolean; sslReqd?: boolean; sslRevokeBestEffort?: boolean; ssl?: boolean; sslv2?: boolean; sslv3?: boolean; dohUrl?: Word; dohInsecure?: boolean; dohCertStatus?: boolean; proxy?: Word; proxyType?: ProxyType; proxyAuth?: Word; proxytunnel?: boolean; noproxy?: Word; preproxy?: Word; proxyAnyauth?: boolean; proxyBasic?: boolean; proxyCaNative?: boolean; proxyCacert?: Word; proxyCapath?: Word; proxyCertType?: Word; proxyCert?: Word; proxyCiphers?: Word; proxyCrlfile?: Word; proxyDigest?: boolean; proxyHttp2?: boolean; proxyInsecure?: boolean; proxyKeyType?: Word; proxyKey?: Word; proxyNegotiate?: boolean; proxyNtlm?: boolean; proxyPass?: Word; proxyPinnedpubkey?: Word; proxyServiceName?: Word; proxySslAllowBeast?: boolean; proxySslAutoClientCert?: boolean; proxyTls13Ciphers?: Word; proxyTlsauthtype?: Word; proxyTlspassword?: Word; proxyTlsuser?: Word; proxyTlsv1?: boolean; proxyUser?: Word; proxy1?: boolean; socks4?: Word; socks4a?: Word; socks5?: Word; socks5Basic?: boolean; socks5GssapiNec?: boolean; socks5GssapiService?: Word; socks5Gssapi?: boolean; socks5Hostname?: Word; haproxyClientIp?: Word; haproxyProtocol?: boolean; timeout?: Word; connectTimeout?: Word; expect100Timeout?: Word; happyEyeballsTimeoutMs?: Word; speedLimit?: Word; speedTime?: Word; limitRate?: Word; maxFilesize?: Word; continueAt?: Word; crlf?: boolean; useAscii?: boolean; remoteTime?: boolean; clobber?: boolean; ftpSkipPasvIp?: boolean; fail?: boolean; retry?: Word; retryMaxTime?: Word; keepAlive?: boolean; keepAliveTime?: Word; altSvc?: Word; followRedirects?: boolean; followRedirectsTrusted?: boolean; maxRedirects?: Word; post301?: boolean; post302?: boolean; post303?: boolean; httpVersion?: "1.0" | "1.1" | "2" | "2-prior-knowledge" | "3" | "3-only"; http0_9?: boolean; http2?: boolean; http3?: boolean; stdin?: Word; stdinFile?: Word; resolve?: Word[]; connectTo?: Word[]; unixSocket?: Word; abstractUnixSocket?: Word; netrc?: "optional" | "required" | "ignored"; netrcFile?: Word; verbose?: boolean; silent?: boolean; } export declare function buildRequests(global_: GlobalConfig, stdin?: Word, stdinFile?: Word): Request[]; export declare function getFirst(requests: Request[], warnings: Warnings, support?: Support): Request;