Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add POST method for /v3/transactions #838

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 87 additions & 4 deletions api/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3958,6 +3958,56 @@ const docTemplate = `{
}
}
},
"post": {
"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.",
"produces": [
"application/json"
],
"tags": [
"Transactions"
],
"summary": "Create transactions",
"parameters": [
{
"description": "Transactions",
"name": "transactions",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.TransactionCreate"
}
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
}
}
},
"options": {
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
"tags": [
Expand Down Expand Up @@ -4882,7 +4932,7 @@ const docTemplate = `{
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down Expand Up @@ -4911,6 +4961,22 @@ const docTemplate = `{
}
}
},
"controllers.TransactionCreateResponseV3": {
"type": "object",
"properties": {
"data": {
"description": "List of created transactions",
"type": "array",
"items": {
"$ref": "#/definitions/controllers.TransactionResponseV3"
}
},
"error": {
"description": "The error, if any occurred",
"type": "string"
}
}
},
"controllers.TransactionListResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4960,6 +5026,23 @@ const docTemplate = `{
}
}
},
"controllers.TransactionResponseV3": {
"type": "object",
"properties": {
"data": {
"description": "The transaction data, if creation was successful",
"allOf": [
{
"$ref": "#/definitions/controllers.TransactionV3"
}
]
},
"error": {
"description": "The error, if any occurred for this transaction",
"type": "string"
}
}
},
"controllers.TransactionV2": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -5033,7 +5116,7 @@ const docTemplate = `{
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down Expand Up @@ -5135,7 +5218,7 @@ const docTemplate = `{
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down Expand Up @@ -5792,7 +5875,7 @@ const docTemplate = `{
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down
91 changes: 87 additions & 4 deletions api/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3947,6 +3947,56 @@
}
}
},
"post": {
"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.",
"produces": [
"application/json"
],
"tags": [
"Transactions"
],
"summary": "Create transactions",
"parameters": [
{
"description": "Transactions",
"name": "transactions",
"in": "body",
"required": true,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.TransactionCreate"
}
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/controllers.TransactionCreateResponseV3"
}
}
}
},
"options": {
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
"tags": [
Expand Down Expand Up @@ -4871,7 +4921,7 @@
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down Expand Up @@ -4900,6 +4950,22 @@
}
}
},
"controllers.TransactionCreateResponseV3": {
"type": "object",
"properties": {
"data": {
"description": "List of created transactions",
"type": "array",
"items": {
"$ref": "#/definitions/controllers.TransactionResponseV3"
}
},
"error": {
"description": "The error, if any occurred",
"type": "string"
}
}
},
"controllers.TransactionListResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -4949,6 +5015,23 @@
}
}
},
"controllers.TransactionResponseV3": {
"type": "object",
"properties": {
"data": {
"description": "The transaction data, if creation was successful",
"allOf": [
{
"$ref": "#/definitions/controllers.TransactionV3"
}
]
},
"error": {
"description": "The error, if any occurred for this transaction",
"type": "string"
}
}
},
"controllers.TransactionV2": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -5022,7 +5105,7 @@
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down Expand Up @@ -5124,7 +5207,7 @@
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down Expand Up @@ -5781,7 +5864,7 @@
"example": "Lunch"
},
"reconciled": {
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead.",
"description": "DEPRECATED. Do not use, this field does not work as intended. See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource and reconciledDestination instead. This field will be removed in 4.0.0",
"type": "boolean",
"default": false,
"example": true
Expand Down
65 changes: 61 additions & 4 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ definitions:
default: false
description: DEPRECATED. Do not use, this field does not work as intended.
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
and reconciledDestination instead.
and reconciledDestination instead. This field will be removed in 4.0.0
example: true
type: boolean
reconciledDestination:
Expand All @@ -670,6 +670,17 @@ definitions:
example: "2022-04-17T20:14:01.048145Z"
type: string
type: object
controllers.TransactionCreateResponseV3:
properties:
data:
description: List of created transactions
items:
$ref: '#/definitions/controllers.TransactionResponseV3'
type: array
error:
description: The error, if any occurred
type: string
type: object
controllers.TransactionListResponse:
properties:
data:
Expand Down Expand Up @@ -700,6 +711,16 @@ definitions:
- $ref: '#/definitions/controllers.Transaction'
description: Data for the transaction
type: object
controllers.TransactionResponseV3:
properties:
data:
allOf:
- $ref: '#/definitions/controllers.TransactionV3'
description: The transaction data, if creation was successful
error:
description: The error, if any occurred for this transaction
type: string
type: object
controllers.TransactionV2:
properties:
amount:
Expand Down Expand Up @@ -765,7 +786,7 @@ definitions:
default: false
description: DEPRECATED. Do not use, this field does not work as intended.
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
and reconciledDestination instead.
and reconciledDestination instead. This field will be removed in 4.0.0
example: true
type: boolean
reconciledDestination:
Expand Down Expand Up @@ -852,7 +873,7 @@ definitions:
default: false
description: DEPRECATED. Do not use, this field does not work as intended.
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
and reconciledDestination instead.
and reconciledDestination instead. This field will be removed in 4.0.0
example: true
type: boolean
reconciledDestination:
Expand Down Expand Up @@ -1375,7 +1396,7 @@ definitions:
default: false
description: DEPRECATED. Do not use, this field does not work as intended.
See https://github.com/envelope-zero/backend/issues/528. Use reconciledSource
and reconciledDestination instead.
and reconciledDestination instead. This field will be removed in 4.0.0
example: true
type: boolean
reconciledDestination:
Expand Down Expand Up @@ -4221,6 +4242,42 @@ paths:
summary: Allowed HTTP verbs
tags:
- Transactions
post:
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.
parameters:
- description: Transactions
in: body
name: transactions
required: true
schema:
items:
$ref: '#/definitions/models.TransactionCreate'
type: array
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
"400":
description: Bad Request
schema:
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
"404":
description: Not Found
schema:
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/controllers.TransactionCreateResponseV3'
summary: Create transactions
tags:
- Transactions
/version:
get:
description: Returns the software version of the API
Expand Down
Loading