All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.twitch4j.graphql.command.CommandUpdateCustomRedemptionStatuses Maven / Gradle / Ivy

The newest version!
package com.github.twitch4j.graphql.command;

import com.apollographql.apollo.ApolloCall;
import com.apollographql.apollo.ApolloClient;
import com.github.twitch4j.graphql.internal.UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsMutation;
import com.github.twitch4j.graphql.internal.type.CommunityPointsCustomRewardRedemptionStatus;
import com.github.twitch4j.graphql.internal.type.UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsInput;
import lombok.NonNull;

import java.util.List;

public class CommandUpdateCustomRedemptionStatuses extends BaseCommand {
    private final String channelId;
    private final List redemptionIds;
    private final CommunityPointsCustomRewardRedemptionStatus oldStatus;
    private final CommunityPointsCustomRewardRedemptionStatus newStatus;

    /**
     * Constructor
     *
     * @param apolloClient  Apollo Client
     * @param channelId     The channel ID the redemptions were made in
     * @param redemptionIds The redemption IDs to update
     * @param oldStatus     The old status redemptions are currently set to
     * @param newStatus     The new status to set the redemptions to
     */
    public CommandUpdateCustomRedemptionStatuses(@NonNull ApolloClient apolloClient, @NonNull String channelId, @NonNull List redemptionIds,
                                                 @NonNull CommunityPointsCustomRewardRedemptionStatus oldStatus, @NonNull CommunityPointsCustomRewardRedemptionStatus newStatus) {
        super(apolloClient);
        this.channelId = channelId;
        this.redemptionIds = redemptionIds;
        this.oldStatus = oldStatus;
        this.newStatus = newStatus;
    }

    @Override
    protected ApolloCall getGraphQLCall() {
        return apolloClient.mutate(
            UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsMutation.builder()
                .input(
                    UpdateCommunityPointsCustomRewardRedemptionStatusesByRedemptionsInput.builder()
                        .channelID(channelId)
                        .newStatus(newStatus)
                        .oldStatus(oldStatus)
                        .redemptionIDs(redemptionIds)
                        .build()
                )
                .build()
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy