Skip to content

Commit

Permalink
Merge pull request #133 from numary/docs/txs-params
Browse files Browse the repository at this point in the history
Update api docs
  • Loading branch information
altitude authored Jan 20, 2022
2 parents a2a7a40 + 687026f commit 1555fad
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
29 changes: 27 additions & 2 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,21 @@ var doc = `{
"produces": [
"application/json"
],
"summary": "List All Accounts",
"summary": "List all accounts",
"parameters": [
{
"type": "string",
"description": "ledger",
"name": "ledger",
"in": "path",
"required": true
},
{
"type": "string",
"description": "pagination cursor, will return accounts after given address (in descending order)",
"name": "after",
"in": "query",
"required": true
}
],
"responses": {
Expand Down Expand Up @@ -332,7 +339,7 @@ var doc = `{
},
"/{ledger}/transactions": {
"get": {
"description": "Get all ledger transactions\nList transactions",
"description": "Get all ledger transactions",
"consumes": [
"application/json"
],
Expand All @@ -350,6 +357,24 @@ var doc = `{
"name": "ledger",
"in": "path",
"required": true
},
{
"type": "string",
"description": "pagination cursor, will return transactions after given txid (in descending order)",
"name": "after",
"in": "query"
},
{
"type": "string",
"description": "find transactions by reference field",
"name": "reference",
"in": "query"
},
{
"type": "string",
"description": "find transactions with postings involving given account, either as source or destination",
"name": "account",
"in": "query"
}
],
"responses": {
Expand Down
6 changes: 4 additions & 2 deletions pkg/api/controllers/account_controller.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package controllers

import (
"net/http"

"github.com/numary/ledger/pkg/core"
"github.com/numary/ledger/pkg/ledger"
"github.com/numary/ledger/pkg/ledger/query"
"net/http"

"github.com/gin-gonic/gin"
)
Expand All @@ -20,9 +21,10 @@ func NewAccountController() AccountController {
}

// GetAccounts godoc
// @Summary List All Accounts
// @Summary List all accounts
// @Schemes
// @Param ledger path string true "ledger"
// @Param after query string true "pagination cursor, will return accounts after given address (in descending order)"
// @Accept json
// @Produce json
// @Success 200 {object} controllers.BaseResponse{cursor=query.Cursor{data=[]core.Account}}
Expand Down
7 changes: 5 additions & 2 deletions pkg/api/controllers/transaction_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package controllers

import (
"errors"
"github.com/numary/ledger/pkg/storage"
"net/http"

"github.com/numary/ledger/pkg/storage"

"github.com/gin-gonic/gin"
"github.com/numary/ledger/pkg/core"
"github.com/numary/ledger/pkg/ledger"
Expand All @@ -26,8 +27,10 @@ func NewTransactionController() TransactionController {
// @Description Get all ledger transactions
// @Tags transactions
// @Schemes
// @Description List transactions
// @Param ledger path string true "ledger"
// @Param after query string false "pagination cursor, will return transactions after given txid (in descending order)"
// @Param reference query string false "find transactions by reference field"
// @Param account query string false "find transactions with postings involving given account, either as source or destination"
// @Accept json
// @Produce json
// @Success 200 {object} controllers.BaseResponse{cursor=query.Cursor{data=[]core.Transaction}}
Expand Down

0 comments on commit 1555fad

Please sign in to comment.