1
0

IInventoryService.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. InventoryCollection GetUserInventory(UUID userID);
  58. /// <summary>
  59. /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
  60. /// inventory has been received
  61. /// </summary>
  62. /// <param name="userID"></param>
  63. /// <param name="callback"></param>
  64. void GetUserInventory(UUID userID, InventoryReceiptCallback callback);
  65. /// <summary>
  66. /// Gets the items inside a folder
  67. /// </summary>
  68. /// <param name="userID"></param>
  69. /// <param name="folderID"></param>
  70. /// <returns></returns>
  71. List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID);
  72. /// <summary>
  73. /// Add a new folder to the user's inventory
  74. /// </summary>
  75. /// <param name="folder"></param>
  76. /// <returns>true if the folder was successfully added</returns>
  77. bool AddFolder(InventoryFolderBase folder);
  78. /// <summary>
  79. /// Update a folder in the user's inventory
  80. /// </summary>
  81. /// <param name="folder"></param>
  82. /// <returns>true if the folder was successfully updated</returns>
  83. bool UpdateFolder(InventoryFolderBase folder);
  84. /// <summary>
  85. /// Move an inventory folder to a new location
  86. /// </summary>
  87. /// <param name="folder">A folder containing the details of the new location</param>
  88. /// <returns>true if the folder was successfully moved</returns>
  89. bool MoveFolder(InventoryFolderBase folder);
  90. /// <summary>
  91. /// Purge an inventory folder of all its items and subfolders.
  92. /// </summary>
  93. /// <param name="folder"></param>
  94. /// <returns>true if the folder was successfully purged</returns>
  95. bool PurgeFolder(InventoryFolderBase folder);
  96. /// <summary>
  97. /// Add a new item to the user's inventory
  98. /// </summary>
  99. /// <param name="item"></param>
  100. /// <returns>true if the item was successfully added</returns>
  101. bool AddItem(InventoryItemBase item);
  102. /// <summary>
  103. /// Update an item in the user's inventory
  104. /// </summary>
  105. /// <param name="item"></param>
  106. /// <returns>true if the item was successfully updated</returns>
  107. bool UpdateItem(InventoryItemBase item);
  108. /// <summary>
  109. /// Delete an item from the user's inventory
  110. /// </summary>
  111. /// <param name="item"></param>
  112. /// <returns>true if the item was successfully deleted</returns>
  113. bool DeleteItem(InventoryItemBase item);
  114. InventoryItemBase QueryItem(InventoryItemBase item);
  115. InventoryFolderBase QueryFolder(InventoryFolderBase folder);
  116. /// <summary>
  117. /// Does the given user have an inventory structure?
  118. /// </summary>
  119. /// <param name="userID"></param>
  120. /// <returns></returns>
  121. bool HasInventoryForUser(UUID userID);
  122. /// <summary>
  123. /// Retrieve the root inventory folder for the given user.
  124. /// </summary>
  125. /// <param name="userID"></param>
  126. /// <returns>null if no root folder was found</returns>
  127. InventoryFolderBase RequestRootFolder(UUID userID);
  128. /// <summary>
  129. /// Get the active gestures of the agent.
  130. /// </summary>
  131. /// <param name="userId"></param>
  132. /// <returns></returns>
  133. List<InventoryItemBase> GetActiveGestures(UUID userId);
  134. }
  135. }