Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions lib/Parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ Parse.prototype = {
parseRequest.call(this, 'POST', '/1/users/', data, callback);
},

findWithObjectId: function (className, objectId, callback){
var url = '/1/' + (className === '_User' ? 'users' : 'classes/' + className + '/' + objectId);


parseRequest.call(this, 'GET', url, null, callback);

},
// get an object from the class store
find: function (className, query, callback) {
var url = '/1/' + (className === '_User' ? 'users' : 'classes/' + className);
Expand All @@ -52,7 +59,7 @@ Parse.prototype = {
// check to see if there is a 'where' object in the query object
// the 'where' object need to be stringified by JSON.stringify(), not querystring
if ( query.hasOwnProperty('where') ) {
url += '?where=' + encodeURIComponent(JSON.stringify(query.where));
url += '?where=' + encodeURIComponent(JSON.stringify(query.where));
delete query.where;
}

Expand Down Expand Up @@ -347,7 +354,13 @@ Parse.prototype = {

sendPush: function (data, callback) {
parseRequest.call(this, 'POST', '/1/push/', data, callback);
},

getCurrentSession: function(objectId, callback)
{
parseRequest.call(this, 'GET', '/1/sessions/'+ objectId, callback);
}

};

// Parse.com https api request
Expand Down Expand Up @@ -395,7 +408,7 @@ function parseRequest(method, path, data, callback, contentType, sessionToken) {
}

var options = {
host: this._api_host,
hostname: this._api_host,
port: this._api_port,
headers: headers,
path: path,
Expand Down