com.phloxui
Version:
PhloxUI Ng2+ Framework
105 lines (104 loc) • 4.6 kB
TypeScript
import { RequestOptionsArgs, Response } from '@angular/http';
export declare const CONNECTION_DATA: string;
/**
* <p style="text-indent: 2em;">
* A <code>ng</code> service interface mainly handles the <code>application</code>'s connections. This service uses [[IBackgroundProcessManager]]
* as <code>background process</code> executor for non-blocking network I/O. So, you can get alive connections using [[getRunningProcesses]] or
* [[getRunningProcessesCount]] method. All connections created via this service will be monitored the <code>connection quality</code> which will
* be displayed on user's screen. You can get the <code>connection quality</code> of the <code>application</code> by using method [[getConnectionQuality]].
* </p>
*
* @author shiorin, tee4cute
*
* @see [[IBackgroundProcessManager]]
*/
export interface IConnectionManager {
getName(): string;
setName(name: string): any;
/**
* <p style="text-indent: 1em;">
* Send a <code>GET</code> request to the specified <code><b>url</b></code>.
* </p>
*/
get(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
getWithHttpInfo(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
/**
* <p style="text-indent: 1em;">
* Send <code>POST</code> request to the specified <code><b>url</b></code>.
* </p>
*/
post(url: string, body: any, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
postWithHttpInfo(url: string, body: any, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
/**
* <p style="text-indent: 1em;">
* Send <code>PUT</code> request to the specified <code><b>url</b></code>.
* </p>
*/
put(url: string, body: any, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
putWithHttpInfo(url: string, body: any, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
/**
* <p style="text-indent: 1em;">
* Send <code>DELETE</code> request to the specified <code><b>url</b></code>.
* </p>
*/
delete(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
deleteWithHttpInfo(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
/**
* <p style="text-indent: 1em;">
* Send <code>PATCH</code> request to the specified <code><b>url</b></code>.
* </p>
*/
patch(url: string, body: any, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
patchWithHttpInfo(url: string, body: any, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
/**
* <p style="text-indent: 1em;">
* Send <code>HEAD</code> request to the specified <code><b>url</b></code>.
* </p>
*/
head(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
headWithHttpInfo(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
/**
* <p style="text-indent: 1em;">
* Send <code>OPTIONS</code> request to the specified <code><b>url</b></code>.
* </p>
*/
options(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
optionsWithHttpInfo(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
request(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<any>;
requestWithHttpInfo(url: string, requestOptionsArgs: RequestOptionsArgs): Promise<Response>;
/**
* <p style="text-indent: 1em;">
* Get underlying <code>background process</code>es count of alive connections.
* </p>
*
* @return Returns <code>0</code> if there is no alive connections.
*/
getRunningProcessesCount(): number;
/**
* <p style="text-indent: 1em;">
* Get underlying <code>background process</code> models of alive connections.
* </p>
*
* @return Returns <code>empty array</code> if there is no alive connections.
*/
getRunningProcesses(): any[];
/**
* <p style="text-indent: 1em;">
* Get connection quality of the <code>application</code> indicated by values between [0, 100].
* </p>
*
* @return A percentage of connection quality.
*/
getConnectionQuality(): number;
setBaseURLs(urls: string[]): void;
resetBaseURLs(): void;
setDefaultHeader(key: string, value: string): void;
removeDefaultHeader(key: string): void;
resetDefaultHeaders(): void;
setSearch(key: string, value: any): void;
removeSearch(key: string): void;
resetSearch(): void;
setParam(key: string, value: any): void;
removeParam(key: string): void;
resetParams(): void;
}