Skip to content

Commit da8a8a9

Browse files
authored
feat: add Envelopes to v3 API (#873)
1 parent ce1d685 commit da8a8a9

16 files changed

+2191
-127
lines changed

api/docs.go

Lines changed: 454 additions & 0 deletions
Large diffs are not rendered by default.

api/swagger.json

Lines changed: 454 additions & 0 deletions
Large diffs are not rendered by default.

api/swagger.yaml

Lines changed: 313 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,18 @@ definitions:
619619
example: "2022-04-17T20:14:01.048145Z"
620620
type: string
621621
type: object
622+
controllers.EnvelopeCreateResponseV3:
623+
properties:
624+
data:
625+
description: Data for the Envelope
626+
items:
627+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
628+
type: array
629+
error:
630+
description: The error, if any occurred
631+
example: the specified resource ID is not a valid UUID
632+
type: string
633+
type: object
622634
controllers.EnvelopeListResponse:
623635
properties:
624636
data:
@@ -627,6 +639,22 @@ definitions:
627639
$ref: '#/definitions/controllers.Envelope'
628640
type: array
629641
type: object
642+
controllers.EnvelopeListResponseV3:
643+
properties:
644+
data:
645+
description: List of Envelopes
646+
items:
647+
$ref: '#/definitions/controllers.EnvelopeV3'
648+
type: array
649+
error:
650+
description: The error, if any occurred
651+
example: the specified resource ID is not a valid UUID
652+
type: string
653+
pagination:
654+
allOf:
655+
- $ref: '#/definitions/controllers.Pagination'
656+
description: Pagination information
657+
type: object
630658
controllers.EnvelopeMonthResponse:
631659
properties:
632660
data:
@@ -641,6 +669,65 @@ definitions:
641669
- $ref: '#/definitions/controllers.Envelope'
642670
description: Data for the Envelope
643671
type: object
672+
controllers.EnvelopeResponseV3:
673+
properties:
674+
data:
675+
allOf:
676+
- $ref: '#/definitions/controllers.EnvelopeV3'
677+
description: Data for the Envelope
678+
error:
679+
description: The error, if any occurred
680+
example: the specified resource ID is not a valid UUID
681+
type: string
682+
type: object
683+
controllers.EnvelopeV3:
684+
properties:
685+
categoryId:
686+
description: ID of the category the envelope belongs to
687+
example: 878c831f-af99-4a71-b3ca-80deb7d793c1
688+
type: string
689+
createdAt:
690+
description: Time the resource was created
691+
example: "2022-04-02T19:28:44.491514Z"
692+
type: string
693+
deletedAt:
694+
description: Time the resource was marked as deleted
695+
example: "2022-04-22T21:01:05.058161Z"
696+
type: string
697+
hidden:
698+
default: false
699+
description: Is the envelope hidden?
700+
example: true
701+
type: boolean
702+
id:
703+
description: UUID for the resource
704+
example: 65392deb-5e92-4268-b114-297faad6cdce
705+
type: string
706+
links:
707+
description: Links to related resources
708+
properties:
709+
self:
710+
description: The envelope itself
711+
example: https://example.com/api/v3/envelopes/45b6b5b9-f746-4ae9-b77b-7688b91f8166
712+
type: string
713+
transactions:
714+
description: The envelope's transactions
715+
example: https://example.com/api/v3/transactions?envelope=45b6b5b9-f746-4ae9-b77b-7688b91f8166
716+
type: string
717+
type: object
718+
name:
719+
description: Name of the envelope
720+
example: Groceries
721+
type: string
722+
note:
723+
description: Notes about the envelope
724+
example: For stuff bought at supermarkets and drugstores
725+
type: string
726+
updatedAt:
727+
description: Last time the resource was updated
728+
example: "2022-04-17T20:14:01.048145Z"
729+
type: string
730+
type: object
644731
controllers.ImportPreviewList:
645732
properties:
646733
data:
@@ -1887,6 +1974,10 @@ definitions:
18871974
description: URL of Budget collection endpoint
18881975
example: https://example.com/api/v3/budgets
18891976
type: string
1977+
envelopes:
1978+
description: URL of Envelope collection endpoint
1979+
example: https://example.com/api/v3/envelopes
1980+
type: string
18901981
import:
18911982
description: URL of import list endpoint
18921983
example: https://example.com/api/v3/import
@@ -3001,6 +3092,7 @@ paths:
30013092
- Categories
30023093
/v1/envelopes:
30033094
get:
3095+
deprecated: true
30043096
description: Returns a list of envelopes
30053097
parameters:
30063098
- description: Filter by name
@@ -3042,6 +3134,7 @@ paths:
30423134
tags:
30433135
- Envelopes
30443136
options:
3137+
deprecated: true
30453138
description: Returns an empty response with the HTTP Header "allow" set to the
30463139
allowed HTTP verbs
30473140
responses:
@@ -3051,6 +3144,7 @@ paths:
30513144
tags:
30523145
- Envelopes
30533146
post:
3147+
deprecated: true
30543148
description: Creates a new envelope
30553149
parameters:
30563150
- description: Envelope
@@ -3083,6 +3177,7 @@ paths:
30833177
- Envelopes
30843178
/v1/envelopes/{id}:
30853179
delete:
3180+
deprecated: true
30863181
description: Deletes an envelope
30873182
parameters:
30883183
- description: ID formatted as string
@@ -3109,6 +3204,7 @@ paths:
31093204
tags:
31103205
- Envelopes
31113206
get:
3207+
deprecated: true
31123208
description: Returns a specific envelope
31133209
parameters:
31143210
- description: ID formatted as string
@@ -3139,6 +3235,7 @@ paths:
31393235
tags:
31403236
- Envelopes
31413237
options:
3238+
deprecated: true
31423239
description: Returns an empty response with the HTTP Header "allow" set to the
31433240
allowed HTTP verbs
31443241
parameters:
@@ -3168,6 +3265,7 @@ paths:
31683265
patch:
31693266
consumes:
31703267
- application/json
3268+
deprecated: true
31713269
description: Updates an existing envelope. Only values to be updated need to
31723270
be specified.
31733271
parameters:
@@ -4994,6 +5092,221 @@ paths:
49945092
summary: Update budget
49955093
tags:
49965094
- Budgets
5095+
/v3/envelopes:
5096+
get:
5097+
description: Returns a list of envelopes
5098+
parameters:
5099+
- description: Filter by name
5100+
in: query
5101+
name: name
5102+
type: string
5103+
- description: Filter by note
5104+
in: query
5105+
name: note
5106+
type: string
5107+
- description: Filter by category ID
5108+
in: query
5109+
name: category
5110+
type: string
5111+
- description: Is the envelope archived?
5112+
in: query
5113+
name: archived
5114+
type: boolean
5115+
- description: Search for this text in name and note
5116+
in: query
5117+
name: search
5118+
type: string
5119+
- description: The offset of the first Transaction returned. Defaults to 0.
5120+
in: query
5121+
name: offset
5122+
type: integer
5123+
- description: Maximum number of transactions to return. Defaults to 50.
5124+
in: query
5125+
name: limit
5126+
type: integer
5127+
produces:
5128+
- application/json
5129+
responses:
5130+
"200":
5131+
description: OK
5132+
schema:
5133+
$ref: '#/definitions/controllers.EnvelopeListResponseV3'
5134+
"400":
5135+
description: Bad Request
5136+
schema:
5137+
$ref: '#/definitions/controllers.EnvelopeListResponseV3'
5138+
"500":
5139+
description: Internal Server Error
5140+
schema:
5141+
$ref: '#/definitions/controllers.EnvelopeListResponseV3'
5142+
summary: Get envelopes
5143+
tags:
5144+
- Envelopes
5145+
options:
5146+
description: Returns an empty response with the HTTP Header "allow" set to the
5147+
allowed HTTP verbs
5148+
responses:
5149+
"204":
5150+
description: No Content
5151+
summary: Allowed HTTP verbs
5152+
tags:
5153+
- Envelopes
5154+
post:
5155+
description: Creates a new envelope
5156+
parameters:
5157+
- description: Envelopes
5158+
in: body
5159+
name: envelope
5160+
required: true
5161+
schema:
5162+
items:
5163+
$ref: '#/definitions/models.EnvelopeCreate'
5164+
type: array
5165+
produces:
5166+
- application/json
5167+
responses:
5168+
"201":
5169+
description: Created
5170+
schema:
5171+
$ref: '#/definitions/controllers.EnvelopeCreateResponseV3'
5172+
"400":
5173+
description: Bad Request
5174+
schema:
5175+
$ref: '#/definitions/controllers.EnvelopeCreateResponseV3'
5176+
"404":
5177+
description: Not Found
5178+
schema:
5179+
$ref: '#/definitions/controllers.EnvelopeCreateResponseV3'
5180+
"500":
5181+
description: Internal Server Error
5182+
schema:
5183+
$ref: '#/definitions/controllers.EnvelopeCreateResponseV3'
5184+
summary: Create envelope
5185+
tags:
5186+
- Envelopes
5187+
/v3/envelopes/{id}:
5188+
delete:
5189+
description: Deletes an envelope
5190+
parameters:
5191+
- description: ID formatted as string
5192+
in: path
5193+
name: id
5194+
required: true
5195+
type: string
5196+
responses:
5197+
"204":
5198+
description: No Content
5199+
"400":
5200+
description: Bad Request
5201+
schema:
5202+
$ref: '#/definitions/httperrors.HTTPError'
5203+
"404":
5204+
description: Not Found
5205+
schema:
5206+
$ref: '#/definitions/httperrors.HTTPError'
5207+
"500":
5208+
description: Internal Server Error
5209+
schema:
5210+
$ref: '#/definitions/httperrors.HTTPError'
5211+
summary: Delete envelope
5212+
tags:
5213+
- Envelopes
5214+
get:
5215+
description: Returns a specific Envelope
5216+
parameters:
5217+
- description: ID formatted as string
5218+
in: path
5219+
name: id
5220+
required: true
5221+
type: string
5222+
produces:
5223+
- application/json
5224+
responses:
5225+
"200":
5226+
description: OK
5227+
schema:
5228+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5229+
"400":
5230+
description: Bad Request
5231+
schema:
5232+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5233+
"404":
5234+
description: Not Found
5235+
schema:
5236+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5237+
"500":
5238+
description: Internal Server Error
5239+
schema:
5240+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5241+
summary: Get Envelope
5242+
tags:
5243+
- Envelopes
5244+
options:
5245+
description: Returns an empty response with the HTTP Header "allow" set to the
5246+
allowed HTTP verbs
5247+
parameters:
5248+
- description: ID formatted as string
5249+
in: path
5250+
name: id
5251+
required: true
5252+
type: string
5253+
responses:
5254+
"204":
5255+
description: No Content
5256+
"400":
5257+
description: Bad Request
5258+
schema:
5259+
$ref: '#/definitions/httperrors.HTTPError'
5260+
"404":
5261+
description: Not Found
5262+
schema:
5263+
$ref: '#/definitions/httperrors.HTTPError'
5264+
"500":
5265+
description: Internal Server Error
5266+
schema:
5267+
$ref: '#/definitions/httperrors.HTTPError'
5268+
summary: Allowed HTTP verbs
5269+
tags:
5270+
- Envelopes
5271+
patch:
5272+
consumes:
5273+
- application/json
5274+
description: Updates an existing envelope. Only values to be updated need to
5275+
be specified.
5276+
parameters:
5277+
- description: ID formatted as string
5278+
in: path
5279+
name: id
5280+
required: true
5281+
type: string
5282+
- description: Envelope
5283+
in: body
5284+
name: envelope
5285+
required: true
5286+
schema:
5287+
$ref: '#/definitions/models.EnvelopeCreate'
5288+
produces:
5289+
- application/json
5290+
responses:
5291+
"200":
5292+
description: OK
5293+
schema:
5294+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5295+
"400":
5296+
description: Bad Request
5297+
schema:
5298+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5299+
"404":
5300+
description: Not Found
5301+
schema:
5302+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5303+
"500":
5304+
description: Internal Server Error
5305+
schema:
5306+
$ref: '#/definitions/controllers.EnvelopeResponseV3'
5307+
summary: Update envelope
5308+
tags:
5309+
- Envelopes
49975310
/v3/import:
49985311
get:
49995312
description: Returns general information about the v3 API

0 commit comments

Comments
 (0)