Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: unreleased changes #60

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ IncreaseClient client = IncreaseOkHttpClient.builder()

### Timeouts

Requests time out after 60 seconds by default. You can configure this on the client builder:
Requests time out after 1 minute by default. You can configure this on the client builder:

```java
IncreaseClient client = IncreaseOkHttpClient.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class IncreaseOkHttpClient private constructor() {

private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var baseUrl: String = ClientOptions.PRODUCTION_URL
// default timeout for client is 1 minute
private var timeout: Duration = Duration.ofSeconds(60)
private var proxy: Proxy? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class IncreaseOkHttpClientAsync private constructor() {

private var clientOptions: ClientOptions.Builder = ClientOptions.builder()
private var baseUrl: String = ClientOptions.PRODUCTION_URL
// default timeout for client is 1 minute
private var timeout: Duration = Duration.ofSeconds(60)
private var proxy: Proxy? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val

private fun getClient(requestOptions: RequestOptions): okhttp3.OkHttpClient {
val timeout = requestOptions.timeout ?: return okHttpClient
return okHttpClient.newBuilder().callTimeout(timeout).build()
return okHttpClient
.newBuilder()
.connectTimeout(timeout)
.readTimeout(timeout)
.writeTimeout(timeout)
.callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30))
.build()
}

override fun execute(
Expand Down Expand Up @@ -165,7 +171,8 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val
class Builder {

private var baseUrl: HttpUrl? = null
private var timeout: Duration = Duration.ofMinutes(5)
// default timeout is 1 minute
private var timeout: Duration = Duration.ofSeconds(60)
private var proxy: Proxy? = null

fun baseUrl(baseUrl: String) = apply { this.baseUrl = baseUrl.toHttpUrl() }
Expand All @@ -176,7 +183,13 @@ private constructor(private val okHttpClient: okhttp3.OkHttpClient, private val

fun build(): OkHttpClient {
return OkHttpClient(
okhttp3.OkHttpClient.Builder().callTimeout(timeout).proxy(proxy).build(),
okhttp3.OkHttpClient.Builder()
.connectTimeout(timeout)
.readTimeout(timeout)
.writeTimeout(timeout)
.callTimeout(if (timeout.seconds == 0L) timeout else timeout.plusSeconds(30))
.proxy(proxy)
.build(),
checkNotNull(baseUrl) { "`baseUrl` is required but was not set" },
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ constructor(

private var date: OffsetDateTime? = null
private var transactionId: String? = null
private var entries: List<Entry>? = null
private var entries: MutableList<Entry> = mutableListOf()
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()
Expand All @@ -217,7 +217,7 @@ constructor(
apply {
this.date = bookkeepingEntrySetCreateParams.date
this.transactionId = bookkeepingEntrySetCreateParams.transactionId
this.entries = bookkeepingEntrySetCreateParams.entries
this.entries(bookkeepingEntrySetCreateParams.entries)
additionalQueryParams(bookkeepingEntrySetCreateParams.additionalQueryParams)
additionalHeaders(bookkeepingEntrySetCreateParams.additionalHeaders)
additionalBodyProperties(bookkeepingEntrySetCreateParams.additionalBodyProperties)
Expand All @@ -233,7 +233,13 @@ constructor(
fun transactionId(transactionId: String) = apply { this.transactionId = transactionId }

/** The bookkeeping entries. */
fun entries(entries: List<Entry>) = apply { this.entries = entries }
fun entries(entries: List<Entry>) = apply {
this.entries.clear()
this.entries.addAll(entries)
}

/** The bookkeeping entries. */
fun addEntry(entry: Entry) = apply { this.entries.add(entry) }

fun additionalQueryParams(additionalQueryParams: Map<String, List<String>>) = apply {
this.additionalQueryParams.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ constructor(
private var trust: Trust? = null
private var description: String? = null
private var relationship: Relationship? = null
private var supplementalDocuments: List<SupplementalDocument>? = null
private var supplementalDocuments: MutableList<SupplementalDocument> = mutableListOf()
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()
Expand All @@ -343,7 +343,7 @@ constructor(
this.trust = entityCreateParams.trust
this.description = entityCreateParams.description
this.relationship = entityCreateParams.relationship
this.supplementalDocuments = entityCreateParams.supplementalDocuments
this.supplementalDocuments(entityCreateParams.supplementalDocuments ?: listOf())
additionalQueryParams(entityCreateParams.additionalQueryParams)
additionalHeaders(entityCreateParams.additionalHeaders)
additionalBodyProperties(entityCreateParams.additionalBodyProperties)
Expand Down Expand Up @@ -382,7 +382,13 @@ constructor(

/** Additional documentation associated with the entity. */
fun supplementalDocuments(supplementalDocuments: List<SupplementalDocument>) = apply {
this.supplementalDocuments = supplementalDocuments
this.supplementalDocuments.clear()
this.supplementalDocuments.addAll(supplementalDocuments)
}

/** Additional documentation associated with the entity. */
fun addSupplementalDocument(supplementalDocument: SupplementalDocument) = apply {
this.supplementalDocuments.add(supplementalDocument)
}

fun additionalQueryParams(additionalQueryParams: Map<String, List<String>>) = apply {
Expand Down Expand Up @@ -448,7 +454,8 @@ constructor(
trust,
description,
checkNotNull(relationship) { "`relationship` is required but was not set" },
supplementalDocuments?.toUnmodifiable(),
if (supplementalDocuments.size == 0) null
else supplementalDocuments.toUnmodifiable(),
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
additionalBodyProperties.toUnmodifiable(),
Expand Down
3 changes: 3 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
"hidden": true
}
],
"reviewers": [
"rattrayalex"
],
"release-type": "simple",
"extra-files": [
"README.md",
Expand Down