com. kelvinluck. flickr. 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.

Version

0.1.0

Author

Kelvin Luck < kelvin at kelvinluck dot com >

Summary
Class to describe a person from Flickr.
This person’s nsid.
This person’s username.
This person’s email address.
Used to build the url to the users’ buddyicon
If this person is a friend.
If this person is family.
If this person is ignored.
If this person is an admin.
If this person has a Pro account.
If this person is online.
This person’s away message (if they are away).
This person’s real name.
This person’s location.
The number of photos this user has taken.
The date this persons first photograph was uploaded.
The date this persons first photograph was taken.
An Array containing references to all of this Person’s photos.
An Object containing references to all of this Person’s Tag’s
An Array containing references to all of this Person’s contacts.
An Array containing references to all of this Person’s favourites as Photo objects indexed by the id of each of the favourites.
A private static Object containing Person objects.
Add’s a public group to this user and notes whether this user is an admin of that group.
Gets a list of the public groups that a user is a member of (if Flickr.peopleGetPublicGroups has been called for that user.
Add’s a public contact to this user
Gets a list of the public contacts that this user has (if addPublicContact has been called for this user.
Add’s a favourite Photo to this user.
Gets a list of the favorite Photo’s that this user has.
Adds this Photo into this Person’s _photos Array if it isn’t already there
Adds a Tag into this Person’s _tags Array if it isn’t already there
Get’s this persons _tags.
Get’s a Person object for the given nsid.

Variables

nsid

public var nsid: String

This person’s nsid.

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

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.

online

public var online: Number

If this person is online.  This relates to their status in the Flickr Live system (http://flickr.com/_chat/chat.gne)

Possible Values

0Offline.
1Away
2Online

awayMessage

public var awayMessage: String

This person’s away message (if they are away).  This relates to the Flickr Live system (http://flickr.com/_chat/chat.gne)

realname

public var realname: String

This person’s real name.

location

public var location: String

This person’s location.

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.

_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.  Flickr.photosGetInfo

TODO

Is this a good idea?  Do we need to link people back to their photos like this within the library?

_tags

private var _tags: Object

An Object containing references to all of this Person’s Tag’s

_publicContacts

private var _publicContacts: Object

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

See Also

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

<getFavourites>

<addFavourite>

_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

Functions

Person

function Person(nsid: String)
Constructor functioncreates a new Person object.

Should be called via <PersonManager.getPerson>

addPublicGroup

function addPublicGroup(group: Group,
isAdmin: Boolean):Void

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

Flickr.peopleGetPublicGroups

getPublicGroups

function getPublicGroups():Array

Gets a list of the public groups that a user is a member of (if Flickr.peopleGetPublicGroups has been called for that user.

TODO

Should this call Flickr.peopleGetPublicGroups automatically if it hasn’t been called?  Probably not because then it would become asyncronous and couldn’t return the result immediately

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

Flickr.peopleGetPublicGroups

addPublicContact

function addPublicContact(contact: Person):Void

Add’s a public contact to this user

Parameters

contactThe Person you are adding.

See Also

Flickr.contactsGetPublicList

getPublicContacts

getPublicContacts

function getPublicContacts():Object

Gets a list of the public contacts that this user has (if addPublicContact has been called for this user.

Returns

An Object containing Person objects indexed by their nsids.

See Also

Flickr.contactsGetPublicList

addPublicContact

addFavorite

function addFavorite(photo: Photo):Void

Add’s a favourite Photo to this user.

Parameters

photoThe Photo you are adding.

See Also

Flickr.favoritesGetPublicList

getFavorites

getFavorites

function getFavorites():Object

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

Returns

An Object containing Photo objects indexed by their ids.

See Also

Flickr.favoritesGetPublicList

<addFavourite>

addPhoto

function addPhoto(photo: Photo):Void

Adds this Photo into this Person’s _photos Array if it isn’t already there

Parameters

photoThe Photo you are adding.

addTag

function addTag(tag: Tag,
count: Number):Void

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.

getTags

public function getTags():Object

Get’s this persons _tags.

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.
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
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 online: Number
If this person is online.
public var awayMessage: String
This person’s away message (if they are away).
public var realname: String
This person’s real name.
public var location: String
This person’s location.
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.
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 Tag’s
Class to describe a tag on a photo on 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.
function Person(nsid: String)
function addPublicGroup(group: Group,
isAdmin: Boolean):Void
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 Flickr.peopleGetPublicGroups has been called for that user.
function peopleGetPublicGroups(nsid: String)
Calls flickr.people.getPublicGroups to get the list of public groups a user is a member of.
function addPublicContact(contact: Person):Void
Add’s a public contact to this user
function getPublicContacts():Object
Gets a list of the public contacts that this user has (if addPublicContact has been called for this user.
function addFavorite(photo: Photo):Void
Add’s a favourite Photo to this user.
function getFavorites():Object
Gets a list of the favorite Photo’s that this user has.
function addPhoto(photo: Photo):Void
Adds this Photo into this Person’s _photos Array if it isn’t already there
function addTag(tag: Tag,
count: Number):Void
Adds a Tag into this Person’s _tags Array if it isn’t already there
public function getTags():Object
Get’s this persons _tags.
public static function getPerson(nsid: String):Person
Get’s a Person object for the given nsid.
function photosGetInfo (photoId: Number,
secret: Number)
Calls flickr.photos.getInfo to get information about a photo..
Class to describe a group from Flickr.
public function contactsGetPublicList(nsid: String)
Calls flickr.contacts.getPublicList to get a list of contacts a user.
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.