Skip to content

Commit 1ee8a00

Browse files
committed
Implement livestreams stats endpoint
1 parent 71770c4 commit 1ee8a00

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

src/main/java/pl/teksusik/kick4j/KickConfiguration.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public final class KickConfiguration {
2121
private final String chat;
2222
private final String moderation;
2323
private final String livestreams;
24+
private final String livestreamsStats;
2425
private final String publicKey;
2526
private final String events;
2627

@@ -41,6 +42,7 @@ private KickConfiguration(Builder builder) {
4142
this.chat = builder.chat;
4243
this.moderation = builder.moderation;
4344
this.livestreams = builder.livestreams;
45+
this.livestreamsStats = builder.livestreamsStats;
4446
this.publicKey = builder.publicKey;
4547
this.events = builder.events;
4648
}
@@ -113,6 +115,10 @@ public String getLivestreams() {
113115
return livestreams;
114116
}
115117

118+
public String getLivestreamsStats() {
119+
return livestreamsStats;
120+
}
121+
116122
public String getPublicKey() {
117123
return publicKey;
118124
}
@@ -138,6 +144,7 @@ public static final class Builder {
138144
private String chat = "/chat";
139145
private String moderation = "/moderation/bans";
140146
private String livestreams = "/livestreams";
147+
private String livestreamsStats = "/livestreams/stats";
141148
private String publicKey = "/public-key";
142149
private String events = "/events/subscriptions";
143150

@@ -221,6 +228,11 @@ public Builder livestreams(String livestreams) {
221228
return this;
222229
}
223230

231+
public Builder livestreamsStats(String livestreamsStats) {
232+
this.livestreamsStats = livestreamsStats;
233+
return this;
234+
}
235+
224236
public Builder publicKey(String publicKey) {
225237
this.publicKey = publicKey;
226238
return this;

src/main/java/pl/teksusik/kick4j/livestreams/LivestreamsClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,9 @@ public List<Livestream> getLivestreams(GetLivestreamsRequest request) {
2727
.queryParams(request)
2828
.send(new TypeReference<>() {});
2929
}
30+
31+
public LivestreamsStats getLivestreamsStats() {
32+
return this.get(this.configuration.getLivestreamsStats())
33+
.send(new TypeReference<>() {});
34+
}
3035
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package pl.teksusik.kick4j.livestreams;
2+
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonProperty;
5+
6+
public class LivestreamsStats {
7+
private final Integer totalCount;
8+
9+
@JsonCreator
10+
public LivestreamsStats(@JsonProperty("total_count") Integer totalCount) {
11+
this.totalCount = totalCount;
12+
}
13+
14+
public Integer getTotalCount() {
15+
return totalCount;
16+
}
17+
}

0 commit comments

Comments
 (0)