IInventoryService.cs 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using OpenSim.Framework;
  30. using OpenMetaverse;
  31. namespace OpenSim.Services.Interfaces
  32. {
  33. /// <summary>
  34. /// Callback used when a user's inventory is received from the inventory service
  35. /// </summary>
  36. public delegate void InventoryReceiptCallback(
  37. ICollection<InventoryFolderImpl> folders, ICollection<InventoryItemBase> items);
  38. public interface IInventoryService
  39. {
  40. /// <summary>
  41. /// Create the entire inventory for a given user
  42. /// </summary>
  43. /// <param name="user"></param>
  44. /// <returns></returns>
  45. bool CreateUserInventory(UUID user);
  46. /// <summary>
  47. /// Gets the skeleton of the inventory -- folders only
  48. /// </summary>
  49. /// <param name="userId"></param>
  50. /// <returns></returns>
  51. List<InventoryFolderBase> GetInventorySkeleton(UUID userId);
  52. /// <summary>
  53. /// Synchronous inventory fetch.
  54. /// </summary>
  55. /// <param name="userID"></param>
  56. /// <returns></returns>
  57. [Obsolete]
  58. InventoryCollection GetUserInventory(UUID userID);
  59. /// <summary>
  60. /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
  61. /// inventory has been received
  62. /// </summary>
  63. /// <param name="userID"></param>
  64. /// <param name="callback"></param>
  65. [Obsolete]
  66. void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
  67. /// <summary>
  68. /// Retrieve the root inventory folder for the given user.
  69. /// </summary>
  70. /// <param name="userID"></param>
  71. /// <returns>null if no root folder was found</returns>
  72. InventoryFolderBase GetRootFolder(UUID userID);
  73. /// <summary>
  74. /// Gets the user folder for the given folder-type
  75. /// </summary>
  76. /// <param name="userID"></param>
  77. /// <param name="type"></param>
  78. /// <returns></returns>
  79. InventoryFolderBase GetFolderForType(UUID userID, AssetType type);
  80. /// <summary>
  81. /// Gets everything (folders and items) inside a folder
  82. /// </summary>
  83. /// <param name="userId"></param>
  84. /// <param name="folderID"></param>
  85. /// <returns></returns>
  86. InventoryCollection GetFolderContent(UUID userID, UUID folderID);
  87. /// <summary>
  88. /// Gets the items inside a folder
  89. /// </summary>
  90. /// <param name="userID"></param>
  91. /// <param name="folderID"></param>
  92. /// <returns></returns>
  93. List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID);
  94. /// <summary>
  95. /// Add a new folder to the user's inventory
  96. /// </summary>
  97. /// <param name="folder"></param>
  98. /// <returns>true if the folder was successfully added</returns>
  99. bool AddFolder(InventoryFolderBase folder);
  100. /// <summary>
  101. /// Update a folder in the user's inventory
  102. /// </summary>
  103. /// <param name="folder"></param>
  104. /// <returns>true if the folder was successfully updated</returns>
  105. bool UpdateFolder(InventoryFolderBase folder);
  106. /// <summary>
  107. /// Move an inventory folder to a new location
  108. /// </summary>
  109. /// <param name="folder">A folder containing the details of the new location</param>
  110. /// <returns>true if the folder was successfully moved</returns>
  111. bool MoveFolder(InventoryFolderBase folder);
  112. /// <summary>
  113. /// Delete an item from the user's inventory
  114. /// </summary>
  115. /// <param name="item"></param>
  116. /// <returns>true if the item was successfully deleted</returns>
  117. //bool DeleteItem(InventoryItemBase item);
  118. bool DeleteFolders(UUID userID, List<UUID> folderIDs);
  119. /// <summary>
  120. /// Purge an inventory folder of all its items and subfolders.
  121. /// </summary>
  122. /// <param name="folder"></param>
  123. /// <returns>true if the folder was successfully purged</returns>
  124. bool PurgeFolder(InventoryFolderBase folder);
  125. /// <summary>
  126. /// Add a new item to the user's inventory
  127. /// </summary>
  128. /// <param name="item"></param>
  129. /// <returns>true if the item was successfully added</returns>
  130. bool AddItem(InventoryItemBase item);
  131. /// <summary>
  132. /// Update an item in the user's inventory
  133. /// </summary>
  134. /// <param name="item"></param>
  135. /// <returns>true if the item was successfully updated</returns>
  136. bool UpdateItem(InventoryItemBase item);
  137. bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
  138. /// <summary>
  139. /// Delete an item from the user's inventory
  140. /// </summary>
  141. /// <param name="item"></param>
  142. /// <returns>true if the item was successfully deleted</returns>
  143. //bool DeleteItem(InventoryItemBase item);
  144. bool DeleteItems(UUID userID, List<UUID> itemIDs);
  145. /// <summary>
  146. /// Get an item, given by its UUID
  147. /// </summary>
  148. /// <param name="item"></param>
  149. /// <returns></returns>
  150. InventoryItemBase GetItem(InventoryItemBase item);
  151. /// <summary>
  152. /// Get a folder, given by its UUID
  153. /// </summary>
  154. /// <param name="folder"></param>
  155. /// <returns></returns>
  156. InventoryFolderBase GetFolder(InventoryFolderBase folder);
  157. /// <summary>
  158. /// Does the given user have an inventory structure?
  159. /// </summary>
  160. /// <param name="userID"></param>
  161. /// <returns></returns>
  162. bool HasInventoryForUser(UUID userID);
  163. /// <summary>
  164. /// Get the active gestures of the agent.
  165. /// </summary>
  166. /// <param name="userId"></param>
  167. /// <returns></returns>
  168. List<InventoryItemBase> GetActiveGestures(UUID userId);
  169. /// <summary>
  170. /// Get the union of permissions of all inventory items
  171. /// that hold the given assetID.
  172. /// </summary>
  173. /// <param name="userID"></param>
  174. /// <param name="assetID"></param>
  175. /// <returns>The permissions or 0 if no such asset is found in
  176. /// the user's inventory</returns>
  177. int GetAssetPermissions(UUID userID, UUID assetID);
  178. }
  179. }