1aab2a3bcbbcbfdaac1376b11fc23f9354f58cf6
[atutor.git] / docs / jscripts / opensocial / person.js
1 /*
2  * Licensed under the Apache License, Version 2.0 (the "License");
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  *     http://www.apache.org/licenses/LICENSE-2.0
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11  * See the License for the specific language governing permissions and
12  * limitations under the License.
13  */
14
15 /**
16  * @fileoverview Representation of a person.
17  */
18
19
20 /**
21  * @class
22  * Base interface for all person objects.
23  *
24  * @name opensocial.Person
25  */
26
27
28 /**
29  * Base interface for all person objects.
30  *
31  * @private
32  * @constructor
33  */
34 opensocial.Person = function() {};
35
36
37 /**
38  * @static
39  * @class
40  * All of the fields that a person has. These are the supported keys for the
41  * <a href="opensocial.Person.html#getField">Person.getField()</a> method.
42  *
43  * @name opensocial.Person.Field
44  */
45 opensocial.Person.Field = {
46   /**
47    * A string ID that can be permanently associated with this person.
48    * This field may be used interchangeably with the string 'id'.
49    * @member opensocial.Person.Field
50    */
51   ID : 'id',
52
53   /**
54    * A opensocial.Name object containing the person's name.
55    * This field may be used interchangeably with the string 'name'.
56    * @member opensocial.Person.Field
57    */
58   NAME : 'name',
59
60   /**
61    * A String representing the person's nickname. This represents the casual 
62    * way to address this person in real life. 
63    * This field may be used interchangeably with the string 'nickname'.
64    * @member opensocial.Person.Field
65    */
66   NICKNAME : 'nickname',
67
68   /**
69    * Person's photo thumbnail URL, specified as a string.
70    * This URL must be fully qualified. Relative URLs will not work in gadgets.
71    * This field may be used interchangeably with the string 'thumbnailUrl'.
72    * @member opensocial.Person.Field
73    */
74   THUMBNAIL_URL : 'thumbnailUrl',
75
76   /**
77    * Person's profile URL, specified as a string.
78    * This URL must be fully qualified. Relative URLs will not work in gadgets.
79    * Container support for this field is OPTIONAL.
80    * This field may be used interchangeably with the string 'profileUrl'.
81    * @member opensocial.Person.Field
82    */
83   PROFILE_URL : 'profileUrl',
84
85   /**
86    * Person's current location, specified as an
87    * <a href="opensocial.Address.html">Address</a>.
88    * Container support for this field is OPTIONAL.
89    * This field may be used interchangeably with the string 'currentLocation'.
90    * @member opensocial.Person.Field
91    */
92   CURRENT_LOCATION : 'currentLocation',
93
94   /**
95    * Addresses associated with the person, specified as an Array of
96    * <a href="opensocial.Address.html">Address</a>es.
97    * Container support for this field is OPTIONAL.
98    * This field may be used interchangeably with the string 'addresses'.
99    * @member opensocial.Person.Field
100    */
101   ADDRESSES : 'addresses',
102
103   /**
104    * Emails associated with the person, specified as an Array of
105    * <a href="opensocial.Email.html">Email</a>s.
106    * Container support for this field is OPTIONAL.
107    * This field may be used interchangeably with the string 'emails'.
108    * @member opensocial.Person.Field
109    */
110   EMAILS : 'emails',
111
112   /**
113    * Phone numbers associated with the person, specified as an Array of
114    * <a href="opensocial.Phone.html">Phone</a>s.
115    * Container support for this field is OPTIONAL.
116    * This field may be used interchangeably with the string 'phoneNumbers'.
117    * @member opensocial.Person.Field
118    */
119   PHONE_NUMBERS : 'phoneNumbers',
120
121   /**
122    * A general statement about the person, specified as a string.
123    * Container support for this field is OPTIONAL.
124    * This field may be used interchangeably with the string 'aboutMe'.
125    * @member opensocial.Person.Field
126    */
127   ABOUT_ME : 'aboutMe',
128
129   /**
130    * Person's status, headline or shoutout, specified as a string.
131    * Container support for this field is OPTIONAL.
132    * This field may be used interchangeably with the string 'status'.
133    * @member opensocial.Person.Field
134    */
135   STATUS : 'status',
136
137   /**
138    * Person's profile song, specified as an opensocial.Url.
139    * Container support for this field is OPTIONAL.
140    * This field may be used interchangeably with the string 'profileSong'.
141    * @member opensocial.Person.Field
142    */
143   PROFILE_SONG : 'profileSong',
144
145   /**
146    * Person's profile video, specified as an opensocial.Url.
147    * Container support for this field is OPTIONAL.
148    * This field may be used interchangeably with the string 'profileVideo'.
149    * @member opensocial.Person.Field
150    */
151   PROFILE_VIDEO : 'profileVideo',
152
153   /**
154    * Person's gender, specified as an opensocial.Enum with the enum's
155    * key referencing opensocial.Enum.Gender.
156    * Container support for this field is OPTIONAL.
157    * This field may be used interchangeably with the string 'gender'.
158    * @member opensocial.Person.Field
159    */
160   GENDER : 'gender',
161
162   /**
163    * Person's sexual orientation, specified as a string.
164    * Container support for this field is OPTIONAL.
165    * This field may be used interchangeably with the string 'sexualOrientation'.
166    * @member opensocial.Person.Field
167    */
168   SEXUAL_ORIENTATION : 'sexualOrientation',
169
170   /**
171    * Person's relationship status, specified as a string.
172    * Container support for this field is OPTIONAL.
173    * This field may be used interchangeably with the string 
174    * 'relationshipStatus'.
175    * @member opensocial.Person.Field
176    */
177   RELATIONSHIP_STATUS : 'relationshipStatus',
178
179   /**
180    * Person's age, specified as a number.
181    * Container support for this field is OPTIONAL.
182    * This field may be used interchangeably with the string 'age'.
183    * @member opensocial.Person.Field
184    */
185   AGE : 'age',
186
187   /**
188    * Person's date of birth, specified as a Date object.
189    * Container support for this field is OPTIONAL.
190    * This field may be used interchangeably with the string 'dateOfBirth'.
191    * @member opensocial.Person.Field
192    */
193   DATE_OF_BIRTH : 'dateOfBirth',
194
195   /**
196    * Person's body characteristics, specified as an opensocial.BodyType.
197    * Container support for this field is OPTIONAL.
198    * This field may be used interchangeably with the string 'bodyType'.
199    * @member opensocial.Person.Field
200    */
201   BODY_TYPE : 'bodyType',
202
203   /**
204    * Person's ethnicity, specified as a string.
205    * Container support for this field is OPTIONAL.
206    * This field may be used interchangeably with the string 'ethnicity'.
207    * @member opensocial.Person.Field
208    */
209   ETHNICITY : 'ethnicity',
210
211   /**
212    * Person's smoking status, specified as an opensocial.Enum with the enum's
213    * key referencing opensocial.Enum.Smoker.
214    * Container support for this field is OPTIONAL.
215    * This field may be used interchangeably with the string 'smoker'.
216    * @member opensocial.Person.Field
217    */
218   SMOKER : 'smoker',
219
220   /**
221    * Person's drinking status, specified as an opensocial.Enum with the enum's
222    * key referencing opensocial.Enum.Drinker.
223    * Container support for this field is OPTIONAL.
224    * This field may be used interchangeably with the string 'drinker'.
225    * @member opensocial.Person.Field
226    */
227   DRINKER : 'drinker',
228
229   /**
230    * Description of the person's children, specified as a string.
231    * Container support for this field is OPTIONAL.
232    * This field may be used interchangeably with the string 'children'.
233    * @member opensocial.Person.Field
234    */
235   CHILDREN : 'children',
236
237   /**
238    * Description of the person's pets, specified as a string.
239    * Container support for this field is OPTIONAL.
240    * This field may be used interchangeably with the string 'pets'.
241    * @member opensocial.Person.Field
242    */
243   PETS : 'pets',
244
245   /**
246    * Description of the person's living arrangement, specified as a string.
247    * Container support for this field is OPTIONAL.
248    * This field may be used interchangeably with the string 'livingArrangement'.
249    * @member opensocial.Person.Field
250    */
251   LIVING_ARRANGEMENT : 'livingArrangement',
252
253   /**
254    * Person's time zone, specified as the difference in minutes between
255    * Greenwich Mean Time (GMT) and the user's local time. See
256    * Date.getTimezoneOffset() in javascript for more details on this format.
257    * Container support for this field is OPTIONAL.
258    * This field may be used interchangeably with the string 'timeZone'.
259    * @member opensocial.Person.Field
260    */
261   TIME_ZONE : 'timeZone',
262
263   /**
264    * List of the languages that the person speaks as ISO 639-1 codes,
265    * specified as an Array of strings.
266    * Container support for this field is OPTIONAL.
267    * This field may be used interchangeably with the string 'languagesSpoken'.
268    * @member opensocial.Person.Field
269    */
270   LANGUAGES_SPOKEN : 'languagesSpoken',
271
272   /**
273    * Jobs the person has held, specified as an Array of
274    * <a href="opensocial.Organization.html">Organization</a>s.
275    * Container support for this field is OPTIONAL.
276    * This field may be used interchangeably with the string 'jobs'.
277    * @member opensocial.Person.Field
278    */
279   JOBS : 'jobs',
280
281   /**
282    * Person's favorite jobs, or job interests and skills, specified as a string.
283    * Container support for this field is OPTIONAL.
284    * This field may be used interchangeably with the string 'jobInterests'.
285    * @member opensocial.Person.Field
286    */
287   JOB_INTERESTS : 'jobInterests',
288
289   /**
290    * Schools the person has attended, specified as an Array of
291    * <a href="opensocial.Organization.html">Organization</a>s.
292    * Container support for this field is OPTIONAL.
293    * This field may be used interchangeably with the string 'schools'.
294    * @member opensocial.Person.Field
295    */
296   SCHOOLS : 'schools',
297
298   /**
299    * Person's interests, hobbies or passions, specified as an Array of strings.
300    * Container support for this field is OPTIONAL.
301    * This field may be used interchangeably with the string 'interests'.
302    * @member opensocial.Person.Field
303    */
304   INTERESTS : 'interests',
305
306   /**
307    * URLs related to the person, their webpages, or feeds. Specified as an
308    * Array of opensocial.Url.
309    * Container support for this field is OPTIONAL.
310    * This field may be used interchangeably with the string 'urls'.
311    * @member opensocial.Person.Field
312    */
313   URLS : 'urls',
314
315   /**
316    * Person's favorite music, specified as an Array of strings.
317    * Container support for this field is OPTIONAL.
318    * This field may be used interchangeably with the string 'music'.
319    * @member opensocial.Person.Field
320    */
321   MUSIC : 'music',
322
323   /**
324    * Person's favorite movies, specified as an Array of strings.
325    * Container support for this field is OPTIONAL.
326    * This field may be used interchangeably with the string 'movies'.
327    * @member opensocial.Person.Field
328    */
329   MOVIES : 'movies',
330
331   /**
332    * Person's favorite TV shows, specified as an Array of strings.
333    * Container support for this field is OPTIONAL.
334    * This field may be used interchangeably with the string 'tvShows'.
335    * @member opensocial.Person.Field
336    */
337   TV_SHOWS : 'tvShows',
338
339   /**
340    * Person's favorite books, specified as an Array of strings.
341    * Container support for this field is OPTIONAL.
342    * This field may be used interchangeably with the string 'books'.
343    * @member opensocial.Person.Field
344    */
345   BOOKS : 'books',
346
347   /**
348    * Person's favorite activities, specified as an Array of strings.
349    * Container support for this field is OPTIONAL.
350    * This field may be used interchangeably with the string 'activities'.
351    * @member opensocial.Person.Field
352    */
353   ACTIVITIES : 'activities',
354
355   /**
356    * Person's favorite sports, specified as an Array of strings.
357    * Container support for this field is OPTIONAL.
358    * This field may be used interchangeably with the string 'sports'.
359    * @member opensocial.Person.Field
360    */
361   SPORTS : 'sports',
362
363   /**
364    * Person's favorite heroes, specified as an Array of strings.
365    * Container support for this field is OPTIONAL.
366    * This field may be used interchangeably with the string 'heroes'.
367    * @member opensocial.Person.Field
368    */
369   HEROES : 'heroes',
370
371   /**
372    * Person's favorite quotes, specified as an Array of strings.
373    * Container support for this field is OPTIONAL.
374    * This field may be used interchangeably with the string 'quotes'.
375    * @member opensocial.Person.Field
376    */
377   QUOTES : 'quotes',
378
379   /**
380    * Person's favorite cars, specified as an Array of strings.
381    * Container support for this field is OPTIONAL.
382    * This field may be used interchangeably with the string 'cars'.
383    * @member opensocial.Person.Field
384    */
385   CARS : 'cars',
386
387   /**
388    * Person's favorite food, specified as an Array of strings.
389    * Container support for this field is OPTIONAL.
390    * This field may be used interchangeably with the string 'food'.
391    * @member opensocial.Person.Field
392    */
393   FOOD : 'food',
394
395   /**
396    * Person's turn ons, specified as an Array of strings.
397    * Container support for this field is OPTIONAL.
398    * This field may be used interchangeably with the string 'turnOns'.
399    * @member opensocial.Person.Field
400    */
401   TURN_ONS : 'turnOns',
402
403   /**
404    * Person's turn offs, specified as an Array of strings.
405    * Container support for this field is OPTIONAL.
406    * This field may be used interchangeably with the string 'turnOffs'.
407    * @member opensocial.Person.Field
408    */
409   TURN_OFFS : 'turnOffs',
410
411   /**
412    * Arbitrary tags about the person, specified as an Array of strings.
413    * Container support for this field is OPTIONAL.
414    * This field may be used interchangeably with the string 'tags'.
415    * @member opensocial.Person.Field
416    */
417   TAGS : 'tags',
418
419   /**
420    * Person's comments about romance, specified as a string.
421    * Container support for this field is OPTIONAL.
422    * This field may be used interchangeably with the string 'romance'.
423    * @member opensocial.Person.Field
424    */
425   ROMANCE : 'romance',
426
427   /**
428    * What the person is scared of, specified as a string.
429    * Container support for this field is OPTIONAL.
430    * This field may be used interchangeably with the string 'scaredOf'.
431    * @member opensocial.Person.Field
432    */
433   SCARED_OF : 'scaredOf',
434
435   /**
436    * Describes when the person is happiest, specified as a string.
437    * Container support for this field is OPTIONAL.
438    * This field may be used interchangeably with the string 'happiestWhen'.
439    * @member opensocial.Person.Field
440    */
441   HAPPIEST_WHEN : 'happiestWhen',
442
443   /**
444    * Person's thoughts on fashion, specified as a string.
445    * Container support for this field is OPTIONAL.
446    * This field may be used interchangeably with the string 'fashion'.
447    * @member opensocial.Person.Field
448    */
449   FASHION : 'fashion',
450
451   /**
452    * Person's thoughts on humor, specified as a string.
453    * Container support for this field is OPTIONAL.
454    * This field may be used interchangeably with the string 'humor'.
455    * @member opensocial.Person.Field
456    */
457   HUMOR : 'humor',
458
459   /**
460    * Person's statement about who or what they are looking for, or what they are
461    * interested in meeting people for. Specified as an Array of opensocial.Enum
462    * with the enum's key referencing opensocial.Enum.LookingFor.
463    * Container support for this field is OPTIONAL.
464    * This field may be used interchangeably with the string 'lookingFor'.
465    * @member opensocial.Person.Field
466    */
467   LOOKING_FOR : 'lookingFor',
468
469   /**
470    * Person's relgion or religious views, specified as a string.
471    * Container support for this field is OPTIONAL.
472    * This field may be used interchangeably with the string 'religion'.
473    * @member opensocial.Person.Field
474    */
475   RELIGION : 'religion',
476
477   /**
478    * Person's political views, specified as a string.
479    * Container support for this field is OPTIONAL.
480    * This field may be used interchangeably with the string 'politicalViews'.
481    * @member opensocial.Person.Field
482    */
483   POLITICAL_VIEWS : 'politicalViews',
484
485   /**
486    * A boolean indicating whether the person has used the current app.
487    * Container support for this field is OPTIONAL.
488    * This field may be used interchangeably with the string 'hasApp'.
489    * @member opensocial.Person.Field
490    */
491   HAS_APP : 'hasApp',
492
493   /**
494    * Person's current network status. Specified as an Enum with the enum's
495    * key referencing opensocial.Enum.Presence.
496    * Container support for this field is OPTIONAL.
497    * This field may be used interchangeably with the string 'networkPresence'.
498    * @member opensocial.Person.Field
499    */
500   NETWORK_PRESENCE : 'networkPresence'
501 };
502
503
504 /**
505  * Gets an ID that can be permanently associated with this person.
506  *
507  * @return {String} The ID
508  */
509 opensocial.Person.prototype.getId = function() {};
510
511
512 /**
513  * Gets a text display name for this person; guaranteed to return
514  * a useful string.
515  *
516  * @return {String} The display name
517  */
518 opensocial.Person.prototype.getDisplayName = function() {};
519
520
521 /**
522  * Gets data for this person that is associated with the specified key.
523  *
524  * @param {String} key The key to get data for;
525  *    keys are defined in <a href="opensocial.Person.Field.html"><code>
526  *    Person.Field</code></a>
527  * @param {Map.&lt;opensocial.DataRequest.DataRequestFields, Object&gt;}
528  *  opt_params Additional
529  *    <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
530  *    to pass to the request.
531  * @return {String} The data
532  */
533 opensocial.Person.prototype.getField = function(key, opt_params) {};
534
535
536 /**
537  * Returns true if this person object represents the currently logged in user.
538  *
539  * @return {Boolean} True if this is the currently logged in user;
540  *   otherwise, false
541  */
542 opensocial.Person.prototype.isViewer = function() {};
543
544
545 /**
546  * Returns true if this person object represents the owner of the current page.
547  *
548  * @return {Boolean} True if this is the owner of the page;
549  *   otherwise, false
550  */
551 opensocial.Person.prototype.isOwner = function() {};