@master-chief/alpaca-ts
Version:
A TypeScript Node.js library for the https://alpaca.markets REST API and WebSocket streams.
35 lines (34 loc) • 2.3 kB
TypeScript
import FormData from "form-data";
import type { AxiosResponse, AxiosInstance } from "axios";
import { Config } from "../Client.js";
import { CancelablePromise } from "./CancelablePromise.js";
import type { OnCancel } from "./CancelablePromise.js";
import type { ApiResult } from "./ApiResult.js";
import type { ApiRequestOptions } from "./ApiRequestOptions.js";
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 isSuccess: (status: number) => boolean;
export declare const base64: (str: string) => string;
export declare const getQueryString: (params: Record<string, any>) => string;
export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
declare 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: Config, options: ApiRequestOptions, formData?: FormData) => Promise<Record<string, string>>;
export declare const getRequestBody: (options: ApiRequestOptions) => any;
export declare const sendRequest: <T>(config: Config, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Record<string, string>, onCancel: OnCancel, axiosClient: AxiosInstance) => Promise<AxiosResponse<T, any>>;
export declare const getResponseHeader: (response: AxiosResponse<any>, responseHeader?: string) => string | undefined;
export declare const getResponseBody: (response: AxiosResponse<any>) => 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
* @param axiosClient The axios client instance to use
* @returns CancelablePromise<T>
* @throws ApiError
*/
export declare const request: <T>(config: Config, options: ApiRequestOptions, axiosClient?: AxiosInstance) => CancelablePromise<T>;
export {};