com. kelvinluck. flashr. core. Person

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.

Licence

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.

Version

0.5.0

Author

Kelvin Luck < kelvin at kelvinluck dot com >

Project Website

http://flashr.kelvinluck.com/

Subversion Id

$Id: Person.as 79 2006-09-06 16:57:39Z kluck $

Summary
com. kelvinluck. flashr. core. PersonClass to describe a person from Flickr.
nsidThis person’s nsid (sometimes just refered to as id or personId).
usernameThis person’s username.
emailThis person’s email address.
iconServerUsed to build the url to the users’ buddyicon
buddyIconThe path to this Person’s buddy icon.
friendIf this person is a friend.
familyIf this person is family.
ignoredIf this person is ignored.
isAdminIf this person is an admin.
isProIf this person has a Pro account.
realnameThis person’s real name.
locationThis person’s location.
mboxSha1sumThis person’s mboxSha1sum.
numPhotosThe number of photos this user has taken.
photosFirstDateThe date this persons first photograph was uploaded.
photosFirstDateTakenThe date this persons first photograph was taken.
bandwidthMaxThe bandwidth this user has available, in bytes per month.
bandwidthUsedThe bandwidth this user has used this month, in bytes.
filesizeMaxThe maximum size per file that this user can upload, in bytes.
_photosAn Array containing references to all of this Person’s photos.
_tagsAn Object containing references to all of this Person’s Tags.
_photosetsAn Array containing references to this user’s Photosets
_groupsAn Array containing references to this user’s Groups
_publicContactsAn Array containing references to all of this Person’s contacts.
_favoritesAn Array containing references to all of this Person’s favourites as Photo objects indexed by the id of each of the favourites.
_peopleA private static Object containing Person objects.
PersonPrivate constructor function - creates a new Person object.
_addPublicGroupPrivate internal function - add’s a public group to this user and notes whether this user is an admin of that group.
getPublicGroupsGets a list of the public groups that a user is a member of (if Flashr.peopleGetPublicGroups has been called for that user.
_addPublicContactPrivate internal function - adds a public contact to this user
getPublicContactsGets a list of the public contacts that this user has (if Flashr.contactsGetPublicList or Flashr.contactsGetList has been called for this user.
_addFavoritePrivate internal function - adds a favourite Photo to this user.
_removeFavoritePrivate internal function - removes a favourite Photo from this user.
getFavoritesGets a list of the favorite Photo’s that this user has.
isFavoriteChecks whether the given Photo is a favorite of this Person.
_addPhotoPrivate internal function - Adds this Photo into this Person’s _photos Array if it isn’t already there
getPhotosReturns this Person’s _photos Array.
_addPhotosetPrivate internal function - Adds this Photoset into this Person’s _photosets Array if it isn’t already there
getPhotosetsReturns this Person’s _photosets Array.
_clearPhotosetsPrivate internal function - clears this Person’s _photosets Array.
_addGroupPrivate internal function - Adds this Group into this Person’s _groups Array if it isn’t already there
getGroupsReturns this Person’s _groups Array.
_removePhotosetPrivate internal function - Removes this Photoset into this Person’s _photosets Array
_addTagPrivate internal function - adds a Tag into this Person’s _tags Array if it isn’t already there
getTagsGet’s this Persons _tags.
getTagsAsStringsGet’s this Persons tags as a simple Array of Strings.
getPersonGet’s a Person object for the given nsid.

nsid

public var nsid: String

This person’s nsid (sometimes just refered to as id or personId).

username

public var username: String

This person’s username.

email

public var email: String

This person’s email address.

iconServer

public var iconServer: Number

Used to build the url to the users’ buddyicon

buddyIcon

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.

friend

public var friend: Boolean

If this person is a friend.

family

public var family: Boolean

If this person is family.

ignored

public var ignored: Boolean

If this person is ignored.

isAdmin

If this person is an admin.

isPro

If this person has a Pro account.

realname

public var realname: String

This person’s real name.

location

public var location: String

This person’s location.

mboxSha1sum

public var mboxSha1sum: String

This person’s mboxSha1sum.

numPhotos

public var numPhotos: String

The number of photos this user has taken.

photosFirstDate

public var photosFirstDate: Date

The date this persons first photograph was uploaded.

photosFirstDateTaken

public var photosFirstDateTaken: Date

The date this persons first photograph was taken.

bandwidthMax

public var bandwidthMax: Number

The bandwidth this user has available, in bytes per month.

bandwidthUsed

public var bandwidthUsed: Number

The bandwidth this user has used this month, in bytes.

filesizeMax

public var filesizeMax: Number

The maximum size per file that this user can upload, in bytes.

_photos

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

See Also

getPhotos

_tags

private var _tags: Object

An Object containing references to all of this Person’s Tags.  The keys of this object are the Tag.raw fields and the value fields are Objects - each with two parts: tag (the Tag object itself) and count (the number of times this Person uses this tag.

See Also

getTags, getTagsAsStrings

_photosets

private var _photosets: Array

An Array containing references to this user’s Photosets

See Also

Flashr.photosetsGetList, getPhotosets, _addPhotoset

_groups

private var _groups: Array

An Array containing references to this user’s Groups

See Also

Flashr.peopleGetPublicGroups, getGroups, _addGroup

_publicContacts

private var _publicContacts: Object

An Array containing references to all of this Person’s contacts.

See Also

Flashr.contactsGetList, Flashr.contactsGetPublicList, getPublicContacts, _addPublicContact

_favorites

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.

See Also

Flashr.favoritesGetList, Flashr.favoritesGetPublicList, getFavorites, _addFavorite

_people

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

Person

private function Person(nsid: String)

Private constructor function - creates a new Person object.  Access via getPerson

See Also

getPerson

_addPublicGroup

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.

Parameters

groupThe Group you are adding.
isAdminWhether this Person is an admin of this group

See Also

Flashr.peopleGetPublicGroups

getPublicGroups

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.

Returns

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

See Also

Flashr.peopleGetPublicGroups

_addPublicContact

private function _addPublicContact(contact: Person):Void

Private internal function - adds a public contact to this user

Parameters

contactThe Person you are adding.

See Also

Flashr.contactsGetPublicList, getPublicContacts

getPublicContacts

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.

Returns

An Object containing Person objects indexed by their nsids.

See Also

Flashr.contactsGetPublicList, Flashr.contactsGetList, _addPublicContact

_addFavorite

private function _addFavorite(photo: Photo):Void

Private internal function - adds a favourite Photo to this user.

Parameters

photoThe Photo you are adding.

See Also

Flashr.favoritesAdd, getFavorites

_removeFavorite

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.

Parameters

photoThe Photo you are adding.

See Also

Flashr.favoritesRemove, getFavorites

getFavorites

function getFavorites():Array

Gets a list of the favorite Photo’s that this user has.

Returns

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.

See Also

Flashr.favoritesGetPublicList, Flashr.favoritesGetList, _addFavorite

isFavorite

function isFavorite(photo: Photo):Boolean

Checks whether the given Photo is a favorite of this Person.

Parameters

photoThe Photo you want to check if is a favorite.

Returns

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

See Also

Flashr.favoritesGetList, Flashr.favoritesGetPublicList, getFavorites

_addPhoto

private function _addPhoto(photo: Photo):Void

Private internal function - Adds this Photo into this Person’s _photos Array if it isn’t already there

Parameters

photoThe Photo you are adding.

getPhotos

function getPhotos():Array

Returns this Person’s _photos Array.

Returns

An Array of Photo objects.

_addPhotoset

private function _addPhotoset(photoset: Photoset):Void

Private internal function - Adds this Photoset into this Person’s _photosets Array if it isn’t already there

Parameters

photosetThe Photoset you are adding.

getPhotosets

function getPhotosets():Array

Returns this Person’s _photosets Array.

Returns

An Array of Photoset objects.

_clearPhotosets

private function _clearPhotosets()

Private internal function - clears this Person’s _photosets Array.

_addGroup

private function _addGroup(group: Group):Void

Private internal function - Adds this Group into this Person’s _groups Array if it isn’t already there

Parameters

groupThe Group you are adding.

See Also

Flashr.peopleGetPublicGroups

getGroups

function getGroups():Array

Returns this Person’s _groups Array.

Returns

An Array of Group objects.

_removePhotoset

private function _removePhotoset(photoset: Photoset):Void

Private internal function - Removes this Photoset into this Person’s _photosets Array

Parameters

photosetThe Photoset you are removing.

See Also

Flashr.photosetsDelete

_addTag

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

Parameters

tagThe Tag you are adding.
countThe number of times this person uses this tag.

See Also

_tags, getTags, getTagsAsStrings, Flashr.tagsGetListUser, Flashr.tagsGetListUserPopular

getTags

public function getTags():Object

Get’s this Persons _tags.  If you aren’t interested in usage counts then you should probably look at getTagsAsStrings.

Returns

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.

See Also

_tags, getTagsAsStrings

getTagsAsStrings

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.

Returns

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.

getPerson

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

Parameters

nsidThe id of the Person you want to get
public var nsid: String
This person’s nsid (sometimes just refered to as id or personId).
public var username: String
This person’s username.
public var email: String
This person’s email address.
public var iconServer: Number
Used to build the url to the users’ buddyicon
function get buddyIcon():String
The path to this Person’s buddy icon.
private function Person(nsid: String)
Private constructor function - creates a new Person object.
public var friend: Boolean
If this person is a friend.
public var family: Boolean
If this person is family.
public var ignored: Boolean
If this person is ignored.
public var realname: String
This person’s real name.
public var location: String
This person’s location.
public var mboxSha1sum: String
This person’s mboxSha1sum.
public var numPhotos: String
The number of photos this user has taken.
public var photosFirstDate: Date
The date this persons first photograph was uploaded.
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 bandwidthUsed: Number
The bandwidth this user has used this month, in bytes.
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.
private var _tags: Object
An Object containing references to all of this Person’s Tags.
Class to describe a tag on a photo on flickr.com
private var _photosets: Array
An Array containing references to this user’s Photosets
Describes a Photoset on flickr.com
private var _groups: Array
An Array containing references to this user’s Groups
Class to describe a group from Flickr.
private var _publicContacts: Object
An Array containing references to all of this Person’s contacts.
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.
Class to describe a photo from Flickr.
private static var _people: Object
A private static Object containing Person objects.
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.
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.
function peopleGetPublicGroups(userId: String):FlashrRequest
Calls flickr.people.getPublicGroups to get the list of public groups a user is a member of.
private function _addPublicContact(contact: Person):Void
Private internal function - adds a public contact to this user
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.
public function contactsGetPublicList(userId: String):FlashrRequest
Calls flickr.contacts.getPublicList to get a list of contacts a user.
public function contactsGetList(filter: String):FlashrRequest
Calls flickr.contacts.getList to get a list of contacts for the calling user.
private function _addFavorite(photo: Photo):Void
Private internal function - adds a favourite Photo to this user.
private function _removeFavorite(photo: Photo):Void
Private internal function - removes a favourite Photo from this user.
function getFavorites():Array
Gets a list of the favorite Photo’s that this user has.
function isFavorite(photo: Photo):Boolean
Checks whether the given Photo is a favorite of this Person.
private function _addPhoto(photo: Photo):Void
Private internal function - Adds this Photo into this Person’s _photos Array if it isn’t already there
function getPhotos():Array
Returns this Person’s _photos Array.
private function _addPhotoset(photoset: Photoset):Void
Private internal function - Adds this Photoset into this Person’s _photosets Array if it isn’t already there
function getPhotosets():Array
Returns this Person’s _photosets Array.
private function _clearPhotosets()
Private internal function - clears this Person’s _photosets Array.
private function _addGroup(group: Group):Void
Private internal function - Adds this Group into this Person’s _groups Array if it isn’t already there
function getGroups():Array
Returns this Person’s _groups Array.
private function _removePhotoset(photoset: Photoset):Void
Private internal function - Removes this Photoset into this Person’s _photosets Array
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
public function getTags():Object
Get’s this Persons _tags.
function getTagsAsStrings():Array
Get’s this Persons tags as a simple Array of Strings.
public static function getPerson(nsid: String):Person
Get’s a Person object for the given nsid.
function photosGetInfo (photoId: String,
secret: String):FlashrRequest
Calls flickr.photos.getInfo to get information about a Photo.
function peopleGetPublicPhotos(nsid: String,
extras: String,
perPage: Number,
page: Number):FlashrRequest
Calls flickr.people.getPublicPhotos to get a list of public photos for the given user.
public var raw: String
The raw text of this tag
function photosetsGetList(userId: String):FlashrRequest
Gets the photosets belonging to the specified user.
public function favoritesGetList(userId: String,
extras: String,
perPage: Number,
page: Number):FlashrRequest
Calls flickr.favorites.getList to get a list of the user’s favorite photos.
public function favoritesGetPublicList(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 favoritesAdd(photoId: String):FlashrRequest
Calls flickr.favorites.add to add a photo to a user’s favorites list.
public function favoritesRemove(photoId: String):FlashrRequest
Calls flickr.favorites.remove to remove a photo from a user’s favorites list.
function photosetsDelete(photosetId: String):FlashrRequest
Delete a photoset.
public function tagsGetListUser(userId: String):FlashrRequest
Calls flickr.tags.getListUser to get the tag list for a given user (or the currently logged in user).
public function tagsGetListUserPopular(userId: String,
count: Number):FlashrRequest
Calls flickr.tags.getListUserPopular to get the popular tags for a given user (or the currently logged in user).
private var _value: String
The text of this tag