
com.merge.api.resources.crm.webhookreceivers.requests.WebhookReceiverRequest Maven / Gradle / Ivy
package com.merge.api.resources.crm.webhookreceivers.requests;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 java.util.Objects;
import java.util.Optional;
@JsonDeserialize(builder = WebhookReceiverRequest.Builder.class)
public final class WebhookReceiverRequest {
private final String event;
private final boolean isActive;
private final Optional key;
private WebhookReceiverRequest(String event, boolean isActive, Optional key) {
this.event = event;
this.isActive = isActive;
this.key = key;
}
/**
* @return <span style="white-space: nowrap">non-empty
</span>
*/
@JsonProperty("event")
public String getEvent() {
return event;
}
@JsonProperty("is_active")
public boolean getIsActive() {
return isActive;
}
/**
* @return <span style="white-space: nowrap">non-empty
</span>
*/
@JsonProperty("key")
public Optional getKey() {
return key;
}
@Override
public boolean equals(Object other) {
if (this == other) return true;
return other instanceof WebhookReceiverRequest && equalTo((WebhookReceiverRequest) other);
}
private boolean equalTo(WebhookReceiverRequest other) {
return event.equals(other.event) && isActive == other.isActive && key.equals(other.key);
}
@Override
public int hashCode() {
return Objects.hash(this.event, this.isActive, this.key);
}
@Override
public String toString() {
return "WebhookReceiverRequest{" + "event: " + event + ", isActive: " + isActive + ", key: " + key + "}";
}
public static EventStage builder() {
return new Builder();
}
public interface EventStage {
IsActiveStage event(String event);
Builder from(WebhookReceiverRequest other);
}
public interface IsActiveStage {
_FinalStage isActive(boolean isActive);
}
public interface _FinalStage {
WebhookReceiverRequest build();
_FinalStage key(Optional key);
_FinalStage key(String key);
}
@JsonIgnoreProperties(ignoreUnknown = true)
public static final class Builder implements EventStage, IsActiveStage, _FinalStage {
private String event;
private boolean isActive;
private Optional key = Optional.empty();
private Builder() {}
@Override
public Builder from(WebhookReceiverRequest other) {
event(other.getEvent());
isActive(other.getIsActive());
key(other.getKey());
return this;
}
/**
* <span style="white-space: nowrap">non-empty
</span>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@Override
@JsonSetter("event")
public IsActiveStage event(String event) {
this.event = event;
return this;
}
@Override
@JsonSetter("is_active")
public _FinalStage isActive(boolean isActive) {
this.isActive = isActive;
return this;
}
/**
* <span style="white-space: nowrap">non-empty
</span>
* @return Reference to {@code this} so that method calls can be chained together.
*/
@Override
public _FinalStage key(String key) {
this.key = Optional.of(key);
return this;
}
@Override
@JsonSetter(value = "key", nulls = Nulls.SKIP)
public _FinalStage key(Optional key) {
this.key = key;
return this;
}
@Override
public WebhookReceiverRequest build() {
return new WebhookReceiverRequest(event, isActive, key);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy