Skip to content

Commit 4cf875f

Browse files
authored
feat: add Match Rules support to v3 (#850)
1 parent af0fbbe commit 4cf875f

File tree

14 files changed

+2484
-323
lines changed

14 files changed

+2484
-323
lines changed

api/docs.go

Lines changed: 431 additions & 1 deletion
Large diffs are not rendered by default.

api/swagger.json

Lines changed: 431 additions & 1 deletion
Large diffs are not rendered by default.

api/swagger.yaml

Lines changed: 299 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,84 @@ definitions:
464464
example: "2022-04-17T20:14:01.048145Z"
465465
type: string
466466
type: object
467+
controllers.MatchRuleCreateResponseV3:
468+
properties:
469+
data:
470+
description: List of created Match Rules
471+
items:
472+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
473+
type: array
474+
error:
475+
description: The error, if any occurred
476+
example: the specified resource ID is not a valid UUID
477+
type: string
478+
type: object
479+
controllers.MatchRuleListResponseV3:
480+
properties:
481+
data:
482+
description: List of Match Rules
483+
items:
484+
$ref: '#/definitions/controllers.MatchRuleV3'
485+
type: array
486+
error:
487+
description: The error, if any occurred
488+
example: the specified resource ID is not a valid UUID
489+
type: string
490+
pagination:
491+
allOf:
492+
- $ref: '#/definitions/controllers.Pagination'
493+
description: Pagination information
494+
type: object
495+
controllers.MatchRuleResponseV3:
496+
properties:
497+
data:
498+
allOf:
499+
- $ref: '#/definitions/controllers.MatchRuleV3'
500+
description: The Match Rule data, if creation was successful
501+
error:
502+
description: The error, if any occurred for this Match Rule
503+
example: the specified resource ID is not a valid UUID
504+
type: string
505+
type: object
506+
controllers.MatchRuleV3:
507+
properties:
508+
accountId:
509+
description: The account to map matching transactions to
510+
example: f9e873c2-fb96-4367-bfb6-7ecd9bf4a6b5
511+
type: string
512+
createdAt:
513+
description: Time the resource was created
514+
example: "2022-04-02T19:28:44.491514Z"
515+
type: string
516+
deletedAt:
517+
description: Time the resource was marked as deleted
518+
example: "2022-04-22T21:01:05.058161Z"
519+
type: string
520+
id:
521+
description: UUID for the resource
522+
example: 65392deb-5e92-4268-b114-297faad6cdce
523+
type: string
524+
links:
525+
properties:
526+
self:
527+
description: The match rule itself
528+
example: https://example.com/api/v3/match-rules/95685c82-53c6-455d-b235-f49960b73b21
529+
type: string
530+
type: object
531+
match:
532+
description: The matching applied to the opposite account. This is a glob
533+
pattern. Multiple globs are allowed. Globbing is case sensitive.
534+
example: Bank*
535+
type: string
536+
priority:
537+
description: The priority of the match rule
538+
example: 3
539+
type: integer
540+
updatedAt:
541+
description: Last time the resource was updated
542+
example: "2022-04-17T20:14:01.048145Z"
543+
type: string
544+
type: object
467545
controllers.MonthConfig:
468546
properties:
469547
createdAt:
@@ -1529,8 +1607,12 @@ definitions:
15291607
type: object
15301608
router.V3Links:
15311609
properties:
1610+
matchRules:
1611+
description: URL of Match Rule collection endpoint
1612+
example: https://example.com/api/v3/match-rules
1613+
type: string
15321614
transactions:
1533-
description: URL of transaction collection endpoint
1615+
description: URL of Transaction collection endpoint
15341616
example: https://example.com/api/v3/transactions
15351617
type: string
15361618
type: object
@@ -3669,6 +3751,7 @@ paths:
36693751
- Accounts
36703752
/v2/match-rules:
36713753
get:
3754+
deprecated: true
36723755
description: Returns a list of matchRules
36733756
parameters:
36743757
- description: Filter by priority
@@ -3704,6 +3787,7 @@ paths:
37043787
tags:
37053788
- MatchRules
37063789
options:
3790+
deprecated: true
37073791
description: Returns an empty response with the HTTP Header "allow" set to the
37083792
allowed HTTP verbs
37093793
responses:
@@ -3713,6 +3797,7 @@ paths:
37133797
tags:
37143798
- MatchRules
37153799
post:
3800+
deprecated: true
37163801
description: Creates matchRules from the list of submitted matchRule data. The
37173802
response code is the highest response code number that a single matchRule
37183803
creation would have caused. If it is not equal to 201, at least one matchRule
@@ -3756,6 +3841,7 @@ paths:
37563841
- MatchRules
37573842
/v2/match-rules/{id}:
37583843
delete:
3844+
deprecated: true
37593845
description: Deletes an matchRule
37603846
parameters:
37613847
- description: ID formatted as string
@@ -3782,6 +3868,7 @@ paths:
37823868
tags:
37833869
- MatchRules
37843870
get:
3871+
deprecated: true
37853872
description: Returns a specific matchRule
37863873
parameters:
37873874
- description: ID formatted as string
@@ -3812,6 +3899,7 @@ paths:
38123899
tags:
38133900
- MatchRules
38143901
options:
3902+
deprecated: true
38153903
description: Returns an empty response with the HTTP Header "allow" set to the
38163904
allowed HTTP verbs
38173905
parameters:
@@ -3841,6 +3929,7 @@ paths:
38413929
patch:
38423930
consumes:
38433931
- application/json
3932+
deprecated: true
38443933
description: Update an matchRule. Only values to be updated need to be specified.
38453934
parameters:
38463935
- description: ID formatted as string
@@ -4162,6 +4251,215 @@ paths:
41624251
summary: Allowed HTTP verbs
41634252
tags:
41644253
- v3
4254+
/v3/match-rules:
4255+
get:
4256+
description: Returns a list of matchRules
4257+
parameters:
4258+
- description: Filter by priority
4259+
in: query
4260+
name: priority
4261+
type: integer
4262+
- description: Filter by match
4263+
in: query
4264+
name: match
4265+
type: string
4266+
- description: Filter by account ID
4267+
in: query
4268+
name: account
4269+
type: string
4270+
- description: The offset of the first Match Rule returned. Defaults to 0.
4271+
in: query
4272+
name: offset
4273+
type: integer
4274+
- description: Maximum number of Match Rules to return. Defaults to 50.
4275+
in: query
4276+
name: limit
4277+
type: integer
4278+
produces:
4279+
- application/json
4280+
responses:
4281+
"200":
4282+
description: OK
4283+
schema:
4284+
$ref: '#/definitions/controllers.MatchRuleListResponseV3'
4285+
"400":
4286+
description: Bad Request
4287+
schema:
4288+
$ref: '#/definitions/controllers.MatchRuleListResponseV3'
4289+
"500":
4290+
description: Internal Server Error
4291+
schema:
4292+
$ref: '#/definitions/controllers.MatchRuleListResponseV3'
4293+
summary: Get matchRules
4294+
tags:
4295+
- MatchRules
4296+
options:
4297+
description: Returns an empty response with the HTTP Header "allow" set to the
4298+
allowed HTTP verbs
4299+
responses:
4300+
"204":
4301+
description: No Content
4302+
summary: Allowed HTTP verbs
4303+
tags:
4304+
- MatchRules
4305+
post:
4306+
description: Creates matchRules from the list of submitted matchRule data. The
4307+
response code is the highest response code number that a single matchRule
4308+
creation would have caused. If it is not equal to 201, at least one matchRule
4309+
has an error.
4310+
parameters:
4311+
- description: MatchRules
4312+
in: body
4313+
name: matchRules
4314+
required: true
4315+
schema:
4316+
items:
4317+
$ref: '#/definitions/models.MatchRuleCreate'
4318+
type: array
4319+
produces:
4320+
- application/json
4321+
responses:
4322+
"201":
4323+
description: Created
4324+
schema:
4325+
$ref: '#/definitions/controllers.MatchRuleCreateResponseV3'
4326+
"400":
4327+
description: Bad Request
4328+
schema:
4329+
$ref: '#/definitions/controllers.MatchRuleCreateResponseV3'
4330+
"404":
4331+
description: Not Found
4332+
schema:
4333+
$ref: '#/definitions/controllers.MatchRuleCreateResponseV3'
4334+
"500":
4335+
description: Internal Server Error
4336+
schema:
4337+
$ref: '#/definitions/controllers.MatchRuleCreateResponseV3'
4338+
summary: Create matchRules
4339+
tags:
4340+
- MatchRules
4341+
/v3/match-rules/{id}:
4342+
delete:
4343+
description: Deletes an matchRule
4344+
parameters:
4345+
- description: ID formatted as string
4346+
in: path
4347+
name: id
4348+
required: true
4349+
type: string
4350+
responses:
4351+
"204":
4352+
description: No Content
4353+
"400":
4354+
description: Bad Request
4355+
schema:
4356+
$ref: '#/definitions/httperrors.HTTPError'
4357+
"404":
4358+
description: Not Found
4359+
schema:
4360+
$ref: '#/definitions/httperrors.HTTPError'
4361+
"500":
4362+
description: Internal Server Error
4363+
schema:
4364+
$ref: '#/definitions/httperrors.HTTPError'
4365+
summary: Delete matchRule
4366+
tags:
4367+
- MatchRules
4368+
get:
4369+
description: Returns a specific matchRule
4370+
parameters:
4371+
- description: ID formatted as string
4372+
in: path
4373+
name: id
4374+
required: true
4375+
type: string
4376+
produces:
4377+
- application/json
4378+
responses:
4379+
"200":
4380+
description: OK
4381+
schema:
4382+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4383+
"400":
4384+
description: Bad Request
4385+
schema:
4386+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4387+
"404":
4388+
description: Not Found
4389+
schema:
4390+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4391+
"500":
4392+
description: Internal Server Error
4393+
schema:
4394+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4395+
summary: Get matchRule
4396+
tags:
4397+
- MatchRules
4398+
options:
4399+
description: Returns an empty response with the HTTP Header "allow" set to the
4400+
allowed HTTP verbs
4401+
parameters:
4402+
- description: ID formatted as string
4403+
in: path
4404+
name: id
4405+
required: true
4406+
type: string
4407+
responses:
4408+
"204":
4409+
description: No Content
4410+
"400":
4411+
description: Bad Request
4412+
schema:
4413+
$ref: '#/definitions/httperrors.HTTPError'
4414+
"404":
4415+
description: Not Found
4416+
schema:
4417+
$ref: '#/definitions/httperrors.HTTPError'
4418+
"500":
4419+
description: Internal Server Error
4420+
schema:
4421+
$ref: '#/definitions/httperrors.HTTPError'
4422+
summary: Allowed HTTP verbs
4423+
tags:
4424+
- MatchRules
4425+
patch:
4426+
consumes:
4427+
- application/json
4428+
description: Update a matchRule. Only values to be updated need to be specified.
4429+
parameters:
4430+
- description: ID formatted as string
4431+
in: path
4432+
name: id
4433+
required: true
4434+
type: string
4435+
- description: MatchRule
4436+
in: body
4437+
name: matchRule
4438+
required: true
4439+
schema:
4440+
$ref: '#/definitions/models.MatchRuleCreate'
4441+
produces:
4442+
- application/json
4443+
responses:
4444+
"200":
4445+
description: OK
4446+
schema:
4447+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4448+
"400":
4449+
description: Bad Request
4450+
schema:
4451+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4452+
"404":
4453+
description: Not Found
4454+
schema:
4455+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4456+
"500":
4457+
description: Internal Server Error
4458+
schema:
4459+
$ref: '#/definitions/controllers.MatchRuleResponseV3'
4460+
summary: Update matchRule
4461+
tags:
4462+
- MatchRules
41654463
/v3/transactions:
41664464
get:
41674465
description: Returns a list of transactions

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/envelope-zero/backend/v3
22

3-
go 1.19
3+
go 1.20
44

55
require (
66
github.com/gin-contrib/cors v1.4.0

0 commit comments

Comments
 (0)