Liam
d2d898a5b8
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 36s
34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
package cc.fascinated.bat.controller;
|
|
|
|
import cc.fascinated.bat.service.SpotifyService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* @author Fascinated (fascinated7)
|
|
*/
|
|
@RestController
|
|
@RequestMapping(value = "/spotify")
|
|
public class SpotifyController {
|
|
private final SpotifyService spotifyService;
|
|
|
|
@Autowired
|
|
public SpotifyController(SpotifyService spotifyService) {
|
|
this.spotifyService = spotifyService;
|
|
}
|
|
|
|
/**
|
|
* A GET request to authorize the user with Spotify.
|
|
*
|
|
* @return the response entity
|
|
*/
|
|
@GetMapping(value = "/callback")
|
|
public ResponseEntity<String> authorizationCallback(@RequestParam(required = false) String code) {
|
|
return ResponseEntity.ok(spotifyService.authorize(code));
|
|
}
|
|
}
|