|
| 1 | +package io.github.yvasyliev.deezer.service; |
| 2 | + |
| 3 | +import feign.Headers; |
| 4 | +import feign.Param; |
| 5 | +import feign.RequestLine; |
| 6 | +import io.github.yvasyliev.deezer.model.Track; |
| 7 | + |
| 8 | +import java.util.concurrent.CompletableFuture; |
| 9 | + |
| 10 | +@Headers("Accept: application/json") |
| 11 | +public interface TrackService { |
| 12 | + /** |
| 13 | + * Returns a track. |
| 14 | + * |
| 15 | + * @param trackId the track ID |
| 16 | + * @return a track |
| 17 | + */ |
| 18 | + @RequestLine("GET /track/{trackId}") |
| 19 | + CompletableFuture<Track> getTrack(@Param("trackId") long trackId); |
| 20 | + |
| 21 | + /** |
| 22 | + * Updates a user's track information. |
| 23 | + * |
| 24 | + * @param trackId the track ID |
| 25 | + * @param accessToken Deezer access token |
| 26 | + * @param title the new title of the track |
| 27 | + * @param artist the new artist of the track |
| 28 | + * @param album the new album of the track |
| 29 | + * @return {@code true} if the track was updated successfully |
| 30 | + */ |
| 31 | + @RequestLine("POST /track/{trackId}") |
| 32 | + @Headers("Content-Type: application/x-www-form-urlencoded") |
| 33 | + CompletableFuture<Boolean> updateTrack( |
| 34 | + @Param("trackId") long trackId, |
| 35 | + @Param("access_token") String accessToken, |
| 36 | + @Param("title") String title, |
| 37 | + @Param("artist") String artist, |
| 38 | + @Param("album") String album |
| 39 | + ); |
| 40 | +} |
0 commit comments