Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/motoki317/traq4j

traQ API client for Java
https://github.com/motoki317/traq4j

traq

Last synced: about 2 months ago
JSON representation

traQ API client for Java

Awesome Lists containing this project

README

        

# traq4j

[![GitHub release](https://img.shields.io/github/release/motoki317/traq4j.svg)](https://GitHub.com/motoki317/traq4j/releases/)

traQ API client for Java

Requires Java 8+

## Example usage

### pom.xml

Make sure to use the latest version shown below.

[![GitHub release](https://img.shields.io/github/release/motoki317/traq4j.svg)](https://GitHub.com/motoki317/traq4j/releases/)

```xml



GitHub traq4j
https://raw.github.com/motoki317/traq4j/mvn-repo/




com.github.motoki317
traq4j
${traq4j.version}

```

### Code

```java
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;
}
}
```

## Development

1. `$ ./generate.sh`
2. Reformat code (takes some time)