
odata.msgraph.client.entity.Channel Maven / Gradle / Ivy
package odata.msgraph.client.entity;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.github.davidmoten.guavamini.Preconditions;
import com.github.davidmoten.odata.client.ActionRequestNoReturn;
import com.github.davidmoten.odata.client.ActionRequestReturningNonCollectionUnwrapped;
import com.github.davidmoten.odata.client.ClientException;
import com.github.davidmoten.odata.client.FunctionRequestReturningNonCollection;
import com.github.davidmoten.odata.client.NameValue;
import com.github.davidmoten.odata.client.ODataEntityType;
import com.github.davidmoten.odata.client.RequestOptions;
import com.github.davidmoten.odata.client.UnmappedFields;
import com.github.davidmoten.odata.client.Util;
import com.github.davidmoten.odata.client.annotation.Action;
import com.github.davidmoten.odata.client.annotation.Function;
import com.github.davidmoten.odata.client.annotation.NavigationProperty;
import com.github.davidmoten.odata.client.annotation.Property;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.Checks;
import com.github.davidmoten.odata.client.internal.ParameterMap;
import com.github.davidmoten.odata.client.internal.RequestHelper;
import com.github.davidmoten.odata.client.internal.TypedObject;
import com.github.davidmoten.odata.client.internal.UnmappedFieldsImpl;
import java.lang.Boolean;
import java.lang.Object;
import java.lang.Override;
import java.lang.String;
import java.lang.StringBuilder;
import java.time.OffsetDateTime;
import java.util.Map;
import java.util.Optional;
import odata.msgraph.client.complex.ProvisionChannelEmailResult;
import odata.msgraph.client.entity.collection.request.ChatMessageCollectionRequest;
import odata.msgraph.client.entity.collection.request.ConversationMemberCollectionRequest;
import odata.msgraph.client.entity.collection.request.SharedWithChannelTeamInfoCollectionRequest;
import odata.msgraph.client.entity.collection.request.TeamsTabCollectionRequest;
import odata.msgraph.client.entity.request.DriveItemRequest;
import odata.msgraph.client.enums.ChannelMembershipType;
@JsonPropertyOrder({
"@odata.type",
"createdDateTime",
"description",
"displayName",
"email",
"isFavoriteByDefault",
"membershipType",
"tenantId",
"webUrl"})
@JsonInclude(Include.NON_NULL)
public class Channel extends Entity implements ODataEntityType {
@Override
public String odataTypeName() {
return "microsoft.graph.channel";
}
@JsonProperty("createdDateTime")
protected OffsetDateTime createdDateTime;
@JsonProperty("description")
protected String description;
@JsonProperty("displayName")
protected String displayName;
@JsonProperty("email")
protected String email;
@JsonProperty("isFavoriteByDefault")
protected Boolean isFavoriteByDefault;
@JsonProperty("membershipType")
protected ChannelMembershipType membershipType;
@JsonProperty("tenantId")
protected String tenantId;
@JsonProperty("webUrl")
protected String webUrl;
protected Channel() {
super();
}
/**
* Returns a builder which is used to create a new
* instance of this class (given that this class is immutable).
*
* @return a new Builder for this class
*/
// Suffix used on builder factory method to differentiate the method
// from static builder methods on superclasses
public static Builder builderChannel() {
return new Builder();
}
public static final class Builder {
private String id;
private OffsetDateTime createdDateTime;
private String description;
private String displayName;
private String email;
private Boolean isFavoriteByDefault;
private ChannelMembershipType membershipType;
private String tenantId;
private String webUrl;
private ChangedFields changedFields = ChangedFields.EMPTY;
Builder() {
// prevent instantiation
}
public Builder id(String id) {
this.id = id;
this.changedFields = changedFields.add("id");
return this;
}
public Builder createdDateTime(OffsetDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
this.changedFields = changedFields.add("createdDateTime");
return this;
}
public Builder description(String description) {
this.description = description;
this.changedFields = changedFields.add("description");
return this;
}
public Builder displayName(String displayName) {
this.displayName = displayName;
this.changedFields = changedFields.add("displayName");
return this;
}
public Builder email(String email) {
this.email = email;
this.changedFields = changedFields.add("email");
return this;
}
public Builder isFavoriteByDefault(Boolean isFavoriteByDefault) {
this.isFavoriteByDefault = isFavoriteByDefault;
this.changedFields = changedFields.add("isFavoriteByDefault");
return this;
}
public Builder membershipType(ChannelMembershipType membershipType) {
this.membershipType = membershipType;
this.changedFields = changedFields.add("membershipType");
return this;
}
public Builder tenantId(String tenantId) {
this.tenantId = tenantId;
this.changedFields = changedFields.add("tenantId");
return this;
}
public Builder webUrl(String webUrl) {
this.webUrl = webUrl;
this.changedFields = changedFields.add("webUrl");
return this;
}
public Channel build() {
Channel _x = new Channel();
_x.contextPath = null;
_x.changedFields = changedFields;
_x.unmappedFields = new UnmappedFieldsImpl();
_x.odataType = "microsoft.graph.channel";
_x.id = id;
_x.createdDateTime = createdDateTime;
_x.description = description;
_x.displayName = displayName;
_x.email = email;
_x.isFavoriteByDefault = isFavoriteByDefault;
_x.membershipType = membershipType;
_x.tenantId = tenantId;
_x.webUrl = webUrl;
return _x;
}
}
@Override
@JsonIgnore
public ChangedFields getChangedFields() {
return changedFields;
}
@Override
public void postInject(boolean addKeysToContextPath) {
if (addKeysToContextPath && id != null) {
contextPath = contextPath.clearQueries().addKeys(new NameValue(id.toString()));
}
}
@Property(name="createdDateTime")
@JsonIgnore
public Optional getCreatedDateTime() {
return Optional.ofNullable(createdDateTime);
}
public Channel withCreatedDateTime(OffsetDateTime createdDateTime) {
Channel _x = _copy();
_x.changedFields = changedFields.add("createdDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.createdDateTime = createdDateTime;
return _x;
}
@Property(name="description")
@JsonIgnore
public Optional getDescription() {
return Optional.ofNullable(description);
}
public Channel withDescription(String description) {
Channel _x = _copy();
_x.changedFields = changedFields.add("description");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.description = description;
return _x;
}
@Property(name="displayName")
@JsonIgnore
public Optional getDisplayName() {
return Optional.ofNullable(displayName);
}
public Channel withDisplayName(String displayName) {
Channel _x = _copy();
_x.changedFields = changedFields.add("displayName");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.displayName = displayName;
return _x;
}
@Property(name="email")
@JsonIgnore
public Optional getEmail() {
return Optional.ofNullable(email);
}
public Channel withEmail(String email) {
Channel _x = _copy();
_x.changedFields = changedFields.add("email");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.email = email;
return _x;
}
@Property(name="isFavoriteByDefault")
@JsonIgnore
public Optional getIsFavoriteByDefault() {
return Optional.ofNullable(isFavoriteByDefault);
}
public Channel withIsFavoriteByDefault(Boolean isFavoriteByDefault) {
Channel _x = _copy();
_x.changedFields = changedFields.add("isFavoriteByDefault");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.isFavoriteByDefault = isFavoriteByDefault;
return _x;
}
@Property(name="membershipType")
@JsonIgnore
public Optional getMembershipType() {
return Optional.ofNullable(membershipType);
}
public Channel withMembershipType(ChannelMembershipType membershipType) {
Channel _x = _copy();
_x.changedFields = changedFields.add("membershipType");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.membershipType = membershipType;
return _x;
}
@Property(name="tenantId")
@JsonIgnore
public Optional getTenantId() {
return Optional.ofNullable(tenantId);
}
public Channel withTenantId(String tenantId) {
Channel _x = _copy();
_x.changedFields = changedFields.add("tenantId");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.tenantId = tenantId;
return _x;
}
@Property(name="webUrl")
@JsonIgnore
public Optional getWebUrl() {
return Optional.ofNullable(webUrl);
}
public Channel withWebUrl(String webUrl) {
Channel _x = _copy();
_x.changedFields = changedFields.add("webUrl");
_x.odataType = Util.nvl(odataType, "microsoft.graph.channel");
_x.webUrl = webUrl;
return _x;
}
public Channel withUnmappedField(String name, String value) {
Channel _x = _copy();
_x.setUnmappedField(name, value);
return _x;
}
@NavigationProperty(name="filesFolder")
@JsonIgnore
public DriveItemRequest getFilesFolder() {
return new DriveItemRequest(contextPath.addSegment("filesFolder"), RequestHelper.getValue(unmappedFields, "filesFolder"));
}
@NavigationProperty(name="members")
@JsonIgnore
public ConversationMemberCollectionRequest getMembers() {
return new ConversationMemberCollectionRequest(
contextPath.addSegment("members"), RequestHelper.getValue(unmappedFields, "members"));
}
/**
*
* Org.OData.Capabilities.V1.ChangeTracking
*
* Supported = true
*
* @return navigational property messages
*/
@NavigationProperty(name="messages")
@JsonIgnore
public ChatMessageCollectionRequest getMessages() {
return new ChatMessageCollectionRequest(
contextPath.addSegment("messages"), RequestHelper.getValue(unmappedFields, "messages"));
}
@NavigationProperty(name="sharedWithTeams")
@JsonIgnore
public SharedWithChannelTeamInfoCollectionRequest getSharedWithTeams() {
return new SharedWithChannelTeamInfoCollectionRequest(
contextPath.addSegment("sharedWithTeams"), RequestHelper.getValue(unmappedFields, "sharedWithTeams"));
}
@NavigationProperty(name="tabs")
@JsonIgnore
public TeamsTabCollectionRequest getTabs() {
return new TeamsTabCollectionRequest(
contextPath.addSegment("tabs"), RequestHelper.getValue(unmappedFields, "tabs"));
}
@JsonAnySetter
private void setUnmappedField(String name, Object value) {
if (unmappedFields == null) {
unmappedFields = new UnmappedFieldsImpl();
}
unmappedFields.put(name, value);
}
@JsonAnyGetter
private UnmappedFieldsImpl unmappedFields() {
return unmappedFields == null ? UnmappedFieldsImpl.EMPTY : unmappedFields;
}
@Override
public UnmappedFields getUnmappedFields() {
return unmappedFields();
}
/**
* Submits only changed fields for update and returns an
* immutable copy of {@code this} with changed fields reset.
*
* @return a copy of {@code this} with changed fields reset
* @throws ClientException if HTTP response is not as expected
*/
public Channel patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
Channel _x = _copy();
_x.changedFields = null;
return _x;
}
/**
* Submits all fields for update and returns an immutable copy of {@code this}
* with changed fields reset (they were ignored anyway).
*
* @return a copy of {@code this} with changed fields reset
* @throws ClientException if HTTP response is not as expected
*/
public Channel put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
Channel _x = _copy();
_x.changedFields = null;
return _x;
}
private Channel _copy() {
Channel _x = new Channel();
_x.contextPath = contextPath;
_x.changedFields = changedFields;
_x.unmappedFields = unmappedFields.copy();
_x.odataType = odataType;
_x.id = id;
_x.createdDateTime = createdDateTime;
_x.description = description;
_x.displayName = displayName;
_x.email = email;
_x.isFavoriteByDefault = isFavoriteByDefault;
_x.membershipType = membershipType;
_x.tenantId = tenantId;
_x.webUrl = webUrl;
return _x;
}
@Action(name = "completeMigration")
@JsonIgnore
public ActionRequestNoReturn completeMigration() {
Map _parameters = ParameterMap.empty();
return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.completeMigration"), _parameters);
}
@Action(name = "provisionEmail")
@JsonIgnore
public ActionRequestReturningNonCollectionUnwrapped provisionEmail() {
Map _parameters = ParameterMap.empty();
return new ActionRequestReturningNonCollectionUnwrapped(this.contextPath.addActionOrFunctionSegment("microsoft.graph.provisionEmail"), ProvisionChannelEmailResult.class, _parameters);
}
@Action(name = "removeEmail")
@JsonIgnore
public ActionRequestNoReturn removeEmail() {
Map _parameters = ParameterMap.empty();
return new ActionRequestNoReturn(this.contextPath.addActionOrFunctionSegment("microsoft.graph.removeEmail"), _parameters);
}
@Function(name = "doesUserHaveAccess")
@JsonIgnore
public FunctionRequestReturningNonCollection doesUserHaveAccess(String userId, String tenantId, String userPrincipalName) {
Preconditions.checkNotNull(userId, "userId cannot be null");
Preconditions.checkNotNull(tenantId, "tenantId cannot be null");
Preconditions.checkNotNull(userPrincipalName, "userPrincipalName cannot be null");
Map _parameters = ParameterMap
.put("userId", "Edm.String", Checks.checkIsAscii(userId))
.put("tenantId", "Edm.String", Checks.checkIsAscii(tenantId))
.put("userPrincipalName", "Edm.String", Checks.checkIsAscii(userPrincipalName))
.build();
return new FunctionRequestReturningNonCollection(this.contextPath.addActionOrFunctionSegment("microsoft.graph.doesUserHaveAccess"), Boolean.class, _parameters);
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("Channel[");
b.append("id=");
b.append(this.id);
b.append(", ");
b.append("createdDateTime=");
b.append(this.createdDateTime);
b.append(", ");
b.append("description=");
b.append(this.description);
b.append(", ");
b.append("displayName=");
b.append(this.displayName);
b.append(", ");
b.append("email=");
b.append(this.email);
b.append(", ");
b.append("isFavoriteByDefault=");
b.append(this.isFavoriteByDefault);
b.append(", ");
b.append("membershipType=");
b.append(this.membershipType);
b.append(", ");
b.append("tenantId=");
b.append(this.tenantId);
b.append(", ");
b.append("webUrl=");
b.append(this.webUrl);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}