items.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.Items = void 0;
  5. const resource_1 = require("../../core/resource.js");
  6. const pagination_1 = require("../../core/pagination.js");
  7. const path_1 = require("../../internal/utils/path.js");
  8. class Items extends resource_1.APIResource {
  9. /**
  10. * Create items in a conversation with the given ID.
  11. */
  12. create(conversationID, params, options) {
  13. const { include, ...body } = params;
  14. return this._client.post((0, path_1.path) `/conversations/${conversationID}/items`, {
  15. query: { include },
  16. body,
  17. ...options,
  18. });
  19. }
  20. /**
  21. * Get a single item from a conversation with the given IDs.
  22. */
  23. retrieve(itemID, params, options) {
  24. const { conversation_id, ...query } = params;
  25. return this._client.get((0, path_1.path) `/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
  26. }
  27. /**
  28. * List all items for a conversation with the given ID.
  29. */
  30. list(conversationID, query = {}, options) {
  31. return this._client.getAPIList((0, path_1.path) `/conversations/${conversationID}/items`, (pagination_1.ConversationCursorPage), { query, ...options });
  32. }
  33. /**
  34. * Delete an item from a conversation with the given IDs.
  35. */
  36. delete(itemID, params, options) {
  37. const { conversation_id } = params;
  38. return this._client.delete((0, path_1.path) `/conversations/${conversation_id}/items/${itemID}`, options);
  39. }
  40. }
  41. exports.Items = Items;
  42. //# sourceMappingURL=items.js.map