Skip to content

Commit 375dc49

Browse files
authored
feat: add import endpoints for API v3 (#854)
1 parent de90ca1 commit 375dc49

File tree

14 files changed

+1877
-564
lines changed

14 files changed

+1877
-564
lines changed

api/docs.go

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,6 +2014,7 @@ const docTemplate = `{
20142014
"Import"
20152015
],
20162016
"summary": "Transaction Import Preview",
2017+
"deprecated": true,
20172018
"parameters": [
20182019
{
20192020
"type": "file",
@@ -2062,6 +2063,7 @@ const docTemplate = `{
20622063
"Import"
20632064
],
20642065
"summary": "Allowed HTTP verbs",
2066+
"deprecated": true,
20652067
"responses": {
20662068
"204": {
20672069
"description": "No Content"
@@ -2082,6 +2084,7 @@ const docTemplate = `{
20822084
"Import"
20832085
],
20842086
"summary": "Import YNAB 4 budget",
2087+
"deprecated": true,
20852088
"parameters": [
20862089
{
20872090
"type": "file",
@@ -2124,6 +2127,7 @@ const docTemplate = `{
21242127
"Import"
21252128
],
21262129
"summary": "Allowed HTTP verbs",
2130+
"deprecated": true,
21272131
"responses": {
21282132
"204": {
21292133
"description": "No Content"
@@ -3844,6 +3848,165 @@ const docTemplate = `{
38443848
}
38453849
}
38463850
},
3851+
"/v3/import": {
3852+
"get": {
3853+
"description": "Returns general information about the v3 API",
3854+
"tags": [
3855+
"Import"
3856+
],
3857+
"summary": "Import API overview",
3858+
"responses": {
3859+
"200": {
3860+
"description": "OK",
3861+
"schema": {
3862+
"$ref": "#/definitions/controllers.ImportV3Response"
3863+
}
3864+
}
3865+
}
3866+
},
3867+
"options": {
3868+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs.",
3869+
"tags": [
3870+
"Import"
3871+
],
3872+
"summary": "Allowed HTTP verbs",
3873+
"responses": {
3874+
"204": {
3875+
"description": "No Content"
3876+
}
3877+
}
3878+
}
3879+
},
3880+
"/v3/import/ynab-import-preview": {
3881+
"post": {
3882+
"description": "Returns a preview of transactions to be imported after parsing a YNAB Import format csv file",
3883+
"consumes": [
3884+
"multipart/form-data"
3885+
],
3886+
"produces": [
3887+
"application/json"
3888+
],
3889+
"tags": [
3890+
"Import"
3891+
],
3892+
"summary": "Transaction Import Preview",
3893+
"parameters": [
3894+
{
3895+
"type": "file",
3896+
"description": "File to import",
3897+
"name": "file",
3898+
"in": "formData",
3899+
"required": true
3900+
},
3901+
{
3902+
"type": "string",
3903+
"description": "ID of the account to import transactions for",
3904+
"name": "accountId",
3905+
"in": "query"
3906+
}
3907+
],
3908+
"responses": {
3909+
"200": {
3910+
"description": "OK",
3911+
"schema": {
3912+
"$ref": "#/definitions/controllers.ImportPreviewListV3"
3913+
}
3914+
},
3915+
"400": {
3916+
"description": "Bad Request",
3917+
"schema": {
3918+
"$ref": "#/definitions/controllers.ImportPreviewListV3"
3919+
}
3920+
},
3921+
"404": {
3922+
"description": "Not Found",
3923+
"schema": {
3924+
"$ref": "#/definitions/controllers.ImportPreviewListV3"
3925+
}
3926+
},
3927+
"500": {
3928+
"description": "Internal Server Error",
3929+
"schema": {
3930+
"$ref": "#/definitions/controllers.ImportPreviewListV3"
3931+
}
3932+
}
3933+
}
3934+
},
3935+
"options": {
3936+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
3937+
"tags": [
3938+
"Import"
3939+
],
3940+
"summary": "Allowed HTTP verbs",
3941+
"responses": {
3942+
"204": {
3943+
"description": "No Content"
3944+
}
3945+
}
3946+
}
3947+
},
3948+
"/v3/import/ynab4": {
3949+
"post": {
3950+
"description": "Imports budgets from YNAB 4",
3951+
"consumes": [
3952+
"multipart/form-data"
3953+
],
3954+
"produces": [
3955+
"application/json"
3956+
],
3957+
"tags": [
3958+
"Import"
3959+
],
3960+
"summary": "Import YNAB 4 budget",
3961+
"parameters": [
3962+
{
3963+
"type": "file",
3964+
"description": "File to import",
3965+
"name": "file",
3966+
"in": "formData",
3967+
"required": true
3968+
},
3969+
{
3970+
"type": "string",
3971+
"description": "Name of the Budget to create",
3972+
"name": "budgetName",
3973+
"in": "query"
3974+
}
3975+
],
3976+
"responses": {
3977+
"201": {
3978+
"description": "Created",
3979+
"schema": {
3980+
"$ref": "#/definitions/controllers.BudgetResponseV3"
3981+
}
3982+
},
3983+
"400": {
3984+
"description": "Bad Request",
3985+
"schema": {
3986+
"$ref": "#/definitions/controllers.BudgetResponseV3"
3987+
}
3988+
},
3989+
"500": {
3990+
"description": "Internal Server Error",
3991+
"schema": {
3992+
"$ref": "#/definitions/controllers.BudgetResponseV3"
3993+
}
3994+
}
3995+
}
3996+
},
3997+
"options": {
3998+
"description": "Returns an empty response with the HTTP Header \"allow\" set to the allowed HTTP verbs",
3999+
"tags": [
4000+
"Import"
4001+
],
4002+
"summary": "Allowed HTTP verbs",
4003+
"responses": {
4004+
"204": {
4005+
"description": "No Content"
4006+
}
4007+
}
4008+
}
4009+
},
38474010
"/v3/match-rules": {
38484011
"get": {
38494012
"description": "Returns a list of matchRules",
@@ -4919,6 +5082,24 @@ const docTemplate = `{
49195082
}
49205083
}
49215084
},
5085+
"controllers.BudgetResponseV3": {
5086+
"type": "object",
5087+
"properties": {
5088+
"data": {
5089+
"description": "Data for the budget",
5090+
"allOf": [
5091+
{
5092+
"$ref": "#/definitions/controllers.Budget"
5093+
}
5094+
]
5095+
},
5096+
"error": {
5097+
"description": "The error, if any occurred",
5098+
"type": "string",
5099+
"example": "the specified resource ID is not a valid UUID"
5100+
}
5101+
}
5102+
},
49225103
"controllers.Category": {
49235104
"type": "object",
49245105
"properties": {
@@ -5134,6 +5315,51 @@ const docTemplate = `{
51345315
}
51355316
}
51365317
},
5318+
"controllers.ImportPreviewListV3": {
5319+
"type": "object",
5320+
"properties": {
5321+
"data": {
5322+
"description": "List of transaction previews",
5323+
"type": "array",
5324+
"items": {
5325+
"$ref": "#/definitions/importer.TransactionPreview"
5326+
}
5327+
},
5328+
"error": {
5329+
"description": "The error, if any occurred for this Match Rule",
5330+
"type": "string",
5331+
"example": "the specified resource ID is not a valid UUID"
5332+
}
5333+
}
5334+
},
5335+
"controllers.ImportV3Links": {
5336+
"type": "object",
5337+
"properties": {
5338+
"matchRules": {
5339+
"description": "URL of YNAB Import preview endpoint",
5340+
"type": "string",
5341+
"example": "https://example.com/api/v3/import/ynab-import-preview"
5342+
},
5343+
"transactions": {
5344+
"description": "URL of YNAB4 import endpoint",
5345+
"type": "string",
5346+
"example": "https://example.com/api/v3/import/ynab4"
5347+
}
5348+
}
5349+
},
5350+
"controllers.ImportV3Response": {
5351+
"type": "object",
5352+
"properties": {
5353+
"links": {
5354+
"description": "Links for the v3 API",
5355+
"allOf": [
5356+
{
5357+
"$ref": "#/definitions/controllers.ImportV3Links"
5358+
}
5359+
]
5360+
}
5361+
}
5362+
},
51375363
"controllers.MatchRule": {
51385364
"type": "object",
51395365
"properties": {
@@ -6671,6 +6897,11 @@ const docTemplate = `{
66716897
"router.V3Links": {
66726898
"type": "object",
66736899
"properties": {
6900+
"import": {
6901+
"description": "URL of import list endpoint",
6902+
"type": "string",
6903+
"example": "https://example.com/api/v3/import"
6904+
},
66746905
"matchRules": {
66756906
"description": "URL of Match Rule collection endpoint",
66766907
"type": "string",

0 commit comments

Comments
 (0)