com. kelvinluck. flickr. FlickrClass 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/ UsageVery 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; This example shows how you would override the method you were interested in: import com.kelvinluck.flickr.Flickr; See Alsohttp://www.flickr.com/services/api/ Version0.1.0 AuthorKelvin Luck < kelvin at kelvinluck dot com > Summary
Flickr
Constructor - as this class implements the Singleton pattern do not call directly but rather access through Flickr.getFlickr. contactsGetList
Calls flickr.contacts.getList to get a list of contacts for the calling user. See AlsoFlickrResponseListener.onContactsGetList http://flickr.com- /services- /api- /flickr.contacts.getList.html contactsGetPublicList
Calls flickr.contacts.getPublicList to get a list of contacts a user. Parameters
See AlsoFlickrResponseListener.onContactsGetPublicList http://flickr.com- /services- /api- /flickr.contacts.getPublicList.html favoritesAdd
Calls flickr.favorites.add to add a photo to a user’s favorites list. TODODoesn’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
See AlsoFlickrResponseListener.onFavoritesAdd http://www.flickr.com- /services- /api- /flickr.favorites.add.html favoritesGetList
Calls flickr.favorites.getList to get a list of the user’s favorite photos. Parameters
See AlsoFlickrResponseListener.onFavoritesGetList http://www.flickr.com- /services- /api- /flickr.favorites.getList.html favoritesGetPublicList
Calls flickr.favorites.getPublicList to get a list of favorite public photos for the given user. Parameters
See AlsoFlickrResponseListener.onFavoritesGetPublicList http://www.flickr.com- /services- /api- /flickr.favorites.getPublicList.html favoritesRemove
Calls flickr.favorites.remove to remove a photo from a user’s favorites list. TODODoesn’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
See AlsoFlickrResponseListener.onFavoritesRemove http://www.flickr.com- /services- /api- /flickr.favorites.remove.html peopleFindByEmail
Calls flickr.people.findByEmail to get a user’s NSID, given their email address. Parameters
See AlsoFlickrResponseListener.onPeopleFindByEmail http://flickr.com- /services- /api- /flickr.people.findByEmail.html peopleFindByUsername
Calls flickr.people.findByUsername to get a user’s NSID, given their username. Parameters
See AlsoFlickrResponseListener.onPeopleFindByUsername http://flickr.com- /services- /api- /flickr.people.findByUsername.html peopleGetInfo
Calls flickr.people.getInfo to get information about a user. Parameters
See AlsoFlickrResponseListener.onPeopleGetInfo http://flickr.com- /services- /api- /flickr.people.getInfo.html 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 AlsoFlickrResponseListener.onPeopleGetOnlineList http://flickr.com- /services- /api- /flickr.people.getOnlineList.html peopleGetPublicGroups
Calls flickr.people.getPublicGroups to get the list of public groups a user is a member of. Parameters
See AlsoFlickrResponseListener.onPeopleGetPublicGroups http://www.flickr.com- /services- /api- /flickr.people.getPublicGroups.html peopleGetPublicPhotos
Calls flickr.people.getPublicPhotos to get a list of public photos for the given user. Parameters
See AlsoFlickrResponseListener.onPeopleGetPublicPhotos http://flickr.com- /services- /api- /flickr.people.getPublicPhotos.html photosAddTags
Calls flickr.photos.addTags to add tags to a given photo. Parameters
See AlsoFlickrResponseListener.onPhotosAddTags http://flickr.com- /services- /api- /flickr.photos.addTags.html photosGetContactsPhotos
Calls flickr.photos.getContactsPhotos to fetch a list of recent photos from the calling users’ contacts. Parameters
See AlsoFlickrResponseListener.onPhotosGetContactsPhotos http://flickr.com- /services- /api- /flickr.photos.getContactsPhotos.html photosGetContactsPublicPhotos
Calls flickr.photos.getContactsPublicPhotos to fetch a list of recent public photos from a users’ contacts. Parameters
See AlsoFlickrResponseListener.onPhotosGetContactsPublicPhotos http://www.flickr.com- /services- /api- /flickr.photos.getContactsPublicPhotos.html photosGetContext
Calls flickr.photos.getContext to return next and previous photos for a photo in a photostream. Parameters
See AlsoFlickrResponseListener.onPhotosGetContext http://www.flickr.com- /services- /api- /flickr.photos.getContext.html photosGetCounts
Calls flickr.photos.getCounts to get a list of photo counts for the given date ranges for the calling user. Parameters
Note
TODOShould 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 AlsoFlickrResponseListener.onPhotosGetCounts http://www.flickr.com- /services- /api- /flickr.photos.getCounts.html photosGetExif
Calls flickr.photos.getExif to return a list of EXIF/TIFF/GPS tags for a given photo. Parameters
See AlsoFlickrResponseListener.onPhotosGetExif http://www.flickr.com- /services- /api- /flickr.photos.getExif.html photosGetInfo
Calls flickr.photos.getInfo to get information about a photo.. Parameters
See AlsoFlickrResponseListener.onPhotosGetInfo http://www.flickr.com- /services- /api- /flickr.photos.getInfo.html photosGetNotInSet
Calls flickr.photos.getNotInSet to get a list of your photos that are not part of any sets. Parameters
See AlsoFlickrResponseListener.onPhotosGetNotInSet http://www.flickr.com- /services- /api- /flickr.photos.getNotInSet.html photosGetPerms
Calls flickr.photos.getPerms to get permissions for a photo. Parameters
See AlsoFlickrResponseListener.onPhotosGetNotInSet http://www.flickr.com- /services- /api- /flickr.photos.getPerms.html photosGetRecent
Calls flickr.photos.getRecent to get a list of the latest public photos uploaded to flickr. Parameters
See AlsoFlickrResponseListener.onPhotosGetRecent http://www.flickr.com- /services- /api- /flickr.photos.getRecent.html photosGetSizes
Calls flickr.photos.getRecent to get the available sizes for a photo. Parameters
See AlsoFlickrResponseListener.onPhotosGetSizes http://www.flickr.com- /services- /api- /flickr.photos.getSizes.html photosGetUntagged
Calls flickr.photos.getUntagged to get a list of your photos with no tags. Parameters
See AlsoFlickrResponseListener.onPhotosGetUntagged http://www.flickr.com- /services- /api- /flickr.photos.getUntagged.html photosRemoveTag
Calls flickr.photos.removeTag to remove a tag from a photo. Parameters
See AlsoFlickrResponseListener.onPhotosRemoveTag http://www.flickr.com- /services- /api- /flickr.photos.removeTag.html photosSearch
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
TODOShould 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 AlsoFlickrResponseListener.onPhotosSearch http://www.flickr.com- /services- /api- /flickr.photos.search.html photosSetDates
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
See AlsoFlickrResponseListener.onPhotosSetDates http://flickr.com- /services- /api- /flickr.photos.setDates.html photosSetMeta
Calls flickr.photos.setMeta to set the meta information for a photo. Parameters
See AlsoFlickrResponseListener.onPhotosSetMeta http://flickr.com- /services- /api- /flickr.photos.setMeta.html photosSetPerms
Calls flickr.photos.setPerms to set permissions for a photo.. Parameters
See AlsoFlickrResponseListener.onPhotosSetMeta http://flickr.com- /services- /api- /flickr.photos.setMeta.html photosSetTags
Calls flickr.photos.setTags to set the tags for a photo. Parameters
See AlsoFlickrResponseListener.onPhotosSetTags Photo.setTags - There are some problems listed here... http://flickr.com- /services- /api- /flickr.photos.setTags.html tagsGetListPhoto
Calls flickr.tags.getListPhoto to get the tag list for a given photo. Parameters
See Also<FlickrResponseListener.onTagsListPhoto> FlickrResponseListener.onError http://www.flickr.com- /services- /api- /flickr.tags.getListPhoto.html tagsGetListUser
Calls flickr.tags.getListUser to get the tag list for a given user (or the currently logged in user). Parameters
See AlsoFlickrResponseListener.onTagsGetListUser FlickrResponseListener.onError http://www.flickr.com- /services- /api- /flickr.tags.getListUser.html tagsGetListUserPopular
Calls flickr.tags.getListUserPopular to get the popular tags for a given user (or the currently logged in user). Parameters
See AlsoFlickrResponseListener.onTagsGetListUserPopular FlickrResponseListener.onError http://www.flickr.com- /services- /api- /flickr.tags.getListUserPopular.html tagsGetRelated
Calls flickr.tags.getRelated to get a list of tags ‘related’ to the given tag, based on clustered usage analysis. Parameters
See AlsoFlickrResponseListener.onTagsGetRelated FlickrResponseListener.onError http://www.flickr.com- /services- /api- /flickr.tags.getRelated.html testEcho
Calls flickr.test.echo - forwards any arguments on to the Flickr API Parameters
See AlsoFlickrResponseListener.onTestEcho FlickrResponseListener.onError http://www.flickr.com- /services- /api- /flickr.test.echo.html testLogin
Calls flickr.test.login - A testing method which checks if the caller is logged in then returns their username. Parameters
See AlsoFlickrResponseListener.onTestLogin FlickrResponseListener.onError http://www.flickr.com- /services- /api- /flickr.test.login.html callMethod
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
See alsoonAPIResponse
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
_parsePhotoXML
Private internal function used to avoid duplicate code to parse “the standard photo list xml” Params
ReturnsAn Array of Photo objects. getFlickr
Returns a reference to the Flickr instance - if none exists yet then creates one and returns a reference to that. ReturnsA Flickr instance |
private static var _flickr: Flickr
private var _apiKey: String
private var _REST_ENDPOINT: String
private var awaitingResponse: Boolean