modrinthjs
Version:
A type safe Modrinth implementation.
32 lines (31 loc) • 2.05 kB
TypeScript
import { AxiosResponse } from 'axios';
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';
import { CancelablePromise } from './CancelablePromise';
import type { OnCancel } from './CancelablePromise';
import type { OpenAPIConfig } from './OpenAPI';
export declare const isDefined: <T>(value: T) => value is Exclude<T, null>;
export declare const isString: (value: any) => value is string;
export declare const isStringWithValue: (value: any) => value is string;
export declare const isBlob: (value: any) => value is Blob;
export declare const isFormData: (value: any) => value is FormData;
export declare const base64: (str: string) => string;
export declare const getQueryString: (params: Record<string, any>) => string;
export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>) => Promise<T>;
export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions) => Promise<Record<string, string>>;
export declare const getRequestBody: (options: ApiRequestOptions) => any;
export declare const sendRequest: (config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Record<string, string>, onCancel: OnCancel) => Promise<AxiosResponse>;
export declare const getResponseHeader: (response: AxiosResponse, responseHeader?: string) => string | undefined;
export declare const getResponseBody: (response: AxiosResponse) => Promise<any>;
export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
/**
* Request method
* @param config The OpenAPI configuration object
* @param options The request options from the service
* @returns CancelablePromise<T>
* @throws ApiError
*/
export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
export {};