/// <summary> /// Updates the related temporary ids. /// </summary> /// <param name="map">The map.</param> void IWithRelationsArgument.UpdateRelatedTempIds(IDictionary <Guid, long> map) { if (ProjectId.HasValue && map.TryGetValue(ProjectId.Value.TempId, out var persistentProjectId)) { ProjectId = new ComplexId(persistentProjectId); } }
/// <summary> /// Initializes a new instance of the <see cref="ReorderEntry" /> class. /// </summary> /// <param name="id">The identifier of moved entity.</param> /// <param name="childOrder">The new order.</param> /// <exception cref="T:System.ArgumentException">Entity ID is required for reorder operation</exception> public ReorderEntry(ComplexId id, int childOrder) { if (id.IsEmpty) { throw new ArgumentException("Entity ID is required for reorder operation", nameof(id)); } Id = id; ChildOrder = childOrder; }
/// <summary> /// Initializes a new instance of the <see cref="MoveArgument" /> class. /// </summary> /// <param name="id">The identifier of moved entity.</param> /// <param name="parentId">The parent entity identifier.</param> /// <exception cref="T:System.ArgumentException">Entity ID is required for the operation</exception> public MoveArgument(ComplexId id, ComplexId?parentId) : base(id) { if (id.IsEmpty) { throw new ArgumentException("Entity ID is required for the move operation", nameof(id)); } ParentId = parentId; }
/// <summary> /// Updates the related temporary ids. /// </summary> /// <param name="map">The map.</param> public void UpdateRelatedTempIds(IDictionary <Guid, int> map) { int persistentProjectId; if (ProjectId.HasValue && map.TryGetValue(ProjectId.Value.TempId, out persistentProjectId)) { ProjectId = new ComplexId(persistentProjectId); } int persistentItemId; if (ItemId.HasValue && map.TryGetValue(ItemId.Value.TempId, out persistentItemId)) { ItemId = new ComplexId(persistentItemId); } }
/// <summary> /// Initializes a new instance of the <see cref="MoveItemArgument"/> class. /// </summary> /// <param name="items">The items.</param> /// <param name="projectId">The project identifier.</param> /// <exception cref="ArgumentException">Unable to move an item with an empty project ID.</exception> public MoveItemArgument(IEnumerable <Item> items, ComplexId projectId) { ProjectItems = new Dictionary <ComplexId, ICollection <ComplexId> >(); foreach (var item in items) { if (!item.ProjectId.HasValue) { throw new ArgumentException("Unable to move item with an empty project ID.", nameof(items)); } ICollection <ComplexId> itemIds; if (!ProjectItems.TryGetValue(item.ProjectId.Value, out itemIds)) { itemIds = new LinkedList <ComplexId>(); ProjectItems.Add(item.ProjectId.Value, itemIds); } itemIds.Add(item.Id); } ToProject = projectId; }
/// <summary> /// Initializes a new instance of the <see cref="Item" /> class. /// </summary> /// <param name="content">The content.</param> /// <param name="projectId">The project identifier.</param> public Item(string content, ComplexId projectId) { Content = content; ProjectId = projectId; Labels = new Collection <long>(); }
/// <summary> /// Initializes a new instance of the <see cref="ShareProjectArgument"/> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="email">The email.</param> internal ShareProjectArgument(ComplexId id, string email) { Id = id; Email = email; }
internal BaseEntity(ComplexId id) { Id = id; }
/// <summary> /// Initializes a new instance of the <see cref="Section" /> class. /// </summary> /// <param name="name">The name.</param> /// <param name="projectId">The project identifier.</param> public Section(string name, ComplexId projectId) : this(name, projectId, 0) { }
/// <summary> /// Creates the move to project argument. /// </summary> /// <param name="itemId">The item identifier.</param> /// <param name="projectId">Id of the destination project. The task becomes the last root task of the project.</param> /// <returns>Instance of <see cref="ItemMoveArgument" /></returns> public static ItemMoveArgument CreateMoveToProject(ComplexId itemId, ComplexId projectId) { return(new ItemMoveArgument { Id = itemId, ProjectId = projectId }); }
/// <summary> /// Initializes a new instance of the <see cref="CompleteItemArgument" /> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="dateCompleted"> /// The date completed. If not set, the server will set the value to the current timestamp. /// </param> /// <param name="forceHistory"> /// The force history. When enabled the item is moved to history irregardless of whether it’s a /// sub-task or not (by default only root tasks are moved to history). /// </param> public CompleteItemArgument(ComplexId id, DateTime?dateCompleted = null, bool?forceHistory = null) { Id = id; DateCompleted = dateCompleted; ForceHistory = forceHistory; }
/// <summary> /// Initializes a new instance of the <see cref="RecurringItemState"/> class. /// </summary> /// <param name="id">The identifier.</param> public RecurringItemState(ComplexId id) { Id = id; }
/// <summary> /// Initializes a new instance of the <see cref="SectionOrderEntry" /> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="order">The order.</param> public SectionOrderEntry(ComplexId id, int order) { Id = id; Order = order; }
/// <summary> /// Initializes a new instance of the <see cref="CompleteRecurringItemArgument" /> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="dueDate">The due date.</param> public CompleteRecurringItemArgument(ComplexId id, DueDate dueDate = null) { DueDate = dueDate; Id = id; }
/// <summary> /// Initializes a new instance of the <see cref="Reminder" /> class. /// </summary> /// <param name="itemId">An ID of a task.</param> public Reminder(ComplexId itemId) { ItemId = itemId; }
/// <summary> /// Creates the move to project argument. /// </summary> /// <param name="itemId">The item identifier.</param> /// <param name="parentItemId">Id of the destination parent task. The task becomes the last child task of the parent task.</param> /// <returns> /// Instance of <see cref="ItemMoveArgument" /> /// </returns> public static ItemMoveArgument CreateMoveToParent(ComplexId itemId, ComplexId parentItemId) { return(new ItemMoveArgument { Id = itemId, ParentId = parentItemId }); }
/// <summary> /// Initializes a new instance of the <see cref="Section" /> class. /// </summary> /// <param name="name">The name.</param> /// <param name="projectId">The project identifier.</param> /// <param name="sectionOrder">The section order.</param> public Section(string name, ComplexId projectId, int sectionOrder) { Name = name; ProjectId = projectId; SectionOrder = sectionOrder; }
/// <summary> /// Creates the move to project argument. /// </summary> /// <param name="itemId">The item identifier.</param> /// <param name="sectionId">Id of the destination section. The task becomes the last root task of the section.</param> /// <returns>Instance of <see cref="ItemMoveArgument" /></returns> public static ItemMoveArgument CreateMoveToSection(ComplexId itemId, ComplexId sectionId) { return(new ItemMoveArgument { Id = itemId, SectionId = sectionId }); }
/// <summary> /// Initializes a new instance of the <see cref="ShareProjectArgument"/> class. /// </summary> /// <param name="id">The identifier.</param> /// <param name="email">The email.</param> internal ShareProjectArgument(ComplexId id, string email) : base(id) { Email = email; }