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

com.hubspot.slack.client.models.response.auth.AuthTestResponse Maven / Gradle / Ivy

package com.hubspot.slack.client.models.response.auth;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.hubspot.immutables.validation.InvalidImmutableStateException;
import com.hubspot.slack.client.models.response.*;
import com.hubspot.slack.client.models.response.SlackResponse;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;
import javax.annotation.ParametersAreNonnullByDefault;
import javax.annotation.concurrent.Immutable;
import javax.annotation.concurrent.NotThreadSafe;
import org.immutables.value.Generated;

/**
 * Immutable implementation of {@link AuthTestResponseIF}.
 * 

* Use the builder to create immutable instances: * {@code AuthTestResponse.builder()}. */ @Generated(from = "AuthTestResponseIF", generator = "Immutables") @SuppressWarnings({"all"}) @SuppressFBWarnings @ParametersAreNonnullByDefault @javax.annotation.processing.Generated("org.immutables.processor.ProxyProcessor") @Immutable public final class AuthTestResponse implements AuthTestResponseIF { private final boolean ok; private final @Nullable ResponseMetadata responseMetadata; private final String url; private final String team; private final String teamId; private final @Nullable String user; private final @Nullable String userId; private AuthTestResponse( boolean ok, @Nullable ResponseMetadata responseMetadata, String url, String team, String teamId, @Nullable String user, @Nullable String userId) { this.ok = ok; this.responseMetadata = responseMetadata; this.url = url; this.team = team; this.teamId = teamId; this.user = user; this.userId = userId; } /** * @return The value of the {@code ok} attribute */ @JsonProperty @Override public boolean isOk() { return ok; } /** * @return The value of the {@code responseMetadata} attribute */ @JsonProperty("response_metadata") @Override public Optional getResponseMetadata() { return Optional.ofNullable(responseMetadata); } /** * @return The value of the {@code url} attribute */ @JsonProperty @Override public String getUrl() { return url; } /** * @return The value of the {@code team} attribute */ @JsonProperty @Override public String getTeam() { return team; } /** * @return The value of the {@code teamId} attribute */ @JsonProperty @Override public String getTeamId() { return teamId; } /** * @return The value of the {@code user} attribute */ @JsonProperty @Override public Optional getUser() { return Optional.ofNullable(user); } /** * @return The value of the {@code userId} attribute */ @JsonProperty @Override public Optional getUserId() { return Optional.ofNullable(userId); } /** * Copy the current immutable object by setting a value for the {@link AuthTestResponseIF#isOk() ok} attribute. * A value equality check is used to prevent copying of the same value by returning {@code this}. * @param value A new value for ok * @return A modified copy of the {@code this} object */ public final AuthTestResponse withOk(boolean value) { if (this.ok == value) return this; return new AuthTestResponse(value, this.responseMetadata, this.url, this.team, this.teamId, this.user, this.userId); } /** * Copy the current immutable object by setting a present value for the optional {@link AuthTestResponseIF#getResponseMetadata() responseMetadata} attribute. * @param value The value for responseMetadata, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final AuthTestResponse withResponseMetadata(@Nullable ResponseMetadata value) { @Nullable ResponseMetadata newValue = value; if (this.responseMetadata == newValue) return this; return new AuthTestResponse(this.ok, newValue, this.url, this.team, this.teamId, this.user, this.userId); } /** * Copy the current immutable object by setting an optional value for the {@link AuthTestResponseIF#getResponseMetadata() responseMetadata} attribute. * A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning {@code this}. * @param optional A value for responseMetadata * @return A modified copy of {@code this} object */ @SuppressWarnings("unchecked") // safe covariant cast public final AuthTestResponse withResponseMetadata(Optional optional) { @Nullable ResponseMetadata value = optional.orElse(null); if (this.responseMetadata == value) return this; return new AuthTestResponse(this.ok, value, this.url, this.team, this.teamId, this.user, this.userId); } /** * Copy the current immutable object by setting a value for the {@link AuthTestResponseIF#getUrl() url} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for url * @return A modified copy of the {@code this} object */ public final AuthTestResponse withUrl(String value) { String newValue = Objects.requireNonNull(value, "url"); if (this.url.equals(newValue)) return this; return new AuthTestResponse(this.ok, this.responseMetadata, newValue, this.team, this.teamId, this.user, this.userId); } /** * Copy the current immutable object by setting a value for the {@link AuthTestResponseIF#getTeam() team} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for team * @return A modified copy of the {@code this} object */ public final AuthTestResponse withTeam(String value) { String newValue = Objects.requireNonNull(value, "team"); if (this.team.equals(newValue)) return this; return new AuthTestResponse(this.ok, this.responseMetadata, this.url, newValue, this.teamId, this.user, this.userId); } /** * Copy the current immutable object by setting a value for the {@link AuthTestResponseIF#getTeamId() teamId} attribute. * An equals check used to prevent copying of the same value by returning {@code this}. * @param value A new value for teamId * @return A modified copy of the {@code this} object */ public final AuthTestResponse withTeamId(String value) { String newValue = Objects.requireNonNull(value, "teamId"); if (this.teamId.equals(newValue)) return this; return new AuthTestResponse(this.ok, this.responseMetadata, this.url, this.team, newValue, this.user, this.userId); } /** * Copy the current immutable object by setting a present value for the optional {@link AuthTestResponseIF#getUser() user} attribute. * @param value The value for user, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final AuthTestResponse withUser(@Nullable String value) { @Nullable String newValue = value; if (Objects.equals(this.user, newValue)) return this; return new AuthTestResponse(this.ok, this.responseMetadata, this.url, this.team, this.teamId, newValue, this.userId); } /** * Copy the current immutable object by setting an optional value for the {@link AuthTestResponseIF#getUser() user} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for user * @return A modified copy of {@code this} object */ public final AuthTestResponse withUser(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.user, value)) return this; return new AuthTestResponse(this.ok, this.responseMetadata, this.url, this.team, this.teamId, value, this.userId); } /** * Copy the current immutable object by setting a present value for the optional {@link AuthTestResponseIF#getUserId() userId} attribute. * @param value The value for userId, {@code null} is accepted as {@code java.util.Optional.empty()} * @return A modified copy of {@code this} object */ public final AuthTestResponse withUserId(@Nullable String value) { @Nullable String newValue = value; if (Objects.equals(this.userId, newValue)) return this; return new AuthTestResponse(this.ok, this.responseMetadata, this.url, this.team, this.teamId, this.user, newValue); } /** * Copy the current immutable object by setting an optional value for the {@link AuthTestResponseIF#getUserId() userId} attribute. * An equality check is used on inner nullable value to prevent copying of the same value by returning {@code this}. * @param optional A value for userId * @return A modified copy of {@code this} object */ public final AuthTestResponse withUserId(Optional optional) { @Nullable String value = optional.orElse(null); if (Objects.equals(this.userId, value)) return this; return new AuthTestResponse(this.ok, this.responseMetadata, this.url, this.team, this.teamId, this.user, value); } /** * This instance is equal to all instances of {@code AuthTestResponse} that have equal attribute values. * @return {@code true} if {@code this} is equal to {@code another} instance */ @Override public boolean equals(@Nullable Object another) { if (this == another) return true; return another instanceof AuthTestResponse && equalTo(0, (AuthTestResponse) another); } private boolean equalTo(int synthetic, AuthTestResponse another) { return ok == another.ok && Objects.equals(responseMetadata, another.responseMetadata) && url.equals(another.url) && team.equals(another.team) && teamId.equals(another.teamId) && Objects.equals(user, another.user) && Objects.equals(userId, another.userId); } /** * Computes a hash code from attributes: {@code ok}, {@code responseMetadata}, {@code url}, {@code team}, {@code teamId}, {@code user}, {@code userId}. * @return hashCode value */ @Override public int hashCode() { int h = 5381; h += (h << 5) + Boolean.hashCode(ok); h += (h << 5) + Objects.hashCode(responseMetadata); h += (h << 5) + url.hashCode(); h += (h << 5) + team.hashCode(); h += (h << 5) + teamId.hashCode(); h += (h << 5) + Objects.hashCode(user); h += (h << 5) + Objects.hashCode(userId); return h; } /** * Prints the immutable value {@code AuthTestResponse} with attribute values. * @return A string representation of the value */ @Override public String toString() { StringBuilder builder = new StringBuilder("AuthTestResponse{"); builder.append("ok=").append(ok); if (responseMetadata != null) { builder.append(", "); builder.append("responseMetadata=").append(responseMetadata); } builder.append(", "); builder.append("url=").append(url); builder.append(", "); builder.append("team=").append(team); builder.append(", "); builder.append("teamId=").append(teamId); if (user != null) { builder.append(", "); builder.append("user=").append(user); } if (userId != null) { builder.append(", "); builder.append("userId=").append(userId); } return builder.append("}").toString(); } /** * Utility type used to correctly read immutable object from JSON representation. * @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure */ @Generated(from = "AuthTestResponseIF", generator = "Immutables") @Deprecated @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE) static final class Json implements AuthTestResponseIF { boolean ok; boolean okIsSet; @Nullable Optional responseMetadata = Optional.empty(); @Nullable String url; @Nullable String team; @Nullable String teamId; @Nullable Optional user = Optional.empty(); @Nullable Optional userId = Optional.empty(); @JsonProperty public void setOk(boolean ok) { this.ok = ok; this.okIsSet = true; } @JsonProperty("response_metadata") public void setResponseMetadata(Optional responseMetadata) { this.responseMetadata = responseMetadata; } @JsonProperty public void setUrl(String url) { this.url = url; } @JsonProperty public void setTeam(String team) { this.team = team; } @JsonProperty public void setTeamId(String teamId) { this.teamId = teamId; } @JsonProperty public void setUser(Optional user) { this.user = user; } @JsonProperty public void setUserId(Optional userId) { this.userId = userId; } @Override public boolean isOk() { throw new UnsupportedOperationException(); } @Override public Optional getResponseMetadata() { throw new UnsupportedOperationException(); } @Override public String getUrl() { throw new UnsupportedOperationException(); } @Override public String getTeam() { throw new UnsupportedOperationException(); } @Override public String getTeamId() { throw new UnsupportedOperationException(); } @Override public Optional getUser() { throw new UnsupportedOperationException(); } @Override public Optional getUserId() { throw new UnsupportedOperationException(); } } /** * @param json A JSON-bindable data structure * @return An immutable value type * @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure */ @Deprecated @JsonCreator(mode = JsonCreator.Mode.DELEGATING) static AuthTestResponse fromJson(Json json) { AuthTestResponse.Builder builder = AuthTestResponse.builder(); if (json.okIsSet) { builder.setOk(json.ok); } if (json.responseMetadata != null) { builder.setResponseMetadata(json.responseMetadata); } if (json.url != null) { builder.setUrl(json.url); } if (json.team != null) { builder.setTeam(json.team); } if (json.teamId != null) { builder.setTeamId(json.teamId); } if (json.user != null) { builder.setUser(json.user); } if (json.userId != null) { builder.setUserId(json.userId); } return builder.build(); } /** * Creates an immutable copy of a {@link AuthTestResponseIF} value. * Uses accessors to get values to initialize the new immutable instance. * If an instance is already immutable, it is returned as is. * @param instance The instance to copy * @return A copied immutable AuthTestResponse instance */ public static AuthTestResponse copyOf(AuthTestResponseIF instance) { if (instance instanceof AuthTestResponse) { return (AuthTestResponse) instance; } return AuthTestResponse.builder() .from(instance) .build(); } /** * Creates a builder for {@link AuthTestResponse AuthTestResponse}. *

   * AuthTestResponse.builder()
   *    .setOk(boolean) // required {@link AuthTestResponseIF#isOk() ok}
   *    .setResponseMetadata(ResponseMetadata) // optional {@link AuthTestResponseIF#getResponseMetadata() responseMetadata}
   *    .setUrl(String) // required {@link AuthTestResponseIF#getUrl() url}
   *    .setTeam(String) // required {@link AuthTestResponseIF#getTeam() team}
   *    .setTeamId(String) // required {@link AuthTestResponseIF#getTeamId() teamId}
   *    .setUser(String) // optional {@link AuthTestResponseIF#getUser() user}
   *    .setUserId(String) // optional {@link AuthTestResponseIF#getUserId() userId}
   *    .build();
   * 
* @return A new AuthTestResponse builder */ public static AuthTestResponse.Builder builder() { return new AuthTestResponse.Builder(); } /** * Builds instances of type {@link AuthTestResponse AuthTestResponse}. * Initialize attributes and then invoke the {@link #build()} method to create an * immutable instance. *

{@code Builder} is not thread-safe and generally should not be stored in a field or collection, * but instead used immediately to create instances. */ @Generated(from = "AuthTestResponseIF", generator = "Immutables") @NotThreadSafe public static final class Builder { private static final long INIT_BIT_OK = 0x1L; private static final long INIT_BIT_URL = 0x2L; private static final long INIT_BIT_TEAM = 0x4L; private static final long INIT_BIT_TEAM_ID = 0x8L; private long initBits = 0xfL; private boolean ok; private @Nullable ResponseMetadata responseMetadata; private @Nullable String url; private @Nullable String team; private @Nullable String teamId; private @Nullable String user; private @Nullable String userId; private Builder() { } /** * Fill a builder with attribute values from the provided {@code com.hubspot.slack.client.models.response.SlackResponse} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(SlackResponse instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } /** * Fill a builder with attribute values from the provided {@code com.hubspot.slack.client.models.response.auth.AuthTestResponseIF} instance. * @param instance The instance from which to copy values * @return {@code this} builder for use in a chained invocation */ public final Builder from(AuthTestResponseIF instance) { Objects.requireNonNull(instance, "instance"); from((short) 0, (Object) instance); return this; } private void from(short _unused, Object object) { long bits = 0; if (object instanceof SlackResponse) { SlackResponse instance = (SlackResponse) object; if ((bits & 0x2L) == 0) { this.setOk(instance.isOk()); bits |= 0x2L; } if ((bits & 0x1L) == 0) { Optional responseMetadataOptional = instance.getResponseMetadata(); if (responseMetadataOptional.isPresent()) { setResponseMetadata(responseMetadataOptional); } bits |= 0x1L; } } if (object instanceof AuthTestResponseIF) { AuthTestResponseIF instance = (AuthTestResponseIF) object; this.setTeamId(instance.getTeamId()); this.setTeam(instance.getTeam()); if ((bits & 0x1L) == 0) { Optional responseMetadataOptional = instance.getResponseMetadata(); if (responseMetadataOptional.isPresent()) { setResponseMetadata(responseMetadataOptional); } bits |= 0x1L; } if ((bits & 0x2L) == 0) { this.setOk(instance.isOk()); bits |= 0x2L; } Optional userIdOptional = instance.getUserId(); if (userIdOptional.isPresent()) { setUserId(userIdOptional); } Optional userOptional = instance.getUser(); if (userOptional.isPresent()) { setUser(userOptional); } this.setUrl(instance.getUrl()); } } /** * Initializes the value for the {@link AuthTestResponseIF#isOk() ok} attribute. * @param ok The value for ok * @return {@code this} builder for use in a chained invocation */ public final Builder setOk(boolean ok) { this.ok = ok; initBits &= ~INIT_BIT_OK; return this; } /** * Initializes the optional value {@link AuthTestResponseIF#getResponseMetadata() responseMetadata} to responseMetadata. * @param responseMetadata The value for responseMetadata, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setResponseMetadata(@Nullable ResponseMetadata responseMetadata) { this.responseMetadata = responseMetadata; return this; } /** * Initializes the optional value {@link AuthTestResponseIF#getResponseMetadata() responseMetadata} to responseMetadata. * @param responseMetadata The value for responseMetadata * @return {@code this} builder for use in a chained invocation */ public final Builder setResponseMetadata(Optional responseMetadata) { this.responseMetadata = responseMetadata.orElse(null); return this; } /** * Initializes the value for the {@link AuthTestResponseIF#getUrl() url} attribute. * @param url The value for url * @return {@code this} builder for use in a chained invocation */ public final Builder setUrl(String url) { this.url = Objects.requireNonNull(url, "url"); initBits &= ~INIT_BIT_URL; return this; } /** * Initializes the value for the {@link AuthTestResponseIF#getTeam() team} attribute. * @param team The value for team * @return {@code this} builder for use in a chained invocation */ public final Builder setTeam(String team) { this.team = Objects.requireNonNull(team, "team"); initBits &= ~INIT_BIT_TEAM; return this; } /** * Initializes the value for the {@link AuthTestResponseIF#getTeamId() teamId} attribute. * @param teamId The value for teamId * @return {@code this} builder for use in a chained invocation */ public final Builder setTeamId(String teamId) { this.teamId = Objects.requireNonNull(teamId, "teamId"); initBits &= ~INIT_BIT_TEAM_ID; return this; } /** * Initializes the optional value {@link AuthTestResponseIF#getUser() user} to user. * @param user The value for user, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setUser(@Nullable String user) { this.user = user; return this; } /** * Initializes the optional value {@link AuthTestResponseIF#getUser() user} to user. * @param user The value for user * @return {@code this} builder for use in a chained invocation */ public final Builder setUser(Optional user) { this.user = user.orElse(null); return this; } /** * Initializes the optional value {@link AuthTestResponseIF#getUserId() userId} to userId. * @param userId The value for userId, {@code null} is accepted as {@code java.util.Optional.empty()} * @return {@code this} builder for chained invocation */ public final Builder setUserId(@Nullable String userId) { this.userId = userId; return this; } /** * Initializes the optional value {@link AuthTestResponseIF#getUserId() userId} to userId. * @param userId The value for userId * @return {@code this} builder for use in a chained invocation */ public final Builder setUserId(Optional userId) { this.userId = userId.orElse(null); return this; } /** * Builds a new {@link AuthTestResponse AuthTestResponse}. * @return An immutable instance of AuthTestResponse * @throws com.hubspot.immutables.validation.InvalidImmutableStateException if any required attributes are missing */ public AuthTestResponse build() { checkRequiredAttributes(); return new AuthTestResponse(ok, responseMetadata, url, team, teamId, user, userId); } private boolean okIsSet() { return (initBits & INIT_BIT_OK) == 0; } private boolean urlIsSet() { return (initBits & INIT_BIT_URL) == 0; } private boolean teamIsSet() { return (initBits & INIT_BIT_TEAM) == 0; } private boolean teamIdIsSet() { return (initBits & INIT_BIT_TEAM_ID) == 0; } private void checkRequiredAttributes() { if (initBits != 0) { throw new InvalidImmutableStateException(formatRequiredAttributesMessage()); } } private String formatRequiredAttributesMessage() { List attributes = new ArrayList<>(); if (!okIsSet()) attributes.add("ok"); if (!urlIsSet()) attributes.add("url"); if (!teamIsSet()) attributes.add("team"); if (!teamIdIsSet()) attributes.add("teamId"); return "Cannot build AuthTestResponse, some of required attributes are not set " + attributes; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy