IHistoryModel.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. using System;
  2. using System.Collections.Generic;
  3. using JetBrains.Annotations;
  4. using Unity.Cloud.Collaborate.Models.Structures;
  5. namespace Unity.Cloud.Collaborate.Models
  6. {
  7. internal interface IHistoryModel : IModel
  8. {
  9. /// <summary>
  10. /// Event triggered when the history list has been updated.
  11. /// </summary>
  12. event Action HistoryListUpdated;
  13. /// <summary>
  14. /// Event triggered when the requested page of revisions is received.
  15. /// </summary>
  16. event Action<IReadOnlyList<IHistoryEntry>> HistoryListReceived;
  17. /// <summary>
  18. /// Event triggered when the requested revision is received.
  19. /// </summary>
  20. event Action<IHistoryEntry> SelectedRevisionReceived;
  21. /// <summary>
  22. /// Event triggered when the busy status changes.
  23. /// </summary>
  24. event Action<bool> BusyStatusUpdated;
  25. /// <summary>
  26. /// Event triggered when the requested entry count is received.
  27. /// </summary>
  28. event Action<int?> EntryCountUpdated;
  29. /// <summary>
  30. /// Whether or not the model is busy with a request.
  31. /// </summary>
  32. bool Busy { get; }
  33. /// <summary>
  34. /// Current page number.
  35. /// </summary>
  36. int PageNumber { get; set; }
  37. /// <summary>
  38. /// Currently selected revision id.
  39. /// </summary>
  40. [NotNull]
  41. string SelectedRevisionId { get; }
  42. /// <summary>
  43. /// Revision saved before domain reload.
  44. /// </summary>
  45. [NotNull]
  46. string SavedRevisionId { get; }
  47. /// <summary>
  48. /// True if a revision is currently selected.
  49. /// </summary>
  50. bool IsRevisionSelected { get; }
  51. /// <summary>
  52. /// Request the current page of given size. Result returns via the HistoryListReceived event.
  53. /// </summary>
  54. /// <param name="pageSize"></param>
  55. void RequestPageOfRevisions(int pageSize);
  56. /// <summary>
  57. /// Request the revision with the given id. Result returned via the SelectedRevisionReceived event.
  58. /// </summary>
  59. /// <param name="revisionId"></param>
  60. void RequestSingleRevision([NotNull] string revisionId);
  61. /// <summary>
  62. /// Request the count of entries. Result returned via the EntryCountUpdated event.
  63. /// </summary>
  64. void RequestEntryNumber();
  65. /// <summary>
  66. /// Request to update the state of the project to a new provided revision.
  67. /// </summary>
  68. /// <param name="revisionId">New revision id of the project to go to.</param>
  69. void RequestUpdateTo([NotNull] string revisionId);
  70. /// <summary>
  71. /// Request to take the state of the project back to the given (and current) revision.
  72. /// </summary>
  73. /// <param name="revisionId">Current revision id of the project to go back to.</param>
  74. void RequestRestoreTo([NotNull] string revisionId);
  75. /// <summary>
  76. /// Request to take the state of the project back to the given revision, but do not change the current revision or history.
  77. /// </summary>
  78. /// <param name="revisionId">Revision id to go back to.</param>
  79. void RequestGoBackTo([NotNull] string revisionId);
  80. /// <summary>
  81. /// Returns true if revert is supported.
  82. /// </summary>
  83. bool SupportsRevert { get; }
  84. /// <summary>
  85. /// Request to revert the specified files to the given revision.
  86. /// </summary>
  87. /// <param name="revisionId">Revision to revert the files back to.</param>
  88. /// <param name="files">Files to revert back.</param>
  89. void RequestRevert([NotNull] string revisionId, [NotNull] IReadOnlyList<string> files);
  90. }
  91. }