Added WebRequestExecutor definitions

This commit is contained in:
Patrick Magee
2014-03-19 09:11:48 +00:00
parent 44446bfc6c
commit 25a829db98
+112
View File
@@ -1654,6 +1654,7 @@ declare module Sys {
/**
* Provides the script API to make a Web request.
* @see {@link http://msdn.microsoft.com/en-us/library/bb310979(v=vs.100).aspx}
*/
class WebRequest {
@@ -1701,6 +1702,117 @@ declare module Sys {
//#endregion
}
/**
* Provides the abstract base class from which network executors derive.
* @see {@link http://msdn.microsoft.com/en-us/library/bb397434(v=vs.100).aspx}
*/
class WebRequestExecutor {
//#region Constructors
/**
* Initializes a Sys.Net.WebRequestExecutor instance when implemented in a derived class.
*/
constructor();
//#endregion
//#region Methods
/**
* Stops the pending network request issued by the executor.
* The specifics of aborting a request vary depending on how an executor is implemented.
* However, all executors that derive from WebRequestExecutor must set their state to aborted and must raise the completed event of the associated Sys.Net.WebRequest object.
* The executor properties do not contain consistent data after abort has been called.
*/
abort(): void;
/**
* Instructs the executor to execute a Web request.
* When this method is called, the executor packages the content of the Web request instance and initiates processing.
* This method is intended to be used by a custom executor. If you are implementing a custom executor, you instantiate the executor, assign it to the Web request instance, and then invoke the method on the executor instance.
* @see {@link http://msdn.microsoft.com/en-us/library/bb383834(v=vs.100).aspx}
*/
executeRequest(): void;
/**
* Gets all the response headers for the current request.
* If a request finished successfully and with valid response data, this method returns all the response headers.
* @return All the response headers
* @see {@link http://msdn.microsoft.com/en-us/library/bb310805(v=vs.100).aspx}
*/
getAllResponseHeaders(): string;
/**
* Gets the value of the specified response header.
* @return The specified response header.
*/
getResponseHeader(): string;
//#endregion
//#region Properties
/**
* Gets the JSON-evaluated object from the response.
* @return The JSON-evaluated response object.
*/
object(): any;
/**
* Gets a value indicating whether the request associated with the executor was aborted.
* When the current instance of the Sys.Net.WebRequestExecutor class is aborted, it must set its state to aborted and it must raise the completed event of the associated request object.
* @return true if the request associated with the executor was aborted; otherwise, false.
*/
get_aborted(): boolean;
/**
* Gets a value indicating whether the request completed successfully.
* Successful completion usually means a well-formed response was received by the executor.
* If a response was received, the current instance of the Sys.Net.WebRequestExecutor class must set its state to completed.
* It must also raise the completed event of the associated request object.
* @return true if the request completed successfully; otherwise, false.
*/
get_responseAvailable(): boolean;
/**
* Gets the text representation of the response body. When a request has completed successfully with valid response data, this property returns the text that is contained in the response body.
* @return The text representation of the response body.
*/
get_responseData(): string;
/**
* Returns a value indicating whether the executor has started processing the request.
* The executor returns true if substantial processing of the request has started. For executors that make network calls, substantial processing means that a network call has been started.
* @return true if the executor has started processing the request; otherwise, false.
*/
get_started(): boolean;
/**
* Gets a success status code.
* The statusCode property returns an integer that specifies that a request completed successfully and with valid response data.
* @return An integer that represents a status code.
*/
get_statusCode(): number;
/**
* Gets status information about a request that completed successfully.
* The statusText property returns status information if a request completed successfully and with valid response data.
* @return the status text
*/
get_statusText(): string;
/**
* Gets a value indicating whether the request timed out.
* Executors use the time-out information associated with the request to raise the completed event on the associated WebRequest object.
* @return true if the request timed out; otherwise, false.
*/
get_timedOut(): boolean;
/**
* Attempts to get the response to the current request as an XMLDOM object.
* If a request finished successfully with valid response data, this method tries to get the response as an XMLDOM object.
*/
get_xml(): XMLDocument;
/**
* Gets the WebRequest object associated with the executor.
* @return The WebRequest object associated with the current executor instance.
*/
get_webRequest(): Sys.Net.WebRequest;
//#endregion
}
}
//#endregion