Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0 beta 2 release #173

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
031ca69
Replace Java with Kotlin + Add Auth, Calendar & Event support (#154)
mrashed-dev Jul 6, 2023
30f6b3c
SDK v2 Beta - Bug fixes, cleanup, and in-code documentation (#157)
mrashed-dev Aug 9, 2023
01e61bd
reminderMinutes should be optional (#158)
mrashed-dev Aug 10, 2023
b120cb0
Added a new GitHub action to auto-generate SDK references. (#159)
AaronDDM Aug 11, 2023
acd6818
Change artifact name and add markdown files (#156)
mrashed-dev Aug 14, 2023
24b7b28
Final Pre-v2.0.0-beta-1 release fixes (#160)
mrashed-dev Aug 16, 2023
623b672
v2.0.0-beta.1 Release (#161)
mrashed-dev Aug 17, 2023
a4f802e
Create a webhook should return secret (#162)
mrashed-dev Sep 29, 2023
0157f4b
Add Free-Busy Support (#163)
mrashed-dev Oct 11, 2023
95d72e9
(Kotlin) Rotate secret should be post (#164)
atejada Oct 25, 2023
a3162e3
v2.0.0 beta 1 minor fixes (#167)
mrashed-dev Nov 8, 2023
358dce8
Add support for custom authentication, connectors, and credentials AP…
mrashed-dev Nov 13, 2023
d5532ef
Add Messages, Drafts, and Smart Compose APIs support (#166)
mrashed-dev Nov 13, 2023
3c610d3
Folder API support (#168)
mrashed-dev Nov 14, 2023
40c37c9
Fixed optional field for `GetAvailabilityResponse` (#169)
mrashed-dev Nov 15, 2023
78fd04d
Make provider optional java/kotlin (#170)
atejada Nov 15, 2023
97254ff
Add getter for GetFreeBusyResponse object type (#172)
mrashed-dev Nov 17, 2023
1424840
Attachments API Support (#171)
mrashed-dev Nov 21, 2023
85dc88c
Update CHANGELOG.md
mrashed-dev Nov 21, 2023
1560851
Version bump
mrashed-dev Nov 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root = true

[*.{kt,kts}]
indent_size = 2
indent_style = space
ktlint_standard_no-wildcard-imports = disabled
49 changes: 49 additions & 0 deletions .github/workflows/sdk-reference.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: sdk-reference

on:
push:
branches:
- v2.0.0-beta
pull_request:

jobs:
docs:
runs-on: ubuntu-latest
environment:
name: sdk-reference
url: ${{ steps.deploy.outputs.url }}
steps:
- uses: actions/checkout@v3
- name: Setup Java 8
uses: actions/setup-java@v3
with:
java-version: "8"
distribution: "corretto"
cache: gradle
- uses: burrunan/gradle-cache-action@v1
name: Build SDK refernece
with:
arguments: dokkaHtml
gradle-version: wrapper
properties: |
kotlin.js.compiler=ir
kotlin.parallel.tasks.in.project=true
- name: Set env BRANCH
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
- name: Set env CLOUDFLARE_BRANCH
run: |
if [[ $BRANCH == 'v2.0.0-beta' && $GITHUB_EVENT_NAME == 'push' ]]; then
echo "CLOUDFLARE_BRANCH=main" >> "$GITHUB_ENV"
else
echo "CLOUDFLARE_BRANCH=$BRANCH" >> "$GITHUB_ENV"
fi
- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@v1
id: deploy
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: nylas-java-sdk-reference
directory: build/dokka/html
wranglerVersion: "3"
branch: ${{ env.CLOUDFLARE_BRANCH }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ bin
out

# Ignore Intellij files
.idea
.idea
.DS_Store
src/main/kotlin/com/nylas/Main.kt
42 changes: 35 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,46 @@
# Nylas Java SDK Changelog

## [Unreleased]

This section contains changes that have been committed but not yet released.
## [2.0.0-beta.2] - Released 2023-11-21

### Added
* Added support for the free-busy endpoint
* Added support for Messages, Drafts, and Smart Compose APIs
* Added support for custom authentication, connectors, and credentials APIs
* Added support for folders API
* Added support for attachments API
* Added getter for `GetFreeBusyResponse` `object` field

### Changed
* Return webhook object with secret when creating a webhook
* Fixed HTTP method for rotating webhook secret
* Fixed Redirect URI endpoint path
* Fixed query parameter serialization
* Fixed optional field for `GetAvailabilityResponse`
* Fixed optional field for `Conferencing`

### Deprecated
## [2.0.0-beta.1] - Released 2023-08-16

### Fixed
### 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

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

## [1.21.0] - Released 2023-02-14

Expand Down Expand Up @@ -387,7 +413,9 @@ This second release aims toward API stability so that we can get to v1.0.0.

Initial preview release

[Unreleased]: https://github.com/nylas/nylas-java/compare/v1.21.0...HEAD
[Unreleased]: https://github.com/nylas/nylas-java/compare/v2.0.0-beta.2...HEAD
[2.0.0-beta.2]: https://github.com/nylas/nylas-java/releases/tag/v2.0.0-beta.2
[2.0.0-beta.1]: https://github.com/nylas/nylas-java/releases/tag/v2.0.0-beta.1
[1.21.0]: https://github.com/nylas/nylas-java/releases/tag/v1.21.0
[1.20.1]: https://github.com/nylas/nylas-java/releases/tag/v1.20.1
[1.20.0]: https://github.com/nylas/nylas-java/releases/tag/v1.20.0
Expand Down
116 changes: 74 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,75 +1,107 @@
# Nylas Java SDK
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).
<a href="https://www.nylas.com/">
<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" />
</a>

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.
# Nylas SDK for Kotlin & Java

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/).

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.

Here are some resources to help you get started:

- [Nylas SDK Tutorials](https://docs.nylas.com/docs/tutorials)
- [Get Started with the Nylas Communications Platform](https://docs.nylas.com/docs/getting-started)
- [Sign up for your Nylas developer account.](https://nylas.com/register)
- [Nylas API Reference](https://docs.nylas.com/reference)
- [Sign up for your free Nylas account](https://dashboard.nylas.com/register)
- [Nylas API v3 Quickstart Guide](https://developer.nylas.com/docs/v3-beta/v3-quickstart/)
- [Nylas SDK Reference](https://nylas-java-sdk-reference.pages.dev/)
- [Nylas API Reference](https://developer.nylas.com/docs/api/)
- [Nylas Samples repo for code samples and example applications](https://github.com/orgs/nylas-samples/repositories?q=&type=all&language=java)

If you have a question about the Nylas Communications Platform, [contact Nylas Support](https://support.nylas.com/) for help.

If you have a question about the Nylas Communications Platform, please reach out to [email protected] to get help.
## ⚙️ Install

# Install
**Note:** The Nylas Java SDK requires Java 8 or above.
**Note:** The Nylas SDK for Kotlin & Java requires JRE 8 or later.

**Setup via Gradle**: If you're using Gradle, add the following to your dependencies section of build.gradle:
### Set up using Gradle

implementation("com.nylas.sdk:nylas-java-sdk:1.21.0")
If you're using Gradle, add the following to the dependencies section of `build.gradle`:

**Setup via Maven**: For projects using Maven, add the following to your POM file:
```groovy
implementation("com.nylas.sdk:nylas:2.0.0-beta.1")
```

<dependency>
<groupId>com.nylas.sdk</groupId>
<artifactId>nylas-java-sdk</artifactId>
<version>1.21.0</version>
</dependency>

**Build from source**: To build from source, clone this repo and build the project with Gradle.
### Build from source

git clone https://github.com/nylas/nylas-java.git && cd nylas-java
./gradlew build
To build from source, clone this repo and build the project with Gradle.

This will create a new jar file in the `build/libs` subdirectory.
```shell
git clone https://github.com/nylas/nylas-java.git && cd nylas-java
./gradlew build uberJar
```

See Gradle documentation on [Building Java Libraries](https://guides.gradle.org/building-java-libraries/)
This creates a new jar file in `build/libs/nylas-java-sdk-2.0.0-beta.1-uber.jar`.

See the Gradle documentation on [Building Libraries](https://guides.gradle.org/building-java-libraries/)
or the [Gradle User Manual](https://docs.gradle.org/current/userguide/userguide.html) for more information.

# Usage
## ⚡️Usage

To use this SDK, you must first [get a free Nylas account](https://dashboard.nylas.com/register).

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/).

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

### 🚀 Making Your First Request

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.

To use this SDK, you first need to [sign up for a free Nylas developer account](https://nylas.com/register).
For example, to get a list of calendars, you can use the following code:

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).
```java
NylasClient nylas = new NylasClient.Builder("API_KEY").build();
ListResponse<Calendars> calendars = nylas.calendars().list("GRANT_ID");
```

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).
## 📚 Documentation

## Logging
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.

## ✨ Upgrading from 1.x

See [UPGRADE.md](UPGRADING.md) for instructions on upgrading from 1.x to 2.x.

**Note**: The Kotlin/Java SDK 2.x is not compatible with the Nylas API earlier than v3-beta.

## 🪵 Logging

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.

The SDK uses [SLF4J](http://www.slf4j.org) for logging. Applications using the SDK can
[choose what logging framework to use with it](http://www.slf4j.org/manual.html#projectDep).
Common choices are log4j, logback, java.util.logging. If the application doesn't specify any logging framework,
then SLF4J will emit one warning and then be completely silent.
SLF4J emits one single warning and is then completely silent.

By default, the HTTP client is configured with the `com.nylas.HttpLoggingInterceptor`
which provides 3 loggers for HTTP requests that only log at DEBUG level.
- `com.nylas.http.Summary` logs one line for each request, containing method, URI, and content size
and one line for each response containing status code, message, content size and duration.
which provides three DEBUG level loggers for HTTP requests.

- `com.nylas.http.Summary` logs one line for each request, containing the method, URI, and content size,
and one line for each response containing the status code, message, content size and duration.
- `com.nylas.http.Headers` logs the request and response HTTP headers (except Authorization value by default).
- `com.nylas.http.Body` logs request and response bodies (first 10kB by default).

Enabling or disabling those loggers is done via the logging framework being used.
For example, if using log4j2 and with an xml configuration file, include this line to enable all three:
You can enable or disable these loggers using whatever logging framework you use.

For example, if you're using log4j2 and with an xml configuration file, include this line to enable all three:
`<Logger name="com.nylas" level="DEBUG"/>`

Configuring the logging of the HTTP Authorization header values and the body size limit can be done by using a
You can configure how you log HTTP Authorization header values and the body size limit using a
`NylasClient.Builder` with a customized `HttpLoggingInterceptor`

# Contributing
## 💙 Contributing

We value and appreciate contributors' time! We welcome questions, bug reports, and pull requests.

Please refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.
See the [Contributing](Contributing.md) for information about how to make contributions to this project.

# License
## 📝 License

This project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE) for the full terms.
This project is licensed under the terms of the MIT license. See the [LICENSE](LICENSE) for the full terms.
Loading
Loading