1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-06-13 13:39:23 -04:00

Prefix all API endpoints with 'v1/', pluralize collections

This commit is contained in:
2017-11-11 08:05:09 -05:00
parent 79ed5dad9f
commit 9429b748fa
20 changed files with 86 additions and 86 deletions

View File

@ -72,7 +72,7 @@ function fetchAll() {
$.ajax({
type: "GET",
dataType: "json",
url: "account/",
url: "v1/accounts/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -100,7 +100,7 @@ function create(account) {
$.ajax({
type: "POST",
dataType: "json",
url: "account/",
url: "v1/accounts/",
data: {account: account.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -127,7 +127,7 @@ function update(account) {
$.ajax({
type: "PUT",
dataType: "json",
url: "account/"+account.AccountId+"/",
url: "v1/accounts/"+account.AccountId+"/",
data: {account: account.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -154,7 +154,7 @@ function remove(account) {
$.ajax({
type: "DELETE",
dataType: "json",
url: "account/"+account.AccountId+"/",
url: "v1/accounts/"+account.AccountId+"/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);

View File

@ -59,7 +59,7 @@ function importOFX(account, password, startDate, endDate) {
$.ajax({
type: "POST",
dataType: "json",
url: "account/"+account.AccountId+"/import/ofx",
url: "v1/accounts/"+account.AccountId+"/imports/ofx",
data: {ofxdownload: ofxdownload.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -145,12 +145,12 @@ function importFile(url, inputElement) {
}
function importOFXFile(inputElement, account) {
var url = "account/"+account.AccountId+"/import/ofxfile";
var url = "v1/accounts/"+account.AccountId+"/imports/ofxfile";
return importFile(url, inputElement);
}
function importGnucash(inputElement) {
var url = "import/gnucash";
var url = "v1/imports/gnucash";
return importFile(url, inputElement);
}

View File

@ -101,7 +101,7 @@ function fetchAll() {
$.ajax({
type: "GET",
dataType: "json",
url: "report/",
url: "v1/reports/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -129,7 +129,7 @@ function create(report) {
$.ajax({
type: "POST",
dataType: "json",
url: "report/",
url: "v1/reports/",
data: {report: report.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -156,7 +156,7 @@ function update(report) {
$.ajax({
type: "PUT",
dataType: "json",
url: "report/"+report.ReportId+"/",
url: "v1/reports/"+report.ReportId+"/",
data: {report: report.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -184,7 +184,7 @@ function remove(report) {
$.ajax({
type: "DELETE",
dataType: "json",
url: "report/"+report.ReportId+"/",
url: "v1/reports/"+report.ReportId+"/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -208,7 +208,7 @@ function tabulate(report) {
$.ajax({
type: "GET",
dataType: "json",
url: "report/"+report.ReportId+"/tabulation/",
url: "v1/reports/"+report.ReportId+"/tabulations/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);

View File

@ -72,7 +72,7 @@ function fetchAll() {
$.ajax({
type: "GET",
dataType: "json",
url: "security/",
url: "v1/securities/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -100,7 +100,7 @@ function create(security) {
$.ajax({
type: "POST",
dataType: "json",
url: "security/",
url: "v1/securities/",
data: {security: security.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -127,7 +127,7 @@ function update(security) {
$.ajax({
type: "PUT",
dataType: "json",
url: "security/"+security.SecurityId+"/",
url: "v1/securities/"+security.SecurityId+"/",
data: {security: security.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -154,7 +154,7 @@ function remove(security) {
$.ajax({
type: "DELETE",
dataType: "json",
url: "security/"+security.SecurityId+"/",
url: "v1/securities/"+security.SecurityId+"/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);

View File

@ -47,7 +47,7 @@ function search(searchString, searchType, limit) {
$.ajax({
type: "GET",
dataType: "json",
url: "securitytemplate/?search="+searchString+"&type="+searchType+"&limit="+limit,
url: "v1/securitytemplates/?search="+searchString+"&type="+searchType+"&limit="+limit,
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -78,7 +78,7 @@ function fetchCurrencies() {
$.ajax({
type: "GET",
dataType: "json",
url: "securitytemplate/?search=&type=currency",
url: "v1/securitytemplates/?search=&type=currency",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);

View File

@ -90,7 +90,7 @@ function fetchPage(account, pageSize, page) {
$.ajax({
type: "GET",
dataType: "json",
url: "account/"+account.AccountId+"/transactions?sort=date-desc&limit="+pageSize+"&page="+page,
url: "v1/accounts/"+account.AccountId+"/transactions?sort=date-desc&limit="+pageSize+"&page="+page,
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -138,7 +138,7 @@ function create(transaction) {
$.ajax({
type: "POST",
dataType: "json",
url: "transaction/",
url: "v1/transactions/",
data: {transaction: transaction.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -165,7 +165,7 @@ function update(transaction) {
$.ajax({
type: "PUT",
dataType: "json",
url: "transaction/"+transaction.TransactionId+"/",
url: "v1/transactions/"+transaction.TransactionId+"/",
data: {transaction: transaction.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -192,7 +192,7 @@ function remove(transaction) {
$.ajax({
type: "DELETE",
dataType: "json",
url: "transaction/"+transaction.TransactionId+"/",
url: "v1/transactions/"+transaction.TransactionId+"/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);

View File

@ -83,7 +83,7 @@ function fetch(userId) {
$.ajax({
type: "GET",
dataType: "json",
url: "user/"+userId+"/",
url: "v1/users/"+userId+"/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -115,7 +115,7 @@ function create(user) {
$.ajax({
type: "POST",
dataType: "json",
url: "user/",
url: "v1/users/",
data: {user: user.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -142,7 +142,7 @@ function login(user) {
$.ajax({
type: "POST",
dataType: "json",
url: "session/",
url: "v1/sessions/",
data: {user: user.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();
@ -167,7 +167,7 @@ function tryResumingSession() {
$.ajax({
type: "GET",
dataType: "json",
url: "session/",
url: "v1/sessions/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -195,7 +195,7 @@ function logout() {
$.ajax({
type: "DELETE",
dataType: "json",
url: "session/",
url: "v1/sessions/",
success: function(data, status, jqXHR) {
var e = new Error();
e.fromJSON(data);
@ -219,7 +219,7 @@ function update(user) {
$.ajax({
type: "PUT",
dataType: "json",
url: "user/"+user.UserId+"/",
url: "v1/users/"+user.UserId+"/",
data: {user: user.toJSON()},
success: function(data, status, jqXHR) {
var e = new Error();