Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 34
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-a278884107d48c04133891fff0d1123a97169758e2baa82411009277932795af.yml
configured_endpoints: 36
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-f1001da4ad3c1503330eebc1e61319a1a5db5e2da9fec98bc8682cb0967894d2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ interface FinchClient {

fun sandbox(): SandboxService

fun payroll(): PayrollService

fun getAccessToken(
clientId: String,
clientSecret: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ interface FinchClientAsync {

fun sandbox(): SandboxServiceAsync

fun payroll(): PayrollServiceAsync

fun getAccessToken(
clientId: String,
clientSecret: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ constructor(

private val sandbox: SandboxServiceAsync by lazy { SandboxServiceAsyncImpl(clientOptions) }

private val payroll: PayrollServiceAsync by lazy { PayrollServiceAsyncImpl(clientOptions) }

private val getAccessTokenHandler: Handler<GetAccessTokenResponse> =
jsonHandler<GetAccessTokenResponse>(clientOptions.jsonMapper).withErrorHandler(errorHandler)

Expand All @@ -68,6 +70,8 @@ constructor(

override fun sandbox(): SandboxServiceAsync = sandbox

override fun payroll(): PayrollServiceAsync = payroll

override fun getAccessToken(
clientId: String,
clientSecret: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ constructor(

private val sandbox: SandboxService by lazy { SandboxServiceImpl(clientOptions) }

private val payroll: PayrollService by lazy { PayrollServiceImpl(clientOptions) }

private val getAccessTokenHandler: Handler<GetAccessTokenResponse> =
jsonHandler<GetAccessTokenResponse>(clientOptions.jsonMapper).withErrorHandler(errorHandler)

Expand All @@ -65,6 +67,8 @@ constructor(

override fun sandbox(): SandboxService = sandbox

override fun payroll(): PayrollService = payroll

override fun getAccessToken(
clientId: String,
clientSecret: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
// File generated from our OpenAPI spec by Stainless.

package com.tryfinch.api.models

import com.fasterxml.jackson.annotation.JsonAnyGetter
import com.fasterxml.jackson.annotation.JsonAnySetter
import com.fasterxml.jackson.annotation.JsonCreator
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.tryfinch.api.core.Enum
import com.tryfinch.api.core.ExcludeMissing
import com.tryfinch.api.core.JsonField
import com.tryfinch.api.core.JsonMissing
import com.tryfinch.api.core.JsonValue
import com.tryfinch.api.core.NoAutoDetect
import com.tryfinch.api.core.toUnmodifiable
import com.tryfinch.api.errors.FinchInvalidDataException
import java.util.Objects
import java.util.Optional

@JsonDeserialize(builder = PayGroupListResponse.Builder::class)
@NoAutoDetect
class PayGroupListResponse
private constructor(
private val id: JsonField<String>,
private val name: JsonField<String>,
private val payFrequencies: JsonField<List<PayFrequency>>,
private val additionalProperties: Map<String, JsonValue>,
) {

private var validated: Boolean = false

private var hashCode: Int = 0

/** Finch id (uuidv4) for the pay group */
fun id(): Optional<String> = Optional.ofNullable(id.getNullable("id"))

/** Name of the pay group */
fun name(): Optional<String> = Optional.ofNullable(name.getNullable("name"))

/** List of pay frequencies associated with this pay group */
fun payFrequencies(): Optional<List<PayFrequency>> =
Optional.ofNullable(payFrequencies.getNullable("pay_frequencies"))

/** Finch id (uuidv4) for the pay group */
@JsonProperty("id") @ExcludeMissing fun _id() = id

/** Name of the pay group */
@JsonProperty("name") @ExcludeMissing fun _name() = name

/** List of pay frequencies associated with this pay group */
@JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

fun validate(): PayGroupListResponse = apply {
if (!validated) {
id()
name()
payFrequencies()
validated = true
}
}

fun toBuilder() = Builder().from(this)

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is PayGroupListResponse &&
this.id == other.id &&
this.name == other.name &&
this.payFrequencies == other.payFrequencies &&
this.additionalProperties == other.additionalProperties
}

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
id,
name,
payFrequencies,
additionalProperties,
)
}
return hashCode
}

override fun toString() =
"PayGroupListResponse{id=$id, name=$name, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}"

companion object {

@JvmStatic fun builder() = Builder()
}

class Builder {

private var id: JsonField<String> = JsonMissing.of()
private var name: JsonField<String> = JsonMissing.of()
private var payFrequencies: JsonField<List<PayFrequency>> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(payGroupListResponse: PayGroupListResponse) = apply {
this.id = payGroupListResponse.id
this.name = payGroupListResponse.name
this.payFrequencies = payGroupListResponse.payFrequencies
additionalProperties(payGroupListResponse.additionalProperties)
}

/** Finch id (uuidv4) for the pay group */
fun id(id: String) = id(JsonField.of(id))

/** Finch id (uuidv4) for the pay group */
@JsonProperty("id") @ExcludeMissing fun id(id: JsonField<String>) = apply { this.id = id }

/** Name of the pay group */
fun name(name: String) = name(JsonField.of(name))

/** Name of the pay group */
@JsonProperty("name")
@ExcludeMissing
fun name(name: JsonField<String>) = apply { this.name = name }

/** List of pay frequencies associated with this pay group */
fun payFrequencies(payFrequencies: List<PayFrequency>) =
payFrequencies(JsonField.of(payFrequencies))

/** List of pay frequencies associated with this pay group */
@JsonProperty("pay_frequencies")
@ExcludeMissing
fun payFrequencies(payFrequencies: JsonField<List<PayFrequency>>) = apply {
this.payFrequencies = payFrequencies
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}

fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}

fun build(): PayGroupListResponse =
PayGroupListResponse(
id,
name,
payFrequencies.map { it.toUnmodifiable() },
additionalProperties.toUnmodifiable(),
)
}

class PayFrequency
@JsonCreator
private constructor(
private val value: JsonField<String>,
) : Enum {

@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is PayFrequency && this.value == other.value
}

override fun hashCode() = value.hashCode()

override fun toString() = value.toString()

companion object {

@JvmField val ANNUALLY = PayFrequency(JsonField.of("annually"))

@JvmField val SEMI_ANNUALLY = PayFrequency(JsonField.of("semi_annually"))

@JvmField val QUARTERLY = PayFrequency(JsonField.of("quarterly"))

@JvmField val MONTHLY = PayFrequency(JsonField.of("monthly"))

@JvmField val SEMI_MONTHLY = PayFrequency(JsonField.of("semi_monthly"))

@JvmField val BI_WEEKLY = PayFrequency(JsonField.of("bi_weekly"))

@JvmField val WEEKLY = PayFrequency(JsonField.of("weekly"))

@JvmField val DAILY = PayFrequency(JsonField.of("daily"))

@JvmField val OTHER = PayFrequency(JsonField.of("other"))

@JvmStatic fun of(value: String) = PayFrequency(JsonField.of(value))
}

enum class Known {
ANNUALLY,
SEMI_ANNUALLY,
QUARTERLY,
MONTHLY,
SEMI_MONTHLY,
BI_WEEKLY,
WEEKLY,
DAILY,
OTHER,
}

enum class Value {
ANNUALLY,
SEMI_ANNUALLY,
QUARTERLY,
MONTHLY,
SEMI_MONTHLY,
BI_WEEKLY,
WEEKLY,
DAILY,
OTHER,
_UNKNOWN,
}

fun value(): Value =
when (this) {
ANNUALLY -> Value.ANNUALLY
SEMI_ANNUALLY -> Value.SEMI_ANNUALLY
QUARTERLY -> Value.QUARTERLY
MONTHLY -> Value.MONTHLY
SEMI_MONTHLY -> Value.SEMI_MONTHLY
BI_WEEKLY -> Value.BI_WEEKLY
WEEKLY -> Value.WEEKLY
DAILY -> Value.DAILY
OTHER -> Value.OTHER
else -> Value._UNKNOWN
}

fun known(): Known =
when (this) {
ANNUALLY -> Known.ANNUALLY
SEMI_ANNUALLY -> Known.SEMI_ANNUALLY
QUARTERLY -> Known.QUARTERLY
MONTHLY -> Known.MONTHLY
SEMI_MONTHLY -> Known.SEMI_MONTHLY
BI_WEEKLY -> Known.BI_WEEKLY
WEEKLY -> Known.WEEKLY
DAILY -> Known.DAILY
OTHER -> Known.OTHER
else -> throw FinchInvalidDataException("Unknown PayFrequency: $value")
}

fun asString(): String = _value().asStringOrThrow()
}
}
Loading