
odata.msgraph.client.entity.TodoTask 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.odata.client.ClientException;
import com.github.davidmoten.odata.client.CollectionPage;
import com.github.davidmoten.odata.client.HttpRequestOptions;
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.NavigationProperty;
import com.github.davidmoten.odata.client.annotation.Property;
import com.github.davidmoten.odata.client.internal.ChangedFields;
import com.github.davidmoten.odata.client.internal.RequestHelper;
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.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import odata.msgraph.client.complex.DateTimeTimeZone;
import odata.msgraph.client.complex.ItemBody;
import odata.msgraph.client.complex.PatternedRecurrence;
import odata.msgraph.client.entity.collection.request.AttachmentBaseCollectionRequest;
import odata.msgraph.client.entity.collection.request.AttachmentSessionCollectionRequest;
import odata.msgraph.client.entity.collection.request.ChecklistItemCollectionRequest;
import odata.msgraph.client.entity.collection.request.ExtensionCollectionRequest;
import odata.msgraph.client.entity.collection.request.LinkedResourceCollectionRequest;
import odata.msgraph.client.enums.Importance;
import odata.msgraph.client.enums.TaskStatus;
@JsonPropertyOrder({
"@odata.type",
"body",
"bodyLastModifiedDateTime",
"categories",
"completedDateTime",
"createdDateTime",
"dueDateTime",
"hasAttachments",
"importance",
"isReminderOn",
"lastModifiedDateTime",
"recurrence",
"reminderDateTime",
"startDateTime",
"status",
"title"})
@JsonInclude(Include.NON_NULL)
public class TodoTask extends Entity implements ODataEntityType {
@Override
public String odataTypeName() {
return "microsoft.graph.todoTask";
}
@JsonProperty("body")
protected ItemBody body;
@JsonProperty("bodyLastModifiedDateTime")
protected OffsetDateTime bodyLastModifiedDateTime;
@JsonProperty("categories")
protected List categories;
@JsonProperty("categories@nextLink")
protected String categoriesNextLink;
@JsonProperty("completedDateTime")
protected DateTimeTimeZone completedDateTime;
@JsonProperty("createdDateTime")
protected OffsetDateTime createdDateTime;
@JsonProperty("dueDateTime")
protected DateTimeTimeZone dueDateTime;
@JsonProperty("hasAttachments")
protected Boolean hasAttachments;
@JsonProperty("importance")
protected Importance importance;
@JsonProperty("isReminderOn")
protected Boolean isReminderOn;
@JsonProperty("lastModifiedDateTime")
protected OffsetDateTime lastModifiedDateTime;
@JsonProperty("recurrence")
protected PatternedRecurrence recurrence;
@JsonProperty("reminderDateTime")
protected DateTimeTimeZone reminderDateTime;
@JsonProperty("startDateTime")
protected DateTimeTimeZone startDateTime;
@JsonProperty("status")
protected TaskStatus status;
@JsonProperty("title")
protected String title;
protected TodoTask() {
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 builderTodoTask() {
return new Builder();
}
public static final class Builder {
private String id;
private ItemBody body;
private OffsetDateTime bodyLastModifiedDateTime;
private List categories;
private String categoriesNextLink;
private DateTimeTimeZone completedDateTime;
private OffsetDateTime createdDateTime;
private DateTimeTimeZone dueDateTime;
private Boolean hasAttachments;
private Importance importance;
private Boolean isReminderOn;
private OffsetDateTime lastModifiedDateTime;
private PatternedRecurrence recurrence;
private DateTimeTimeZone reminderDateTime;
private DateTimeTimeZone startDateTime;
private TaskStatus status;
private String title;
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 body(ItemBody body) {
this.body = body;
this.changedFields = changedFields.add("body");
return this;
}
public Builder bodyLastModifiedDateTime(OffsetDateTime bodyLastModifiedDateTime) {
this.bodyLastModifiedDateTime = bodyLastModifiedDateTime;
this.changedFields = changedFields.add("bodyLastModifiedDateTime");
return this;
}
public Builder categories(List categories) {
this.categories = categories;
this.changedFields = changedFields.add("categories");
return this;
}
public Builder categories(String... categories) {
return categories(Arrays.asList(categories));
}
public Builder categoriesNextLink(String categoriesNextLink) {
this.categoriesNextLink = categoriesNextLink;
this.changedFields = changedFields.add("categories");
return this;
}
public Builder completedDateTime(DateTimeTimeZone completedDateTime) {
this.completedDateTime = completedDateTime;
this.changedFields = changedFields.add("completedDateTime");
return this;
}
public Builder createdDateTime(OffsetDateTime createdDateTime) {
this.createdDateTime = createdDateTime;
this.changedFields = changedFields.add("createdDateTime");
return this;
}
public Builder dueDateTime(DateTimeTimeZone dueDateTime) {
this.dueDateTime = dueDateTime;
this.changedFields = changedFields.add("dueDateTime");
return this;
}
public Builder hasAttachments(Boolean hasAttachments) {
this.hasAttachments = hasAttachments;
this.changedFields = changedFields.add("hasAttachments");
return this;
}
public Builder importance(Importance importance) {
this.importance = importance;
this.changedFields = changedFields.add("importance");
return this;
}
public Builder isReminderOn(Boolean isReminderOn) {
this.isReminderOn = isReminderOn;
this.changedFields = changedFields.add("isReminderOn");
return this;
}
public Builder lastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
this.lastModifiedDateTime = lastModifiedDateTime;
this.changedFields = changedFields.add("lastModifiedDateTime");
return this;
}
public Builder recurrence(PatternedRecurrence recurrence) {
this.recurrence = recurrence;
this.changedFields = changedFields.add("recurrence");
return this;
}
public Builder reminderDateTime(DateTimeTimeZone reminderDateTime) {
this.reminderDateTime = reminderDateTime;
this.changedFields = changedFields.add("reminderDateTime");
return this;
}
public Builder startDateTime(DateTimeTimeZone startDateTime) {
this.startDateTime = startDateTime;
this.changedFields = changedFields.add("startDateTime");
return this;
}
public Builder status(TaskStatus status) {
this.status = status;
this.changedFields = changedFields.add("status");
return this;
}
public Builder title(String title) {
this.title = title;
this.changedFields = changedFields.add("title");
return this;
}
public TodoTask build() {
TodoTask _x = new TodoTask();
_x.contextPath = null;
_x.changedFields = changedFields;
_x.unmappedFields = new UnmappedFieldsImpl();
_x.odataType = "microsoft.graph.todoTask";
_x.id = id;
_x.body = body;
_x.bodyLastModifiedDateTime = bodyLastModifiedDateTime;
_x.categories = categories;
_x.categoriesNextLink = categoriesNextLink;
_x.completedDateTime = completedDateTime;
_x.createdDateTime = createdDateTime;
_x.dueDateTime = dueDateTime;
_x.hasAttachments = hasAttachments;
_x.importance = importance;
_x.isReminderOn = isReminderOn;
_x.lastModifiedDateTime = lastModifiedDateTime;
_x.recurrence = recurrence;
_x.reminderDateTime = reminderDateTime;
_x.startDateTime = startDateTime;
_x.status = status;
_x.title = title;
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="body")
@JsonIgnore
public Optional getBody() {
return Optional.ofNullable(body);
}
public TodoTask withBody(ItemBody body) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("body");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.body = body;
return _x;
}
@Property(name="bodyLastModifiedDateTime")
@JsonIgnore
public Optional getBodyLastModifiedDateTime() {
return Optional.ofNullable(bodyLastModifiedDateTime);
}
public TodoTask withBodyLastModifiedDateTime(OffsetDateTime bodyLastModifiedDateTime) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("bodyLastModifiedDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.bodyLastModifiedDateTime = bodyLastModifiedDateTime;
return _x;
}
@Property(name="categories")
@JsonIgnore
public CollectionPage getCategories() {
return new CollectionPage(contextPath, String.class, this.categories, Optional.ofNullable(categoriesNextLink), Collections.emptyList(), HttpRequestOptions.EMPTY);
}
public TodoTask withCategories(List categories) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("categories");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.categories = categories;
return _x;
}
@Property(name="categories")
@JsonIgnore
public CollectionPage getCategories(HttpRequestOptions options) {
return new CollectionPage(contextPath, String.class, this.categories, Optional.ofNullable(categoriesNextLink), Collections.emptyList(), options);
}
@Property(name="completedDateTime")
@JsonIgnore
public Optional getCompletedDateTime() {
return Optional.ofNullable(completedDateTime);
}
public TodoTask withCompletedDateTime(DateTimeTimeZone completedDateTime) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("completedDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.completedDateTime = completedDateTime;
return _x;
}
@Property(name="createdDateTime")
@JsonIgnore
public Optional getCreatedDateTime() {
return Optional.ofNullable(createdDateTime);
}
public TodoTask withCreatedDateTime(OffsetDateTime createdDateTime) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("createdDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.createdDateTime = createdDateTime;
return _x;
}
@Property(name="dueDateTime")
@JsonIgnore
public Optional getDueDateTime() {
return Optional.ofNullable(dueDateTime);
}
public TodoTask withDueDateTime(DateTimeTimeZone dueDateTime) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("dueDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.dueDateTime = dueDateTime;
return _x;
}
@Property(name="hasAttachments")
@JsonIgnore
public Optional getHasAttachments() {
return Optional.ofNullable(hasAttachments);
}
public TodoTask withHasAttachments(Boolean hasAttachments) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("hasAttachments");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.hasAttachments = hasAttachments;
return _x;
}
@Property(name="importance")
@JsonIgnore
public Optional getImportance() {
return Optional.ofNullable(importance);
}
public TodoTask withImportance(Importance importance) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("importance");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.importance = importance;
return _x;
}
@Property(name="isReminderOn")
@JsonIgnore
public Optional getIsReminderOn() {
return Optional.ofNullable(isReminderOn);
}
public TodoTask withIsReminderOn(Boolean isReminderOn) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("isReminderOn");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.isReminderOn = isReminderOn;
return _x;
}
@Property(name="lastModifiedDateTime")
@JsonIgnore
public Optional getLastModifiedDateTime() {
return Optional.ofNullable(lastModifiedDateTime);
}
public TodoTask withLastModifiedDateTime(OffsetDateTime lastModifiedDateTime) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("lastModifiedDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.lastModifiedDateTime = lastModifiedDateTime;
return _x;
}
@Property(name="recurrence")
@JsonIgnore
public Optional getRecurrence() {
return Optional.ofNullable(recurrence);
}
public TodoTask withRecurrence(PatternedRecurrence recurrence) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("recurrence");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.recurrence = recurrence;
return _x;
}
@Property(name="reminderDateTime")
@JsonIgnore
public Optional getReminderDateTime() {
return Optional.ofNullable(reminderDateTime);
}
public TodoTask withReminderDateTime(DateTimeTimeZone reminderDateTime) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("reminderDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.reminderDateTime = reminderDateTime;
return _x;
}
@Property(name="startDateTime")
@JsonIgnore
public Optional getStartDateTime() {
return Optional.ofNullable(startDateTime);
}
public TodoTask withStartDateTime(DateTimeTimeZone startDateTime) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("startDateTime");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.startDateTime = startDateTime;
return _x;
}
@Property(name="status")
@JsonIgnore
public Optional getStatus() {
return Optional.ofNullable(status);
}
public TodoTask withStatus(TaskStatus status) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("status");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.status = status;
return _x;
}
@Property(name="title")
@JsonIgnore
public Optional getTitle() {
return Optional.ofNullable(title);
}
public TodoTask withTitle(String title) {
TodoTask _x = _copy();
_x.changedFields = changedFields.add("title");
_x.odataType = Util.nvl(odataType, "microsoft.graph.todoTask");
_x.title = title;
return _x;
}
public TodoTask withUnmappedField(String name, String value) {
TodoTask _x = _copy();
_x.setUnmappedField(name, value);
return _x;
}
/**
*
* Org.OData.Capabilities.V1.ChangeTracking
*
* Supported = false
*
* Org.OData.Capabilities.V1.ExpandRestrictions
*
* Expandable = false
*
* Org.OData.Capabilities.V1.SearchRestrictions
*
* Searchable = false
*
* Org.OData.Capabilities.V1.UpdateRestrictions
*
* Updatable = false
*
* @return navigational property attachments
*/
@NavigationProperty(name="attachments")
@JsonIgnore
public AttachmentBaseCollectionRequest getAttachments() {
return new AttachmentBaseCollectionRequest(
contextPath.addSegment("attachments"), RequestHelper.getValue(unmappedFields, "attachments"));
}
/**
*
* Org.OData.Capabilities.V1.ChangeTracking
*
* Supported = false
*
* Org.OData.Capabilities.V1.ExpandRestrictions
*
* Expandable = false
*
* Org.OData.Capabilities.V1.InsertRestrictions
*
* Insertable = false
*
* Org.OData.Capabilities.V1.SearchRestrictions
*
* Searchable = false
*
* @return navigational property attachmentSessions
*/
@NavigationProperty(name="attachmentSessions")
@JsonIgnore
public AttachmentSessionCollectionRequest getAttachmentSessions() {
return new AttachmentSessionCollectionRequest(
contextPath.addSegment("attachmentSessions"), RequestHelper.getValue(unmappedFields, "attachmentSessions"));
}
@NavigationProperty(name="checklistItems")
@JsonIgnore
public ChecklistItemCollectionRequest getChecklistItems() {
return new ChecklistItemCollectionRequest(
contextPath.addSegment("checklistItems"), RequestHelper.getValue(unmappedFields, "checklistItems"));
}
@NavigationProperty(name="extensions")
@JsonIgnore
public ExtensionCollectionRequest getExtensions() {
return new ExtensionCollectionRequest(
contextPath.addSegment("extensions"), RequestHelper.getValue(unmappedFields, "extensions"));
}
@NavigationProperty(name="linkedResources")
@JsonIgnore
public LinkedResourceCollectionRequest getLinkedResources() {
return new LinkedResourceCollectionRequest(
contextPath.addSegment("linkedResources"), RequestHelper.getValue(unmappedFields, "linkedResources"));
}
@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 TodoTask patch() {
RequestHelper.patch(this, contextPath, RequestOptions.EMPTY);
TodoTask _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 TodoTask put() {
RequestHelper.put(this, contextPath, RequestOptions.EMPTY);
TodoTask _x = _copy();
_x.changedFields = null;
return _x;
}
private TodoTask _copy() {
TodoTask _x = new TodoTask();
_x.contextPath = contextPath;
_x.changedFields = changedFields;
_x.unmappedFields = unmappedFields.copy();
_x.odataType = odataType;
_x.id = id;
_x.body = body;
_x.bodyLastModifiedDateTime = bodyLastModifiedDateTime;
_x.categories = categories;
_x.completedDateTime = completedDateTime;
_x.createdDateTime = createdDateTime;
_x.dueDateTime = dueDateTime;
_x.hasAttachments = hasAttachments;
_x.importance = importance;
_x.isReminderOn = isReminderOn;
_x.lastModifiedDateTime = lastModifiedDateTime;
_x.recurrence = recurrence;
_x.reminderDateTime = reminderDateTime;
_x.startDateTime = startDateTime;
_x.status = status;
_x.title = title;
return _x;
}
@Override
public String toString() {
StringBuilder b = new StringBuilder();
b.append("TodoTask[");
b.append("id=");
b.append(this.id);
b.append(", ");
b.append("body=");
b.append(this.body);
b.append(", ");
b.append("bodyLastModifiedDateTime=");
b.append(this.bodyLastModifiedDateTime);
b.append(", ");
b.append("categories=");
b.append(this.categories);
b.append(", ");
b.append("completedDateTime=");
b.append(this.completedDateTime);
b.append(", ");
b.append("createdDateTime=");
b.append(this.createdDateTime);
b.append(", ");
b.append("dueDateTime=");
b.append(this.dueDateTime);
b.append(", ");
b.append("hasAttachments=");
b.append(this.hasAttachments);
b.append(", ");
b.append("importance=");
b.append(this.importance);
b.append(", ");
b.append("isReminderOn=");
b.append(this.isReminderOn);
b.append(", ");
b.append("lastModifiedDateTime=");
b.append(this.lastModifiedDateTime);
b.append(", ");
b.append("recurrence=");
b.append(this.recurrence);
b.append(", ");
b.append("reminderDateTime=");
b.append(this.reminderDateTime);
b.append(", ");
b.append("startDateTime=");
b.append(this.startDateTime);
b.append(", ");
b.append("status=");
b.append(this.status);
b.append(", ");
b.append("title=");
b.append(this.title);
b.append("]");
b.append(",unmappedFields=");
b.append(unmappedFields);
b.append(",odataType=");
b.append(odataType);
return b.toString();
}
}