From 95b4ee0c9d635adbc54572cd5988903218056e50 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 19:29:55 +0000 Subject: [PATCH] refactor(client): migrate pages to builder pattern --- ...nefitIndividualRetrieveManyBenefitsPage.kt | 112 ++++++++++++---- ...IndividualRetrieveManyBenefitsPageAsync.kt | 116 +++++++++++++---- .../api/models/HrisBenefitListPage.kt | 102 +++++++++++---- .../api/models/HrisBenefitListPageAsync.kt | 108 ++++++++++++---- .../HrisBenefitListSupportedBenefitsPage.kt | 109 ++++++++++++---- ...isBenefitListSupportedBenefitsPageAsync.kt | 113 ++++++++++++---- .../HrisCompanyPayStatementItemListPage.kt | 115 ++++++++++++----- ...risCompanyPayStatementItemListPageAsync.kt | 119 ++++++++++++----- ...HrisCompanyPayStatementItemRuleListPage.kt | 116 ++++++++++++----- ...ompanyPayStatementItemRuleListPageAsync.kt | 121 +++++++++++++----- .../HrisDirectoryListIndividualsPage.kt | 112 ++++++++++++---- .../HrisDirectoryListIndividualsPageAsync.kt | 115 +++++++++++++---- .../api/models/HrisDirectoryListPage.kt | 108 ++++++++++++---- .../api/models/HrisDirectoryListPageAsync.kt | 110 ++++++++++++---- .../models/HrisEmploymentRetrieveManyPage.kt | 109 ++++++++++++---- .../HrisEmploymentRetrieveManyPageAsync.kt | 115 +++++++++++++---- .../models/HrisIndividualRetrieveManyPage.kt | 109 ++++++++++++---- .../HrisIndividualRetrieveManyPageAsync.kt | 115 +++++++++++++---- .../HrisPayStatementRetrieveManyPage.kt | 114 ++++++++++++----- .../HrisPayStatementRetrieveManyPageAsync.kt | 119 ++++++++++++----- .../api/models/HrisPaymentListPage.kt | 102 +++++++++++---- .../api/models/HrisPaymentListPageAsync.kt | 108 ++++++++++++---- .../api/models/PayrollPayGroupListPage.kt | 104 +++++++++++---- .../models/PayrollPayGroupListPageAsync.kt | 108 ++++++++++++---- .../tryfinch/api/models/ProviderListPage.kt | 102 +++++++++++---- .../api/models/ProviderListPageAsync.kt | 108 ++++++++++++---- .../async/ProviderServiceAsyncImpl.kt | 10 +- .../async/hris/BenefitServiceAsyncImpl.kt | 20 +-- .../async/hris/DirectoryServiceAsyncImpl.kt | 20 +-- .../async/hris/EmploymentServiceAsyncImpl.kt | 10 +- .../async/hris/IndividualServiceAsyncImpl.kt | 10 +- .../hris/PayStatementServiceAsyncImpl.kt | 10 +- .../async/hris/PaymentServiceAsyncImpl.kt | 10 +- .../benefits/IndividualServiceAsyncImpl.kt | 10 +- .../PayStatementItemServiceAsyncImpl.kt | 10 +- .../payStatementItem/RuleServiceAsyncImpl.kt | 10 +- .../async/payroll/PayGroupServiceAsyncImpl.kt | 10 +- .../services/blocking/ProviderServiceImpl.kt | 8 +- .../blocking/hris/BenefitServiceImpl.kt | 18 ++- .../blocking/hris/DirectoryServiceImpl.kt | 16 ++- .../blocking/hris/EmploymentServiceImpl.kt | 10 +- .../blocking/hris/IndividualServiceImpl.kt | 10 +- .../blocking/hris/PayStatementServiceImpl.kt | 10 +- .../blocking/hris/PaymentServiceImpl.kt | 8 +- .../hris/benefits/IndividualServiceImpl.kt | 10 +- .../company/PayStatementItemServiceImpl.kt | 10 +- .../payStatementItem/RuleServiceImpl.kt | 10 +- .../blocking/payroll/PayGroupServiceImpl.kt | 6 +- 48 files changed, 2309 insertions(+), 826 deletions(-) diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt index 0dd2f3f0..b5773d4e 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.benefits.IndividualService import java.util.Objects import java.util.Optional @@ -9,49 +10,95 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** Get enrollment information for the given individuals. */ +/** @see [IndividualService.retrieveManyBenefits] */ class HrisBenefitIndividualRetrieveManyBenefitsPage private constructor( - private val individualsService: IndividualService, + private val service: IndividualService, private val params: HrisBenefitIndividualRetrieveManyBenefitsParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = + Optional.empty() - return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPage && individualsService == other.individualsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): Optional = + getNextPageParams().map { service.retrieveManyBenefits(it) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "HrisBenefitIndividualRetrieveManyBenefitsPage{individualsService=$individualsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): HrisBenefitIndividualRetrieveManyBenefitsParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = - Optional.empty() + fun toBuilder() = Builder().from(this) + + companion object { - fun getNextPage(): Optional { - return getNextPageParams().map { individualsService.retrieveManyBenefits(it) } + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualRetrieveManyBenefitsPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisBenefitIndividualRetrieveManyBenefitsPage]. */ + class Builder internal constructor() { + + private var service: IndividualService? = null + private var params: HrisBenefitIndividualRetrieveManyBenefitsParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from( + hrisBenefitIndividualRetrieveManyBenefitsPage: + HrisBenefitIndividualRetrieveManyBenefitsPage + ) = apply { + service = hrisBenefitIndividualRetrieveManyBenefitsPage.service + params = hrisBenefitIndividualRetrieveManyBenefitsPage.params + items = hrisBenefitIndividualRetrieveManyBenefitsPage.items + } - companion object { + fun service(service: IndividualService) = apply { this.service = service } - @JvmStatic - fun of( - individualsService: IndividualService, - params: HrisBenefitIndividualRetrieveManyBenefitsParams, - items: List, - ) = HrisBenefitIndividualRetrieveManyBenefitsPage(individualsService, params, items) + /** The parameters that were used to request this page. */ + fun params(params: HrisBenefitIndividualRetrieveManyBenefitsParams) = apply { + this.params = params + } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [HrisBenefitIndividualRetrieveManyBenefitsPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisBenefitIndividualRetrieveManyBenefitsPage = + HrisBenefitIndividualRetrieveManyBenefitsPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPage) : @@ -73,4 +120,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPage && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "HrisBenefitIndividualRetrieveManyBenefitsPage{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt index af12a0b0..1d164078 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitIndividualRetrieveManyBenefitsPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.benefits.IndividualServiceAsync import java.util.Objects import java.util.Optional @@ -9,52 +10,98 @@ import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate -/** Get enrollment information for the given individuals. */ +/** @see [IndividualServiceAsync.retrieveManyBenefits] */ class HrisBenefitIndividualRetrieveManyBenefitsPageAsync private constructor( - private val individualsService: IndividualServiceAsync, + private val service: IndividualServiceAsync, private val params: HrisBenefitIndividualRetrieveManyBenefitsParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPageAsync && individualsService == other.individualsService && params == other.params && items == other.items /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, items) /* spotless:on */ - - override fun toString() = - "HrisBenefitIndividualRetrieveManyBenefitsPageAsync{individualsService=$individualsService, params=$params, items=$items}" - fun hasNextPage(): Boolean = items.isNotEmpty() fun getNextPageParams(): Optional = Optional.empty() fun getNextPage(): - CompletableFuture> { - return getNextPageParams() - .map { individualsService.retrieveManyBenefits(it).thenApply { Optional.of(it) } } + CompletableFuture> = + getNextPageParams() + .map { service.retrieveManyBenefits(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisBenefitIndividualRetrieveManyBenefitsParams = params + + /** The response that this page was parsed from. */ + fun items(): List = items + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - individualsService: IndividualServiceAsync, - params: HrisBenefitIndividualRetrieveManyBenefitsParams, - items: List, - ) = HrisBenefitIndividualRetrieveManyBenefitsPageAsync(individualsService, params, items) + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitIndividualRetrieveManyBenefitsPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisBenefitIndividualRetrieveManyBenefitsPageAsync]. */ + class Builder internal constructor() { + + private var service: IndividualServiceAsync? = null + private var params: HrisBenefitIndividualRetrieveManyBenefitsParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from( + hrisBenefitIndividualRetrieveManyBenefitsPageAsync: + HrisBenefitIndividualRetrieveManyBenefitsPageAsync + ) = apply { + service = hrisBenefitIndividualRetrieveManyBenefitsPageAsync.service + params = hrisBenefitIndividualRetrieveManyBenefitsPageAsync.params + items = hrisBenefitIndividualRetrieveManyBenefitsPageAsync.items + } + + fun service(service: IndividualServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisBenefitIndividualRetrieveManyBenefitsParams) = apply { + this.params = params + } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [HrisBenefitIndividualRetrieveManyBenefitsPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisBenefitIndividualRetrieveManyBenefitsPageAsync = + HrisBenefitIndividualRetrieveManyBenefitsPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisBenefitIndividualRetrieveManyBenefitsPageAsync) { @@ -86,4 +133,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisBenefitIndividualRetrieveManyBenefitsPageAsync && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "HrisBenefitIndividualRetrieveManyBenefitsPageAsync{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt index f99c7aed..7b00ce90 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.BenefitService import java.util.Objects import java.util.Optional @@ -9,48 +10,87 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** List all company-wide deductions and contributions. */ +/** @see [BenefitService.list] */ class HrisBenefitListPage private constructor( - private val benefitsService: BenefitService, + private val service: BenefitService, private val params: HrisBenefitListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is HrisBenefitListPage && benefitsService == other.benefitsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "HrisBenefitListPage{benefitsService=$benefitsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): HrisBenefitListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) + + companion object { - fun getNextPage(): Optional { - return getNextPageParams().map { benefitsService.list(it) } + /** + * Returns a mutable builder for constructing an instance of [HrisBenefitListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisBenefitListPage]. */ + class Builder internal constructor() { - companion object { + private var service: BenefitService? = null + private var params: HrisBenefitListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(hrisBenefitListPage: HrisBenefitListPage) = apply { + service = hrisBenefitListPage.service + params = hrisBenefitListPage.params + items = hrisBenefitListPage.items + } - @JvmStatic - fun of( - benefitsService: BenefitService, - params: HrisBenefitListParams, - items: List, - ) = HrisBenefitListPage(benefitsService, params, items) + fun service(service: BenefitService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisBenefitListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [HrisBenefitListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisBenefitListPage = + HrisBenefitListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisBenefitListPage) : Iterable { @@ -71,4 +111,16 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisBenefitListPage && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = "HrisBenefitListPage{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt index 5274b3a9..f49f49a4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.BenefitServiceAsync import java.util.Objects import java.util.Optional @@ -9,50 +10,90 @@ import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate -/** List all company-wide deductions and contributions. */ +/** @see [BenefitServiceAsync.list] */ class HrisBenefitListPageAsync private constructor( - private val benefitsService: BenefitServiceAsync, + private val service: BenefitServiceAsync, private val params: HrisBenefitListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is HrisBenefitListPageAsync && benefitsService == other.benefitsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.list(it).thenApply { Optional.of(it) } } + .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "HrisBenefitListPageAsync{benefitsService=$benefitsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): HrisBenefitListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { benefitsService.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + companion object { + + /** + * Returns a mutable builder for constructing an instance of [HrisBenefitListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisBenefitListPageAsync]. */ + class Builder internal constructor() { - companion object { + private var service: BenefitServiceAsync? = null + private var params: HrisBenefitListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(hrisBenefitListPageAsync: HrisBenefitListPageAsync) = apply { + service = hrisBenefitListPageAsync.service + params = hrisBenefitListPageAsync.params + items = hrisBenefitListPageAsync.items + } - @JvmStatic - fun of( - benefitsService: BenefitServiceAsync, - params: HrisBenefitListParams, - items: List, - ) = HrisBenefitListPageAsync(benefitsService, params, items) + fun service(service: BenefitServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisBenefitListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [HrisBenefitListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisBenefitListPageAsync = + HrisBenefitListPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisBenefitListPageAsync) { @@ -83,4 +124,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisBenefitListPageAsync && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "HrisBenefitListPageAsync{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt index 65bc601f..9d619bc6 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.BenefitService import java.util.Objects import java.util.Optional @@ -9,48 +10,93 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** Get deductions metadata */ +/** @see [BenefitService.listSupportedBenefits] */ class HrisBenefitListSupportedBenefitsPage private constructor( - private val benefitsService: BenefitService, + private val service: BenefitService, private val params: HrisBenefitListSupportedBenefitsParams, private val items: Optional>, ) { - /** Returns the response that this page was parsed from. */ - fun items(): Optional> = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is HrisBenefitListSupportedBenefitsPage && benefitsService == other.benefitsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): Optional = + getNextPageParams().map { service.listSupportedBenefits(it) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "HrisBenefitListSupportedBenefitsPage{benefitsService=$benefitsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): HrisBenefitListSupportedBenefitsParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): Optional> = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) - fun getNextPage(): Optional { - return getNextPageParams().map { benefitsService.listSupportedBenefits(it) } + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitListSupportedBenefitsPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisBenefitListSupportedBenefitsPage]. */ + class Builder internal constructor() { - companion object { + private var service: BenefitService? = null + private var params: HrisBenefitListSupportedBenefitsParams? = null + private var items: Optional>? = null - @JvmStatic - fun of( - benefitsService: BenefitService, - params: HrisBenefitListSupportedBenefitsParams, - items: Optional>, - ) = HrisBenefitListSupportedBenefitsPage(benefitsService, params, items) + @JvmSynthetic + internal fun from( + hrisBenefitListSupportedBenefitsPage: HrisBenefitListSupportedBenefitsPage + ) = apply { + service = hrisBenefitListSupportedBenefitsPage.service + params = hrisBenefitListSupportedBenefitsPage.params + items = hrisBenefitListSupportedBenefitsPage.items + } + + fun service(service: BenefitService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisBenefitListSupportedBenefitsParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: Optional>) = apply { + this.items = items + } + + /** + * Returns an immutable instance of [HrisBenefitListSupportedBenefitsPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisBenefitListSupportedBenefitsPage = + HrisBenefitListSupportedBenefitsPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisBenefitListSupportedBenefitsPage) : @@ -72,4 +118,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisBenefitListSupportedBenefitsPage && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "HrisBenefitListSupportedBenefitsPage{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt index 08dea534..d9740159 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisBenefitListSupportedBenefitsPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.BenefitServiceAsync import java.util.Objects import java.util.Optional @@ -9,50 +10,95 @@ import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate -/** Get deductions metadata */ +/** @see [BenefitServiceAsync.listSupportedBenefits] */ class HrisBenefitListSupportedBenefitsPageAsync private constructor( - private val benefitsService: BenefitServiceAsync, + private val service: BenefitServiceAsync, private val params: HrisBenefitListSupportedBenefitsParams, private val items: Optional>, ) { - /** Returns the response that this page was parsed from. */ - fun items(): Optional> = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is HrisBenefitListSupportedBenefitsPageAsync && benefitsService == other.benefitsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.listSupportedBenefits(it).thenApply { Optional.of(it) } } + .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(benefitsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "HrisBenefitListSupportedBenefitsPageAsync{benefitsService=$benefitsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): HrisBenefitListSupportedBenefitsParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): Optional> = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { benefitsService.listSupportedBenefits(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisBenefitListSupportedBenefitsPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisBenefitListSupportedBenefitsPageAsync]. */ + class Builder internal constructor() { - companion object { + private var service: BenefitServiceAsync? = null + private var params: HrisBenefitListSupportedBenefitsParams? = null + private var items: Optional>? = null + + @JvmSynthetic + internal fun from( + hrisBenefitListSupportedBenefitsPageAsync: HrisBenefitListSupportedBenefitsPageAsync + ) = apply { + service = hrisBenefitListSupportedBenefitsPageAsync.service + params = hrisBenefitListSupportedBenefitsPageAsync.params + items = hrisBenefitListSupportedBenefitsPageAsync.items + } + + fun service(service: BenefitServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisBenefitListSupportedBenefitsParams) = apply { this.params = params } - @JvmStatic - fun of( - benefitsService: BenefitServiceAsync, - params: HrisBenefitListSupportedBenefitsParams, - items: Optional>, - ) = HrisBenefitListSupportedBenefitsPageAsync(benefitsService, params, items) + /** The response that this page was parsed from. */ + fun items(items: Optional>) = apply { + this.items = items + } + + /** + * Returns an immutable instance of [HrisBenefitListSupportedBenefitsPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisBenefitListSupportedBenefitsPageAsync = + HrisBenefitListSupportedBenefitsPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisBenefitListSupportedBenefitsPageAsync) { @@ -85,4 +131,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisBenefitListSupportedBenefitsPageAsync && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "HrisBenefitListSupportedBenefitsPageAsync{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt index ce55af68..00bcd8fa 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.company.PayStatementItemService import java.util.Objects import java.util.Optional @@ -9,21 +10,14 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** - * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical - * support will be added soon Retrieve a list of detailed pay statement items for the access token's - * connection account. - */ +/** @see [PayStatementItemService.list] */ class HrisCompanyPayStatementItemListPage private constructor( - private val payStatementItemService: PayStatementItemService, + private val service: PayStatementItemService, private val params: HrisCompanyPayStatementItemListParams, private val response: HrisCompanyPayStatementItemListPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisCompanyPayStatementItemListPageResponse = response - /** * Delegates to [HrisCompanyPayStatementItemListPageResponse], but gracefully handles missing * data. @@ -33,37 +27,85 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun hasNextPage(): Boolean = responses().isNotEmpty() - return /* spotless:off */ other is HrisCompanyPayStatementItemListPage && payStatementItemService == other.payStatementItemService && params == other.params && response == other.response /* spotless:on */ - } + fun getNextPageParams(): Optional = Optional.empty() - override fun hashCode(): Int = /* spotless:off */ Objects.hash(payStatementItemService, params, response) /* spotless:on */ + fun getNextPage(): Optional = + getNextPageParams().map { service.list(it) } - override fun toString() = - "HrisCompanyPayStatementItemListPage{payStatementItemService=$payStatementItemService, params=$params, response=$response}" + fun autoPager(): AutoPager = AutoPager(this) - fun hasNextPage(): Boolean = responses().isNotEmpty() + /** The parameters that were used to request this page. */ + fun params(): HrisCompanyPayStatementItemListParams = params - fun getNextPageParams(): Optional = Optional.empty() + /** The response that this page was parsed from. */ + fun response(): HrisCompanyPayStatementItemListPageResponse = response - fun getNextPage(): Optional { - return getNextPageParams().map { payStatementItemService.list(it) } + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisCompanyPayStatementItemListPage]. */ + class Builder internal constructor() { - companion object { + private var service: PayStatementItemService? = null + private var params: HrisCompanyPayStatementItemListParams? = null + private var response: HrisCompanyPayStatementItemListPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemListPage: HrisCompanyPayStatementItemListPage + ) = apply { + service = hrisCompanyPayStatementItemListPage.service + params = hrisCompanyPayStatementItemListPage.params + response = hrisCompanyPayStatementItemListPage.response + } + + fun service(service: PayStatementItemService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisCompanyPayStatementItemListParams) = apply { this.params = params } - @JvmStatic - fun of( - payStatementItemService: PayStatementItemService, - params: HrisCompanyPayStatementItemListParams, - response: HrisCompanyPayStatementItemListPageResponse, - ) = HrisCompanyPayStatementItemListPage(payStatementItemService, params, response) + /** The response that this page was parsed from. */ + fun response(response: HrisCompanyPayStatementItemListPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisCompanyPayStatementItemListPage = + HrisCompanyPayStatementItemListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisCompanyPayStatementItemListPage) : @@ -85,4 +127,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemListPage && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemListPage{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt index 55743717..8a50507b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemListPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.company.PayStatementItemServiceAsync import java.util.Objects import java.util.Optional @@ -10,21 +11,14 @@ import java.util.concurrent.Executor import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull -/** - * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical - * support will be added soon Retrieve a list of detailed pay statement items for the access token's - * connection account. - */ +/** @see [PayStatementItemServiceAsync.list] */ class HrisCompanyPayStatementItemListPageAsync private constructor( - private val payStatementItemService: PayStatementItemServiceAsync, + private val service: PayStatementItemServiceAsync, private val params: HrisCompanyPayStatementItemListParams, private val response: HrisCompanyPayStatementItemListPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisCompanyPayStatementItemListPageResponse = response - /** * Delegates to [HrisCompanyPayStatementItemListPageResponse], but gracefully handles missing * data. @@ -34,39 +28,87 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisCompanyPayStatementItemListPageAsync && payStatementItemService == other.payStatementItemService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(payStatementItemService, params, response) /* spotless:on */ - - override fun toString() = - "HrisCompanyPayStatementItemListPageAsync{payStatementItemService=$payStatementItemService, params=$params, response=$response}" - fun hasNextPage(): Boolean = responses().isNotEmpty() fun getNextPageParams(): Optional = Optional.empty() - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { payStatementItemService.list(it).thenApply { Optional.of(it) } } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.list(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisCompanyPayStatementItemListParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisCompanyPayStatementItemListPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - payStatementItemService: PayStatementItemServiceAsync, - params: HrisCompanyPayStatementItemListParams, - response: HrisCompanyPayStatementItemListPageResponse, - ) = HrisCompanyPayStatementItemListPageAsync(payStatementItemService, params, response) + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisCompanyPayStatementItemListPageAsync]. */ + class Builder internal constructor() { + + private var service: PayStatementItemServiceAsync? = null + private var params: HrisCompanyPayStatementItemListParams? = null + private var response: HrisCompanyPayStatementItemListPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemListPageAsync: HrisCompanyPayStatementItemListPageAsync + ) = apply { + service = hrisCompanyPayStatementItemListPageAsync.service + params = hrisCompanyPayStatementItemListPageAsync.params + response = hrisCompanyPayStatementItemListPageAsync.response + } + + fun service(service: PayStatementItemServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisCompanyPayStatementItemListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisCompanyPayStatementItemListPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisCompanyPayStatementItemListPageAsync = + HrisCompanyPayStatementItemListPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisCompanyPayStatementItemListPageAsync) { @@ -97,4 +139,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemListPageAsync{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt index 2d27aa04..cb2c5147 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.company.payStatementItem.RuleService import java.util.Objects import java.util.Optional @@ -9,20 +10,14 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** - * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical - * support will be added soon List all rules of a connection account. - */ +/** @see [RuleService.list] */ class HrisCompanyPayStatementItemRuleListPage private constructor( - private val rulesService: RuleService, + private val service: RuleService, private val params: HrisCompanyPayStatementItemRuleListParams, private val response: HrisCompanyPayStatementItemRuleListPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisCompanyPayStatementItemRuleListPageResponse = response - /** * Delegates to [HrisCompanyPayStatementItemRuleListPageResponse], but gracefully handles * missing data. @@ -32,37 +27,87 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun hasNextPage(): Boolean = responses().isNotEmpty() - return /* spotless:off */ other is HrisCompanyPayStatementItemRuleListPage && rulesService == other.rulesService && params == other.params && response == other.response /* spotless:on */ - } + fun getNextPageParams(): Optional = Optional.empty() - override fun hashCode(): Int = /* spotless:off */ Objects.hash(rulesService, params, response) /* spotless:on */ + fun getNextPage(): Optional = + getNextPageParams().map { service.list(it) } - override fun toString() = - "HrisCompanyPayStatementItemRuleListPage{rulesService=$rulesService, params=$params, response=$response}" + fun autoPager(): AutoPager = AutoPager(this) - fun hasNextPage(): Boolean = responses().isNotEmpty() + /** The parameters that were used to request this page. */ + fun params(): HrisCompanyPayStatementItemRuleListParams = params - fun getNextPageParams(): Optional = Optional.empty() + /** The response that this page was parsed from. */ + fun response(): HrisCompanyPayStatementItemRuleListPageResponse = response - fun getNextPage(): Optional { - return getNextPageParams().map { rulesService.list(it) } + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisCompanyPayStatementItemRuleListPage]. */ + class Builder internal constructor() { - companion object { + private var service: RuleService? = null + private var params: HrisCompanyPayStatementItemRuleListParams? = null + private var response: HrisCompanyPayStatementItemRuleListPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemRuleListPage: HrisCompanyPayStatementItemRuleListPage + ) = apply { + service = hrisCompanyPayStatementItemRuleListPage.service + params = hrisCompanyPayStatementItemRuleListPage.params + response = hrisCompanyPayStatementItemRuleListPage.response + } - @JvmStatic - fun of( - rulesService: RuleService, - params: HrisCompanyPayStatementItemRuleListParams, - response: HrisCompanyPayStatementItemRuleListPageResponse, - ) = HrisCompanyPayStatementItemRuleListPage(rulesService, params, response) + fun service(service: RuleService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisCompanyPayStatementItemRuleListParams) = apply { + this.params = params + } + + /** The response that this page was parsed from. */ + fun response(response: HrisCompanyPayStatementItemRuleListPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemRuleListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisCompanyPayStatementItemRuleListPage = + HrisCompanyPayStatementItemRuleListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisCompanyPayStatementItemRuleListPage) : @@ -84,4 +129,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemRuleListPage && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleListPage{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt index 510961b7..269318ac 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisCompanyPayStatementItemRuleListPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.company.payStatementItem.RuleServiceAsync import java.util.Objects import java.util.Optional @@ -10,20 +11,14 @@ import java.util.concurrent.Executor import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull -/** - * **Beta:** this endpoint currently serves employers onboarded after March 4th and historical - * support will be added soon List all rules of a connection account. - */ +/** @see [RuleServiceAsync.list] */ class HrisCompanyPayStatementItemRuleListPageAsync private constructor( - private val rulesService: RuleServiceAsync, + private val service: RuleServiceAsync, private val params: HrisCompanyPayStatementItemRuleListParams, private val response: HrisCompanyPayStatementItemRuleListPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisCompanyPayStatementItemRuleListPageResponse = response - /** * Delegates to [HrisCompanyPayStatementItemRuleListPageResponse], but gracefully handles * missing data. @@ -33,39 +28,90 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisCompanyPayStatementItemRuleListPageAsync && rulesService == other.rulesService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(rulesService, params, response) /* spotless:on */ - - override fun toString() = - "HrisCompanyPayStatementItemRuleListPageAsync{rulesService=$rulesService, params=$params, response=$response}" - fun hasNextPage(): Boolean = responses().isNotEmpty() fun getNextPageParams(): Optional = Optional.empty() - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { rulesService.list(it).thenApply { Optional.of(it) } } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.list(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisCompanyPayStatementItemRuleListParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisCompanyPayStatementItemRuleListPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - rulesService: RuleServiceAsync, - params: HrisCompanyPayStatementItemRuleListParams, - response: HrisCompanyPayStatementItemRuleListPageResponse, - ) = HrisCompanyPayStatementItemRuleListPageAsync(rulesService, params, response) + /** + * Returns a mutable builder for constructing an instance of + * [HrisCompanyPayStatementItemRuleListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisCompanyPayStatementItemRuleListPageAsync]. */ + class Builder internal constructor() { + + private var service: RuleServiceAsync? = null + private var params: HrisCompanyPayStatementItemRuleListParams? = null + private var response: HrisCompanyPayStatementItemRuleListPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisCompanyPayStatementItemRuleListPageAsync: + HrisCompanyPayStatementItemRuleListPageAsync + ) = apply { + service = hrisCompanyPayStatementItemRuleListPageAsync.service + params = hrisCompanyPayStatementItemRuleListPageAsync.params + response = hrisCompanyPayStatementItemRuleListPageAsync.response + } + + fun service(service: RuleServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisCompanyPayStatementItemRuleListParams) = apply { + this.params = params + } + + /** The response that this page was parsed from. */ + fun response(response: HrisCompanyPayStatementItemRuleListPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisCompanyPayStatementItemRuleListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisCompanyPayStatementItemRuleListPageAsync = + HrisCompanyPayStatementItemRuleListPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisCompanyPayStatementItemRuleListPageAsync) { @@ -96,4 +142,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisCompanyPayStatementItemRuleListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisCompanyPayStatementItemRuleListPageAsync{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt index 976f4206..eeafc093 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.DirectoryService import java.util.Objects import java.util.Optional @@ -10,18 +11,15 @@ import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrDefault import kotlin.jvm.optionals.getOrNull -/** Read company directory and organization structure */ +/** @see [DirectoryService.listIndividuals] */ @Deprecated("use `list` instead") class HrisDirectoryListIndividualsPage private constructor( - private val directoryService: DirectoryService, + private val service: DirectoryService, private val params: HrisDirectoryListIndividualsParams, private val response: HrisDirectoryListIndividualsPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisDirectoryListIndividualsPageResponse = response - /** * Delegates to [HrisDirectoryListIndividualsPageResponse], but gracefully handles missing data. * @@ -37,19 +35,6 @@ private constructor( */ fun paging(): Optional = response._paging().getOptional("paging") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisDirectoryListIndividualsPage && directoryService == other.directoryService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(directoryService, params, response) /* spotless:on */ - - override fun toString() = - "HrisDirectoryListIndividualsPage{directoryService=$directoryService, params=$params, response=$response}" - fun hasNextPage(): Boolean { if (individuals().isEmpty()) { return false @@ -70,20 +55,80 @@ private constructor( return Optional.of(params.toBuilder().offset(offset + individuals().size).build()) } - fun getNextPage(): Optional { - return getNextPageParams().map { directoryService.listIndividuals(it) } - } + fun getNextPage(): Optional = + getNextPageParams().map { service.listIndividuals(it) } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisDirectoryListIndividualsParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisDirectoryListIndividualsPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - directoryService: DirectoryService, - params: HrisDirectoryListIndividualsParams, - response: HrisDirectoryListIndividualsPageResponse, - ) = HrisDirectoryListIndividualsPage(directoryService, params, response) + /** + * Returns a mutable builder for constructing an instance of + * [HrisDirectoryListIndividualsPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisDirectoryListIndividualsPage]. */ + class Builder internal constructor() { + + private var service: DirectoryService? = null + private var params: HrisDirectoryListIndividualsParams? = null + private var response: HrisDirectoryListIndividualsPageResponse? = null + + @JvmSynthetic + internal fun from(hrisDirectoryListIndividualsPage: HrisDirectoryListIndividualsPage) = + apply { + service = hrisDirectoryListIndividualsPage.service + params = hrisDirectoryListIndividualsPage.params + response = hrisDirectoryListIndividualsPage.response + } + + fun service(service: DirectoryService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisDirectoryListIndividualsParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisDirectoryListIndividualsPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisDirectoryListIndividualsPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisDirectoryListIndividualsPage = + HrisDirectoryListIndividualsPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisDirectoryListIndividualsPage) : @@ -105,4 +150,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisDirectoryListIndividualsPage && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisDirectoryListIndividualsPage{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt index 58819226..e7480379 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListIndividualsPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.DirectoryServiceAsync import java.util.Objects import java.util.Optional @@ -11,18 +12,15 @@ import java.util.function.Predicate import kotlin.jvm.optionals.getOrDefault import kotlin.jvm.optionals.getOrNull -/** Read company directory and organization structure */ +/** @see [DirectoryServiceAsync.listIndividuals] */ @Deprecated("use `list` instead") class HrisDirectoryListIndividualsPageAsync private constructor( - private val directoryService: DirectoryServiceAsync, + private val service: DirectoryServiceAsync, private val params: HrisDirectoryListIndividualsParams, private val response: HrisDirectoryListIndividualsPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisDirectoryListIndividualsPageResponse = response - /** * Delegates to [HrisDirectoryListIndividualsPageResponse], but gracefully handles missing data. * @@ -38,19 +36,6 @@ private constructor( */ fun paging(): Optional = response._paging().getOptional("paging") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisDirectoryListIndividualsPageAsync && directoryService == other.directoryService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(directoryService, params, response) /* spotless:on */ - - override fun toString() = - "HrisDirectoryListIndividualsPageAsync{directoryService=$directoryService, params=$params, response=$response}" - fun hasNextPage(): Boolean { if (individuals().isEmpty()) { return false @@ -71,22 +56,83 @@ private constructor( return Optional.of(params.toBuilder().offset(offset + individuals().size).build()) } - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { directoryService.listIndividuals(it).thenApply { Optional.of(it) } } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.listIndividuals(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisDirectoryListIndividualsParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisDirectoryListIndividualsPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - directoryService: DirectoryServiceAsync, - params: HrisDirectoryListIndividualsParams, - response: HrisDirectoryListIndividualsPageResponse, - ) = HrisDirectoryListIndividualsPageAsync(directoryService, params, response) + /** + * Returns a mutable builder for constructing an instance of + * [HrisDirectoryListIndividualsPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisDirectoryListIndividualsPageAsync]. */ + class Builder internal constructor() { + + private var service: DirectoryServiceAsync? = null + private var params: HrisDirectoryListIndividualsParams? = null + private var response: HrisDirectoryListIndividualsPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisDirectoryListIndividualsPageAsync: HrisDirectoryListIndividualsPageAsync + ) = apply { + service = hrisDirectoryListIndividualsPageAsync.service + params = hrisDirectoryListIndividualsPageAsync.params + response = hrisDirectoryListIndividualsPageAsync.response + } + + fun service(service: DirectoryServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisDirectoryListIndividualsParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisDirectoryListIndividualsPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisDirectoryListIndividualsPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisDirectoryListIndividualsPageAsync = + HrisDirectoryListIndividualsPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisDirectoryListIndividualsPageAsync) { @@ -117,4 +163,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisDirectoryListIndividualsPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisDirectoryListIndividualsPageAsync{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt index 838dcd26..36eff6a0 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.DirectoryService import java.util.Objects import java.util.Optional @@ -10,17 +11,14 @@ import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrDefault import kotlin.jvm.optionals.getOrNull -/** Read company directory and organization structure */ +/** @see [DirectoryService.list] */ class HrisDirectoryListPage private constructor( - private val directoryService: DirectoryService, + private val service: DirectoryService, private val params: HrisDirectoryListParams, private val response: HrisDirectoryListPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisDirectoryListPageResponse = response - /** * Delegates to [HrisDirectoryListPageResponse], but gracefully handles missing data. * @@ -36,19 +34,6 @@ private constructor( */ fun paging(): Optional = response._paging().getOptional("paging") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisDirectoryListPage && directoryService == other.directoryService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(directoryService, params, response) /* spotless:on */ - - override fun toString() = - "HrisDirectoryListPage{directoryService=$directoryService, params=$params, response=$response}" - fun hasNextPage(): Boolean { if (individuals().isEmpty()) { return false @@ -69,20 +54,76 @@ private constructor( return Optional.of(params.toBuilder().offset(offset + individuals().size).build()) } - fun getNextPage(): Optional { - return getNextPageParams().map { directoryService.list(it) } - } + fun getNextPage(): Optional = + getNextPageParams().map { service.list(it) } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisDirectoryListParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisDirectoryListPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - directoryService: DirectoryService, - params: HrisDirectoryListParams, - response: HrisDirectoryListPageResponse, - ) = HrisDirectoryListPage(directoryService, params, response) + /** + * Returns a mutable builder for constructing an instance of [HrisDirectoryListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisDirectoryListPage]. */ + class Builder internal constructor() { + + private var service: DirectoryService? = null + private var params: HrisDirectoryListParams? = null + private var response: HrisDirectoryListPageResponse? = null + + @JvmSynthetic + internal fun from(hrisDirectoryListPage: HrisDirectoryListPage) = apply { + service = hrisDirectoryListPage.service + params = hrisDirectoryListPage.params + response = hrisDirectoryListPage.response + } + + fun service(service: DirectoryService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisDirectoryListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisDirectoryListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [HrisDirectoryListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisDirectoryListPage = + HrisDirectoryListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisDirectoryListPage) : @@ -104,4 +145,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisDirectoryListPage && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisDirectoryListPage{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt index 7c1035e1..bc8d9645 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisDirectoryListPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.DirectoryServiceAsync import java.util.Objects import java.util.Optional @@ -11,17 +12,14 @@ import java.util.function.Predicate import kotlin.jvm.optionals.getOrDefault import kotlin.jvm.optionals.getOrNull -/** Read company directory and organization structure */ +/** @see [DirectoryServiceAsync.list] */ class HrisDirectoryListPageAsync private constructor( - private val directoryService: DirectoryServiceAsync, + private val service: DirectoryServiceAsync, private val params: HrisDirectoryListParams, private val response: HrisDirectoryListPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisDirectoryListPageResponse = response - /** * Delegates to [HrisDirectoryListPageResponse], but gracefully handles missing data. * @@ -37,19 +35,6 @@ private constructor( */ fun paging(): Optional = response._paging().getOptional("paging") - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisDirectoryListPageAsync && directoryService == other.directoryService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(directoryService, params, response) /* spotless:on */ - - override fun toString() = - "HrisDirectoryListPageAsync{directoryService=$directoryService, params=$params, response=$response}" - fun hasNextPage(): Boolean { if (individuals().isEmpty()) { return false @@ -70,22 +55,78 @@ private constructor( return Optional.of(params.toBuilder().offset(offset + individuals().size).build()) } - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { directoryService.list(it).thenApply { Optional.of(it) } } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.list(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisDirectoryListParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisDirectoryListPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - directoryService: DirectoryServiceAsync, - params: HrisDirectoryListParams, - response: HrisDirectoryListPageResponse, - ) = HrisDirectoryListPageAsync(directoryService, params, response) + /** + * Returns a mutable builder for constructing an instance of [HrisDirectoryListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisDirectoryListPageAsync]. */ + class Builder internal constructor() { + + private var service: DirectoryServiceAsync? = null + private var params: HrisDirectoryListParams? = null + private var response: HrisDirectoryListPageResponse? = null + + @JvmSynthetic + internal fun from(hrisDirectoryListPageAsync: HrisDirectoryListPageAsync) = apply { + service = hrisDirectoryListPageAsync.service + params = hrisDirectoryListPageAsync.params + response = hrisDirectoryListPageAsync.response + } + + fun service(service: DirectoryServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisDirectoryListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisDirectoryListPageResponse) = apply { this.response = response } + + /** + * Returns an immutable instance of [HrisDirectoryListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisDirectoryListPageAsync = + HrisDirectoryListPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisDirectoryListPageAsync) { @@ -116,4 +157,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisDirectoryListPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisDirectoryListPageAsync{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt index 128f6ce1..9987671a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.EmploymentService import java.util.Objects import java.util.Optional @@ -9,17 +10,14 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** Read individual employment and income data */ +/** @see [EmploymentService.retrieveMany] */ class HrisEmploymentRetrieveManyPage private constructor( - private val employmentsService: EmploymentService, + private val service: EmploymentService, private val params: HrisEmploymentRetrieveManyParams, private val response: HrisEmploymentRetrieveManyPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisEmploymentRetrieveManyPageResponse = response - /** * Delegates to [HrisEmploymentRetrieveManyPageResponse], but gracefully handles missing data. * @@ -28,37 +26,83 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun hasNextPage(): Boolean = responses().isNotEmpty() - return /* spotless:off */ other is HrisEmploymentRetrieveManyPage && employmentsService == other.employmentsService && params == other.params && response == other.response /* spotless:on */ - } + fun getNextPageParams(): Optional = Optional.empty() - override fun hashCode(): Int = /* spotless:off */ Objects.hash(employmentsService, params, response) /* spotless:on */ + fun getNextPage(): Optional = + getNextPageParams().map { service.retrieveMany(it) } - override fun toString() = - "HrisEmploymentRetrieveManyPage{employmentsService=$employmentsService, params=$params, response=$response}" + fun autoPager(): AutoPager = AutoPager(this) - fun hasNextPage(): Boolean = responses().isNotEmpty() + /** The parameters that were used to request this page. */ + fun params(): HrisEmploymentRetrieveManyParams = params - fun getNextPageParams(): Optional = Optional.empty() + /** The response that this page was parsed from. */ + fun response(): HrisEmploymentRetrieveManyPageResponse = response - fun getNextPage(): Optional { - return getNextPageParams().map { employmentsService.retrieveMany(it) } + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisEmploymentRetrieveManyPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisEmploymentRetrieveManyPage]. */ + class Builder internal constructor() { - companion object { + private var service: EmploymentService? = null + private var params: HrisEmploymentRetrieveManyParams? = null + private var response: HrisEmploymentRetrieveManyPageResponse? = null + + @JvmSynthetic + internal fun from(hrisEmploymentRetrieveManyPage: HrisEmploymentRetrieveManyPage) = apply { + service = hrisEmploymentRetrieveManyPage.service + params = hrisEmploymentRetrieveManyPage.params + response = hrisEmploymentRetrieveManyPage.response + } + + fun service(service: EmploymentService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisEmploymentRetrieveManyParams) = apply { this.params = params } - @JvmStatic - fun of( - employmentsService: EmploymentService, - params: HrisEmploymentRetrieveManyParams, - response: HrisEmploymentRetrieveManyPageResponse, - ) = HrisEmploymentRetrieveManyPage(employmentsService, params, response) + /** The response that this page was parsed from. */ + fun response(response: HrisEmploymentRetrieveManyPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisEmploymentRetrieveManyPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisEmploymentRetrieveManyPage = + HrisEmploymentRetrieveManyPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisEmploymentRetrieveManyPage) : @@ -80,4 +124,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisEmploymentRetrieveManyPage && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisEmploymentRetrieveManyPage{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt index 8298a799..83f3ed95 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisEmploymentRetrieveManyPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.EmploymentServiceAsync import java.util.Objects import java.util.Optional @@ -10,17 +11,14 @@ import java.util.concurrent.Executor import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull -/** Read individual employment and income data */ +/** @see [EmploymentServiceAsync.retrieveMany] */ class HrisEmploymentRetrieveManyPageAsync private constructor( - private val employmentsService: EmploymentServiceAsync, + private val service: EmploymentServiceAsync, private val params: HrisEmploymentRetrieveManyParams, private val response: HrisEmploymentRetrieveManyPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisEmploymentRetrieveManyPageResponse = response - /** * Delegates to [HrisEmploymentRetrieveManyPageResponse], but gracefully handles missing data. * @@ -29,39 +27,87 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisEmploymentRetrieveManyPageAsync && employmentsService == other.employmentsService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(employmentsService, params, response) /* spotless:on */ - - override fun toString() = - "HrisEmploymentRetrieveManyPageAsync{employmentsService=$employmentsService, params=$params, response=$response}" - fun hasNextPage(): Boolean = responses().isNotEmpty() fun getNextPageParams(): Optional = Optional.empty() - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { employmentsService.retrieveMany(it).thenApply { Optional.of(it) } } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.retrieveMany(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisEmploymentRetrieveManyParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisEmploymentRetrieveManyPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - employmentsService: EmploymentServiceAsync, - params: HrisEmploymentRetrieveManyParams, - response: HrisEmploymentRetrieveManyPageResponse, - ) = HrisEmploymentRetrieveManyPageAsync(employmentsService, params, response) + /** + * Returns a mutable builder for constructing an instance of + * [HrisEmploymentRetrieveManyPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisEmploymentRetrieveManyPageAsync]. */ + class Builder internal constructor() { + + private var service: EmploymentServiceAsync? = null + private var params: HrisEmploymentRetrieveManyParams? = null + private var response: HrisEmploymentRetrieveManyPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisEmploymentRetrieveManyPageAsync: HrisEmploymentRetrieveManyPageAsync + ) = apply { + service = hrisEmploymentRetrieveManyPageAsync.service + params = hrisEmploymentRetrieveManyPageAsync.params + response = hrisEmploymentRetrieveManyPageAsync.response + } + + fun service(service: EmploymentServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisEmploymentRetrieveManyParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisEmploymentRetrieveManyPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisEmploymentRetrieveManyPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisEmploymentRetrieveManyPageAsync = + HrisEmploymentRetrieveManyPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisEmploymentRetrieveManyPageAsync) { @@ -92,4 +138,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisEmploymentRetrieveManyPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisEmploymentRetrieveManyPageAsync{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt index 4ce3f385..e9c57c27 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.IndividualService import java.util.Objects import java.util.Optional @@ -9,17 +10,14 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** Read individual data, excluding income and employment data */ +/** @see [IndividualService.retrieveMany] */ class HrisIndividualRetrieveManyPage private constructor( - private val individualsService: IndividualService, + private val service: IndividualService, private val params: HrisIndividualRetrieveManyParams, private val response: HrisIndividualRetrieveManyPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisIndividualRetrieveManyPageResponse = response - /** * Delegates to [HrisIndividualRetrieveManyPageResponse], but gracefully handles missing data. * @@ -28,37 +26,83 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun hasNextPage(): Boolean = responses().isNotEmpty() - return /* spotless:off */ other is HrisIndividualRetrieveManyPage && individualsService == other.individualsService && params == other.params && response == other.response /* spotless:on */ - } + fun getNextPageParams(): Optional = Optional.empty() - override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, response) /* spotless:on */ + fun getNextPage(): Optional = + getNextPageParams().map { service.retrieveMany(it) } - override fun toString() = - "HrisIndividualRetrieveManyPage{individualsService=$individualsService, params=$params, response=$response}" + fun autoPager(): AutoPager = AutoPager(this) - fun hasNextPage(): Boolean = responses().isNotEmpty() + /** The parameters that were used to request this page. */ + fun params(): HrisIndividualRetrieveManyParams = params - fun getNextPageParams(): Optional = Optional.empty() + /** The response that this page was parsed from. */ + fun response(): HrisIndividualRetrieveManyPageResponse = response - fun getNextPage(): Optional { - return getNextPageParams().map { individualsService.retrieveMany(it) } + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisIndividualRetrieveManyPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisIndividualRetrieveManyPage]. */ + class Builder internal constructor() { - companion object { + private var service: IndividualService? = null + private var params: HrisIndividualRetrieveManyParams? = null + private var response: HrisIndividualRetrieveManyPageResponse? = null + + @JvmSynthetic + internal fun from(hrisIndividualRetrieveManyPage: HrisIndividualRetrieveManyPage) = apply { + service = hrisIndividualRetrieveManyPage.service + params = hrisIndividualRetrieveManyPage.params + response = hrisIndividualRetrieveManyPage.response + } + + fun service(service: IndividualService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisIndividualRetrieveManyParams) = apply { this.params = params } - @JvmStatic - fun of( - individualsService: IndividualService, - params: HrisIndividualRetrieveManyParams, - response: HrisIndividualRetrieveManyPageResponse, - ) = HrisIndividualRetrieveManyPage(individualsService, params, response) + /** The response that this page was parsed from. */ + fun response(response: HrisIndividualRetrieveManyPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisIndividualRetrieveManyPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisIndividualRetrieveManyPage = + HrisIndividualRetrieveManyPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisIndividualRetrieveManyPage) : @@ -80,4 +124,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisIndividualRetrieveManyPage && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisIndividualRetrieveManyPage{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt index c76563e1..77678253 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisIndividualRetrieveManyPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.IndividualServiceAsync import java.util.Objects import java.util.Optional @@ -10,17 +11,14 @@ import java.util.concurrent.Executor import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull -/** Read individual data, excluding income and employment data */ +/** @see [IndividualServiceAsync.retrieveMany] */ class HrisIndividualRetrieveManyPageAsync private constructor( - private val individualsService: IndividualServiceAsync, + private val service: IndividualServiceAsync, private val params: HrisIndividualRetrieveManyParams, private val response: HrisIndividualRetrieveManyPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisIndividualRetrieveManyPageResponse = response - /** * Delegates to [HrisIndividualRetrieveManyPageResponse], but gracefully handles missing data. * @@ -29,39 +27,87 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisIndividualRetrieveManyPageAsync && individualsService == other.individualsService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(individualsService, params, response) /* spotless:on */ - - override fun toString() = - "HrisIndividualRetrieveManyPageAsync{individualsService=$individualsService, params=$params, response=$response}" - fun hasNextPage(): Boolean = responses().isNotEmpty() fun getNextPageParams(): Optional = Optional.empty() - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { individualsService.retrieveMany(it).thenApply { Optional.of(it) } } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.retrieveMany(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisIndividualRetrieveManyParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisIndividualRetrieveManyPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - individualsService: IndividualServiceAsync, - params: HrisIndividualRetrieveManyParams, - response: HrisIndividualRetrieveManyPageResponse, - ) = HrisIndividualRetrieveManyPageAsync(individualsService, params, response) + /** + * Returns a mutable builder for constructing an instance of + * [HrisIndividualRetrieveManyPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisIndividualRetrieveManyPageAsync]. */ + class Builder internal constructor() { + + private var service: IndividualServiceAsync? = null + private var params: HrisIndividualRetrieveManyParams? = null + private var response: HrisIndividualRetrieveManyPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisIndividualRetrieveManyPageAsync: HrisIndividualRetrieveManyPageAsync + ) = apply { + service = hrisIndividualRetrieveManyPageAsync.service + params = hrisIndividualRetrieveManyPageAsync.params + response = hrisIndividualRetrieveManyPageAsync.response + } + + fun service(service: IndividualServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisIndividualRetrieveManyParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisIndividualRetrieveManyPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisIndividualRetrieveManyPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisIndividualRetrieveManyPageAsync = + HrisIndividualRetrieveManyPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisIndividualRetrieveManyPageAsync) { @@ -92,4 +138,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisIndividualRetrieveManyPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisIndividualRetrieveManyPageAsync{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt index 84c61ad2..f8a43307 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.PayStatementService import java.util.Objects import java.util.Optional @@ -9,21 +10,14 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** - * Read detailed pay statements for each individual. - * - * Deduction and contribution types are supported by the payroll systems that supports Benefits. - */ +/** @see [PayStatementService.retrieveMany] */ class HrisPayStatementRetrieveManyPage private constructor( - private val payStatementsService: PayStatementService, + private val service: PayStatementService, private val params: HrisPayStatementRetrieveManyParams, private val response: HrisPayStatementRetrieveManyPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisPayStatementRetrieveManyPageResponse = response - /** * Delegates to [HrisPayStatementRetrieveManyPageResponse], but gracefully handles missing data. * @@ -32,37 +26,84 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun hasNextPage(): Boolean = responses().isNotEmpty() - return /* spotless:off */ other is HrisPayStatementRetrieveManyPage && payStatementsService == other.payStatementsService && params == other.params && response == other.response /* spotless:on */ - } + fun getNextPageParams(): Optional = Optional.empty() - override fun hashCode(): Int = /* spotless:off */ Objects.hash(payStatementsService, params, response) /* spotless:on */ + fun getNextPage(): Optional = + getNextPageParams().map { service.retrieveMany(it) } - override fun toString() = - "HrisPayStatementRetrieveManyPage{payStatementsService=$payStatementsService, params=$params, response=$response}" + fun autoPager(): AutoPager = AutoPager(this) - fun hasNextPage(): Boolean = responses().isNotEmpty() + /** The parameters that were used to request this page. */ + fun params(): HrisPayStatementRetrieveManyParams = params - fun getNextPageParams(): Optional = Optional.empty() + /** The response that this page was parsed from. */ + fun response(): HrisPayStatementRetrieveManyPageResponse = response - fun getNextPage(): Optional { - return getNextPageParams().map { payStatementsService.retrieveMany(it) } + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [HrisPayStatementRetrieveManyPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisPayStatementRetrieveManyPage]. */ + class Builder internal constructor() { - companion object { + private var service: PayStatementService? = null + private var params: HrisPayStatementRetrieveManyParams? = null + private var response: HrisPayStatementRetrieveManyPageResponse? = null + + @JvmSynthetic + internal fun from(hrisPayStatementRetrieveManyPage: HrisPayStatementRetrieveManyPage) = + apply { + service = hrisPayStatementRetrieveManyPage.service + params = hrisPayStatementRetrieveManyPage.params + response = hrisPayStatementRetrieveManyPage.response + } + + fun service(service: PayStatementService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisPayStatementRetrieveManyParams) = apply { this.params = params } - @JvmStatic - fun of( - payStatementsService: PayStatementService, - params: HrisPayStatementRetrieveManyParams, - response: HrisPayStatementRetrieveManyPageResponse, - ) = HrisPayStatementRetrieveManyPage(payStatementsService, params, response) + /** The response that this page was parsed from. */ + fun response(response: HrisPayStatementRetrieveManyPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisPayStatementRetrieveManyPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisPayStatementRetrieveManyPage = + HrisPayStatementRetrieveManyPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisPayStatementRetrieveManyPage) : @@ -84,4 +125,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisPayStatementRetrieveManyPage && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisPayStatementRetrieveManyPage{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt index 369a9ee7..2ec1929c 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPayStatementRetrieveManyPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.PayStatementServiceAsync import java.util.Objects import java.util.Optional @@ -10,21 +11,14 @@ import java.util.concurrent.Executor import java.util.function.Predicate import kotlin.jvm.optionals.getOrNull -/** - * Read detailed pay statements for each individual. - * - * Deduction and contribution types are supported by the payroll systems that supports Benefits. - */ +/** @see [PayStatementServiceAsync.retrieveMany] */ class HrisPayStatementRetrieveManyPageAsync private constructor( - private val payStatementsService: PayStatementServiceAsync, + private val service: PayStatementServiceAsync, private val params: HrisPayStatementRetrieveManyParams, private val response: HrisPayStatementRetrieveManyPageResponse, ) { - /** Returns the response that this page was parsed from. */ - fun response(): HrisPayStatementRetrieveManyPageResponse = response - /** * Delegates to [HrisPayStatementRetrieveManyPageResponse], but gracefully handles missing data. * @@ -33,39 +27,87 @@ private constructor( fun responses(): List = response._responses().getOptional("responses").getOrNull() ?: emptyList() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return /* spotless:off */ other is HrisPayStatementRetrieveManyPageAsync && payStatementsService == other.payStatementsService && params == other.params && response == other.response /* spotless:on */ - } - - override fun hashCode(): Int = /* spotless:off */ Objects.hash(payStatementsService, params, response) /* spotless:on */ - - override fun toString() = - "HrisPayStatementRetrieveManyPageAsync{payStatementsService=$payStatementsService, params=$params, response=$response}" - fun hasNextPage(): Boolean = responses().isNotEmpty() fun getNextPageParams(): Optional = Optional.empty() - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { payStatementsService.retrieveMany(it).thenApply { Optional.of(it) } } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.retrieveMany(it).thenApply { Optional.of(it) } } .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - } fun autoPager(): AutoPager = AutoPager(this) + /** The parameters that were used to request this page. */ + fun params(): HrisPayStatementRetrieveManyParams = params + + /** The response that this page was parsed from. */ + fun response(): HrisPayStatementRetrieveManyPageResponse = response + + fun toBuilder() = Builder().from(this) + companion object { - @JvmStatic - fun of( - payStatementsService: PayStatementServiceAsync, - params: HrisPayStatementRetrieveManyParams, - response: HrisPayStatementRetrieveManyPageResponse, - ) = HrisPayStatementRetrieveManyPageAsync(payStatementsService, params, response) + /** + * Returns a mutable builder for constructing an instance of + * [HrisPayStatementRetrieveManyPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [HrisPayStatementRetrieveManyPageAsync]. */ + class Builder internal constructor() { + + private var service: PayStatementServiceAsync? = null + private var params: HrisPayStatementRetrieveManyParams? = null + private var response: HrisPayStatementRetrieveManyPageResponse? = null + + @JvmSynthetic + internal fun from( + hrisPayStatementRetrieveManyPageAsync: HrisPayStatementRetrieveManyPageAsync + ) = apply { + service = hrisPayStatementRetrieveManyPageAsync.service + params = hrisPayStatementRetrieveManyPageAsync.params + response = hrisPayStatementRetrieveManyPageAsync.response + } + + fun service(service: PayStatementServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisPayStatementRetrieveManyParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun response(response: HrisPayStatementRetrieveManyPageResponse) = apply { + this.response = response + } + + /** + * Returns an immutable instance of [HrisPayStatementRetrieveManyPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .response() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisPayStatementRetrieveManyPageAsync = + HrisPayStatementRetrieveManyPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("response", response), + ) } class AutoPager(private val firstPage: HrisPayStatementRetrieveManyPageAsync) { @@ -96,4 +138,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisPayStatementRetrieveManyPageAsync && service == other.service && params == other.params && response == other.response /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, response) /* spotless:on */ + + override fun toString() = + "HrisPayStatementRetrieveManyPageAsync{service=$service, params=$params, response=$response}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt index abfb1a64..82892fa1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.hris.PaymentService import java.util.Objects import java.util.Optional @@ -9,48 +10,87 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** Read payroll and contractor related payments by the company. */ +/** @see [PaymentService.list] */ class HrisPaymentListPage private constructor( - private val paymentsService: PaymentService, + private val service: PaymentService, private val params: HrisPaymentListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is HrisPaymentListPage && paymentsService == other.paymentsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(paymentsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "HrisPaymentListPage{paymentsService=$paymentsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): HrisPaymentListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) + + companion object { - fun getNextPage(): Optional { - return getNextPageParams().map { paymentsService.list(it) } + /** + * Returns a mutable builder for constructing an instance of [HrisPaymentListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisPaymentListPage]. */ + class Builder internal constructor() { - companion object { + private var service: PaymentService? = null + private var params: HrisPaymentListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(hrisPaymentListPage: HrisPaymentListPage) = apply { + service = hrisPaymentListPage.service + params = hrisPaymentListPage.params + items = hrisPaymentListPage.items + } - @JvmStatic - fun of( - paymentsService: PaymentService, - params: HrisPaymentListParams, - items: List, - ) = HrisPaymentListPage(paymentsService, params, items) + fun service(service: PaymentService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisPaymentListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [HrisPaymentListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisPaymentListPage = + HrisPaymentListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisPaymentListPage) : Iterable { @@ -71,4 +111,16 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisPaymentListPage && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = "HrisPaymentListPage{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt index 327da14f..236a00f1 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/HrisPaymentListPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.hris.PaymentServiceAsync import java.util.Objects import java.util.Optional @@ -9,50 +10,90 @@ import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate -/** Read payroll and contractor related payments by the company. */ +/** @see [PaymentServiceAsync.list] */ class HrisPaymentListPageAsync private constructor( - private val paymentsService: PaymentServiceAsync, + private val service: PaymentServiceAsync, private val params: HrisPaymentListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is HrisPaymentListPageAsync && paymentsService == other.paymentsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.list(it).thenApply { Optional.of(it) } } + .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(paymentsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "HrisPaymentListPageAsync{paymentsService=$paymentsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): HrisPaymentListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { paymentsService.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + companion object { + + /** + * Returns a mutable builder for constructing an instance of [HrisPaymentListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [HrisPaymentListPageAsync]. */ + class Builder internal constructor() { - companion object { + private var service: PaymentServiceAsync? = null + private var params: HrisPaymentListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(hrisPaymentListPageAsync: HrisPaymentListPageAsync) = apply { + service = hrisPaymentListPageAsync.service + params = hrisPaymentListPageAsync.params + items = hrisPaymentListPageAsync.items + } - @JvmStatic - fun of( - paymentsService: PaymentServiceAsync, - params: HrisPaymentListParams, - items: List, - ) = HrisPaymentListPageAsync(paymentsService, params, items) + fun service(service: PaymentServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: HrisPaymentListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [HrisPaymentListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): HrisPaymentListPageAsync = + HrisPaymentListPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: HrisPaymentListPageAsync) { @@ -80,4 +121,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is HrisPaymentListPageAsync && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "HrisPaymentListPageAsync{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt index 9de2c369..a6556ac8 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.payroll.PayGroupService import java.util.Objects import java.util.Optional @@ -9,48 +10,88 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** Read company pay groups and frequencies */ +/** @see [PayGroupService.list] */ class PayrollPayGroupListPage private constructor( - private val payGroupsService: PayGroupService, + private val service: PayGroupService, private val params: PayrollPayGroupListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is PayrollPayGroupListPage && payGroupsService == other.payGroupsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): Optional = + getNextPageParams().map { service.list(it) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(payGroupsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "PayrollPayGroupListPage{payGroupsService=$payGroupsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): PayrollPayGroupListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) + + companion object { - fun getNextPage(): Optional { - return getNextPageParams().map { payGroupsService.list(it) } + /** + * Returns a mutable builder for constructing an instance of [PayrollPayGroupListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [PayrollPayGroupListPage]. */ + class Builder internal constructor() { - companion object { + private var service: PayGroupService? = null + private var params: PayrollPayGroupListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(payrollPayGroupListPage: PayrollPayGroupListPage) = apply { + service = payrollPayGroupListPage.service + params = payrollPayGroupListPage.params + items = payrollPayGroupListPage.items + } - @JvmStatic - fun of( - payGroupsService: PayGroupService, - params: PayrollPayGroupListParams, - items: List, - ) = PayrollPayGroupListPage(payGroupsService, params, items) + fun service(service: PayGroupService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: PayrollPayGroupListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [PayrollPayGroupListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PayrollPayGroupListPage = + PayrollPayGroupListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: PayrollPayGroupListPage) : @@ -72,4 +113,17 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PayrollPayGroupListPage && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "PayrollPayGroupListPage{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt index 40752dec..98a97b4f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/PayrollPayGroupListPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.payroll.PayGroupServiceAsync import java.util.Objects import java.util.Optional @@ -9,50 +10,90 @@ import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate -/** Read company pay groups and frequencies */ +/** @see [PayGroupServiceAsync.list] */ class PayrollPayGroupListPageAsync private constructor( - private val payGroupsService: PayGroupServiceAsync, + private val service: PayGroupServiceAsync, private val params: PayrollPayGroupListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is PayrollPayGroupListPageAsync && payGroupsService == other.payGroupsService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.list(it).thenApply { Optional.of(it) } } + .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(payGroupsService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "PayrollPayGroupListPageAsync{payGroupsService=$payGroupsService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): PayrollPayGroupListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { payGroupsService.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + companion object { + + /** + * Returns a mutable builder for constructing an instance of [PayrollPayGroupListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [PayrollPayGroupListPageAsync]. */ + class Builder internal constructor() { - companion object { + private var service: PayGroupServiceAsync? = null + private var params: PayrollPayGroupListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(payrollPayGroupListPageAsync: PayrollPayGroupListPageAsync) = apply { + service = payrollPayGroupListPageAsync.service + params = payrollPayGroupListPageAsync.params + items = payrollPayGroupListPageAsync.items + } - @JvmStatic - fun of( - payGroupsService: PayGroupServiceAsync, - params: PayrollPayGroupListParams, - items: List, - ) = PayrollPayGroupListPageAsync(payGroupsService, params, items) + fun service(service: PayGroupServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: PayrollPayGroupListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [PayrollPayGroupListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): PayrollPayGroupListPageAsync = + PayrollPayGroupListPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: PayrollPayGroupListPageAsync) { @@ -83,4 +124,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is PayrollPayGroupListPageAsync && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "PayrollPayGroupListPageAsync{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt index 946b84fe..fddd8a63 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPage.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.blocking.ProviderService import java.util.Objects import java.util.Optional @@ -9,48 +10,87 @@ import java.util.stream.Stream import java.util.stream.StreamSupport import kotlin.jvm.optionals.getOrNull -/** Return details on all available payroll and HR systems. */ +/** @see [ProviderService.list] */ class ProviderListPage private constructor( - private val providersService: ProviderService, + private val service: ProviderService, private val params: ProviderListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is ProviderListPage && providersService == other.providersService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): Optional = getNextPageParams().map { service.list(it) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(providersService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "ProviderListPage{providersService=$providersService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): ProviderListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) + + companion object { - fun getNextPage(): Optional { - return getNextPageParams().map { providersService.list(it) } + /** + * Returns a mutable builder for constructing an instance of [ProviderListPage]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [ProviderListPage]. */ + class Builder internal constructor() { - companion object { + private var service: ProviderService? = null + private var params: ProviderListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(providerListPage: ProviderListPage) = apply { + service = providerListPage.service + params = providerListPage.params + items = providerListPage.items + } - @JvmStatic - fun of( - providersService: ProviderService, - params: ProviderListParams, - items: List, - ) = ProviderListPage(providersService, params, items) + fun service(service: ProviderService) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: ProviderListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [ProviderListPage]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ProviderListPage = + ProviderListPage( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: ProviderListPage) : Iterable { @@ -71,4 +111,16 @@ private constructor( return StreamSupport.stream(spliterator(), false) } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProviderListPage && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = "ProviderListPage{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt index 1e416f73..bdb79fb7 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/models/ProviderListPageAsync.kt @@ -2,6 +2,7 @@ package com.tryfinch.api.models +import com.tryfinch.api.core.checkRequired import com.tryfinch.api.services.async.ProviderServiceAsync import java.util.Objects import java.util.Optional @@ -9,50 +10,90 @@ import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor import java.util.function.Predicate -/** Return details on all available payroll and HR systems. */ +/** @see [ProviderServiceAsync.list] */ class ProviderListPageAsync private constructor( - private val providersService: ProviderServiceAsync, + private val service: ProviderServiceAsync, private val params: ProviderListParams, private val items: List, ) { - /** Returns the response that this page was parsed from. */ - fun items(): List = items + fun hasNextPage(): Boolean = items.isNotEmpty() - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } + fun getNextPageParams(): Optional = Optional.empty() - return /* spotless:off */ other is ProviderListPageAsync && providersService == other.providersService && params == other.params && items == other.items /* spotless:on */ - } + fun getNextPage(): CompletableFuture> = + getNextPageParams() + .map { service.list(it).thenApply { Optional.of(it) } } + .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } - override fun hashCode(): Int = /* spotless:off */ Objects.hash(providersService, params, items) /* spotless:on */ + fun autoPager(): AutoPager = AutoPager(this) - override fun toString() = - "ProviderListPageAsync{providersService=$providersService, params=$params, items=$items}" + /** The parameters that were used to request this page. */ + fun params(): ProviderListParams = params - fun hasNextPage(): Boolean = items.isNotEmpty() + /** The response that this page was parsed from. */ + fun items(): List = items - fun getNextPageParams(): Optional = Optional.empty() + fun toBuilder() = Builder().from(this) - fun getNextPage(): CompletableFuture> { - return getNextPageParams() - .map { providersService.list(it).thenApply { Optional.of(it) } } - .orElseGet { CompletableFuture.completedFuture(Optional.empty()) } + companion object { + + /** + * Returns a mutable builder for constructing an instance of [ProviderListPageAsync]. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + */ + @JvmStatic fun builder() = Builder() } - fun autoPager(): AutoPager = AutoPager(this) + /** A builder for [ProviderListPageAsync]. */ + class Builder internal constructor() { - companion object { + private var service: ProviderServiceAsync? = null + private var params: ProviderListParams? = null + private var items: List? = null + + @JvmSynthetic + internal fun from(providerListPageAsync: ProviderListPageAsync) = apply { + service = providerListPageAsync.service + params = providerListPageAsync.params + items = providerListPageAsync.items + } - @JvmStatic - fun of( - providersService: ProviderServiceAsync, - params: ProviderListParams, - items: List, - ) = ProviderListPageAsync(providersService, params, items) + fun service(service: ProviderServiceAsync) = apply { this.service = service } + + /** The parameters that were used to request this page. */ + fun params(params: ProviderListParams) = apply { this.params = params } + + /** The response that this page was parsed from. */ + fun items(items: List) = apply { this.items = items } + + /** + * Returns an immutable instance of [ProviderListPageAsync]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .service() + * .params() + * .items() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ProviderListPageAsync = + ProviderListPageAsync( + checkRequired("service", service), + checkRequired("params", params), + checkRequired("items", items), + ) } class AutoPager(private val firstPage: ProviderListPageAsync) { @@ -80,4 +121,17 @@ private constructor( return forEach(values::add, executor).thenApply { values } } } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return /* spotless:off */ other is ProviderListPageAsync && service == other.service && params == other.params && items == other.items /* spotless:on */ + } + + override fun hashCode(): Int = /* spotless:off */ Objects.hash(service, params, items) /* spotless:on */ + + override fun toString() = + "ProviderListPageAsync{service=$service, params=$params, items=$items}" } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt index 1aed912f..faaef5e4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/ProviderServiceAsyncImpl.kt @@ -66,11 +66,11 @@ class ProviderServiceAsyncImpl internal constructor(private val clientOptions: C } } .let { - ProviderListPageAsync.of( - ProviderServiceAsyncImpl(clientOptions), - params, - it, - ) + ProviderListPageAsync.builder() + .service(ProviderServiceAsyncImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt index 3bca46b9..3eefa17d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/BenefitServiceAsyncImpl.kt @@ -210,11 +210,11 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl } } .let { - HrisBenefitListPageAsync.of( - BenefitServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisBenefitListPageAsync.builder() + .service(BenefitServiceAsyncImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } @@ -250,11 +250,11 @@ class BenefitServiceAsyncImpl internal constructor(private val clientOptions: Cl } } .let { - HrisBenefitListSupportedBenefitsPageAsync.of( - BenefitServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisBenefitListSupportedBenefitsPageAsync.builder() + .service(BenefitServiceAsyncImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt index 00974814..dfe58374 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/DirectoryServiceAsyncImpl.kt @@ -78,11 +78,11 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: } } .let { - HrisDirectoryListPageAsync.of( - DirectoryServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisDirectoryListPageAsync.builder() + .service(DirectoryServiceAsyncImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } @@ -116,11 +116,11 @@ class DirectoryServiceAsyncImpl internal constructor(private val clientOptions: } } .let { - HrisDirectoryListIndividualsPageAsync.of( - DirectoryServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisDirectoryListIndividualsPageAsync.builder() + .service(DirectoryServiceAsyncImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt index d7b724b3..395a53ff 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/EmploymentServiceAsyncImpl.kt @@ -69,11 +69,11 @@ class EmploymentServiceAsyncImpl internal constructor(private val clientOptions: } } .let { - HrisEmploymentRetrieveManyPageAsync.of( - EmploymentServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisEmploymentRetrieveManyPageAsync.builder() + .service(EmploymentServiceAsyncImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt index f8bffb62..20b0435f 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/IndividualServiceAsyncImpl.kt @@ -69,11 +69,11 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: } } .let { - HrisIndividualRetrieveManyPageAsync.of( - IndividualServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisIndividualRetrieveManyPageAsync.builder() + .service(IndividualServiceAsyncImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt index b022515e..cfae8dc4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PayStatementServiceAsyncImpl.kt @@ -69,11 +69,11 @@ class PayStatementServiceAsyncImpl internal constructor(private val clientOption } } .let { - HrisPayStatementRetrieveManyPageAsync.of( - PayStatementServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisPayStatementRetrieveManyPageAsync.builder() + .service(PayStatementServiceAsyncImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt index 1865fb77..35690383 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/PaymentServiceAsyncImpl.kt @@ -66,11 +66,11 @@ class PaymentServiceAsyncImpl internal constructor(private val clientOptions: Cl } } .let { - HrisPaymentListPageAsync.of( - PaymentServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisPaymentListPageAsync.builder() + .service(PaymentServiceAsyncImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt index 2ea6a3b6..08d6b37a 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/benefits/IndividualServiceAsyncImpl.kt @@ -116,11 +116,11 @@ class IndividualServiceAsyncImpl internal constructor(private val clientOptions: } } .let { - HrisBenefitIndividualRetrieveManyBenefitsPageAsync.of( - IndividualServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisBenefitIndividualRetrieveManyBenefitsPageAsync.builder() + .service(IndividualServiceAsyncImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt index 5c9634dd..c7b25159 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/PayStatementItemServiceAsyncImpl.kt @@ -79,11 +79,11 @@ internal constructor(private val clientOptions: ClientOptions) : PayStatementIte } } .let { - HrisCompanyPayStatementItemListPageAsync.of( - PayStatementItemServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisCompanyPayStatementItemListPageAsync.builder() + .service(PayStatementItemServiceAsyncImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt index d3d5726f..3d5e6225 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/hris/company/payStatementItem/RuleServiceAsyncImpl.kt @@ -155,11 +155,11 @@ class RuleServiceAsyncImpl internal constructor(private val clientOptions: Clien } } .let { - HrisCompanyPayStatementItemRuleListPageAsync.of( - RuleServiceAsyncImpl(clientOptions), - params, - it, - ) + HrisCompanyPayStatementItemRuleListPageAsync.builder() + .service(RuleServiceAsyncImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt index 4059ca8b..1807f79b 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/async/payroll/PayGroupServiceAsyncImpl.kt @@ -106,11 +106,11 @@ class PayGroupServiceAsyncImpl internal constructor(private val clientOptions: C } } .let { - PayrollPayGroupListPageAsync.of( - PayGroupServiceAsyncImpl(clientOptions), - params, - it, - ) + PayrollPayGroupListPageAsync.builder() + .service(PayGroupServiceAsyncImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt index c371b21c..0e75130d 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/ProviderServiceImpl.kt @@ -62,7 +62,13 @@ class ProviderServiceImpl internal constructor(private val clientOptions: Client it.forEach { it.validate() } } } - .let { ProviderListPage.of(ProviderServiceImpl(clientOptions), params, it) } + .let { + ProviderListPage.builder() + .service(ProviderServiceImpl(clientOptions)) + .params(params) + .items(it) + .build() + } } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt index 08445899..98cd9792 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/BenefitServiceImpl.kt @@ -195,7 +195,13 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO it.forEach { it.validate() } } } - .let { HrisBenefitListPage.of(BenefitServiceImpl(clientOptions), params, it) } + .let { + HrisBenefitListPage.builder() + .service(BenefitServiceImpl(clientOptions)) + .params(params) + .items(it) + .build() + } } } @@ -227,11 +233,11 @@ class BenefitServiceImpl internal constructor(private val clientOptions: ClientO } } .let { - HrisBenefitListSupportedBenefitsPage.of( - BenefitServiceImpl(clientOptions), - params, - it, - ) + HrisBenefitListSupportedBenefitsPage.builder() + .service(BenefitServiceImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt index ed699622..b4ecac79 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/DirectoryServiceImpl.kt @@ -75,7 +75,11 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien } } .let { - HrisDirectoryListPage.of(DirectoryServiceImpl(clientOptions), params, it) + HrisDirectoryListPage.builder() + .service(DirectoryServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } @@ -106,11 +110,11 @@ class DirectoryServiceImpl internal constructor(private val clientOptions: Clien } } .let { - HrisDirectoryListIndividualsPage.of( - DirectoryServiceImpl(clientOptions), - params, - it, - ) + HrisDirectoryListIndividualsPage.builder() + .service(DirectoryServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt index 804b5376..b3fbd9b9 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/EmploymentServiceImpl.kt @@ -66,11 +66,11 @@ class EmploymentServiceImpl internal constructor(private val clientOptions: Clie } } .let { - HrisEmploymentRetrieveManyPage.of( - EmploymentServiceImpl(clientOptions), - params, - it, - ) + HrisEmploymentRetrieveManyPage.builder() + .service(EmploymentServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt index 09dbfe4c..150aaa04 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/IndividualServiceImpl.kt @@ -66,11 +66,11 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie } } .let { - HrisIndividualRetrieveManyPage.of( - IndividualServiceImpl(clientOptions), - params, - it, - ) + HrisIndividualRetrieveManyPage.builder() + .service(IndividualServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt index 56cd9d5d..6cfadcaf 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PayStatementServiceImpl.kt @@ -66,11 +66,11 @@ class PayStatementServiceImpl internal constructor(private val clientOptions: Cl } } .let { - HrisPayStatementRetrieveManyPage.of( - PayStatementServiceImpl(clientOptions), - params, - it, - ) + HrisPayStatementRetrieveManyPage.builder() + .service(PayStatementServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt index a28d1aed..7cb22ea4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/PaymentServiceImpl.kt @@ -62,7 +62,13 @@ class PaymentServiceImpl internal constructor(private val clientOptions: ClientO it.forEach { it.validate() } } } - .let { HrisPaymentListPage.of(PaymentServiceImpl(clientOptions), params, it) } + .let { + HrisPaymentListPage.builder() + .service(PaymentServiceImpl(clientOptions)) + .params(params) + .items(it) + .build() + } } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt index ca75feab..98f57289 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/benefits/IndividualServiceImpl.kt @@ -110,11 +110,11 @@ class IndividualServiceImpl internal constructor(private val clientOptions: Clie } } .let { - HrisBenefitIndividualRetrieveManyBenefitsPage.of( - IndividualServiceImpl(clientOptions), - params, - it, - ) + HrisBenefitIndividualRetrieveManyBenefitsPage.builder() + .service(IndividualServiceImpl(clientOptions)) + .params(params) + .items(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt index 3868e4bb..87dd1814 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/PayStatementItemServiceImpl.kt @@ -76,11 +76,11 @@ class PayStatementItemServiceImpl internal constructor(private val clientOptions } } .let { - HrisCompanyPayStatementItemListPage.of( - PayStatementItemServiceImpl(clientOptions), - params, - it, - ) + HrisCompanyPayStatementItemListPage.builder() + .service(PayStatementItemServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt index af2941f2..370263d4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/hris/company/payStatementItem/RuleServiceImpl.kt @@ -145,11 +145,11 @@ class RuleServiceImpl internal constructor(private val clientOptions: ClientOpti } } .let { - HrisCompanyPayStatementItemRuleListPage.of( - RuleServiceImpl(clientOptions), - params, - it, - ) + HrisCompanyPayStatementItemRuleListPage.builder() + .service(RuleServiceImpl(clientOptions)) + .params(params) + .response(it) + .build() } } } diff --git a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt index 3be34de8..085c2bc4 100644 --- a/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt +++ b/finch-java-core/src/main/kotlin/com/tryfinch/api/services/blocking/payroll/PayGroupServiceImpl.kt @@ -100,7 +100,11 @@ class PayGroupServiceImpl internal constructor(private val clientOptions: Client } } .let { - PayrollPayGroupListPage.of(PayGroupServiceImpl(clientOptions), params, it) + PayrollPayGroupListPage.builder() + .service(PayGroupServiceImpl(clientOptions)) + .params(params) + .items(it) + .build() } } }