Skip to content

Commit 71bc2ee

Browse files
feat(api): api update
1 parent 1cd481b commit 71bc2ee

File tree

2 files changed

+36
-39
lines changed

2 files changed

+36
-39
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 45
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-f8783c7acb61970583e95ad6d75c8735d2ae5e4344f808957e0b9cc22f2b8c04.yml
3-
openapi_spec_hash: 2baa7719b95befc1553083d5757bd99a
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch%2Ffinch-ef0b0fb4ec85648855da514cbc53018cb429fb37bce8570bc6c44254eb32c62f.yml
3+
openapi_spec_hash: 38622a4a3cdef04686053018329616f2
44
config_hash: 6d3585c0032e08d723d077d660fc8448

finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayStatement.kt

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ class PayStatement
2424
@JsonCreator(mode = JsonCreator.Mode.DISABLED)
2525
private constructor(
2626
private val earnings: JsonField<List<Earning?>>,
27-
private val employeeDeductions: JsonField<List<EmployeeDeduction?>>,
28-
private val employerContributions: JsonField<List<EmployerContribution?>>,
27+
private val employeeDeductions: JsonField<List<EmployeeDeduction>>,
28+
private val employerContributions: JsonField<List<EmployerContribution>>,
2929
private val grossPay: JsonField<Money>,
3030
private val individualId: JsonField<String>,
3131
private val netPay: JsonField<Money>,
3232
private val paymentMethod: JsonField<PaymentMethod>,
33-
private val taxes: JsonField<List<Tax?>>,
33+
private val taxes: JsonField<List<Tax>>,
3434
private val totalHours: JsonField<Double>,
3535
private val type: JsonField<Type>,
3636
private val additionalProperties: MutableMap<String, JsonValue>,
@@ -43,10 +43,10 @@ private constructor(
4343
earnings: JsonField<List<Earning?>> = JsonMissing.of(),
4444
@JsonProperty("employee_deductions")
4545
@ExcludeMissing
46-
employeeDeductions: JsonField<List<EmployeeDeduction?>> = JsonMissing.of(),
46+
employeeDeductions: JsonField<List<EmployeeDeduction>> = JsonMissing.of(),
4747
@JsonProperty("employer_contributions")
4848
@ExcludeMissing
49-
employerContributions: JsonField<List<EmployerContribution?>> = JsonMissing.of(),
49+
employerContributions: JsonField<List<EmployerContribution>> = JsonMissing.of(),
5050
@JsonProperty("gross_pay") @ExcludeMissing grossPay: JsonField<Money> = JsonMissing.of(),
5151
@JsonProperty("individual_id")
5252
@ExcludeMissing
@@ -55,7 +55,7 @@ private constructor(
5555
@JsonProperty("payment_method")
5656
@ExcludeMissing
5757
paymentMethod: JsonField<PaymentMethod> = JsonMissing.of(),
58-
@JsonProperty("taxes") @ExcludeMissing taxes: JsonField<List<Tax?>> = JsonMissing.of(),
58+
@JsonProperty("taxes") @ExcludeMissing taxes: JsonField<List<Tax>> = JsonMissing.of(),
5959
@JsonProperty("total_hours")
6060
@ExcludeMissing
6161
totalHours: JsonField<Double> = JsonMissing.of(),
@@ -88,14 +88,14 @@ private constructor(
8888
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
8989
* server responded with an unexpected value).
9090
*/
91-
fun employeeDeductions(): Optional<List<EmployeeDeduction?>> =
91+
fun employeeDeductions(): Optional<List<EmployeeDeduction>> =
9292
employeeDeductions.getOptional("employee_deductions")
9393

9494
/**
9595
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
9696
* server responded with an unexpected value).
9797
*/
98-
fun employerContributions(): Optional<List<EmployerContribution?>> =
98+
fun employerContributions(): Optional<List<EmployerContribution>> =
9999
employerContributions.getOptional("employer_contributions")
100100

101101
/**
@@ -132,7 +132,7 @@ private constructor(
132132
* @throws FinchInvalidDataException if the JSON field has an unexpected type (e.g. if the
133133
* server responded with an unexpected value).
134134
*/
135-
fun taxes(): Optional<List<Tax?>> = taxes.getOptional("taxes")
135+
fun taxes(): Optional<List<Tax>> = taxes.getOptional("taxes")
136136

137137
/**
138138
* The number of hours worked for this pay period
@@ -165,7 +165,7 @@ private constructor(
165165
*/
166166
@JsonProperty("employee_deductions")
167167
@ExcludeMissing
168-
fun _employeeDeductions(): JsonField<List<EmployeeDeduction?>> = employeeDeductions
168+
fun _employeeDeductions(): JsonField<List<EmployeeDeduction>> = employeeDeductions
169169

170170
/**
171171
* Returns the raw JSON value of [employerContributions].
@@ -175,7 +175,7 @@ private constructor(
175175
*/
176176
@JsonProperty("employer_contributions")
177177
@ExcludeMissing
178-
fun _employerContributions(): JsonField<List<EmployerContribution?>> = employerContributions
178+
fun _employerContributions(): JsonField<List<EmployerContribution>> = employerContributions
179179

180180
/**
181181
* Returns the raw JSON value of [grossPay].
@@ -214,7 +214,7 @@ private constructor(
214214
*
215215
* Unlike [taxes], this method doesn't throw if the JSON field has an unexpected type.
216216
*/
217-
@JsonProperty("taxes") @ExcludeMissing fun _taxes(): JsonField<List<Tax?>> = taxes
217+
@JsonProperty("taxes") @ExcludeMissing fun _taxes(): JsonField<List<Tax>> = taxes
218218

219219
/**
220220
* Returns the raw JSON value of [totalHours].
@@ -268,13 +268,13 @@ private constructor(
268268
class Builder internal constructor() {
269269

270270
private var earnings: JsonField<MutableList<Earning?>>? = null
271-
private var employeeDeductions: JsonField<MutableList<EmployeeDeduction?>>? = null
272-
private var employerContributions: JsonField<MutableList<EmployerContribution?>>? = null
271+
private var employeeDeductions: JsonField<MutableList<EmployeeDeduction>>? = null
272+
private var employerContributions: JsonField<MutableList<EmployerContribution>>? = null
273273
private var grossPay: JsonField<Money>? = null
274274
private var individualId: JsonField<String>? = null
275275
private var netPay: JsonField<Money>? = null
276276
private var paymentMethod: JsonField<PaymentMethod>? = null
277-
private var taxes: JsonField<MutableList<Tax?>>? = null
277+
private var taxes: JsonField<MutableList<Tax>>? = null
278278
private var totalHours: JsonField<Double>? = null
279279
private var type: JsonField<Type>? = null
280280
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
@@ -324,23 +324,23 @@ private constructor(
324324
}
325325

326326
/** The array of deductions objects associated with this pay statement. */
327-
fun employeeDeductions(employeeDeductions: List<EmployeeDeduction?>?) =
327+
fun employeeDeductions(employeeDeductions: List<EmployeeDeduction>?) =
328328
employeeDeductions(JsonField.ofNullable(employeeDeductions))
329329

330330
/**
331331
* Alias for calling [Builder.employeeDeductions] with `employeeDeductions.orElse(null)`.
332332
*/
333-
fun employeeDeductions(employeeDeductions: Optional<List<EmployeeDeduction?>>) =
333+
fun employeeDeductions(employeeDeductions: Optional<List<EmployeeDeduction>>) =
334334
employeeDeductions(employeeDeductions.getOrNull())
335335

336336
/**
337337
* Sets [Builder.employeeDeductions] to an arbitrary JSON value.
338338
*
339339
* You should usually call [Builder.employeeDeductions] with a well-typed
340-
* `List<EmployeeDeduction?>` value instead. This method is primarily for setting the field
340+
* `List<EmployeeDeduction>` value instead. This method is primarily for setting the field
341341
* to an undocumented or not yet supported value.
342342
*/
343-
fun employeeDeductions(employeeDeductions: JsonField<List<EmployeeDeduction?>>) = apply {
343+
fun employeeDeductions(employeeDeductions: JsonField<List<EmployeeDeduction>>) = apply {
344344
this.employeeDeductions = employeeDeductions.map { it.toMutableList() }
345345
}
346346

@@ -356,24 +356,24 @@ private constructor(
356356
}
357357
}
358358

359-
fun employerContributions(employerContributions: List<EmployerContribution?>?) =
359+
fun employerContributions(employerContributions: List<EmployerContribution>?) =
360360
employerContributions(JsonField.ofNullable(employerContributions))
361361

362362
/**
363363
* Alias for calling [Builder.employerContributions] with
364364
* `employerContributions.orElse(null)`.
365365
*/
366-
fun employerContributions(employerContributions: Optional<List<EmployerContribution?>>) =
366+
fun employerContributions(employerContributions: Optional<List<EmployerContribution>>) =
367367
employerContributions(employerContributions.getOrNull())
368368

369369
/**
370370
* Sets [Builder.employerContributions] to an arbitrary JSON value.
371371
*
372372
* You should usually call [Builder.employerContributions] with a well-typed
373-
* `List<EmployerContribution?>` value instead. This method is primarily for setting the
373+
* `List<EmployerContribution>` value instead. This method is primarily for setting the
374374
* field to an undocumented or not yet supported value.
375375
*/
376-
fun employerContributions(employerContributions: JsonField<List<EmployerContribution?>>) =
376+
fun employerContributions(employerContributions: JsonField<List<EmployerContribution>>) =
377377
apply {
378378
this.employerContributions = employerContributions.map { it.toMutableList() }
379379
}
@@ -450,19 +450,18 @@ private constructor(
450450
}
451451

452452
/** The array of taxes objects associated with this pay statement. */
453-
fun taxes(taxes: List<Tax?>?) = taxes(JsonField.ofNullable(taxes))
453+
fun taxes(taxes: List<Tax>?) = taxes(JsonField.ofNullable(taxes))
454454

455455
/** Alias for calling [Builder.taxes] with `taxes.orElse(null)`. */
456-
fun taxes(taxes: Optional<List<Tax?>>) = taxes(taxes.getOrNull())
456+
fun taxes(taxes: Optional<List<Tax>>) = taxes(taxes.getOrNull())
457457

458458
/**
459459
* Sets [Builder.taxes] to an arbitrary JSON value.
460460
*
461-
* You should usually call [Builder.taxes] with a well-typed `List<Tax?>` value instead.
462-
* This method is primarily for setting the field to an undocumented or not yet supported
463-
* value.
461+
* You should usually call [Builder.taxes] with a well-typed `List<Tax>` value instead. This
462+
* method is primarily for setting the field to an undocumented or not yet supported value.
464463
*/
465-
fun taxes(taxes: JsonField<List<Tax?>>) = apply {
464+
fun taxes(taxes: JsonField<List<Tax>>) = apply {
466465
this.taxes = taxes.map { it.toMutableList() }
467466
}
468467

@@ -578,13 +577,13 @@ private constructor(
578577
}
579578

580579
earnings().ifPresent { it.forEach { it?.validate() } }
581-
employeeDeductions().ifPresent { it.forEach { it?.validate() } }
582-
employerContributions().ifPresent { it.forEach { it?.validate() } }
580+
employeeDeductions().ifPresent { it.forEach { it.validate() } }
581+
employerContributions().ifPresent { it.forEach { it.validate() } }
583582
grossPay().ifPresent { it.validate() }
584583
individualId()
585584
netPay().ifPresent { it.validate() }
586585
paymentMethod().ifPresent { it.validate() }
587-
taxes().ifPresent { it.forEach { it?.validate() } }
586+
taxes().ifPresent { it.forEach { it.validate() } }
588587
totalHours()
589588
type().ifPresent { it.validate() }
590589
validated = true
@@ -606,15 +605,13 @@ private constructor(
606605
@JvmSynthetic
607606
internal fun validity(): Int =
608607
(earnings.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) +
609-
(employeeDeductions.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() }
610-
?: 0) +
611-
(employerContributions.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() }
612-
?: 0) +
608+
(employeeDeductions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
609+
(employerContributions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
613610
(grossPay.asKnown().getOrNull()?.validity() ?: 0) +
614611
(if (individualId.asKnown().isPresent) 1 else 0) +
615612
(netPay.asKnown().getOrNull()?.validity() ?: 0) +
616613
(paymentMethod.asKnown().getOrNull()?.validity() ?: 0) +
617-
(taxes.asKnown().getOrNull()?.sumOf { (it?.validity() ?: 0).toInt() } ?: 0) +
614+
(taxes.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) +
618615
(if (totalHours.asKnown().isPresent) 1 else 0) +
619616
(type.asKnown().getOrNull()?.validity() ?: 0)
620617

0 commit comments

Comments
 (0)