@discomedia/utils 1.0.30 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -269,7 +269,7 @@ const safeJSON = (text) => {
269
269
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
270
270
  const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
271
271
 
272
- const VERSION = '5.12.2'; // x-release-please-version
272
+ const VERSION = '5.16.0'; // x-release-please-version
273
273
 
274
274
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
275
275
  const isRunningInBrowser = () => {
@@ -1609,6 +1609,36 @@ class CursorPage extends AbstractPage {
1609
1609
  };
1610
1610
  }
1611
1611
  }
1612
+ class ConversationCursorPage extends AbstractPage {
1613
+ constructor(client, response, body, options) {
1614
+ super(client, response, body, options);
1615
+ this.data = body.data || [];
1616
+ this.has_more = body.has_more || false;
1617
+ this.last_id = body.last_id || '';
1618
+ }
1619
+ getPaginatedItems() {
1620
+ return this.data ?? [];
1621
+ }
1622
+ hasNextPage() {
1623
+ if (this.has_more === false) {
1624
+ return false;
1625
+ }
1626
+ return super.hasNextPage();
1627
+ }
1628
+ nextPageRequestOptions() {
1629
+ const cursor = this.last_id;
1630
+ if (!cursor) {
1631
+ return null;
1632
+ }
1633
+ return {
1634
+ ...this.options,
1635
+ query: {
1636
+ ...maybeObj(this.options.query),
1637
+ after: cursor,
1638
+ },
1639
+ };
1640
+ }
1641
+ }
1612
1642
 
1613
1643
  const checkFileSupport = () => {
1614
1644
  if (typeof File === 'undefined') {
@@ -4699,6 +4729,74 @@ class Containers extends APIResource {
4699
4729
  }
4700
4730
  Containers.Files = Files$2;
4701
4731
 
4732
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4733
+ class Items extends APIResource {
4734
+ /**
4735
+ * Create items in a conversation with the given ID.
4736
+ */
4737
+ create(conversationID, params, options) {
4738
+ const { include, ...body } = params;
4739
+ return this._client.post(path `/conversations/${conversationID}/items`, {
4740
+ query: { include },
4741
+ body,
4742
+ ...options,
4743
+ });
4744
+ }
4745
+ /**
4746
+ * Get a single item from a conversation with the given IDs.
4747
+ */
4748
+ retrieve(itemID, params, options) {
4749
+ const { conversation_id, ...query } = params;
4750
+ return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, { query, ...options });
4751
+ }
4752
+ /**
4753
+ * List all items for a conversation with the given ID.
4754
+ */
4755
+ list(conversationID, query = {}, options) {
4756
+ return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options });
4757
+ }
4758
+ /**
4759
+ * Delete an item from a conversation with the given IDs.
4760
+ */
4761
+ delete(itemID, params, options) {
4762
+ const { conversation_id } = params;
4763
+ return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`, options);
4764
+ }
4765
+ }
4766
+
4767
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4768
+ class Conversations extends APIResource {
4769
+ constructor() {
4770
+ super(...arguments);
4771
+ this.items = new Items(this._client);
4772
+ }
4773
+ /**
4774
+ * Create a conversation.
4775
+ */
4776
+ create(body, options) {
4777
+ return this._client.post('/conversations', { body, ...options });
4778
+ }
4779
+ /**
4780
+ * Get a conversation with the given ID.
4781
+ */
4782
+ retrieve(conversationID, options) {
4783
+ return this._client.get(path `/conversations/${conversationID}`, options);
4784
+ }
4785
+ /**
4786
+ * Update a conversation's metadata with the given ID.
4787
+ */
4788
+ update(conversationID, body, options) {
4789
+ return this._client.post(path `/conversations/${conversationID}`, { body, ...options });
4790
+ }
4791
+ /**
4792
+ * Delete a conversation with the given ID.
4793
+ */
4794
+ delete(conversationID, options) {
4795
+ return this._client.delete(path `/conversations/${conversationID}`, options);
4796
+ }
4797
+ }
4798
+ Conversations.Items = Items;
4799
+
4702
4800
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
4703
4801
  class Embeddings extends APIResource {
4704
4802
  /**
@@ -4863,7 +4961,7 @@ let Files$1 = class Files extends APIResource {
4863
4961
  /**
4864
4962
  * Upload a file that can be used across various endpoints. Individual files can be
4865
4963
  * up to 512 MB, and the size of all files uploaded by one organization can be up
4866
- * to 100 GB.
4964
+ * to 1 TB.
4867
4965
  *
4868
4966
  * The Assistants API supports files up to 2 million tokens and of specific file
4869
4967
  * types. See the
@@ -6292,6 +6390,7 @@ class OpenAI {
6292
6390
  this.batches = new Batches(this);
6293
6391
  this.uploads = new Uploads(this);
6294
6392
  this.responses = new Responses(this);
6393
+ this.conversations = new Conversations(this);
6295
6394
  this.evals = new Evals(this);
6296
6395
  this.containers = new Containers(this);
6297
6396
  if (apiKey === undefined) {
@@ -6682,7 +6781,7 @@ class OpenAI {
6682
6781
  // Preserve legacy string encoding behavior for now
6683
6782
  headers.values.has('content-type')) ||
6684
6783
  // `Blob` is superset of `File`
6685
- body instanceof Blob ||
6784
+ (globalThis.Blob && body instanceof globalThis.Blob) ||
6686
6785
  // `FormData` -> `multipart/form-data`
6687
6786
  body instanceof FormData ||
6688
6787
  // `URLSearchParams` -> `application/x-www-form-urlencoded`
@@ -6737,6 +6836,7 @@ OpenAI.Beta = Beta;
6737
6836
  OpenAI.Batches = Batches;
6738
6837
  OpenAI.Uploads = Uploads;
6739
6838
  OpenAI.Responses = Responses;
6839
+ OpenAI.Conversations = Conversations;
6740
6840
  OpenAI.Evals = Evals;
6741
6841
  OpenAI.Containers = Containers;
6742
6842