Skip to content

Commit

Permalink
v2.0.0-beta.1 Release (#161)
Browse files Browse the repository at this point in the history
# Description
This PR is for releasing the first beta of v2 on maven central.

# 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.
  • Loading branch information
mrashed-dev authored Aug 17, 2023
1 parent 24b7b28 commit 623b672
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 20 deletions.
20 changes: 14 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
# Nylas Java SDK Changelog

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

This section contains changes that have been committed but not yet released.
### 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

### Changed
* 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

### Deprecated
### Changed

### Fixed
* 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
48 changes: 48 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ plugins {
kotlin("jvm") version "1.8.21"
id("org.jmailen.kotlinter") version "3.15.0"
id("org.jetbrains.dokka") version "1.8.20"
`maven-publish`
`java-library`
application
signing
}

repositories {
Expand All @@ -12,6 +15,8 @@ repositories {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}

kotlin {
Expand Down Expand Up @@ -58,3 +63,46 @@ tasks.register<Jar>("uberJar") {
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}

publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name.set("Nylas SDK for Kotlin & Java")
description.set("Kotlin & Java SDK for the Nylas Communication Platform")
url.set("https://github.com/nylas/nylas-java")
licenses {
license {
name.set("MIT")
url.set("http://www.opensource.org/licenses/mit-license.php")
}
}
developers {
developer {
id.set("mrashed-dev")
name.set("Mostafa Rashed")
organization.set("Nylas")
organizationUrl.set("https://www.nylas.com/")
}
}
scm {
url.set("https://github.com/nylas/nylas-java")
connection.set("scm:git:https://github.com/nylas/nylas-java.git")
developerConnection.set("scm:git:https://github.com/nylas/nylas-java.git")
}
}
}
}
repositories {
maven {
name = "ossrh"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2")
credentials(PasswordCredentials::class)
}
}
}

signing {
sign(publishing.publications["mavenJava"])
}
3 changes: 2 additions & 1 deletion src/main/kotlin/com/nylas/models/AvailabilityMethod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.squareup.moshi.Json
enum class AvailabilityMethod {
@Json(name = "max-fairness")
MAX_FAIRNESS,

@Json(name = "max-availability")
MAX_AVAILABILITY,
}
}
4 changes: 3 additions & 1 deletion src/main/kotlin/com/nylas/models/EventStatus.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import com.squareup.moshi.Json
enum class EventStatus {
@Json(name = "confirmed")
CONFIRMED,

@Json(name = "tentative")
TENTATIVE,

@Json(name = "cancelled")
CANCELLED,
}
}
8 changes: 4 additions & 4 deletions src/main/kotlin/com/nylas/models/GetAvailabilityRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ data class GetAvailabilityRequest(
* @param durationMinutes The total number of minutes the event should last.
*/
data class Builder(
private val startTime: String,
private val endTime: String,
private val startTime: Int,
private val endTime: Int,
private val participants: List<AvailabilityParticipant>,
private val durationMinutes: Int,
) {
Expand Down Expand Up @@ -98,7 +98,7 @@ data class GetAvailabilityRequest(
durationMinutes,
intervalMinutes,
roundTo30Minutes,
availabilityRules
availabilityRules,
)
}
}
}
1 change: 0 additions & 1 deletion src/main/kotlin/com/nylas/models/ListGrantsQueryParams.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ data class ListGrantsQueryParams(
*/
fun provider(provider: AuthProvider?) = apply { this.provider = provider }


/**
* Builds a [ListGrantsQueryParams] instance.
* @return The [ListGrantsQueryParams] instance.
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/nylas/models/TimeSlot.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ data class TimeSlot(
*/
@Json(name = "end_time")
val endTime: Int,
)
)
1 change: 0 additions & 1 deletion src/main/kotlin/com/nylas/models/UpdateGrantRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ data class UpdateGrantRequest(
*/
fun scopes(scopes: List<String>) = apply { this.scopes = scopes }


/**
* Build the [UpdateGrantRequest].
* @return The built [UpdateGrantRequest]
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/nylas/models/Webhook.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ data class Webhook(
*/
@Json(name = "notification_email_address")
val notificationEmailAddress: String? = null,
)
)
5 changes: 4 additions & 1 deletion src/main/kotlin/com/nylas/models/WebhookStatus.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@ import com.squareup.moshi.Json
enum class WebhookStatus {
@Json(name = "active")
ACTIVE,

@Json(name = "failing")
FAILING,

@Json(name = "failed")
FAILED,

@Json(name = "paused")
PAUSE,
}
}
13 changes: 12 additions & 1 deletion src/main/kotlin/com/nylas/models/WebhookTriggers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,37 @@ import com.squareup.moshi.Json
enum class WebhookTriggers {
@Json(name = "calendar.created")
CALENDAR_CREATED,

@Json(name = "calendar.updated")
CALENDAR_UPDATED,

@Json(name = "calendar.deleted")
CALENDAR_DELETED,

@Json(name = "event.created")
EVENT_CREATED,

@Json(name = "event.updated")
EVENT_UPDATED,

@Json(name = "event.deleted")
EVENT_DELETED,

@Json(name = "grant.created")
GRANT_CREATED,

@Json(name = "grant.updated")
GRANT_UPDATED,

@Json(name = "grant.deleted")
GRANT_DELETED,

@Json(name = "grant.expired")
GRANT_EXPIRED,

@Json(name = "message.send_success")
MESSAGE_SEND_SUCCESS,

@Json(name = "message.send_failed")
MESSAGE_SEND_FAILED,
}
}
2 changes: 1 addition & 1 deletion src/main/kotlin/com/nylas/resources/Calendars.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Calendars(client: NylasClient) : Resource<Calendar>(client, Calendar::clas

val serializedRequestBody = JsonHelper.moshi()
.adapter(GetAvailabilityRequest::class.java)
.toJson(request);
.toJson(request)

return client.executePost(path, GetAvailabilityResponse::class.java, serializedRequestBody)
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/nylas/resources/Webhooks.kt
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ class Webhooks(client: NylasClient) : Resource<Webhook>(client, Webhook::class.j

return challengeParameter
}
}
}

0 comments on commit 623b672

Please sign in to comment.