IChangesModel.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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 IChangesModel : IModel
  8. {
  9. /// <summary>
  10. /// Event triggered when an updated change list is available.
  11. /// </summary>
  12. event Action UpdatedChangeList;
  13. /// <summary>
  14. /// Event triggered when an updated selection of change list is available.
  15. /// </summary>
  16. event Action OnUpdatedSelectedChanges;
  17. /// <summary>
  18. /// Event triggered when the busy status changes.
  19. /// </summary>
  20. event Action<bool> BusyStatusUpdated;
  21. /// <summary>
  22. /// Stored revision summary.
  23. /// </summary>
  24. [NotNull]
  25. string SavedRevisionSummary { get; set; }
  26. /// <summary>
  27. /// Stored search query.
  28. /// </summary>
  29. [NotNull]
  30. string SavedSearchQuery { get; set; }
  31. /// <summary>
  32. /// Number of toggled entries.
  33. /// </summary>
  34. int ToggledCount { get; }
  35. /// <summary>
  36. /// Total number of entries.
  37. /// </summary>
  38. int TotalCount { get; }
  39. /// <summary>
  40. /// Number of conflicted entries.
  41. /// </summary>
  42. int ConflictedCount { get; }
  43. /// <summary>
  44. /// Whether or not conflicts exist.
  45. /// </summary>
  46. bool Conflicted { get; }
  47. /// <summary>
  48. /// Whether or not the model is busy with a request.
  49. /// </summary>
  50. bool Busy { get; }
  51. /// <summary>
  52. /// Request initial data to populate the change list.
  53. /// </summary>
  54. void RequestInitialData();
  55. /// <summary>
  56. /// Set the value of the toggle for the given path.
  57. /// </summary>
  58. /// <param name="path">Path to modify the toggle for.</param>
  59. /// <param name="toggled">Value to set the toggle to.</param>
  60. /// <returns>True if more than one entry has had its value change.</returns>
  61. bool UpdateEntryToggle([NotNull] string path, bool toggled);
  62. /// <summary>
  63. /// Get the list of toggled entries. Can be long running in the case of a large change list.
  64. /// </summary>
  65. /// <param name="query">Query to filter the entries via.</param>
  66. /// <returns>The filtered toggled list.</returns>
  67. [NotNull]
  68. IReadOnlyList<IChangeEntryData> GetToggledEntries([CanBeNull] string query = null);
  69. /// <summary>
  70. /// Get the list of untoggled entries. Can be long running in the case of a large change list.
  71. /// </summary>
  72. /// <param name="query">Query to filter the entries via.</param>
  73. /// <returns>The filtered untoggled list.</returns>
  74. [NotNull]
  75. IReadOnlyList<IChangeEntryData> GetUntoggledEntries([CanBeNull] string query = null);
  76. /// <summary>
  77. /// Get full list of changes. Can be long running in the case of a large change list.
  78. /// </summary>
  79. /// <param name="query">Query to filter the changes with</param>
  80. /// <returns>The filtered change list.</returns>
  81. [NotNull]
  82. IReadOnlyList<IChangeEntryData> GetAllEntries([CanBeNull] string query = null);
  83. /// <summary>
  84. /// Get the list of conflicted entries. Can be long running in the case of a large change list.
  85. /// </summary>
  86. /// <param name="query">Query to filter the entries via.</param>
  87. /// <returns>The filtered conflicted list.</returns>
  88. [NotNull]
  89. IReadOnlyList<IChangeEntryData> GetConflictedEntries([CanBeNull] string query = null);
  90. /// <summary>
  91. /// Request diff of the file at the given path.
  92. /// </summary>
  93. /// <param name="path">Path to file to diff.</param>
  94. void RequestDiffChanges([NotNull] string path);
  95. /// <summary>
  96. /// Request discard of the file at the given path.
  97. /// </summary>
  98. /// <param name="entry">Entry to discard.</param>
  99. void RequestDiscard([NotNull] IChangeEntry entry);
  100. /// <summary>
  101. /// Request discard of the given list of files.
  102. /// </summary>
  103. /// <param name="entries">List of entries to discard.</param>
  104. void RequestBulkDiscard([NotNull] IReadOnlyList<IChangeEntry> entries);
  105. /// <summary>
  106. /// Request publish with the given message and list of files.
  107. /// </summary>
  108. /// <param name="message">Message for the revision.</param>
  109. /// <param name="changes">Changes to publish.</param>
  110. void RequestPublish([NotNull] string message, [NotNull] IReadOnlyList<IChangeEntry> changes);
  111. /// <summary>
  112. /// Show the difference between both version of a conflicted file.
  113. /// </summary>
  114. /// <param name="path">Path of the file to show.</param>
  115. void RequestShowConflictedDifferences([NotNull] string path);
  116. /// <summary>
  117. /// Request to choose merge for the provided conflict.
  118. /// </summary>
  119. /// <param name="path">Path of the file to choose merge for.</param>
  120. void RequestChooseMerge([NotNull] string path);
  121. /// <summary>
  122. /// Request to choose mine for the provided conflict.
  123. /// </summary>
  124. /// <param name="paths">Paths of the files to choose mine for.</param>
  125. void RequestChooseMine([NotNull] string[] paths);
  126. /// <summary>
  127. /// Request to choose remote for the provided conflict.
  128. /// </summary>
  129. /// <param name="paths">Paths of the files to choose remote for.</param>
  130. void RequestChooseRemote([NotNull] string[] paths);
  131. }
  132. }