-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Complete resources testing + fixes (#192)
# Description This PR brings the test coverage of the resources module to 100%. Fixes include: * Added additional enum support for Grants * Fixed various issues with the connector API * Fixed response type for smart compose methods * Fixed inaccuracies with webhook related models # 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: Blag <[email protected]>
- Loading branch information
1 parent
2d19f3c
commit 3f18ace
Showing
62 changed files
with
3,843 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
/** | ||
* Class representing a request to compose a message. | ||
*/ | ||
data class ComposeMessageRequest( | ||
/** | ||
* The prompt that smart compose will use to generate a message suggestion. | ||
*/ | ||
@Json(name = "prompt") | ||
val prompt: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
/** | ||
* Class representing a response to a message composition request. | ||
*/ | ||
data class ComposeMessageResponse( | ||
/** | ||
* The message suggestion generated by smart compose. | ||
*/ | ||
@Json(name = "suggestion") | ||
val suggestion: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,66 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
import com.squareup.moshi.adapters.PolymorphicJsonAdapterFactory | ||
|
||
/** | ||
* Class representation of the Nylas connector response. | ||
*/ | ||
data class Connector( | ||
/** | ||
* Custom name of the connector | ||
*/ | ||
@Json(name = "name") | ||
val name: String, | ||
sealed class Connector( | ||
/** | ||
* The provider type | ||
*/ | ||
@Json(name = "provider") | ||
val provider: AuthProvider, | ||
) { | ||
/** | ||
* Class representing a Google connector creation request. | ||
*/ | ||
data class Google( | ||
/** | ||
* The Google OAuth provider credentials and settings | ||
*/ | ||
@Json(name = "settings") | ||
val settings: GoogleConnectorSettings, | ||
/** | ||
* The Google OAuth scopes | ||
*/ | ||
@Json(name = "scope") | ||
val scope: List<String>? = null, | ||
) : Connector(AuthProvider.GOOGLE) | ||
|
||
/** | ||
* Optional settings from provider | ||
* Class representing a Microsoft connector creation request. | ||
*/ | ||
@Json(name = "settings") | ||
val settings: Map<String, Any>? = null, | ||
data class Microsoft( | ||
/** | ||
* The Microsoft OAuth provider credentials and settings | ||
*/ | ||
@Json(name = "settings") | ||
val settings: MicrosoftConnectorSettings, | ||
/** | ||
* The Microsoft OAuth scopes | ||
*/ | ||
@Json(name = "scope") | ||
val scope: List<String>? = null, | ||
) : Connector(AuthProvider.MICROSOFT) | ||
|
||
/** | ||
* Default scopes for the connector | ||
* Class representing an IMAP connector creation request. | ||
*/ | ||
@Json(name = "scope") | ||
val scope: List<String>? = null, | ||
) | ||
class Imap : Connector(AuthProvider.IMAP) | ||
|
||
/** | ||
* Class representing a virtual calendar connector creation request. | ||
*/ | ||
class VirtualCalendar : Connector(AuthProvider.VIRTUAL_CALENDAR) | ||
|
||
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
/** | ||
* Class representing an object that points to a contact group ID. | ||
*/ | ||
data class ContactGroupId( | ||
/** | ||
* The ID of the contact group. | ||
*/ | ||
@Json(name = "id") | ||
val id: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.