src/status.js
function(options = {}) {
        if (!getSessionToken(options) && !AV.User.current()) {
          throw new Error('Please signin an user.');
        }
        if (!this.query) {
          return AV.Status.sendStatusToFollowers(this, options);
        }

        return getUserPointer(options)
          .then(currUser => {
            var query = this.query.toJSON();
            query.className = this.query.className;
            var data = {};
            data.query = query;
            this.data = this.data || {};
            this.data.source = this.data.source || currUser;
            data.data = this._getDataJSON();
            data.inboxType = this.inboxType || 'default';

            return AVRequest('statuses', null, null, 'POST', data, options);
          })
          .then(response => {
            this.id = response.objectId;
            this.createdAt = AV._parseDate(response.createdAt);
            return this;
          });
      }
function(options = {}) {
        if (!getSessionToken(options) && !AV.User.current()) {
          throw new Error('Please signin an user.');
        }
        if (!this.query) {
          return AV.Status.sendStatusToFollowers(this, options);
        }

        return getUserPointer(options)
          .then(currUser => {
            var query = this.query.toJSON();
            query.className = this.query.className;
            var data = {};
            data.query = query;
            this.data = this.data || {};
            this.data.source = this.data.source || currUser;
            data.data = this._getDataJSON();
            data.inboxType = this.inboxType || 'default';

            return AVRequest('statuses', null, null, 'POST', data, options);
          })
          .then(response => {
            this.id = response.objectId;
            this.createdAt = AV._parseDate(response.createdAt);
            return this;
          });
      }
function ( options = { } ) { if ( ! getSessionToken ( options ) && ! AV . User . current ( ) ) { throw new Error ( 'Please signin an user.' ) ; } if ( ! this . query ) { return AV . Status . sendStatusToFollowers ( this , options ) ; } return getUserPointer ( options ) . then ( currUser => { var query = this . query . toJSON ( ) ; query . className = this . query . className ; var data = { } ; data . query = query ; this . data = this . data || { } ; this . data . source = this . data . source || currUser ; data . data = this . _getDataJSON ( ) ; data . inboxType = this . inboxType || 'default' ; return AVRequest ( 'statuses' , null , null , 'POST' , data , options ) ; } ) . then ( response => { this . id = response . objectId ; this . createdAt = AV . _parseDate ( response . createdAt ) ; return this ; } ) ; }
Send a status by a AV.Query object.
@since 0.3.0
@param {AuthOptions} options
@return {Promise} A promise that is fulfilled when the send
completes.
@example
// send a status to male users
var status = new AVStatus('image url', 'a message');
status.query = new AV.Query('_User');
status.query.equalTo('gender', 'male');
status.send().then(function(){
//send status successfully.
}, function(err){
//an error threw.
console.dir(err);
});
Send a status by a AV . Query object .