-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v2.0.0-beta' into AV-1451-3-0-beta-java-sdk-beta-test-c…
…overage
- Loading branch information
Showing
34 changed files
with
984 additions
and
51 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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
/** | ||
* Class representation of a Nylas contact object | ||
*/ | ||
data class Contact( | ||
@Json(name = "id") | ||
val id: String = "", | ||
@Json(name = "grant_id") | ||
val grantId: String = "", | ||
@Json(name = "object") | ||
private val obj: String = "contact", | ||
@Json(name = "birthday") | ||
val birthday: String? = null, | ||
@Json(name = "company_name") | ||
val companyName: String? = null, | ||
@Json(name = "display_name") | ||
val displayName: String = "", | ||
@Json(name = "emails") | ||
val emails: List<ContactEmail>? = null, | ||
@Json(name = "im_addresses") | ||
val imAddresses: List<InstantMessagingAddress>? = null, | ||
@Json(name = "given_name") | ||
val givenName: String? = null, | ||
@Json(name = "job_title") | ||
val jobTitle: String? = null, | ||
@Json(name = "manager_name") | ||
val managerName: String? = null, | ||
@Json(name = "middle_name") | ||
val middleName: String? = null, | ||
@Json(name = "nickname") | ||
val nickname: String? = null, | ||
@Json(name = "notes") | ||
val notes: String? = null, | ||
@Json(name = "office_location") | ||
val officeLocation: String? = null, | ||
@Json(name = "picture_url") | ||
val pictureUrl: String? = null, | ||
@Json(name = "picture") | ||
val picture: String? = null, | ||
@Json(name = "suffix") | ||
val suffix: String? = null, | ||
@Json(name = "surname") | ||
val surname: String? = null, | ||
@Json(name = "source") | ||
val source: SourceType? = null, | ||
@Json(name = "phone_numbers") | ||
val phoneNumbers: List<PhoneNumber>? = null, | ||
@Json(name = "physical_addresses") | ||
val physicalAddresses: List<PhysicalAddress>? = null, | ||
@Json(name = "web_pages") | ||
val webPages: List<WebPage>? = null, | ||
@Json(name = "groups") | ||
val groups: List<ContactGroupId>? = null, | ||
) { | ||
fun getObject() = obj | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.nylas.models | ||
|
||
/** | ||
* Interface for email addresses in a contact. | ||
*/ | ||
data class ContactEmail( | ||
val email: String? = null, | ||
val type: ContactType? = null, | ||
) { | ||
class Builder { | ||
private var email: String? = null | ||
private var type: ContactType? = null | ||
|
||
fun email(email: String) = apply { this.email = email } | ||
fun type(type: ContactType) = apply { this.type = type } | ||
fun build() = ContactEmail(email, type) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.nylas.models | ||
|
||
/** | ||
* Class representing a contact group. | ||
*/ | ||
data class ContactGroup( | ||
val id: String, | ||
val grantId: String? = null, | ||
val groupType: GroupType? = null, | ||
val name: String? = null, | ||
val path: String? = null, | ||
private val obj: String = "contact_group", | ||
) { | ||
fun getObject() = obj | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.nylas.models | ||
|
||
/** | ||
* Class representing an object that points to a contact group ID. | ||
*/ | ||
data class ContactGroupId( | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
enum class ContactType { | ||
@Json(name = "work") | ||
WORK, | ||
|
||
@Json(name = "home") | ||
HOME, | ||
|
||
@Json(name = "other") | ||
OTHER, | ||
|
||
@Json(name = "mobile") | ||
MOBILE, | ||
} |
113 changes: 113 additions & 0 deletions
113
src/main/kotlin/com/nylas/models/CreateContactRequest.kt
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 |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
data class CreateContactRequest( | ||
@Json(name = "display_name") | ||
val displayName: String? = null, | ||
@Json(name = "birthday") | ||
val birthday: String? = null, | ||
@Json(name = "company_name") | ||
val companyName: String? = null, | ||
@Json(name = "emails") | ||
val emails: List<ContactEmail>? = null, | ||
@Json(name = "given_name") | ||
val givenName: String? = null, | ||
@Json(name = "im_addresses") | ||
val imAddresses: List<InstantMessagingAddress>? = null, | ||
@Json(name = "job_title") | ||
val jobTitle: String? = null, | ||
@Json(name = "manager_name") | ||
val managerName: String? = null, | ||
@Json(name = "middle_name") | ||
val middleName: String? = null, | ||
@Json(name = "nickname") | ||
val nickname: String? = null, | ||
@Json(name = "notes") | ||
val notes: String? = null, | ||
@Json(name = "office_location") | ||
val officeLocation: String? = null, | ||
@Json(name = "phone_numbers") | ||
val phoneNumbers: List<PhoneNumber>? = null, | ||
@Json(name = "physical_addresses") | ||
val physicalAddresses: List<PhysicalAddress>? = null, | ||
@Json(name = "suffix") | ||
val suffix: String? = null, | ||
@Json(name = "surname") | ||
val surname: String? = null, | ||
@Json(name = "web_pages") | ||
val webPages: List<WebPage>? = null, | ||
@Json(name = "picture") | ||
val picture: String? = null, | ||
@Json(name = "source") | ||
val source: SourceType? = null, | ||
@Json(name = "groups") | ||
val groups: List<ContactGroupId>? = null, | ||
) { | ||
class Builder { | ||
private var displayName: String? = null | ||
private var birthday: String? = null | ||
private var companyName: String? = null | ||
private var emails: List<ContactEmail>? = null | ||
private var givenName: String? = null | ||
private var imAddresses: List<InstantMessagingAddress>? = null | ||
private var jobTitle: String? = null | ||
private var managerName: String? = null | ||
private var middleName: String? = null | ||
private var nickname: String? = null | ||
private var notes: String? = null | ||
private var officeLocation: String? = null | ||
private var phoneNumbers: List<PhoneNumber>? = null | ||
private var physicalAddresses: List<PhysicalAddress>? = null | ||
private var suffix: String? = null | ||
private var surname: String? = null | ||
private var webPages: List<WebPage>? = null | ||
private var picture: String? = null | ||
private var source: SourceType? = null | ||
private var groups: List<ContactGroupId>? = null | ||
|
||
fun displayName(displayName: String?) = apply { this.displayName = displayName } | ||
fun birthday(birthday: String?) = apply { this.birthday = birthday } | ||
fun companyName(companyName: String?) = apply { this.companyName = companyName } | ||
fun emails(emails: List<ContactEmail>?) = apply { this.emails = emails } | ||
fun givenName(givenName: String?) = apply { this.givenName = givenName } | ||
fun imAddresses(imAddresses: List<InstantMessagingAddress>?) = apply { this.imAddresses = imAddresses } | ||
fun jobTitle(jobTitle: String?) = apply { this.jobTitle = jobTitle } | ||
fun managerName(managerName: String?) = apply { this.managerName = managerName } | ||
fun middleName(middleName: String?) = apply { this.middleName = middleName } | ||
fun nickname(nickname: String?) = apply { this.nickname = nickname } | ||
fun notes(notes: String?) = apply { this.notes = notes } | ||
fun officeLocation(officeLocation: String?) = apply { this.officeLocation = officeLocation } | ||
fun phoneNumbers(phoneNumbers: List<PhoneNumber>?) = apply { this.phoneNumbers = phoneNumbers } | ||
fun physicalAddresses(physicalAddresses: List<PhysicalAddress>?) = apply { this.physicalAddresses = physicalAddresses } | ||
fun suffix(suffix: String?) = apply { this.suffix = suffix } | ||
fun surname(surname: String?) = apply { this.surname = surname } | ||
fun webPages(webPages: List<WebPage>?) = apply { this.webPages = webPages } | ||
fun picture(picture: String?) = apply { this.picture = picture } | ||
fun source(source: SourceType?) = apply { this.source = source } | ||
fun groups(groups: List<ContactGroupId>?) = apply { this.groups = groups } | ||
|
||
fun build() = CreateContactRequest( | ||
displayName = displayName, | ||
birthday = birthday, | ||
companyName = companyName, | ||
emails = emails, | ||
givenName = givenName, | ||
imAddresses = imAddresses, | ||
jobTitle = jobTitle, | ||
managerName = managerName, | ||
middleName = middleName, | ||
nickname = nickname, | ||
notes = notes, | ||
officeLocation = officeLocation, | ||
phoneNumbers = phoneNumbers, | ||
physicalAddresses = physicalAddresses, | ||
suffix = suffix, | ||
surname = surname, | ||
webPages = webPages, | ||
picture = picture, | ||
source = source, | ||
groups = groups, | ||
) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
data class FindContactQueryParams( | ||
@Json(name = "profile_picture") | ||
val profilePicture: Boolean? = null, | ||
) : IQueryParams |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
enum class GroupType { | ||
@Json(name = "user") | ||
USER, | ||
|
||
@Json(name = "system") | ||
SYSTEM, | ||
|
||
@Json(name = "other") | ||
OTHER, | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/nylas/models/InstantMessagingAddress.kt
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.nylas.models | ||
|
||
/** | ||
* Class representation for an IM address in a contact. | ||
*/ | ||
data class InstantMessagingAddress( | ||
val imAddress: String? = null, | ||
val type: ContactType? = null, | ||
) { | ||
class Builder { | ||
private var imAddress: String? = null | ||
private var type: ContactType? = null | ||
|
||
fun imAddress(imAddress: String) = apply { this.imAddress = imAddress } | ||
fun type(type: ContactType) = apply { this.type = type } | ||
fun build() = InstantMessagingAddress(imAddress, type) | ||
} | ||
} |
Oops, something went wrong.