com. kelvinluck. flashr. core. FlashrRequest

Class to hold information about requests to the Flickr API through Flashr

Licence

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.

Version

0.5.0

Author

Kelvin Luck < kelvin at kelvinluck dot com >

Project Website

http://flashr.kelvinluck.com/

Subversion Id

$Id: FlashrRequest.as 82 2006-09-10 18:43:14Z kluck $

Summary
com. kelvinluck. flashr. core. FlashrRequestClass to hold information about requests to the Flickr API through Flashr
methodThe Flickr API method associated with this request.
parametersThe parameters that will be passed to this request.
additionalArgumentsExtra information about the reuqest which isn’t held in the parameters variable but which is needed when the response is received.
requiresSigningWhether this API method requires signing.
completedWhether this request has been completed or not.
idThe unique ID associated with this request.
queueIdThe unique identifier which identifies this requests position in the FlashrRequestQueue
cancelledWhether this FlashrRequest has been cancelled.
querystringThe querystring part of the url that was used to make this request.
_requestsA static variable used to keep hold of all FlashrRequest Objects generated.
FlashrRequest
cloneCreates a copy of this FlashrRequest.
setPriorityIf this request is in the FlashrRequestQueue then sets it’s priority to the passed value.
_prepareQuerystringPrivate, internal function used to convert a list of arguments into a querystring for use in a URL for a call to flickr.com.
generateRequestStatic function which generates a new FlashrRequest object and returns it’s unique id.
getRequestStatic function which will return a reference to a FlashrRequest Object given it’s unique id.
toString

method

var method: String

The Flickr API method associated with this request.

parameters

var parameters: Object

The parameters that will be passed to this request.

additionalArguments

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.

requiresSigning

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.

completed

var completed: Boolean

Whether this request has been completed or not.

id

var id: Number

The unique ID associated with this request.

queueId

var queueId: Number

The unique identifier which identifies this requests position in the FlashrRequestQueue

cancelled

var cancelled: Boolean

Whether this FlashrRequest has been cancelled.

See Also

Flashr.cancelCurrentRequest

querystring

function get querystring():String

The querystring part of the url that was used to make this request.

_requests

private static var _requests: Array

A static variable used to keep hold of all FlashrRequest Objects generated.

FlashrRequest

private function FlashrRequest(method: String,
parameters: Object,
additionalArguments: Object,
requiresSigning: Boolean)
Private constructoruse 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.

Parameters

methodThe Flickr API Method this request should call.
parametersAny parameters that need to be passed to this method.
additionalArgumentsAny additional arguments which aren’t sent to flickr.com but which are necessary to know what to associate the response with.
requiresSigningWhether 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.

clone

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)

Returns

The new FlashrRequest object.

setPriority

function setPriority(priority: Number):Boolean

If this request is in the FlashrRequestQueue then sets it’s priority to the passed value.

Parameters

priorityThe priority you want to set this request to.

Returns

True if the request was not completed, was in the queue and had it’s priority changed, false otherwise

See Also

FlashrRequestQueue.setPriority

_prepareQuerystring

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).

Returns

The generated querystring.

generateRequest

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.

Parameters

methodThe Flickr API Method this request should call.
parametersAny parameters that need to be passed to this method.
additionalArgumentsAny additional arguments which aren’t sent to flickr.com but which are necessary to know what to associate the response with.
requiresSigningWhether 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.

Returns

The generated FlashrRequest

getRequest

static function getRequest(id: Number):FlashrRequest

Static function which will return a reference to a FlashrRequest Object given it’s unique id.

Parameters

idThe id of the FlashrRequest Object you want.

Returns

The relevant FlashrRequest Object or undefined if it was an illegal id.

toString

public function toString():String
var method: String
The Flickr API method associated with this request.
var parameters: Object
The parameters that will be passed to this request.
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.
var completed: Boolean
Whether this request has been completed or not.
var id: Number
The unique ID associated with this request.
var queueId: Number
The unique identifier which identifies this requests position in the FlashrRequestQueue
Handles the queue of FlashrRequest objects sent to the Flickr API.
var cancelled: Boolean
Whether this FlashrRequest has been cancelled.
private function FlashrRequest(method: String,
parameters: Object,
additionalArguments: Object,
requiresSigning: Boolean)
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.
function clone():FlashrRequest
Creates a copy of this FlashrRequest.
function setPriority(priority: Number):Boolean
If this request is in the FlashrRequestQueue then sets it’s priority to the passed value.
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.
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.
static function getRequest(id: Number):FlashrRequest
Static function which will return a reference to a FlashrRequest Object given it’s unique id.
public function toString():String
function cancelCurrentRequest()
If there is a FlashrRequest which has been made to flickr.com and hasn’t returned yet then mark it cancelled.
function setPriority(request: FlashrRequest,
priority: Number):Boolean
Sets the priority of the passed FlashrRequest to the passed value if the FlashrRequest is in the queue, otherwise returns false