You've already forked openaccounting-server
mirror of
https://github.com/openaccounting/oa-server.git
synced 2025-12-09 00:50:59 +13:00
Added GET /orgs/:orgId/accounts/:accountI API endpoint
This commit is contained in:
@@ -2,23 +2,24 @@ package api
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/ant0ine/go-json-rest/rest"
|
||||
"github.com/openaccounting/oa-server/core/model"
|
||||
"github.com/openaccounting/oa-server/core/model/types"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/ant0ine/go-json-rest/rest"
|
||||
"github.com/openaccounting/oa-server/core/model"
|
||||
"github.com/openaccounting/oa-server/core/model/types"
|
||||
)
|
||||
|
||||
/**
|
||||
* @api {get} /orgs/:orgId/accounts Get Accounts by Org id
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetOrgAccounts
|
||||
* @apiGroup Account
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Account.
|
||||
* @apiSuccess {String} orgId Id of the Org.
|
||||
@@ -83,14 +84,85 @@ func GetOrgAccounts(w rest.ResponseWriter, r *rest.Request) {
|
||||
w.WriteJson(&accounts)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} /orgs/:orgId/accounts/:accountId Get Acount by Org id and Account id
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetOrgAccount
|
||||
* @apiGroup Account
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Account.
|
||||
* @apiSuccess {String} orgId Id of the Org.
|
||||
* @apiSuccess {Date} inserted Date Account was created
|
||||
* @apiSuccess {Date} updated Date Account was updated
|
||||
* @apiSuccess {String} name Name of the Account.
|
||||
* @apiSuccess {String} parent Id of the parent Account.
|
||||
* @apiSuccess {String} currency Three letter currency code.
|
||||
* @apiSuccess {Number} precision How many digits the currency goes out to.
|
||||
* @apiSuccess {Boolean} debitBalance True if Account has a debit balance.
|
||||
* @apiSuccess {Number} balance Current Account balance in this Account's currency
|
||||
* @apiSuccess {Number} nativeBalance Current Account balance in the Org's currency
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
* {
|
||||
* "id": "22222222222222222222222222222222",
|
||||
* "orgId": "11111111111111111111111111111111",
|
||||
* "inserted": "2018-09-11T18:05:04.420Z",
|
||||
* "updated": "2018-09-11T18:05:04.420Z",
|
||||
* "name": "Cash",
|
||||
* "parent": "11111111111111111111111111111111",
|
||||
* "currency": "USD",
|
||||
* "precision": 2,
|
||||
* "debitBalance": true,
|
||||
* "balance": 10000,
|
||||
* "nativeBalance": 10000
|
||||
* }
|
||||
*
|
||||
* @apiUse NotAuthorizedError
|
||||
* @apiUse InternalServerError
|
||||
*/
|
||||
func GetOrgAccount(w rest.ResponseWriter, r *rest.Request) {
|
||||
user := r.Env["USER"].(*types.User)
|
||||
orgId := r.PathParam("orgId")
|
||||
accountId := r.PathParam("accountId")
|
||||
|
||||
// TODO how do we make date an optional parameter
|
||||
// instead of resorting to this hack?
|
||||
date := time.Date(2100, time.January, 1, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
dateParam := r.URL.Query().Get("date")
|
||||
|
||||
if dateParam != "" {
|
||||
dateParamNumeric, err := strconv.ParseInt(dateParam, 10, 64)
|
||||
|
||||
if err != nil {
|
||||
rest.Error(w, "invalid date", 400)
|
||||
return
|
||||
}
|
||||
date = time.Unix(0, dateParamNumeric*1000000)
|
||||
}
|
||||
|
||||
accounts, err := model.Instance.GetAccountWithBalance(orgId, accountId, user.Id, "", date)
|
||||
|
||||
if err != nil {
|
||||
rest.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.WriteJson(&accounts)
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /orgs/:orgId/accounts Create a new Account
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostAccount
|
||||
* @apiGroup Account
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} id Id 32 character hex string
|
||||
* @apiParam {String} name Name of the Account.
|
||||
@@ -198,12 +270,12 @@ func PostAccounts(w rest.ResponseWriter, r *rest.Request, content []byte) {
|
||||
|
||||
/**
|
||||
* @api {put} /orgs/:orgId/accounts/:accountId Modify an Account
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PutAccount
|
||||
* @apiGroup Account
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} id Id 32 character hex string
|
||||
* @apiParam {String} name Name of the Account.
|
||||
@@ -273,12 +345,12 @@ func PutAccount(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {delete} /orgs/:orgId/accounts/:accountId Delete an Account
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName DeleteAccount
|
||||
* @apiGroup Account
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
|
||||
@@ -7,6 +7,9 @@ import (
|
||||
/**
|
||||
* Changelog
|
||||
*
|
||||
* 1.2.0
|
||||
* - add `GET /orgs/:orgId/accounts/:accountId
|
||||
*
|
||||
* 1.1.0
|
||||
* - add `GET /health-check`
|
||||
*
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
|
||||
/**
|
||||
* @api {get} /apikeys Get API keys
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetApiKeys
|
||||
* @apiGroup ApiKey
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the ApiKey.
|
||||
* @apiSuccess {Date} inserted Date ApiKey was created
|
||||
@@ -52,11 +52,11 @@ func GetApiKeys(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /apikeys Create a new API key
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostApiKey
|
||||
* @apiGroup ApiKey
|
||||
*
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
*
|
||||
* @apiParam {String} id 32 character hex string
|
||||
@@ -105,11 +105,11 @@ func PostApiKey(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {put} /apikeys Modify an API key
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PutApiKey
|
||||
* @apiGroup ApiKey
|
||||
*
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
*
|
||||
* @apiParam {String} id 32 character hex string
|
||||
@@ -160,12 +160,12 @@ func PutApiKey(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {delete} /apikeys/:apiKeyId Delete an API key
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName DeleteApiKey
|
||||
* @apiGroup ApiKey
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
|
||||
/**
|
||||
* @api {get} /org/:orgId Get Org by id
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetOrg
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Org.
|
||||
* @apiSuccess {Date} inserted Date Org was created
|
||||
@@ -53,12 +53,12 @@ func GetOrg(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {get} /orgs Get a User's Orgs
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetOrgs
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Org.
|
||||
* @apiSuccess {Date} inserted Date Org was created
|
||||
@@ -98,12 +98,12 @@ func GetOrgs(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /orgs Create a new Org
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostOrg
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} id Id 32 character hex string
|
||||
* @apiParam {String} name Name of the Org.
|
||||
@@ -152,12 +152,12 @@ func PostOrg(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {put} /orgs/:orgId Modify an Org
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PutOrg
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} name Name of the Org.
|
||||
*
|
||||
@@ -207,12 +207,12 @@ func PutOrg(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /orgs/:orgId/invites Invite a user to an Org
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostInvite
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} email Email address of user
|
||||
*
|
||||
@@ -263,12 +263,12 @@ func PostInvite(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {put} /orgs/:orgId/invites/:inviteId Accept an invitation
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PutInvite
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} accepted true
|
||||
*
|
||||
@@ -320,12 +320,12 @@ func PutInvite(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {get} /orgs/:orgId/invites Get Org invites
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetInvites
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Invite
|
||||
* @apiSuccess {orgId} id Id of the Org
|
||||
@@ -366,12 +366,12 @@ func GetInvites(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {delete} /orgs/:orgId/invites/:inviteId Delete Invite
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName DeleteInvite
|
||||
* @apiGroup Org
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
|
||||
@@ -11,12 +11,12 @@ import (
|
||||
|
||||
/**
|
||||
* @api {get} /org/:orgId/prices Get prices nearest in time or by currency
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetPrices
|
||||
* @apiGroup Price
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {Number} nearestDate Milliseconds since epoch
|
||||
* @apiParam {String} currency Currency code
|
||||
@@ -93,12 +93,12 @@ func GetPrices(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /orgs/:orgId/prices Create a new Price
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostPrice
|
||||
* @apiGroup Price
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} id Id 32 character hex string.
|
||||
* @apiParam {String} orgId Id of the Org.
|
||||
@@ -155,12 +155,12 @@ func PostPrice(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {delete} /orgs/:orgId/prices/:priceId Delete a Price
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName DeletePrice
|
||||
* @apiGroup Price
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
|
||||
@@ -22,6 +22,7 @@ func GetRouter(auth *AuthMiddleware, prefix string) (rest.App, error) {
|
||||
rest.Delete(prefix+"/orgs/:orgId/ledgers/:accountId", auth.RequireAuth(DeleteAccount)),
|
||||
rest.Get(prefix+"/orgs/:orgId/ledgers/:accountId/transactions", auth.RequireAuth(GetTransactionsByAccount)),
|
||||
rest.Get(prefix+"/orgs/:orgId/accounts", auth.RequireAuth(GetOrgAccounts)),
|
||||
rest.Get(prefix+"/orgs/:orgId/accounts/:accountId", auth.RequireAuth(GetOrgAccount)),
|
||||
rest.Post(prefix+"/orgs/:orgId/accounts", auth.RequireAuth(PostAccount)),
|
||||
rest.Put(prefix+"/orgs/:orgId/accounts/:accountId", auth.RequireAuth(PutAccount)),
|
||||
rest.Delete(prefix+"/orgs/:orgId/accounts/:accountId", auth.RequireAuth(DeleteAccount)),
|
||||
|
||||
@@ -9,11 +9,11 @@ import (
|
||||
|
||||
/**
|
||||
* @api {post} /sessions Create a new Session
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostSession
|
||||
* @apiGroup Session
|
||||
*
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
*
|
||||
* @apiParam {String} id 32 character hex string
|
||||
@@ -59,12 +59,12 @@ func PostSession(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {delete} /sessions/:sessionId Log out of a Session
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName DeleteSession
|
||||
* @apiGroup Session
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
|
||||
/**
|
||||
* @api {get} /health-check Get system health status
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetSystemHealthStatus
|
||||
* @apiGroup SystemHealth
|
||||
*
|
||||
*
|
||||
* @apiHeader {String} Accept-Version: 1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version: 1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} database Database status: "ok"; "fail"
|
||||
* @apiSuccess {String} api API status: "ok"
|
||||
|
||||
@@ -9,12 +9,12 @@ import (
|
||||
|
||||
/**
|
||||
* @api {get} /orgs/:orgId/accounts/:accountId/transactions Get Transactions by Account Id
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetAccountTransactions
|
||||
* @apiGroup Transaction
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Transaction.
|
||||
* @apiSuccess {String} orgId Id of the Org.
|
||||
@@ -85,12 +85,12 @@ func GetTransactionsByAccount(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {get} /orgs/:orgId/transactions Get Transactions by Org Id
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetOrgTransactions
|
||||
* @apiGroup Transaction
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the Transaction.
|
||||
* @apiSuccess {String} orgId Id of the Org.
|
||||
@@ -160,12 +160,12 @@ func GetTransactionsByOrg(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /orgs/:orgId/transactions Create a new Transaction
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostTransaction
|
||||
* @apiGroup Transaction
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} id Id 32 character hex string
|
||||
* @apiParam {Date} date Date of the Transaction
|
||||
@@ -246,12 +246,12 @@ func PostTransaction(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {put} /orgs/:orgId/transactions/:transactionId Modify a Transaction
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PutTransaction
|
||||
* @apiGroup Transaction
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} id 32 character hex string
|
||||
* @apiParam {Date} date Date of the Transaction
|
||||
@@ -333,12 +333,12 @@ func PutTransaction(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {delete} /orgs/:orgId/transactions/:transactionId Delete a Transaction
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName DeleteTransaction
|
||||
* @apiGroup Transaction
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccessExample Success-Response:
|
||||
* HTTP/1.1 200 OK
|
||||
|
||||
@@ -22,12 +22,12 @@ type ResetPasswordParams struct {
|
||||
|
||||
/**
|
||||
* @api {get} /user Get Authenticated User
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName GetUser
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiSuccess {String} id Id of the User.
|
||||
* @apiSuccess {Date} inserted Date User was created
|
||||
@@ -64,11 +64,11 @@ func GetUser(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /users Create a new User
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PostUser
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} id 32 character hex string
|
||||
* @apiParam {String} firstName First name of the User.
|
||||
@@ -123,12 +123,12 @@ func PostUser(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {put} /user Modify User
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName PutUser
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiHeader {String} Authorization HTTP Basic Auth
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} password New password
|
||||
* @apiParam {String} code Password reset code. (Instead of Authorization header)
|
||||
@@ -204,11 +204,11 @@ func PutUser(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /user/verify Verify user email address
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName VerifyUser
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} code Email verification code
|
||||
*
|
||||
@@ -238,11 +238,11 @@ func VerifyUser(w rest.ResponseWriter, r *rest.Request) {
|
||||
|
||||
/**
|
||||
* @api {post} /user/reset-password Send reset password email
|
||||
* @apiVersion 1.1.0
|
||||
* @apiVersion 1.2.0
|
||||
* @apiName ResetPassword
|
||||
* @apiGroup User
|
||||
*
|
||||
* @apiHeader {String} Accept-Version ^1.1.0 semver versioning
|
||||
* @apiHeader {String} Accept-Version ^1.2.0 semver versioning
|
||||
*
|
||||
* @apiParam {String} email Email address for user
|
||||
*
|
||||
|
||||
@@ -31,7 +31,7 @@ func (mw *VersionMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.Handl
|
||||
rest.Error(writer, "Invalid version", http.StatusBadRequest)
|
||||
}
|
||||
|
||||
serverVersion, _ := semver.NewVersion("1.1.0")
|
||||
serverVersion, _ := semver.NewVersion("1.2.0")
|
||||
// Pre-release versions
|
||||
compatVersion, _ := semver.NewVersion("0.1.8")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user