Skip to content

Instantly share code, notes, and snippets.

@abhishek-sisodiya
Last active July 30, 2019 10:30
Show Gist options
  • Save abhishek-sisodiya/6dc407f1456828e9c0b9b66fc3f581f7 to your computer and use it in GitHub Desktop.
Save abhishek-sisodiya/6dc407f1456828e9c0b9b66fc3f581f7 to your computer and use it in GitHub Desktop.
package com.org.project.theWeatherMan.controller;
/**
* This controller class handle request and response for Weather.
*
* @author abhishek.sisodiya
* @since 01/07/2019.
*/
@RestApiController("/getweather")
public class WeatherController extends APIController {
@Autowired
private WeatherService weatherService;
@ApiOperation(value = "Get Weather Detail By www.openweathermap.org")
@RequestMapping(value = "/openweathermap", method = RequestMethod.GET)
public ResponseEntity openweathermap(@RequestParam String lat,@RequestParam String longi, HttpServletRequest request,
HttpServletResponse response) throws Exception {
return new ResponseEntity(new CustomResponseEntity().getResponseObject(weatherService.openweathermap(lat, longi)),
HttpStatus.OK);
}
@ApiOperation(value = "Get Weather Detail By www.darksky.net")
@RequestMapping(value = "/darksky", method = RequestMethod.GET)
public ResponseEntity darksky(@RequestParam String lat,@RequestParam String longi, HttpServletRequest request,
HttpServletResponse response) throws Exception {
return new ResponseEntity(new CustomResponseEntity().getResponseObject(weatherService.darksky(lat, longi)),
HttpStatus.OK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment