Skip to content

Commit 3fdfb41

Browse files
Stainless Botstainless-app[bot]
authored andcommitted
feat(api): updates (#226)
1 parent 95992b8 commit 3fdfb41

25 files changed

Lines changed: 1711 additions & 2 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 34
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-a278884107d48c04133891fff0d1123a97169758e2baa82411009277932795af.yml
1+
configured_endpoints: 36
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/finch-f1001da4ad3c1503330eebc1e61319a1a5db5e2da9fec98bc8682cb0967894d2.yml

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClient.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ interface FinchClient {
2828

2929
fun sandbox(): SandboxService
3030

31+
fun payroll(): PayrollService
32+
3133
fun getAccessToken(
3234
clientId: String,
3335
clientSecret: String,

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsync.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ interface FinchClientAsync {
2929

3030
fun sandbox(): SandboxServiceAsync
3131

32+
fun payroll(): PayrollServiceAsync
33+
3234
fun getAccessToken(
3335
clientId: String,
3436
clientSecret: String,

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientAsyncImpl.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ constructor(
4747

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

50+
private val payroll: PayrollServiceAsync by lazy { PayrollServiceAsyncImpl(clientOptions) }
51+
5052
private val getAccessTokenHandler: Handler<GetAccessTokenResponse> =
5153
jsonHandler<GetAccessTokenResponse>(clientOptions.jsonMapper).withErrorHandler(errorHandler)
5254

@@ -68,6 +70,8 @@ constructor(
6870

6971
override fun sandbox(): SandboxServiceAsync = sandbox
7072

73+
override fun payroll(): PayrollServiceAsync = payroll
74+
7175
override fun getAccessToken(
7276
clientId: String,
7377
clientSecret: String,

finch-java-core/src/main/kotlin/com/tryfinch/api/client/FinchClientImpl.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ constructor(
4444

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

47+
private val payroll: PayrollService by lazy { PayrollServiceImpl(clientOptions) }
48+
4749
private val getAccessTokenHandler: Handler<GetAccessTokenResponse> =
4850
jsonHandler<GetAccessTokenResponse>(clientOptions.jsonMapper).withErrorHandler(errorHandler)
4951

@@ -65,6 +67,8 @@ constructor(
6567

6668
override fun sandbox(): SandboxService = sandbox
6769

70+
override fun payroll(): PayrollService = payroll
71+
6872
override fun getAccessToken(
6973
clientId: String,
7074
clientSecret: String,
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
// File generated from our OpenAPI spec by Stainless.
2+
3+
package com.tryfinch.api.models
4+
5+
import com.fasterxml.jackson.annotation.JsonAnyGetter
6+
import com.fasterxml.jackson.annotation.JsonAnySetter
7+
import com.fasterxml.jackson.annotation.JsonCreator
8+
import com.fasterxml.jackson.annotation.JsonProperty
9+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
10+
import com.tryfinch.api.core.Enum
11+
import com.tryfinch.api.core.ExcludeMissing
12+
import com.tryfinch.api.core.JsonField
13+
import com.tryfinch.api.core.JsonMissing
14+
import com.tryfinch.api.core.JsonValue
15+
import com.tryfinch.api.core.NoAutoDetect
16+
import com.tryfinch.api.core.toUnmodifiable
17+
import com.tryfinch.api.errors.FinchInvalidDataException
18+
import java.util.Objects
19+
import java.util.Optional
20+
21+
@JsonDeserialize(builder = PayGroupListResponse.Builder::class)
22+
@NoAutoDetect
23+
class PayGroupListResponse
24+
private constructor(
25+
private val id: JsonField<String>,
26+
private val name: JsonField<String>,
27+
private val payFrequencies: JsonField<List<PayFrequency>>,
28+
private val additionalProperties: Map<String, JsonValue>,
29+
) {
30+
31+
private var validated: Boolean = false
32+
33+
private var hashCode: Int = 0
34+
35+
/** Finch id (uuidv4) for the pay group */
36+
fun id(): Optional<String> = Optional.ofNullable(id.getNullable("id"))
37+
38+
/** Name of the pay group */
39+
fun name(): Optional<String> = Optional.ofNullable(name.getNullable("name"))
40+
41+
/** List of pay frequencies associated with this pay group */
42+
fun payFrequencies(): Optional<List<PayFrequency>> =
43+
Optional.ofNullable(payFrequencies.getNullable("pay_frequencies"))
44+
45+
/** Finch id (uuidv4) for the pay group */
46+
@JsonProperty("id") @ExcludeMissing fun _id() = id
47+
48+
/** Name of the pay group */
49+
@JsonProperty("name") @ExcludeMissing fun _name() = name
50+
51+
/** List of pay frequencies associated with this pay group */
52+
@JsonProperty("pay_frequencies") @ExcludeMissing fun _payFrequencies() = payFrequencies
53+
54+
@JsonAnyGetter
55+
@ExcludeMissing
56+
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties
57+
58+
fun validate(): PayGroupListResponse = apply {
59+
if (!validated) {
60+
id()
61+
name()
62+
payFrequencies()
63+
validated = true
64+
}
65+
}
66+
67+
fun toBuilder() = Builder().from(this)
68+
69+
override fun equals(other: Any?): Boolean {
70+
if (this === other) {
71+
return true
72+
}
73+
74+
return other is PayGroupListResponse &&
75+
this.id == other.id &&
76+
this.name == other.name &&
77+
this.payFrequencies == other.payFrequencies &&
78+
this.additionalProperties == other.additionalProperties
79+
}
80+
81+
override fun hashCode(): Int {
82+
if (hashCode == 0) {
83+
hashCode =
84+
Objects.hash(
85+
id,
86+
name,
87+
payFrequencies,
88+
additionalProperties,
89+
)
90+
}
91+
return hashCode
92+
}
93+
94+
override fun toString() =
95+
"PayGroupListResponse{id=$id, name=$name, payFrequencies=$payFrequencies, additionalProperties=$additionalProperties}"
96+
97+
companion object {
98+
99+
@JvmStatic fun builder() = Builder()
100+
}
101+
102+
class Builder {
103+
104+
private var id: JsonField<String> = JsonMissing.of()
105+
private var name: JsonField<String> = JsonMissing.of()
106+
private var payFrequencies: JsonField<List<PayFrequency>> = JsonMissing.of()
107+
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
108+
109+
@JvmSynthetic
110+
internal fun from(payGroupListResponse: PayGroupListResponse) = apply {
111+
this.id = payGroupListResponse.id
112+
this.name = payGroupListResponse.name
113+
this.payFrequencies = payGroupListResponse.payFrequencies
114+
additionalProperties(payGroupListResponse.additionalProperties)
115+
}
116+
117+
/** Finch id (uuidv4) for the pay group */
118+
fun id(id: String) = id(JsonField.of(id))
119+
120+
/** Finch id (uuidv4) for the pay group */
121+
@JsonProperty("id") @ExcludeMissing fun id(id: JsonField<String>) = apply { this.id = id }
122+
123+
/** Name of the pay group */
124+
fun name(name: String) = name(JsonField.of(name))
125+
126+
/** Name of the pay group */
127+
@JsonProperty("name")
128+
@ExcludeMissing
129+
fun name(name: JsonField<String>) = apply { this.name = name }
130+
131+
/** List of pay frequencies associated with this pay group */
132+
fun payFrequencies(payFrequencies: List<PayFrequency>) =
133+
payFrequencies(JsonField.of(payFrequencies))
134+
135+
/** List of pay frequencies associated with this pay group */
136+
@JsonProperty("pay_frequencies")
137+
@ExcludeMissing
138+
fun payFrequencies(payFrequencies: JsonField<List<PayFrequency>>) = apply {
139+
this.payFrequencies = payFrequencies
140+
}
141+
142+
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
143+
this.additionalProperties.clear()
144+
this.additionalProperties.putAll(additionalProperties)
145+
}
146+
147+
@JsonAnySetter
148+
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
149+
this.additionalProperties.put(key, value)
150+
}
151+
152+
fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
153+
this.additionalProperties.putAll(additionalProperties)
154+
}
155+
156+
fun build(): PayGroupListResponse =
157+
PayGroupListResponse(
158+
id,
159+
name,
160+
payFrequencies.map { it.toUnmodifiable() },
161+
additionalProperties.toUnmodifiable(),
162+
)
163+
}
164+
165+
class PayFrequency
166+
@JsonCreator
167+
private constructor(
168+
private val value: JsonField<String>,
169+
) : Enum {
170+
171+
@com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField<String> = value
172+
173+
override fun equals(other: Any?): Boolean {
174+
if (this === other) {
175+
return true
176+
}
177+
178+
return other is PayFrequency && this.value == other.value
179+
}
180+
181+
override fun hashCode() = value.hashCode()
182+
183+
override fun toString() = value.toString()
184+
185+
companion object {
186+
187+
@JvmField val ANNUALLY = PayFrequency(JsonField.of("annually"))
188+
189+
@JvmField val SEMI_ANNUALLY = PayFrequency(JsonField.of("semi_annually"))
190+
191+
@JvmField val QUARTERLY = PayFrequency(JsonField.of("quarterly"))
192+
193+
@JvmField val MONTHLY = PayFrequency(JsonField.of("monthly"))
194+
195+
@JvmField val SEMI_MONTHLY = PayFrequency(JsonField.of("semi_monthly"))
196+
197+
@JvmField val BI_WEEKLY = PayFrequency(JsonField.of("bi_weekly"))
198+
199+
@JvmField val WEEKLY = PayFrequency(JsonField.of("weekly"))
200+
201+
@JvmField val DAILY = PayFrequency(JsonField.of("daily"))
202+
203+
@JvmField val OTHER = PayFrequency(JsonField.of("other"))
204+
205+
@JvmStatic fun of(value: String) = PayFrequency(JsonField.of(value))
206+
}
207+
208+
enum class Known {
209+
ANNUALLY,
210+
SEMI_ANNUALLY,
211+
QUARTERLY,
212+
MONTHLY,
213+
SEMI_MONTHLY,
214+
BI_WEEKLY,
215+
WEEKLY,
216+
DAILY,
217+
OTHER,
218+
}
219+
220+
enum class Value {
221+
ANNUALLY,
222+
SEMI_ANNUALLY,
223+
QUARTERLY,
224+
MONTHLY,
225+
SEMI_MONTHLY,
226+
BI_WEEKLY,
227+
WEEKLY,
228+
DAILY,
229+
OTHER,
230+
_UNKNOWN,
231+
}
232+
233+
fun value(): Value =
234+
when (this) {
235+
ANNUALLY -> Value.ANNUALLY
236+
SEMI_ANNUALLY -> Value.SEMI_ANNUALLY
237+
QUARTERLY -> Value.QUARTERLY
238+
MONTHLY -> Value.MONTHLY
239+
SEMI_MONTHLY -> Value.SEMI_MONTHLY
240+
BI_WEEKLY -> Value.BI_WEEKLY
241+
WEEKLY -> Value.WEEKLY
242+
DAILY -> Value.DAILY
243+
OTHER -> Value.OTHER
244+
else -> Value._UNKNOWN
245+
}
246+
247+
fun known(): Known =
248+
when (this) {
249+
ANNUALLY -> Known.ANNUALLY
250+
SEMI_ANNUALLY -> Known.SEMI_ANNUALLY
251+
QUARTERLY -> Known.QUARTERLY
252+
MONTHLY -> Known.MONTHLY
253+
SEMI_MONTHLY -> Known.SEMI_MONTHLY
254+
BI_WEEKLY -> Known.BI_WEEKLY
255+
WEEKLY -> Known.WEEKLY
256+
DAILY -> Known.DAILY
257+
OTHER -> Known.OTHER
258+
else -> throw FinchInvalidDataException("Unknown PayFrequency: $value")
259+
}
260+
261+
fun asString(): String = _value().asStringOrThrow()
262+
}
263+
}

0 commit comments

Comments
 (0)