Skip to content

Commit b6146f1

Browse files
committed
Add support for the Individuals Reliefs API
Link: <https://developer.service.hmrc.gov.uk/api-documentation/docs/api/service/individuals-reliefs-api/2.0/oas/page> Signed-off-by: Andrew Clayton <ac@sigsegv.uk>
1 parent 89c5624 commit b6146f1

4 files changed

Lines changed: 132 additions & 1 deletion

File tree

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ It has a fairly straightforward interface, essentially
5555

5656
::
5757

58-
mtd-cli init|init-creds|init-oauth|init-nino|bd|biss|bsas|cisd|ic|ical|icgi|id|idi|ie|iei|ifi|iipi|ilos|ioi|ipi|isb|isi|ob|od|pb|saa|saass|said|seb|vat|test_cu|test_fph|test_sa
58+
mtd-cli init|init-creds|init-oauth|init-nino|bd|biss|bsas|cisd|ic|ical|icgi|id|idi|ie|iei|ifi|iipi|ilos|ioi|ipi|ir|isb|isi|ob|od|pb|saa|saass|said|seb|vat|test_cu|test_fph|test_sa
5959

6060
The first argument specifies the API to interface with
6161

src/endpoints.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern const struct _endpoint iipi_endpoint;
2525
extern const struct _endpoint ilos_endpoint;
2626
extern const struct _endpoint ioi_endpoint;
2727
extern const struct _endpoint ipi_endpoint;
28+
extern const struct _endpoint ir_endpoint;
2829
extern const struct _endpoint isb_endpoint;
2930
extern const struct _endpoint isi_endpoint;
3031
extern const struct _endpoint ob_endpoint;

src/mtd-cli-ir.c

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
/*
4+
* mtd-cli-ir.c - Make Tax Digital - Individuals Reliefs
5+
*
6+
* Copyright (C) 2025 Andrew Clayton <ac@sigsegv.uk>
7+
*/
8+
9+
#include <stdbool.h>
10+
11+
#include <libmtdac/mtd.h>
12+
13+
#include "mtd-cli.h"
14+
15+
#define API ir
16+
17+
#define API_NAME "Individuals Reliefs"
18+
#define CMDS \
19+
"Relief Investments\n\n"\
20+
"ri-get ri-amend ri-delete\n\n"\
21+
"Other Reliefs\n\n"\
22+
"or-get or-amend or-delete\n\n"\
23+
"Foreign Reliefs\n\n"\
24+
"fr-get fr-amend fr-delete\n\n"\
25+
"Pensions Reliefs\n\n"\
26+
"pr-get pr-amend pr-delete\n\n"\
27+
"Charitable Givings\n\n"\
28+
"cg-get cg-amend cg-delete\n\n"\
29+
30+
static const struct endpoint endpoints[] = {
31+
/* Relief Investments */
32+
{
33+
.name = "ri-get",
34+
.api_ep = MTD_API_EP_IR_RI_GET,
35+
.nr_req_args = 1,
36+
.args = "taxYear"
37+
}, {
38+
.name = "ri-amend",
39+
.api_ep = MTD_API_EP_IR_RI_AMEND,
40+
.nr_req_args = 2,
41+
.file_data = true,
42+
.args = "<file> taxYear"
43+
}, {
44+
.name = "ri-delete",
45+
.api_ep = MTD_API_EP_IR_RI_DELETE,
46+
.nr_req_args = 1,
47+
.args = "taxYear"
48+
},
49+
/* Other Reliefs */
50+
{
51+
.name = "or-get",
52+
.api_ep = MTD_API_EP_IR_OR_GET,
53+
.nr_req_args = 1,
54+
.args = "taxYear"
55+
}, {
56+
.name = "or-amend",
57+
.api_ep = MTD_API_EP_IR_OR_AMEND,
58+
.nr_req_args = 2,
59+
.file_data = true,
60+
.args = "<file> taxYear"
61+
}, {
62+
.name = "or-delete",
63+
.api_ep = MTD_API_EP_IR_OR_DELETE,
64+
.nr_req_args = 1,
65+
.args = "taxYear"
66+
},
67+
/* Foreign Reliefs */
68+
{
69+
.name = "fr-get",
70+
.api_ep = MTD_API_EP_IR_FR_GET,
71+
.nr_req_args = 1,
72+
.args = "taxYear"
73+
}, {
74+
.name = "fr-amend",
75+
.api_ep = MTD_API_EP_IR_FR_AMEND,
76+
.nr_req_args = 2,
77+
.file_data = true,
78+
.args = "<file> taxYear"
79+
}, {
80+
.name = "fr-delete",
81+
.api_ep = MTD_API_EP_IR_FR_DELETE,
82+
.nr_req_args = 1,
83+
.args = "taxYear"
84+
},
85+
/* Pensions Reliefs */
86+
{
87+
.name = "pr-get",
88+
.api_ep = MTD_API_EP_IR_PR_GET,
89+
.nr_req_args = 1,
90+
.args = "taxYear"
91+
}, {
92+
.name = "pr-amend",
93+
.api_ep = MTD_API_EP_IR_PR_AMEND,
94+
.nr_req_args = 2,
95+
.file_data = true,
96+
.args = "<file> taxYear"
97+
}, {
98+
.name = "pr-delete",
99+
.api_ep = MTD_API_EP_IR_PR_DELETE,
100+
.nr_req_args = 1,
101+
.args = "taxYear"
102+
},
103+
/* Charitable Givings */
104+
{
105+
.name = "cg-get",
106+
.api_ep = MTD_API_EP_IR_CG_GET,
107+
.nr_req_args = 1,
108+
.args = "taxYear"
109+
}, {
110+
.name = "cg-amend",
111+
.api_ep = MTD_API_EP_IR_CG_AMEND,
112+
.nr_req_args = 2,
113+
.file_data = true,
114+
.args = "<file> taxYear"
115+
}, {
116+
.name = "cg-delete",
117+
.api_ep = MTD_API_EP_IR_CG_DELETE,
118+
.nr_req_args = 1,
119+
.args = "taxYear"
120+
},
121+
122+
{ }
123+
};
124+
125+
const struct _endpoint ENDPOINT = {
126+
.endpoints = endpoints,
127+
.api_name = API_NAME,
128+
.cmds = CMDS
129+
};

src/mtd-cli.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ static const struct api_ep {
5151
EP_MAP_ENT(ilos),
5252
EP_MAP_ENT(ioi),
5353
EP_MAP_ENT(ipi),
54+
EP_MAP_ENT(ir),
5455
EP_MAP_ENT(isb),
5556
EP_MAP_ENT(isi),
5657
EP_MAP_ENT(ob),

0 commit comments

Comments
 (0)