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: add fetch rewards via gql #610

Merged
merged 2 commits into from Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
@@ -0,0 +1,138 @@
query fetchChannelPointRewards($login: String!) {
PhilippHeuer marked this conversation as resolved.
Show resolved Hide resolved
channel(name: $login) {
id
communityPointsSettings {
name
image {
url
url2x
url4x
}
isEnabled
automaticRewards {
backgroundColor
cost
defaultBackgroundColor
defaultCost
defaultImage {
url
url2x
url4x
}
globallyUpdatedForIndicatorAt
id
image {
url
url2x
url4x
}
isEnabled
isHiddenForSubs
minimumCost
type
updatedForIndicatorAt
}
customRewards {
backgroundColor
cooldownExpiresAt
cost
defaultImage {
url
url2x
url4x
}
globalCooldownSetting {
isEnabled
globalCooldownSeconds
}
id
image {
url
url2x
url4x
}
isEnabled
isInStock
isPaused
isSubOnly
isUserInputRequired
maxPerStreamSetting {
isEnabled
maxPerStream
}
maxPerUserPerStreamSetting {
isEnabled
maxPerUserPerStream
}
prompt
redemptionsRedeemedCurrentStream
shouldRedemptionsSkipRequestQueue
title
updatedForIndicatorAt
}
goals {
amountNeeded
backgroundColor
defaultImage {
url
url2x
url4x
}
description
durationDays
endedAt
id
image {
url
url2x
url4x
}
isInStock
perStreamUserMaximumContribution
pointsContributed
smallContribution
startedAt
status
title
type
}
emoteVariants {
emote {
id
token
}
id
isUnlockable
modifications {
emote {
id
token
}
globallyUpdatedForIndicatorAt
id
modifier {
id
}
}
}
earning {
averagePointsPerHour
cheerPoints
claimPoints
followPoints
id
multipliers {
reasonCode
factor
}
passiveWatchPoints
raidPoints
subscriptionGiftPoints
watchStreakPoints {
points
streakLength
}
}
}
}
}
Expand Up @@ -187,6 +187,10 @@ public CommandUpdateClip updateClip(OAuth2Credential auth, String slug, String n
return new CommandUpdateClip(getApolloClient(auth), slug, newTitle);
}

public CommandFetchChannelPointRewards fetchChannelPointRewards(OAuth2Credential auth, String channelLogin) {
iProdigy marked this conversation as resolved.
Show resolved Hide resolved
return new CommandFetchChannelPointRewards(getApolloClient(auth), channelLogin);
}

public CommandCreateCommunityPointsGoal createCommunityPointsGoal(OAuth2Credential auth, CreateCommunityPointsCommunityGoalInput input) {
return new CommandCreateCommunityPointsGoal(getApolloClient(auth), input);
}
Expand Down
@@ -0,0 +1,32 @@
package com.github.twitch4j.graphql.command;

import com.apollographql.apollo.ApolloCall;
import com.apollographql.apollo.ApolloClient;
import com.github.twitch4j.graphql.internal.FetchChannelPointRewardsQuery;
import org.jetbrains.annotations.NotNull;

public class CommandFetchChannelPointRewards extends BaseCommand<FetchChannelPointRewardsQuery.Data> {

private final String channelLogin;

/**
* Constructor
*
* @param apolloClient Apollo Client
* @param channelLogin Channel login name
*/
public CommandFetchChannelPointRewards(@NotNull ApolloClient apolloClient, @NotNull String channelLogin) {
super(apolloClient);
this.channelLogin = channelLogin;
}

@Override
protected ApolloCall<FetchChannelPointRewardsQuery.Data> getGraphQLCall() {
return apolloClient.query(
FetchChannelPointRewardsQuery.builder()
.login(channelLogin)
.build()
);
}

}