Skip to content

Commit cd582db

Browse files
authored
feat: add MonthConfigs to API v3 (#878)
1 parent cb63b15 commit cd582db

File tree

14 files changed

+1528
-404
lines changed

14 files changed

+1528
-404
lines changed

api/docs.go

Lines changed: 235 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,6 +2172,7 @@ const docTemplate = `{
21722172
"MonthConfigs"
21732173
],
21742174
"summary": "List MonthConfigs",
2175+
"deprecated": true,
21752176
"parameters": [
21762177
{
21772178
"type": "string",
@@ -2213,6 +2214,7 @@ const docTemplate = `{
22132214
"MonthConfigs"
22142215
],
22152216
"summary": "Allowed HTTP verbs",
2217+
"deprecated": true,
22162218
"responses": {
22172219
"204": {
22182220
"description": "No Content"
@@ -2230,6 +2232,7 @@ const docTemplate = `{
22302232
"MonthConfigs"
22312233
],
22322234
"summary": "Get MonthConfig",
2235+
"deprecated": true,
22332236
"parameters": [
22342237
{
22352238
"type": "string",
@@ -2282,6 +2285,7 @@ const docTemplate = `{
22822285
"MonthConfigs"
22832286
],
22842287
"summary": "Create MonthConfig",
2288+
"deprecated": true,
22852289
"parameters": [
22862290
{
22872291
"type": "string",
@@ -2343,6 +2347,7 @@ const docTemplate = `{
23432347
"MonthConfigs"
23442348
],
23452349
"summary": "Delete MonthConfig",
2350+
"deprecated": true,
23462351
"parameters": [
23472352
{
23482353
"type": "string",
@@ -2389,6 +2394,7 @@ const docTemplate = `{
23892394
"MonthConfigs"
23902395
],
23912396
"summary": "Allowed HTTP verbs",
2397+
"deprecated": true,
23922398
"parameters": [
23932399
{
23942400
"type": "string",
@@ -2438,6 +2444,7 @@ const docTemplate = `{
24382444
"MonthConfigs"
24392445
],
24402446
"summary": "Update MonthConfig",
2447+
"deprecated": true,
24412448
"parameters": [
24422449
{
24432450
"type": "string",
@@ -5173,6 +5180,155 @@ const docTemplate = `{
51735180
}
51745181
}
51755182
},
5183+
"/v3/envelopes/{id}/{month}": {
5184+
"get": {
5185+
"description": "Returns configuration for a specific month",
5186+
"produces": [
5187+
"application/json"
5188+
],
5189+
"tags": [
5190+
"Envelopes"
5191+
],
5192+
"summary": "Get MonthConfig",
5193+
"parameters": [
5194+
{
5195+
"type": "string",
5196+
"description": "ID of the Envelope",
5197+
"name": "id",
5198+
"in": "path",
5199+
"required": true
5200+
},
5201+
{
5202+
"type": "string",
5203+
"description": "The month in YYYY-MM format",
5204+
"name": "month",
5205+
"in": "path",
5206+
"required": true
5207+
}
5208+
],
5209+
"responses": {
5210+
"200": {
5211+
"description": "OK",
5212+
"schema": {
5213+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5214+
}
5215+
},
5216+
"400": {
5217+
"description": "Bad Request",
5218+
"schema": {
5219+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5220+
}
5221+
},
5222+
"404": {
5223+
"description": "Not Found",
5224+
"schema": {
5225+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5226+
}
5227+
},
5228+
"500": {
5229+
"description": "Internal Server Error",
5230+
"schema": {
5231+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5232+
}
5233+
}
5234+
}
5235+
},
5236+
"options": {
5237+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
5238+
"tags": [
5239+
"Envelopes"
5240+
],
5241+
"summary": "Allowed HTTP verbs",
5242+
"parameters": [
5243+
{
5244+
"type": "string",
5245+
"description": "ID of the Envelope",
5246+
"name": "id",
5247+
"in": "path",
5248+
"required": true
5249+
},
5250+
{
5251+
"type": "string",
5252+
"description": "The month in YYYY-MM format",
5253+
"name": "month",
5254+
"in": "path",
5255+
"required": true
5256+
}
5257+
],
5258+
"responses": {
5259+
"204": {
5260+
"description": "No Content"
5261+
},
5262+
"400": {
5263+
"description": "Bad Request",
5264+
"schema": {
5265+
"$ref": "#/definitions/httperrors.HTTPError"
5266+
}
5267+
}
5268+
}
5269+
},
5270+
"patch": {
5271+
"description": "Changes configuration for a Month. If there is no configuration for the month yet, this endpoint transparently creates a configuration resource.",
5272+
"produces": [
5273+
"application/json"
5274+
],
5275+
"tags": [
5276+
"Envelopes"
5277+
],
5278+
"summary": "Update MonthConfig",
5279+
"parameters": [
5280+
{
5281+
"type": "string",
5282+
"description": "ID of the Envelope",
5283+
"name": "id",
5284+
"in": "path",
5285+
"required": true
5286+
},
5287+
{
5288+
"type": "string",
5289+
"description": "The month in YYYY-MM format",
5290+
"name": "month",
5291+
"in": "path",
5292+
"required": true
5293+
},
5294+
{
5295+
"description": "MonthConfig",
5296+
"name": "monthConfig",
5297+
"in": "body",
5298+
"required": true,
5299+
"schema": {
5300+
"$ref": "#/definitions/models.MonthConfigCreate"
5301+
}
5302+
}
5303+
],
5304+
"responses": {
5305+
"201": {
5306+
"description": "Created",
5307+
"schema": {
5308+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5309+
}
5310+
},
5311+
"400": {
5312+
"description": "Bad Request",
5313+
"schema": {
5314+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5315+
}
5316+
},
5317+
"404": {
5318+
"description": "Not Found",
5319+
"schema": {
5320+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5321+
}
5322+
},
5323+
"500": {
5324+
"description": "Internal Server Error",
5325+
"schema": {
5326+
"$ref": "#/definitions/controllers.MonthConfigResponseV3"
5327+
}
5328+
}
5329+
}
5330+
}
5331+
},
51765332
"/v3/import": {
51775333
"get": {
51785334
"description": "Returns general information about the v3 API",
@@ -7132,6 +7288,11 @@ const docTemplate = `{
71327288
"description": "Links to related resources",
71337289
"type": "object",
71347290
"properties": {
7291+
"month": {
7292+
"description": "The MonthConfig for the envelope",
7293+
"type": "string",
7294+
"example": "https://example.com/api/v3/transactions?envelope=45b6b5b9-f746-4ae9-b77b-7688b91f8166/YYYY-MM"
7295+
},
71357296
"self": {
71367297
"description": "The envelope itself",
71377298
"type": "string",
@@ -7422,7 +7583,7 @@ const docTemplate = `{
74227583
"example": "Added 200€ here because we replaced Tim's expensive vase"
74237584
},
74247585
"overspendMode": {
7425-
"description": "The overspend handling mode to use",
7586+
"description": "The overspend handling mode to use. Deprecated, will be removed with 4.0.0 release and is not used in API v3 anymore",
74267587
"default": "AFFECT_AVAILABLE",
74277588
"allOf": [
74287589
{
@@ -7463,6 +7624,78 @@ const docTemplate = `{
74637624
}
74647625
}
74657626
},
7627+
"controllers.MonthConfigResponseV3": {
7628+
"type": "object",
7629+
"properties": {
7630+
"data": {
7631+
"description": "Config for the month",
7632+
"allOf": [
7633+
{
7634+
"$ref": "#/definitions/controllers.MonthConfigV3"
7635+
}
7636+
]
7637+
},
7638+
"error": {
7639+
"description": "The error, if any occurred",
7640+
"type": "string",
7641+
"example": "the specified resource ID is not a valid UUID"
7642+
}
7643+
}
7644+
},
7645+
"controllers.MonthConfigV3": {
7646+
"type": "object",
7647+
"properties": {
7648+
"createdAt": {
7649+
"description": "Time the resource was created",
7650+
"type": "string",
7651+
"example": "2022-04-02T19:28:44.491514Z"
7652+
},
7653+
"deletedAt": {
7654+
"description": "Time the resource was marked as deleted",
7655+
"type": "string",
7656+
"example": "2022-04-22T21:01:05.058161Z"
7657+
},
7658+
"envelopeId": {
7659+
"description": "ID of the envelope",
7660+
"type": "string",
7661+
"example": "10b9705d-3356-459e-9d5a-28d42a6c4547"
7662+
},
7663+
"links": {
7664+
"type": "object",
7665+
"properties": {
7666+
"envelope": {
7667+
"description": "The Envelope this config belongs to",
7668+
"type": "string",
7669+
"example": "https://example.com/api/v3/envelopes/61027ebb-ab75-4a49-9e23-a104ddd9ba6b"
7670+
},
7671+
"self": {
7672+
"description": "The Month Config itself",
7673+
"type": "string",
7674+
"example": "https://example.com/api/v3/envelopes/61027ebb-ab75-4a49-9e23-a104ddd9ba6b/2017-10"
7675+
}
7676+
}
7677+
},
7678+
"month": {
7679+
"description": "The month. This is always set to 00:00 UTC on the first of the month.",
7680+
"type": "string",
7681+
"example": "1969-06-01T00:00:00.000000Z"
7682+
},
7683+
"note": {
7684+
"description": "A note for the month config",
7685+
"type": "string",
7686+
"example": "Added 200€ here because we replaced Tim's expensive vase"
7687+
},
7688+
"overspendMode": {
7689+
"description": "Ignore this. It is here to override the OverspendMode from models.MonthConfigCreate and will be removed with 4.0.0",
7690+
"type": "string"
7691+
},
7692+
"updatedAt": {
7693+
"description": "Last time the resource was updated",
7694+
"type": "string",
7695+
"example": "2022-04-17T20:14:01.048145Z"
7696+
}
7697+
}
7698+
},
74667699
"controllers.MonthResponse": {
74677700
"type": "object",
74687701
"properties": {
@@ -8540,7 +8773,7 @@ const docTemplate = `{
85408773
"example": "Added 200€ here because we replaced Tim's expensive vase"
85418774
},
85428775
"overspendMode": {
8543-
"description": "The overspend handling mode to use",
8776+
"description": "The overspend handling mode to use. Deprecated, will be removed with 4.0.0 release and is not used in API v3 anymore",
85448777
"default": "AFFECT_AVAILABLE",
85458778
"allOf": [
85468779
{

0 commit comments

Comments
 (0)