|
| 1 | + |
| 2 | + |
| 3 | +# [Sendbird Java Platform SDK](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) |
| 4 | + |
| 5 | + |
| 6 | +[](/docs) |
| 7 | + |
| 8 | +This is a Java library that makes talking to the [Sendbird Platform API](https://sendbird.com/docs/chat/v3/platform-api/getting-started/prepare-to-use-api) easier. With this library you can extend your Sendbird integration to include advanced features like channel automation and user management. |
| 9 | + |
| 10 | +# 🔥 Quick start |
| 11 | + |
| 12 | +```java |
| 13 | + |
| 14 | +import org.sendbird.client.ApiClient; |
| 15 | +import org.sendbird.client.ApiException; |
| 16 | +import org.sendbird.client.Configuration; |
| 17 | +import org.sendbird.client.api.UserApi; |
| 18 | +import org.openapitools.client.model.ListUsersResponse; |
| 19 | + |
| 20 | + |
| 21 | +class AppTest { |
| 22 | + static class User { |
| 23 | + UserApi apiInstance; |
| 24 | + public User(ApiClient defaultClient){ |
| 25 | + apiInstance = new UserApi(defaultClient); |
| 26 | + } |
| 27 | + public void listUsers(){ |
| 28 | + |
| 29 | + try { |
| 30 | + Integer limit = 56; |
| 31 | + String activeMode = "activated"; |
| 32 | + Boolean showBot = true; |
| 33 | + ListUsersResponse result = apiInstance.listUsers().limit(limit).activeMode(activeMode).execute(); |
| 34 | + System.out.println(result); |
| 35 | + |
| 36 | + } catch (ApiException e) { |
| 37 | + System.err.println("Exception when calling listUsers"); |
| 38 | + System.err.println("Status code: " + e.getCode()); |
| 39 | + System.err.println("Reason: " + e.getResponseBody()); |
| 40 | + System.err.println("Response headers: " + e.getResponseHeaders()); |
| 41 | + e.printStackTrace(); |
| 42 | + } |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + public static void main(String[] args) { |
| 47 | + String apiToken = "YOUR_API_TOKEN"; |
| 48 | + String applicationId = "YOUR_APP_ID_FROM_DASHBOARD"; |
| 49 | + ApiClient defaultClient = Configuration.getDefaultApiClient().addDefaultHeader("Api-Token", apiToken); |
| 50 | + defaultClient.setBasePath("https://api-" + applicationId + ".sendbird.com"); |
| 51 | + User user = new User(defaultClient); |
| 52 | + user.listUsers(); |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +``` |
| 57 | + |
| 58 | +# ⚒️ Prerequisite |
| 59 | +In order to make requests with this SDK you will need you master API token. This can be found through the [Sendbird dashboard](https://dashboard.sendbird.com/). Each app you create in Sendbird has its own master api token. These tokens can be found in Settings > Application > General. |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | +## 💻 Requirements |
| 64 | + |
| 65 | +Building the API client library requires: |
| 66 | +1. Java 1.7+ |
| 67 | +2. Maven (3.8.3+)/Gradle (7.2+) |
| 68 | + |
| 69 | +## ⚙️ Installation |
| 70 | + |
| 71 | +To install the API client library to your local Maven repository, simply execute: |
| 72 | + |
| 73 | +```shell |
| 74 | +mvn clean install |
| 75 | +``` |
| 76 | + |
| 77 | +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: |
| 78 | + |
| 79 | +```shell |
| 80 | +mvn clean deploy |
| 81 | +``` |
| 82 | + |
| 83 | +Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information. |
| 84 | + |
| 85 | +### Maven users |
| 86 | + |
| 87 | +Add these dependency to your project's POM: |
| 88 | + |
| 89 | +```xml |
| 90 | +<repositories> |
| 91 | + <repository> |
| 92 | + <id>sendbird</id> |
| 93 | + <url>https://repo.sendbird.com/public/maven</url> |
| 94 | + </repository> |
| 95 | +</repositories> |
| 96 | + |
| 97 | +<dependencies> |
| 98 | + <dependency> |
| 99 | + <groupId>org.sendbird</groupId> |
| 100 | + <artifactId>sendbird-platform-sdk</artifactId> |
| 101 | + <version>1.0.23</version> |
| 102 | + </dependency> |
| 103 | +</dependencies> |
| 104 | +``` |
| 105 | + |
| 106 | +### Gradle users |
| 107 | + |
| 108 | +Add this dependency to your project's build file: |
| 109 | + |
| 110 | +```groovy |
| 111 | + |
| 112 | +dependencies { |
| 113 | + implementation "org.sendbird:sendbird-platform-sdk:1.0.23" |
| 114 | +} |
| 115 | + |
| 116 | +allprojects { |
| 117 | + repositories { |
| 118 | + maven { url "https://repo.sendbird.com/public/maven" } |
| 119 | + } |
| 120 | +} |
| 121 | +``` |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +# 🗃️ Documentation |
| 128 | +All the documentation for this project lives in the /docs directory of this repo. |
| 129 | + |
| 130 | +##### Helpful links |
| 131 | + |
| 132 | +| | Documentation | |
| 133 | +| ----------- | ----------- | |
| 134 | +| Announcement | [docs/AnnouncementApi.md](docs/AnnouncementApi.md)| |
| 135 | +| Application | [docs/ApplicationApi.md](docs/ApplicationApi.md) | |
| 136 | +| Bot | [docs/BotApi.md](docs/BotApi.md) | |
| 137 | +| GroupChannel | [docs/GroupChannelApi.md](docs/GroupChannelApi.md) | |
| 138 | +| Message | [docs/MessageApi.md](docs/MessageApi.md) | |
| 139 | +| OpenChannel | [docs/OpenChannelApi.md ](docs/OpenChannelApi.md) | |
| 140 | +| User | [docs/UserApi.md](docs/UserApi.md) | |
| 141 | +| Webhooks | [docs/WebhooksApi.md](docs/WebhooksApi.md) | |
| 142 | + |
| 143 | + |
0 commit comments