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

release: 0.25.0 #131

Merged
merged 3 commits into from
Jan 17, 2024
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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.24.0"
".": "0.25.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
configured_endpoints: 105
configured_endpoints: 106
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.25.0 (2024-01-17)

Full Changelog: [v0.24.0...v0.25.0](https://github.com/lithic-com/lithic-kotlin/compare/v0.24.0...v0.25.0)

### Features

* **api:** updates ([#132](https://github.com/lithic-com/lithic-kotlin/issues/132)) ([15c7f5c](https://github.com/lithic-com/lithic-kotlin/commit/15c7f5ca6ab00326cc67de2a63a90b1898ce1cb7))


### Documentation

* **readme:** improve api reference ([#130](https://github.com/lithic-com/lithic-kotlin/issues/130)) ([23ba154](https://github.com/lithic-com/lithic-kotlin/commit/23ba154b9ee55aeea1663247138b161215af48eb))

## 0.24.0 (2024-01-09)

Full Changelog: [v0.23.0...v0.24.0](https://github.com/lithic-com/lithic-kotlin/compare/v0.23.0...v0.24.0)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The Lithic Kotlin SDK is similar to the Lithic Java SDK but with minor differenc

## Documentation

The API documentation can be found [here](https://docs.lithic.com).
The REST API documentation can be found [on docs.lithic.com](https://docs.lithic.com). The full API of this library can be found in [api.md](https://www.github.com/lithic-com/lithic-kotlin/blob/main/api.md).

---

Expand All @@ -19,7 +19,7 @@ The API documentation can be found [here](https://docs.lithic.com).
<!-- x-release-please-start-version -->

```kotlin
implementation("com.lithic.api:lithic-kotlin:0.24.0")
implementation("com.lithic.api:lithic-kotlin:0.25.0")
```

#### Maven
Expand All @@ -28,7 +28,7 @@ implementation("com.lithic.api:lithic-kotlin:0.24.0")
<dependency>
<groupId>com.lithic.api</groupId>
<artifactId>lithic-kotlin</artifactId>
<version>0.24.0</version>
<version>0.25.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

allprojects {
group = "com.lithic.api"
version = "0.24.0" // x-release-please-version
version = "0.25.0" // x-release-please-version
}

nexusPublishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private constructor(
fun statusReasons(): List<StatusReason>? = statusReasons.getNullable("status_reasons")

/** Globally unique identifier for the account holder. */
fun token(): String? = token.getNullable("token")
fun token(): String = token.getRequired("token")

/**
* The type of Account Holder. If the type is "INDIVIDUAL", the "individual" attribute will be
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
// File generated from our OpenAPI spec by Stainless.

package com.lithic.api.models

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.lithic.api.core.ExcludeMissing
import com.lithic.api.core.JsonField
import com.lithic.api.core.JsonMissing
import com.lithic.api.core.JsonValue
import com.lithic.api.core.NoAutoDetect
import com.lithic.api.core.toUnmodifiable
import com.lithic.api.services.blocking.AccountHolderService
import java.util.Objects

class AccountHolderListPage
private constructor(
private val accountHoldersService: AccountHolderService,
private val params: AccountHolderListParams,
private val response: Response,
) {

fun response(): Response = response

fun data(): List<AccountHolder> = response().data()

fun hasMore(): Boolean = response().hasMore()

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is AccountHolderListPage &&
this.accountHoldersService == other.accountHoldersService &&
this.params == other.params &&
this.response == other.response
}

override fun hashCode(): Int {
return Objects.hash(
accountHoldersService,
params,
response,
)
}

override fun toString() =
"AccountHolderListPage{accountHoldersService=$accountHoldersService, params=$params, response=$response}"

fun hasNextPage(): Boolean {
return data().isEmpty()
}

fun getNextPageParams(): AccountHolderListParams? {
return null
}

fun getNextPage(): AccountHolderListPage? {
return getNextPageParams()?.let { accountHoldersService.list(it) }
}

fun autoPager(): AutoPager = AutoPager(this)

companion object {

fun of(
accountHoldersService: AccountHolderService,
params: AccountHolderListParams,
response: Response
) =
AccountHolderListPage(
accountHoldersService,
params,
response,
)
}

@JsonDeserialize(builder = Response.Builder::class)
@NoAutoDetect
class Response
constructor(
private val data: JsonField<List<AccountHolder>>,
private val hasMore: JsonField<Boolean>,
private val additionalProperties: Map<String, JsonValue>,
) {

private var validated: Boolean = false

fun data(): List<AccountHolder> = data.getNullable("data") ?: listOf()

fun hasMore(): Boolean = hasMore.getRequired("has_more")

@JsonProperty("data") fun _data(): JsonField<List<AccountHolder>>? = data

@JsonProperty("has_more") fun _hasMore(): JsonField<Boolean>? = hasMore

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

fun validate(): Response = apply {
if (!validated) {
data().map { it.validate() }
hasMore()
validated = true
}
}

fun toBuilder() = Builder().from(this)

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is Response &&
this.data == other.data &&
this.hasMore == other.hasMore &&
this.additionalProperties == other.additionalProperties
}

override fun hashCode(): Int {
return Objects.hash(
data,
hasMore,
additionalProperties,
)
}

override fun toString() =
"AccountHolderListPage.Response{data=$data, hasMore=$hasMore, additionalProperties=$additionalProperties}"

companion object {

fun builder() = Builder()
}

class Builder {

private var data: JsonField<List<AccountHolder>> = JsonMissing.of()
private var hasMore: JsonField<Boolean> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

internal fun from(page: Response) = apply {
this.data = page.data
this.hasMore = page.hasMore
this.additionalProperties.putAll(page.additionalProperties)
}

fun data(data: List<AccountHolder>) = data(JsonField.of(data))

@JsonProperty("data")
fun data(data: JsonField<List<AccountHolder>>) = apply { this.data = data }

fun hasMore(hasMore: Boolean) = hasMore(JsonField.of(hasMore))

@JsonProperty("has_more")
fun hasMore(hasMore: JsonField<Boolean>) = apply { this.hasMore = hasMore }

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}

fun build() =
Response(
data,
hasMore,
additionalProperties.toUnmodifiable(),
)
}
}

class AutoPager
constructor(
private val firstPage: AccountHolderListPage,
) : Sequence<AccountHolder> {

override fun iterator(): Iterator<AccountHolder> = iterator {
var page = firstPage
var index = 0
while (true) {
while (index < page.data().size) {
yield(page.data()[index++])
}
page = page.getNextPage() ?: break
index = 0
}
}
}
}
Loading