All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tryfinch.api.models.Location.kt Maven / Gradle / Ivy

Go to download

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)

There is a newer version: 1.11.0
Show newest version
// 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 = Location.Builder::class)
@NoAutoDetect
class Location
private constructor(
    private val line1: JsonField,
    private val line2: JsonField,
    private val city: JsonField,
    private val state: JsonField,
    private val postalCode: JsonField,
    private val country: JsonField,
    private val name: JsonField,
    private val sourceId: JsonField,
    private val additionalProperties: Map,
) {

    private var validated: Boolean = false

    private var hashCode: Int = 0

    /** Street address or PO box. */
    fun line1(): Optional = Optional.ofNullable(line1.getNullable("line1"))

    /** Apartment, suite, unit, or building. */
    fun line2(): Optional = Optional.ofNullable(line2.getNullable("line2"))

    /** City, district, suburb, town, or village. */
    fun city(): Optional = Optional.ofNullable(city.getNullable("city"))

    /** The state code. */
    fun state(): Optional = Optional.ofNullable(state.getNullable("state"))

    /** The postal code or zip code. */
    fun postalCode(): Optional = Optional.ofNullable(postalCode.getNullable("postal_code"))

    /** The 2-letter ISO 3166 country code. */
    fun country(): Optional = Optional.ofNullable(country.getNullable("country"))

    fun name(): Optional = Optional.ofNullable(name.getNullable("name"))

    fun sourceId(): Optional = Optional.ofNullable(sourceId.getNullable("source_id"))

    /** Street address or PO box. */
    @JsonProperty("line1") @ExcludeMissing fun _line1() = line1

    /** Apartment, suite, unit, or building. */
    @JsonProperty("line2") @ExcludeMissing fun _line2() = line2

    /** City, district, suburb, town, or village. */
    @JsonProperty("city") @ExcludeMissing fun _city() = city

    /** The state code. */
    @JsonProperty("state") @ExcludeMissing fun _state() = state

    /** The postal code or zip code. */
    @JsonProperty("postal_code") @ExcludeMissing fun _postalCode() = postalCode

    /** The 2-letter ISO 3166 country code. */
    @JsonProperty("country") @ExcludeMissing fun _country() = country

    @JsonProperty("name") @ExcludeMissing fun _name() = name

    @JsonProperty("source_id") @ExcludeMissing fun _sourceId() = sourceId

    @JsonAnyGetter
    @ExcludeMissing
    fun _additionalProperties(): Map = additionalProperties

    fun validate(): Location = apply {
        if (!validated) {
            line1()
            line2()
            city()
            state()
            postalCode()
            country()
            name()
            sourceId()
            validated = true
        }
    }

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

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

        return other is Location &&
            this.line1 == other.line1 &&
            this.line2 == other.line2 &&
            this.city == other.city &&
            this.state == other.state &&
            this.postalCode == other.postalCode &&
            this.country == other.country &&
            this.name == other.name &&
            this.sourceId == other.sourceId &&
            this.additionalProperties == other.additionalProperties
    }

    override fun hashCode(): Int {
        if (hashCode == 0) {
            hashCode =
                Objects.hash(
                    line1,
                    line2,
                    city,
                    state,
                    postalCode,
                    country,
                    name,
                    sourceId,
                    additionalProperties,
                )
        }
        return hashCode
    }

    override fun toString() =
        "Location{line1=$line1, line2=$line2, city=$city, state=$state, postalCode=$postalCode, country=$country, name=$name, sourceId=$sourceId, additionalProperties=$additionalProperties}"

    companion object {

        @JvmStatic fun builder() = Builder()
    }

    class Builder {

        private var line1: JsonField = JsonMissing.of()
        private var line2: JsonField = JsonMissing.of()
        private var city: JsonField = JsonMissing.of()
        private var state: JsonField = JsonMissing.of()
        private var postalCode: JsonField = JsonMissing.of()
        private var country: JsonField = JsonMissing.of()
        private var name: JsonField = JsonMissing.of()
        private var sourceId: JsonField = JsonMissing.of()
        private var additionalProperties: MutableMap = mutableMapOf()

        @JvmSynthetic
        internal fun from(location: Location) = apply {
            this.line1 = location.line1
            this.line2 = location.line2
            this.city = location.city
            this.state = location.state
            this.postalCode = location.postalCode
            this.country = location.country
            this.name = location.name
            this.sourceId = location.sourceId
            additionalProperties(location.additionalProperties)
        }

        /** Street address or PO box. */
        fun line1(line1: String) = line1(JsonField.of(line1))

        /** Street address or PO box. */
        @JsonProperty("line1")
        @ExcludeMissing
        fun line1(line1: JsonField) = apply { this.line1 = line1 }

        /** Apartment, suite, unit, or building. */
        fun line2(line2: String) = line2(JsonField.of(line2))

        /** Apartment, suite, unit, or building. */
        @JsonProperty("line2")
        @ExcludeMissing
        fun line2(line2: JsonField) = apply { this.line2 = line2 }

        /** City, district, suburb, town, or village. */
        fun city(city: String) = city(JsonField.of(city))

        /** City, district, suburb, town, or village. */
        @JsonProperty("city")
        @ExcludeMissing
        fun city(city: JsonField) = apply { this.city = city }

        /** The state code. */
        fun state(state: String) = state(JsonField.of(state))

        /** The state code. */
        @JsonProperty("state")
        @ExcludeMissing
        fun state(state: JsonField) = apply { this.state = state }

        /** The postal code or zip code. */
        fun postalCode(postalCode: String) = postalCode(JsonField.of(postalCode))

        /** The postal code or zip code. */
        @JsonProperty("postal_code")
        @ExcludeMissing
        fun postalCode(postalCode: JsonField) = apply { this.postalCode = postalCode }

        /** The 2-letter ISO 3166 country code. */
        fun country(country: String) = country(JsonField.of(country))

        /** The 2-letter ISO 3166 country code. */
        @JsonProperty("country")
        @ExcludeMissing
        fun country(country: JsonField) = apply { this.country = country }

        fun name(name: String) = name(JsonField.of(name))

        @JsonProperty("name")
        @ExcludeMissing
        fun name(name: JsonField) = apply { this.name = name }

        fun sourceId(sourceId: String) = sourceId(JsonField.of(sourceId))

        @JsonProperty("source_id")
        @ExcludeMissing
        fun sourceId(sourceId: JsonField) = apply { this.sourceId = sourceId }

        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(): Location =
            Location(
                line1,
                line2,
                city,
                state,
                postalCode,
                country,
                name,
                sourceId,
                additionalProperties.toUnmodifiable(),
            )
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy