Skip to content

Commit c85d308

Browse files
stainless-botrattrayalex
authored andcommitted
v0.0.3 - pull Address into its own type, improve error messages when required params are missing
1 parent 4517221 commit c85d308

45 files changed

Lines changed: 628 additions & 1223 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The API documentation can be found [here](https://docs.lithic.com).
1717
#### Gradle
1818

1919
```kotlin
20-
implementation("com.lithic.api:lithic-java:0.0.2")
20+
implementation("com.lithic.api:lithic-java:0.0.3")
2121
```
2222

2323
#### Maven
@@ -26,7 +26,7 @@ implementation("com.lithic.api:lithic-java:0.0.2")
2626
<dependency>
2727
<groupId>com.lithic.api</groupId>
2828
<artifactId>lithic-java</artifactId>
29-
<version>0.0.2</version>
29+
<version>0.0.3</version>
3030
</dependency>
3131
```
3232

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44

55
allprojects {
66
group = "com.lithic.api"
7-
version = "0.0.2"
7+
version = "0.0.3"
88
}
99

1010
nexusPublishing {

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderCreateParams.kt

Lines changed: 82 additions & 715 deletions
Large diffs are not rendered by default.

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderCreateWebhookParams.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ constructor(
103103
}
104104

105105
fun build(): AccountHolderCreateWebhookBody =
106-
AccountHolderCreateWebhookBody(url!!, additionalProperties.toUnmodifiable())
106+
AccountHolderCreateWebhookBody(
107+
checkNotNull(url) { "Property `url` is required but was not set" },
108+
additionalProperties.toUnmodifiable()
109+
)
107110
}
108111
}
109112

@@ -207,7 +210,7 @@ constructor(
207210

208211
fun build(): AccountHolderCreateWebhookParams =
209212
AccountHolderCreateWebhookParams(
210-
url!!,
213+
checkNotNull(url) { "Property `url` is required but was not set" },
211214
additionalQueryParams.toUnmodifiable(),
212215
additionalHeaders.toUnmodifiable(),
213216
additionalBodyProperties.toUnmodifiable(),

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderListDocumentsParams.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ constructor(
108108

109109
fun build(): AccountHolderListDocumentsParams =
110110
AccountHolderListDocumentsParams(
111-
accountHolderToken!!,
111+
checkNotNull(accountHolderToken) {
112+
"Property `accountHolderToken` is required but was not set"
113+
},
112114
additionalQueryParams.toUnmodifiable(),
113115
additionalHeaders.toUnmodifiable(),
114116
)

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderResubmitParams.kt

Lines changed: 26 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,13 @@ constructor(
162162

163163
fun build(): AccountHolderResubmitBody =
164164
AccountHolderResubmitBody(
165-
workflow!!,
166-
tosTimestamp!!,
167-
individual!!,
165+
checkNotNull(workflow) { "Property `workflow` is required but was not set" },
166+
checkNotNull(tosTimestamp) {
167+
"Property `tosTimestamp` is required but was not set"
168+
},
169+
checkNotNull(individual) {
170+
"Property `individual` is required but was not set"
171+
},
168172
additionalProperties.toUnmodifiable(),
169173
)
170174
}
@@ -296,10 +300,14 @@ constructor(
296300

297301
fun build(): AccountHolderResubmitParams =
298302
AccountHolderResubmitParams(
299-
accountHolderToken!!,
300-
workflow!!,
301-
tosTimestamp!!,
302-
individual!!,
303+
checkNotNull(accountHolderToken) {
304+
"Property `accountHolderToken` is required but was not set"
305+
},
306+
checkNotNull(workflow) { "Property `workflow` is required but was not set" },
307+
checkNotNull(tosTimestamp) {
308+
"Property `tosTimestamp` is required but was not set"
309+
},
310+
checkNotNull(individual) { "Property `individual` is required but was not set" },
303311
additionalQueryParams.toUnmodifiable(),
304312
additionalHeaders.toUnmodifiable(),
305313
additionalBodyProperties.toUnmodifiable(),
@@ -531,185 +539,19 @@ constructor(
531539

532540
fun build(): Individual =
533541
Individual(
534-
address!!,
535-
dob!!,
536-
email!!,
537-
firstName!!,
538-
governmentId!!,
539-
lastName!!,
540-
phoneNumber!!,
542+
checkNotNull(address) { "Property `address` is required but was not set" },
543+
checkNotNull(dob) { "Property `dob` is required but was not set" },
544+
checkNotNull(email) { "Property `email` is required but was not set" },
545+
checkNotNull(firstName) { "Property `firstName` is required but was not set" },
546+
checkNotNull(governmentId) {
547+
"Property `governmentId` is required but was not set"
548+
},
549+
checkNotNull(lastName) { "Property `lastName` is required but was not set" },
550+
checkNotNull(phoneNumber) {
551+
"Property `phoneNumber` is required but was not set"
552+
},
541553
additionalProperties.toUnmodifiable(),
542554
)
543555
}
544-
545-
/**
546-
* Individual's current address - PO boxes, UPS drops, and FedEx drops are not acceptable;
547-
* APO/FPO are acceptable. Only USA addresses are currently supported.
548-
*/
549-
@NoAutoDetect
550-
class Address
551-
private constructor(
552-
private val address1: String?,
553-
private val address2: String?,
554-
private val city: String?,
555-
private val country: String?,
556-
private val postalCode: String?,
557-
private val state: String?,
558-
private val additionalProperties: Map<String, JsonValue>,
559-
) {
560-
561-
private var hashCode: Int = 0
562-
563-
/** Valid deliverable address (no PO boxes). */
564-
@JsonProperty("address1") fun address1(): String? = address1
565-
566-
/** Unit or apartment number (if applicable). */
567-
@JsonProperty("address2") fun address2(): String? = address2
568-
569-
/** Name of city. */
570-
@JsonProperty("city") fun city(): String? = city
571-
572-
/**
573-
* Valid country code. Only USA is currently supported, entered in uppercase ISO 3166-1
574-
* alpha-3 three-character format.
575-
*/
576-
@JsonProperty("country") fun country(): String? = country
577-
578-
/**
579-
* Valid postal code. Only USA ZIP codes are currently supported, entered as a
580-
* five-digit ZIP or nine-digit ZIP+4.
581-
*/
582-
@JsonProperty("postal_code") fun postalCode(): String? = postalCode
583-
584-
/**
585-
* Valid state code. Only USA state codes are currently supported, entered in uppercase
586-
* ISO 3166-2 two-character format.
587-
*/
588-
@JsonProperty("state") fun state(): String? = state
589-
590-
@JsonAnyGetter
591-
@ExcludeMissing
592-
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
593-
594-
fun toBuilder() = Builder().from(this)
595-
596-
override fun equals(other: Any?): Boolean {
597-
if (this === other) {
598-
return true
599-
}
600-
601-
return other is Address &&
602-
address1 == other.address1 &&
603-
address2 == other.address2 &&
604-
city == other.city &&
605-
country == other.country &&
606-
postalCode == other.postalCode &&
607-
state == other.state &&
608-
additionalProperties == other.additionalProperties
609-
}
610-
611-
override fun hashCode(): Int {
612-
if (hashCode == 0) {
613-
hashCode =
614-
Objects.hash(
615-
address1,
616-
address2,
617-
city,
618-
country,
619-
postalCode,
620-
state,
621-
additionalProperties,
622-
)
623-
}
624-
return hashCode
625-
}
626-
627-
override fun toString() =
628-
"Address{address1=$address1, address2=$address2, city=$city, country=$country, postalCode=$postalCode, state=$state, additionalProperties=$additionalProperties}"
629-
630-
companion object {
631-
632-
@JvmStatic fun builder() = Builder()
633-
}
634-
635-
class Builder {
636-
637-
private var address1: String? = null
638-
private var address2: String? = null
639-
private var city: String? = null
640-
private var country: String? = null
641-
private var postalCode: String? = null
642-
private var state: String? = null
643-
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
644-
645-
@JvmSynthetic
646-
internal fun from(address: Address) = apply {
647-
this.address1 = address.address1
648-
this.address2 = address.address2
649-
this.city = address.city
650-
this.country = address.country
651-
this.postalCode = address.postalCode
652-
this.state = address.state
653-
additionalProperties(address.additionalProperties)
654-
}
655-
656-
/** Valid deliverable address (no PO boxes). */
657-
@JsonProperty("address1")
658-
fun address1(address1: String) = apply { this.address1 = address1 }
659-
660-
/** Unit or apartment number (if applicable). */
661-
@JsonProperty("address2")
662-
fun address2(address2: String) = apply { this.address2 = address2 }
663-
664-
/** Name of city. */
665-
@JsonProperty("city") fun city(city: String) = apply { this.city = city }
666-
667-
/**
668-
* Valid country code. Only USA is currently supported, entered in uppercase ISO
669-
* 3166-1 alpha-3 three-character format.
670-
*/
671-
@JsonProperty("country")
672-
fun country(country: String) = apply { this.country = country }
673-
674-
/**
675-
* Valid postal code. Only USA ZIP codes are currently supported, entered as a
676-
* five-digit ZIP or nine-digit ZIP+4.
677-
*/
678-
@JsonProperty("postal_code")
679-
fun postalCode(postalCode: String) = apply { this.postalCode = postalCode }
680-
681-
/**
682-
* Valid state code. Only USA state codes are currently supported, entered in
683-
* uppercase ISO 3166-2 two-character format.
684-
*/
685-
@JsonProperty("state") fun state(state: String) = apply { this.state = state }
686-
687-
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
688-
this.additionalProperties.clear()
689-
this.additionalProperties.putAll(additionalProperties)
690-
}
691-
692-
@JsonAnySetter
693-
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
694-
this.additionalProperties.put(key, value)
695-
}
696-
697-
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) =
698-
apply {
699-
this.additionalProperties.putAll(additionalProperties)
700-
}
701-
702-
fun build(): Address =
703-
Address(
704-
address1!!,
705-
address2,
706-
city!!,
707-
country!!,
708-
postalCode!!,
709-
state!!,
710-
additionalProperties.toUnmodifiable(),
711-
)
712-
}
713-
}
714556
}
715557
}

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderRetrieveDocumentParams.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,12 @@ constructor(
119119

120120
fun build(): AccountHolderRetrieveDocumentParams =
121121
AccountHolderRetrieveDocumentParams(
122-
accountHolderToken!!,
123-
documentToken!!,
122+
checkNotNull(accountHolderToken) {
123+
"Property `accountHolderToken` is required but was not set"
124+
},
125+
checkNotNull(documentToken) {
126+
"Property `documentToken` is required but was not set"
127+
},
124128
additionalQueryParams.toUnmodifiable(),
125129
additionalHeaders.toUnmodifiable(),
126130
)

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderRetrieveParams.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ constructor(
107107

108108
fun build(): AccountHolderRetrieveParams =
109109
AccountHolderRetrieveParams(
110-
accountHolderToken!!,
110+
checkNotNull(accountHolderToken) {
111+
"Property `accountHolderToken` is required but was not set"
112+
},
111113
additionalQueryParams.toUnmodifiable(),
112114
additionalHeaders.toUnmodifiable(),
113115
)

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUpdateParams.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ constructor(
275275

276276
fun build(): AccountHolderUpdateParams =
277277
AccountHolderUpdateParams(
278-
accountHolderToken!!,
278+
checkNotNull(accountHolderToken) {
279+
"Property `accountHolderToken` is required but was not set"
280+
},
279281
email,
280282
phoneNumber,
281283
additionalQueryParams.toUnmodifiable(),

lithic-java-core/src/main/kotlin/com/lithic/api/models/AccountHolderUploadDocumentParams.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ constructor(
120120

121121
fun build(): AccountHolderUploadDocumentBody =
122122
AccountHolderUploadDocumentBody(
123-
documentType!!,
123+
checkNotNull(documentType) {
124+
"Property `documentType` is required but was not set"
125+
},
124126
additionalProperties.toUnmodifiable()
125127
)
126128
}
@@ -234,8 +236,12 @@ constructor(
234236

235237
fun build(): AccountHolderUploadDocumentParams =
236238
AccountHolderUploadDocumentParams(
237-
accountHolderToken!!,
238-
documentType!!,
239+
checkNotNull(accountHolderToken) {
240+
"Property `accountHolderToken` is required but was not set"
241+
},
242+
checkNotNull(documentType) {
243+
"Property `documentType` is required but was not set"
244+
},
239245
additionalQueryParams.toUnmodifiable(),
240246
additionalHeaders.toUnmodifiable(),
241247
additionalBodyProperties.toUnmodifiable(),

0 commit comments

Comments
 (0)