Skip to content

Commit 96939af

Browse files
authored
feat: add transaction create endpoint for v2 (#708)
1 parent 9c21791 commit 96939af

28 files changed

+1298
-490
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ VERSION ?= $(shell git rev-parse HEAD)
2626
.PHONY: build
2727
build:
2828
go build -ldflags "-X github.com/envelope-zero/backend/v2/pkg/router.version=${VERSION}"
29+
30+
31+
.PHONY: docs
32+
docs:
33+
swag init --parseDependency --output ./api

api/docs.go

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/swagger.json

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2807,6 +2807,105 @@
28072807
}
28082808
}
28092809
},
2810+
"/v2": {
2811+
"get": {
2812+
"description": "Returns general information about the v2 API",
2813+
"tags": [
2814+
"v2"
2815+
],
2816+
"summary": "v2 API",
2817+
"responses": {
2818+
"200": {
2819+
"description": "OK",
2820+
"schema": {
2821+
"$ref": "#/definitions/router.V2Response"
2822+
}
2823+
}
2824+
}
2825+
},
2826+
"options": {
2827+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
2828+
"tags": [
2829+
"v2"
2830+
],
2831+
"summary": "Allowed HTTP verbs",
2832+
"responses": {
2833+
"204": {
2834+
"description": "No Content"
2835+
}
2836+
}
2837+
}
2838+
},
2839+
"/v2/transactions": {
2840+
"post": {
2841+
"description": "Creates transactions from the list of submitted transaction data. The response code is the highest response code number that a single transaction creation would have caused. If it is not equal to 201, at least one transaction has an error.",
2842+
"produces": [
2843+
"application/json"
2844+
],
2845+
"tags": [
2846+
"Transactions"
2847+
],
2848+
"summary": "Create transactions",
2849+
"parameters": [
2850+
{
2851+
"description": "Transactions",
2852+
"name": "transactions",
2853+
"in": "body",
2854+
"required": true,
2855+
"schema": {
2856+
"type": "array",
2857+
"items": {
2858+
"$ref": "#/definitions/models.TransactionCreate"
2859+
}
2860+
}
2861+
}
2862+
],
2863+
"responses": {
2864+
"201": {
2865+
"description": "Created",
2866+
"schema": {
2867+
"type": "array",
2868+
"items": {
2869+
"$ref": "#/definitions/controllers.ResponseTransactionV2"
2870+
}
2871+
}
2872+
},
2873+
"400": {
2874+
"description": "Bad Request",
2875+
"schema": {
2876+
"type": "array",
2877+
"items": {
2878+
"$ref": "#/definitions/controllers.ResponseTransactionV2"
2879+
}
2880+
}
2881+
},
2882+
"404": {
2883+
"description": "Not Found"
2884+
},
2885+
"500": {
2886+
"description": "Internal Server Error",
2887+
"schema": {
2888+
"type": "array",
2889+
"items": {
2890+
"$ref": "#/definitions/controllers.ResponseTransactionV2"
2891+
}
2892+
}
2893+
}
2894+
}
2895+
},
2896+
"options": {
2897+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
2898+
"tags": [
2899+
"Transactions"
2900+
],
2901+
"summary": "Allowed HTTP verbs",
2902+
"responses": {
2903+
"204": {
2904+
"description": "No Content"
2905+
}
2906+
}
2907+
}
2908+
},
28102909
"/version": {
28112910
"get": {
28122911
"description": "Returns the software version of the API",
@@ -3170,6 +3269,24 @@
31703269
}
31713270
}
31723271
},
3272+
"controllers.ResponseTransactionV2": {
3273+
"type": "object",
3274+
"properties": {
3275+
"data": {
3276+
"description": "This field contains the transaction data",
3277+
"allOf": [
3278+
{
3279+
"$ref": "#/definitions/models.Transaction"
3280+
}
3281+
]
3282+
},
3283+
"error": {
3284+
"description": "This field contains a human readable error message",
3285+
"type": "string",
3286+
"example": "A human readable error message"
3287+
}
3288+
}
3289+
},
31733290
"controllers.TransactionListResponse": {
31743291
"type": "object",
31753292
"properties": {
@@ -4083,6 +4200,11 @@
40834200
"type": "string",
40844201
"example": "https://example.com/api/v1"
40854202
},
4203+
"v2": {
4204+
"description": "List endpoint for all v2 endpoints",
4205+
"type": "string",
4206+
"example": "https://example.com/api/v2"
4207+
},
40864208
"version": {
40874209
"description": "Endpoint returning the version of the backend",
40884210
"type": "string",
@@ -4156,6 +4278,29 @@
41564278
}
41574279
}
41584280
},
4281+
"router.V2Links": {
4282+
"type": "object",
4283+
"properties": {
4284+
"transactions": {
4285+
"description": "URL of transaction list endpoint",
4286+
"type": "string",
4287+
"example": "https://example.com/api/v2/transactions"
4288+
}
4289+
}
4290+
},
4291+
"router.V2Response": {
4292+
"type": "object",
4293+
"properties": {
4294+
"links": {
4295+
"description": "Links for the v2 API",
4296+
"allOf": [
4297+
{
4298+
"$ref": "#/definitions/router.V2Links"
4299+
}
4300+
]
4301+
}
4302+
}
4303+
},
41594304
"router.VersionObject": {
41604305
"type": "object",
41614306
"properties": {

0 commit comments

Comments
 (0)