com.tryfinch.api.models.IndividualInDirectory.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of finch-java-core Show documentation
Show all versions of finch-java-core Show documentation
The Finch HRIS API provides a unified way to connect to a multitide of HRIS
systems. The API requires an access token issued by Finch.
By default, Organization and Payroll requests use Finch's
[Data Syncs](/developer-resources/Data-Syncs). If a request is made before the
initial sync has completed, Finch will request data live from the provider. The
latency on live requests may range from seconds to minutes depending on the
provider and batch size. For automated integrations, Deductions requests (both
read and write) are always made live to the provider. Latencies may range from
seconds to minutes depending on the provider and batch size.
Employer products are specified by the product parameter, a space-separated list
of products that your application requests from an employer authenticating
through Finch Connect. Valid product names are—
- `company`: Read basic company data
- `directory`: Read company directory and organization structure
- `individual`: Read individual data, excluding income and employment data
- `employment`: Read individual employment and income data
- `payment`: Read payroll and contractor related payments by the company
- `pay_statement`: Read detailed pay statements for each individual
- `benefits`: Create and manage deductions and contributions and enrollment for
an employer
[![Open in Postman](https://run.pstmn.io/button.svg)](https://god.gw.postman.com/run-collection/21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4?action=collection%2Ffork&collection-url=entityId%3D21027137-08db0929-883d-4094-a9ce-dbf5a9bee4a4%26entityType%3Dcollection%26workspaceId%3D1edf19bc-e0a8-41e9-ac55-481a4b50790b)
// 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.JsonProperty
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
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 java.util.Objects
import java.util.Optional
@JsonDeserialize(builder = IndividualInDirectory.Builder::class)
@NoAutoDetect
class IndividualInDirectory
private constructor(
private val id: JsonField,
private val firstName: JsonField,
private val middleName: JsonField,
private val lastName: JsonField,
private val manager: JsonField,
private val department: JsonField,
private val isActive: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** A stable Finch id (UUID v4) for an individual in the company. */
fun id(): Optional = Optional.ofNullable(id.getNullable("id"))
/** The legal first name of the individual. */
fun firstName(): Optional = Optional.ofNullable(firstName.getNullable("first_name"))
/** The legal middle name of the individual. */
fun middleName(): Optional = Optional.ofNullable(middleName.getNullable("middle_name"))
/** The legal last name of the individual. */
fun lastName(): Optional = Optional.ofNullable(lastName.getNullable("last_name"))
/** The manager object. */
fun manager(): Optional = Optional.ofNullable(manager.getNullable("manager"))
/** The department object. */
fun department(): Optional =
Optional.ofNullable(department.getNullable("department"))
/** `true` if the individual is an active employee or contractor at the company. */
fun isActive(): Optional = Optional.ofNullable(isActive.getNullable("is_active"))
/** A stable Finch id (UUID v4) for an individual in the company. */
@JsonProperty("id") @ExcludeMissing fun _id() = id
/** The legal first name of the individual. */
@JsonProperty("first_name") @ExcludeMissing fun _firstName() = firstName
/** The legal middle name of the individual. */
@JsonProperty("middle_name") @ExcludeMissing fun _middleName() = middleName
/** The legal last name of the individual. */
@JsonProperty("last_name") @ExcludeMissing fun _lastName() = lastName
/** The manager object. */
@JsonProperty("manager") @ExcludeMissing fun _manager() = manager
/** The department object. */
@JsonProperty("department") @ExcludeMissing fun _department() = department
/** `true` if the individual is an active employee or contractor at the company. */
@JsonProperty("is_active") @ExcludeMissing fun _isActive() = isActive
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): IndividualInDirectory = apply {
if (!validated) {
id()
firstName()
middleName()
lastName()
manager().map { it.validate() }
department().map { it.validate() }
isActive()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is IndividualInDirectory &&
this.id == other.id &&
this.firstName == other.firstName &&
this.middleName == other.middleName &&
this.lastName == other.lastName &&
this.manager == other.manager &&
this.department == other.department &&
this.isActive == other.isActive &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode =
Objects.hash(
id,
firstName,
middleName,
lastName,
manager,
department,
isActive,
additionalProperties,
)
}
return hashCode
}
override fun toString() =
"IndividualInDirectory{id=$id, firstName=$firstName, middleName=$middleName, lastName=$lastName, manager=$manager, department=$department, isActive=$isActive, additionalProperties=$additionalProperties}"
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var id: JsonField = JsonMissing.of()
private var firstName: JsonField = JsonMissing.of()
private var middleName: JsonField = JsonMissing.of()
private var lastName: JsonField = JsonMissing.of()
private var manager: JsonField = JsonMissing.of()
private var department: JsonField = JsonMissing.of()
private var isActive: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(individualInDirectory: IndividualInDirectory) = apply {
this.id = individualInDirectory.id
this.firstName = individualInDirectory.firstName
this.middleName = individualInDirectory.middleName
this.lastName = individualInDirectory.lastName
this.manager = individualInDirectory.manager
this.department = individualInDirectory.department
this.isActive = individualInDirectory.isActive
additionalProperties(individualInDirectory.additionalProperties)
}
/** A stable Finch id (UUID v4) for an individual in the company. */
fun id(id: String) = id(JsonField.of(id))
/** A stable Finch id (UUID v4) for an individual in the company. */
@JsonProperty("id") @ExcludeMissing fun id(id: JsonField) = apply { this.id = id }
/** The legal first name of the individual. */
fun firstName(firstName: String) = firstName(JsonField.of(firstName))
/** The legal first name of the individual. */
@JsonProperty("first_name")
@ExcludeMissing
fun firstName(firstName: JsonField) = apply { this.firstName = firstName }
/** The legal middle name of the individual. */
fun middleName(middleName: String) = middleName(JsonField.of(middleName))
/** The legal middle name of the individual. */
@JsonProperty("middle_name")
@ExcludeMissing
fun middleName(middleName: JsonField) = apply { this.middleName = middleName }
/** The legal last name of the individual. */
fun lastName(lastName: String) = lastName(JsonField.of(lastName))
/** The legal last name of the individual. */
@JsonProperty("last_name")
@ExcludeMissing
fun lastName(lastName: JsonField) = apply { this.lastName = lastName }
/** The manager object. */
fun manager(manager: Manager) = manager(JsonField.of(manager))
/** The manager object. */
@JsonProperty("manager")
@ExcludeMissing
fun manager(manager: JsonField) = apply { this.manager = manager }
/** The department object. */
fun department(department: Department) = department(JsonField.of(department))
/** The department object. */
@JsonProperty("department")
@ExcludeMissing
fun department(department: JsonField) = apply { this.department = department }
/** `true` if the individual is an active employee or contractor at the company. */
fun isActive(isActive: Boolean) = isActive(JsonField.of(isActive))
/** `true` if the individual is an active employee or contractor at the company. */
@JsonProperty("is_active")
@ExcludeMissing
fun isActive(isActive: JsonField) = apply { this.isActive = isActive }
fun additionalProperties(additionalProperties: Map) = 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) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): IndividualInDirectory =
IndividualInDirectory(
id,
firstName,
middleName,
lastName,
manager,
department,
isActive,
additionalProperties.toUnmodifiable(),
)
}
/** The department object. */
@JsonDeserialize(builder = Department.Builder::class)
@NoAutoDetect
class Department
private constructor(
private val name: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** The name of the department. */
fun name(): Optional = Optional.ofNullable(name.getNullable("name"))
/** The name of the department. */
@JsonProperty("name") @ExcludeMissing fun _name() = name
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): Department = apply {
if (!validated) {
name()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Department &&
this.name == other.name &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = Objects.hash(name, additionalProperties)
}
return hashCode
}
override fun toString() =
"Department{name=$name, additionalProperties=$additionalProperties}"
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var name: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(department: Department) = apply {
this.name = department.name
additionalProperties(department.additionalProperties)
}
/** The name of the department. */
fun name(name: String) = name(JsonField.of(name))
/** The name of the department. */
@JsonProperty("name")
@ExcludeMissing
fun name(name: JsonField) = apply { this.name = name }
fun additionalProperties(additionalProperties: Map) = 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) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): Department = Department(name, additionalProperties.toUnmodifiable())
}
}
/** The manager object. */
@JsonDeserialize(builder = Manager.Builder::class)
@NoAutoDetect
class Manager
private constructor(
private val id: JsonField,
private val additionalProperties: Map,
) {
private var validated: Boolean = false
private var hashCode: Int = 0
/** A stable Finch `id` (UUID v4) for an individual in the company. */
fun id(): Optional = Optional.ofNullable(id.getNullable("id"))
/** A stable Finch `id` (UUID v4) for an individual in the company. */
@JsonProperty("id") @ExcludeMissing fun _id() = id
@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map = additionalProperties
fun validate(): Manager = apply {
if (!validated) {
id()
validated = true
}
}
fun toBuilder() = Builder().from(this)
override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}
return other is Manager &&
this.id == other.id &&
this.additionalProperties == other.additionalProperties
}
override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = Objects.hash(id, additionalProperties)
}
return hashCode
}
override fun toString() = "Manager{id=$id, additionalProperties=$additionalProperties}"
companion object {
@JvmStatic fun builder() = Builder()
}
class Builder {
private var id: JsonField = JsonMissing.of()
private var additionalProperties: MutableMap = mutableMapOf()
@JvmSynthetic
internal fun from(manager: Manager) = apply {
this.id = manager.id
additionalProperties(manager.additionalProperties)
}
/** A stable Finch `id` (UUID v4) for an individual in the company. */
fun id(id: String) = id(JsonField.of(id))
/** A stable Finch `id` (UUID v4) for an individual in the company. */
@JsonProperty("id")
@ExcludeMissing
fun id(id: JsonField) = apply { this.id = id }
fun additionalProperties(additionalProperties: Map) = 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) = apply {
this.additionalProperties.putAll(additionalProperties)
}
fun build(): Manager = Manager(id, additionalProperties.toUnmodifiable())
}
}
}