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

com.github.twitch4j.graphql.command.CommandFetchChatHistory 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.FetchChatHistoryQuery;
import lombok.NonNull;
import org.jetbrains.annotations.Nullable;

public class CommandFetchChatHistory extends BaseCommand {
    private final String channelId;
    private final String userId;
    private final String after;

    /**
     * Constructor
     *
     * @param apolloClient Apollo Client
     * @param channelId    Channel ID
     * @param userId       User ID
     * @param after        Optional cursor for pagination
     */
    public CommandFetchChatHistory(@NonNull ApolloClient apolloClient, @NonNull String channelId, @NonNull String userId, @Nullable String after) {
        super(apolloClient);
        this.channelId = channelId;
        this.userId = userId;
        this.after = after;
    }

    @Override
    protected ApolloCall getGraphQLCall() {
        return apolloClient.query(
            FetchChatHistoryQuery.builder()
                .channelID(channelId)
                .userID(userId)
                .after(after)
                .build()
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy