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

com.dominodatalab.pub.model.ProjectV1 Maven / Gradle / Ivy

/*
 * Domino Public API
 * Domino Public API Endpoints
 *
 * The version of the OpenAPI document: 5.9.1
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.dominodatalab.pub.model;

import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.StringJoiner;
import java.util.Objects;
import java.util.Map;
import java.util.HashMap;
import com.dominodatalab.pub.model.ProjectCollaboratorV1;
import com.dominodatalab.pub.model.ProjectGitRepositoryV1;
import com.dominodatalab.pub.model.ProjectVisibilityV1;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;


/**
 * ProjectV1
 */
@JsonPropertyOrder({
  ProjectV1.JSON_PROPERTY_COLLABORATORS,
  ProjectV1.JSON_PROPERTY_DESCRIPTION,
  ProjectV1.JSON_PROPERTY_ID,
  ProjectV1.JSON_PROPERTY_INTERNAL_TAGS,
  ProjectV1.JSON_PROPERTY_MAIN_REPOSITORY,
  ProjectV1.JSON_PROPERTY_NAME,
  ProjectV1.JSON_PROPERTY_OWNER_ID,
  ProjectV1.JSON_PROPERTY_OWNER_USERNAME,
  ProjectV1.JSON_PROPERTY_VISIBILITY
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2024-02-03T07:34:09.642933400-05:00[America/New_York]")
public class ProjectV1 {
  public static final String JSON_PROPERTY_COLLABORATORS = "collaborators";
  private List collaborators = new ArrayList<>();

  public static final String JSON_PROPERTY_DESCRIPTION = "description";
  private String description;

  public static final String JSON_PROPERTY_ID = "id";
  private String id;

  public static final String JSON_PROPERTY_INTERNAL_TAGS = "internal tags";
  private List internalTags;

  public static final String JSON_PROPERTY_MAIN_REPOSITORY = "mainRepository";
  private ProjectGitRepositoryV1 mainRepository;

  public static final String JSON_PROPERTY_NAME = "name";
  private String name;

  public static final String JSON_PROPERTY_OWNER_ID = "ownerId";
  private String ownerId;

  public static final String JSON_PROPERTY_OWNER_USERNAME = "ownerUsername";
  private String ownerUsername;

  public static final String JSON_PROPERTY_VISIBILITY = "visibility";
  private ProjectVisibilityV1 visibility;

  public ProjectV1() { 
  }

  public ProjectV1 collaborators(List collaborators) {
    this.collaborators = collaborators;
    return this;
  }

  public ProjectV1 addCollaboratorsItem(ProjectCollaboratorV1 collaboratorsItem) {
    if (this.collaborators == null) {
      this.collaborators = new ArrayList<>();
    }
    this.collaborators.add(collaboratorsItem);
    return this;
  }

   /**
   * List of collaborators, if any
   * @return collaborators
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_COLLABORATORS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public List getCollaborators() {
    return collaborators;
  }


  @JsonProperty(JSON_PROPERTY_COLLABORATORS)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setCollaborators(List collaborators) {
    this.collaborators = collaborators;
  }


  public ProjectV1 description(String description) {
    this.description = description;
    return this;
  }

   /**
   * A description of the project
   * @return description
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getDescription() {
    return description;
  }


  @JsonProperty(JSON_PROPERTY_DESCRIPTION)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setDescription(String description) {
    this.description = description;
  }


  public ProjectV1 id(String id) {
    this.id = id;
    return this;
  }

   /**
   * Project ID
   * @return id
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getId() {
    return id;
  }


  @JsonProperty(JSON_PROPERTY_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setId(String id) {
    this.id = id;
  }


  public ProjectV1 internalTags(List internalTags) {
    this.internalTags = internalTags;
    return this;
  }

  public ProjectV1 addInternalTagsItem(String internalTagsItem) {
    if (this.internalTags == null) {
      this.internalTags = new ArrayList<>();
    }
    this.internalTags.add(internalTagsItem);
    return this;
  }

   /**
   * Optional list of strings containing internal tags of project
   * @return internalTags
  **/
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_INTERNAL_TAGS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public List getInternalTags() {
    return internalTags;
  }


  @JsonProperty(JSON_PROPERTY_INTERNAL_TAGS)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setInternalTags(List internalTags) {
    this.internalTags = internalTags;
  }


  public ProjectV1 mainRepository(ProjectGitRepositoryV1 mainRepository) {
    this.mainRepository = mainRepository;
    return this;
  }

   /**
   * Get mainRepository
   * @return mainRepository
  **/
  @javax.annotation.Nullable
  @JsonProperty(JSON_PROPERTY_MAIN_REPOSITORY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

  public ProjectGitRepositoryV1 getMainRepository() {
    return mainRepository;
  }


  @JsonProperty(JSON_PROPERTY_MAIN_REPOSITORY)
  @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
  public void setMainRepository(ProjectGitRepositoryV1 mainRepository) {
    this.mainRepository = mainRepository;
  }


  public ProjectV1 name(String name) {
    this.name = name;
    return this;
  }

   /**
   * Name of the project
   * @return name
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getName() {
    return name;
  }


  @JsonProperty(JSON_PROPERTY_NAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setName(String name) {
    this.name = name;
  }


  public ProjectV1 ownerId(String ownerId) {
    this.ownerId = ownerId;
    return this;
  }

   /**
   * userId of the project owner
   * @return ownerId
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_OWNER_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getOwnerId() {
    return ownerId;
  }


  @JsonProperty(JSON_PROPERTY_OWNER_ID)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setOwnerId(String ownerId) {
    this.ownerId = ownerId;
  }


  public ProjectV1 ownerUsername(String ownerUsername) {
    this.ownerUsername = ownerUsername;
    return this;
  }

   /**
   * username of the project owner
   * @return ownerUsername
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_OWNER_USERNAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public String getOwnerUsername() {
    return ownerUsername;
  }


  @JsonProperty(JSON_PROPERTY_OWNER_USERNAME)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setOwnerUsername(String ownerUsername) {
    this.ownerUsername = ownerUsername;
  }


  public ProjectV1 visibility(ProjectVisibilityV1 visibility) {
    this.visibility = visibility;
    return this;
  }

   /**
   * Get visibility
   * @return visibility
  **/
  @javax.annotation.Nonnull
  @JsonProperty(JSON_PROPERTY_VISIBILITY)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)

  public ProjectVisibilityV1 getVisibility() {
    return visibility;
  }


  @JsonProperty(JSON_PROPERTY_VISIBILITY)
  @JsonInclude(value = JsonInclude.Include.ALWAYS)
  public void setVisibility(ProjectVisibilityV1 visibility) {
    this.visibility = visibility;
  }


  /**
   * Return true if this ProjectV1 object is equal to o.
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    ProjectV1 projectV1 = (ProjectV1) o;
    return Objects.equals(this.collaborators, projectV1.collaborators) &&
        Objects.equals(this.description, projectV1.description) &&
        Objects.equals(this.id, projectV1.id) &&
        Objects.equals(this.internalTags, projectV1.internalTags) &&
        Objects.equals(this.mainRepository, projectV1.mainRepository) &&
        Objects.equals(this.name, projectV1.name) &&
        Objects.equals(this.ownerId, projectV1.ownerId) &&
        Objects.equals(this.ownerUsername, projectV1.ownerUsername) &&
        Objects.equals(this.visibility, projectV1.visibility);
  }

  @Override
  public int hashCode() {
    return Objects.hash(collaborators, description, id, internalTags, mainRepository, name, ownerId, ownerUsername, visibility);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class ProjectV1 {\n");
    sb.append("    collaborators: ").append(toIndentedString(collaborators)).append("\n");
    sb.append("    description: ").append(toIndentedString(description)).append("\n");
    sb.append("    id: ").append(toIndentedString(id)).append("\n");
    sb.append("    internalTags: ").append(toIndentedString(internalTags)).append("\n");
    sb.append("    mainRepository: ").append(toIndentedString(mainRepository)).append("\n");
    sb.append("    name: ").append(toIndentedString(name)).append("\n");
    sb.append("    ownerId: ").append(toIndentedString(ownerId)).append("\n");
    sb.append("    ownerUsername: ").append(toIndentedString(ownerUsername)).append("\n");
    sb.append("    visibility: ").append(toIndentedString(visibility)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

  /**
   * Convert the instance into URL query string.
   *
   * @return URL query string
   */
  public String toUrlQueryString() {
    return toUrlQueryString(null);
  }

  /**
   * Convert the instance into URL query string.
   *
   * @param prefix prefix of the query string
   * @return URL query string
   */
  public String toUrlQueryString(String prefix) {
    String suffix = "";
    String containerSuffix = "";
    String containerPrefix = "";
    if (prefix == null) {
      // style=form, explode=true, e.g. /pet?name=cat&type=manx
      prefix = "";
    } else {
      // deepObject style e.g. /pet?id[name]=cat&id[type]=manx
      prefix = prefix + "[";
      suffix = "]";
      containerSuffix = "]";
      containerPrefix = "[";
    }

    StringJoiner joiner = new StringJoiner("&");

    // add `collaborators` to the URL query string
    if (getCollaborators() != null) {
      for (int i = 0; i < getCollaborators().size(); i++) {
        if (getCollaborators().get(i) != null) {
          joiner.add(getCollaborators().get(i).toUrlQueryString(String.format("%scollaborators%s%s", prefix, suffix,
          "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
        }
      }
    }

    // add `description` to the URL query string
    if (getDescription() != null) {
      joiner.add(String.format("%sdescription%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getDescription()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `id` to the URL query string
    if (getId() != null) {
      joiner.add(String.format("%sid%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `internal tags` to the URL query string
    if (getInternalTags() != null) {
      for (int i = 0; i < getInternalTags().size(); i++) {
        joiner.add(String.format("%sinternal tags%s%s=%s", prefix, suffix,
            "".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix),
            URLEncoder.encode(String.valueOf(getInternalTags().get(i)), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
      }
    }

    // add `mainRepository` to the URL query string
    if (getMainRepository() != null) {
      joiner.add(getMainRepository().toUrlQueryString(prefix + "mainRepository" + suffix));
    }

    // add `name` to the URL query string
    if (getName() != null) {
      joiner.add(String.format("%sname%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getName()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `ownerId` to the URL query string
    if (getOwnerId() != null) {
      joiner.add(String.format("%sownerId%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getOwnerId()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `ownerUsername` to the URL query string
    if (getOwnerUsername() != null) {
      joiner.add(String.format("%sownerUsername%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getOwnerUsername()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    // add `visibility` to the URL query string
    if (getVisibility() != null) {
      joiner.add(String.format("%svisibility%s=%s", prefix, suffix, URLEncoder.encode(String.valueOf(getVisibility()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
    }

    return joiner.toString();
  }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy