Document JsonResponse

This commit is contained in:
Kegan Myers 2014-02-28 11:38:48 -06:00
parent 7d48dd705e
commit 3f6d28e0ee

View file

@ -1,13 +1,37 @@
/**
* Created by kegan on 2/26/14.
* @namespace Typertext
* @module Json
*/
module Typertext.Json {
import HttpResponse = Typertext.Http.HttpResponse;
import HttpResponseStatus = Typertext.Http.HttpResponseStatus;
import HttpHeaderData = Typertext.Http.HttpHeaderData;
export class JsonResponse extends Typertext.GenericResponse<JsonObject> {
public static fromHttpResponse(httpResponse:Typertext.Http.HttpResponse):JsonResponse {
/**
* This method handles converting a string into a parsed JSON object
*
* @param httpResponse
* @returns {JsonResponse}
*/
public static fromHttpResponse(httpResponse:HttpResponse):JsonResponse {
return new JsonResponse(httpResponse.GetStatus(), httpResponse.GetHeaders(), httpResponse.GetHttpStatus(), window["JSON"].parse(httpResponse.GetContent()));
}
constructor(status:Typertext.Http.HttpResponseStatus, responseHeaders?:Typertext.Http.HttpHeaderData, httpResponseCode?:number, responseBody?:JsonObject) {
/**
* A class that passes around a parsed JSON reponse from the server
*
* @class JsonResponse
* @param {HttpResponseStatus} status
* @param {HttpHeaderData} responseHeaders
* @param {number} httpResponseCode
* @param {JsonObject} responseBody
*
* @author Kegan Myers <kegan@keganmyers.com>
* @version 0.3.0
*/
constructor(status:HttpResponseStatus, responseHeaders?:HttpHeaderData, httpResponseCode?:number, responseBody?:JsonObject) {
super(status, responseHeaders, httpResponseCode, responseBody);
}
}