Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
mrashed-dev committed Feb 5, 2024
1 parent 0d6f321 commit eb618be
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 24 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 6 additions & 5 deletions src/main/kotlin/com/nylas/models/Connector.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ sealed class Connector(

companion object {
@JvmStatic
val CONNECTOR_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory<Connector> = 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<Connector> =
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)
}
}
11 changes: 6 additions & 5 deletions src/main/kotlin/com/nylas/models/CreateConnectorRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,11 @@ sealed class CreateConnectorRequest(

companion object {
@JvmStatic
val CREATE_CONNECTOR_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory<CreateConnectorRequest> = 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<CreateConnectorRequest> =
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)
}
}
9 changes: 5 additions & 4 deletions src/main/kotlin/com/nylas/models/CreateCredentialRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,10 @@ sealed class CreateCredentialRequest(

companion object {
@JvmStatic
val CREATE_CREDENTIAL_JSON_ADAPTER_FACTORY: PolymorphicJsonAdapterFactory<CreateCredentialRequest> = 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<CreateCredentialRequest> =
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)
}
}
4 changes: 3 additions & 1 deletion src/main/kotlin/com/nylas/models/CreateWebhookRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>?) = apply { this.notificationEmailAddresses = notificationEmailAddresses }
fun notificationEmailAddresses(notificationEmailAddresses: List<String>?) = apply {
this.notificationEmailAddresses = notificationEmailAddresses
}

/**
* Build the [CreateWebhookRequest].
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/com/nylas/models/UpdateWebhookRequest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>?) = apply { this.notificationEmailAddresses = notificationEmailAddresses }
fun notificationEmailAddresses(notificationEmailAddresses: List<String>?) = apply {
this.notificationEmailAddresses = notificationEmailAddresses
}

/**
* Build the [UpdateWebhookRequest].
Expand Down
12 changes: 6 additions & 6 deletions src/test/kotlin/com/nylas/resources/EventsTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit eb618be

Please sign in to comment.