IInventoryServices.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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.Collections.Generic;
  28. using OpenMetaverse;
  29. using OpenSim.Framework.Communications.Cache;
  30. namespace OpenSim.Framework.Communications
  31. {
  32. /// <summary>
  33. /// Callback used when a user's inventory is received from the inventory service
  34. /// </summary>
  35. public delegate void InventoryReceiptCallback(
  36. ICollection<InventoryFolderImpl> folders, ICollection<InventoryItemBase> items);
  37. /// <summary>
  38. /// Defines all the operations one can perform on a user's inventory.
  39. /// </summary>
  40. public interface IInventoryServices
  41. {
  42. string Host
  43. {
  44. get;
  45. }
  46. /// <summary>
  47. /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
  48. /// inventory has been received
  49. /// </summary>
  50. /// <param name="userID"></param>
  51. /// <param name="callback"></param>
  52. void RequestInventoryForUser(UUID userID, InventoryReceiptCallback callback);
  53. /// <summary>
  54. /// Add a new folder to the user's inventory
  55. /// </summary>
  56. /// <param name="folder"></param>
  57. /// <returns>true if the folder was successfully added</returns>
  58. bool AddFolder(InventoryFolderBase folder);
  59. /// <summary>
  60. /// Update a folder in the user's inventory
  61. /// </summary>
  62. /// <param name="folder"></param>
  63. /// <returns>true if the folder was successfully updated</returns>
  64. bool UpdateFolder(InventoryFolderBase folder);
  65. /// <summary>
  66. /// Move an inventory folder to a new location
  67. /// </summary>
  68. /// <param name="folder">A folder containing the details of the new location</param>
  69. /// <returns>true if the folder was successfully moved</returns>
  70. bool MoveFolder(InventoryFolderBase folder);
  71. /// <summary>
  72. /// Purge an inventory folder of all its items and subfolders.
  73. /// </summary>
  74. /// <param name="folder"></param>
  75. /// <returns>true if the folder was successfully purged</returns>
  76. bool PurgeFolder(InventoryFolderBase folder);
  77. /// <summary>
  78. /// Add a new item to the user's inventory
  79. /// </summary>
  80. /// <param name="item"></param>
  81. /// <returns>true if the item was successfully added</returns>
  82. bool AddItem(InventoryItemBase item);
  83. /// <summary>
  84. /// Update an item in the user's inventory
  85. /// </summary>
  86. /// <param name="item"></param>
  87. /// <returns>true if the item was successfully updated</returns>
  88. bool UpdateItem(InventoryItemBase item);
  89. /// <summary>
  90. /// Delete an item from the user's inventory
  91. /// </summary>
  92. /// <param name="item"></param>
  93. /// <returns>true if the item was successfully deleted</returns>
  94. bool DeleteItem(InventoryItemBase item);
  95. /// <summary>
  96. /// Query the server for an item that may have been added by
  97. /// another region
  98. /// </summary>
  99. /// <param name="item"></param>
  100. /// <returns>true if the item was found in local cache</returns>
  101. InventoryItemBase QueryItem(InventoryItemBase item);
  102. /// <summary>
  103. /// Query the server for a folder that may have been added by
  104. /// another region
  105. /// </summary>
  106. /// <param name="folder"></param>
  107. /// <returns>true if the folder was found in local cache</returns>
  108. InventoryFolderBase QueryFolder(InventoryFolderBase folder);
  109. /// <summary>
  110. /// Does the given user have an inventory structure?
  111. /// </summary>
  112. /// <param name="userID"></param>
  113. /// <returns></returns>
  114. bool HasInventoryForUser(UUID userID);
  115. /// <summary>
  116. /// Retrieve the root inventory folder for the given user.
  117. /// </summary>
  118. /// <param name="userID"></param>
  119. /// <returns>null if no root folder was found</returns>
  120. InventoryFolderBase RequestRootFolder(UUID userID);
  121. }
  122. }