diff --git a/README.rst b/README.rst index 98fc00b..80c7d07 100644 --- a/README.rst +++ b/README.rst @@ -55,7 +55,7 @@ It has a fairly straightforward interface, essentially :: - 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 + 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 The first argument specifies the API to interface with diff --git a/src/endpoints.h b/src/endpoints.h index 59cef14..4054ba9 100644 --- a/src/endpoints.h +++ b/src/endpoints.h @@ -25,6 +25,7 @@ extern const struct _endpoint iipi_endpoint; extern const struct _endpoint ilos_endpoint; extern const struct _endpoint ioi_endpoint; extern const struct _endpoint ipi_endpoint; +extern const struct _endpoint ir_endpoint; extern const struct _endpoint isb_endpoint; extern const struct _endpoint isi_endpoint; extern const struct _endpoint ob_endpoint; diff --git a/src/mtd-cli-ir.c b/src/mtd-cli-ir.c new file mode 100644 index 0000000..34b1ce1 --- /dev/null +++ b/src/mtd-cli-ir.c @@ -0,0 +1,129 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +/* + * mtd-cli-ir.c - Make Tax Digital - Individuals Reliefs + * + * Copyright (C) 2025 Andrew Clayton + */ + +#include + +#include + +#include "mtd-cli.h" + +#define API ir + +#define API_NAME "Individuals Reliefs" +#define CMDS \ +"Relief Investments\n\n"\ +"ri-get ri-amend ri-delete\n\n"\ +"Other Reliefs\n\n"\ +"or-get or-amend or-delete\n\n"\ +"Foreign Reliefs\n\n"\ +"fr-get fr-amend fr-delete\n\n"\ +"Pensions Reliefs\n\n"\ +"pr-get pr-amend pr-delete\n\n"\ +"Charitable Givings\n\n"\ +"cg-get cg-amend cg-delete\n\n"\ + +static const struct endpoint endpoints[] = { + /* Relief Investments */ + { + .name = "ri-get", + .api_ep = MTD_API_EP_IR_RI_GET, + .nr_req_args = 1, + .args = "taxYear" + }, { + .name = "ri-amend", + .api_ep = MTD_API_EP_IR_RI_AMEND, + .nr_req_args = 2, + .file_data = true, + .args = " taxYear" + }, { + .name = "ri-delete", + .api_ep = MTD_API_EP_IR_RI_DELETE, + .nr_req_args = 1, + .args = "taxYear" + }, + /* Other Reliefs */ + { + .name = "or-get", + .api_ep = MTD_API_EP_IR_OR_GET, + .nr_req_args = 1, + .args = "taxYear" + }, { + .name = "or-amend", + .api_ep = MTD_API_EP_IR_OR_AMEND, + .nr_req_args = 2, + .file_data = true, + .args = " taxYear" + }, { + .name = "or-delete", + .api_ep = MTD_API_EP_IR_OR_DELETE, + .nr_req_args = 1, + .args = "taxYear" + }, + /* Foreign Reliefs */ + { + .name = "fr-get", + .api_ep = MTD_API_EP_IR_FR_GET, + .nr_req_args = 1, + .args = "taxYear" + }, { + .name = "fr-amend", + .api_ep = MTD_API_EP_IR_FR_AMEND, + .nr_req_args = 2, + .file_data = true, + .args = " taxYear" + }, { + .name = "fr-delete", + .api_ep = MTD_API_EP_IR_FR_DELETE, + .nr_req_args = 1, + .args = "taxYear" + }, + /* Pensions Reliefs */ + { + .name = "pr-get", + .api_ep = MTD_API_EP_IR_PR_GET, + .nr_req_args = 1, + .args = "taxYear" + }, { + .name = "pr-amend", + .api_ep = MTD_API_EP_IR_PR_AMEND, + .nr_req_args = 2, + .file_data = true, + .args = " taxYear" + }, { + .name = "pr-delete", + .api_ep = MTD_API_EP_IR_PR_DELETE, + .nr_req_args = 1, + .args = "taxYear" + }, + /* Charitable Givings */ + { + .name = "cg-get", + .api_ep = MTD_API_EP_IR_CG_GET, + .nr_req_args = 1, + .args = "taxYear" + }, { + .name = "cg-amend", + .api_ep = MTD_API_EP_IR_CG_AMEND, + .nr_req_args = 2, + .file_data = true, + .args = " taxYear" + }, { + .name = "cg-delete", + .api_ep = MTD_API_EP_IR_CG_DELETE, + .nr_req_args = 1, + .args = "taxYear" + }, + + { } +}; + +const struct _endpoint ENDPOINT = { + .endpoints = endpoints, + .api_name = API_NAME, + .cmds = CMDS +}; diff --git a/src/mtd-cli.c b/src/mtd-cli.c index 278ce7e..92ee0a9 100644 --- a/src/mtd-cli.c +++ b/src/mtd-cli.c @@ -51,6 +51,7 @@ static const struct api_ep { EP_MAP_ENT(ilos), EP_MAP_ENT(ioi), EP_MAP_ENT(ipi), + EP_MAP_ENT(ir), EP_MAP_ENT(isb), EP_MAP_ENT(isi), EP_MAP_ENT(ob),