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

mattermost-java-sdk.1.2.source-code.Testing Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
import com.jrodmanu.mattermostjavasdk.MattermostClient;
import com.jrodmanu.mattermostjavasdk.models.common.Channel;
import com.jrodmanu.mattermostjavasdk.models.exceptions.MattermostException;
import com.jrodmanu.mattermostjavasdk.models.parameters.CreateChannelParams;
import com.jrodmanu.mattermostjavasdk.models.parameters.CreatePostParams;
import com.jrodmanu.mattermostjavasdk.models.common.Post;

public class Testing {

    public static void main(String[] args) {
        try {
            MattermostClient client = new MattermostClient.Builder("https://mattermost.winwholesale.com/api/v4")
                    .setAccessToken("ntwtzcioptn79c3hga3hkq4e6r")
                    .setDefaultTeam("winsupply")
                    .build();

            Channel channel = client.channels.createChannel(
                    new CreateChannelParams.Builder("jaredss-party", "jared's party", "O").build()
            );

            Post post = client.posts.createPost(
                    new CreatePostParams.Builder("There is no need to be afraid")
                            .setChannelId(channel.id)
                            .build()
            );
        } catch (MattermostException e) {
            e.printStackTrace();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy