Skip to content

Commit 0d70132

Browse files
feat: Add spec for api to list archived cards in the statement upload (#801)
* feat: Add spec for api to list archived cards in the statement upload * Auto generate API docs
1 parent a4160cb commit 0d70132

4 files changed

Lines changed: 216 additions & 0 deletions

File tree

reference/admin.yaml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11606,6 +11606,61 @@ paths:
1160611606
application/json:
1160711607
schema:
1160811608
$ref: '#/components/schemas/404'
11609+
/admin/statements/archived_cards:
11610+
post:
11611+
tags:
11612+
- Statements
11613+
summary: Archived cards present in Sage Exp Mgmt
11614+
description: |
11615+
Returns archived cards present in Sage Exp Mgmt for cards in Statement
11616+
operationId: archived_cards
11617+
requestBody:
11618+
required: true
11619+
content:
11620+
application/json:
11621+
schema:
11622+
type: object
11623+
properties:
11624+
data:
11625+
$ref: '#/components/schemas/statement_archived_cards_in'
11626+
required:
11627+
- data
11628+
responses:
11629+
'200':
11630+
description: OK
11631+
content:
11632+
application/json:
11633+
schema:
11634+
type: object
11635+
properties:
11636+
data:
11637+
type: array
11638+
items:
11639+
$ref: '#/components/schemas/statement_archived_cards_out'
11640+
'400':
11641+
description: Bad request
11642+
content:
11643+
application/json:
11644+
schema:
11645+
$ref: '#/components/schemas/400'
11646+
'401':
11647+
description: Unauthorized request
11648+
content:
11649+
application/json:
11650+
schema:
11651+
$ref: '#/components/schemas/401'
11652+
'403':
11653+
description: Forbidden
11654+
content:
11655+
application/json:
11656+
schema:
11657+
$ref: '#/components/schemas/403'
11658+
'404':
11659+
description: Not Found
11660+
content:
11661+
application/json:
11662+
schema:
11663+
$ref: '#/components/schemas/404'
1160911664
/admin/expense_rules:
1161011665
post:
1161111666
tags:
@@ -30998,6 +31053,57 @@ components:
3099831053
description: |
3099931054
RTF Confidence percentage indicates what % of the transactions in last uploaded statement are already existing in Sage Exp Mgmt via RTF.
3100031055
example: 99.22
31056+
statement_archived_cards_in:
31057+
allOf:
31058+
- $ref: '#/components/schemas/summary_from_statement_in'
31059+
- type: object
31060+
properties:
31061+
card_mapping:
31062+
$ref: '#/components/schemas/card_mapping_in'
31063+
required:
31064+
- card_mapping
31065+
statement_archived_cards_out:
31066+
properties:
31067+
number_of_cards:
31068+
type: integer
31069+
description: |
31070+
Number of cards in the statement
31071+
example: 3
31072+
number_of_archived_cards:
31073+
type: integer
31074+
description: |
31075+
Number of cards in the statement that are archived in Sage Exp Mgmt
31076+
example: 1
31077+
archived_cards:
31078+
type: array
31079+
items:
31080+
type: object
31081+
properties:
31082+
id:
31083+
allOf:
31084+
- $ref: '#/components/schemas/id_string'
31085+
example: bawownwrng
31086+
card_number:
31087+
$ref: '#/components/schemas/card_number'
31088+
nickname:
31089+
type: string
31090+
maxLength: 25
31091+
nullable: true
31092+
description: |
31093+
Unique nickname assigned to the card
31094+
example: Business Card
31095+
user:
31096+
$ref: '#/components/schemas/user_out_embed_nullable'
31097+
is_archived:
31098+
type: boolean
31099+
description: |
31100+
If the card is archived in Sage Exp Mgmt
31101+
nullable: false
31102+
archived_at:
31103+
$ref: '#/components/schemas/timestamptz_utc'
31104+
description: |
31105+
Timestamp when the card was archived in Sage Exp Mgmt
31106+
nullable: true
3100131107
expense_rule_if_out:
3100231108
type: object
3100331109
additionalProperties: false

src/admin/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,8 @@ paths:
524524
$ref: paths/admin@statements@create_card_transactions.yaml
525525
/admin/statements/rtf_stats:
526526
$ref: paths/admin@statements@rtf_stats.yaml
527+
/admin/statements/archived_cards:
528+
$ref: paths/admin@statements@archived_cards.yaml
527529
/admin/expense_rules:
528530
$ref: paths/admin@expense_rules.yaml
529531
/admin/expense_rules/dismiss_suggestion:
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
post:
2+
tags:
3+
- Statements
4+
summary: Archived cards present in Sage Exp Mgmt
5+
description: |
6+
Returns archived cards present in Sage Exp Mgmt for cards in Statement
7+
operationId: archived_cards
8+
requestBody:
9+
required: true
10+
content:
11+
application/json:
12+
schema:
13+
type: object
14+
properties:
15+
data:
16+
$ref: '../../components/schemas/statements.yaml#/statement_archived_cards_in'
17+
required:
18+
- data
19+
responses:
20+
'200':
21+
description: OK
22+
content:
23+
application/json:
24+
schema:
25+
type: object
26+
properties:
27+
data:
28+
type: array
29+
items:
30+
$ref: '../../components/schemas/statements.yaml#/statement_archived_cards_out'
31+
'400':
32+
description: Bad request
33+
content:
34+
application/json:
35+
schema:
36+
$ref: '../../components/schemas/400.yaml'
37+
'401':
38+
description: Unauthorized request
39+
content:
40+
application/json:
41+
schema:
42+
$ref: '../../components/schemas/401.yaml'
43+
'403':
44+
description: Forbidden
45+
content:
46+
application/json:
47+
schema:
48+
$ref: '../../components/schemas/403.yaml'
49+
'404':
50+
description: Not Found
51+
content:
52+
application/json:
53+
schema:
54+
$ref: '../../components/schemas/404.yaml'

src/components/schemas/statements.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,3 +1320,57 @@ unassigned_cards_from_statement_in:
13201320
example: stmtwownwrng
13211321
required:
13221322
- statement_id
1323+
1324+
statement_archived_cards_out:
1325+
properties:
1326+
number_of_cards:
1327+
type: integer
1328+
description: |
1329+
Number of cards in the statement
1330+
example: 3
1331+
number_of_archived_cards:
1332+
type: integer
1333+
description: |
1334+
Number of cards in the statement that are archived in Sage Exp Mgmt
1335+
example: 1
1336+
archived_cards:
1337+
type: array
1338+
items:
1339+
type: object
1340+
properties:
1341+
id:
1342+
allOf:
1343+
- $ref: './fields.yaml#/id_string'
1344+
example: bawownwrng
1345+
card_number:
1346+
$ref: './fields.yaml#/card_number'
1347+
nickname:
1348+
type: string
1349+
maxLength: 25
1350+
nullable: true
1351+
description: |
1352+
Unique nickname assigned to the card
1353+
example: 'Business Card'
1354+
user:
1355+
$ref: ./user.yaml#/user_out_embed_nullable
1356+
is_archived:
1357+
type: boolean
1358+
description: |
1359+
If the card is archived in Sage Exp Mgmt
1360+
nullable: false
1361+
archived_at:
1362+
$ref: './fields.yaml#/timestamptz_utc'
1363+
description: |
1364+
Timestamp when the card was archived in Sage Exp Mgmt
1365+
nullable: true
1366+
1367+
1368+
statement_archived_cards_in:
1369+
allOf:
1370+
- $ref: '#/summary_from_statement_in'
1371+
- type: object
1372+
properties:
1373+
card_mapping:
1374+
$ref: '#/card_mapping_in'
1375+
required:
1376+
- card_mapping

0 commit comments

Comments
 (0)