Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
b21feb4
refactor(document): remove function to match python wrapper
Karvel Jul 15, 2016
a5ebba5
refactor(document api): replace remove function with delete; warn use…
Karvel Aug 1, 2016
272c2d8
refactor(file api): replace remove function with delete; warn user wi…
Karvel Aug 1, 2016
f74122f
refactor(policy api): replace remove function with delete; warn user …
Karvel Aug 1, 2016
85f1c0d
refactor(role api): replace remove function with delete; warn user wi…
Karvel Aug 1, 2016
7c42722
refactor(schema api): replace remove function with delete; warn user …
Karvel Aug 1, 2016
4f5dd5e
refactor(user api): replace remove function with delete; warn user wi…
Karvel Aug 1, 2016
badcabd
refactor(query): update Query object to pass in named parameters/obj…
Karvel Aug 2, 2016
e7a985d
refactor(query): update orderBy ordering with precede argument with `…
Karvel Aug 2, 2016
a2bcb44
style(query): moved function to match `python-montage` wrapper
Karvel Aug 2, 2016
21c8056
docs(query): add comments for function groups to match the `python-mo…
Karvel Aug 2, 2016
bc5beba
feat(query): add delete function to match the `python-montage` wrapper
Karvel Aug 2, 2016
500793a
test(field): add tests for each function in `field.js`
Karvel Aug 2, 2016
8b430e1
refactor(query): rename arguments to match the `python-montage` wrapper
Karvel Aug 2, 2016
63eb9ca
refactor(query): fix logic typo
Karvel Aug 2, 2016
12ff867
test(query): update tests to work with new object parameters in `quer…
Karvel Aug 2, 2016
9c1d2b1
fix(query): rewrite remaining functions to work correctly with object…
Karvel Aug 2, 2016
d7e00f7
test(query): update remaining tests to work with updated `query.js`
Karvel Aug 2, 2016
f390f05
fix(field): change parameter from spread operator
Karvel Aug 2, 2016
60860d6
feat(tasks): import TaskAPI to Client script
Karvel Aug 3, 2016
101bc0d
feat(tasks): add TaskAPI script to match the `python-montage` wrapper
Karvel Aug 3, 2016
4d431af
fix(task): update object name to match server-side name
Karvel Aug 3, 2016
9daef5d
refactor(field): update inSet() to in(); deprecate inSet()
Karvel Aug 3, 2016
e8c1f86
test(field): update inSet() test to reference in()
Karvel Aug 3, 2016
66dae52
feat(field): Add a $match operator to replace the (now deprecated) $r…
dmpayton Aug 11, 2016
3290bcc
Add filters to the already-implemented api list methods.
dmpayton Aug 11, 2016
9baafed
refactor(client): rename `project` to `subdomain`
Karvel Sep 6, 2016
1b9078d
feat(client): import `ProjectAPI`
Karvel Sep 6, 2016
9745c43
feat(project): add `ProjectAPI` script
Karvel Sep 6, 2016
eed576a
refactor(task): make optional arguments into options object
Karvel Sep 6, 2016
5e24816
refactor(api): make optional arguments into options object
Karvel Sep 6, 2016
f8887ea
Merge branch 'feature/parity-with-python-wrapper' of https://github.c…
Karvel Sep 6, 2016
899411f
Merge branch 'feature/parity-with-python-wrapper' of github.com:Monta…
dmpayton Sep 6, 2016
a5cc17c
Merge pull request #20 from Montage-Inc/feature/15-add-tasks
dmpayton Sep 6, 2016
38fddfe
Merge pull request #19 from Montage-Inc/feature/18-project-api
dmpayton Sep 6, 2016
fb203b4
refactor(project): make optional arguments into options object
Karvel Sep 6, 2016
eba24cf
refactor(api): check for payload object length before returning
Karvel Sep 6, 2016
a21575e
Merge branch 'feature/v3' into feature/parity-with-python-wrapper
Karvel Sep 13, 2016
c5cc5f8
refactor(tests): change `.to.be.eql()` to `.to.eql()` so that asserti…
Sep 19, 2016
f326a6e
style(misc): add missing semi-colons
Sep 19, 2016
81a704b
style(query_test): remove unnecessary quotes from property name
Sep 19, 2016
c18cd37
style(query_test): add missing semicolon
Sep 19, 2016
b9d2108
refactor(client_test): remove unused `Query` import
Sep 19, 2016
a062c1f
refactor(field): remove obsolete code
Karvel Sep 19, 2016
236d145
test(field_test): remove dead code test
Karvel Sep 19, 2016
a4c65e4
test(field_test): fix test to use correct field
Karvel Sep 19, 2016
25478aa
test(field_test): finish updating test
Karvel Sep 19, 2016
1a69190
test(query_test): add test for `group`
Karvel Sep 21, 2016
4b603b1
test(query_test): add test for `delete`
Karvel Sep 21, 2016
ba0db4c
Merge branch 'feature/v3' into feature/parity-with-python-wrapper
Karvel Sep 21, 2016
88b3677
Rewrite Query.filter(). Untested. ¯\_(ツ)_/¯
dmpayton Sep 21, 2016
6f858e4
Re-Rewrite Query.filter(). Untested. ¯\_(ツ)_/¯
dmpayton Sep 21, 2016
4a6d800
test(query_test): add early implementation of `filter` tests
Karvel Sep 21, 2016
d8781d8
Rewrite Field operators and modifiers to return their data, and test …
dmpayton Sep 22, 2016
859e554
Add .editorconfig
dmpayton Sep 22, 2016
377315b
Style: Fix indentation to match .editorconfig.
dmpayton Sep 22, 2016
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
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# http://editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,jsx}]
indent_size = 2
13 changes: 7 additions & 6 deletions src/api/document.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ export default class DocumentAPI {
this.client = client;
}

list(schema) {
const endpoint = `schemas/${schema}/documents/`;
return this.client.request(endpoint);
}

save(schema, documents) {
const endpoint = `schemas/${schema}/documents/`;
return this.client.request(endpoint, 'POST', documents);
Expand All @@ -28,8 +23,14 @@ export default class DocumentAPI {
return this.client.request(endpoint, 'PATCH', document);
}

remove(schema, document_id) {
delete(schema, document_id) {
const endpoint = `schemas/${schema}/documents/${document_id}/`;
return this.client.request(endpoint, 'DELETE');
}

remove(schema, document_id) {
console.warn("The function remove() is deprecated, use delete().");

return this.delete(schema, document_id);
}
}
15 changes: 11 additions & 4 deletions src/api/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,26 @@ export default class FileAPI {
this.client = client;
}

list() {
return this.client.request('files/');
list(params) {
params = params ? params : {};
return this.client.request('files/', 'GET', params);
}

get(file_id) {
return this.client.request(`files/${file_id}/`);
}

remove(file_id) {
const endpoint = `files/${file_id}/`;
delete(file_id) {
const endpoint = `/files/${file_id}/`;
return this.client.request(endpoint, 'DELETE');
}

remove(file_id) {
console.warn("The function remove() is deprecated, use delete().");

return this.delete(file_id);
}

save(formData) {
return this.client.request('files/', 'POST', formData, true);
}
Expand Down
12 changes: 9 additions & 3 deletions src/api/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class PolicyAPI {
return this.client.request(`policy/${policy_id}/`);
}

update(policy_id, description, policy) {
update(policy_id, { description, policy }) {
if(!description && !policy) {
throw new Error('Must provide a `description` or `policy`');
}
Expand All @@ -35,15 +35,21 @@ export default class PolicyAPI {
payload.policy = policy;
}

if(payload) {
if (Object.keys(payload).length) {
return this.client.request(`policy/${policy_id}/`, 'PATCH', payload);
}
}

remove(policy_id) {
delete(policy_id) {
return this.client.request(`policy/${policy_id}/`, 'DELETE');
}

remove(policy_id) {
console.warn("The function remove() is deprecated, use delete().");

return this.delete(policy_id);
}

checkPermission(action, resource) {
var payload = {
action,
Expand Down
25 changes: 25 additions & 0 deletions src/api/project.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default class ProjectAPI {
constructor(client) {
this.client = client;
}

get() {
return this.client.request(`project`);
}

update({ name, subdomain }) {
var payload = {};

if(name) {
payload.name = name;
}

if(subdomain) {
payload.subdomain = subdomain;
}

if (Object.keys(payload).length) {
return this.client.request(`project`, 'PATCH', payload);
}
}
}
15 changes: 11 additions & 4 deletions src/api/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export default class RoleAPI {
return this.client.request(`roles/`, 'POST', payload);
}

list() {
return this.client.request(`roles/`);
list(params) {
params = params ? params : {};
return this.client.request(`roles/`, 'GET', params);
}

get(role) {
return this.client.request(`roles/${role}/`);
}

update(role, name, add_users, remove_users) {
update(role, { name, add_users, remove_users }) {
var payload = {};

if (name) {
Expand All @@ -36,7 +37,13 @@ export default class RoleAPI {
}
}

remove(role) {
delete(role) {
return this.client.request(`roles/${role}/`, 'DELETE');
}

remove(role) {
console.warn("The function remove() is deprecated, use delete().");

return this.delete(role);
}
}
15 changes: 11 additions & 4 deletions src/api/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export default class SchemaAPI {
return this.client.request('schemas/', 'POST', payload);
}

list() {
return this.client.request('schemas/');
list(params) {
params = params ? params : {};
return this.client.request('schemas/', 'GET', params);
}

get(schema) {
return this.client.request(`schemas/${schema}/`);
}

update(schema, name, fields) {
update(schema, { name, fields }) {
var payload = {};

if (name) {
Expand All @@ -32,7 +33,13 @@ export default class SchemaAPI {
}
}

remove(schema) {
delete(schema) {
return this.client.request(`schemas/${schema}/`, 'DELETE');
}

remove(schema) {
console.warn("The function remove() is deprecated, use delete().");

return this.delete(schema);
}
}
25 changes: 25 additions & 0 deletions src/api/task.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default class TaskAPI {
constructor(client) {
this.client = client;
}

run(command, { image, token, timeLimit }) {
const payload = { command };

if (image) {
payload.image = image;
}
if (token) {
payload.token = token;
}
if (timeLimit) {
payload.time_limit = timeLimit;
}

return this.client.request(`tasks/`, 'POST', payload);
}

get(task_id) {
return this.client.request(`tasks/${task_id}/`);
}
}
17 changes: 12 additions & 5 deletions src/api/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ export default class UserAPI {
this.client = client
}

list() {
return this.client.request('users/');
list(params) {
params = params ? params : {};
return this.client.request('users/', 'GET', params);
}

create(full_name, email, password) {
const payload = { full_name, email, password };
return this.client.request('users/', 'POST', payload)
return this.client.request('users/', 'POST', payload);
}

get(user_id) {
return this.client.request(`users/${user_id}/`);
}

update(user_id, full_name, email, password) {
update(user_id, { full_name, email, password }) {
var payload = {};

if (full_name) {
Expand All @@ -36,7 +37,13 @@ export default class UserAPI {
}
}

remove(user_id) {
delete(user_id) {
return this.client.request(`users/${user_id}/`, 'DELETE');
}

remove(user_id) {
console.warn("The function remove() is deprecated, use delete().");

return this.delete(user_id);
}
}
Loading