Package org.powertac.visualizer.web.rest
Class ChartResource
- java.lang.Object
-
- org.powertac.visualizer.web.rest.ChartResource
-
@RestController @RequestMapping("/api") public class ChartResource extends Object
REST controller for managing Chart.
-
-
Constructor Summary
Constructors Constructor Description ChartResource(ChartService chartService, UserRepository userRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.http.ResponseEntity<Chart>
createChart(@Valid Chart chart)
POST /charts : Create a new chart.org.springframework.http.ResponseEntity<Void>
deleteChart(Long id)
DELETE /charts/:id : delete the "id" chart.org.springframework.http.ResponseEntity<List<Chart>>
getAllCharts(org.springframework.data.domain.Pageable pageable)
GET /charts : get all the charts.org.springframework.http.ResponseEntity<Chart>
getChart(Long id)
GET /charts/:id : get the "id" chart.org.springframework.http.ResponseEntity<List<Chart>>
getMyGames()
Get all charts owned by logged in user, plus all shared charts.org.springframework.http.ResponseEntity<Chart>
updateChart(@Valid Chart chart)
PUT /charts : Updates an existing chart.
-
-
-
Constructor Detail
-
ChartResource
public ChartResource(ChartService chartService, UserRepository userRepository)
-
-
Method Detail
-
createChart
@PostMapping("/charts") @Timed public org.springframework.http.ResponseEntity<Chart> createChart(@Valid @RequestBody @Valid Chart chart) throws URISyntaxException
POST /charts : Create a new chart.- Parameters:
chart
- the chart to create- Returns:
- the ResponseEntity with status 201 (Created) and with body the new chart, or with status 400 (Bad Request) if the chart has already an ID
- Throws:
URISyntaxException
- if the Location URI syntax is incorrect
-
updateChart
@PutMapping("/charts") @Timed public org.springframework.http.ResponseEntity<Chart> updateChart(@Valid @RequestBody @Valid Chart chart) throws URISyntaxException
PUT /charts : Updates an existing chart.- Parameters:
chart
- the chart to update- Returns:
- the ResponseEntity with status 200 (OK) and with body the updated chart, or with status 400 (Bad Request) if the chart is not valid, or with status 500 (Internal Server Error) if the chart couldnt be updated
- Throws:
URISyntaxException
- if the Location URI syntax is incorrect
-
getAllCharts
@GetMapping("/charts") @Timed public org.springframework.http.ResponseEntity<List<Chart>> getAllCharts(org.springframework.data.domain.Pageable pageable) throws URISyntaxException
GET /charts : get all the charts.- Parameters:
pageable
- the pagination information- Returns:
- the ResponseEntity with status 200 (OK) and the list of charts in body
- Throws:
URISyntaxException
- if there is an error to generate the pagination HTTP headers
-
getChart
@GetMapping("/charts/{id}") @Timed public org.springframework.http.ResponseEntity<Chart> getChart(@PathVariable Long id)
GET /charts/:id : get the "id" chart.- Parameters:
id
- the id of the chart to retrieve- Returns:
- the ResponseEntity with status 200 (OK) and with body the chart, or with status 404 (Not Found)
-
deleteChart
@DeleteMapping("/charts/{id}") @Timed public org.springframework.http.ResponseEntity<Void> deleteChart(@PathVariable Long id)
DELETE /charts/:id : delete the "id" chart.- Parameters:
id
- the id of the chart to delete- Returns:
- the ResponseEntity with status 200 (OK)
-
getMyGames
@GetMapping("/mycharts") @Timed public org.springframework.http.ResponseEntity<List<Chart>> getMyGames() throws URISyntaxException
Get all charts owned by logged in user, plus all shared charts.- Throws:
URISyntaxException
-
-