1 | package org.cardanofoundation.explorer.api.controller; | |
2 | ||
3 | import lombok.RequiredArgsConstructor; | |
4 | ||
5 | import org.springframework.http.ResponseEntity; | |
6 | import org.springframework.validation.annotation.Validated; | |
7 | import org.springframework.web.bind.annotation.*; | |
8 | ||
9 | import io.swagger.v3.oas.annotations.Operation; | |
10 | import io.swagger.v3.oas.annotations.Parameter; | |
11 | import io.swagger.v3.oas.annotations.tags.Tag; | |
12 | ||
13 | import org.cardanofoundation.explorer.api.config.LogMessage; | |
14 | import org.cardanofoundation.explorer.api.model.response.micar.AddressCarbonEmissionResponse; | |
15 | import org.cardanofoundation.explorer.api.service.MiCARService; | |
16 | ||
17 | @RestController | |
18 | @RequestMapping("/api/v1/MiCAR") | |
19 | @RequiredArgsConstructor | |
20 | @Validated | |
21 | @Tag(name = "MiCar", description = "The MiCAR APIs") | |
22 | public class MiCARController { | |
23 | private final MiCARService miCARService; | |
24 | ||
25 | @GetMapping("/carbon-emission/{address}") | |
26 | @LogMessage | |
27 | @Operation( | |
28 | summary = "Get the carbon emissions of the given addresses", | |
29 | description = "Get the carbon emissions of the given addresses", | |
30 | tags = {"MiCar"}) | |
31 | public ResponseEntity<AddressCarbonEmissionResponse> getAddressCarbonEmissions( | |
32 | @PathVariable | |
33 | @Parameter( | |
34 | description = | |
35 | " The address or stake address for which the carbon emissions are to be calculated.") | |
36 | String address) { | |
37 |
1
1. getAddressCarbonEmissions : replaced return value with null for org/cardanofoundation/explorer/api/controller/MiCARController::getAddressCarbonEmissions → KILLED |
return ResponseEntity.ok(miCARService.getCarbonEmissionsByAddressAndPool(address)); |
38 | } | |
39 | ||
40 | @GetMapping("/carbon-emission/overview") | |
41 | @LogMessage | |
42 | @Operation( | |
43 | summary = "Get the carbon emissions overview", | |
44 | description = "Get the carbon emissions overview", | |
45 | tags = {"MiCar"}) | |
46 | public ResponseEntity<Object> getOverviewCarbonEmissions() { | |
47 |
1
1. getOverviewCarbonEmissions : replaced return value with null for org/cardanofoundation/explorer/api/controller/MiCARController::getOverviewCarbonEmissions → NO_COVERAGE |
return ResponseEntity.ok(miCARService.getCarbonEmissionsOverview()); |
48 | } | |
49 | ||
50 | @GetMapping("/carbon-emission/historical") | |
51 | @LogMessage | |
52 | @Operation( | |
53 | summary = "Get the carbon emissions historical", | |
54 | description = "Get the carbon emissions historical", | |
55 | tags = {"MiCar"}) | |
56 | public ResponseEntity<Object> getHistoricalCarbonEmissions() { | |
57 |
1
1. getHistoricalCarbonEmissions : replaced return value with null for org/cardanofoundation/explorer/api/controller/MiCARController::getHistoricalCarbonEmissions → NO_COVERAGE |
return ResponseEntity.ok(miCARService.getCarbonEmissionsHistorical()); |
58 | } | |
59 | } | |
Mutations | ||
37 |
1.1 |
|
47 |
1.1 |
|
57 |
1.1 |