Skip to content

Commit 72ff92c

Browse files
feat(api): add method to fetch the extended credit for a given credit product (#260)
1 parent 0fb6269 commit 72ff92c

19 files changed

Lines changed: 580 additions & 1 deletion

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 127
1+
configured_endpoints: 128

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClient.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ interface LithicClient {
5858

5959
fun bookTransfers(): BookTransferService
6060

61+
fun creditProducts(): CreditProductService
62+
6163
/** Status of api */
6264
@JvmOverloads
6365
fun apiStatus(

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsync.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ interface LithicClientAsync {
5959

6060
fun bookTransfers(): BookTransferServiceAsync
6161

62+
fun creditProducts(): CreditProductServiceAsync
63+
6264
/** Status of api */
6365
@JvmOverloads
6466
fun apiStatus(

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientAsyncImpl.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ constructor(
9494
BookTransferServiceAsyncImpl(clientOptions)
9595
}
9696

97+
private val creditProducts: CreditProductServiceAsync by lazy {
98+
CreditProductServiceAsyncImpl(clientOptions)
99+
}
100+
97101
override fun sync(): LithicClient = sync
98102

99103
override fun accounts(): AccountServiceAsync = accounts
@@ -143,6 +147,8 @@ constructor(
143147

144148
override fun bookTransfers(): BookTransferServiceAsync = bookTransfers
145149

150+
override fun creditProducts(): CreditProductServiceAsync = creditProducts
151+
146152
private val apiStatusHandler: Handler<ApiStatus> =
147153
jsonHandler<ApiStatus>(clientOptions.jsonMapper).withErrorHandler(errorHandler)
148154

lithic-java-core/src/main/kotlin/com/lithic/api/client/LithicClientImpl.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ constructor(
8989
BookTransferServiceImpl(clientOptions)
9090
}
9191

92+
private val creditProducts: CreditProductService by lazy {
93+
CreditProductServiceImpl(clientOptions)
94+
}
95+
9296
override fun async(): LithicClientAsync = async
9397

9498
override fun accounts(): AccountService = accounts
@@ -137,6 +141,8 @@ constructor(
137141

138142
override fun bookTransfers(): BookTransferService = bookTransfers
139143

144+
override fun creditProducts(): CreditProductService = creditProducts
145+
140146
private val apiStatusHandler: Handler<ApiStatus> =
141147
jsonHandler<ApiStatus>(clientOptions.jsonMapper).withErrorHandler(errorHandler)
142148

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.lithic.api.models
4+
5+
import com.lithic.api.core.JsonValue
6+
import com.lithic.api.core.NoAutoDetect
7+
import com.lithic.api.core.toUnmodifiable
8+
import com.lithic.api.models.*
9+
import java.util.Objects
10+
11+
class CreditProductExtendedCreditRetrieveParams
12+
constructor(
13+
private val creditProductId: String,
14+
private val additionalQueryParams: Map<String, List<String>>,
15+
private val additionalHeaders: Map<String, List<String>>,
16+
private val additionalBodyProperties: Map<String, JsonValue>,
17+
) {
18+
19+
fun creditProductId(): String = creditProductId
20+
21+
@JvmSynthetic internal fun getQueryParams(): Map<String, List<String>> = additionalQueryParams
22+
23+
@JvmSynthetic internal fun getHeaders(): Map<String, List<String>> = additionalHeaders
24+
25+
fun getPathParam(index: Int): String {
26+
return when (index) {
27+
0 -> creditProductId
28+
else -> ""
29+
}
30+
}
31+
32+
fun _additionalQueryParams(): Map<String, List<String>> = additionalQueryParams
33+
34+
fun _additionalHeaders(): Map<String, List<String>> = additionalHeaders
35+
36+
fun _additionalBodyProperties(): Map<String, JsonValue> = additionalBodyProperties
37+
38+
override fun equals(other: Any?): Boolean {
39+
if (this === other) {
40+
return true
41+
}
42+
43+
return other is CreditProductExtendedCreditRetrieveParams &&
44+
this.creditProductId == other.creditProductId &&
45+
this.additionalQueryParams == other.additionalQueryParams &&
46+
this.additionalHeaders == other.additionalHeaders &&
47+
this.additionalBodyProperties == other.additionalBodyProperties
48+
}
49+
50+
override fun hashCode(): Int {
51+
return Objects.hash(
52+
creditProductId,
53+
additionalQueryParams,
54+
additionalHeaders,
55+
additionalBodyProperties,
56+
)
57+
}
58+
59+
override fun toString() =
60+
"CreditProductExtendedCreditRetrieveParams{creditProductId=$creditProductId, additionalQueryParams=$additionalQueryParams, additionalHeaders=$additionalHeaders, additionalBodyProperties=$additionalBodyProperties}"
61+
62+
fun toBuilder() = Builder().from(this)
63+
64+
companion object {
65+
66+
@JvmStatic fun builder() = Builder()
67+
}
68+
69+
@NoAutoDetect
70+
class Builder {
71+
72+
private var creditProductId: String? = null
73+
private var additionalQueryParams: MutableMap<String, MutableList<String>> = mutableMapOf()
74+
private var additionalHeaders: MutableMap<String, MutableList<String>> = mutableMapOf()
75+
private var additionalBodyProperties: MutableMap<String, JsonValue> = mutableMapOf()
76+
77+
@JvmSynthetic
78+
internal fun from(
79+
creditProductExtendedCreditRetrieveParams: CreditProductExtendedCreditRetrieveParams
80+
) = apply {
81+
this.creditProductId = creditProductExtendedCreditRetrieveParams.creditProductId
82+
additionalQueryParams(creditProductExtendedCreditRetrieveParams.additionalQueryParams)
83+
additionalHeaders(creditProductExtendedCreditRetrieveParams.additionalHeaders)
84+
additionalBodyProperties(
85+
creditProductExtendedCreditRetrieveParams.additionalBodyProperties
86+
)
87+
}
88+
89+
fun creditProductId(creditProductId: String) = apply {
90+
this.creditProductId = creditProductId
91+
}
92+
93+
fun additionalQueryParams(additionalQueryParams: Map<String, List<String>>) = apply {
94+
this.additionalQueryParams.clear()
95+
putAllQueryParams(additionalQueryParams)
96+
}
97+
98+
fun putQueryParam(name: String, value: String) = apply {
99+
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.add(value)
100+
}
101+
102+
fun putQueryParams(name: String, values: Iterable<String>) = apply {
103+
this.additionalQueryParams.getOrPut(name) { mutableListOf() }.addAll(values)
104+
}
105+
106+
fun putAllQueryParams(additionalQueryParams: Map<String, Iterable<String>>) = apply {
107+
additionalQueryParams.forEach(this::putQueryParams)
108+
}
109+
110+
fun removeQueryParam(name: String) = apply {
111+
this.additionalQueryParams.put(name, mutableListOf())
112+
}
113+
114+
fun additionalHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
115+
this.additionalHeaders.clear()
116+
putAllHeaders(additionalHeaders)
117+
}
118+
119+
fun putHeader(name: String, value: String) = apply {
120+
this.additionalHeaders.getOrPut(name) { mutableListOf() }.add(value)
121+
}
122+
123+
fun putHeaders(name: String, values: Iterable<String>) = apply {
124+
this.additionalHeaders.getOrPut(name) { mutableListOf() }.addAll(values)
125+
}
126+
127+
fun putAllHeaders(additionalHeaders: Map<String, Iterable<String>>) = apply {
128+
additionalHeaders.forEach(this::putHeaders)
129+
}
130+
131+
fun removeHeader(name: String) = apply { this.additionalHeaders.put(name, mutableListOf()) }
132+
133+
fun additionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) = apply {
134+
this.additionalBodyProperties.clear()
135+
this.additionalBodyProperties.putAll(additionalBodyProperties)
136+
}
137+
138+
fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply {
139+
this.additionalBodyProperties.put(key, value)
140+
}
141+
142+
fun putAllAdditionalBodyProperties(additionalBodyProperties: Map<String, JsonValue>) =
143+
apply {
144+
this.additionalBodyProperties.putAll(additionalBodyProperties)
145+
}
146+
147+
fun build(): CreditProductExtendedCreditRetrieveParams =
148+
CreditProductExtendedCreditRetrieveParams(
149+
checkNotNull(creditProductId) { "`creditProductId` is required but was not set" },
150+
additionalQueryParams.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
151+
additionalHeaders.mapValues { it.value.toUnmodifiable() }.toUnmodifiable(),
152+
additionalBodyProperties.toUnmodifiable(),
153+
)
154+
}
155+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.lithic.api.models
4+
5+
import com.fasterxml.jackson.annotation.JsonAnyGetter
6+
import com.fasterxml.jackson.annotation.JsonAnySetter
7+
import com.fasterxml.jackson.annotation.JsonProperty
8+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
9+
import com.lithic.api.core.ExcludeMissing
10+
import com.lithic.api.core.JsonField
11+
import com.lithic.api.core.JsonMissing
12+
import com.lithic.api.core.JsonValue
13+
import com.lithic.api.core.NoAutoDetect
14+
import com.lithic.api.core.toUnmodifiable
15+
import java.util.Objects
16+
17+
@JsonDeserialize(builder = ExtendedCredit.Builder::class)
18+
@NoAutoDetect
19+
class ExtendedCredit
20+
private constructor(
21+
private val creditExtended: JsonField<Long>,
22+
private val additionalProperties: Map<String, JsonValue>,
23+
) {
24+
25+
private var validated: Boolean = false
26+
27+
private var hashCode: Int = 0
28+
29+
fun creditExtended(): Long = creditExtended.getRequired("credit_extended")
30+
31+
@JsonProperty("credit_extended") @ExcludeMissing fun _creditExtended() = creditExtended
32+
33+
@JsonAnyGetter
34+
@ExcludeMissing
35+
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
36+
37+
fun validate(): ExtendedCredit = apply {
38+
if (!validated) {
39+
creditExtended()
40+
validated = true
41+
}
42+
}
43+
44+
fun toBuilder() = Builder().from(this)
45+
46+
override fun equals(other: Any?): Boolean {
47+
if (this === other) {
48+
return true
49+
}
50+
51+
return other is ExtendedCredit &&
52+
this.creditExtended == other.creditExtended &&
53+
this.additionalProperties == other.additionalProperties
54+
}
55+
56+
override fun hashCode(): Int {
57+
if (hashCode == 0) {
58+
hashCode = Objects.hash(creditExtended, additionalProperties)
59+
}
60+
return hashCode
61+
}
62+
63+
override fun toString() =
64+
"ExtendedCredit{creditExtended=$creditExtended, additionalProperties=$additionalProperties}"
65+
66+
companion object {
67+
68+
@JvmStatic fun builder() = Builder()
69+
}
70+
71+
class Builder {
72+
73+
private var creditExtended: JsonField<Long> = JsonMissing.of()
74+
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
75+
76+
@JvmSynthetic
77+
internal fun from(extendedCredit: ExtendedCredit) = apply {
78+
this.creditExtended = extendedCredit.creditExtended
79+
additionalProperties(extendedCredit.additionalProperties)
80+
}
81+
82+
fun creditExtended(creditExtended: Long) = creditExtended(JsonField.of(creditExtended))
83+
84+
@JsonProperty("credit_extended")
85+
@ExcludeMissing
86+
fun creditExtended(creditExtended: JsonField<Long>) = apply {
87+
this.creditExtended = creditExtended
88+
}
89+
90+
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
91+
this.additionalProperties.clear()
92+
this.additionalProperties.putAll(additionalProperties)
93+
}
94+
95+
@JsonAnySetter
96+
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
97+
this.additionalProperties.put(key, value)
98+
}
99+
100+
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
101+
this.additionalProperties.putAll(additionalProperties)
102+
}
103+
104+
fun build(): ExtendedCredit =
105+
ExtendedCredit(creditExtended, additionalProperties.toUnmodifiable())
106+
}
107+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102
4+
5+
package com.lithic.api.services.async
6+
7+
import com.lithic.api.services.async.creditProducts.ExtendedCreditServiceAsync
8+
9+
interface CreditProductServiceAsync {
10+
11+
fun extendedCredit(): ExtendedCreditServiceAsync
12+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.lithic.api.services.async
4+
5+
import com.lithic.api.core.ClientOptions
6+
import com.lithic.api.core.http.HttpResponse.Handler
7+
import com.lithic.api.errors.LithicError
8+
import com.lithic.api.services.async.creditProducts.ExtendedCreditServiceAsync
9+
import com.lithic.api.services.async.creditProducts.ExtendedCreditServiceAsyncImpl
10+
import com.lithic.api.services.errorHandler
11+
12+
class CreditProductServiceAsyncImpl
13+
constructor(
14+
private val clientOptions: ClientOptions,
15+
) : CreditProductServiceAsync {
16+
17+
private val errorHandler: Handler<LithicError> = errorHandler(clientOptions.jsonMapper)
18+
19+
private val extendedCredit: ExtendedCreditServiceAsync by lazy {
20+
ExtendedCreditServiceAsyncImpl(clientOptions)
21+
}
22+
23+
override fun extendedCredit(): ExtendedCreditServiceAsync = extendedCredit
24+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
@file:Suppress("OVERLOADS_INTERFACE") // See https://youtrack.jetbrains.com/issue/KT-36102
4+
5+
package com.lithic.api.services.async.creditProducts
6+
7+
import com.lithic.api.core.RequestOptions
8+
import com.lithic.api.models.CreditProductExtendedCreditRetrieveParams
9+
import com.lithic.api.models.ExtendedCredit
10+
import java.util.concurrent.CompletableFuture
11+
12+
interface ExtendedCreditServiceAsync {
13+
14+
/** Get the extended credit for a given credit product under a program */
15+
@JvmOverloads
16+
fun retrieve(
17+
params: CreditProductExtendedCreditRetrieveParams,
18+
requestOptions: RequestOptions = RequestOptions.none()
19+
): CompletableFuture<ExtendedCredit>
20+
}

0 commit comments

Comments
 (0)