Class to describe a person from Flickr.
Instances of this class are created to hold people who have been returned in data from calls to the Flickr API.
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.
0.5.0
Kelvin Luck < kelvin at kelvinluck dot com >
$Id: Person.as 79 2006-09-06 16:57:39Z kluck $
| com. kelvinluck. flashr. core. Person | Class to describe a person from Flickr. |
| nsid | This person’s nsid (sometimes just refered to as id or personId). |
| username | This person’s username. |
| This person’s email address. | |
| iconServer | Used to build the url to the users’ buddyicon |
| buddyIcon | The path to this Person’s buddy icon. |
| friend | If this person is a friend. |
| family | If this person is family. |
| ignored | If this person is ignored. |
| isAdmin | If this person is an admin. |
| isPro | If this person has a Pro account. |
| realname | This person’s real name. |
| location | This person’s location. |
| mboxSha1sum | This person’s mboxSha1sum. |
| numPhotos | The number of photos this user has taken. |
| photosFirstDate | The date this persons first photograph was uploaded. |
| photosFirstDateTaken | The date this persons first photograph was taken. |
| bandwidthMax | The bandwidth this user has available, in bytes per month. |
| bandwidthUsed | The bandwidth this user has used this month, in bytes. |
| filesizeMax | The maximum size per file that this user can upload, in bytes. |
| _photos | An Array containing references to all of this Person’s photos. |
| _tags | An Object containing references to all of this Person’s Tags. |
| _photosets | An Array containing references to this user’s Photosets |
| _groups | An Array containing references to this user’s Groups |
| _publicContacts | An Array containing references to all of this Person’s contacts. |
| _favorites | An Array containing references to all of this Person’s favourites as Photo objects indexed by the id of each of the favourites. |
| _people | A private static Object containing Person objects. |
| Person | Private constructor function - creates a new Person object. |
| _addPublicGroup | Private internal function - add’s a public group to this user and notes whether this user is an admin of that group. |
| getPublicGroups | Gets a list of the public groups that a user is a member of (if Flashr.peopleGetPublicGroups has been called for that user. |
| _addPublicContact | Private internal function - adds a public contact to this user |
| getPublicContacts | Gets a list of the public contacts that this user has (if Flashr.contactsGetPublicList or Flashr.contactsGetList has been called for this user. |
| _addFavorite | Private internal function - adds a favourite Photo to this user. |
| _removeFavorite | Private internal function - removes a favourite Photo from this user. |
| getFavorites | Gets a list of the favorite Photo’s that this user has. |
| isFavorite | Checks whether the given Photo is a favorite of this Person. |
| _addPhoto | Private internal function - Adds this Photo into this Person’s _photos Array if it isn’t already there |
| getPhotos | Returns this Person’s _photos Array. |
| _addPhotoset | Private internal function - Adds this Photoset into this Person’s _photosets Array if it isn’t already there |
| getPhotosets | Returns this Person’s _photosets Array. |
| _clearPhotosets | Private internal function - clears this Person’s _photosets Array. |
| _addGroup | Private internal function - Adds this Group into this Person’s _groups Array if it isn’t already there |
| getGroups | Returns this Person’s _groups Array. |
| _removePhotoset | Private internal function - Removes this Photoset into this Person’s _photosets Array |
| _addTag | Private internal function - adds a Tag into this Person’s _tags Array if it isn’t already there |
| getTags | Get’s this Persons _tags. |
| getTagsAsStrings | Get’s this Persons tags as a simple Array of Strings. |
| getPerson | Get’s a Person object for the given nsid. |
function get buddyIcon():String
The path to this Person’s buddy icon. If they don’t have a buddy icon or we don’t know where it is then the path to the default buddy icon is returned.
public var photosFirstDateTaken: Date
The date this persons first photograph was taken.
public var bandwidthMax: Number
The bandwidth this user has available, in bytes per month.
public var filesizeMax: Number
The maximum size per file that this user can upload, in bytes.
private var _photos: Array
An Array containing references to all of this Person’s photos. Can be filled up bit by bit as a result of calls to e.g. Flashr.photosGetInfo or a page at a time by calling Flashr.peopleGetPublicPhotos
private var _publicContacts: Object
An Array containing references to all of this Person’s contacts.
Flashr.contactsGetList, Flashr.contactsGetPublicList, getPublicContacts, _addPublicContact
private var _favorites: Object
An Array containing references to all of this Person’s favourites as Photo objects indexed by the id of each of the favourites.
Flashr.favoritesGetList, Flashr.favoritesGetPublicList, getFavorites, _addFavorite
private static var _people: Object
A private static Object containing Person objects. Used by getPerson to insure that only one Person is created for each nsid returned from flickr.com
private function _addPublicGroup( group: Group, isAdmin: Boolean ):Void
Private internal function - add’s a public group to this user and notes whether this user is an admin of that group.
| group | The Group you are adding. |
| isAdmin | Whether this Person is an admin of this group |
function getPublicGroups():Array
Gets a list of the public groups that a user is a member of (if Flashr.peopleGetPublicGroups has been called for that user.
An Array of Objects containing two items group (a Group) and isAdmin (a Boolean) which marks whether this Person is an administrator of that Group
private function _addPublicContact( contact: Person ):Void
Private internal function - adds a public contact to this user
| contact | The Person you are adding. |
function getPublicContacts():Object
Gets a list of the public contacts that this user has (if Flashr.contactsGetPublicList or Flashr.contactsGetList has been called for this user.
An Object containing Person objects indexed by their nsids.
Flashr.contactsGetPublicList, Flashr.contactsGetList, _addPublicContact
private function _removeFavorite( photo: Photo ):Void
Private internal function - removes a favourite Photo from this user.
NOTE, this just updates the internal representation of the user, It doesn’t remove the favorite on the flickr website. See Flashr.favoritesRemove if this is what you want to do.
| photo | The Photo you are adding. |
function getFavorites():Array
Gets a list of the favorite Photo’s that this user has.
An Array containing this Person’s favourite Photos. This Array will be empty until Flashr.favoritesGetPublicList or Flashr.favoritesGetList has been called for this Person.
Flashr.favoritesGetPublicList, Flashr.favoritesGetList, _addFavorite
function isFavorite( photo: Photo ):Boolean
Checks whether the given Photo is a favorite of this Person.
| photo | The Photo you want to check if is a favorite. |
True if the photo is a favorite, false otherwise. Result will only be correct where Flashr.favoritesGetList or Flashr.favoritesGetPublicList have been called for this Person
Flashr.favoritesGetList, Flashr.favoritesGetPublicList, getFavorites
private function _addPhotoset( photoset: Photoset ):Void
Private internal function - Adds this Photoset into this Person’s _photosets Array if it isn’t already there
| photoset | The Photoset you are adding. |
function getPhotosets():Array
Returns this Person’s _photosets Array.
An Array of Photoset objects.
private function _clearPhotosets()
Private internal function - clears this Person’s _photosets Array.
private function _removePhotoset( photoset: Photoset ):Void
Private internal function - Removes this Photoset into this Person’s _photosets Array
| photoset | The Photoset you are removing. |
private function _addTag( tag: Tag, count: Number ):Void
Private internal function - adds a Tag into this Person’s _tags Array if it isn’t already there
| tag | The Tag you are adding. |
| count | The number of times this person uses this tag. |
_tags, getTags, getTagsAsStrings, Flashr.tagsGetListUser, Flashr.tagsGetListUserPopular
public function getTags():Object
Get’s this Persons _tags. If you aren’t interested in usage counts then you should probably look at getTagsAsStrings.
An Object. Each key is the Tag.raw data and each value is an object with tag (the relevant Tag object and count (the number of times this Person uses this Tag) fields.
The value will be an empty Object if a method which retrieves this info (e.g. Flashr.tagsGetListUser or Flashr.tagsGetListUserPopular) hasn’t been called.
function getTagsAsStrings():Array
Get’s this Persons tags as a simple Array of Strings. Use this method if you want a Persons tags without any aditional data such as the amount of times they are used etc.
An Array containing the Tag.value version of all of this Persons Tags.
The value will be an empty Array if a method which retrieves this info (e.g. Flashr.tagsGetListUser or Flashr.tagsGetListUserPopular) hasn’t been called.
public static function getPerson( nsid: String ):Person
Get’s a Person object for the given nsid.
Consults _people to make sure that only one Person instance is created for each nsid from flickr.com
| nsid | The id of the Person you want to get |
This person’s nsid (sometimes just refered to as id or personId).
public var nsid: String
This person’s username.
public var username: String
This person’s email address.
public var email: String
Used to build the url to the users’ buddyicon
public var iconServer: Number
The path to this Person’s buddy icon.
function get buddyIcon():String
Private constructor function - creates a new Person object.
private function Person( nsid: String )
If this person is a friend.
public var friend: Boolean
If this person is family.
public var family: Boolean
If this person is ignored.
public var ignored: Boolean
This person’s real name.
public var realname: String
This person’s location.
public var location: String
This person’s mboxSha1sum.
public var mboxSha1sum: String
The number of photos this user has taken.
public var numPhotos: String
The date this persons first photograph was uploaded.
public var photosFirstDate: Date
The date this persons first photograph was taken.
public var photosFirstDateTaken: Date
The bandwidth this user has available, in bytes per month.
public var bandwidthMax: Number
The bandwidth this user has used this month, in bytes.
public var bandwidthUsed: Number
The maximum size per file that this user can upload, in bytes.
public var filesizeMax: Number
An Array containing references to all of this Person’s photos.
private var _photos: Array
An Object containing references to all of this Person’s Tags.
private var _tags: Object
An Array containing references to this user’s Photosets
private var _photosets: Array
An Array containing references to this user’s Groups
private var _groups: Array
An Array containing references to all of this Person’s contacts.
private var _publicContacts: Object
An Array containing references to all of this Person’s favourites as Photo objects indexed by the id of each of the favourites.
private var _favorites: Object
A private static Object containing Person objects.
private static var _people: Object
Private internal function - add’s a public group to this user and notes whether this user is an admin of that group.
private function _addPublicGroup( group: Group, isAdmin: Boolean ):Void
Gets a list of the public groups that a user is a member of (if Flashr.peopleGetPublicGroups has been called for that user.
function getPublicGroups():Array
Calls flickr.people.getPublicGroups to get the list of public groups a user is a member of.
function peopleGetPublicGroups( userId: String ):FlashrRequest
Private internal function - adds a public contact to this user
private function _addPublicContact( contact: Person ):Void
Gets a list of the public contacts that this user has (if Flashr.contactsGetPublicList or Flashr.contactsGetList has been called for this user.
function getPublicContacts():Object
Calls flickr.contacts.getPublicList to get a list of contacts a user.
public function contactsGetPublicList( userId: String ):FlashrRequest
Calls flickr.contacts.getList to get a list of contacts for the calling user.
public function contactsGetList( filter: String ):FlashrRequest
Private internal function - adds a favourite Photo to this user.
private function _addFavorite( photo: Photo ):Void
Private internal function - removes a favourite Photo from this user.
private function _removeFavorite( photo: Photo ):Void
Gets a list of the favorite Photo’s that this user has.
function getFavorites():Array
Checks whether the given Photo is a favorite of this Person.
function isFavorite( photo: Photo ):Boolean
Private internal function - Adds this Photo into this Person’s _photos Array if it isn’t already there
private function _addPhoto( photo: Photo ):Void
Returns this Person’s _photos Array.
function getPhotos():Array
Private internal function - Adds this Photoset into this Person’s _photosets Array if it isn’t already there
private function _addPhotoset( photoset: Photoset ):Void
Returns this Person’s _photosets Array.
function getPhotosets():Array
Private internal function - clears this Person’s _photosets Array.
private function _clearPhotosets()
Private internal function - Adds this Group into this Person’s _groups Array if it isn’t already there
private function _addGroup( group: Group ):Void
Returns this Person’s _groups Array.
function getGroups():Array
Private internal function - Removes this Photoset into this Person’s _photosets Array
private function _removePhotoset( photoset: Photoset ):Void
Private internal function - adds a Tag into this Person’s _tags Array if it isn’t already there
private function _addTag( tag: Tag, count: Number ):Void
Get’s this Persons _tags.
public function getTags():Object
Get’s this Persons tags as a simple Array of Strings.
function getTagsAsStrings():Array
Get’s a Person object for the given nsid.
public static function getPerson( nsid: String ):Person
Calls flickr.photos.getInfo to get information about a Photo.
function photosGetInfo ( photoId: String, secret: String ):FlashrRequest
Calls flickr.people.getPublicPhotos to get a list of public photos for the given user.
function peopleGetPublicPhotos( nsid: String, extras: String, perPage: Number, page: Number ):FlashrRequest
The raw text of this tag
public var raw: String
Gets the photosets belonging to the specified user.
function photosetsGetList( userId: String ):FlashrRequest
Calls flickr.favorites.getList to get a list of the user’s favorite photos.
public function favoritesGetList( userId: String, extras: String, perPage: Number, page: Number ):FlashrRequest
Calls flickr.favorites.getPublicList to get a list of favorite public photos for the given user.
public function favoritesGetPublicList( userId: String, extras: String, perPage: Number, page: Number ):FlashrRequest
Calls flickr.favorites.add to add a photo to a user’s favorites list.
public function favoritesAdd( photoId: String ):FlashrRequest
Calls flickr.favorites.remove to remove a photo from a user’s favorites list.
public function favoritesRemove( photoId: String ):FlashrRequest
Delete a photoset.
function photosetsDelete( photosetId: String ):FlashrRequest
Calls flickr.tags.getListUser to get the tag list for a given user (or the currently logged in user).
public function tagsGetListUser( userId: String ):FlashrRequest
Calls flickr.tags.getListUserPopular to get the popular tags for a given user (or the currently logged in user).
public function tagsGetListUserPopular( userId: String, count: Number ):FlashrRequest
The text of this tag
private var _value: String