Commit b1b725b0 authored by Matija Obreza's avatar Matija Obreza
Browse files

webapi JS bugfix

parent 8b1032c5
......@@ -17,49 +17,50 @@ var GenesysPGR = function(baseUrl, clientId) {
clientId: clientId,
baseUrl: baseUrl,
clientSecret: null,
defaultOptions: defaultOptions
};
};
defaultOptions: defaultOptions,
getUrl : function(apiCall) {
return this.baseUrl + '/webapi' + apiCall + '?client_id=' + this.clientId + (this.clientSecret!==null ? '&client_secret=' + this.clientSecret : '');
},
listAccessions : function (filter, opts) {
var o = $.extend({}, GenesysPGR.defaultOptions, opts);
var json={filter: JSON.stringify(filter), startAt: Math.max(1, o.startAt), maxRecords: o.maxRecords };
GenesysPGR.prototype.getUrl = function(apiCall) {
return this.baseUrl + '/webapi' + apiCall + '?client_id=' + this.clientId + (this.clientSecret!==null ? '&client_secret=' + this.clientSecret : '');
};
GenesysPGR.prototype.listAccessions = function (filter, opts) {
var o = $.extend({}, GenesysPGR.defaultOptions, opts);
var json={filter: JSON.stringify(filter), startAt: Math.max(1, o.startAt), maxRecords: o.maxRecords };
$.ajax(this.getUrl('/v0/acn/filter'), {
dataType: 'json',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(json),
$.ajax(this.getUrl('/v0/acn/filter'), {
dataType: 'json',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(json),
success: function (accessions) {
o.success(accessions);
},
success: function (accessions) {
o.success(accessions);
},
error: function (errorAsync) {
o.error(errorAsync);
}
});
},
overview : function (filter, opts) {
var o = $.extend({}, GenesysPGR.defaultOptions, opts);
error: function (errorAsync) {
o.error(errorAsync);
}
});
};
$.ajax(this.getUrl('/v0/acn/overview'), {
dataType: 'json',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(filter),
GenesysPGR.prototype.overview = function (filter, opts) {
var o = $.extend({}, GenesysPGR.defaultOptions, opts);
success: function (accessions) {
o.success(accessions);
},
$.ajax(this.getUrl('/v0/acn/overview'), {
dataType: 'json',
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(filter),
success: function (accessions) {
o.success(accessions);
},
error: function (errorAsync) {
o.error(errorAsync);
}
});
error: function (errorAsync) {
o.error(errorAsync);
}
});
}
};
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment