Zend Framework  1.12
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Zend_Service_Flickr Class Reference

Public Member Functions

 __construct ($apiKey)
 Performs object initializations.
 
 tagSearch ($query, array $options=array())
 Find Flickr photos by tag.
 
 userSearch ($query, array $options=null)
 Finds photos by a user's username or email.
 
 groupPoolGetPhotos ($query, array $options=array())
 Finds photos in a group's pool.
 
 getIdByUsername ($username)
 Utility function to find Flickr User IDs for usernames.
 
 getIdByEmail ($email)
 Utility function to find Flickr User IDs for emails.
 
 getImageDetails ($id)
 Returns Flickr photo details by for the given photo ID.
 
 getRestClient ()
 Returns a reference to the REST client, instantiating it if necessary.
 

Public Attributes

const URI_BASE = 'http://www.flickr.com'
 Base URI for the REST client.
 
 $apiKey
 

Protected Member Functions

 _validateUserSearch (array $options)
 Validate User Search Options.
 
 _validateTagSearch (array $options)
 Validate Tag Search Options.
 
 _validateGroupPoolGetPhotos (array $options)
 Validate Group Search Options.
 
 _prepareOptions ($method, array $options, array $defaultOptions)
 Prepare options for the request.
 
 _compareOptions (array $options, array $validOptions)
 Throws an exception if and only if any user options are invalid.
 

Static Protected Member Functions

static _checkErrors (DOMDocument $dom)
 Throws an exception if and only if the response status indicates a failure.
 

Protected Attributes

 $_restClient = null
 

Constructor & Destructor Documentation

__construct (   $apiKey)

Performs object initializations.

# Sets up character encoding # Saves the API key

Parameters
string$apiKeyYour Flickr API key
Returns
void

Member Function Documentation

static _checkErrors ( DOMDocument  $dom)
staticprotected

Throws an exception if and only if the response status indicates a failure.

Parameters
DOMDocument$dom
Returns
void
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
_compareOptions ( array  $options,
array  $validOptions 
)
protected

Throws an exception if and only if any user options are invalid.

Parameters
array$optionsUser options
array$validOptionsValid options
Returns
void
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
_prepareOptions (   $method,
array  $options,
array  $defaultOptions 
)
protected

Prepare options for the request.

Parameters
string$methodFlickr Method to call
array$optionsUser Options
array$defaultOptionsDefault Options
Returns
array Merged array of user and default/required options
_validateGroupPoolGetPhotos ( array  $options)
protected

Validate Group Search Options.

Parameters
array$options
Exceptions
Zend_Service_Exception
Returns
void
See Also
Zend_Validate_Between
Zend_Service_Exception
Zend_Validate_Int
Zend_Service_Exception
Todo:
The following does not do anything [yet], so it is commented out.
_validateTagSearch ( array  $options)
protected

Validate Tag Search Options.

Parameters
array$options
Returns
void
Exceptions
Zend_Service_Exception
See Also
Zend_Validate_Between
Zend_Service_Exception
Zend_Validate_Int
Zend_Service_Exception
Todo:
The following does not do anything [yet], so it is commented out.
_validateUserSearch ( array  $options)
protected

Validate User Search Options.

Parameters
array$options
Returns
void
Exceptions
Zend_Service_Exception
See Also
Zend_Validate_Between
Zend_Service_Exception
Zend_Validate_Int
Zend_Service_Exception
Todo:
The following does not do anything [yet], so it is commented out.
getIdByEmail (   $email)

Utility function to find Flickr User IDs for emails.

(You can only find a user's photo with their NSID.)

Parameters
string$emailthe email
Returns
string the NSID (userid)
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
Zend_Service_Exception
getIdByUsername (   $username)

Utility function to find Flickr User IDs for usernames.

(You can only find a user's photo with their NSID.)

Parameters
string$usernamethe username
Returns
string the NSID (userid)
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
Zend_Service_Exception
getImageDetails (   $id)

Returns Flickr photo details by for the given photo ID.

Parameters
string$idthe NSID
Returns
array of Zend_Service_Flickr_Image, details for the specified image
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
Zend_Service_Flickr_Image
getRestClient ( )

Returns a reference to the REST client, instantiating it if necessary.

Returns
Zend_Rest_Client
See Also
Zend_Rest_Client
groupPoolGetPhotos (   $query,
array  $options = array() 
)

Finds photos in a group's pool.

Parameters
string$querygroup id
array$optionsAdditional parameters to refine your query.
Returns
Zend_Service_Flickr_ResultSet
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
Zend_Service_Exception
Zend_Service_Flickr_ResultSet
tagSearch (   $query,
array  $options = array() 
)

Find Flickr photos by tag.

Query options include:

# per_page: how many results to return per query # page: the starting page offset. first result will be (page - 1) * per_page + 1 # tag_mode: Either 'any' for an OR combination of tags, or 'all' for an AND combination. Default is 'any'. # min_upload_date: Minimum upload date to search on. Date should be a unix timestamp. # max_upload_date: Maximum upload date to search on. Date should be a unix timestamp. # min_taken_date: Minimum upload date to search on. Date should be a MySQL datetime. # max_taken_date: Maximum upload date to search on. Date should be a MySQL datetime.

Parameters
string | array$queryA single tag or an array of tags.
array$optionsAdditional parameters to refine your query.
Returns
Zend_Service_Flickr_ResultSet
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
Zend_Service_Flickr_ResultSet
userSearch (   $query,
array  $options = null 
)

Finds photos by a user's username or email.

Additional query options include:

# per_page: how many results to return per query # page: the starting page offset. first result will be (page - 1) * per_page + 1 # min_upload_date: Minimum upload date to search on. Date should be a unix timestamp. # max_upload_date: Maximum upload date to search on. Date should be a unix timestamp. # min_taken_date: Minimum upload date to search on. Date should be a MySQL datetime. # max_taken_date: Maximum upload date to search on. Date should be a MySQL datetime.

Parameters
string$queryusername or email
array$optionsAdditional parameters to refine your query.
Returns
Zend_Service_Flickr_ResultSet
Exceptions
Zend_Service_Exception
See Also
Zend_Service_Exception
Zend_Service_Flickr_ResultSet

Member Data Documentation

$_restClient = null
protected
$apiKey
const URI_BASE = 'http://www.flickr.com'

Base URI for the REST client.