diff --git a/.editorconfig b/.editorconfig index 28404d8b..82cefe7b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,7 @@ root = true [*.{kt,kts}] +ktlint_code_style = intellij_idea indent_size = 2 indent_style = space ktlint_standard_no-wildcard-imports = disabled diff --git a/src/main/kotlin/com/nylas/interceptors/HttpLoggingInterceptor.kt b/src/main/kotlin/com/nylas/interceptors/HttpLoggingInterceptor.kt index aa0cb0dc..91ae0432 100644 --- a/src/main/kotlin/com/nylas/interceptors/HttpLoggingInterceptor.kt +++ b/src/main/kotlin/com/nylas/interceptors/HttpLoggingInterceptor.kt @@ -145,10 +145,13 @@ class HttpLoggingInterceptor : Interceptor { (truncated ${buf.size} byte body after $bytesToLog bytes)""" } val charset = contentType!!.charset(StandardCharsets.UTF_8) - return """ + val str = + """ $prefix ${buf.readString(bytesToLog, charset!!)}$truncationMessage - """.trimIndent() + """.trimIndent() + + return str } private fun getContentLength(response: Response?): Long { diff --git a/src/main/kotlin/com/nylas/models/Connector.kt b/src/main/kotlin/com/nylas/models/Connector.kt index 20ee20d0..62eb9060 100644 --- a/src/main/kotlin/com/nylas/models/Connector.kt +++ b/src/main/kotlin/com/nylas/models/Connector.kt @@ -57,10 +57,11 @@ sealed class Connector( companion object { @JvmStatic - val CONNECTOR_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory = PolymorphicJsonAdapterFactory.of(Connector::class.java, "provider") - .withSubtype(Google::class.java, AuthProvider.GOOGLE.value) - .withSubtype(Microsoft::class.java, AuthProvider.MICROSOFT.value) - .withSubtype(Imap::class.java, AuthProvider.IMAP.value) - .withSubtype(VirtualCalendar::class.java, AuthProvider.VIRTUAL_CALENDAR.value) + val CONNECTOR_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory = + PolymorphicJsonAdapterFactory.of(Connector::class.java, "provider") + .withSubtype(Google::class.java, AuthProvider.GOOGLE.value) + .withSubtype(Microsoft::class.java, AuthProvider.MICROSOFT.value) + .withSubtype(Imap::class.java, AuthProvider.IMAP.value) + .withSubtype(VirtualCalendar::class.java, AuthProvider.VIRTUAL_CALENDAR.value) } } diff --git a/src/main/kotlin/com/nylas/models/CreateConnectorRequest.kt b/src/main/kotlin/com/nylas/models/CreateConnectorRequest.kt index 5a4eb416..7e86c881 100644 --- a/src/main/kotlin/com/nylas/models/CreateConnectorRequest.kt +++ b/src/main/kotlin/com/nylas/models/CreateConnectorRequest.kt @@ -103,10 +103,11 @@ sealed class CreateConnectorRequest( companion object { @JvmStatic - val CREATE_CONNECTOR_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory = PolymorphicJsonAdapterFactory.of(CreateConnectorRequest::class.java, "provider") - .withSubtype(Google::class.java, AuthProvider.GOOGLE.value) - .withSubtype(Microsoft::class.java, AuthProvider.MICROSOFT.value) - .withSubtype(Imap::class.java, AuthProvider.IMAP.value) - .withSubtype(VirtualCalendar::class.java, AuthProvider.VIRTUAL_CALENDAR.value) + val CREATE_CONNECTOR_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory = + PolymorphicJsonAdapterFactory.of(CreateConnectorRequest::class.java, "provider") + .withSubtype(Google::class.java, AuthProvider.GOOGLE.value) + .withSubtype(Microsoft::class.java, AuthProvider.MICROSOFT.value) + .withSubtype(Imap::class.java, AuthProvider.IMAP.value) + .withSubtype(VirtualCalendar::class.java, AuthProvider.VIRTUAL_CALENDAR.value) } } diff --git a/src/main/kotlin/com/nylas/models/CreateCredentialRequest.kt b/src/main/kotlin/com/nylas/models/CreateCredentialRequest.kt index 4dc0727a..946bf777 100644 --- a/src/main/kotlin/com/nylas/models/CreateCredentialRequest.kt +++ b/src/main/kotlin/com/nylas/models/CreateCredentialRequest.kt @@ -73,9 +73,10 @@ sealed class CreateCredentialRequest( companion object { @JvmStatic - val CREATE_CREDENTIAL_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory = PolymorphicJsonAdapterFactory.of(CreateCredentialRequest::class.java, "credential_type") - .withSubtype(Microsoft::class.java, CredentialType.ADMINCONSENT.value) - .withSubtype(Google::class.java, CredentialType.SERVICEACCOUNT.value) - .withSubtype(Override::class.java, CredentialType.CONNECTOR.value) + val CREATE_CREDENTIAL_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory = + PolymorphicJsonAdapterFactory.of(CreateCredentialRequest::class.java, "credential_type") + .withSubtype(Microsoft::class.java, CredentialType.ADMINCONSENT.value) + .withSubtype(Google::class.java, CredentialType.SERVICEACCOUNT.value) + .withSubtype(Override::class.java, CredentialType.CONNECTOR.value) } } diff --git a/src/main/kotlin/com/nylas/models/CreateWebhookRequest.kt b/src/main/kotlin/com/nylas/models/CreateWebhookRequest.kt index 77566cba..3f35cabf 100644 --- a/src/main/kotlin/com/nylas/models/CreateWebhookRequest.kt +++ b/src/main/kotlin/com/nylas/models/CreateWebhookRequest.kt @@ -51,7 +51,9 @@ data class CreateWebhookRequest( * @param notificationEmailAddresses The email addresses that Nylas notifies when a webhook is down for a while. * @return The builder. */ - fun notificationEmailAddresses(notificationEmailAddresses: List?) = apply { this.notificationEmailAddresses = notificationEmailAddresses } + fun notificationEmailAddresses(notificationEmailAddresses: List?) = apply { + this.notificationEmailAddresses = notificationEmailAddresses + } /** * Build the [CreateWebhookRequest]. diff --git a/src/main/kotlin/com/nylas/models/UpdateWebhookRequest.kt b/src/main/kotlin/com/nylas/models/UpdateWebhookRequest.kt index fbbc16ff..bf9ffdd3 100644 --- a/src/main/kotlin/com/nylas/models/UpdateWebhookRequest.kt +++ b/src/main/kotlin/com/nylas/models/UpdateWebhookRequest.kt @@ -62,7 +62,9 @@ data class UpdateWebhookRequest( * @param notificationEmailAddresses The email addresses that Nylas notifies when a webhook is down for a while. * @return The builder. */ - fun notificationEmailAddresses(notificationEmailAddresses: List?) = apply { this.notificationEmailAddresses = notificationEmailAddresses } + fun notificationEmailAddresses(notificationEmailAddresses: List?) = apply { + this.notificationEmailAddresses = notificationEmailAddresses + } /** * Build the [UpdateWebhookRequest]. diff --git a/src/test/kotlin/com/nylas/resources/EventsTests.kt b/src/test/kotlin/com/nylas/resources/EventsTests.kt index 7788d073..506dfc34 100644 --- a/src/test/kotlin/com/nylas/resources/EventsTests.kt +++ b/src/test/kotlin/com/nylas/resources/EventsTests.kt @@ -222,12 +222,12 @@ class EventsTests { val createEventRequest = CreateEventRequest( whenObj = - CreateEventRequest.When.Timespan( - startTime = 1620000000, - endTime = 1620000000, - startTimezone = "America/Los_Angeles", - endTimezone = "America/Los_Angeles", - ), + CreateEventRequest.When.Timespan( + startTime = 1620000000, + endTime = 1620000000, + startTimezone = "America/Los_Angeles", + endTimezone = "America/Los_Angeles", + ), description = "Description of my new event", location = "Los Angeles, CA", metadata = mapOf("your-key" to "value"),