Skip to content
Open
Changes from all commits
Commits
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
42 changes: 40 additions & 2 deletions baasbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,45 @@ var BaasBox = (function() {
});
return deferred.promise();
},

/* LINK API */
insertLink: function (outID, label, inID) {
var deferred = buildDeferred();
var req = $.ajax({
url: BaasBox.endPoint + '/link/' + outID + '/' + label + '/' + inID,
method: 'POST'
})
.done(function (res) {
deferred.resolve(res);
})
.fail(function (error) {
deferred.reject(error);
});
return deferred.promise();
},
fetchLinks: function (params) {
var deferred = buildDeferred();
var url = BaasBox.endPoint + '/link';
var req = $.ajax({
url: url,
method: 'GET',
timeout: BaasBox.timeout,
dataType: 'json',
data: params
})
.done(function (res) {
deferred.resolve(res['data']);
})
.fail(function (error) {
deferred.reject(error);
});
return deferred.promise();
},
deleteLink: function (linkid) {
return $.ajax({
url: BaasBox.endPoint + '/link/' + linkid,
method: 'DELETE'
});
}
};
})();

Expand Down Expand Up @@ -672,4 +710,4 @@ var BaasBox = (function() {
return !$.cookie(key);
};

}));
}));