mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
68 lines
2.5 KiB
TypeScript
68 lines
2.5 KiB
TypeScript
import type { File } from '../file-system';
|
|
import type { ImageSource } from '../image-source';
|
|
import type { HttpResponse, HttpRequestOptions } from './http-interfaces';
|
|
export { request } from './http-request';
|
|
export * from './http-interfaces';
|
|
|
|
/**
|
|
* Downloads the content from the specified URL as a string.
|
|
* @param url The URL to request from.
|
|
*/
|
|
export function getString(url: string): Promise<string>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL as a string.
|
|
* @param options An object that specifies various request options.
|
|
*/
|
|
export function getString(options: HttpRequestOptions): Promise<string>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL as a string and returns its JSON.parse representation.
|
|
* @param url The URL to request from.
|
|
*/
|
|
export function getJSON<T>(url: string): Promise<T>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL as a string and returns its JSON.parse representation.
|
|
* @param options An object that specifies various request options.
|
|
*/
|
|
export function getJSON<T>(options: HttpRequestOptions): Promise<T>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL and attempts to decode it as an image.
|
|
* @param url The URL to request from.
|
|
*/
|
|
export function getImage(url: string): Promise<ImageSource>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL and attempts to decode it as an image.
|
|
* @param options An object that specifies various request options.
|
|
*/
|
|
export function getImage(options: HttpRequestOptions): Promise<ImageSource>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL and attempts to save it as file.
|
|
* @param url The URL to request from.
|
|
* @param destinationFilePath Optional. The downloaded file path.
|
|
*/
|
|
export function getFile(url: string, destinationFilePath?: string): Promise<any>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL and attempts to save it as file.
|
|
* @param options An object that specifies various request options.
|
|
* @param destinationFilePath Optional. The downloaded file path.
|
|
*/
|
|
export function getFile(options: HttpRequestOptions, destinationFilePath?: string): Promise<File>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL as binary and returns an ArrayBuffer.
|
|
* @param url The URL to request from.
|
|
*/
|
|
export function getBinary(url: string): Promise<ArrayBuffer>;
|
|
|
|
/**
|
|
* Downloads the content from the specified URL as binary and returns an ArrayBuffer.
|
|
* @param options An object that specifies various request options.
|
|
*/
|
|
export function getBinary(options: HttpRequestOptions): Promise<ArrayBuffer>;
|