Class to hold information about requests to the Flickr API through Flashr
This code and documentation is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0. http://creativecommons.org/licenses/by-nc-sa/2.0/
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0.5.0
Kelvin Luck < kelvin at kelvinluck dot com >
$Id: FlashrRequest.as 82 2006-09-10 18:43:14Z kluck $
| com. kelvinluck. flashr. core. FlashrRequest | Class to hold information about requests to the Flickr API through Flashr |
| method | The Flickr API method associated with this request. |
| parameters | The parameters that will be passed to this request. |
| additionalArguments | Extra information about the reuqest which isn’t held in the parameters variable but which is needed when the response is received. |
| requiresSigning | Whether this API method requires signing. |
| completed | Whether this request has been completed or not. |
| id | The unique ID associated with this request. |
| queueId | The unique identifier which identifies this requests position in the FlashrRequestQueue |
| cancelled | Whether this FlashrRequest has been cancelled. |
| querystring | The querystring part of the url that was used to make this request. |
| _requests | A static variable used to keep hold of all FlashrRequest Objects generated. |
| FlashrRequest | |
| clone | Creates a copy of this FlashrRequest. |
| setPriority | If this request is in the FlashrRequestQueue then sets it’s priority to the passed value. |
| _prepareQuerystring | Private, internal function used to convert a list of arguments into a querystring for use in a URL for a call to flickr.com. |
| generateRequest | Static function which generates a new FlashrRequest object and returns it’s unique id. |
| getRequest | Static function which will return a reference to a FlashrRequest Object given it’s unique id. |
| toString |
var additionalArguments: Object
Extra information about the reuqest which isn’t held in the parameters variable but which is needed when the response is received.
var requiresSigning: Boolean
Whether this API method requires signing. Used by methods such as flickr.auth.getFrob which need to be signed but are called before the user is auth’d. Once a user is auth’d then all methods are automatically signed.
var queueId: Number
The unique identifier which identifies this requests position in the FlashrRequestQueue
function get querystring():String
The querystring part of the url that was used to make this request.
private static var _requests: Array
A static variable used to keep hold of all FlashrRequest Objects generated.
private function FlashrRequest( method: String, parameters: Object, additionalArguments: Object, requiresSigning: Boolean )
| Private constructor | use generateRequest to create FlashrRequest Objects as this will generate the relevant unique ID that you will need to manipulate this request at a later date. |
| method | The Flickr API Method this request should call. |
| parameters | Any parameters that need to be passed to this method. |
| additionalArguments | Any additional arguments which aren’t sent to flickr.com but which are necessary to know what to associate the response with. |
| requiresSigning | Whether the called method requires signing. Used by methods such as flickr.auth.getFrob which need to be signed but are called before the user is auth’d. Once a user is auth’d then all methods are automatically signed. |
function clone():FlashrRequest
Creates a copy of this FlashrRequest. Useful if you want to take the last request and change just one parameter (e.g. the page number to skip through pages of results)
The new FlashrRequest object.
function setPriority( priority: Number ):Boolean
If this request is in the FlashrRequestQueue then sets it’s priority to the passed value.
| priority | The priority you want to set this request to. |
True if the request was not completed, was in the queue and had it’s priority changed, false otherwise
private function _prepareQuerystring()
Private, internal function used to convert a list of arguments into a querystring for use in a URL for a call to flickr.com. Deals with signing the call as necessary. Can also be used when a signed querystring is needed outside of the API (e.g. for uploading).
The generated querystring.
static function generateRequest( method: String, parameters: Object, additionalArguments: Object, requiresSigning: Boolean ):FlashrRequest
Static function which generates a new FlashrRequest object and returns it’s unique id.
| method | The Flickr API Method this request should call. |
| parameters | Any parameters that need to be passed to this method. |
| additionalArguments | Any additional arguments which aren’t sent to flickr.com but which are necessary to know what to associate the response with. |
| requiresSigning | Whether the called method requires signing. Used by methods such as flickr.auth.getFrob which need to be signed but are called before the user is auth’d. Once a user is auth’d then all methods are automatically signed. |
The generated FlashrRequest
static function getRequest( id: Number ):FlashrRequest
Static function which will return a reference to a FlashrRequest Object given it’s unique id.
| id | The id of the FlashrRequest Object you want. |
The relevant FlashrRequest Object or undefined if it was an illegal id.
The Flickr API method associated with this request.
var method: String
The parameters that will be passed to this request.
var parameters: Object
Extra information about the reuqest which isn’t held in the parameters variable but which is needed when the response is received.
var additionalArguments: Object
Whether this API method requires signing.
var requiresSigning: Boolean
Whether this request has been completed or not.
var completed: Boolean
The unique ID associated with this request.
var id: Number
The unique identifier which identifies this requests position in the FlashrRequestQueue
var queueId: Number
Whether this FlashrRequest has been cancelled.
var cancelled: Boolean
private function FlashrRequest( method: String, parameters: Object, additionalArguments: Object, requiresSigning: Boolean )
The querystring part of the url that was used to make this request.
function get querystring():String
A static variable used to keep hold of all FlashrRequest Objects generated.
private static var _requests: Array
Creates a copy of this FlashrRequest.
function clone():FlashrRequest
If this request is in the FlashrRequestQueue then sets it’s priority to the passed value.
function setPriority( priority: Number ):Boolean
Private, internal function used to convert a list of arguments into a querystring for use in a URL for a call to flickr.com.
private function _prepareQuerystring()
Static function which generates a new FlashrRequest object and returns it’s unique id.
static function generateRequest( method: String, parameters: Object, additionalArguments: Object, requiresSigning: Boolean ):FlashrRequest
Static function which will return a reference to a FlashrRequest Object given it’s unique id.
static function getRequest( id: Number ):FlashrRequest
public function toString():String
If there is a FlashrRequest which has been made to flickr.com and hasn’t returned yet then mark it cancelled.
function cancelCurrentRequest()
Sets the priority of the passed FlashrRequest to the passed value if the FlashrRequest is in the queue, otherwise returns false
function setPriority( request: FlashrRequest, priority: Number ):Boolean