CoolFace
Apppublic

opusdev/vector-similarity-api

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes
index.d.cts592 linesDownload Raw Back to axios
1interface RawAxiosHeaders {2  [key: string]: axios.AxiosHeaderValue;3}4 5type MethodsHeaders = Partial<{6  [Key in axios.Method as Lowercase<Key>]: AxiosHeaders;7} & {common: AxiosHeaders}>;8 9type AxiosHeaderMatcher = string | RegExp | ((this: AxiosHeaders, value: string, name: string) => boolean);10 11type AxiosHeaderParser = (this: AxiosHeaders, value: axios.AxiosHeaderValue, header: string) => any;12 13type CommonRequestHeadersList = 'Accept' | 'Content-Length' | 'User-Agent'| 'Content-Encoding' | 'Authorization';14 15type ContentType = axios.AxiosHeaderValue | 'text/html' | 'text/plain' | 'multipart/form-data' | 'application/json' | 'application/x-www-form-urlencoded' | 'application/octet-stream';16 17type CommonResponseHeadersList = 'Server' | 'Content-Type' | 'Content-Length' | 'Cache-Control'| 'Content-Encoding';18 19type BrowserProgressEvent = any;20 21declare class AxiosHeaders {22  constructor(23      headers?: RawAxiosHeaders | AxiosHeaders | string24  );25 26  [key: string]: any;27 28  set(headerName?: string, value?: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;29  set(headers?: RawAxiosHeaders | AxiosHeaders | string, rewrite?: boolean): AxiosHeaders;30 31  get(headerName: string, parser: RegExp): RegExpExecArray | null;32  get(headerName: string, matcher?: true | AxiosHeaderParser): axios.AxiosHeaderValue;33 34  has(header: string, matcher?: AxiosHeaderMatcher): boolean;35 36  delete(header: string | string[], matcher?: AxiosHeaderMatcher): boolean;37 38  clear(matcher?: AxiosHeaderMatcher): boolean;39 40  normalize(format: boolean): AxiosHeaders;41 42  concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;43 44  toJSON(asStrings?: boolean): RawAxiosHeaders;45 46  static from(thing?: AxiosHeaders | RawAxiosHeaders | string): AxiosHeaders;47 48  static accessor(header: string | string[]): AxiosHeaders;49 50  static concat(...targets: Array<AxiosHeaders | RawAxiosHeaders | string | undefined | null>): AxiosHeaders;51 52  setContentType(value: ContentType, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;53  getContentType(parser?: RegExp): RegExpExecArray | null;54  getContentType(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;55  hasContentType(matcher?: AxiosHeaderMatcher): boolean;56 57  setContentLength(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;58  getContentLength(parser?: RegExp): RegExpExecArray | null;59  getContentLength(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;60  hasContentLength(matcher?: AxiosHeaderMatcher): boolean;61 62  setAccept(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;63  getAccept(parser?: RegExp): RegExpExecArray | null;64  getAccept(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;65  hasAccept(matcher?: AxiosHeaderMatcher): boolean;66 67  setUserAgent(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;68  getUserAgent(parser?: RegExp): RegExpExecArray | null;69  getUserAgent(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;70  hasUserAgent(matcher?: AxiosHeaderMatcher): boolean;71 72  setContentEncoding(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;73  getContentEncoding(parser?: RegExp): RegExpExecArray | null;74  getContentEncoding(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;75  hasContentEncoding(matcher?: AxiosHeaderMatcher): boolean;76 77  setAuthorization(value: axios.AxiosHeaderValue, rewrite?: boolean | AxiosHeaderMatcher): AxiosHeaders;78  getAuthorization(parser?: RegExp): RegExpExecArray | null;79  getAuthorization(matcher?: AxiosHeaderMatcher): axios.AxiosHeaderValue;80  hasAuthorization(matcher?: AxiosHeaderMatcher): boolean;81 82  getSetCookie(): string[];83 84  [Symbol.iterator](): IterableIterator<[string, axios.AxiosHeaderValue]>;85}86 87declare class AxiosError<T = unknown, D = any> extends Error {88  constructor(89      message?: string,90      code?: string,91      config?: axios.InternalAxiosRequestConfig<D>,92      request?: any,93      response?: axios.AxiosResponse<T, D>94  );95 96  config?: axios.InternalAxiosRequestConfig<D>;97  code?: string;98  request?: any;99  response?: axios.AxiosResponse<T, D>;100  isAxiosError: boolean;101  status?: number;102  toJSON: () => object;103  cause?: Error;104  event?: BrowserProgressEvent;105  static from<T = unknown, D = any>(106    error: Error | unknown,107    code?: string,108    config?: axios.InternalAxiosRequestConfig<D>,109    request?: any,110    response?: axios.AxiosResponse<T, D>,111    customProps?: object,112): AxiosError<T, D>;113  static readonly ERR_FR_TOO_MANY_REDIRECTS = "ERR_FR_TOO_MANY_REDIRECTS";114  static readonly ERR_BAD_OPTION_VALUE = "ERR_BAD_OPTION_VALUE";115  static readonly ERR_BAD_OPTION = "ERR_BAD_OPTION";116  static readonly ERR_NETWORK = "ERR_NETWORK";117  static readonly ERR_DEPRECATED = "ERR_DEPRECATED";118  static readonly ERR_BAD_RESPONSE = "ERR_BAD_RESPONSE";119  static readonly ERR_BAD_REQUEST = "ERR_BAD_REQUEST";120  static readonly ERR_NOT_SUPPORT = "ERR_NOT_SUPPORT";121  static readonly ERR_INVALID_URL = "ERR_INVALID_URL";122  static readonly ERR_CANCELED = "ERR_CANCELED";123  static readonly ECONNABORTED = "ECONNABORTED";124  static readonly ETIMEDOUT = "ETIMEDOUT";125}126 127declare class CanceledError<T> extends AxiosError<T> {128}129 130declare class Axios {131  constructor(config?: axios.AxiosRequestConfig);132  defaults: axios.AxiosDefaults;133  interceptors: {134    request: axios.AxiosInterceptorManager<axios.InternalAxiosRequestConfig>;135    response: axios.AxiosInterceptorManager<axios.AxiosResponse>;136  };137  getUri(config?: axios.AxiosRequestConfig): string;138  request<T = any, R = axios.AxiosResponse<T>, D = any>(config: axios.AxiosRequestConfig<D>): Promise<R>;139  get<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;140  delete<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;141  head<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;142  options<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, config?: axios.AxiosRequestConfig<D>): Promise<R>;143  post<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;144  put<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;145  patch<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;146  postForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;147  putForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;148  patchForm<T = any, R = axios.AxiosResponse<T>, D = any>(url: string, data?: D, config?: axios.AxiosRequestConfig<D>): Promise<R>;149}150 151declare enum HttpStatusCode {152  Continue = 100,153  SwitchingProtocols = 101,154  Processing = 102,155  EarlyHints = 103,156  Ok = 200,157  Created = 201,158  Accepted = 202,159  NonAuthoritativeInformation = 203,160  NoContent = 204,161  ResetContent = 205,162  PartialContent = 206,163  MultiStatus = 207,164  AlreadyReported = 208,165  ImUsed = 226,166  MultipleChoices = 300,167  MovedPermanently = 301,168  Found = 302,169  SeeOther = 303,170  NotModified = 304,171  UseProxy = 305,172  Unused = 306,173  TemporaryRedirect = 307,174  PermanentRedirect = 308,175  BadRequest = 400,176  Unauthorized = 401,177  PaymentRequired = 402,178  Forbidden = 403,179  NotFound = 404,180  MethodNotAllowed = 405,181  NotAcceptable = 406,182  ProxyAuthenticationRequired = 407,183  RequestTimeout = 408,184  Conflict = 409,185  Gone = 410,186  LengthRequired = 411,187  PreconditionFailed = 412,188  PayloadTooLarge = 413,189  UriTooLong = 414,190  UnsupportedMediaType = 415,191  RangeNotSatisfiable = 416,192  ExpectationFailed = 417,193  ImATeapot = 418,194  MisdirectedRequest = 421,195  UnprocessableEntity = 422,196  Locked = 423,197  FailedDependency = 424,198  TooEarly = 425,199  UpgradeRequired = 426,200  PreconditionRequired = 428,201  TooManyRequests = 429,202  RequestHeaderFieldsTooLarge = 431,203  UnavailableForLegalReasons = 451,204  InternalServerError = 500,205  NotImplemented = 501,206  BadGateway = 502,207  ServiceUnavailable = 503,208  GatewayTimeout = 504,209  HttpVersionNotSupported = 505,210  VariantAlsoNegotiates = 506,211  InsufficientStorage = 507,212  LoopDetected = 508,213  NotExtended = 510,214  NetworkAuthenticationRequired = 511,215}216 217type InternalAxiosError<T = unknown, D = any> = AxiosError<T, D>;218 219declare namespace axios {220  type AxiosError<T = unknown, D = any> = InternalAxiosError<T, D>;221 222  type RawAxiosRequestHeaders = Partial<RawAxiosHeaders & {223    [Key in CommonRequestHeadersList]: AxiosHeaderValue;224  } & {225    'Content-Type': ContentType226  }>;227 228  type AxiosRequestHeaders = RawAxiosRequestHeaders & AxiosHeaders;229 230  type AxiosHeaderValue = AxiosHeaders | string | string[] | number | boolean | null;231 232  type RawCommonResponseHeaders = {233    [Key in CommonResponseHeadersList]: AxiosHeaderValue;234  } & {235    "set-cookie": string[];236  };237 238  type RawAxiosResponseHeaders = Partial<RawAxiosHeaders & RawCommonResponseHeaders>;239 240  type AxiosResponseHeaders = RawAxiosResponseHeaders & AxiosHeaders;241 242  interface AxiosRequestTransformer {243    (this: InternalAxiosRequestConfig, data: any, headers: AxiosRequestHeaders): any;244  }245 246  interface AxiosResponseTransformer {247    (this: InternalAxiosRequestConfig, data: any, headers: AxiosResponseHeaders, status?: number): any;248  }249 250  interface AxiosAdapter {251    (config: InternalAxiosRequestConfig): AxiosPromise;252  }253 254  interface AxiosBasicCredentials {255    username: string;256    password: string;257  }258 259  interface AxiosProxyConfig {260    host: string;261    port: number;262    auth?: AxiosBasicCredentials;263    protocol?: string;264  }265 266  type Method =267    | 'get' | 'GET'268    | 'delete' | 'DELETE'269    | 'head' | 'HEAD'270    | 'options' | 'OPTIONS'271    | 'post' | 'POST'272    | 'put' | 'PUT'273    | 'patch' | 'PATCH'274    | 'purge' | 'PURGE'275    | 'link' | 'LINK'276    | 'unlink' | 'UNLINK';277 278  type ResponseType =279    | 'arraybuffer'280    | 'blob'281    | 'document'282    | 'json'283    | 'text'284    | 'stream'285    | 'formdata';286 287  type responseEncoding =288    | 'ascii' | 'ASCII'289    | 'ansi' | 'ANSI'290    | 'binary' | 'BINARY'291    | 'base64' | 'BASE64'292    | 'base64url' | 'BASE64URL'293    | 'hex' | 'HEX'294    | 'latin1' | 'LATIN1'295    | 'ucs-2' | 'UCS-2'296    | 'ucs2' | 'UCS2'297    | 'utf-8' | 'UTF-8'298    | 'utf8' | 'UTF8'299    | 'utf16le' | 'UTF16LE';300 301  interface TransitionalOptions {302    silentJSONParsing?: boolean;303    forcedJSONParsing?: boolean;304    clarifyTimeoutError?: boolean;305    legacyInterceptorReqResOrdering?: boolean;306  }307 308  interface GenericAbortSignal {309    readonly aborted: boolean;310    onabort?: ((...args: any) => any) | null;311    addEventListener?: (...args: any) => any;312    removeEventListener?: (...args: any) => any;313  }314 315  interface FormDataVisitorHelpers {316    defaultVisitor: SerializerVisitor;317    convertValue: (value: any) => any;318    isVisitable: (value: any) => boolean;319  }320 321  interface SerializerVisitor {322    (323        this: GenericFormData,324        value: any,325        key: string | number,326        path: null | Array<string | number>,327        helpers: FormDataVisitorHelpers328    ): boolean;329  }330 331  interface SerializerOptions {332    visitor?: SerializerVisitor;333    dots?: boolean;334    metaTokens?: boolean;335    indexes?: boolean | null;336  }337 338  // tslint:disable-next-line339  interface FormSerializerOptions extends SerializerOptions {340  }341 342  interface ParamEncoder {343    (value: any, defaultEncoder: (value: any) => any): any;344  }345 346  interface CustomParamsSerializer {347    (params: Record<string, any>, options?: ParamsSerializerOptions): string;348  }349 350  interface ParamsSerializerOptions extends SerializerOptions {351    encode?: ParamEncoder;352    serialize?: CustomParamsSerializer;353  }354 355  type MaxUploadRate = number;356 357  type MaxDownloadRate = number;358 359  interface AxiosProgressEvent {360    loaded: number;361    total?: number;362    progress?: number;363    bytes: number;364    rate?: number;365    estimated?: number;366    upload?: boolean;367    download?: boolean;368    event?: BrowserProgressEvent;369    lengthComputable: boolean;370  }371 372  type Milliseconds = number;373 374  type AxiosAdapterName = 'fetch' | 'xhr' | 'http' | (string & {});375 376  type AxiosAdapterConfig = AxiosAdapter | AxiosAdapterName;377 378  type AddressFamily = 4 | 6 | undefined;379 380  interface LookupAddressEntry {381    address: string;382    family?: AddressFamily;383  }384 385  type LookupAddress = string | LookupAddressEntry;386 387  interface AxiosRequestConfig<D = any> {388    url?: string;389    method?: Method | string;390    baseURL?: string;391    allowAbsoluteUrls?: boolean;392    transformRequest?: AxiosRequestTransformer | AxiosRequestTransformer[];393    transformResponse?: AxiosResponseTransformer | AxiosResponseTransformer[];394    headers?: (RawAxiosRequestHeaders & MethodsHeaders) | AxiosHeaders;395    params?: any;396    paramsSerializer?: ParamsSerializerOptions | CustomParamsSerializer;397    data?: D;398    timeout?: Milliseconds;399    timeoutErrorMessage?: string;400    withCredentials?: boolean;401    adapter?: AxiosAdapterConfig | AxiosAdapterConfig[];402    auth?: AxiosBasicCredentials;403    responseType?: ResponseType;404    responseEncoding?: responseEncoding | string;405    xsrfCookieName?: string;406    xsrfHeaderName?: string;407    onUploadProgress?: (progressEvent: AxiosProgressEvent) => void;408    onDownloadProgress?: (progressEvent: AxiosProgressEvent) => void;409    maxContentLength?: number;410    validateStatus?: ((status: number) => boolean) | null;411    maxBodyLength?: number;412    maxRedirects?: number;413    maxRate?: number | [MaxUploadRate, MaxDownloadRate];414    beforeRedirect?: (options: Record<string, any>, responseDetails: {headers: Record<string, string>, statusCode: HttpStatusCode}) => void;415    socketPath?: string | null;416    transport?: any;417    httpAgent?: any;418    httpsAgent?: any;419    proxy?: AxiosProxyConfig | false;420    cancelToken?: CancelToken;421    decompress?: boolean;422    transitional?: TransitionalOptions;423    signal?: GenericAbortSignal;424    insecureHTTPParser?: boolean;425    env?: {426      FormData?: new (...args: any[]) => object;427      fetch?: (input: URL | Request | string, init?: RequestInit) => Promise<Response>;428      Request?: new (input: URL | Request | string, init?: RequestInit) => Request;429      Response?: new (430          body?: ArrayBuffer | ArrayBufferView | Blob | FormData | URLSearchParams | string | null,431          init?: ResponseInit432      ) => Response;433    };434    formSerializer?: FormSerializerOptions;435    family?: AddressFamily;436    lookup?: ((hostname: string, options: object, cb: (err: Error | null, address: LookupAddress | LookupAddress[], family?: AddressFamily) => void) => void) |437        ((hostname: string, options: object) => Promise<[address: LookupAddressEntry | LookupAddressEntry[], family?: AddressFamily] | LookupAddress>);438    withXSRFToken?: boolean | ((config: InternalAxiosRequestConfig) => boolean | undefined);439    fetchOptions?: Omit<RequestInit, 'body' | 'headers' | 'method' | 'signal'> | Record<string, any>;440    httpVersion?: 1 | 2;441    http2Options?: Record<string, any> & {442      sessionTimeout?: number;443    };444  }445 446  // Alias447  type RawAxiosRequestConfig<D = any> = AxiosRequestConfig<D>;448 449  interface InternalAxiosRequestConfig<D = any> extends AxiosRequestConfig<D> {450    headers: AxiosRequestHeaders;451  }452 453  interface HeadersDefaults {454    common: RawAxiosRequestHeaders;455    delete: RawAxiosRequestHeaders;456    get: RawAxiosRequestHeaders;457    head: RawAxiosRequestHeaders;458    post: RawAxiosRequestHeaders;459    put: RawAxiosRequestHeaders;460    patch: RawAxiosRequestHeaders;461    options?: RawAxiosRequestHeaders;462    purge?: RawAxiosRequestHeaders;463    link?: RawAxiosRequestHeaders;464    unlink?: RawAxiosRequestHeaders;465  }466 467  interface AxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {468    headers: HeadersDefaults;469  }470 471  interface CreateAxiosDefaults<D = any> extends Omit<AxiosRequestConfig<D>, 'headers'> {472    headers?: RawAxiosRequestHeaders | AxiosHeaders | Partial<HeadersDefaults>;473  }474 475  interface AxiosResponse<T = any, D = any, H = {}>  {476    data: T;477    status: number;478    statusText: string;479    headers: H & RawAxiosResponseHeaders | AxiosResponseHeaders;480    config: InternalAxiosRequestConfig<D>;481    request?: any;482  }483 484  type AxiosPromise<T = any> = Promise<AxiosResponse<T>>;485 486  interface CancelStatic {487    new (message?: string): Cancel;488  }489 490  interface Cancel {491    message: string | undefined;492  }493 494  interface Canceler {495    (message?: string, config?: AxiosRequestConfig, request?: any): void;496  }497 498  interface CancelTokenStatic {499    new (executor: (cancel: Canceler) => void): CancelToken;500    source(): CancelTokenSource;501  }502 503  interface CancelToken {504    promise: Promise<Cancel>;505    reason?: Cancel;506    throwIfRequested(): void;507  }508 509  interface CancelTokenSource {510    token: CancelToken;511    cancel: Canceler;512  }513 514  interface AxiosInterceptorOptions {515    synchronous?: boolean;516    runWhen?: (config: InternalAxiosRequestConfig) => boolean;517  }518 519  type AxiosInterceptorFulfilled<T> = (value: T) => T | Promise<T>;520  type AxiosInterceptorRejected = (error: any) => any;521 522  type AxiosRequestInterceptorUse<T> = (523    onFulfilled?: AxiosInterceptorFulfilled<T> | null,524    onRejected?: AxiosInterceptorRejected | null,525    options?: AxiosInterceptorOptions526  ) => number;527 528  type AxiosResponseInterceptorUse<T> = (529    onFulfilled?: AxiosInterceptorFulfilled<T> | null,530    onRejected?: AxiosInterceptorRejected | null531  ) => number;532 533  interface AxiosInterceptorHandler<T> {534    fulfilled: AxiosInterceptorFulfilled<T>;535    rejected?: AxiosInterceptorRejected;536    synchronous: boolean;537    runWhen?: (config: AxiosRequestConfig) => boolean;538  }539 540  interface AxiosInterceptorManager<V> {541    use: V extends AxiosResponse ? AxiosResponseInterceptorUse<V> : AxiosRequestInterceptorUse<V>;542    eject(id: number): void;543    clear(): void;544    handlers?: Array<AxiosInterceptorHandler<V>>;545  }546 547  interface AxiosInstance extends Axios {548    <T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D>): Promise<R>;549    <T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>): Promise<R>;550 551    create(config?: CreateAxiosDefaults): AxiosInstance;552    defaults: Omit<AxiosDefaults, 'headers'> & {553      headers: HeadersDefaults & {554        [key: string]: AxiosHeaderValue555      }556    };557  }558 559  interface GenericFormData {560    append(name: string, value: any, options?: any): any;561  }562 563  interface GenericHTMLFormElement {564    name: string;565    method: string;566    submit(): void;567  }568 569  interface AxiosStatic extends AxiosInstance {570    Cancel: CancelStatic;571    CancelToken: CancelTokenStatic;572    Axios: typeof Axios;573    AxiosError: typeof AxiosError;574    CanceledError: typeof CanceledError;575    HttpStatusCode: typeof HttpStatusCode;576    readonly VERSION: string;577    isCancel(value: any): value is Cancel;578    all<T>(values: Array<T | Promise<T>>): Promise<T[]>;579    spread<T, R>(callback: (...args: T[]) => R): (array: T[]) => R;580    isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D>;581    toFormData(sourceObj: object, targetFormData?: GenericFormData, options?: FormSerializerOptions): GenericFormData;582    formToJSON(form: GenericFormData|GenericHTMLFormElement): object;583    getAdapter(adapters: AxiosAdapterConfig | AxiosAdapterConfig[] | undefined): AxiosAdapter;584    AxiosHeaders: typeof AxiosHeaders;585    mergeConfig<D = any>(config1: AxiosRequestConfig<D>, config2: AxiosRequestConfig<D>): AxiosRequestConfig<D>;586  }587}588 589declare const axios: axios.AxiosStatic;590 591export = axios;592