Skip to content

Commit 714cbef

Browse files
lyuzashidave-irvine
authored andcommitted
Add project share endpoint (moul#156)
1 parent 4aa5fd8 commit 714cbef

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

lib/Models/Projects.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
this.showTrigger = bind(this.showTrigger, this);
1818
this.listTriggers = bind(this.listTriggers, this);
1919
this.search = bind(this.search, this);
20+
this.share = bind(this.share, this);
2021
this.fork = bind(this.fork, this);
2122
this.remove = bind(this.remove, this);
2223
this.listTags = bind(this.listTags, this);
@@ -300,6 +301,21 @@
300301
});
301302
};
302303

304+
Projects.prototype.share = function(params, fn) {
305+
if (params == null) {
306+
params = {};
307+
}
308+
if (fn == null) {
309+
fn = null;
310+
}
311+
this.debug("Projects::share()");
312+
return this.post("projects/" + (Utils.parseProjectId(params.projectId)) + "/share", params, function(data) {
313+
if (fn) {
314+
return fn(data);
315+
}
316+
});
317+
};
318+
303319
Projects.prototype.search = function(projectName, params, fn) {
304320
if (params == null) {
305321
params = {};

src/Models/Projects.coffee

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ class Projects extends BaseModel
108108
@debug "Projects::fork()"
109109
@post "projects/fork/#{params.id}", params, (data) -> fn data if fn
110110

111+
share: (params={}, fn=null) =>
112+
@debug "Projects::share()"
113+
@post "projects/#{Utils.parseProjectId params.projectId}/share", params, (data) -> fn data if fn
114+
111115
search: (projectName, params={}, fn=null) =>
112116
if 'function' is typeof params
113117
fn = params

0 commit comments

Comments
 (0)