This repository was archived by the owner on Aug 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcloud.js
37 lines (32 loc) · 1.67 KB
/
cloud.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
angular.module('cloudsdk').endpoints({
// All endpoints are prefixed with the current host/port by default.
// (e.g. "http://localhost:1337/")
//
// To set a different base url, set window.CONSTANTS.apiUrl
// (e.g. `{apiUrl: 'https://whatever.foo.com:1500/api/v3'}`)
// It will be applied to all of the endpoints below automatically.
// (see assets/js/dependencies/cloudsdk.js for implementation)
//
// Each cloudsdk endpoint wrapper method takes an object of options you throw at it, then
// determines the appropriate encoding based on the configuration of the matching
// endpoint below. i.e. if you have an endpoint method `updateFoo()` configured as `PUT /foo/:id`,
// and you call it as `updateFoo({id: 7, email: '[email protected]'})`, the destination URL will be
// automatically encoded with 7, the value you passed in for id (i.e. /foo/7) and the value you passed
// in for `email` will be sent as an appropriately-encoded body parameter.
//
// Note that you can also configure cloud endpoint methods below using a function for lower-level control.
// 99% of the time, this should not be necessary, and any custom code you might write in such a function
// is probably better suited elsewhere in your UI code (likely a ui-model). However, if you're still
// interested, see implementation in assets/js/dependencies/cloudsdk.js for details.
// Me (current user)
login: 'PUT /me/login',
logout: 'PUT /me/logout',
signup: 'POST /me/signup',
getMyProfile: 'GET /me',
updateMyProfile: 'PUT /me',
// Pencils
listPencils: 'GET /pencils',
createPencil: 'POST /pencils',
updatePencil: 'PUT /pencils/:id',
destroyPencil: 'DELETE /pencils/:id',
});