maruTA-bis5 / mattermost4j

Mattermost API v4 Client for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mattermost4j

CI Status Maven Central Javadocs Coverage

Mattermost API v4 client for Java.

Requirement

  • JDK 11 or later
    • Additional dependencies required for Java SE runtime environment. These dependencies is not required for Jakarta EE server environment.
      • Jakarta XML Binding (jakarta.xml.bind:jakarta.xml.bind-api)
      • Jakarta Activation (jakarta.activation:jakarta.activation-api)
  • Mattermost Server
  • Jakarta RESTful Web Services 3.1 implementation (Client only, A part of Jakarta EE 10)

Usage

Basic API Client

// Create client instance
MattermostClient client;
// case 1. use constructor - log disable and prohibit unknown properties
client = new MattermostClient("YOUR-MATTERMOST-URL");
// case 2. use builder
client = MattermostClient.builder()
    .url("YOUR-MATTERMOST-URL")
	.ignoreUnknownProperties()
	.build();

// Login by id + password
client.login(loginId, password);
// Login by Personal Access Token
client.setAccessToken(token);

Use Incoming Webhook

// You can also use builder for create client instance.
IncomingWebhookClient client = new IncomingWebhookClient("YOUR-MATTERMOST-URL");

IncomingWebhookRequest payload = new IncomingWebhookRequest();
payload.setText("Hello World!");
payload.setUsername("Override Username");

client.postByIncomingWebhook(payload);

Install

Add these dependencies to your project.

  • Core (net.bis5.mattermost4j:mattermost4j-core)
  • Client Adapter matches to your RESTful Web Service Client
    You can request to create new client adapter for other client not in below list if you would like to use.
    • for Jersey: net.bis5.mattermost4j:mattermost4j-jersey
    • for RESTEasy: net.bis5.mattermost4j:mattermost4j-resteasy

Module index

groupId: net.bis5.mattermost4j

artifactId JPMS module module name note
mattermost-models net.bis5.mattermost4j.models Maattermost Data Models
mattermost4j-core net.bis5.mattermost4j.core Mattermost APIv4 Client for Java
mattermost4j-integration-test-base net.bis5.mattermost4j.testbase Mattermost4J :: Integration Test Base
mattermost4j-jersey net.bis5.mattermost4j.jersey Mattermost4J :: Jersey Client
mattermost4j-resteasy net.bis5.mattermost4j.resteasy Mattermost4J :: RESTEasy Client (JPMS) Automatic module

Contribution

  1. Fork it ( https://github.com/maruTA-bis5/mattermost4j/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Code Formatter

use https://github.com/google/styleguide/ {intellij,eclipse}-java-google-style.xml .

CheckStyle

Currently, use CheckStyle's built-in google_checks.xml.

Test

Integration with Mattermost Server

  1. docker-compose up
  2. mvn test

To run specify test

  1. docker-compose up
  2. mvn test -Dtest=UsersApiTest -Dsurefire.failIfNoSpecifiedTests=false

Contact

License

Apache Software License, Version 2.0

About

Mattermost API v4 Client for Java

License:Apache License 2.0


Languages

Language:Java 100.0%Language:Shell 0.0%