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