src/user.js
function(options, authOptions) {
        if (!this.id) {
          throw new Error('Please signin.');
        }
        let user;
        let attributes;
        if (options.user) {
          user = options.user;
          attributes = options.attributes;
        } else {
          user = options;
        }
        var userObjectId = _.isString(user) ? user : user.id;
        if (!userObjectId) {
          throw new Error('Invalid target user.');
        }
        var route = 'users/' + this.id + '/friendship/' + userObjectId;
        var request = AVRequest(
          route,
          null,
          null,
          'POST',
          AV._encode(attributes),
          authOptions
        );
        return request;
      }
function(options, authOptions) {
        if (!this.id) {
          throw new Error('Please signin.');
        }
        let user;
        let attributes;
        if (options.user) {
          user = options.user;
          attributes = options.attributes;
        } else {
          user = options;
        }
        var userObjectId = _.isString(user) ? user : user.id;
        if (!userObjectId) {
          throw new Error('Invalid target user.');
        }
        var route = 'users/' + this.id + '/friendship/' + userObjectId;
        var request = AVRequest(
          route,
          null,
          null,
          'POST',
          AV._encode(attributes),
          authOptions
        );
        return request;
      }
function ( options , authOptions ) { if ( ! this . id ) { throw new Error ( 'Please signin.' ) ; } let user ; let attributes ; if ( options . user ) { user = options . user ; attributes = options . attributes ; } else { user = options ; } var userObjectId = _ . isString ( user ) ? user : user . id ; if ( ! userObjectId ) { throw new Error ( 'Invalid target user.' ) ; } var route = 'users/' + this . id + '/friendship/' + userObjectId ; var request = AVRequest ( route , null , null , 'POST' , AV . _encode ( attributes ) , authOptions ) ; return request ; }
Follow a user
@since 0.3.0
@param {Object | AV.User | String} options if an AV.User or string is given, it will be used as the target user.
@param {AV.User | String} options.user The target user or user's objectId to follow.
@param {Object} [options.attributes] key-value attributes dictionary to be used as
conditions of followerQuery/followeeQuery.
@param {AuthOptions} [authOptions]
Follow a user