Skip to content

Commit

Permalink
feat: add unofficial kraken hosts endpoint (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed Mar 4, 2021
1 parent 6e43796 commit 15729fc
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,20 @@ HystrixCommand<KrakenCollectionMetadata> createCollection(
@Param("title") String title
);

/**
* Get Hosts of a Target Channel
* <p>
* This endpoint returns a "host" record for each channel hosting the channel with the provided targetId.
*
* @param channelId The user ID of the channel for which to get host information.
* @return KrakenHostList
*/
@Unofficial
@RequestLine("GET /channels/{channel_id}/hosts")
HystrixCommand<KrakenHostList> getHostsOf(
@Param("channel_id") String channelId
);

/**
* Update Collection
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.github.twitch4j.kraken.domain;

import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Data
@Setter(AccessLevel.PRIVATE)
@NoArgsConstructor
public class KrakenHost {

private String hostId;

private String targetId;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.github.twitch4j.kraken.domain;

import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

@Data
@Setter(AccessLevel.PRIVATE)
@NoArgsConstructor
public class KrakenHostList {

private List<KrakenHost> hosts;

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public interface TwitchMessagingInterface {
HystrixCommand<Chatters> getChatters(
@Param("channel") String channelName
);

/**
* Get Hosts
* <p>
Expand All @@ -42,7 +42,7 @@ HystrixCommand<Chatters> getChatters(
HystrixCommand<HostList> getHosts(
@Param("id") List<String> channelIds
);

/**
* Get Hosts of target channel
* <p>
Expand All @@ -54,7 +54,9 @@ HystrixCommand<HostList> getHosts(
*
* @param targetId The user ID of the channel for which to get host information.
* @return List of hosts of the target channel.
* @deprecated no longer functioning, so TwitchKraken#getHostsOf should be used
*/
@Deprecated
@RequestLine("GET /hosts?include_logins=1&target={id}")
HystrixCommand<HostList> getHostsOf(
@Param("id") String targetId
Expand Down

0 comments on commit 15729fc

Please sign in to comment.