Skip to content

Commit 56429f0

Browse files
committed
feat(api): add CardProgram and DigitalCardArt resources (#109)
- Add list and get endpoints for CardProgram - Add list endpoint for DigitalCardArt
1 parent 93b0ba7 commit 56429f0

34 files changed

Lines changed: 2515 additions & 11 deletions

.stats.yml

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

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ interface LithicClient {
5454

5555
fun cardProduct(): CardProductService
5656

57+
fun cardPrograms(): CardProgramService
58+
59+
fun digitalCardArt(): DigitalCardArtService
60+
5761
/** API status check */
5862
@JvmOverloads
5963
fun apiStatus(

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ interface LithicClientAsync {
5555

5656
fun cardProduct(): CardProductServiceAsync
5757

58+
fun cardPrograms(): CardProgramServiceAsync
59+
60+
fun digitalCardArt(): DigitalCardArtServiceAsync
61+
5862
/** API status check */
5963
@JvmOverloads
6064
fun apiStatus(

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ constructor(
8686
CardProductServiceAsyncImpl(clientOptions)
8787
}
8888

89+
private val cardPrograms: CardProgramServiceAsync by lazy {
90+
CardProgramServiceAsyncImpl(clientOptions)
91+
}
92+
93+
private val digitalCardArt: DigitalCardArtServiceAsync by lazy {
94+
DigitalCardArtServiceAsyncImpl(clientOptions)
95+
}
96+
8997
override fun sync(): LithicClient = sync
9098

9199
override fun accounts(): AccountServiceAsync = accounts
@@ -131,6 +139,10 @@ constructor(
131139

132140
override fun cardProduct(): CardProductServiceAsync = cardProduct
133141

142+
override fun cardPrograms(): CardProgramServiceAsync = cardPrograms
143+
144+
override fun digitalCardArt(): DigitalCardArtServiceAsync = digitalCardArt
145+
134146
private val apiStatusHandler: Handler<ApiStatus> =
135147
jsonHandler<ApiStatus>(clientOptions.jsonMapper).withErrorHandler(errorHandler)
136148

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ constructor(
8181

8282
private val cardProduct: CardProductService by lazy { CardProductServiceImpl(clientOptions) }
8383

84+
private val cardPrograms: CardProgramService by lazy { CardProgramServiceImpl(clientOptions) }
85+
86+
private val digitalCardArt: DigitalCardArtService by lazy {
87+
DigitalCardArtServiceImpl(clientOptions)
88+
}
89+
8490
override fun async(): LithicClientAsync = async
8591

8692
override fun accounts(): AccountService = accounts
@@ -125,6 +131,10 @@ constructor(
125131

126132
override fun cardProduct(): CardProductService = cardProduct
127133

134+
override fun cardPrograms(): CardProgramService = cardPrograms
135+
136+
override fun digitalCardArt(): DigitalCardArtService = digitalCardArt
137+
128138
private val apiStatusHandler: Handler<ApiStatus> =
129139
jsonHandler<ApiStatus>(clientOptions.jsonMapper).withErrorHandler(errorHandler)
130140

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
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.time.OffsetDateTime
16+
import java.util.Objects
17+
18+
@JsonDeserialize(builder = CardProgram.Builder::class)
19+
@NoAutoDetect
20+
class CardProgram
21+
private constructor(
22+
private val created: JsonField<OffsetDateTime>,
23+
private val token: JsonField<String>,
24+
private val panRangeStart: JsonField<String>,
25+
private val panRangeEnd: JsonField<String>,
26+
private val name: JsonField<String>,
27+
private val additionalProperties: Map<String, JsonValue>,
28+
) {
29+
30+
private var validated: Boolean = false
31+
32+
private var hashCode: Int = 0
33+
34+
/** Timestamp of when the card program was created. */
35+
fun created(): OffsetDateTime = created.getRequired("created")
36+
37+
/** Globally unique identifier. */
38+
fun token(): String = token.getRequired("token")
39+
40+
/** The first digits of the card number that this card program starts with. */
41+
fun panRangeStart(): String = panRangeStart.getRequired("pan_range_start")
42+
43+
/** The first digits of the card number that this card program ends with. */
44+
fun panRangeEnd(): String = panRangeEnd.getRequired("pan_range_end")
45+
46+
/** The name of the card program. */
47+
fun name(): String = name.getRequired("name")
48+
49+
/** Timestamp of when the card program was created. */
50+
@JsonProperty("created") @ExcludeMissing fun _created() = created
51+
52+
/** Globally unique identifier. */
53+
@JsonProperty("token") @ExcludeMissing fun _token() = token
54+
55+
/** The first digits of the card number that this card program starts with. */
56+
@JsonProperty("pan_range_start") @ExcludeMissing fun _panRangeStart() = panRangeStart
57+
58+
/** The first digits of the card number that this card program ends with. */
59+
@JsonProperty("pan_range_end") @ExcludeMissing fun _panRangeEnd() = panRangeEnd
60+
61+
/** The name of the card program. */
62+
@JsonProperty("name") @ExcludeMissing fun _name() = name
63+
64+
@JsonAnyGetter
65+
@ExcludeMissing
66+
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
67+
68+
fun validate(): CardProgram = apply {
69+
if (!validated) {
70+
created()
71+
token()
72+
panRangeStart()
73+
panRangeEnd()
74+
name()
75+
validated = true
76+
}
77+
}
78+
79+
fun toBuilder() = Builder().from(this)
80+
81+
override fun equals(other: Any?): Boolean {
82+
if (this === other) {
83+
return true
84+
}
85+
86+
return other is CardProgram &&
87+
this.created == other.created &&
88+
this.token == other.token &&
89+
this.panRangeStart == other.panRangeStart &&
90+
this.panRangeEnd == other.panRangeEnd &&
91+
this.name == other.name &&
92+
this.additionalProperties == other.additionalProperties
93+
}
94+
95+
override fun hashCode(): Int {
96+
if (hashCode == 0) {
97+
hashCode =
98+
Objects.hash(
99+
created,
100+
token,
101+
panRangeStart,
102+
panRangeEnd,
103+
name,
104+
additionalProperties,
105+
)
106+
}
107+
return hashCode
108+
}
109+
110+
override fun toString() =
111+
"CardProgram{created=$created, token=$token, panRangeStart=$panRangeStart, panRangeEnd=$panRangeEnd, name=$name, additionalProperties=$additionalProperties}"
112+
113+
companion object {
114+
115+
@JvmStatic fun builder() = Builder()
116+
}
117+
118+
class Builder {
119+
120+
private var created: JsonField<OffsetDateTime> = JsonMissing.of()
121+
private var token: JsonField<String> = JsonMissing.of()
122+
private var panRangeStart: JsonField<String> = JsonMissing.of()
123+
private var panRangeEnd: JsonField<String> = JsonMissing.of()
124+
private var name: JsonField<String> = JsonMissing.of()
125+
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
126+
127+
@JvmSynthetic
128+
internal fun from(cardProgram: CardProgram) = apply {
129+
this.created = cardProgram.created
130+
this.token = cardProgram.token
131+
this.panRangeStart = cardProgram.panRangeStart
132+
this.panRangeEnd = cardProgram.panRangeEnd
133+
this.name = cardProgram.name
134+
additionalProperties(cardProgram.additionalProperties)
135+
}
136+
137+
/** Timestamp of when the card program was created. */
138+
fun created(created: OffsetDateTime) = created(JsonField.of(created))
139+
140+
/** Timestamp of when the card program was created. */
141+
@JsonProperty("created")
142+
@ExcludeMissing
143+
fun created(created: JsonField<OffsetDateTime>) = apply { this.created = created }
144+
145+
/** Globally unique identifier. */
146+
fun token(token: String) = token(JsonField.of(token))
147+
148+
/** Globally unique identifier. */
149+
@JsonProperty("token")
150+
@ExcludeMissing
151+
fun token(token: JsonField<String>) = apply { this.token = token }
152+
153+
/** The first digits of the card number that this card program starts with. */
154+
fun panRangeStart(panRangeStart: String) = panRangeStart(JsonField.of(panRangeStart))
155+
156+
/** The first digits of the card number that this card program starts with. */
157+
@JsonProperty("pan_range_start")
158+
@ExcludeMissing
159+
fun panRangeStart(panRangeStart: JsonField<String>) = apply {
160+
this.panRangeStart = panRangeStart
161+
}
162+
163+
/** The first digits of the card number that this card program ends with. */
164+
fun panRangeEnd(panRangeEnd: String) = panRangeEnd(JsonField.of(panRangeEnd))
165+
166+
/** The first digits of the card number that this card program ends with. */
167+
@JsonProperty("pan_range_end")
168+
@ExcludeMissing
169+
fun panRangeEnd(panRangeEnd: JsonField<String>) = apply { this.panRangeEnd = panRangeEnd }
170+
171+
/** The name of the card program. */
172+
fun name(name: String) = name(JsonField.of(name))
173+
174+
/** The name of the card program. */
175+
@JsonProperty("name")
176+
@ExcludeMissing
177+
fun name(name: JsonField<String>) = apply { this.name = name }
178+
179+
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
180+
this.additionalProperties.clear()
181+
this.additionalProperties.putAll(additionalProperties)
182+
}
183+
184+
@JsonAnySetter
185+
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
186+
this.additionalProperties.put(key, value)
187+
}
188+
189+
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
190+
this.additionalProperties.putAll(additionalProperties)
191+
}
192+
193+
fun build(): CardProgram =
194+
CardProgram(
195+
created,
196+
token,
197+
panRangeStart,
198+
panRangeEnd,
199+
name,
200+
additionalProperties.toUnmodifiable(),
201+
)
202+
}
203+
}

0 commit comments

Comments
 (0)