Skip to content

Commit

Permalink
Merge pull request #41 from slntopp/dev-namespaces
Browse files Browse the repository at this point in the history
add additional params to link
  • Loading branch information
slntopp authored Feb 26, 2024
2 parents b91ca20 + 90f7112 commit 93782e8
Showing 1 changed file with 41 additions and 39 deletions.
80 changes: 41 additions & 39 deletions modules/namespaces.js
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
class Namespaces{
constructor(api){
this.api = api;
this.moduleBase = 'namespaces'
}
class Namespaces {
constructor(api) {
this.api = api;
this.moduleBase = "namespaces";
}

create(title){
return this.api.put(`/${this.moduleBase}`, {
title
})
}
create(title) {
return this.api.put(`/${this.moduleBase}`, {
title,
});
}

delete(id){
return this.api.delete(`/${this.moduleBase}/${id}`)
}
delete(id) {
return this.api.delete(`/${this.moduleBase}/${id}`);
}

join(namespace, {account, access, role}){
return this.api.post(`/${this.moduleBase}/${namespace}/join`, {
account,
access: access === undefined ? '1' : access,
role: role === undefined ? 'default' : role
})
}
join(namespace, { account, access, role }) {
return this.api.post(`/${this.moduleBase}/${namespace}/join`, {
account,
access: access === undefined ? "1" : access,
role: role === undefined ? "default" : role,
});
}

edit(namespace){
return this.api.patch(`/${this.moduleBase}/${namespace.uuid}`, {
uuid:namespace.uuid,
title:namespace.title,
})
}
edit(namespace) {
return this.api.patch(`/${this.moduleBase}/${namespace.uuid}`, {
uuid: namespace.uuid,
title: namespace.title,
});
}

link(namespace, account){
return this.api.post(`/${this.moduleBase}/${namespace}/link`, {
account
})
}
link(namespace, { account, role, access }) {
return this.api.post(`/${this.moduleBase}/${namespace}/link`, {
account,
access,
role: role === undefined ? "default" : role,
});
}

list(depth = 10){
return this.api.get(`/${this.moduleBase}`, {
params: {
depth
}
})
}
list(depth = 10) {
return this.api.get(`/${this.moduleBase}`, {
params: {
depth,
},
});
}
}

export default Namespaces;
export default Namespaces;

0 comments on commit 93782e8

Please sign in to comment.