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
6 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 * @fileoverview Representation of a environment.
22 * Represents the current environment for a gadget.
26 * <a href="opensocial.html#getEnvironment">opensocial.getEnvironment()</a>,
28 * @name opensocial.Environment
33 * Base interface for all environment objects.
35 * @param {String} domain The current domain
36 * @param {Map.<String, Map.<String, Boolean>>} supportedFields
37 * The fields supported by this container
42 opensocial.Environment = function() {};
46 * Returns the current domain —
47 * for example, "orkut.com" or "myspace.com".
49 * @return {String} The domain
51 opensocial.Environment.prototype.getDomain = function() {};
58 * The types of objects in this container.
62 * <a href="opensocial.Environment.html#supportsField">
63 * <code>Environment.supportsField()</code></a>
65 * @name opensocial.Environment.ObjectType
67 opensocial.Environment.ObjectType = {
69 * This field may be used interchangeably with the string 'person'.
70 * @member opensocial.Environment.ObjectType
74 * This field may be used interchangeably with the string 'address'.
75 * @member opensocial.Environment.ObjectType
79 * This field may be used interchangeably with the string 'bodyType'.
80 * @member opensocial.Environment.ObjectType
82 BODY_TYPE : 'bodyType',
84 * This field may be used interchangeably with the string 'email'.
85 * @member opensocial.Environment.ObjectType
89 * This field may be used interchangeably with the string 'name'.
90 * @member opensocial.Environment.ObjectType
94 * This field may be used interchangeably with the string 'organization'.
95 * @member opensocial.Environment.ObjectType
97 ORGANIZATION : 'organization',
99 * This field may be used interchangeably with the string 'phone'.
100 * @member opensocial.Environment.ObjectType
104 * This field may be used interchangeably with the string 'url'.
105 * @member opensocial.Environment.ObjectType
109 * This field may be used interchangeably with the string 'activity'.
110 * @member opensocial.Environment.ObjectType
112 ACTIVITY : 'activity',
114 * This field may be used interchangeably with the string 'mediaItem'.
115 * @member opensocial.Environment.ObjectType
117 MEDIA_ITEM : 'mediaItem',
119 * This field may be used interchangeably with the string 'message'.
120 * @member opensocial.Environment.ObjectType
124 * This field may be used interchangeably with the string 'messageType'.
125 * @member opensocial.Environment.ObjectType
127 MESSAGE_TYPE : 'messageType',
129 * This field may be used interchangeably with the string 'sortOrder'.
130 * @member opensocial.Environment.ObjectType
132 SORT_ORDER : 'sortOrder',
134 * This field may be used interchangeably with the string 'filterType'.
135 * @member opensocial.Environment.ObjectType
137 FILTER_TYPE : 'filterType'
142 * Returns true if the specified field is supported in this container on the
143 * given object type, and returns false otherwise.
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
151 opensocial.Environment.prototype.supportsField = function(objectType,