|
1 | 1 | package uk.gov.justice.digital.hmpps.personintegrationapi.common.client
|
2 | 2 |
|
| 3 | +import org.springframework.http.MediaType.APPLICATION_JSON_VALUE |
| 4 | +import org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE |
3 | 5 | import org.springframework.http.ResponseEntity
|
| 6 | +import org.springframework.web.bind.annotation.ModelAttribute |
4 | 7 | import org.springframework.web.bind.annotation.PathVariable
|
5 | 8 | import org.springframework.web.bind.annotation.RequestBody
|
| 9 | +import org.springframework.web.bind.annotation.RequestPart |
| 10 | +import org.springframework.web.multipart.MultipartFile |
6 | 11 | import org.springframework.web.service.annotation.GetExchange
|
7 | 12 | import org.springframework.web.service.annotation.HttpExchange
|
8 | 13 | import org.springframework.web.service.annotation.PostExchange
|
9 | 14 | import org.springframework.web.service.annotation.PutExchange
|
10 |
| -import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.dto.UpdateBirthCountry |
| 15 | +import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.request.DistinguishingMarkCreateRequest |
| 16 | +import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.request.DistinguishingMarkUpdateRequest |
11 | 17 | import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.request.MilitaryRecordRequest
|
| 18 | +import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.request.UpdateBirthCountry |
12 | 19 | import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.request.UpdateBirthPlace
|
13 | 20 | import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.request.UpdateNationality
|
14 | 21 | import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.request.UpdateReligion
|
15 | 22 | import uk.gov.justice.digital.hmpps.personintegrationapi.common.client.response.MilitaryRecordPrisonDto
|
| 23 | +import uk.gov.justice.digital.hmpps.personintegrationapi.corepersonrecord.dto.response.DistinguishingMarkDto |
16 | 24 |
|
17 |
| -@HttpExchange("/api/offenders") |
| 25 | +@HttpExchange("/api") |
18 | 26 | interface PrisonApiClient {
|
19 |
| - @PutExchange("/{offenderNo}/birth-place") |
| 27 | + @PutExchange("/offenders/{offenderNo}/birth-place") |
20 | 28 | fun updateBirthPlaceForWorkingName(
|
21 | 29 | @PathVariable offenderNo: String,
|
22 | 30 | @RequestBody updateBirthPlace: UpdateBirthPlace,
|
23 | 31 | ): ResponseEntity<Void>
|
24 | 32 |
|
25 |
| - @PutExchange("/{offenderNo}/birth-country") |
| 33 | + @PutExchange("/offenders/{offenderNo}/birth-country") |
26 | 34 | fun updateBirthCountryForWorkingName(
|
27 | 35 | @PathVariable offenderNo: String,
|
28 | 36 | @RequestBody updateBirthCountry: UpdateBirthCountry,
|
29 | 37 | ): ResponseEntity<Void>
|
30 | 38 |
|
31 |
| - @PutExchange("/{offenderNo}/nationality") |
| 39 | + @PutExchange("/offenders/{offenderNo}/nationality") |
32 | 40 | fun updateNationalityForWorkingName(
|
33 | 41 | @PathVariable offenderNo: String,
|
34 | 42 | @RequestBody updateNationality: UpdateNationality,
|
35 | 43 | ): ResponseEntity<Void>
|
36 | 44 |
|
37 |
| - @GetExchange("/{offenderNo}/military-records") |
| 45 | + @GetExchange("/offenders/{offenderNo}/military-records") |
38 | 46 | fun getMilitaryRecords(
|
39 | 47 | @PathVariable offenderNo: String,
|
40 | 48 | ): ResponseEntity<MilitaryRecordPrisonDto>
|
41 | 49 |
|
42 |
| - @PutExchange("/{offenderNo}/military-records/{militarySeq}") |
| 50 | + @PutExchange("/offenders/{offenderNo}/military-records/{militarySeq}") |
43 | 51 | fun updateMilitaryRecord(
|
44 | 52 | @PathVariable offenderNo: String,
|
45 | 53 | @PathVariable militarySeq: Int,
|
46 | 54 | @RequestBody militaryRecordRequest: MilitaryRecordRequest,
|
47 | 55 | ): ResponseEntity<Void>
|
48 | 56 |
|
49 |
| - @PostExchange("/{offenderNo}/military-records") |
| 57 | + @PostExchange("/offenders/{offenderNo}/military-records") |
50 | 58 | fun createMilitaryRecord(
|
51 | 59 | @PathVariable offenderNo: String,
|
52 | 60 | @RequestBody militaryRecordRequest: MilitaryRecordRequest,
|
53 | 61 | ): ResponseEntity<Void>
|
54 | 62 |
|
55 |
| - @PutExchange("/{offenderNo}/religion") |
| 63 | + @PutExchange("/offenders/{offenderNo}/religion") |
56 | 64 | fun updateReligionForWorkingName(
|
57 | 65 | @PathVariable offenderNo: String,
|
58 | 66 | @RequestBody updateNationality: UpdateReligion,
|
59 | 67 | ): ResponseEntity<Void>
|
| 68 | + |
| 69 | + @GetExchange("/person/{prisonerNumber}/distinguishing-marks") |
| 70 | + fun getDistinguishingMarks( |
| 71 | + @PathVariable prisonerNumber: String, |
| 72 | + ): ResponseEntity<List<DistinguishingMarkDto>> |
| 73 | + |
| 74 | + @GetExchange("/person/{prisonerNumber}/distinguishing-mark/{markId}") |
| 75 | + fun getDistinguishingMark( |
| 76 | + @PathVariable prisonerNumber: String, |
| 77 | + @PathVariable markId: Int, |
| 78 | + ): ResponseEntity<DistinguishingMarkDto> |
| 79 | + |
| 80 | + @PutExchange("/person/{prisonerNumber}/distinguishing-mark/{markId}") |
| 81 | + fun updateDistinguishingMark( |
| 82 | + @RequestBody request: DistinguishingMarkUpdateRequest, |
| 83 | + @PathVariable prisonerNumber: String, |
| 84 | + @PathVariable markId: Int, |
| 85 | + ): ResponseEntity<DistinguishingMarkDto> |
| 86 | + |
| 87 | + @PostExchange("/person/{prisonerNumber}/distinguishing-mark", accept = [APPLICATION_JSON_VALUE, MULTIPART_FORM_DATA_VALUE]) |
| 88 | + fun createDistinguishingMark( |
| 89 | + @RequestPart(name = "file") file: MultipartFile?, |
| 90 | + @ModelAttribute request: DistinguishingMarkCreateRequest, |
| 91 | + @PathVariable prisonerNumber: String, |
| 92 | + ): ResponseEntity<DistinguishingMarkDto> |
| 93 | + |
| 94 | + @GetExchange("/person/photo/{imageId}") |
| 95 | + fun getDistinguishingMarkImage( |
| 96 | + @PathVariable imageId: Int, |
| 97 | + ): ResponseEntity<ByteArray> |
| 98 | + |
| 99 | + @PostExchange("/person/{prisonerNumber}/distinguishing-mark/{markId}/photo") |
| 100 | + fun addDistinguishingMarkImage( |
| 101 | + @RequestPart(name = "file") file: MultipartFile, |
| 102 | + @PathVariable prisonerNumber: String, |
| 103 | + @PathVariable markId: Int, |
| 104 | + ): ResponseEntity<DistinguishingMarkDto> |
60 | 105 | }
|
0 commit comments