IInventoryServices.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 OpenSim 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 libsecondlife;
  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(LLUUID userId, ICollection<InventoryFolderImpl> folders, ICollection<InventoryItemBase> items);
  36. /// <summary>
  37. /// Defines all the operations one can perform on a user's inventory.
  38. /// </summary>
  39. public interface IInventoryServices
  40. {
  41. /// <summary>
  42. /// Request the inventory for a user. This is an asynchronous operation that will call the callback when the
  43. /// inventory has been received
  44. /// </summary>
  45. /// <param name="userID"></param>
  46. /// <param name="callback"></param>
  47. void RequestInventoryForUser(LLUUID userID, InventoryReceiptCallback callback);
  48. /// <summary>
  49. /// Add a new folder to the given user's inventory
  50. /// </summary>
  51. /// <param name="userID"></param>
  52. /// <param name="folder"></param>
  53. void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder);
  54. /// <summary>
  55. /// Move an inventory folder to a new location
  56. /// </summary>
  57. /// <param name="userID"></param>
  58. /// <param name="folder">A folder containing the details of the new location</param>
  59. void MoveInventoryFolder(LLUUID userID, InventoryFolderBase folder);
  60. /// <summary>
  61. /// Purge an inventory folder of all its items and subfolders.
  62. /// </summary>
  63. /// <param name="userID"></param>
  64. /// <param name="folder"></param>
  65. void PurgeInventoryFolder(LLUUID userID, InventoryFolderBase folder);
  66. /// <summary>
  67. /// Add a new item to the given user's inventory
  68. /// </summary>
  69. /// <param name="userID"></param>
  70. /// <param name="item"></param>
  71. void AddNewInventoryItem(LLUUID userID, InventoryItemBase item);
  72. /// <summary>
  73. /// Update an item in the given user's inventory
  74. /// </summary>
  75. /// <param name="userID"></param>
  76. /// <param name="item"></param>
  77. void UpdateInventoryItem(LLUUID userID, InventoryItemBase item);
  78. /// <summary>
  79. /// Delete an item from the given user's inventory
  80. /// </summary>
  81. /// <param name="userID"></param>
  82. /// <param name="item"></param>
  83. void DeleteInventoryItem(LLUUID userID, InventoryItemBase item);
  84. /// <summary>
  85. /// Create a new inventory for the given user.
  86. /// </summary>
  87. /// <param name="user"></param>
  88. /// <returns>true if the inventory was successfully created, false otherwise</returns>
  89. bool CreateNewUserInventory(LLUUID user);
  90. bool HasInventoryForUser(LLUUID userID);
  91. /// <summary>
  92. /// Retrieve the root inventory folder for the given user.
  93. /// </summary>
  94. /// <param name="userID"></param>
  95. /// <returns>null if no root folder was found</returns>
  96. InventoryFolderBase RequestRootFolder(LLUUID userID);
  97. /// <summary>
  98. /// Returns a list of all the folders in a given user's inventory.
  99. /// </summary>
  100. /// <param name="userId"></param>
  101. /// <returns>A flat list of the user's inventory folder tree,
  102. /// null if there is no inventory for this user</returns>
  103. List<InventoryFolderBase> GetInventorySkeleton(LLUUID userId);
  104. }
  105. }