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

com.github.twitch4j.graphql.command.CommandFollowUser 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.FollowMutation;
import com.github.twitch4j.graphql.internal.type.FollowUserInput;

/**
 * Follow User
 */
public class CommandFollowUser extends BaseCommand {

    private final Long targetUserId;

    private final Boolean goLiveNotification;

    public CommandFollowUser(ApolloClient apolloClient, Long targetUserId, Boolean goLiveNotification) {
        super(apolloClient);
        this.targetUserId = targetUserId;
        this.goLiveNotification = goLiveNotification;
    }

    @Override
    protected ApolloCall getGraphQLCall() {
        ApolloCall apolloCall = apolloClient.mutate(
            FollowMutation.builder()
                .followUserInput(
                    FollowUserInput.builder()
                        .targetID(targetUserId.toString())
                        .disableNotifications(goLiveNotification ? false : true)
                        .build()
                )
                .build()
        );

        return apolloCall;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy