com. kelvinluck. flickr. Flickr

Class to provide an interface to the Flickr API

This class in combination with FlickrResponseListener provides a convienient way to interact with the Flickr API from AS 2.  The implementation should abstract away any processing of XML and allow for type checking in the functions you override in FlickrResponseListener.  The idea is to make flash code which interacts with the Flickr API quicker and easier to write.

This is still very alpha so feedback is greatfully received :)

This code is licensed under a Creative Commons License.  http://creativecommons.org/licenses/by-nc-sa/2.0/

Usage

Very simple usage example -- in the real world you would either subclass FlickrResponseListener to add functionality you required or override the method you were interested in.

import com.kelvinluck.flickr.Flickr;
import com.kelvinluck.flickr.FlickrResponseListener;

var _flickr:Flickr = Flickr.getFlickr();
_flickrResponseListener = new FlickrResponseListener();
_flickr.apiKey = "***";
_flickr.testEcho("one", 2, "free");

This example shows how you would override the method you were interested in:

import com.kelvinluck.flickr.Flickr;
import com.kelvinluck.flickr.FlickrResponseListener;

var _flickr:Flickr = Flickr.getFlickr();
_flickrResponseListener = new FlickrResponseListener();
_flickrResponseListener.onTestEcho = function(params:Object) {
// do stuff
}
_flickr.apiKey = "***";
_flickr.testEcho("one", 2, "free");

See Also

FlickrResponseListener

http://www.flickr.com/services/api/

Version

0.1.0

Author

Kelvin Luck < kelvin at kelvinluck dot com >

Summary
Class to provide an interface to the Flickr API
Your Flickr API Key.
The place for all API calls to connect to.
The API is already waiting for the response to a method call so cannot make another call
Could not connect to the server (e.g.
The XML returned by the server wasn’t in a &lt;rsp /&gt; tag.
The user wasn’t logged in and tried to access a method that requires authentication (returned from flickr.com)
The API key sent to flickr was invalid (returned from flickr.com)
There was no errors and valid XML was returned.
A constant representing permissions for nobody.
A constant representing permissions for friends and family.
A constant representing permissions for contacts.
A constant representing permissions for everybody.
The email address to use when accessing methods that require user authentication.
The password to use when accessing methods that require user authentication.
Constructor - as this class implements the Singleton pattern do not call directly but rather access through Flickr.getFlickr.
Calls flickr.contacts.getList to get a list of contacts for the calling user.
Calls flickr.contacts.getPublicList to get a list of contacts a user.
Calls flickr.favorites.add to add a photo to a user’s favorites list.
Calls flickr.favorites.getList to get a list of the user’s favorite photos.
Calls flickr.favorites.getPublicList to get a list of favorite public photos for the given user.
Calls flickr.favorites.remove to remove a photo from a user’s favorites list.
Calls flickr.people.findByEmail to get a user’s NSID, given their email address.
Calls flickr.people.findByUsername to get a user’s NSID, given their username.
Calls flickr.people.getInfo to get information about a user.
Calls flickr.people.getOnlineList to get a list of all online users.
Calls flickr.people.getPublicGroups to get the list of public groups a user is a member of.
Calls flickr.people.getPublicPhotos to get a list of public photos for the given user.
Calls flickr.photos.addTags to add tags to a given photo.
Calls flickr.photos.getContactsPhotos to fetch a list of recent photos from the calling users’ contacts.
Calls flickr.photos.getContactsPublicPhotos to fetch a list of recent public photos from a users’ contacts.
Calls flickr.photos.getContext to return next and previous photos for a photo in a photostream.
Calls flickr.photos.getCounts to get a list of photo counts for the given date ranges for the calling user.
Calls flickr.photos.getExif to return a list of EXIF/TIFF/GPS tags for a given photo.
Calls flickr.photos.getInfo to get information about a photo..
Calls flickr.photos.getNotInSet to get a list of your photos that are not part of any sets.
Calls flickr.photos.getPerms to get permissions for a photo.
Calls flickr.photos.getRecent to get a list of the latest public photos uploaded to flickr.
Calls flickr.photos.getRecent to get the available sizes for a photo.
Calls flickr.photos.getUntagged to get a list of your photos with no tags.
Calls flickr.photos.removeTag to remove a tag from a photo.
Calls flickr.photos.search to get a list of photos matching some criteria.
Calls flickr.photos.setDates to set one or both of the dates for a photo..
Calls flickr.photos.setMeta to set the meta information for a photo.
Calls flickr.photos.setPerms to set permissions for a photo..
Calls flickr.photos.setTags to set the tags for a photo.
Calls flickr.tags.getListPhoto to get the tag list for a given photo.
Calls flickr.tags.getListUser to get the tag list for a given user (or the currently logged in user).
Calls flickr.tags.getListUserPopular to get the popular tags for a given user (or the currently logged in user).
Calls flickr.tags.getRelated to get a list of tags ‘related’ to the given tag, based on clustered usage analysis.
Calls flickr.test.echo - forwards any arguments on to the Flickr API
Calls flickr.test.login - A testing method which checks if the caller is logged in then returns their username.
Used to call a method on the flickr API.
Called internally on recepit of a response from a request to the REST_ENDPOINT.
Private internal function used to avoid duplicate code to parse “the standard photo list xml”
Returns a reference to the Flickr instance - if none exists yet then creates one and returns a reference to that.

Variables

_flickr

private static var _flickr: Flickr

apiKey

Your Flickr API Key.  None of the method calls will work without this.

_apiKey

private var _apiKey: String

REST_ENDPOINT

The place for all API calls to connect to.  The default value of connecting directly to the flickr.com server will only work if a relevant entry is added to their crossdomain.xml file otherwise set the value to the location of a proxy script on your server.

_REST_ENDPOINT

private var _REST_ENDPOINT: String

awaitingResponse

private var awaitingResponse: Boolean

_restXML

private var _restXML: XML

_calledMethod

private var _calledMethod: String

_additionalArgs

private var _additionalArgs: Object

_email

private var _email: String

_password

private var _password: String

STATUS_BUSY

public static var STATUS_BUSY: Number

The API is already waiting for the response to a method call so cannot make another call

STATUS_BUSY_DESCRIPTION

public static var STATUS_BUSY_DESCRIPTION: String

STATUS_ERROR_CONNECTING

public static var STATUS_ERROR_CONNECTING: Number

Could not connect to the server (e.g. no internet connection, server down, security restrictions)

STATUS_ERROR_CONNECTING_DESCRIPTION

public static var STATUS_ERROR_CONNECTING_DESCRIPTION: String

STATUS_INVALID_XML

public static var STATUS_INVALID_XML: Number

The XML returned by the server wasn’t in a &lt;rsp /&gt; tag.

STATUS_INVALID_XML_DESCRIPTION

public static var STATUS_INVALID_XML_DESCRIPTION: String

STATUS_USER_NOT_LOGGED_IN

public static var STATUS_USER_NOT_LOGGED_IN: Number

The user wasn’t logged in and tried to access a method that requires authentication (returned from flickr.com)

STATUS_INVALID_API_KEY

public static var STATUS_INVALID_API_KEY: Number

The API key sent to flickr was invalid (returned from flickr.com)

STATUS_OK

public static var STATUS_OK: Number

There was no errors and valid XML was returned.

PERM_NOBODY

public static var PERM_NOBODY: Number

A constant representing permissions for nobody.

See Also

photosSetPerms

PERM_FRIENDS

public static var PERM_FRIENDS: Number

A constant representing permissions for friends and family.

See Also

photosSetPerms

PERM_CONTACTS

public static var PERM_CONTACTS: Number

A constant representing permissions for contacts.

See Also

photosSetPerms

PERM_EVERYBODY

public static var PERM_EVERYBODY: Number

A constant representing permissions for everybody.

See Also

photosSetPerms

Properties

email

public function set email(email: String):Void

The email address to use when accessing methods that require user authentication.

password

public function set password(password: String):Void

The password to use when accessing methods that require user authentication.

Functions

Flickr

private function Flickr()

Constructor - as this class implements the Singleton pattern do not call directly but rather access through Flickr.getFlickr.

contactsGetList

public function contactsGetList()

Calls flickr.contacts.getList to get a list of contacts for the calling user.

See Also

FlickrResponseListener.onContactsGetList

http://flickr.com- /services- /api- /flickr.contacts.getList.html

contactsGetPublicList

public function contactsGetPublicList(nsid: String)

Calls flickr.contacts.getPublicList to get a list of contacts a user.

Parameters

nsidThe nsid of the user whose contacts you want to get.

See Also

FlickrResponseListener.onContactsGetPublicList

http://flickr.com- /services- /api- /flickr.contacts.getPublicList.html

favoritesAdd

public function favoritesAdd(photoId: Number,
email: String,
password: String)

Calls flickr.favorites.add to add a photo to a user’s favorites list.

TODO

Doesn’t currently add the Photo to the Person._favorites Object as we don’t have and actual Person object for the calling user.  Is there a way around this?  Or maybe we don’t want to do this as the Person._favorites Object isn’t necessarily up to date anyway...

Parameters

photoIdThe id of the photo you want to add.
emailThe email address of the user whose favourites you want to add to [Optional: default=<email>]
passwordThe password of the user whose favourites you want to add to [Optional: default=<password>]

See Also

FlickrResponseListener.onFavoritesAdd

http://www.flickr.com- /services- /api- /flickr.favorites.add.html

favoritesGetList

public function favoritesGetList(userId: String,
perPage: Number,
page: Number,
email: String,
password: String)

Calls flickr.favorites.getList to get a list of the user’s favorite photos.

Parameters

userIdThe id of the user to get favourites for [Optional: default=logged in user]
perPageThe number of results to get per page [Optional: default=100]
pageThe page of results to get [Optional: default=1]
emailThe email address of the user whose favourites you want to add to [Optional: default=<email>]
passwordThe password of the user whose favourites you want to add to [Optional: default=<password>]

See Also

FlickrResponseListener.onFavoritesGetList

http://www.flickr.com- /services- /api- /flickr.favorites.getList.html

favoritesGetPublicList

public function favoritesGetPublicList(userId: String,
perPage: Number,
page: Number)

Calls flickr.favorites.getPublicList to get a list of favorite public photos for the given user.

Parameters

userIdThe id of the user to get favourites for
perPageThe number of results to get per page [Optional: default=100]
pageThe page of results to get [Optional: default=1]

See Also

FlickrResponseListener.onFavoritesGetPublicList

http://www.flickr.com- /services- /api- /flickr.favorites.getPublicList.html

favoritesRemove

public function favoritesRemove(photoId: Number,
email: String,
password: String)

Calls flickr.favorites.remove to remove a photo from a user’s favorites list.

TODO

Doesn’t currently remove the Photo from the Person._favorites Object as we don’t have and actual Person object for the calling user.  Is there a way around this?  Or maybe we don’t want to do this as the Person._favorites Object isn’t necessarily up to date anyway...

Parameters

photoIdThe id of the photo you want to add.
emailThe email address of the user whose favourites you want to add to [Optional: default=<email>]
passwordThe password of the user whose favourites you want to add to [Optional: default=<password>]

See Also

FlickrResponseListener.onFavoritesRemove

http://www.flickr.com- /services- /api- /flickr.favorites.remove.html

peopleFindByEmail

function peopleFindByEmail(email: String)

Calls flickr.people.findByEmail to get a user’s NSID, given their email address.

Parameters

emailThe email address of the person whose nsid you want

See Also

FlickrResponseListener.onPeopleFindByEmail

http://flickr.com- /services- /api- /flickr.people.findByEmail.html

peopleFindByUsername

function peopleFindByUsername(username: String)

Calls flickr.people.findByUsername to get a user’s NSID, given their username.

Parameters

usernameThe username of the person whose nsid you want

See Also

FlickrResponseListener.onPeopleFindByUsername

http://flickr.com- /services- /api- /flickr.people.findByUsername.html

peopleGetInfo

function peopleGetInfo(nsid: String)

Calls flickr.people.getInfo to get information about a user.

Parameters

nsidThe nsid of the user you want information about.

See Also

FlickrResponseListener.onPeopleGetInfo

http://flickr.com- /services- /api- /flickr.people.getInfo.html

peopleGetOnlineList

function peopleGetOnlineList()

Calls flickr.people.getOnlineList to get a list of all online users.

Online in this instance refers to the Flickr Live system (http://flickr.com/_chat/chat.gne)

See Also

FlickrResponseListener.onPeopleGetOnlineList

http://flickr.com- /services- /api- /flickr.people.getOnlineList.html

peopleGetPublicGroups

function peopleGetPublicGroups(nsid: String)

Calls flickr.people.getPublicGroups to get the list of public groups a user is a member of.

Parameters

nsidThe nsid of the user whose groups you want to know about.

See Also

FlickrResponseListener.onPeopleGetPublicGroups

http://www.flickr.com- /services- /api- /flickr.people.getPublicGroups.html

peopleGetPublicPhotos

function peopleGetPublicPhotos(nsid: String,
perPage: Number,
page: Number)

Calls flickr.people.getPublicPhotos to get a list of public photos for the given user.

Parameters

nsidThe nsid of the user whose photos you want to know about.
perPageThe number of photos to return per page.  [Optional: default=100]
pageThe page of results to return.  [Optional: default=1]

See Also

FlickrResponseListener.onPeopleGetPublicPhotos

http://flickr.com- /services- /api- /flickr.people.getPublicPhotos.html

photosAddTags

function photosAddTags (photoId: Number,
tags: String,
email: String,
password: String)

Calls flickr.photos.addTags to add tags to a given photo.

Parameters

photoIdThe id of the photo to add tags to.
tagsThe tags to add to the photo.
emailThe email address of the user whose favourites you want to add to [Optional: default=<email>]
passwordThe password of the user whose favourites you want to add to [Optional: default=<password>]

See Also

FlickrResponseListener.onPhotosAddTags

http://flickr.com- /services- /api- /flickr.photos.addTags.html

photosGetContactsPhotos

function photosGetContactsPhotos (count: Number,
justFriends: Boolean,
singlePhoto: Boolean,
includeSelf: Boolean,
email: String,
password: String)

Calls flickr.photos.getContactsPhotos to fetch a list of recent photos from the calling users’ contacts.

Parameters

countNumber of photos to return.  Defaults to 10, maximum 50.  This is only used if single_photo is not passed.
justFriendsset as 1 to only show photos from friends and family (excluding regular contacts).  [Optional: default=0].
singlePhotoOnly fetch one photo (the latest) per contact, instead of all photos in chronological order [Optional: default=0].
includeSelfSet to 1 to include photos from the calling user.  [Optional: default=0].
emailThe email address of the user whose favourites you want to add to [Optional: default=<email>]
passwordThe password of the user whose favourites you want to add to [Optional: default=<password>]

See Also

FlickrResponseListener.onPhotosGetContactsPhotos

http://flickr.com- /services- /api- /flickr.photos.getContactsPhotos.html

photosGetContactsPublicPhotos

function photosGetContactsPublicPhotos (nsid: String,
count: Number,
justFriends: Boolean,
singlePhoto: Boolean,
includeSelf: Boolean)

Calls flickr.photos.getContactsPublicPhotos to fetch a list of recent public photos from a users’ contacts.

Parameters

nsidThe NSID of the user to fetch photos for.
countNumber of photos to return.  Defaults to 10, maximum 50.  This is only used if single_photo is not passed.
justFriendsset as 1 to only show photos from friends and family (excluding regular contacts).  [Optional: default=0].
singlePhotoOnly fetch one photo (the latest) per contact, instead of all photos in chronological order [Optional: default=0].
includeSelfSet to 1 to include photos from the calling user.  [Optional: default=0].

See Also

FlickrResponseListener.onPhotosGetContactsPublicPhotos

http://www.flickr.com- /services- /api- /flickr.photos.getContactsPublicPhotos.html

photosGetContext

function photosGetContext (photoId: Number)

Calls flickr.photos.getContext to return next and previous photos for a photo in a photostream.

Parameters

photoIdThe id of the photo to fetch the context for.

See Also

FlickrResponseListener.onPhotosGetContext

http://www.flickr.com- /services- /api- /flickr.photos.getContext.html

photosGetCounts

function photosGetCounts (dates: String,
takenDates: String,
email: String,
password: String)

Calls flickr.photos.getCounts to get a list of photo counts for the given date ranges for the calling user.

Parameters

datesA comma delimited list of unix timestamps denoting the periods to return counts for.  They should be specified smallest first.  [Optional: if not present then takenDates used instead.
takenDatesA comma delimited list of mysql datetimes denoting the periods to return counts for.  They should be specified smallest first.  [Optional: if not present then dates used instead.
emailThe email address of the user whose photos you want to count [Optional: default=<email>]
passwordThe password of the user whose photos you want to count [Optional: default=<password>]

Note

  • The dates parameter is passed as UNIX Timestamps while the takenDates parameter is passed as MySQL Timestamps (e.g.  2005-03-21).
  • If you want to pass takenDates then pass “” (empty string) or undefined as the value of dates.

TODO

Should we change this method to accept Arrays of Date Objects rather than comma delimited Strings?  Then we could sort it making order unimportant and could abstract away the fact that Flickr stores dates uploaded and dates taken in different formats.  Maybe it would be better if the methods first two arguments were dates (an Array of Date Objects) and type (Flickr.DATES_UPLOADED or Flickr.DATES_TAKEN)?

See Also

FlickrResponseListener.onPhotosGetCounts

http://www.flickr.com- /services- /api- /flickr.photos.getCounts.html

photosGetExif

function photosGetExif (photoId: Number,
secret: String)

Calls flickr.photos.getExif to return a list of EXIF/TIFF/GPS tags for a given photo.

Parameters

photoIdThe id of the photo to fetch the context for.
secretThe secret for the photo.  If the correct secret is passed then permissions checking is skipped.  This enables the ‘sharing’ of individual photos by passing around the id and secret.

See Also

FlickrResponseListener.onPhotosGetExif

ExifData

http://www.flickr.com- /services- /api- /flickr.photos.getExif.html

photosGetInfo

function photosGetInfo (photoId: Number,
secret: Number)

Calls flickr.photos.getInfo to get information about a photo..

Parameters

photoIdThe id of the photo to fetch the context for.
secretThe secret for the photo.  If the correct secret is passed then permissions checking is skipped.  This enables the ‘sharing’ of individual photos by passing around the id and secret.

See Also

FlickrResponseListener.onPhotosGetInfo

http://www.flickr.com- /services- /api- /flickr.photos.getInfo.html

photosGetNotInSet

function photosGetNotInSet (perPage: Number,
page: Number)

Calls flickr.photos.getNotInSet to get a list of your photos that are not part of any sets.

Parameters

perPageThe number of photos to return per page.  [Optional: default=100]
pageThe page of results to return.  [Optional: default=1]

See Also

FlickrResponseListener.onPhotosGetNotInSet

http://www.flickr.com- /services- /api- /flickr.photos.getNotInSet.html

photosGetPerms

function photosGetPerms (photoId: Number)

Calls flickr.photos.getPerms to get permissions for a photo.

Parameters

photoIdThe id of the photo whose permissions you want

See Also

FlickrResponseListener.onPhotosGetNotInSet

http://www.flickr.com- /services- /api- /flickr.photos.getPerms.html

photosGetRecent

function photosGetRecent (perPage: Number,
page: Number)

Calls flickr.photos.getRecent to get a list of the latest public photos uploaded to flickr.

Parameters

perPageThe number of photos to return per page.  [Optional: default=100]
pageThe page of results to return.  [Optional: default=1]

See Also

FlickrResponseListener.onPhotosGetRecent

http://www.flickr.com- /services- /api- /flickr.photos.getRecent.html

photosGetSizes

function photosGetSizes (photoId: Number)

Calls flickr.photos.getRecent to get the available sizes for a photo.

Parameters

photoIdThe id of the photo to fetch size information for.

See Also

FlickrResponseListener.onPhotosGetSizes

http://www.flickr.com- /services- /api- /flickr.photos.getSizes.html

photosGetUntagged

function photosGetUntagged (perPage: Number,
page: Number)

Calls flickr.photos.getUntagged to get a list of your photos with no tags.

Parameters

perPageThe number of photos to return per page.  [Optional: default=100]
pageThe page of results to return.  [Optional: default=1]

See Also

FlickrResponseListener.onPhotosGetUntagged

http://www.flickr.com- /services- /api- /flickr.photos.getUntagged.html

photosRemoveTag

function photosRemoveTag (tagId: Number)

Calls flickr.photos.removeTag to remove a tag from a photo.

Parameters

tagIdThe tag to remove from the photo.  This parameter should contain a tag id, as returned by photosGetInfo.

See Also

FlickrResponseListener.onPhotosRemoveTag

http://www.flickr.com- /services- /api- /flickr.photos.removeTag.html

photosSearch

function photosSearch (params)

Calls flickr.photos.search to get a list of photos matching some criteria.

You pass an object with one or many of the following attributes...

Attributes

user_idThe NSID of the user who’s photo to search.  If this parameter isn’t passed then everybody’s public photos will be searched.
tagsA comma-delimited list of tags.  Photos with one or more of the tags listed will be returned.
tagModeEither ‘any’ for an OR combination of tags, or ‘all’ for an AND combination.  Defaults to ‘any’ if not specified.
textA free text search.  Photos who’s title, description or tags contain the text will be returned.
min_upload_dateMinimum upload date.  Photos with an upload date greater than or equal to this value will be returned.  The date should be in the form of a UNIX timestamp.
max_upload_dateMaximum upload date.  Photos with an upload date less than or equal to this value will be returned.  The date should be in the form of a UNIX timestamp.
min_taken_dateMinimum taken date.  Photos with an taken date greater than or equal to this value will be returned.  The date should be in the form of a MySQL datetime.
max_taken_dateMaximum taken date.  Photos with an taken date less than or equal to this value will be returned.  The date should be in the form of a MySQL datetime.
licenseThe license id for photos.
extrasA comma-delimited list of extra information to fetch for each returned record.  Currently supported fields are: license, date_upload, date_taken, owner_name, icon_server
per_pageNumber of photos to return per page.  If this argument is ommited, it defaults to 100.  The maximum allowed value is 500.
pageThe page of results to return.  If this argument is ommited, it defaults to 1.
sortThe order in which to sort returned photos.  Deafults to date-posted-desc.  The possible values are: date-posted-asc, date-posted-desc, date-taken-asc and date-taken-desc

TODO

Should probably change it to accept dates as Date Objects...  Then you wouldn’t have to worry about what type of date flickr expects for the different arguments.

See Also

FlickrResponseListener.onPhotosSearch

http://www.flickr.com- /services- /api- /flickr.photos.search.html

photosSetDates

function photosSetDates (photoId: Number,
datePosted: Date,
dateTaken: Date,
dateTakenGran: Number)

Calls flickr.photos.setDates to set one or both of the dates for a photo..

All parameters are optional but you must provide either dateTaken or datePosted (or both if you like).

Dates are passed as Flash Date Objects so you don’t need to worry about the fact that flickr uses two different formats to represent it’s dates...

Parameters

photoIdThe id of the photo to edit dates for.
datePostedThe date the photo was uploaded to flickr.
dateTakenThe date the photo was taken.
dateTakenGranThe granularity of the date the photo was taken.

See Also

FlickrResponseListener.onPhotosSetDates

http://flickr.com- /services- /api- /flickr.photos.setDates.html

http://flickr.com/services/api/misc.dates.html

photosSetMeta

function photosSetMeta (photoId: Number,
title: String,
description: String)

Calls flickr.photos.setMeta to set the meta information for a photo.

Parameters

photoIdThe id of the photo to edit dates for.
titleThe title for the photo.
descriptionThe description for the photo.

See Also

FlickrResponseListener.onPhotosSetMeta

http://flickr.com- /services- /api- /flickr.photos.setMeta.html

photosSetPerms

function photosSetPerms (photoId: Number,
isPublic: Number,
isFriend: Number,
isFamily: Number,
permComment: Number,
permAddMeta: Number)

Calls flickr.photos.setPerms to set permissions for a photo..

Parameters

photoIdThe id of the photo to set permissions for.
isPublic1 to set the photo to public, 0 to set it to private.
isFriend1 to make the photo visible to friends when private, 0 to not.
isFamily1 to make the photo visible to family when private, 0 to not.
permCommentwho can add comments to the photo and it’s notes.  See Flickr.PERM_* for options.
permAddMetawho can add notes and tags to the photo.  See Flickr.PERM_* for options.

See Also

Flickr.PERM_NOBODY

Flickr.PERM_FRIENDS

Flickr.PERM_CONTACTS

Flickr.PERM_EVERYBODY

FlickrResponseListener.onPhotosSetMeta

http://flickr.com- /services- /api- /flickr.photos.setMeta.html

photosSetTags

function photosSetTags (photoId: Number,
tags: String)

Calls flickr.photos.setTags to set the tags for a photo.

Parameters

photoIdThe id of the photo to edit dates for.
tagsAll tags for the photo (as a single space-delimited string).

See Also

FlickrResponseListener.onPhotosSetTags

Photo.setTags - There are some problems listed here...

http://flickr.com- /services- /api- /flickr.photos.setTags.html

tagsGetListPhoto

public function tagsGetListPhoto(photoId: Number)

Calls flickr.tags.getListPhoto to get the tag list for a given photo.

Parameters

photoIdThe id of the photo to return tags for.

See Also

<FlickrResponseListener.onTagsListPhoto>

FlickrResponseListener.onError

http://www.flickr.com- /services- /api- /flickr.tags.getListPhoto.html

tagsGetListUser

public function tagsGetListUser(userId: String)

Calls flickr.tags.getListUser to get the tag list for a given user (or the currently logged in user).

Parameters

userIdThe NSID of the user to fetch the tag list for.  [Optional: default=the currently logged in user (if any)]

See Also

FlickrResponseListener.onTagsGetListUser

FlickrResponseListener.onError

http://www.flickr.com- /services- /api- /flickr.tags.getListUser.html

tagsGetListUserPopular

public function tagsGetListUserPopular(userId: String,
count: Number)

Calls flickr.tags.getListUserPopular to get the popular tags for a given user (or the currently logged in user).

Parameters

userIDThe NSID of the user to fetch the tag list for.  [Optional: default=the currently logged in user (if any)]
countNumber of popular tags to return.  [Optional: default=10]

See Also

FlickrResponseListener.onTagsGetListUserPopular

FlickrResponseListener.onError

http://www.flickr.com- /services- /api- /flickr.tags.getListUserPopular.html

tagsGetRelated

public function tagsGetRelated(tag: String)

Calls flickr.tags.getRelated to get a list of tags ‘related’ to the given tag, based on clustered usage analysis.

Parameters

tagThe tag to fetch related tags for.

See Also

FlickrResponseListener.onTagsGetRelated

FlickrResponseListener.onError

http://www.flickr.com- /services- /api- /flickr.tags.getRelated.html

testEcho

public function testEcho()

Calls flickr.test.echo - forwards any arguments on to the Flickr API

Parameters

1...nAny number of parameters to echo back from the server [Optional]

See Also

FlickrResponseListener.onTestEcho

FlickrResponseListener.onError

http://www.flickr.com- /services- /api- /flickr.test.echo.html

testLogin

public function testLogin(email: String,
password: String)

Calls flickr.test.login - A testing method which checks if the caller is logged in then returns their username.

Parameters

emailThe email address to try loging in with [Optional: default=<Flickr.email>]
passwordThe password to try loging in with [Optional: default=<Flickr.password>]

See Also

FlickrResponseListener.onTestLogin

FlickrResponseListener.onError

Flickr.email

Flickr.password

http://www.flickr.com- /services- /api- /flickr.test.login.html

callMethod

public function callMethod(method: String,
additionalArguments: Object,
requiresAuthentication: Boolean):Void

Used to call a method on the flickr API.

When the method returns an onAPIResponse event is broadcast to any registered listeners.

You should use the methods above unless you are calling a method on Flickr.com which hasn’t yet been implemented in this API as then you will get argument type checking etc...

Parameters

methodThe name of the method you want to call
additionalArgumentsAny additional arguments required by the object [Optional]
requiresAuthenticationWhether the called method requires authentication. if it does and no values for email and password exist within the additionalArguments object then the values Flickr.email and Flickr.password will be used [optional: default=false]

See also

Flickr.onAPIResponse

onAPIResponse

private function onAPIResponse(success: Boolean):Void

Called internally on recepit of a response from a request to the REST_ENDPOINT.  Interperets the received XML and broadcasts an onAPIResponse event to any registered listeners.  If the XML was the result of a known method call then the broadcast event will include sensible information, otherwise it will just be the XML for parsing outside this class (e.g. if a new method has been added to the Flickr.com API and not programmed into this class).

Parameters

successWhether the call to the API was successfull (e.g. the server specfied in REST_ENDPOINT was connected to) or not.

Properties

REST_ENDPOINT

public function set REST_ENDPOINT(REST_ENDPOINT: String):Void

REST_ENDPOINT

public function get REST_ENDPOINT():String

apiKey

public function set apiKey(apiKey: String):Void

Functions

_parsePhotoXML

private function _parsePhotoXML(px: XMLNode):Array

Private internal function used to avoid duplicate code to parse “the standard photo list xml”

Params

pxThe “standard photo list xml” from flickr.

Returns

An Array of Photo objects.

getFlickr

public static function getFlickr():Flickr

Returns a reference to the Flickr instance - if none exists yet then creates one and returns a reference to that.

Returns

A Flickr instance

toString

public function toString():String

dispatchEvent

function dispatchEvent()

addEventListener

function addEventListener()

removeEventListener

function removeEventListener()
private static var _flickr: Flickr
private var _apiKey: String
private var _REST_ENDPOINT: String
private var awaitingResponse: Boolean