{"_id":"kaiseki","_rev":"31-a1c32c21159787ffd5b2a55d13bb6f29","name":"kaiseki","description":"A Parse.com REST API Client for Node.js","dist-tags":{"latest":"1.0.0"},"versions":{"0.1.0":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.1.0","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":">= 2.9.202","underscore":">= 1.3.3"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"_id":"kaiseki@0.1.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"3bb47ceeee607eb595aaacae16337c0c4e537562","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.1.0.tgz","integrity":"sha512-89K3jz1s5oTDXGhbI+9RIugVdm4vJrp115nwJy/FpNKE2m0/YDqR0BTiU4y7rzfWPqTA452NoyjOwNvSolvvLQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCXlHPktXhpw6KYnoyXAKhmW4P8lJ1tvXY4G06T+dfQnAIgPPCuMze8q8eZyl00qS8/IZnm186PGnYgibqlQrJyv6Q="}]},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.1.1":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.1.1","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":">= 2.9.202","underscore":">= 1.3.3"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"_id":"kaiseki@0.1.1","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"792c0e54af635e0981b049569251e196bfdb669d","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.1.1.tgz","integrity":"sha512-5ALVsFZqkGrcSimKGA+DcfzcnYKCMCuR90uc4l8i11mHQ4vb73agXu/JEzEWR2/8bioPXxzkJ0982aCFSRsEQw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHMAqJwUphYZqwemAM02ZiyiFdFvv+NEWqMnqLzk1RMvAiAHZuXDssDodCMUh8dLoPqHqAOrgdBYbeRa7FP5pHrQmQ=="}]},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.2.0":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.2.0","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":">= 2.9.202","underscore":">= 1.3.3","mime":">= 1.2.5"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"_id":"kaiseki@0.2.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"75605f79105d3d8fc17acf798184e402969e0cfd","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.2.0.tgz","integrity":"sha512-W3IaKmrgTgkKP+x5GwvdXRzFJAJq4ypktAjU5qoV0c1BDBV0D+wLTR9THfs9Hw+c74TvJg665JmB/67SsY1ttg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCYy0R1ABOU19iw8zkgx6hEqv3FDHxlnFnPtvk5BslnaAIgbXgs/16SIqioJQMe5qHXCKYFpZWFqYakPOLnRXHn00Q="}]},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.3.0":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.3.0","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":">= 2.9.202","underscore":">= 1.3.3","mime":">= 1.2.5"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"_id":"kaiseki@0.3.0","optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.15","_nodeVersion":"v0.6.14","_defaultsLoaded":true,"dist":{"shasum":"872dea85d01b7e25876aa16c3eb4b59eeecd701f","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.3.0.tgz","integrity":"sha512-vwcn4LBO7KjQ311g7tOquX183Qz6aEpzCGh8P/X2ir/lIbpcvReZ7+SydGyFFAu2wErBhNuRdFKZl2sWF6M++Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEYFlAIu0fmp8XoTVZG1MyODRODKWCE8VrWSTCfBSe20AiEAuPDtpbCRpJNXiVg39Zdpn5snALYpM9lAZ+iANH/3gdA="}]},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.3.1":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.3.1","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":">= 2.9.202","underscore":">= 1.3.3","mime":">= 1.2.5"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"_id":"kaiseki@0.3.1","dist":{"shasum":"44b86304c186095db586a89d95ec946789bb20a5","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.3.1.tgz","integrity":"sha512-QG4BvppTy9rIv/256CnOmyfjnKfKQ6SMuFGVeWqssCsCRkv2cCjviA0SjhctVZDXHLVKXPfmrvNaTmKgAdy7OA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCHS8jAR01ejGfu5oMR+FeKVUqgvsBqJWHprYGscJ1n4QIhAKPVPGpDmnqOhae2yLpu5Vk3/clthuYQfYdwVv2kO1LH"}]},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.3.2":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.3.2","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":"2.11.1","underscore":"1.3.3","mime":"1.2.7"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"_id":"kaiseki@0.3.2","dist":{"shasum":"8c13474e3305a233b2ca5e00206adbc890ec38ac","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.3.2.tgz","integrity":"sha512-3bj5gvwxcOmMwSJVpH3aoXj1TzFZa4VATcf2sB/xOEo9yJ1jfSwpzg6ipAdzNTTJn6dIhYTaDlUoW5N1CE1Wrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCB/x4lVb77IQ8XRPZNFk4H9K7y0dBI9e++UAPUh0NltAIhAJgLpqwivaPNWZ8WVqEIuWYo7PrdDOZAWuW3ekCprXlp"}]},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.4.0":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.4.0","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":"2.11.4","underscore":"1.4.0","mime":"1.2.7"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"_id":"kaiseki@0.4.0","dist":{"shasum":"880a70dffa8f2b98a8f5884b9e66a4b097a43c9b","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.4.0.tgz","integrity":"sha512-jRymkfsCp0bvKe/44TVhC03IZWIj06c9HiCCLxsx1ASk8KJ3QXZ5V+wV/U1voXNSBY+RxS6vVB6cTAJId26nSQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAKYRM6jLACtlQZYKxETS1BHbbOF7imltqTU4/7ONsLQIhANLXxmTn7p1O9mTNtGsHxwK2Ew9XcEZ8hXCa7m12FZEs"}]},"_npmVersion":"1.1.62","_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.5.1":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.5.1","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":"2.27.x","underscore":"1.5.x","mime":"1.2.x"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/shiki/kaiseki/issues"},"_id":"kaiseki@0.5.1","dist":{"shasum":"ea2d346f5fa2c48ffe845445278ea69c26090f45","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.5.1.tgz","integrity":"sha512-lbWrOPBEyDqb64he0oqxCxaUi4JXH3+JRgzWvEf0dqupgrJHl8mj//BTt3WYA8mhRWScIWQEaxbYJkEY5UhKVg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDFx4JrWCVsZdG0e4U9lr2jqmTV6pHeDJzUuwLHTEPVuAiEA6lK1RGW4oVC7Nzn9RykWobPg4r4OEyzR25xigC7Oe24="}]},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.5.3":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.5.3","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":"2.27.x","underscore":"1.5.x","mime":"1.2.x"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/shiki/kaiseki/issues"},"_id":"kaiseki@0.5.3","dist":{"shasum":"9fe3bbafddbced0c362592660d55e8ac55b994d3","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.5.3.tgz","integrity":"sha512-i/kxnGS33YtDHJGVFMXQv98mr9tUQed/sbU8/ayoKfl9YKFqTtf3BDgCjFqhGrp9kr84ucUypTtTOXJzYj69SA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHZhXiix+1hpDccEL1Q37UjOkeNZhSipv/yZSqw5Q84GAiEAxscD8cqPxgUCrWXkY4hxMklNXWvJXMAuiVdm+51hQbs="}]},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.5.4":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.5.4","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":"2.27.x","underscore":"1.5.x","mime":"1.2.x"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"bugs":{"url":"https://github.com/shiki/kaiseki/issues"},"_id":"kaiseki@0.5.4","dist":{"shasum":"db1ef91df0115f49fd7340ee7170c9623d3e0296","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.5.4.tgz","integrity":"sha512-ssJFdtLWSZvcLg/ahijwEVbOJ45BsuVtc+CSQMaLhbh36stfghhyo8q4cBIJWcND9ftJ0oFgKWZZaSEgRRLZTQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCS0c3DeJwZUwuVAccII6Trw/i2dOd90xlrcHN4iyUUVQIgKnkmD9g5k7hHTnLWZ/f4mv4o+nmDYmCNVthDgwnnFxw="}]},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}]},"0.5.6":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"0.5.6","homepage":"https://github.com/shiki/kaiseki","private":false,"author":{"name":"BJ Basañes","email":"shikishiji@gmail.com","url":"Shiki"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":"2.27.x","underscore":"1.5.x","mime":"1.2.x"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":"*"},"gitHead":"c265f911e0f43ca9ca85d9e60b8f1a826c22db41","bugs":{"url":"https://github.com/shiki/kaiseki/issues"},"_id":"kaiseki@0.5.6","scripts":{},"_shasum":"5abb8fa7abffc823cafad2c1d8fffb2036047720","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}],"dist":{"shasum":"5abb8fa7abffc823cafad2c1d8fffb2036047720","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-0.5.6.tgz","integrity":"sha512-SSU8xR5+hswZIbrRpkwTAzq7oKZEm5hk1nOjKbWFCwcSwakUyTGgGUMjbMkPTsSbZMXtLAN/h5QApk0P188XHQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOBh7Mh0fDs5tAzWBXSVZZNsu9nO7NAiWbhRBGRwozDAIhANAICebFeckw9UjYWzRN6m43XC9Ouwg/vrZ3OsZPr24j"}]}},"1.0.0":{"name":"kaiseki","description":"A Parse.com REST API Client for Node.js","version":"1.0.0","homepage":"https://github.com/shiki/kaiseki","private":false,"license":"MIT","author":{"name":"Jayson Basanes","email":"jayson@basanes.net"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"main":"./index.js","dependencies":{"request":"2.27.x","underscore":"1.8.x","mime":"1.3.x"},"devDependencies":{"mocha":"*","should":"*","async":"*"},"engines":{"node":">= 4.3"},"gitHead":"9eca53b27b3d86f14363549e7634aeeca42c7a5f","bugs":{"url":"https://github.com/shiki/kaiseki/issues"},"_id":"kaiseki@1.0.0","scripts":{},"_shasum":"aa986a2f7eb1d83c00c052267abb9922bf706db7","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"shiki","email":"shikishiji@gmail.com"},"maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}],"dist":{"shasum":"aa986a2f7eb1d83c00c052267abb9922bf706db7","tarball":"https://registry.npmjs.org/kaiseki/-/kaiseki-1.0.0.tgz","integrity":"sha512-pS40ntwSkjA9MWDOEuissaGUeDqWSHG/oIkbqzv8EbvYWKC0w+/e1T/KVpT+kyUKv0GIZzK1WI92V5+ZUItQQA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCGZ1mlnIoBIaeuarzuMGmABb5uLOSJFaP3/B1HHo66+gIgeTpxDWTw9uFXvCxhOEJE9G4qHE71wtri9pI/F8sRLjI="}]},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/kaiseki-1.0.0.tgz_1467519172022_0.18881602981127799"}}},"readme":"Kaiseki\n=============\n\nA Node.js API client for the open source [Parse Server](https://github.com/ParsePlatform/parse-server).\n\nInstalling\n-------------\n\n* Install through npm:\n\n    ```\n    npm install kaiseki\n    ```\n\n* Or in your `package.json`:\n\n  ```json\n  \"dependencies\": {\n    \"kaiseki\": \"*\"\n  }\n  ```\n\n Then:\n\n ```\n npm install\n ```\n\nUsage\n-------------\n\nYou might want to read about the [REST API](https://parse.com/docs/rest) first before diving in.\n\n### Setup\n\n```js\n// the class\nvar Kaiseki = require('kaiseki');\n\n// instantiate\nvar config = {\n  serverUrl: 'http://localhost:1337',\n  applicationId: 'myAppId',\n  masterKey: 'myMasterKey', // optional\n  mountPath: '/parse' // optional (\"/parse\" by default)\n};\n\nvar kaiseki = new Kaiseki(config);\n\n// use it\nkaiseki.getObjects(...);\n```\n\n### Callbacks\n\nAll callbacks should follow this format: `function(error, response, body, success) { ... }`. This is because Kaiseki is based on [Request](https://github.com/mikeal/request) and I thought it would be best to pass the same callback parameters. The `error` and `response` parameters are passed as is. On most methods, `body` is changed and parsed from JSON for your convenience.\n\n * __error__: If there's an error during the request (e.g. no internet connection), this will not be empty. Note that if the API returns a `statusCode` that is not `2xx`, it is not marked as an error.\n\n * __response__: You can check lots of info about the request in here. For example, the REST API will return a `response.statusCode` value of `4xx` on failures. In these cases, the API will still return a JSON object containing the fields `code` and `error`. You can get this in the `body` parameter.\n\n  ```json\n  { \"code\": 105,\n     \"error\": \"invalid field name: bl!ng\" }\n  ```\n\n Read more about the Response format [here](https://parse.com/docs/rest#general-responses).\n\n * __body__: On successful requests, this will be an object or array depending on the method called.\n\n * __success__: A convenience parameter, this is a boolean indicating if the request was a success.\n\n\n### Users\n\n#### createUser (data, callback)\n\nThis will pass to `body` whatever you passed in `data` plus the returned `createdAt` and `sessionToken` fields.\n\n```js\nvar userInfo = {\n  // required\n  username: 'maricris',\n  password: 'whew',\n\n  name: 'Maricris',\n  gender: 'female',\n  nickname: 'Kit'\n};\n\nkaiseki.createUser(userInfo, function(err, res, body, success) {\n  console.log('user created with session token = ', body.sessionToken);\n  console.log('object id = ', body.objectId);\n});\n```\n\n#### getUser (objectId, params, callback)\n\nGets a user info based on the `objectId` (user id). The `params` is currently unused but is there for a\nfuture use. You can pass in the callback function as the second parameter.\n\n```js\nkaiseki.getUser('<object-id>', function(err, res, body, success) {\n  console.log('user info = ', body);\n});\n```\n\n#### loginUser (username, password, callback)\n\nLog in a user. This will give you a user's `sessionToken` that you can use in `updateUser` and `deleteUser`, and other API calls that may need a `sessionToken`.\n\n```js\nkaiseki.loginUser('username', 'my secret password', function(err, res, body, success) {\n  console.log('user logged in with session token = ', body.sessionToken);\n});\n```\n\n#### getCurrentUser (callback)\n\nGet active user based on the current`sessionToken`. Use `loginUser` or `createUser` to obtain the session token. You can also use this function to validate a `sessionToken`.\n\n```js\nkaiseki.sessionToken = 'le session token';\nkaiseki.getCurrentUser(function(err, res, body, success) {\n  if (success)\n    console.log('Session token is valid for user ', body.username);\n});\n```\n\n#### updateUser (objectId, data, callback)\n\nUpdates a user object (if that wasn't obvious). This requires a sessionToken received from `loginUser` or `createUser`. If successful, body will contain the `updatedAt` value.\n\n```js\nkaiseki.sessionToken = 'le session token';\nkaiseki.updateUser('<object-id>', {name: 'new name'}, function(err, res, body, success) {\n  console.log('updated at = ', body.updatedAt);\n});\n```\n\n#### deleteUser (objectId, data, callback)\n\nDeletes a user. Like `updateUser()`, this needs a `sessionToken`.\n\n```js\nkaiseki.sessionToken = '<user-seassion-token>';\nkaiseki.deleteUser('<object-id>', function(err, res, body, success) {\n  if (success)\n    console.log('deleted!');\n  else\n    console.log('failed!');\n});\n```\n\n#### getUsers (params, callback)\n\nReturns an array of users. The `params` parameter can be an object containing the query options as described [here](https://parse.com/docs/rest#queries-basic). Note that unlike the Parse API Doc, you do not have to pass in strings for the parameter values. This is all taken care of for you.\n\nIf you do not want to pass in some query parameters, you can set the callback as the first parameter.\n\nThe `body` in the callback is an array of the returned objects.\n\n```js\n// get all users (no parameters)\nkaiseki.getUsers(function(err, res, body, success) {\n  console.log('all users = ', body);\n});\n\n// query with parameters\nvar params = {\n  where: { gender: \"female\" },\n  order: '-name'\n};\nkaiseki.getUsers(params, function(err, res, body, success) {\n  console.log('female users = ', body);\n});\n```\n\n#### requestPasswordReset (email, callback)\n\nJust provide an email and this function will send the user an email to reset their password\n\n```js\nkaiseki.requestPasswordReset('email@mail.com', function(err, res, body, success) {\n  if (success) {\n    console.log('Successfully Sent Password Reset');\n  } else {\n    console.log('Error: ', err, body);\n  }\n});\n```\n\n### Objects\n\nObject methods are similar to the User methods except that Object methods require you to specify the Parse class name. Class names are generally passed as the first parameter.\n\n#### createObject (className, data, callback)\n\nCreates an object and passes to `body` whatever you passed in `data` plus the returned `createdAt` field.\n\n```js\nvar dog = {\n  name: 'Prince',\n  breed: 'Pomeranian'\n};\nvar className = 'Dogs';\n\nkaiseki.createObject(className, dog, function(err, res, body, success) {\n  console.log('object created = ', body);\n  console.log('object id = ', body.objectId);\n});\n```\n\n#### createObjects (className, data, callback)\n\nCreates objects and passes to `body` whatever you passed in `data` plus the returned `createdAt` field for each object.\n\n```js\nvar dogs = [\n  {\n    name: 'Prince',\n    breed: 'Pomeranian'\n  },\n  {\n    name: 'Queen',\n    breed: 'Dandie Dinmont Terrier'\n  }\n]\nvar className = 'Dog';\n\nkaiseki.createObjects(className, dogs, function(err, res, body, success) {\n  console.log('objects created = ', body);\n});\n```\n\n#### getObject (className, objectId, params, callback)\n\nGets an object based on the `objectId`.\n\nThe `params` parameter can be an object containing the query options as described [here](https://parse.com/docs/rest#queries-basic). Note that unlike the Parse API Doc, you do not have to pass in strings for the parameter values. This is all taken care of for you.\n\nIf you do not want to pass in some query parameters, you can set the callback as the second parameter.\n\n```js\n// query with parameters\nvar params = {\n  where: { breed: \"Chow Chow\" },\n  order: '-name'\n};\nkaiseki.getObject('<class-name>', '<object-id>', params, function(err, res, body, success) {\n  console.log('found object = ', body);\n});\n```\n\n#### updateObject (className, objectId, data, callback)\n\nUpdates an object. If successful, body will contain the `updatedAt` value.\n\n```js\nkaiseki.updateObject('<class-name>', '<object-id>',\n  {name: 'new object name'},\n  function(err, res, body, success) {\n\n  console.log('object updated at = ', body.updatedAt);\n});\n```\n\n#### updateObjects (className, updates, callback)\n\nUpdates objects of specified className.\n\nReturns an array of objects with `updatedAt` value.\n\n```js\n/*\nAn update contains an object-id and data fields to update\n{\n  objectId: '<object-id>',\n  data: '<data-object>'\n}\n*/\n\nvar updates = [\n  { objectId: 'Q1BfhrqB30', data: { breed: 'Chow Chow' } },\n  { objectId: 'VS5JzNyp2g', data: { breed: 'Maltese' } },\n  { objectId: 'XeTBhTW4ig', data: { breed: 'Dalmatian' } },\n  { objectId: 'lyDBcnsTc3', data: { breed: 'Pomeranian' } }\n];\n\nvar className = 'Dog';\n\nkaiseki.updateObjects(className, updates, function(err, res, body, success) {\n  for (var i = 0; i < body.length; i++) {\n    object = body[i];\n    console.log('objects updated = at ', object.updatedAt);\n  }\n});\n```\n\n#### deleteObject (className, objectId, callback)\n\nDeletes an object.\n\n```js\nkaiseki.deleteObject('<class-name>', '<object-id>', function(err, res, body, success) {\n  if (success)\n    console.log('deleted!');\n  else\n    console.log('failed!');\n});\n```\n\n#### getObjects (className, params, callback)\n\nReturns an array of objects in the class name. The `params` parameter can be an object containing the query options as described [here](https://parse.com/docs/rest#queries-basic). Note that unlike the Parse API Doc, you do not have to pass in strings for the parameter values. This is all taken care of for you.\n\nIf you do not want to pass in some query parameters, you can set the callback as the first parameter.\n\nThe `body` in the callback is an array of the returned objects.\n\n```js\n// get all objects (no parameters)\nkaiseki.getObjects('Dogs', function(err, res, body, success) {\n  console.log('all dogs = ', body);\n});\n\n// query with parameters\nvar params = {\n  where: { breed: \"Chow Chow\" },\n  order: '-name'\n};\nkaiseki.getObjects('Dogs', params, function(err, res, body, success) {\n  console.log('Chow chow dogs = ', body);\n});\n```\n\n##### Using `count` with `getObjects`.\n\nYou are allowed to pass in the `count` parameter when using `getObjects`. If you do, the value of `body` will be an object with the properties `results` and `count`. The `results` property contains the objects resulting from the query. See more about counting [here](https://parse.com/docs/rest#queries-counting). If you only need `count`, you may also use the helper method `countObjects`. Using `getObjects` for counting has the advantage of querying for a _limited_ list of objects and getting the total possible objects that can be queried at the same time.\n\n```js\n// Get 10 objects, but also return the total number of objects\nvar params = {\n  where: { breed: \"Chow Chow\" },\n  limit: 10,\n  count: true\n};\nkaiseki.getObjects('Dogs', params, function(err, res, body, success) {\n  console.log('The first 10 Chow chow dogs = ', body.results);\n  console.log('Total number of Chow chow dogs = ', body.count);\n});\n```\n\n#### countObjects (className, params, callback)\n\nSame as getObjects but returns a count in the `body.count` parameter without returning any objects.\n\n```js\n// count all objects (no parameters)\nkaiseki.countObjects('Dogs', function(err, res, body, success) {\n  console.log('number of dogs = ', body.count);\n});\n\n// query with parameters\nvar params = {\n  where: { breed: \"Chow Chow\" },\n  order: '-name'\n};\nkaiseki.getObjects('Dogs', params, function(err, res, body, success) {\n  console.log('Number of Chow chow dogs = ', body.count);\n});\n```\n\n### Roles\n\nRole methods are similar to the Object methods except that they don't require you to use a classname.\n\n#### createRole (data, callback)\n\nCreates a role and passes to `body` whatever you passed in `data` plus the returned `createdAt` field. You can only create a role if you provide the `kaiseki.masterKey` property.\n\n```js\nvar data = {\n  name: 'Administrator',\n  ACL: {\n      \"*\": {\n        \"read\": true\n      }\n    },\n  roles: {\n      \"__op\": \"AddRelation\",\n      \"objects\": [\n        {\n          \"__type\": \"Pointer\",\n          \"className\": \"_Role\",\n          \"objectId\": <role-id>\n        }\n      ]\n    },\n  users: {\n      \"__op\": \"AddRelation\",\n      \"objects\": [\n        {\n          \"__type\": \"Pointer\",\n          \"className\": \"_User\",\n          \"objectId\": <user-id>\n        }\n      ]\n    }\n};\n\nkaiseki.createRole(data, function(err, res, body, success) {\n  console.log('role created = ', body);\n  console.log('object id = ', body.objectId);\n});\n```\n\n#### getRole (objectId, params, callback)\n\nGets a role based on the `objectId`. The `params` is currently unused but is there for a future use. You can pass in the callback function as the second parameter.\n\n```js\nkaiseki.getRole('<object-id>', function(err, res, body, success) {\n  console.log('found role = ', body);\n});\n```\n\n#### updateRole (objectId, data, callback)\n\nUpdates a role. If successful, body will contain the `updatedAt` value. You can only update a role if you provide the `kaiseki.masterKey` property or the `kaiseki.sessionToken` property and if that user has write access to the role.\n\n```js\nvar data = {\n  users: {\n      \"__op\": \"RemoveRelation\",\n      \"objects\": [\n        {\n          \"__type\": \"Pointer\",\n          \"className\": \"_User\",\n          \"objectId\": <user-id>\n        }\n      ]\n    }\n};\n\nkaiseki.updateRole('<role-object-id>', data, function(err, res, body, success) {\n  console.log('role updated at = ', body.updatedAt);\n});\n```\n\n#### deleteRole (objectId, callback)\n\nDeletes a role. The REST API does not return anything in the body so it's best to check for `success` if the operation was successful. You can only delete a role if you provide the `kaiseki.masterKey` property or the `kaiseki.sessionToken` property and if that user has write access to the role.\n\n```js\nkaiseki.deleteRole('<object-id>', function(err, res, body, success) {\n  if (success)\n    console.log('deleted!');\n  else\n    console.log('failed!');\n});\n```\n\n#### getRoles (params, callback)\n\nReturns an array of roles. The `params` parameter can be an object containing the query options as described [here](https://parse.com/docs/rest#queries-basic). Note that unlike the Parse API Doc, you do not have to pass in strings for the parameter values. This is all taken care for you.\n\nIf you do not want to pass in some query parameters, you can set the callback as the first parameter.\n\nThe `body` in the callback is an array of the returned roles.\n\n```js\n// get all objects (no parameters)\nkaiseki.getRoles(function(err, res, body, success) {\n  console.log('all roles = ', body);\n});\n\n// query with parameters\nvar params = {\n  where: { name: \"Administrator\" }\n};\nkaiseki.getRoles(params, function(err, res, body, success) {\n  console.log('Administrator Role = ', body);\n});\n```\n\n### Files\n\n#### uploadFile (filePath, fileName, callback)\n\nUpload a local file. Specifying `fileName` is optional. If successful, the `body` result will contain the Parse `name` and `url` of the file. The value of `name` is what you will use for associating a Parse file to an object.\n\n```js\nvar localFilePath = __dirname + '/images/apple.jpg';\nkaiseki.uploadFile(localFilePath, function(err, res, body, success) {\n  console.log('uploaded file url:', body.url);\n  console.log('uploaded file name:', body.name);\n});\n```\n\n#### uploadFileBuffer (buffer, contentType, fileName, callback)\n\nThis is a more specific upload utility. You can specify the buffer or string to be used as the upload data. The `body` result is still the same as `uploadFile()`.\n\n```js\nvar buffer = require('fs').readFileSync(localFilePath);\nkaiseki.uploadFileBuffer(buffer, 'image/jpeg', 'orange.jpg', function(err, res, body, success) {\n  console.log('uploaded file details', body);\n});\n```\n\nUploading a string as a text file:\n\n```js\nvar buffer = 'my text file contents';\nkaiseki.uploadFileBuffer(buffer, 'text/plain', 'readme.txt', function(err, res, body, success) {\n  console.log('uploaded file details', body);\n});\n```\n\n#### deleteFile (name, callback)\n\nDeleting files require the Parse API master key. The value of `name` should be the name generated by Parse during upload.\n\n```js\nkaiseki.masterKey = 'your-api-master-key';\nvar parseFileName = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-files.apple.jpg';\nkaiseki.deleteFile(parseFileName, function(err, res, body, success) {\n  // body is empty here\n  if (success)\n    console.log('successfully deleted file!');\n});\n```\n\n#### Associating Files with Objects\n\nOnce you have the Parse file `name` after calling `uploadFile()` or `uploadFileBuffer()`, you can attach it to an object by simple setting a `\"File\"` data type to a property. More info [here](https://parse.com/docs/rest#files-associating).\n\n```js\nvar parseFileName = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx-files.apple.jpg';\nvar apple = {\n  name: 'Apple',\n  rotten: true,\n  photo: {\n    name: parseFileName,\n    __type: 'File'\n  }\n};\nkaiseki.createObject('Fruits', apple, function(err, res, body, success) {\n  if (success)\n    console.log('created an apple object with image');\n});\n```\n\nAssociating a file to an existing object:\n\n```js\nvar orange = {\n  photo: {\n    name: parseFileName,\n    __type: 'File'\n  }\n};\nkaiseki.updateObject('Fruits', '<the-object-id>', orange, function(err, res, body, success) {\n  if (success)\n    console.log('attached photo to an object');\n});\n```\n\n### Push Notifications\n\n#### sendPushNotification (data, callback)\n\nSend a push notification. The `data` parameter has to follow the data structure as described in the [Parse REST API](https://www.parse.com/docs/rest#push). The following code sample sends a notification to the broadcast channel (all devices) on all platforms (iOS and Android).\n\n*Please note:* For push notifications to work you have to configure your Parse app accordingly. Use the _Settings > Push_ section of your app's dashboard.\n\n```js\nvar notification = {\n  channels: [''],\n  data: {\n    alert: \"Tune in for the World Series, tonight at 8pm EDT\"\n  }\n};\n\nkaiseki.sendPushNotification(notification, function(err, res, body, success) {\n  if (success) {\n    console.log('Push notification successfully sent:', body);\n  } else {\n    console.log('Could not send push notification:', err);\n  }\n});\n```\n\n### Cloud Functions\n\n#### cloudRun (functionName, data, callback)\n\nThis will send a POST request to a cloud code function with the `data` that you pass and return what your cloud code function sends back to `body`.\n\n```js\nvar data = {\n  name: 'Ross'\n};\n\nkaiseki.cloudRun('HelloWorld', data, function(err, res, body, success) {\n  console.log('The cloud code function returned: ', body);\n});\n```\n\n### GeoPoints\n\nYou can set [GeoPoints](https://parse.com/docs/rest#geo) by simply setting a `\"GeoPoint\"` data type to a property named `\"location\"`.\n\n```js\nvar place = {\n  name: 'Tokyo Coffee Shop',\n  location: {\n    __type: 'GeoPoint',\n    latitude: 40.0,\n    longitude: -30.0\n  }\n};\nkaiseki.createObject('Places', place, function(err, res, body, success) {\n  if (success)\n    console.log('Created a place with a GeoPoint.');\n});\n```\n\n### Analytics\n\nYou can use the [Analytics API](https://parse.com/docs/rest#analytics) to send analytic events happening in your app.\n\nTo record an _AppOpened_ event use it like this.\n\n```js\nkaiseki.sendAnalyticsEvent('AppOpened', function(err, res, body, success) {\n  // do nothing\n});\n```\n\nTo record a custom event, let's say _Search_, use it like this.\n\n```js\nkaiseki.sendAnalyticsEvent('Search', {\n  'priceRange': '1000-1500',\n  'source': 'craigslist',\n  'dayType': 'weekday'\n}, function(err, res, body, success) {\n  // do nothing\n);\n```\n\nTests\n-------------\nIn order to run the tests, you need to have a local Parse Server set up. We recommend setting up [parse-server-example](https://github.com/ParsePlatform/parse-server-example). Update `test/config.js` and `test/config-master.js` for whatever configurations you have set up on your server. \n\nTo run the test:\n\n```\nmake mocha\n```\n\nNote: Some tests have been disabled because they require extra configuration for the server like email and push notifications.\n","maintainers":[{"name":"shiki","email":"shikishiji@gmail.com"}],"time":{"modified":"2022-06-19T07:44:47.442Z","created":"2012-05-01T00:44:01.345Z","0.1.0":"2012-05-01T00:44:07.500Z","0.1.1":"2012-05-12T22:51:59.952Z","0.2.0":"2012-05-20T03:07:53.213Z","0.3.0":"2012-06-24T05:36:09.302Z","0.3.1":"2012-07-26T07:35:05.433Z","0.3.2":"2012-09-05T02:17:26.745Z","0.4.0":"2012-09-30T11:54:47.853Z","0.5.1":"2013-11-03T02:34:42.546Z","0.5.3":"2013-11-25T09:18:00.804Z","0.5.4":"2014-03-05T20:54:44.521Z","0.5.6":"2014-11-08T04:37:58.935Z","1.0.0":"2016-07-03T04:12:55.226Z"},"author":{"name":"Jayson Basanes","email":"jayson@basanes.net"},"repository":{"type":"git","url":"git://github.com/shiki/kaiseki.git"},"users":{"fgribreau":true,"parkerproject":true,"meshal":true},"homepage":"https://github.com/shiki/kaiseki","bugs":{"url":"https://github.com/shiki/kaiseki/issues"},"readmeFilename":"README.md","license":"MIT"}