81910fa7817509cec7c661855d56f8fa70180fa8
[atutor.git] / docs / jscripts / opensocial / responseitem.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 ResponseItem containing information about a specific response
17  * from the server.
18  */
19
20
21 /**
22  * @class
23  * Represents a response that was generated
24  * by processing a data request item on the server.
25  *
26  * @name opensocial.ResponseItem
27  */
28
29
30 /**
31  * Represents a response that was generated by processing a data request item
32  * on the server.
33  *
34  * @private
35  * @constructor
36  */
37 opensocial.ResponseItem = function() {};
38
39
40 /**
41  * Returns true if there was an error in fetching this data from the server.
42  *
43  * @return {Boolean} True if there was an error; otherwise, false
44  */
45 opensocial.ResponseItem.prototype.hadError = function() {};
46
47
48 /**
49  * @static
50  * @class
51  *
52  * Error codes that a response item can return.
53  *
54  * @name opensocial.ResponseItem.Error
55  */
56 opensocial.ResponseItem.Error = {
57   /**
58    * This container does not support the request that was made.
59    * This field may be used interchangeably with the string 'notImplemented'.
60    * @member opensocial.ResponseItem.Error
61    */
62   NOT_IMPLEMENTED : 'notImplemented',
63
64   /**
65    * The gadget does not have access to the requested data.
66    * To get access, use
67    * <a href="opensocial.html#requestPermission">
68    * opensocial.requestPermission()</a>.
69    * This field may be used interchangeably with the string 'unauthorized'.
70    * @member opensocial.ResponseItem.Error
71    */
72   UNAUTHORIZED : 'unauthorized',
73
74   /**
75    * The gadget can never have access to the requested data.
76    * This field may be used interchangeably with the string 'forbidden'.
77    * @member opensocial.ResponseItem.Error
78    */
79   FORBIDDEN : 'forbidden',
80
81    /**
82    * The request was invalid. Example: 'max' was -1.
83    * This field may be used interchangeably with the string 'badRequest'.
84    * @member opensocial.ResponseItem.Error
85    */
86   BAD_REQUEST : 'badRequest',
87
88   /**
89    * The request encountered an unexpected condition that
90    * prevented it from fulfilling the request.
91    * This field may be used interchangeably with the string 'internalError'.
92    * @member opensocial.ResponseItem.Error
93    */
94   INTERNAL_ERROR : 'internalError',
95
96   /**
97    * The gadget exceeded a quota on the request. Example quotas include a
98    * max number of calls per day, calls per user per day, calls within a
99    * certain time period and so forth.
100    * This field may be used interchangeably with the string 'limitExceeded'.
101    * @member opensocial.ResponseItem.Error
102    */
103   LIMIT_EXCEEDED : 'limitExceeded'
104 };
105
106
107 /**
108  * If the request had an error, returns the error code.
109  * The error code can be container-specific
110  * or one of the values defined by
111  * <a href="opensocial.ResponseItem.Error.html"><code>Error</code></a>.
112  *
113  * @return {String} The error code, or null if no error occurred
114  */
115 opensocial.ResponseItem.prototype.getErrorCode = function() {};
116
117
118 /**
119  * If the request had an error, returns the error message.
120  *
121  * @return {String} A human-readable description of the error that occurred;
122  *    can be null, even if an error occurred
123  */
124 opensocial.ResponseItem.prototype.getErrorMessage = function() {};
125
126
127 /**
128  * Returns the original data request item.
129  *
130  * @return {Object} The request item used to fetch this data
131  *    response
132  */
133 opensocial.ResponseItem.prototype.getOriginalDataRequest = function() {};
134
135
136 /**
137  * Gets the response data.
138  *
139  * @return {Object} The requested value calculated by the server; the type of
140  *    this value is defined by the type of request that was made
141  */
142 opensocial.ResponseItem.prototype.getData = function() {};