com.vital.api.resources.sleep.requests.SleepGetRawRequest Maven / Gradle / Ivy
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.vital.api.resources.sleep.requests;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.fasterxml.jackson.annotation.Nulls;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.vital.api.core.ObjectMappers;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonDeserialize(builder = SleepGetRawRequest.Builder.class)
public final class SleepGetRawRequest {
private final Optional provider;
private final String startDate;
private final Optional endDate;
private final Map additionalProperties;
private SleepGetRawRequest(
Optional provider,
String startDate,
Optional endDate,
Map additionalProperties) {
this.provider = provider;
this.startDate = startDate;
this.endDate = endDate;
this.additionalProperties = additionalProperties;
}
/**
* @return Provider oura/strava etc
*/
@JsonProperty("provider")
public Optional getProvider() {
return provider;
}
/**
* @return Date from in YYYY-MM-DD or ISO formatted date time. If a date is provided without a time, the time will be set to 00:00:00
*/
@JsonProperty("start_date")
public String getStartDate() {
return startDate;
}
/**
* @return Date to YYYY-MM-DD or ISO formatted date time. If a date is provided without a time, the time will be set to 23:59:59
*/
@JsonProperty("end_date")
public Optional getEndDate() {
return endDate;
}
@Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof SleepGetRawRequest && equalTo((SleepGetRawRequest) other);
}
@JsonAnyGetter
public Map getAdditionalProperties() {
return this.additionalProperties;
}
private boolean equalTo(SleepGetRawRequest other) {
return provider.equals(other.provider) && startDate.equals(other.startDate) && endDate.equals(other.endDate);
}
@Override
public int hashCode() {
return Objects.hash(this.provider, this.startDate, this.endDate);
}
@Override
public String toString() {
return ObjectMappers.stringify(this);
}
public static StartDateStage builder() {
return new Builder();
}
public interface StartDateStage {
_FinalStage startDate(String startDate);
Builder from(SleepGetRawRequest other);
}
public interface _FinalStage {
SleepGetRawRequest build();
_FinalStage provider(Optional provider);
_FinalStage provider(String provider);
_FinalStage endDate(Optional endDate);
_FinalStage endDate(String endDate);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements StartDateStage, _FinalStage {
private String startDate;
private Optional endDate = Optional.empty();
private Optional provider = Optional.empty();
@JsonAnySetter
private Map additionalProperties = new HashMap<>();
private Builder() {}
@Override
public Builder from(SleepGetRawRequest other) {
provider(other.getProvider());
startDate(other.getStartDate());
endDate(other.getEndDate());
return this;
}
/**
* Date from in YYYY-MM-DD or ISO formatted date time. If a date is provided without a time, the time will be set to 00:00:00
* @return Reference to {@code this} so that method calls can be chained together.
*/
@Override
@JsonSetter("start_date")
public _FinalStage startDate(String startDate) {
this.startDate = startDate;
return this;
}
/**
* Date to YYYY-MM-DD or ISO formatted date time. If a date is provided without a time, the time will be set to 23:59:59
* @return Reference to {@code this} so that method calls can be chained together.
*/
@Override
public _FinalStage endDate(String endDate) {
this.endDate = Optional.of(endDate);
return this;
}
@Override
@JsonSetter(value = "end_date", nulls = Nulls.SKIP)
public _FinalStage endDate(Optional endDate) {
this.endDate = endDate;
return this;
}
/**
* Provider oura/strava etc
* @return Reference to {@code this} so that method calls can be chained together.
*/
@Override
public _FinalStage provider(String provider) {
this.provider = Optional.of(provider);
return this;
}
@Override
@JsonSetter(value = "provider", nulls = Nulls.SKIP)
public _FinalStage provider(Optional provider) {
this.provider = provider;
return this;
}
@Override
public SleepGetRawRequest build() {
return new SleepGetRawRequest(provider, startDate, endDate, additionalProperties);
}
}
}