-
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.
Merge branch 'main' into TW-2895-kotlin-gh-222-attachments-not-send-w…
…hen-3-mb
- Loading branch information
Showing
40 changed files
with
744 additions
and
220 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,36 @@ | ||
package com.nylas.models | ||
|
||
import com.squareup.moshi.Json | ||
|
||
/** | ||
* Custom headers to be used when drafting or sending an email. | ||
*/ | ||
data class CustomHeader( | ||
/** | ||
* The name of the custom header. | ||
*/ | ||
@Json(name = "name") | ||
val name: String, | ||
/** | ||
* The value of the custom header. | ||
*/ | ||
@Json(name = "value") | ||
val value: String, | ||
) { | ||
/** | ||
* Builder for [CustomHeader]. | ||
* @property name The name of the custom header. | ||
* @property value The value of the custom header. | ||
*/ | ||
data class Builder( | ||
private val name: String, | ||
private val value: String, | ||
) { | ||
/** | ||
* Build the [CustomHeader] object. | ||
*/ | ||
fun build(): CustomHeader { | ||
return CustomHeader(name, 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.nylas.models | ||
|
||
/** | ||
* Overrides to use for an outgoing request to the Nylas API. | ||
*/ | ||
data class RequestOverrides( | ||
/** | ||
* The API key to use for the request. | ||
*/ | ||
val apiKey: String? = null, | ||
/** | ||
* The API URI to use for the request. | ||
*/ | ||
val apiUri: String? = null, | ||
/** | ||
* The timeout to use for the request. | ||
*/ | ||
val timeout: Long? = null, | ||
/** | ||
* Additional headers to include in the request. | ||
*/ | ||
val headers: Map<String, String>? = emptyMap(), | ||
) { | ||
/** | ||
* Builder for [RequestOverrides]. | ||
*/ | ||
class Builder { | ||
private var apiKey: String? = null | ||
private var apiUri: String? = null | ||
private var timeout: Long? = null | ||
private var headers: Map<String, String>? = null | ||
|
||
/** | ||
* Set the API key to use for the request. | ||
*/ | ||
fun apiKey(apiKey: String) = apply { this.apiKey = apiKey } | ||
|
||
/** | ||
* Set the API URI to use for the request. | ||
*/ | ||
fun apiUri(apiUri: String) = apply { this.apiUri = apiUri } | ||
|
||
/** | ||
* Set the timeout to use for the request. | ||
*/ | ||
fun timeout(timeout: Long) = apply { this.timeout = timeout } | ||
|
||
/** | ||
* Add additional headers to include in the request. | ||
*/ | ||
fun headers(headers: Map<String, String>) = apply { this.headers = headers } | ||
|
||
/** | ||
* Build the [RequestOverrides]. | ||
*/ | ||
fun build() = RequestOverrides(apiKey, apiUri, timeout, headers) | ||
} | ||
} |
Oops, something went wrong.