Skip to content

Commit

Permalink
feat: add gql fetch reward settings (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy committed Jul 22, 2022
1 parent 54bab93 commit 0eb095f
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 0 deletions.
@@ -0,0 +1,138 @@
query fetchCommunityPointsSettings($login: String!) {
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 CommandFetchCommunityPointsSettings fetchChannelPointRewards(OAuth2Credential auth, String channelLogin) {
return new CommandFetchCommunityPointsSettings(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.FetchCommunityPointsSettingsQuery;
import org.jetbrains.annotations.NotNull;

public class CommandFetchCommunityPointsSettings extends BaseCommand<FetchCommunityPointsSettingsQuery.Data> {

private final String channelLogin;

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

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

}

0 comments on commit 0eb095f

Please sign in to comment.