/* Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights embodied in the content of this file are licensed under the BSD (revised) open source license */ package com.yahoo.social { import com.yahoo.oauth.OAuthToken; import com.yahoo.social.methodgroups.ConnectionsRequest; import com.yahoo.social.methodgroups.ContactsRequest; import com.yahoo.social.methodgroups.ProfileRequest; import com.yahoo.social.methodgroups.StatusRequest; import com.yahoo.social.methodgroups.UpdatesRequest; import com.yahoo.social.methodgroups.YQL; /** * YahooUser contains the session and guid properties of a Yahoo user and the methods to query data from Profiles, Social Directory, Presence and Vitality. * @author Zach Graves (zachg@yahoo-inc.com) * @example *
* Examples language codes: *
The default value is en-US
* Example regions codes: *
The default value is en-US
getUser or getSessionedUser methods of YahooSession.
* This is in order to provide session and authentication information to the API methods attached to this user.
*
* @see YahooSession.
*
* @param session A YahooSession object.
* @param guid The GUID of the user.
*/
public function YahooUser(session:YahooSession, guid:String)
{
super();
this.$session = session;
this.$guid = guid;
this.$connections = new ConnectionsRequest();
this.$connections.user = this;
this.$contacts = new ContactsRequest();
this.$contacts.user = this;
this.$status = new StatusRequest();
this.$status.user = this;
this.$profile = new ProfileRequest();
this.$profile.user = this;
this.$updates = new UpdatesRequest();
this.$updates.user = this;
this.$yql = new YQL();
this.$yql.user = this;
}
//--------------------------------------
// Public functions
//--------------------------------------
/**
* Sets the small view for this user.
*
* Supports only HTML and YML Lite
*
* @param content HTML and YML Lite contents.
*/
public function setSmallView(content:String):void
{
this.$session.application.setSmallView(this.guid,content);
}
//--------------------------------------
// Properties
//--------------------------------------
/**
* Returns a boolean, true if this user is the currently sessioned viewer of the app.
* @return
*
*/
public function get sessioned():Boolean
{
var accessToken:OAuthToken = this.$session.getAccessToken();
return (accessToken && accessToken.guid == this.$guid);
}
/**
* The global YahooSession object.
* @return
*
*/
public function get session():YahooSession
{
return this.$session;
}
/**
* The GUID of this user, a 26-character string which represents a Yahoo! user.
*
* @return
* @see http://developer.yahoo.com/social/rest_api_guide/web-services-guids.html
*/
public function get guid():String
{
return this.$guid;
}
//--------------------------------------
// Method group accessors
//--------------------------------------
/**
* The instance of the ConnectionsRequest API for this user.
* @see ConnectionsRequest
* @return
*
*/
public function get connections():ConnectionsRequest
{
return this.$connections;
}
/**
* The instance of the ContactsRequest API for this user.
* @see ContactsRequest
* @return
*
*/
public function get contacts():ContactsRequest
{
return this.$contacts;
}
/**
* The instance of the StatusRequest API for this user.
* @see StatusRequest
* @return
*
*/
public function get status():StatusRequest
{
return this.$status;
}
/**
* The instance of the ProfileRequest API for this user.
* @see ProfileRequest
* @return
*
*/
public function get profile():ProfileRequest
{
return this.$profile;
}
/**
* The instance of the UpdatesRequest API for this user.
* @see UpdatesRequest
* @return
*
*/
public function get updates():UpdatesRequest
{
return this.$updates;
}
/**
* The instance of the YQL API for this user.
* @see YQL
* @return
*
*/
public function get yql():YQL
{
return this.$yql;
}
}
}