|
1359 | 1359 | AV._initialize(applicationId, applicationKey,masterKey); |
1360 | 1360 | }; |
1361 | 1361 |
|
| 1362 | + /** |
| 1363 | + * Call this method to set production environment variable. |
| 1364 | + * @param {Boolean} production True is production environment,and |
| 1365 | + * it's true by default. |
| 1366 | + */ |
| 1367 | + AV.setProduction = function(production){ |
| 1368 | + if(!AV._isNullOrUndefined(production)) { |
| 1369 | + //make sure it's a number |
| 1370 | + production = production ? 1 : 0; |
| 1371 | + } |
| 1372 | + //default is 1 |
| 1373 | + AV.applicationProduction = AV._isNullOrUndefined(production) ? 1: production; |
| 1374 | + } |
| 1375 | + |
| 1376 | + |
1362 | 1377 | /** |
1363 | 1378 | * Call this method first to set up authentication tokens for AV. |
1364 | 1379 | * This method is for AV's own private use. |
|
4126 | 4141 | return file; |
4127 | 4142 | }; |
4128 | 4143 |
|
| 4144 | + /** |
| 4145 | + * Creates a file object with exists objectId. |
| 4146 | + * @param {String} objectId The objectId string |
| 4147 | + * @return {AV.File} the file object |
| 4148 | + */ |
| 4149 | + AV.File.createWithoutData = function(objectId){ |
| 4150 | + var file = new AV.File(); |
| 4151 | + file.id = objectId; |
| 4152 | + return file; |
| 4153 | + }; |
| 4154 | + |
| 4155 | + |
4129 | 4156 | AV.File.prototype = { |
4130 | 4157 |
|
| 4158 | + /** |
| 4159 | + * Returns the ACL for this file. |
| 4160 | + * @returns {AV.ACL} An instance of AV.ACL. |
| 4161 | + */ |
| 4162 | + getACL: function() { |
| 4163 | + return this._acl; |
| 4164 | + }, |
| 4165 | + |
| 4166 | + /** |
| 4167 | + * Sets the ACL to be used for this file. |
| 4168 | + * @param {AV.ACL} acl An instance of AV.ACL. |
| 4169 | + */ |
| 4170 | + setACL: function(acl) { |
| 4171 | + if(!(acl instanceof AV.ACL)) { |
| 4172 | + return new AV.Error(AV.Error.OTHER_CAUSE, |
| 4173 | + "ACL must be a AV.ACL."); |
| 4174 | + } |
| 4175 | + this._acl = acl; |
| 4176 | + }, |
| 4177 | + |
4131 | 4178 | /** |
4132 | 4179 | * Gets the name of the file. Before save is called, this is the filename |
4133 | 4180 | * given by the user. After save is called, that name gets prefixed with a |
|
7342 | 7389 | return query; |
7343 | 7390 | }; |
7344 | 7391 |
|
| 7392 | + /** |
| 7393 | + * Constructs a AV.Query that is the AND of the passed in queries. For |
| 7394 | + * example: |
| 7395 | + * <pre>var compoundQuery = AV.Query.and(query1, query2, query3);</pre> |
| 7396 | + * |
| 7397 | + * will create a compoundQuery that is an 'and' of the query1, query2, and |
| 7398 | + * query3. |
| 7399 | + * @param {...AV.Query} var_args The list of queries to AND. |
| 7400 | + * @return {AV.Query} The query that is the AND of the passed in queries. |
| 7401 | + */ |
| 7402 | + AV.Query.and = function() { |
| 7403 | + var queries = _.toArray(arguments); |
| 7404 | + var className = null; |
| 7405 | + AV._arrayEach(queries, function(q) { |
| 7406 | + if (_.isNull(className)) { |
| 7407 | + className = q.className; |
| 7408 | + } |
| 7409 | + |
| 7410 | + if (className !== q.className) { |
| 7411 | + throw "All queries must be for the same class"; |
| 7412 | + } |
| 7413 | + }); |
| 7414 | + var query = new AV.Query(className); |
| 7415 | + query._andQuery(queries); |
| 7416 | + return query; |
| 7417 | + }; |
| 7418 | + |
| 7419 | + |
7345 | 7420 | /** |
7346 | 7421 | * Retrieves a list of AVObjects that satisfy the CQL. |
7347 | 7422 | * CQL syntax please see <a href='https://cn.avoscloud.com/docs/cql_guide.html'>CQL Guide.</a> |
|
8923 | 8998 | /** |
8924 | 8999 | * Makes a call to verify sms code that sent by AV.Cloud.requestSmsCode |
8925 | 9000 | * @param {String} code The sms code sent by AV.Cloud.requestSmsCode |
| 9001 | + * @param {phone} phone The mobile phoner number(optional). |
8926 | 9002 | * @param {Object} options A Backbone-style options object |
8927 | 9003 | * @return {AV.Promise} A promise that will be resolved with the result |
8928 | 9004 | * of the function. |
8929 | 9005 | */ |
8930 | | - verifySmsCode: function(code, options){ |
| 9006 | + verifySmsCode: function(code, phone, options){ |
8931 | 9007 | if(!code) |
8932 | 9008 | throw "Missing sms code."; |
8933 | 9009 | var request = AV._request("verifySmsCode", code, null, 'POST', |
|
0 commit comments