com.dominodatalab.api.model.DominoNotificationsLimitedAudience Maven / Gradle / Ivy
/*
* Domino Data Lab API v4
* This API is going to provide access to all the Domino functions available in the user interface. To authenticate your requests, include your API Key (which you can find on your account page) with the header X-Domino-Api-Key.
*
* The version of the OpenAPI document: 4.0.0
*
*
* 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.api.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.api.model.DominoNotificationsNameAndId;
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;
/**
* Definition of a limited audience for a notification. If present, a notification will be shown to users who are mentioned directly, or part of a mentioned org, or have one of the mentioned roles (at least one of these criteria must apply).
*/
@JsonPropertyOrder({
DominoNotificationsLimitedAudience.JSON_PROPERTY_USERS,
DominoNotificationsLimitedAudience.JSON_PROPERTY_ORGS,
DominoNotificationsLimitedAudience.JSON_PROPERTY_ROLES
})
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2023-10-17T15:20:46.682098100-04:00[America/New_York]")
public class DominoNotificationsLimitedAudience {
public static final String JSON_PROPERTY_USERS = "users";
private List users;
public static final String JSON_PROPERTY_ORGS = "orgs";
private List orgs;
public static final String JSON_PROPERTY_ROLES = "roles";
private List roles;
public DominoNotificationsLimitedAudience() {
}
public DominoNotificationsLimitedAudience users(List users) {
this.users = users;
return this;
}
public DominoNotificationsLimitedAudience addUsersItem(DominoNotificationsNameAndId usersItem) {
if (this.users == null) {
this.users = new ArrayList<>();
}
this.users.add(usersItem);
return this;
}
/**
* Names and IDs of users who will receive this notification
* @return users
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_USERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List getUsers() {
return users;
}
@JsonProperty(JSON_PROPERTY_USERS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setUsers(List users) {
this.users = users;
}
public DominoNotificationsLimitedAudience orgs(List orgs) {
this.orgs = orgs;
return this;
}
public DominoNotificationsLimitedAudience addOrgsItem(DominoNotificationsNameAndId orgsItem) {
if (this.orgs == null) {
this.orgs = new ArrayList<>();
}
this.orgs.add(orgsItem);
return this;
}
/**
* Names and IDs of orgs whose users will receive this notification
* @return orgs
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ORGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List getOrgs() {
return orgs;
}
@JsonProperty(JSON_PROPERTY_ORGS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setOrgs(List orgs) {
this.orgs = orgs;
}
public DominoNotificationsLimitedAudience roles(List roles) {
this.roles = roles;
return this;
}
public DominoNotificationsLimitedAudience addRolesItem(DominoNotificationsNameAndId rolesItem) {
if (this.roles == null) {
this.roles = new ArrayList<>();
}
this.roles.add(rolesItem);
return this;
}
/**
* Names and Ids of Roles. Users that have any of these Roles will receive this notification.
* @return roles
**/
@javax.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ROLES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List getRoles() {
return roles;
}
@JsonProperty(JSON_PROPERTY_ROLES)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public void setRoles(List roles) {
this.roles = roles;
}
/**
* Return true if this domino.notifications.LimitedAudience object is equal to o.
*/
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DominoNotificationsLimitedAudience dominoNotificationsLimitedAudience = (DominoNotificationsLimitedAudience) o;
return Objects.equals(this.users, dominoNotificationsLimitedAudience.users) &&
Objects.equals(this.orgs, dominoNotificationsLimitedAudience.orgs) &&
Objects.equals(this.roles, dominoNotificationsLimitedAudience.roles);
}
@Override
public int hashCode() {
return Objects.hash(users, orgs, roles);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DominoNotificationsLimitedAudience {\n");
sb.append(" users: ").append(toIndentedString(users)).append("\n");
sb.append(" orgs: ").append(toIndentedString(orgs)).append("\n");
sb.append(" roles: ").append(toIndentedString(roles)).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 `users` to the URL query string
if (getUsers() != null) {
for (int i = 0; i < getUsers().size(); i++) {
if (getUsers().get(i) != null) {
joiner.add(getUsers().get(i).toUrlQueryString(String.format("%susers%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
// add `orgs` to the URL query string
if (getOrgs() != null) {
for (int i = 0; i < getOrgs().size(); i++) {
if (getOrgs().get(i) != null) {
joiner.add(getOrgs().get(i).toUrlQueryString(String.format("%sorgs%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
// add `roles` to the URL query string
if (getRoles() != null) {
for (int i = 0; i < getRoles().size(); i++) {
if (getRoles().get(i) != null) {
joiner.add(getRoles().get(i).toUrlQueryString(String.format("%sroles%s%s", prefix, suffix,
"".equals(suffix) ? "" : String.format("%s%d%s", containerPrefix, i, containerSuffix))));
}
}
}
return joiner.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy