traQ API client for Java
Requires Java 8+
Make sure to use the latest version shown below.
<project>
<repositories>
<repository>
<id>GitHub traq4j</id>
<url>https://raw.github.com/motoki317/traq4j/mvn-repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.motoki317</groupId>
<artifactId>traq4j</artifactId>
<version>${traq4j.version}</version>
</dependency>
</dependencies>
</project>
public class Main {
public static void main(String[] args){
// Create API client
String accessToken = System.getenv("ACCESS_TOKEN");
ApiClient client = new ApiClient();
client.addDefaultHeader("Authorization", "Bearer " + accessToken);
// Message API client
MessageApi messageApi = new MessageApi(client);
// Post message
String channelId = "00000000-0000-0000-0000-000000000000";
String content = "oisu~";
Message message = messageApi.postMessage(
UUID.fromString(channelId),
new PostMessageRequest().content(content).embed(false)
);
assert message != null;
}
}
$ ./generate.sh
- Reformat code (takes some time)