Skip to content

Commit 9bc4b02

Browse files
mrashed-devAaronDDMLrubinsanscontextatejada
authored
v2.0.0 (#202)
# Description This PR is a culmination of all the PRs that contained v2-related development, with formal support for the Nylas API v3. This release is essentially the same as the v2.0.0-beta.5 release found on maven. This release also formally switches the development language of the SDK from Java to Kotlin, as well as the artifact name from `nylas-java-sdk` to `nylas`. Please refer to the readme for a quick start guide on using the new SDK, as well as links to the upgrade doc as well as the SDK reference docs. # Changelog ### BREAKING CHANGES * Renamed artifact from `nylas-java-sdk` to `nylas`. * Nylas SDK v2 supports the Nylas API v3 exclusively, dropping support for any endpoints that are not available in v3. * Removed all REST calls from models and moved them directly into resources ### Added * Full Kotlin support * Created models for all API resources and endpoints, for all HTTP methods to reduce confusion on which fields are available for each endpoint * Created error classes for the different API errors as well as SDK-specific errors ### Changed * Leveraged Moshi annotations for JSON serialization/deserialization as opposed to manually writing JSON maps * Removed all REST calls from models and moved them directly into resources ### Removed * Non-builder ways for initializing `NylasClient` * Local Webhook development support is removed due to incompatibility with the new API version # License <!-- Your PR comment must contain the following line for us to merge the PR. --> I confirm that this contribution is made under the terms of the MIT license and that I have the authority necessary to make this contribution on behalf of its copyright owner. --------- Co-authored-by: Aaron de Mello <314152+AaronDDM@users.noreply.github.com> Co-authored-by: Lrubin <Lrubin@nylas.com> Co-authored-by: LRubin <sanscontext@users.noreply.github.com> Co-authored-by: Blag <atejada@gmail.com> Co-authored-by: YIFAN WU <14408339+yifanplanet@users.noreply.github.com>
1 parent 52cf0ff commit 9bc4b02

428 files changed

Lines changed: 16944 additions & 22170 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
root = true
2+
3+
[*.{kt,kts}]
4+
ktlint_code_style = intellij_idea
5+
indent_size = 2
6+
indent_style = space
7+
ktlint_standard_no-wildcard-imports = disabled

.github/workflows/pull-reqeust.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
checks:
1414
runs-on: ubuntu-latest
15-
name: Java unit tests
15+
name: Lint, Build, Test, and Upload Coverage
1616
steps:
1717
- uses: actions/checkout@v3
1818
- name: Setup Java 8
@@ -24,8 +24,16 @@ jobs:
2424
- name: Grant execute permission for gradlew
2525
run: chmod +x gradlew
2626

27+
- name: Lint project
28+
run: ./gradlew lintKotlin
29+
2730
- name: Build project
2831
run: ./gradlew clean build
2932

3033
- name: Run tests
3134
run: ./gradlew test
35+
36+
- name: Upload coverage to Codecov
37+
uses: codecov/codecov-action@v4
38+
env:
39+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: sdk-reference
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
docs:
11+
runs-on: ubuntu-latest
12+
environment:
13+
name: sdk-reference
14+
url: ${{ steps.deploy.outputs.url }}
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Setup Java 8
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: "8"
21+
distribution: "corretto"
22+
cache: gradle
23+
- uses: burrunan/gradle-cache-action@v1
24+
name: Build SDK refernece
25+
with:
26+
arguments: dokkaHtml
27+
gradle-version: wrapper
28+
properties: |
29+
kotlin.js.compiler=ir
30+
kotlin.parallel.tasks.in.project=true
31+
- name: Set env BRANCH
32+
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
33+
- name: Set env CLOUDFLARE_BRANCH
34+
run: |
35+
if [[ $BRANCH == 'main' && $GITHUB_EVENT_NAME == 'push' ]]; then
36+
echo "CLOUDFLARE_BRANCH=main" >> "$GITHUB_ENV"
37+
else
38+
echo "CLOUDFLARE_BRANCH=$BRANCH" >> "$GITHUB_ENV"
39+
fi
40+
- name: Publish to Cloudflare Pages
41+
uses: cloudflare/pages-action@v1
42+
id: deploy
43+
with:
44+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
45+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
46+
projectName: nylas-java-sdk-reference
47+
directory: build/dokka/html
48+
wranglerVersion: "3"
49+
branch: ${{ env.CLOUDFLARE_BRANCH }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ bin
1212
out
1313

1414
# Ignore Intellij files
15-
.idea
15+
.idea
16+
.DS_Store
17+
src/main/kotlin/com/nylas/Main.kt

CHANGELOG.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
# Nylas Java SDK Changelog
22

3-
## [Unreleased]
3+
## [2.0.0] - Released 2024-02-05
44

5-
This section contains changes that have been committed but not yet released.
5+
### BREAKING CHANGES
6+
7+
* Renamed artifact from `nylas-java-sdk` to `nylas`.
8+
* Nylas SDK v2 supports the Nylas API v3 exclusively, dropping support for any endpoints that are not available in v3.
9+
* Removed all REST calls from models and moved them directly into resources
610

711
### Added
812

9-
### Changed
13+
* Full Kotlin support
14+
* Created models for all API resources and endpoints, for all HTTP methods to reduce confusion on which fields are available for each endpoint
15+
* Created error classes for the different API errors as well as SDK-specific errors
1016

11-
### Deprecated
17+
### Changed
1218

13-
### Fixed
19+
* Leveraged Moshi annotations for JSON serialization/deserialization as opposed to manually writing JSON maps
20+
* Removed all REST calls from models and moved them directly into resources
1421

1522
### Removed
1623

17-
### Security
24+
* Non-builder ways for initializing `NylasClient`
25+
* Local Webhook development support is removed due to incompatibility with the new API version
1826

1927
## [1.22.0] - Released 2024-01-29
2028

@@ -395,8 +403,8 @@ This second release aims toward API stability so that we can get to v1.0.0.
395403

396404
Initial preview release
397405

398-
[Unreleased]: https://github.com/nylas/nylas-java/compare/v1.22.0...HEAD
399-
[1.22.0]: https://github.com/nylas/nylas-java/releases/tag/v1.22.0
406+
[Unreleased]: https://github.com/nylas/nylas-java/compare/v2.0.0...HEAD
407+
[2.0.0]: https://github.com/nylas/nylas-java/releases/tag/v2.0.0
400408
[1.21.0]: https://github.com/nylas/nylas-java/releases/tag/v1.21.0
401409
[1.20.1]: https://github.com/nylas/nylas-java/releases/tag/v1.20.1
402410
[1.20.0]: https://github.com/nylas/nylas-java/releases/tag/v1.20.0

README.md

Lines changed: 77 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,110 @@
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>
34

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+
![Maven Central Version](https://img.shields.io/maven-central/v/com.nylas.sdk/nylas)
8+
[![codecov](https://codecov.io/gh/nylas/nylas-java/graph/badge.svg?token=R94RD91GZ3)](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.
513

614
Here are some resources to help you get started:
715

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
1225

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.
1427

15-
# Install
16-
**Note:** The Nylas Java SDK requires Java 8 or above.
28+
### Set up using Gradle
1729

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`:
1931

20-
implementation("com.nylas.sdk:nylas-java-sdk:1.22.0")
32+
```groovy
33+
implementation("com.nylas.sdk:nylas:2.0.0")
34+
```
2135

22-
**Setup via Maven**: For projects using Maven, add the following to your POM file:
36+
### Build from source
2337

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.
3139

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+
```
3444

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`.
3646

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/)
3848
or the [Gradle User Manual](https://docs.gradle.org/current/userguide/userguide.html) for more information.
3949

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
4159

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.
4361

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:
4563

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+
```
4768

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.
4982

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).
5283
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.
5485

5586
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.
5991
- `com.nylas.http.Headers` logs the request and response HTTP headers (except Authorization value by default).
6092
- `com.nylas.http.Body` logs request and response bodies (first 10kB by default).
6193

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:
6497
`<Logger name="com.nylas" level="DEBUG"/>`
6598

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
67100
`NylasClient.Builder` with a customized `HttpLoggingInterceptor`
68101

69-
# Contributing
102+
## 💙 Contributing
103+
104+
We value and appreciate contributors' time! We welcome questions, bug reports, and pull requests.
70105

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.
72107

73-
# License
108+
## 📝 License
74109

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

Comments
 (0)