| 
 | 1 | +package uk.gov.hmcts.darts.arm.client;  | 
 | 2 | + | 
 | 3 | +import org.springframework.cloud.openfeign.FeignClient;  | 
 | 4 | +import org.springframework.web.bind.annotation.GetMapping;  | 
 | 5 | +import org.springframework.web.bind.annotation.PathVariable;  | 
 | 6 | +import org.springframework.web.bind.annotation.PostMapping;  | 
 | 7 | +import org.springframework.web.bind.annotation.RequestBody;  | 
 | 8 | +import org.springframework.web.bind.annotation.RequestHeader;  | 
 | 9 | +import uk.gov.hmcts.darts.arm.client.model.UpdateMetadataRequest;  | 
 | 10 | +import uk.gov.hmcts.darts.arm.client.model.UpdateMetadataResponse;  | 
 | 11 | +import uk.gov.hmcts.darts.arm.client.model.rpo.ArmAsyncSearchResponse;  | 
 | 12 | +import uk.gov.hmcts.darts.arm.client.model.rpo.CreateExportBasedOnSearchResultsTableRequest;  | 
 | 13 | +import uk.gov.hmcts.darts.arm.client.model.rpo.CreateExportBasedOnSearchResultsTableResponse;  | 
 | 14 | +import uk.gov.hmcts.darts.arm.client.model.rpo.EmptyRpoRequest;  | 
 | 15 | +import uk.gov.hmcts.darts.arm.client.model.rpo.ExtendedProductionsByMatterResponse;  | 
 | 16 | +import uk.gov.hmcts.darts.arm.client.model.rpo.ExtendedSearchesByMatterResponse;  | 
 | 17 | +import uk.gov.hmcts.darts.arm.client.model.rpo.IndexesByMatterIdRequest;  | 
 | 18 | +import uk.gov.hmcts.darts.arm.client.model.rpo.IndexesByMatterIdResponse;  | 
 | 19 | +import uk.gov.hmcts.darts.arm.client.model.rpo.MasterIndexFieldByRecordClassSchemaRequest;  | 
 | 20 | +import uk.gov.hmcts.darts.arm.client.model.rpo.MasterIndexFieldByRecordClassSchemaResponse;  | 
 | 21 | +import uk.gov.hmcts.darts.arm.client.model.rpo.ProductionOutputFilesRequest;  | 
 | 22 | +import uk.gov.hmcts.darts.arm.client.model.rpo.ProductionOutputFilesResponse;  | 
 | 23 | +import uk.gov.hmcts.darts.arm.client.model.rpo.ProfileEntitlementResponse;  | 
 | 24 | +import uk.gov.hmcts.darts.arm.client.model.rpo.RecordManagementMatterResponse;  | 
 | 25 | +import uk.gov.hmcts.darts.arm.client.model.rpo.RemoveProductionRequest;  | 
 | 26 | +import uk.gov.hmcts.darts.arm.client.model.rpo.RemoveProductionResponse;  | 
 | 27 | +import uk.gov.hmcts.darts.arm.client.model.rpo.SaveBackgroundSearchRequest;  | 
 | 28 | +import uk.gov.hmcts.darts.arm.client.model.rpo.SaveBackgroundSearchResponse;  | 
 | 29 | +import uk.gov.hmcts.darts.arm.client.model.rpo.StorageAccountRequest;  | 
 | 30 | +import uk.gov.hmcts.darts.arm.client.model.rpo.StorageAccountResponse;  | 
 | 31 | + | 
 | 32 | +import static org.springframework.http.HttpHeaders.AUTHORIZATION;  | 
 | 33 | +import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE;  | 
 | 34 | +import static org.springframework.http.MediaType.APPLICATION_OCTET_STREAM_VALUE;  | 
 | 35 | + | 
 | 36 | +@FeignClient(  | 
 | 37 | +    name = "arm-api-base-client",  | 
 | 38 | +    url = "${darts.storage.arm-api.version5-2.api.api-base-url}"  | 
 | 39 | +)  | 
 | 40 | +public interface ArmApiBaseClient {  | 
 | 41 | + | 
 | 42 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.update-metadata-path}",  | 
 | 43 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 44 | +        produces = APPLICATION_JSON_VALUE  | 
 | 45 | +    )  | 
 | 46 | +    UpdateMetadataResponse updateMetadata(@RequestHeader(AUTHORIZATION) String bearerAuth,  | 
 | 47 | +                                          @RequestBody UpdateMetadataRequest updateMetadataRequest);  | 
 | 48 | + | 
 | 49 | +    @GetMapping("${darts.storage.arm-api.version5-2.api.download-data-path}")  | 
 | 50 | +    @SuppressWarnings({"PMD.UseObjectForClearerAPI"})  | 
 | 51 | +    feign.Response downloadArmData(@RequestHeader(AUTHORIZATION) String bearerAuth,  | 
 | 52 | +                                   @PathVariable("cabinet_id") String cabinetId,  | 
 | 53 | +                                   @PathVariable("record_id") String externalRecordId,  | 
 | 54 | +                                   @PathVariable("file_id") String externalFileId);  | 
 | 55 | + | 
 | 56 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-record-management-matter-path}",  | 
 | 57 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 58 | +        produces = APPLICATION_JSON_VALUE  | 
 | 59 | +    )  | 
 | 60 | +    RecordManagementMatterResponse getRecordManagementMatter(@RequestHeader(AUTHORIZATION) String bearerAuth,  | 
 | 61 | +                                                             @RequestBody EmptyRpoRequest emptyRpoRequest);  | 
 | 62 | + | 
 | 63 | + | 
 | 64 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-storage-accounts-path}",  | 
 | 65 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 66 | +        produces = APPLICATION_JSON_VALUE  | 
 | 67 | +    )  | 
 | 68 | +    StorageAccountResponse getStorageAccounts(@RequestHeader(AUTHORIZATION) String bearerToken,  | 
 | 69 | +                                              @RequestBody StorageAccountRequest storageAccountRequest);  | 
 | 70 | + | 
 | 71 | + | 
 | 72 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-master-index-field-by-record-class-schema-path}",  | 
 | 73 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 74 | +        produces = APPLICATION_JSON_VALUE  | 
 | 75 | +    )  | 
 | 76 | +    MasterIndexFieldByRecordClassSchemaResponse getMasterIndexFieldByRecordClassSchema(  | 
 | 77 | +        @RequestHeader(AUTHORIZATION) String bearerAuth, @RequestBody MasterIndexFieldByRecordClassSchemaRequest masterIndexFieldByRecordClassSchemaRequest);  | 
 | 78 | + | 
 | 79 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-profile-entitlements-path}",  | 
 | 80 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 81 | +        produces = APPLICATION_JSON_VALUE  | 
 | 82 | +    )  | 
 | 83 | +    ProfileEntitlementResponse getProfileEntitlementResponse(@RequestHeader(AUTHORIZATION) String bearerAuth,  | 
 | 84 | +                                                             @RequestBody EmptyRpoRequest emptyRpoRequest);  | 
 | 85 | + | 
 | 86 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.add-async-search-path}",  | 
 | 87 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 88 | +        produces = APPLICATION_JSON_VALUE  | 
 | 89 | +    )  | 
 | 90 | +    ArmAsyncSearchResponse addAsyncSearch(@RequestHeader(AUTHORIZATION) String bearerAuth, @RequestBody String body);  | 
 | 91 | + | 
 | 92 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-indexes-by-matter-id-path}",  | 
 | 93 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 94 | +        produces = APPLICATION_JSON_VALUE  | 
 | 95 | +    )  | 
 | 96 | +    IndexesByMatterIdResponse getIndexesByMatterId(@RequestHeader(AUTHORIZATION) String bearerToken,  | 
 | 97 | +                                                   @RequestBody IndexesByMatterIdRequest indexesByMatterIdRequest);  | 
 | 98 | + | 
 | 99 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.save-background-search-path}",  | 
 | 100 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 101 | +        produces = APPLICATION_JSON_VALUE  | 
 | 102 | +    )  | 
 | 103 | +    SaveBackgroundSearchResponse saveBackgroundSearch(@RequestHeader(AUTHORIZATION) String bearerToken,  | 
 | 104 | +                                                      @RequestBody SaveBackgroundSearchRequest saveBackgroundSearchRequest);  | 
 | 105 | + | 
 | 106 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-extended-searches-by-matter-path}",  | 
 | 107 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 108 | +        produces = APPLICATION_JSON_VALUE  | 
 | 109 | +    )  | 
 | 110 | +    ExtendedSearchesByMatterResponse getExtendedSearchesByMatter(@RequestHeader(AUTHORIZATION) String bearerToken,  | 
 | 111 | +                                                                 @RequestBody String body);  | 
 | 112 | + | 
 | 113 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-production-output-files-path}",  | 
 | 114 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 115 | +        produces = APPLICATION_JSON_VALUE  | 
 | 116 | +    )  | 
 | 117 | +    ProductionOutputFilesResponse getProductionOutputFiles(@RequestHeader(AUTHORIZATION) String bearerToken,  | 
 | 118 | +                                                           @RequestBody ProductionOutputFilesRequest productionOutputFilesRequest);  | 
 | 119 | + | 
 | 120 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.rpo-url.create-export-based-on-search-results-table-path}",  | 
 | 121 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 122 | +        produces = APPLICATION_JSON_VALUE  | 
 | 123 | +    )  | 
 | 124 | +    CreateExportBasedOnSearchResultsTableResponse createExportBasedOnSearchResultsTable(  | 
 | 125 | +        @RequestHeader(AUTHORIZATION) String bearerToken, @RequestBody CreateExportBasedOnSearchResultsTableRequest request);  | 
 | 126 | + | 
 | 127 | + | 
 | 128 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.rpo-url.remove-production-path}",  | 
 | 129 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 130 | +        produces = APPLICATION_JSON_VALUE  | 
 | 131 | +    )  | 
 | 132 | +    RemoveProductionResponse removeProduction(@RequestHeader(AUTHORIZATION) String bearerToken,  | 
 | 133 | +                                              @RequestBody RemoveProductionRequest removeProductionRequest);  | 
 | 134 | + | 
 | 135 | +    @PostMapping(value = "${darts.storage.arm-api.version5-2.api.get-extended-productions-by-matter}",  | 
 | 136 | +        consumes = APPLICATION_JSON_VALUE,  | 
 | 137 | +        produces = APPLICATION_JSON_VALUE  | 
 | 138 | +    )  | 
 | 139 | +    ExtendedProductionsByMatterResponse getExtendedProductionsByMatter(@RequestHeader(AUTHORIZATION) String bearerToken,  | 
 | 140 | +                                                                       @RequestBody String body);  | 
 | 141 | + | 
 | 142 | +    @GetMapping(value = "${darts.storage.arm-api.version5-2.api.download-production-path}",  | 
 | 143 | +        produces = APPLICATION_OCTET_STREAM_VALUE)  | 
 | 144 | +    feign.Response downloadProduction(@RequestHeader(AUTHORIZATION) String bearerAuth,  | 
 | 145 | +                                      @PathVariable("productionExportFileID") String productionExportFileId);  | 
 | 146 | + | 
 | 147 | + | 
 | 148 | +    /**  | 
 | 149 | +     * Download production that should only be used in lower environments for testing purposes.  | 
 | 150 | +     */  | 
 | 151 | +    @GetMapping(value = "${darts.storage.arm-api.version5-2.api.download-production-path}",  | 
 | 152 | +        produces = APPLICATION_OCTET_STREAM_VALUE)  | 
 | 153 | +    feign.Response downloadProduction(@RequestHeader(AUTHORIZATION) String bearerAuth,  | 
 | 154 | +                                      @RequestHeader("EOD_IDS") String eodIds,  | 
 | 155 | +                                      @PathVariable("productionExportFileID") String productionExportFileId);  | 
 | 156 | +}  | 
0 commit comments