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 code is still beta so feedback is greatfully received :) LicenceThis code and documentation is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0. 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.3.0 AuthorKelvin Luck < kelvin at kelvinluck dot com > Project Websitehttp://kelvinluck.com- /projects- /flashr-a-flickr-api-wrapper-for-flash Summary
_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. _secret
Private variable to store this app’s shared secret for use with the authentication API. See Alsohttp://www.flickr.com/services/api/auth.spec.html http://www.flickr.com- /services- /api- /registered_keys.gne authPerms
A variable describing the permissions the currently auth’d user has within this app. It will be “none” until the user has been logged in and then will become “read”, “write” or “delete”. You can check whether authPerms == “none” if you want to find out if the user is currently logged in before checking who they are with authUser See AlsoFlickr
Constructor - as this class implements the Singleton pattern do not call directly but rather access through Flickr.getFlickr. authSetSecret
Use to set the value of the shared secret before any calls to methods like authLogin or authCheckToken Parameters
See Alsohttp://www.flickr.com/services/api/auth.spec.html http://www.flickr.com- /services- /api- /auth.howto.desktop.html http://www.flickr.com- /services- /api- /registered_keys.gne authLogin
Pops open a login window so that the user can authenticate with the flickr.com website. The user authenticates using the “Non-web based app” method as described in section 9.2 of the auth spec. The end effect of calling this function is that a window is opened with the relevant login / authenticate stuff on flickr.com. It is the responsibility of the user of this library to pop up a dialog box saying words to the effect of: ”This program requires your authentication before it can read/write/delete your photos on flickr.com. Please complete the authorisation process in the window which has popped up and then press the CONTINUE button below” The CONTINUE button needs to call authGetToken which does the final stage of logging the user in. Parameters
See Alsohttp://www.flickr.com/services/api/auth.spec.html http://www.flickr.com- /services- /api- /auth.howto.desktop.html http://www.flickr.com- /services- /api- /registered_keys.gne authGetFrob
Calls flickr.auth.getFrob to get a frob to be used during authentication. In most cases you would not call this method directly and would instead use authLogin. Parameters
See AlsoFlickrResponseListener.onAuthGetFrob http://flickr.com- /services- /api- /flickr.auth.getFrob.html authGetToken
Calls flickr.auth.getToken to get the auth token for the given frob, if one has been attached. Should be called after the user has pressed CONTINUE on the status window you opened when calling authLogin. If a valid token is returned (e.g. if the frob was correct and valid) then the user is logged in for all further API calls from this session and FlickrResponseListener.onAuthCheckToken will be fired. If there is a problem then FlickrResponseListener.onError is fired. See AlsoFlickrResponseListener.onAuthCheckToken http://www.flickr.com- /services- /api- /flickr.auth.getToken.html authCheckToken
Calls flickr.auth.checkToken to get the credentials attached to an authentication token. You can use this to log in if you have auth’d an app in a previous session and saved the token e.g. in a SharedObject. If the token is still valid, the user will become logged in and FlickrResponseListener.onAuthCheckToken will be fired. If the token is invalid then FlickrResponseListener.onError will be fired. Parameters
See AlsoFlickrResponseListener.onAuthCheckToken http://www.flickr.com- /services- /api- /flickr.auth.checkToken.html authLogout
Simple function which forgets the information that was making this user be logged in. The app will remain authenticated against flickr.com until the user visits http://www.flickr.com/services/auth/list.gne but the app will have to reapply for frob and then a token to use this authentication... _authOpenLogin
Internal function which generates the relevant link and pops open the login window on flickr.com. Triggered when a frob (necessary to generate the link) is returned from flickr.auth.getFrob. See Alsohttp://www.flickr.com- /services- /api- /flickr.auth.getFrob.html http://www.flickr.com/services/api/auth.spec.html http://www.flickr.com- /services- /api- /auth.howto.desktop.html http://www.flickr.com- /services- /api- /registered_keys.gne _authSignCall
Internal, private function which is used to generate the api_sig used to sign a call. Parameters
See Alsohttp://www.flickr.com/services/api/auth.spec.html http://www.flickr.com- /services- /api- /auth.howto.desktop.html http://www.flickr.com- /services- /api- /registered_keys.gne contactsGetList
Calls flickr.contacts.getList to get a list of contacts for the calling user. Parameters
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. 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. Parameters
See AlsoFlickrResponseListener.onFavoritesRemove http://www.flickr.com- /services- /api- /flickr.favorites.remove.html groupsPoolsAdd
Add a photo to a group’s pool. Parameters
See AlsoFlickrResponseListener.onGroupsPoolsAdd http://www.flickr.com- /services- /api- /flickr.groups.pools.add.html groupsPoolsGetContext
Gets next and previous photos for a photo in a group pool. Parameters
See AlsoFlickrResponseListener.onGroupsPoolsAdd http://www.flickr.com- /services- /api- /flickr.groups.pools.add.html groupsPoolsGetGroups
Gets a list of groups to which you can add photos. See AlsoFlickrResponseListener.onGroupsPoolsGetGroups http://www.flickr.com- /services- /api- /flickr.groups.pools.getGroups.html groupsPoolsGetPhotos
Gets a list of pool photos for a given group, based on the permissions of the group and the user logged in (if any). Parameters
See AlsoFlickrResponseListener.onGroupsPoolsGetPhotos http://www.flickr.com- /services- /api- /flickr.groups.pools.getPhotos.html groupsPoolsRemove
Remove a photo from a group pool. Parameters
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 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 peopleGetUploadStatus
Calls flickr.people.getUploadStatus to get information for the calling user related to photo uploads. See AlsoFlickrResponseListener.onPeopleGetUploadStatus http://flickr.com- /services- /api- /flickr.people.getUploadStatus.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 photosGetAllContexts
Returns all visble sets and pools the photo belongs to. Parameters
See AlsoFlickrResponseListener.onPhotosGetAllContexts http://www.flickr.com- /services- /api- /flickr.photos.getAllContexts.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 method’s 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 |