Document GenericResponse, remove SetdData, bump version
This commit is contained in:
parent
d15b8a9149
commit
66ddf14b73
|
@ -29,6 +29,9 @@ This project is licensed under the MIT license, the text of which can be read in
|
|||
|
||||
Changelog
|
||||
---------
|
||||
####0.3.0
|
||||
- Removed SetData from GenericResponse
|
||||
- Added documentation
|
||||
####0.2.1
|
||||
- Renamed some functions
|
||||
- Pulled decoding of URL encoded objects into own function
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Typertext",
|
||||
"version": "0.2.1",
|
||||
"version": "0.3.0",
|
||||
"homepage": "https://github.com/terribleplan/Typertext",
|
||||
"authors": [
|
||||
"Kegan Myers <kegan@keganmyers.com>"
|
||||
|
|
|
@ -17,7 +17,7 @@ module Typertext {
|
|||
* @uses Typertext.Http.HttpUrl
|
||||
*
|
||||
* @author Kegan Myers <kegan@keganmyers.com>
|
||||
* @version 0.2.1
|
||||
* @version 0.3.0
|
||||
*/
|
||||
export interface GenericRequest<T extends GenericResponseHandler<GenericResponse<any>>> {
|
||||
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
/**
|
||||
* @module Typertext
|
||||
* @submodule Http
|
||||
* @submodule Json
|
||||
*/
|
||||
module Typertext {
|
||||
import HttpHeaderData = Typertext.Http.HttpHeaderData;
|
||||
import HttpResponseStatus = Typertext.Http.HttpResponseStatus;
|
||||
|
@ -8,6 +13,22 @@ module Typertext {
|
|||
private httpStatus:number;
|
||||
private content:T;
|
||||
|
||||
/**
|
||||
* A common way to specify a response that gets passed between classes and eventually returned to the user
|
||||
*
|
||||
* @class GenericResponse
|
||||
* @uses Typertext.Http.HttpHeaderData
|
||||
* @uses Typertext.Http.HttpResponseStatus
|
||||
*
|
||||
* @param {HttpResponseStatus} status
|
||||
* @param {HttpHeaderData} responseHeaders
|
||||
* @param {number} httpResponseCode
|
||||
* @param {T} responseBody
|
||||
* @constructor
|
||||
*
|
||||
* @author Kegan Myers <kegan@keganmyers.com>
|
||||
* @version 0.3.0
|
||||
*/
|
||||
constructor(status:HttpResponseStatus, responseHeaders?:HttpHeaderData, httpResponseCode?:number, responseBody?:T) {
|
||||
this.status = status;
|
||||
this.headers = responseHeaders;
|
||||
|
@ -15,28 +36,53 @@ module Typertext {
|
|||
this.content = responseBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor method
|
||||
*
|
||||
* @returns {T}
|
||||
*/
|
||||
public GetContent():T {
|
||||
return this.content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor method
|
||||
*
|
||||
* @returns {string}
|
||||
* @constructor
|
||||
*/
|
||||
public GetContentType():string {
|
||||
return this.GetHeaders()["Content-Type"];
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor method
|
||||
*
|
||||
* @returns {HttpHeaderData}
|
||||
* @constructor
|
||||
*/
|
||||
public GetHeaders():HttpHeaderData {
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor method
|
||||
*
|
||||
* @returns {number}
|
||||
* @constructor
|
||||
*/
|
||||
public GetHttpStatus():number {
|
||||
return this.httpStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor method
|
||||
*
|
||||
* @returns {HttpResponseStatus}
|
||||
* @constructor
|
||||
*/
|
||||
public GetStatus():HttpResponseStatus {
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public SetContent(content:T):void {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
"type" : "git",
|
||||
"url" : "https://github.com/terribleplan/Typertext.git"
|
||||
},
|
||||
"version": "0.2.1",
|
||||
"version": "0.3.0",
|
||||
"devDependencies": {
|
||||
"grunt": "~0.4.2",
|
||||
"grunt-typescript": "~0.2.7"
|
||||
|
|
Reference in a new issue