UNPKG

textiot

Version:

A framework for building web and native (IoT) Dapps on the IPFS network

94 lines (93 loc) 4 kB
import '@ef-carbon/fetch/install'; import { KeyValue, ApiOptions } from '../models'; export declare const DEFAULT_API_OPTIONS: { url: string; port: number; version: number; }; /** * Create 'args' like a CLI command would take * * @param {string[]} argsAr An array of arguments * @private */ export declare const getArgs: (argsAr?: string[] | undefined) => string; /** * Create 'options' like a CLI command would take. * * @param {Object.<string, string>} opts A map of option keys and values * @private */ export declare const getOpts: (opts?: Record<string, string | number | boolean> | undefined) => string; export declare const createHeaders: (args?: string[] | undefined, opts?: Record<string, string | number | boolean> | undefined, headers?: Record<string, string | number | boolean> | undefined) => Record<string, string>; /** * API is the base class for all SDK modules. * * @params {ApiOptions] opts API options object */ declare class API { private opts; private baseURL; private gatewayURL; constructor(opts?: ApiOptions); /** * Make a get request to the Textile node * * @param url The relative URL of the API endpoint * @param args An array of arguments to pass as Textile args headers * @param opts An object of options to pass as Textile options headers */ protected sendGatewayGet(path: string, headers?: KeyValue): Promise<Response>; /** * Make a post request to the Textile node * * @param url The relative URL of the API endpoint * @param args An array of arguments to pass as Textile args headers * @param opts An object of options to pass as Textile options headers * @param data An object of data to post */ protected sendPost(url: string, args?: string[], opts?: KeyValue, data?: any, headers?: KeyValue, raw?: boolean): Promise<Response>; /** * Make a get request to the Textile node * * @param url The relative URL of the API endpoint * @param args An array of arguments to pass as Textile args headers * @param opts An object of options to pass as Textile options headers */ protected sendGet(url: string, args?: string[], opts?: KeyValue, headers?: KeyValue): Promise<Response>; /** * Make a delete request to the Textile node * * @param url The relative URL of the API endpoint * @param args An array of arguments to pass as Textile args headers * @param opts An object of options to pass as Textile options headers */ protected sendDelete(url: string, args?: string[], opts?: KeyValue, headers?: KeyValue): Promise<Response>; /** * Make a put request to the Textile node * * @param url The relative URL of the API endpoint * @param args An array of arguments to pass as Textile args headers * @param opts An object of options to pass as Textile options headers * @param data An object of data to put */ protected sendPut(url: string, args?: string[], opts?: KeyValue, data?: any, headers?: KeyValue): Promise<Response>; /** * Make a patch request to the Textile node * * @param url The relative URL of the API endpoint * @param args An array of arguments to pass as Textile args headers * @param opts An object of options to pass as Textile options headers * @param data An object of data to put */ protected sendPatch(url: string, args?: string[], opts?: KeyValue, data?: any, headers?: KeyValue): Promise<Response>; /** * Make an EventSource request to the Textile node * * @param url The relative URL of the API endpoint * @param args An array of arguments to pass as query in native EventSource or Textile args headers in EventSourcePolyfill * @param opts An object of options to pass as Textile options headers */ protected sendEventSource(url: string, args?: string[], opts?: KeyValue, headers?: KeyValue): EventSource; } export { API };