api.js 553 B

12345678910111213141516171819202122232425262728
  1. (function (Misago) {
  2. 'use strict';
  3. var Api = function(_) {
  4. this.buildUrl = function(model, call, querystrings) {
  5. var url = _.router.baseUrl;
  6. url += 'api/' + model + '/';
  7. return url;
  8. };
  9. this.one = function(model, id) {
  10. var url = this.buildUrl(model) + id + '/';
  11. return _.ajax.get(url);
  12. };
  13. this.many = function(model, filters) {
  14. };
  15. this.call = function(model, target, call, data) {
  16. };
  17. };
  18. Misago.addService('api', function(_) {
  19. return new Api(_);
  20. });
  21. }(Misago.prototype));