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 message.
22 * Base interface for all message objects.
26 * <a href="opensocial.html#newMessage">opensocial.newMessage()</a>,
27 * <a href="opensocial.html#requestSendMessage">
28 * opensocial.requestSendMessage()</a>
32 * @name opensocial.Message
37 * Base interface for all message objects.
39 * @param {String} body The main text of the message.
40 * @param {Map.<opensocial.Message.Field, Object>} opt_params Any other
41 * fields that should be set on the message object. All of the defined
42 * Fields are supported.
46 opensocial.Message = function() {};
52 * All of the fields that messages can have.
57 * href="opensocial.Message.html#getField">opensocial.Message.getField()</a>
60 * @name opensocial.Message.Field
62 opensocial.Message.Field = {
64 * The title of the message, specified as an opensocial.Message.Type.
65 * This field may be used interchangeably with the string 'type'.
66 * @member opensocial.Message.Field
71 * The title of the message. HTML attributes are allowed and are
72 * sanitized by the container.
73 * This field may be used interchangeably with the string 'title'.
74 * @member opensocial.Message.Field
79 * The main text of the message. HTML attributes are allowed and are
80 * sanitized by the container.
81 * This field may be used interchangeably with the string 'body'.
82 * @member opensocial.Message.Field
87 * The title of the message as a message template. Specifies the
88 * message ID to use in the gadget xml.
89 * This field may be used interchangeably with the string 'titleId'.
90 * @member opensocial.Message.Field
95 * The main text of the message as a message template. Specifies the
96 * message ID to use in the gadget xml.
97 * This field may be used interchangeably with the string 'bodyId'.
98 * @member opensocial.Message.Field
107 * The types of messages that can be sent.
109 * @name opensocial.Message.Type
111 opensocial.Message.Type = {
114 * This field may be used interchangeably with the string 'email'.
115 * @member opensocial.Message.Type
120 * A short private message.
121 * This field may be used interchangeably with the string 'notification'.
122 * @member opensocial.Message.Type
124 NOTIFICATION : 'notification',
127 * A message to a specific user that can be seen only by that user.
128 * This field may be used interchangeably with the string 'privateMessage'.
129 * @member opensocial.Message.Type
131 PRIVATE_MESSAGE : 'privateMessage',
134 * A message to a specific user that can be seen by more than that user.
135 * This field may be used interchangeably with the string 'publicMessage'.
136 * @member opensocial.Message.Type
138 PUBLIC_MESSAGE : 'publicMessage'
143 * Gets the message data that's associated with the specified key.
145 * @param {String} key The key to get data for;
146 * see the <a href="opensocial.Message.Field.html">Field</a> class
147 * for possible values
148 * @param {Map.<opensocial.DataRequest.DataRequestFields, Object>}
149 * opt_params Additional
150 * <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
151 * to pass to the request.
152 * @return {String} The data
153 * @member opensocial.Message
155 opensocial.Message.prototype.getField = function(key, opt_params) {};
159 * Sets data for this message associated with the given key.
161 * @param {String} key The key to set data for
162 * @param {String} data The data to set
164 opensocial.Message.prototype.setField = function(key, data) {};