Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement updated soundtrack playlist api #596

Merged
merged 2 commits into from Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 23 additions & 10 deletions rest-helix/src/main/java/com/github/twitch4j/helix/TwitchHelix.java
Expand Up @@ -927,31 +927,44 @@ HystrixCommand<SoundtrackCurrentTrackWrapper> getSoundtrackCurrentTrack(
);

/**
* Gets a Soundtrack playlist, which includes its list of tracks.
* Gets the tracks of a Soundtrack playlist.
*
* @param authToken App access token or User access token.
* @param id The ASIN of the Soundtrack playlist to get.
* @return SoundtrackPlaylistTracksWrapper
* @param authToken Required: App access token or User access token.
* @param id Required: The ID of the Soundtrack playlist to get.
* @param limit Optional: The maximum number of tracks to return for this playlist in the response. The minimum number of tracks is 1 and the maximum is 50. The default is 20.
* @param after Optional: The cursor used to get the next page of tracks for this playlist. The Pagination object in the response contains the cursor’s value.
* @return SoundtrackPlaylistTracksList
*/
@Unofficial // beta
@RequestLine("GET /soundtrack/playlist?id={id}")
@RequestLine("GET /soundtrack/playlist?id={id}&first={first}&after={after}")
@Headers("Authorization: Bearer {token}")
HystrixCommand<SoundtrackPlaylistTracksWrapper> getSoundtrackPlaylist(
HystrixCommand<SoundtrackPlaylistTracksList> getSoundtrackPlaylist(
@Param("token") String authToken,
@Param("id") String id
@Param("id") String id,
@Param("first") Integer limit,
@Param("after") String after
);

/**
* Gets a list of Soundtrack playlists.
* <p>
* The list contains information about the playlists, such as their titles and descriptions.
* To get a playlist’s tracks, call {@link #getSoundtrackPlaylist(String, String, Integer, String)} and specify the playlist’s ID.
*
* @param authToken App access token or User access token.
* @param authToken Required: App access token or User access token.
* @param id Optional: The ID of the Soundtrack playlist to get. Specify an ID only if you want to get a single playlist instead of all playlists.
* @param limit Optional: The maximum number of playlists to return in the response. The minimum number of playlists is 1 and the maximum is 50. The default is 20.
* @param after Optional: The cursor used to get the next page of playlists. The Pagination object in the response contains the cursor’s value.
* @return SoundtrackPlaylistMetadataList
*/
@Unofficial // beta
@RequestLine("GET /soundtrack/playlists")
@RequestLine("GET /soundtrack/playlists?id={id}&first={first}&after={after}")
@Headers("Authorization: Bearer {token}")
HystrixCommand<SoundtrackPlaylistMetadataList> getSoundtrackPlaylists(
@Param("token") String authToken
@Param("token") String authToken,
@Param("id") String id,
@Param("first") Integer limit,
@Param("after") String after
);

/**
Expand Down
@@ -1,6 +1,7 @@
package com.github.twitch4j.helix.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.twitch4j.common.annotation.Unofficial;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
Expand All @@ -17,4 +18,10 @@ public class SoundtrackPlaylistMetadataList {
@JsonProperty("data")
private List<SoundtrackPlaylistMetadata> playlists;

/**
* Cursor for forward pagination: tells the server where to start fetching the next set of results, in a multi-page response.
*/
@Unofficial
private HelixPagination pagination;

}

This file was deleted.

@@ -0,0 +1,25 @@
package com.github.twitch4j.helix.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;

import java.util.List;

@Data
@Setter(AccessLevel.PRIVATE)
public class SoundtrackPlaylistTracksList {

/**
* The list of tracks in the playlist.
*/
@JsonProperty("data")
private List<SoundtrackTrack> tracks;

/**
* Cursor for forward pagination; used to tell the server where to start fetching the next set of results, in a multi-page response.
*/
private HelixPagination pagination;

}

This file was deleted.

@@ -1,5 +1,6 @@
package com.github.twitch4j.helix.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Setter;
Expand Down Expand Up @@ -30,6 +31,12 @@ public class SoundtrackTrack {
*/
private String id;

/**
* The track’s ISRC (International Standard Recording Code).
*/
@JsonProperty("isrc")
private String code;

/**
* The track’s title.
*/
Expand Down