remove old readme
[atutor.git] / jscripts / opensocial / environment.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 environment.
17  */
18
19
20 /**
21  * @class
22  * Represents the current environment for a gadget.
23  *
24  * <p>
25  * <b>See also:</b>
26  * <a href="opensocial.html#getEnvironment">opensocial.getEnvironment()</a>,
27  *
28  * @name opensocial.Environment
29  */
30
31
32 /**
33  * Base interface for all environment objects.
34  *
35  * @param {String} domain The current domain
36  * @param {Map.&lt;String, Map.&lt;String, Boolean&gt;&gt;} supportedFields
37  *    The fields supported by this container
38  *
39  * @private
40  * @constructor
41  */
42 opensocial.Environment = function() {};
43
44
45 /**
46  * Returns the current domain &mdash;
47  * for example, "orkut.com" or "myspace.com".
48  *
49  * @return {String} The domain
50  */
51 opensocial.Environment.prototype.getDomain = function() {};
52
53
54 /**
55  * @static
56  * @class
57  *
58  * The types of objects in this container.
59  *
60  * <p>
61  * <b>See also:</b>
62  * <a href="opensocial.Environment.html#supportsField">
63  * <code>Environment.supportsField()</code></a>
64  *
65  * @name opensocial.Environment.ObjectType
66  */
67 opensocial.Environment.ObjectType = {
68   /**
69    * This field may be used interchangeably with the string 'person'.
70    * @member opensocial.Environment.ObjectType
71    */
72   PERSON : 'person',
73   /**
74    * This field may be used interchangeably with the string 'address'.
75    * @member opensocial.Environment.ObjectType
76    */
77   ADDRESS : 'address',
78   /**
79    * This field may be used interchangeably with the string 'bodyType'.
80    * @member opensocial.Environment.ObjectType
81    */
82   BODY_TYPE : 'bodyType',
83   /**
84    * This field may be used interchangeably with the string 'email'.
85    * @member opensocial.Environment.ObjectType
86    */
87   EMAIL : 'email',
88   /**
89    * This field may be used interchangeably with the string 'name'.
90    * @member opensocial.Environment.ObjectType
91    */
92   NAME : 'name',
93   /**
94    * This field may be used interchangeably with the string 'organization'.
95    * @member opensocial.Environment.ObjectType
96    */
97   ORGANIZATION : 'organization',
98   /**
99    * This field may be used interchangeably with the string 'phone'.
100    * @member opensocial.Environment.ObjectType
101    */
102   PHONE : 'phone',
103   /**
104    * This field may be used interchangeably with the string 'url'.
105    * @member opensocial.Environment.ObjectType
106    */
107   URL : 'url',
108   /**
109    * This field may be used interchangeably with the string 'activity'.
110    * @member opensocial.Environment.ObjectType
111    */
112   ACTIVITY : 'activity',
113   /**
114    * This field may be used interchangeably with the string 'mediaItem'.
115    * @member opensocial.Environment.ObjectType
116    */
117   MEDIA_ITEM : 'mediaItem',
118   /**
119    * This field may be used interchangeably with the string 'message'.
120    * @member opensocial.Environment.ObjectType
121    */
122   MESSAGE : 'message',
123   /**
124    * This field may be used interchangeably with the string 'messageType'.
125    * @member opensocial.Environment.ObjectType
126    */
127   MESSAGE_TYPE : 'messageType',
128   /**
129    * This field may be used interchangeably with the string 'sortOrder'.
130    * @member opensocial.Environment.ObjectType
131    */
132   SORT_ORDER : 'sortOrder',
133   /**
134    * This field may be used interchangeably with the string 'filterType'.
135    * @member opensocial.Environment.ObjectType
136    */
137   FILTER_TYPE : 'filterType'
138 };
139
140
141 /**
142  * Returns true if the specified field is supported in this container on the
143  * given object type, and returns false otherwise.
144  *
145  * @param {opensocial.Environment.ObjectType} objectType
146  *    The <a href="opensocial.Environment.ObjectType.html">object type</a>
147  *    to check for the field
148  * @param {String} fieldName The name of the field to check for
149  * @return {Boolean} True if the field is supported on the specified object type
150  */
151 opensocial.Environment.prototype.supportsField = function(objectType,
152     fieldName) {};