2014-02-26 19:12:37 +00:00
|
|
|
//TODO comment everything
|
|
|
|
|
2014-02-28 16:32:43 +00:00
|
|
|
/**
|
|
|
|
* @module Typertext
|
|
|
|
* @submodule Http
|
|
|
|
* @submodule Json
|
|
|
|
*/
|
2014-02-26 19:12:37 +00:00
|
|
|
module Typertext {
|
|
|
|
import HttpMethod = Typertext.Http.HttpMethod;
|
|
|
|
import HttpPostData = Typertext.Http.HttpPostData;
|
|
|
|
import HttpUrl = Typertext.Http.HttpUrl;
|
|
|
|
|
2014-02-28 16:32:43 +00:00
|
|
|
/**
|
|
|
|
* A class to simplify passing both the status and data of a completed proxy request
|
|
|
|
*
|
|
|
|
* @interface GenericRequest
|
|
|
|
* @uses Typertext.Http.HttpMethod
|
|
|
|
* @uses Typertext.Http.HttpPostData
|
|
|
|
* @uses Typertext.Http.HttpUrl
|
|
|
|
*
|
|
|
|
* @author Kegan Myers <kegan@keganmyers.com>
|
|
|
|
* @version 0.2.1
|
|
|
|
*/
|
2014-02-26 19:12:37 +00:00
|
|
|
export interface GenericRequest<T extends GenericResponseHandler<GenericResponse<any>>> {
|
2014-02-28 16:32:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A convenience method which will simply use the RawRequest method with a GET
|
|
|
|
*
|
|
|
|
* @param {HttpUrl} request
|
|
|
|
* @param {GenericResponseHandler} callback
|
|
|
|
*/
|
2014-02-26 19:12:37 +00:00
|
|
|
Get(request:HttpUrl, callback:T):void;
|
|
|
|
|
2014-02-28 16:32:43 +00:00
|
|
|
/**
|
|
|
|
* A convenience method which will simply use the RawRequest method with a GET
|
|
|
|
*
|
|
|
|
* @param {HttpUrl} request
|
|
|
|
* @param {HttpPostData} postData
|
|
|
|
* @param {GenericResponseHandler} callback
|
|
|
|
*/
|
2014-02-26 19:12:37 +00:00
|
|
|
Post(request:HttpUrl, postData:HttpPostData, callback:T):void;
|
|
|
|
|
2014-02-28 16:32:43 +00:00
|
|
|
/**
|
|
|
|
* A method which calls the server and passes returned data to an optionally specified callback
|
|
|
|
*
|
|
|
|
* @param {HttpMethid} method
|
|
|
|
* @param {HttpUrl} request
|
|
|
|
* @param {HttpPostData} postData
|
|
|
|
* @param {GenericResponseHandler} callback
|
|
|
|
*/
|
2014-02-26 19:12:37 +00:00
|
|
|
RawRequest(method:HttpMethod, request:HttpUrl, postData?:HttpPostData, callback?:T):void;
|
|
|
|
}
|
|
|
|
}
|