|
1 | | -# Nylas Java SDK |
2 | | -This is the GitHub repository for the Nylas Java SDK and this repo is primarily for anyone who wants to make contributions to the SDK or install it from source. If you are looking to use Java to access the Nylas Email, Calendar, or Contacts API you should refer to our official [Java SDK Quickstart Guide](https://docs.nylas.com/docs/quickstart-java). |
| 1 | +<a href="https://www.nylas.com/"> |
| 2 | + <img src="https://brand.nylas.com/assets/downloads/logo_horizontal_png/Nylas-Logo-Horizontal-Blue_.png" alt="Aimeos logo" title="Aimeos" align="right" height="60" /> |
| 3 | +</a> |
3 | 4 |
|
4 | | -The Nylas Communications Platform provides REST APIs for [Email](https://docs.nylas.com/docs/quickstart-email), [Calendar](https://docs.nylas.com/docs/quickstart-calendar), and [Contacts](https://docs.nylas.com/docs/quickstart-contacts), and the Java SDK is the quickest way to build your integration using Java. |
| 5 | +# Nylas SDK for Kotlin & Java |
| 6 | + |
| 7 | + |
| 8 | +[](https://codecov.io/gh/nylas/nylas-java) |
| 9 | + |
| 10 | +This is the GitHub repository for the Nylas SDK for Kotlin and Java. This repo is primarily for anyone who wants to make contributions to the SDK or install it from source. For documentation on how to use this SDK to access the Nylas Email, Calendar, or Contacts APIs, see the official [Java SDK Quickstart Guide](https://developer.nylas.com/docs/sdks/java/). |
| 11 | + |
| 12 | +The Nylas Communications Platform provides REST APIs for [Email](https://developer.nylas.com/docs/email/), [Calendar](https://developer.nylas.com/docs/calendar/), and [Contacts](https://developer.nylas.com/docs/contacts/), and the Nylas SDK is the quickest way to build your integration using Kotlin or Java. |
5 | 13 |
|
6 | 14 | Here are some resources to help you get started: |
7 | 15 |
|
8 | | -- [Nylas SDK Tutorials](https://docs.nylas.com/docs/tutorials) |
9 | | -- [Get Started with the Nylas Communications Platform](https://docs.nylas.com/docs/getting-started) |
10 | | -- [Sign up for your Nylas developer account.](https://nylas.com/register) |
11 | | -- [Nylas API Reference](https://docs.nylas.com/reference) |
| 16 | +- [Sign up for your free Nylas account](https://dashboard.nylas.com/register) |
| 17 | +- [Nylas API v3 Quickstart Guide](https://developer.nylas.com/docs/v3-beta/v3-quickstart/) |
| 18 | +- [Nylas SDK Reference](https://nylas-java-sdk-reference.pages.dev/) |
| 19 | +- [Nylas API Reference](https://developer.nylas.com/docs/api/) |
| 20 | +- [Nylas Samples repo for code samples and example applications](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=java) |
| 21 | + |
| 22 | +If you have a question about the Nylas Communications Platform, [contact Nylas Support](https://support.nylas.com/) for help. |
| 23 | + |
| 24 | +## ⚙️ Install |
12 | 25 |
|
13 | | -If you have a question about the Nylas Communications Platform, please reach out to support@nylas.com to get help. |
| 26 | +**Note:** The Nylas SDK for Kotlin & Java requires JRE 8 or later. |
14 | 27 |
|
15 | | -# Install |
16 | | -**Note:** The Nylas Java SDK requires Java 8 or above. |
| 28 | +### Set up using Gradle |
17 | 29 |
|
18 | | -**Setup via Gradle**: If you're using Gradle, add the following to your dependencies section of build.gradle: |
| 30 | +If you're using Gradle, add the following to the dependencies section of `build.gradle`: |
19 | 31 |
|
20 | | - implementation("com.nylas.sdk:nylas-java-sdk:1.22.0") |
| 32 | +```groovy |
| 33 | +implementation("com.nylas.sdk:nylas:2.0.0") |
| 34 | +``` |
21 | 35 |
|
22 | | -**Setup via Maven**: For projects using Maven, add the following to your POM file: |
| 36 | +### Build from source |
23 | 37 |
|
24 | | - <dependency> |
25 | | - <groupId>com.nylas.sdk</groupId> |
26 | | - <artifactId>nylas-java-sdk</artifactId> |
27 | | - <version>1.22.0</version> |
28 | | - </dependency> |
29 | | - |
30 | | -**Build from source**: To build from source, clone this repo and build the project with Gradle. |
| 38 | +To build from source, clone this repo and build the project with Gradle. |
31 | 39 |
|
32 | | - git clone https://github.com/nylas/nylas-java.git && cd nylas-java |
33 | | - ./gradlew build |
| 40 | +```shell |
| 41 | +git clone https://github.com/nylas/nylas-java.git && cd nylas-java |
| 42 | +./gradlew build uberJar |
| 43 | +``` |
34 | 44 |
|
35 | | -This will create a new jar file in the `build/libs` subdirectory. |
| 45 | +This creates a new jar file in `build/libs/nylas-java-sdk-2.0.0-uber.jar`. |
36 | 46 |
|
37 | | -See Gradle documentation on [Building Java Libraries](https://guides.gradle.org/building-java-libraries/) |
| 47 | +See the Gradle documentation on [Building Libraries](https://guides.gradle.org/building-java-libraries/) |
38 | 48 | or the [Gradle User Manual](https://docs.gradle.org/current/userguide/userguide.html) for more information. |
39 | 49 |
|
40 | | -# Usage |
| 50 | +## ⚡️Usage |
| 51 | + |
| 52 | +To use this SDK, you must first [get a free Nylas account](https://dashboard.nylas.com/register). |
| 53 | + |
| 54 | +Then, follow the Quickstart guide to [set up your first app and get your API keys](https://developer.nylas.com/docs/v3-beta/v3-quickstart/). |
| 55 | + |
| 56 | +For code examples that demonstrate how to use this SDK, take a look at our [Java repos in the Nylas Samples collection](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=java). |
| 57 | + |
| 58 | +### 🚀 Making Your First Request |
41 | 59 |
|
42 | | -To use this SDK, you first need to [sign up for a free Nylas developer account](https://nylas.com/register). |
| 60 | +You use the `NylasClient` object to make requests to the Nylas API. The SDK is organized into different resources, each of which has methods to make requests to the API. Each resource is available through the `NylasClient` object configured with your API key. |
43 | 61 |
|
44 | | -Then, follow our guide to [setup your first app and get your API access keys](https://docs.nylas.com/docs/get-your-developer-api-keys). |
| 62 | +For example, to get a list of calendars, you can use the following code: |
45 | 63 |
|
46 | | -For code examples that demonstrate how to use this SDK, take a look at our [Java SDK Quickstart Guide](https://docs.nylas.com/docs/quickstart-java). |
| 64 | +```java |
| 65 | +NylasClient nylas = new NylasClient.Builder("API_KEY").build(); |
| 66 | +ListResponse<Calendars> calendars = nylas.calendars().list("GRANT_ID"); |
| 67 | +``` |
47 | 68 |
|
48 | | -## Logging |
| 69 | +## 📚 Documentation |
| 70 | + |
| 71 | +Nylas maintains a [reference guide for the Kotlin and Java SDK](https://nylas-java-sdk-reference.pages.dev/) to help you get familiar with the available methods and classes. |
| 72 | + |
| 73 | +## ✨ Upgrading from 1.x |
| 74 | + |
| 75 | +See [UPGRADE.md](UPGRADING.md) for instructions on upgrading from 1.x to 2.x. |
| 76 | + |
| 77 | +**Note**: The Kotlin/Java SDK 2.x is not compatible with the Nylas API earlier than v3-beta. |
| 78 | + |
| 79 | +## 🪵 Logging |
| 80 | + |
| 81 | +The SDK uses [SLF4J](http://www.slf4j.org) for logging. If you are using the SDK you can [choose what logging framework to use with it](http://www.slf4j.org/manual.html#projectDep) for your app. |
49 | 82 |
|
50 | | -The SDK uses [SLF4J](http://www.slf4j.org) for logging. Applications using the SDK can |
51 | | -[choose what logging framework to use with it](http://www.slf4j.org/manual.html#projectDep). |
52 | 83 | Common choices are log4j, logback, java.util.logging. If the application doesn't specify any logging framework, |
53 | | -then SLF4J will emit one warning and then be completely silent. |
| 84 | +SLF4J emits one single warning and is then completely silent. |
54 | 85 |
|
55 | 86 | By default, the HTTP client is configured with the `com.nylas.HttpLoggingInterceptor` |
56 | | -which provides 3 loggers for HTTP requests that only log at DEBUG level. |
57 | | -- `com.nylas.http.Summary` logs one line for each request, containing method, URI, and content size |
58 | | -and one line for each response containing status code, message, content size and duration. |
| 87 | +which provides three DEBUG level loggers for HTTP requests. |
| 88 | + |
| 89 | +- `com.nylas.http.Summary` logs one line for each request, containing the method, URI, and content size, |
| 90 | +and one line for each response containing the status code, message, content size and duration. |
59 | 91 | - `com.nylas.http.Headers` logs the request and response HTTP headers (except Authorization value by default). |
60 | 92 | - `com.nylas.http.Body` logs request and response bodies (first 10kB by default). |
61 | 93 |
|
62 | | -Enabling or disabling those loggers is done via the logging framework being used. |
63 | | -For example, if using log4j2 and with an xml configuration file, include this line to enable all three: |
| 94 | +You can enable or disable these loggers using whatever logging framework you use. |
| 95 | + |
| 96 | +For example, if you're using log4j2 and with an xml configuration file, include this line to enable all three: |
64 | 97 | `<Logger name="com.nylas" level="DEBUG"/>` |
65 | 98 |
|
66 | | -Configuring the logging of the HTTP Authorization header values and the body size limit can be done by using a |
| 99 | +You can configure how you log HTTP Authorization header values and the body size limit using a |
67 | 100 | `NylasClient.Builder` with a customized `HttpLoggingInterceptor` |
68 | 101 |
|
69 | | -# Contributing |
| 102 | +## 💙 Contributing |
| 103 | + |
| 104 | +We value and appreciate contributors' time! We welcome questions, bug reports, and pull requests. |
70 | 105 |
|
71 | | -Please refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests. |
| 106 | +See the [Contributing](Contributing.md) for information about how to make contributions to this project. |
72 | 107 |
|
73 | | -# License |
| 108 | +## 📝 License |
74 | 109 |
|
75 | | -This project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE) for the full terms. |
| 110 | +This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) for the full terms. |
0 commit comments