From 9d50dfc7b638295f9af0a11869fd47f4f319c4e5 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 15 Aug 2024 14:48:40 +0000
Subject: [PATCH 01/11] chore(internal): codegen related update (#33)
---
.github/workflows/release-doctor.yml | 1 +
bin/check-release-environment | 1 +
package.json | 2 +-
scripts/format | 2 +-
scripts/lint | 2 +-
scripts/mock | 4 ++--
6 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index 1e6c440..7ed8833 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -19,3 +19,4 @@ jobs:
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.HONCHO_NPM_TOKEN || secrets.NPM_TOKEN }}
+
diff --git a/bin/check-release-environment b/bin/check-release-environment
index 652f4f6..8330585 100644
--- a/bin/check-release-environment
+++ b/bin/check-release-environment
@@ -19,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then
fi
echo "The environment is ready to push releases!"
+
diff --git a/package.json b/package.json
index ab0d088..6fe86bc 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,7 @@
"prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi",
"tsn": "ts-node -r tsconfig-paths/register",
"lint": "./scripts/lint",
- "fix": "eslint --fix --ext ts,js ."
+ "fix": "./scripts/format"
},
"dependencies": {
"@types/node": "^18.11.18",
diff --git a/scripts/format b/scripts/format
index d297e76..a6bb9d0 100755
--- a/scripts/format
+++ b/scripts/format
@@ -5,4 +5,4 @@ set -e
cd "$(dirname "$0")/.."
echo "==> Running eslint --fix"
-./node_modules/.bin/eslint --fix --ext ts,js .
+ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js .
diff --git a/scripts/lint b/scripts/lint
index 6b0e5dc..4af1de0 100755
--- a/scripts/lint
+++ b/scripts/lint
@@ -5,4 +5,4 @@ set -e
cd "$(dirname "$0")/.."
echo "==> Running eslint"
-./node_modules/.bin/eslint --ext ts,js .
+ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js .
diff --git a/scripts/mock b/scripts/mock
index f586157..d2814ae 100755
--- a/scripts/mock
+++ b/scripts/mock
@@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
- npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL" &> .prism.log &
+ npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
# Wait for server to come online
echo -n "Waiting for server"
@@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then
echo
else
- npm exec --package=@stainless-api/prism-cli@5.8.4 -- prism mock "$URL"
+ npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
fi
From 0fe4e34b9adb0c6aefb97a7f86255f17ef07a605 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sun, 15 Sep 2024 02:50:29 +0000
Subject: [PATCH 02/11] feat(api): update via SDK Studio (#35)
---
.stats.yml | 2 +-
api.md | 6 ++---
.../apps/users/collections/collections.ts | 2 +-
.../apps/users/sessions/metamessages.ts | 7 +++---
src/resources/apps/users/sessions/sessions.ts | 22 +++++++++++--------
.../apps/users/sessions/sessions.test.ts | 8 +++----
6 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index 4bb711f..6d65821 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 38
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-9b368f4c227f4695fb1b16d44996ca0dcaab52c7ee1433491ce2989fee846115.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-522b2d21f11fa12f9f9bdc701a5c4ed2c2ee5ceee9d630d0c38fe5495aeae734.yml
diff --git a/api.md b/api.md
index 9f33ff1..7b6cfe3 100644
--- a/api.md
+++ b/api.md
@@ -44,9 +44,9 @@ Methods:
- client.apps.users.sessions.update(appId, userId, sessionId, { ...params }) -> Session
- client.apps.users.sessions.list(appId, userId, { ...params }) -> SessionsPage
- client.apps.users.sessions.delete(appId, userId, sessionId) -> unknown
-- client.apps.users.sessions.chat(appId, userId, sessionId, { ...params }) -> AgentChat
+- client.apps.users.sessions.chat(appId, userId, sessionId, { ...params }) -> AgentChat
- client.apps.users.sessions.get(appId, userId, sessionId) -> Session
-- client.apps.users.sessions.stream(appId, userId, sessionId, { ...params }) -> unknown
+- client.apps.users.sessions.stream(appId, userId, sessionId, { ...params }) -> unknown
#### Messages
@@ -93,7 +93,7 @@ Methods:
- client.apps.users.collections.delete(appId, userId, collectionId) -> unknown
- client.apps.users.collections.get(appId, userId, collectionId) -> Collection
- client.apps.users.collections.getByName(appId, userId, name) -> Collection
-- client.apps.users.collections.query(appId, userId, collectionId, { ...params }) -> CollectionQueryResponse
+- client.apps.users.collections.query(appId, userId, collectionId, { ...params }) -> CollectionQueryResponse
#### Documents
diff --git a/src/resources/apps/users/collections/collections.ts b/src/resources/apps/users/collections/collections.ts
index 35f1e3b..e896fc6 100644
--- a/src/resources/apps/users/collections/collections.ts
+++ b/src/resources/apps/users/collections/collections.ts
@@ -119,7 +119,7 @@ export class Collections extends APIResource {
query: CollectionQueryParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/collections/${collectionId}/query`, {
+ return this._client.get(`/apps/${appId}/users/${userId}/collections/${collectionId}/documents/query`, {
query,
...options,
});
diff --git a/src/resources/apps/users/sessions/metamessages.ts b/src/resources/apps/users/sessions/metamessages.ts
index 156dd4e..bc9fdbf 100644
--- a/src/resources/apps/users/sessions/metamessages.ts
+++ b/src/resources/apps/users/sessions/metamessages.ts
@@ -8,13 +8,12 @@ import { Page, type PageParams } from '../../../../pagination';
export class Metamessages extends APIResource {
/**
- * Adds a metamessage to a session
+ * Adds a message to a session
*
* Args: app_id (uuid.UUID): The ID of the app representing the client application
* using honcho user_id (str): The User ID representing the user, managed by the
- * user session_id (int): The ID of the Session to add the metamessage to
- * metamessage (schemas.MetamessageCreate): The Metamessage object to add
- * containing the metamessage content and type
+ * user session_id (int): The ID of the Session to add the message to metamessage
+ * (schemas.MeteamessageCreate): The metamessage creation object
*
* Returns: schemas.Metamessage: The Metamessage object of the added metamessage
*
diff --git a/src/resources/apps/users/sessions/sessions.ts b/src/resources/apps/users/sessions/sessions.ts
index f697aeb..0535a9c 100644
--- a/src/resources/apps/users/sessions/sessions.ts
+++ b/src/resources/apps/users/sessions/sessions.ts
@@ -103,17 +103,17 @@ export class Sessions extends APIResource {
}
/**
- * Get Chat
+ * Chat
*/
chat(
appId: string,
userId: string,
sessionId: string,
- query: SessionChatParams,
+ body: SessionChatParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat`, {
- query,
+ return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat`, {
+ body,
...options,
});
}
@@ -145,11 +145,11 @@ export class Sessions extends APIResource {
appId: string,
userId: string,
sessionId: string,
- query: SessionStreamParams,
+ body: SessionStreamParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat/stream`, {
- query,
+ return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat/stream`, {
+ body,
...options,
});
}
@@ -206,11 +206,15 @@ export interface SessionListParams extends PageParams {
}
export interface SessionChatParams {
- query: string;
+ queries: string | Array;
+
+ collections?: string | Array;
}
export interface SessionStreamParams {
- query: string;
+ queries: string | Array;
+
+ collections?: string | Array;
}
export namespace Sessions {
diff --git a/tests/api-resources/apps/users/sessions/sessions.test.ts b/tests/api-resources/apps/users/sessions/sessions.test.ts
index 3d2ce39..465d21b 100644
--- a/tests/api-resources/apps/users/sessions/sessions.test.ts
+++ b/tests/api-resources/apps/users/sessions/sessions.test.ts
@@ -109,7 +109,7 @@ describe('resource sessions', () => {
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { query: 'query' },
+ { queries: 'string' },
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -125,7 +125,7 @@ describe('resource sessions', () => {
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { query: 'query' },
+ { queries: 'string', collections: 'string' },
);
});
@@ -161,7 +161,7 @@ describe('resource sessions', () => {
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { query: 'query' },
+ { queries: 'string' },
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -177,7 +177,7 @@ describe('resource sessions', () => {
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { query: 'query' },
+ { queries: 'string', collections: 'string' },
);
});
});
From dbade177ef333f740138ff026a346a6e25bec229 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sun, 15 Sep 2024 02:50:52 +0000
Subject: [PATCH 03/11] chore(internal): codegen related update (#36)
---
.github/workflows/ci.yml | 23 +++++++++++++++++++++--
scripts/lint | 3 +++
src/uploads.ts | 15 +++++++++++----
tests/uploads.test.ts | 8 ++++++++
yarn.lock | 26 +++++++++++++-------------
5 files changed, 56 insertions(+), 19 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d791adb..e3530dc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -22,11 +22,30 @@ jobs:
with:
node-version: '18'
- - name: Install dependencies
- run: yarn install
+ - name: Bootstrap
+ run: ./scripts/bootstrap
- name: Check types
run: ./scripts/lint
+
+ build:
+ name: build
+ runs-on: ubuntu-latest
+
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Set up Node
+ uses: actions/setup-node@v4
+ with:
+ node-version: '18'
+
+ - name: Bootstrap
+ run: ./scripts/bootstrap
+
+ - name: Check build
+ run: ./scripts/build
test:
name: test
runs-on: ubuntu-latest
diff --git a/scripts/lint b/scripts/lint
index 4af1de0..6ba75df 100755
--- a/scripts/lint
+++ b/scripts/lint
@@ -6,3 +6,6 @@ cd "$(dirname "$0")/.."
echo "==> Running eslint"
ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js .
+
+echo "==> Running tsc"
+./node_modules/.bin/tsc --noEmit
diff --git a/src/uploads.ts b/src/uploads.ts
index 081827c..8fd2154 100644
--- a/src/uploads.ts
+++ b/src/uploads.ts
@@ -107,21 +107,28 @@ export async function toFile(
// If it's a promise, resolve it.
value = await value;
- // Use the file's options if there isn't one provided
- options ??= isFileLike(value) ? { lastModified: value.lastModified, type: value.type } : {};
+ // If we've been given a `File` we don't need to do anything
+ if (isFileLike(value)) {
+ return value;
+ }
if (isResponseLike(value)) {
const blob = await value.blob();
name ||= new URL(value.url).pathname.split(/[\\/]/).pop() ?? 'unknown_file';
- return new File([blob as any], name, options);
+ // we need to convert the `Blob` into an array buffer because the `Blob` class
+ // that `node-fetch` defines is incompatible with the web standard which results
+ // in `new File` interpreting it as a string instead of binary data.
+ const data = isBlobLike(blob) ? [(await blob.arrayBuffer()) as any] : [blob];
+
+ return new File(data, name, options);
}
const bits = await getBytes(value);
name ||= getName(value) ?? 'unknown_file';
- if (!options.type) {
+ if (!options?.type) {
const type = (bits[0] as any)?.type;
if (typeof type === 'string') {
options = { ...options, type };
diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts
index 6bda430..403ba13 100644
--- a/tests/uploads.test.ts
+++ b/tests/uploads.test.ts
@@ -54,4 +54,12 @@ describe('toFile', () => {
const file = await toFile(input);
expect(file.name).toEqual('uploads.test.ts');
});
+
+ it('does not copy File objects', async () => {
+ const input = new File(['foo'], 'input.jsonl', { type: 'jsonl' });
+ const file = await toFile(input);
+ expect(file).toBe(input);
+ expect(file.name).toEqual('input.jsonl');
+ expect(file.type).toBe('jsonl');
+ });
});
diff --git a/yarn.lock b/yarn.lock
index 358dbf2..0f17a27 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1200,12 +1200,12 @@ brace-expansion@^2.0.1:
dependencies:
balanced-match "^1.0.0"
-braces@^3.0.2:
- version "3.0.2"
- resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
- integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
+braces@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789"
+ integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==
dependencies:
- fill-range "^7.0.1"
+ fill-range "^7.1.1"
browserslist@^4.22.2:
version "4.22.2"
@@ -1762,10 +1762,10 @@ file-entry-cache@^6.0.1:
dependencies:
flat-cache "^3.0.4"
-fill-range@^7.0.1:
- version "7.0.1"
- resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
- integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==
+fill-range@^7.1.1:
+ version "7.1.1"
+ resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292"
+ integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==
dependencies:
to-regex-range "^5.0.1"
@@ -2638,11 +2638,11 @@ merge2@^1.3.0, merge2@^1.4.1:
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
micromatch@^4.0.4:
- version "4.0.5"
- resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
- integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
+ version "4.0.8"
+ resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.8.tgz#d66fa18f3a47076789320b9b1af32bd86d9fa202"
+ integrity sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==
dependencies:
- braces "^3.0.2"
+ braces "^3.0.3"
picomatch "^2.3.1"
mime-db@1.51.0:
From 099c25b0a9bdfde9404f2760027c868f99565e3c Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sun, 15 Sep 2024 02:51:38 +0000
Subject: [PATCH 04/11] fix(errors): pass message through to APIConnectionError
(#37)
---
src/error.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/error.ts b/src/error.ts
index 3fc264d..7e8bb1e 100644
--- a/src/error.ts
+++ b/src/error.ts
@@ -49,7 +49,7 @@ export class APIError extends HonchoError {
headers: Headers | undefined,
) {
if (!status) {
- return new APIConnectionError({ cause: castToError(errorResponse) });
+ return new APIConnectionError({ message, cause: castToError(errorResponse) });
}
const error = errorResponse as Record;
@@ -101,7 +101,7 @@ export class APIUserAbortError extends APIError {
export class APIConnectionError extends APIError {
override readonly status: undefined = undefined;
- constructor({ message, cause }: { message?: string; cause?: Error | undefined }) {
+ constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
super(undefined, undefined, message || 'Connection error.', undefined);
// in some environments the 'cause' property is already declared
// @ts-ignore
From 3e16bc162793c14e925f40868f85ec89bfda9c8f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sun, 15 Sep 2024 02:52:01 +0000
Subject: [PATCH 05/11] chore: better object fallback behaviour for casting
errors (#38)
---
src/core.ts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/core.ts b/src/core.ts
index 0f7a3b1..2132746 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -978,6 +978,11 @@ const validatePositiveInteger = (name: string, n: unknown): number => {
export const castToError = (err: any): Error => {
if (err instanceof Error) return err;
+ if (typeof err === 'object' && err !== null) {
+ try {
+ return new Error(JSON.stringify(err));
+ } catch {}
+ }
return new Error(err);
};
From 0b370d587c6a73a78563f2faf807e2844fe9dc8f Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Sun, 15 Sep 2024 03:00:53 +0000
Subject: [PATCH 06/11] docs: update CONTRIBUTING.md (#39)
---
CONTRIBUTING.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6c5fd6a..b58edf7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -14,13 +14,13 @@ This will install all the required dependencies and build output files to `dist/
## Modifying/Adding code
-Most of the SDK is generated code, and any modified code will be overridden on the next generation. The
-`src/lib/` and `examples/` directories are exceptions and will never be overridden.
+Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
+result in merge conflicts between manual patches and changes from the generator. The generator will never
+modify the contents of the `src/lib/` and `examples/` directories.
## Adding and running examples
-All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or
-added to.
+All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
```bash
// add an example to examples/.ts
From 404f89cd152afcdd9a482ff9487c852298ff3ab9 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 10 Oct 2024 02:11:17 +0000
Subject: [PATCH 07/11] feat(api): api update (#40)
---
.stats.yml | 4 +-
CONTRIBUTING.md | 4 +-
README.md | 18 ++---
api.md | 15 ++--
jest.config.ts | 6 +-
package.json | 6 +-
scripts/build | 8 +-
scripts/utils/postprocess-files.cjs | 4 +-
src/_shims/README.md | 32 ++++----
src/_shims/index.d.ts | 2 +-
src/_shims/index.js | 2 +-
src/_shims/index.mjs | 2 +-
src/_shims/manual-types.d.ts | 4 +-
src/_shims/registry.ts | 6 +-
src/_shims/web-runtime.ts | 6 +-
src/core.ts | 12 +--
.../apps/users/collections/collections.ts | 28 -------
src/resources/apps/users/collections/index.ts | 2 -
src/resources/apps/users/index.ts | 6 +-
src/resources/apps/users/metamessages.ts | 75 +++++++++++++++++++
src/resources/apps/users/sessions/index.ts | 3 -
src/resources/apps/users/sessions/sessions.ts | 49 ------------
src/resources/apps/users/users.ts | 10 +--
tests/api-resources/apps/apps.test.ts | 2 +-
.../users/collections/collections.test.ts | 27 +------
.../apps/users/collections/documents.test.ts | 2 +-
.../apps/users/metamessages.test.ts | 48 ++++++++++++
.../apps/users/sessions/messages.test.ts | 2 +-
.../apps/users/sessions/metamessages.test.ts | 2 +-
.../apps/users/sessions/sessions.test.ts | 52 +------------
tests/api-resources/apps/users/users.test.ts | 2 +-
tests/form.test.ts | 6 +-
tests/index.test.ts | 6 +-
tests/responses.test.ts | 4 +-
tests/stringifyQuery.test.ts | 2 +-
tests/uploads.test.ts | 4 +-
tsconfig.build.json | 4 +-
tsconfig.deno.json | 6 +-
tsconfig.json | 6 +-
39 files changed, 222 insertions(+), 257 deletions(-)
create mode 100644 src/resources/apps/users/metamessages.ts
create mode 100644 tests/api-resources/apps/users/metamessages.test.ts
diff --git a/.stats.yml b/.stats.yml
index 6d65821..d0bac8d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 38
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-522b2d21f11fa12f9f9bdc701a5c4ed2c2ee5ceee9d630d0c38fe5495aeae734.yml
+configured_endpoints: 36
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-d259b106accde65e100275c3eee2d01d0b91792abc0e67ae807dae74fb32f4de.yml
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b58edf7..e508f2b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -55,12 +55,12 @@ cd honcho-node
# With yarn
yarn link
cd ../my-package
-yarn link honcho-ai
+yarn link honcho
# With pnpm
pnpm link --global
cd ../my-package
-pnpm link -—global honcho-ai
+pnpm link -—global honcho
```
## Running tests
diff --git a/README.md b/README.md
index dd39150..96b9490 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# Honcho Node API Library
+# honcho-ai API Library
-[![NPM version](https://img.shields.io/npm/v/honcho-ai.svg)](https://npmjs.org/package/honcho-ai) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/honcho-ai)
+[![NPM version](https://img.shields.io/npm/v/honcho.svg)](https://npmjs.org/package/honcho) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/honcho)
This library provides convenient access to the Honcho REST API from server-side TypeScript or JavaScript.
@@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
## Installation
```sh
-npm install honcho-ai
+npm install honcho
```
## Usage
@@ -20,7 +20,7 @@ The full API of this library can be found in [api.md](api.md).
```js
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
const client = new Honcho({
apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted
@@ -42,7 +42,7 @@ This library includes TypeScript definitions for all request params and response
```ts
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
const client = new Honcho({
apiKey: process.env['HONCHO_API_KEY'], // This is the default and can be omitted
@@ -244,11 +244,11 @@ add the following import before your first import `from "Honcho"`:
```ts
// Tell TypeScript and the package to use the global web fetch instead of node-fetch.
// Note, despite the name, this does not add any polyfills, but expects them to be provided if needed.
-import 'honcho-ai/shims/web';
-import Honcho from 'honcho-ai';
+import 'honcho/shims/web';
+import Honcho from 'honcho';
```
-To do the inverse, add `import "honcho-ai/shims/node"` (which does import polyfills).
+To do the inverse, add `import "honcho/shims/node"` (which does import polyfills).
This can also be useful if you are getting the wrong TypeScript types for `Response` ([more details](https://github.com/plastic-labs/honcho-node/tree/main/src/_shims#readme)).
### Logging and middleware
@@ -258,7 +258,7 @@ which can be used to inspect or alter the `Request` or `Response` before/after e
```ts
import { fetch } from 'undici'; // as one example
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
const client = new Honcho({
fetch: async (url: RequestInfo, init?: RequestInit): Promise => {
diff --git a/api.md b/api.md
index 7b6cfe3..fe4ea4f 100644
--- a/api.md
+++ b/api.md
@@ -28,6 +28,16 @@ Methods:
- client.apps.users.getByName(appId, name) -> User
- client.apps.users.getOrCreate(appId, name) -> User
+### Metamessages
+
+Types:
+
+- PageMetamessage
+
+Methods:
+
+- client.apps.users.metamessages.list(appId, userId, { ...params }) -> MetamessagesPage
+
### Sessions
Types:
@@ -36,7 +46,6 @@ Types:
- PageSession
- Session
- SessionDeleteResponse
-- SessionStreamResponse
Methods:
@@ -44,9 +53,7 @@ Methods:
- client.apps.users.sessions.update(appId, userId, sessionId, { ...params }) -> Session
- client.apps.users.sessions.list(appId, userId, { ...params }) -> SessionsPage
- client.apps.users.sessions.delete(appId, userId, sessionId) -> unknown
-- client.apps.users.sessions.chat(appId, userId, sessionId, { ...params }) -> AgentChat
- client.apps.users.sessions.get(appId, userId, sessionId) -> Session
-- client.apps.users.sessions.stream(appId, userId, sessionId, { ...params }) -> unknown
#### Messages
@@ -83,7 +90,6 @@ Types:
- Collection
- PageCollection
- CollectionDeleteResponse
-- CollectionQueryResponse
Methods:
@@ -93,7 +99,6 @@ Methods:
- client.apps.users.collections.delete(appId, userId, collectionId) -> unknown
- client.apps.users.collections.get(appId, userId, collectionId) -> Collection
- client.apps.users.collections.getByName(appId, userId, name) -> Collection
-- client.apps.users.collections.query(appId, userId, collectionId, { ...params }) -> CollectionQueryResponse
#### Documents
diff --git a/jest.config.ts b/jest.config.ts
index 751cc62..0b5e735 100644
--- a/jest.config.ts
+++ b/jest.config.ts
@@ -7,9 +7,9 @@ const config: JestConfigWithTsJest = {
'^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }],
},
moduleNameMapper: {
- '^honcho-ai$': '/src/index.ts',
- '^honcho-ai/_shims/auto/(.*)$': '/src/_shims/auto/$1-node',
- '^honcho-ai/(.*)$': '/src/$1',
+ '^honcho$': '/src/index.ts',
+ '^honcho/_shims/auto/(.*)$': '/src/_shims/auto/$1-node',
+ '^honcho/(.*)$': '/src/$1',
},
modulePathIgnorePatterns: [
'/ecosystem-tests/',
diff --git a/package.json b/package.json
index 6fe86bc..557b1bb 100644
--- a/package.json
+++ b/package.json
@@ -1,5 +1,5 @@
{
- "name": "honcho-ai",
+ "name": "honcho",
"version": "0.0.6",
"description": "The official TypeScript library for the Honcho API",
"author": "Honcho ",
@@ -59,8 +59,8 @@
"./shims/web.mjs"
],
"imports": {
- "honcho-ai": ".",
- "honcho-ai/*": "./src/*"
+ "honcho": ".",
+ "honcho/*": "./src/*"
},
"exports": {
"./_shims/auto/*": {
diff --git a/scripts/build b/scripts/build
index 4c05d10..a60d4e7 100755
--- a/scripts/build
+++ b/scripts/build
@@ -8,7 +8,7 @@ node scripts/utils/check-version.cjs
# Build into dist and will publish the package from there,
# so that src/resources/foo.ts becomes /resources/foo.js
-# This way importing from `"honcho-ai/resources/foo"` works
+# This way importing from `"honcho/resources/foo"` works
# even with `"moduleResolution": "node"`
rm -rf dist; mkdir dist
@@ -32,7 +32,7 @@ npm exec tsc-multi
# copy over handwritten .js/.mjs/.d.ts files
cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims
cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto
-# we need to add exports = module.exports = Honcho Node to index.js;
+# we need to add exports = module.exports = honcho-ai to index.js;
# No way to get that from index.ts because it would cause compile errors
# when building .mjs
node scripts/utils/fix-index-exports.cjs
@@ -47,8 +47,8 @@ node scripts/utils/postprocess-files.cjs
# make sure that nothing crashes when we require the output CJS or
# import the output ESM
-(cd dist && node -e 'require("honcho-ai")')
-(cd dist && node -e 'import("honcho-ai")' --input-type=module)
+(cd dist && node -e 'require("honcho")')
+(cd dist && node -e 'import("honcho")' --input-type=module)
if command -v deno &> /dev/null && [ -e ./scripts/build-deno ]
then
diff --git a/scripts/utils/postprocess-files.cjs b/scripts/utils/postprocess-files.cjs
index 1c79e83..d8e0c91 100644
--- a/scripts/utils/postprocess-files.cjs
+++ b/scripts/utils/postprocess-files.cjs
@@ -2,7 +2,7 @@ const fs = require('fs');
const path = require('path');
const { parse } = require('@typescript-eslint/parser');
-const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'honcho-ai/';
+const pkgImportPath = process.env['PKG_IMPORT_PATH'] ?? 'honcho/';
const distDir =
process.env['DIST_PATH'] ?
@@ -142,7 +142,7 @@ async function postprocess() {
if (file.endsWith('.d.ts')) {
// work around bad tsc behavior
- // if we have `import { type Readable } from 'honcho-ai/_shims/index'`,
+ // if we have `import { type Readable } from 'honcho/_shims/index'`,
// tsc sometimes replaces `Readable` with `import("stream").Readable` inline
// in the output .d.ts
transformed = transformed.replace(/import\("stream"\).Readable/g, 'Readable');
diff --git a/src/_shims/README.md b/src/_shims/README.md
index ef0d8c2..5ff23fe 100644
--- a/src/_shims/README.md
+++ b/src/_shims/README.md
@@ -1,9 +1,9 @@
# 👋 Wondering what everything in here does?
-`honcho-ai` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
+`honcho` supports a wide variety of runtime environments like Node.js, Deno, Bun, browsers, and various
edge runtimes, as well as both CommonJS (CJS) and EcmaScript Modules (ESM).
-To do this, `honcho-ai` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
+To do this, `honcho` provides shims for either using `node-fetch` when in Node (because `fetch` is still experimental there) or the global `fetch` API built into the environment when not in Node.
It uses [conditional exports](https://nodejs.org/api/packages.html#conditional-exports) to
automatically select the correct shims for each environment. However, conditional exports are a fairly new
@@ -15,32 +15,32 @@ getting the wrong raw `Response` type from `.asResponse()`, for example.
The user can work around these issues by manually importing one of:
-- `import 'honcho-ai/shims/node'`
-- `import 'honcho-ai/shims/web'`
+- `import 'honcho/shims/node'`
+- `import 'honcho/shims/web'`
All of the code here in `_shims` handles selecting the automatic default shims or manual overrides.
### How it works - Runtime
-Runtime shims get installed by calling `setShims` exported by `honcho-ai/_shims/registry`.
+Runtime shims get installed by calling `setShims` exported by `honcho/_shims/registry`.
-Manually importing `honcho-ai/shims/node` or `honcho-ai/shims/web`, calls `setShims` with the respective runtime shims.
+Manually importing `honcho/shims/node` or `honcho/shims/web`, calls `setShims` with the respective runtime shims.
-All client code imports shims from `honcho-ai/_shims/index`, which:
+All client code imports shims from `honcho/_shims/index`, which:
- checks if shims have been set manually
-- if not, calls `setShims` with the shims from `honcho-ai/_shims/auto/runtime`
-- re-exports the installed shims from `honcho-ai/_shims/registry`.
+- if not, calls `setShims` with the shims from `honcho/_shims/auto/runtime`
+- re-exports the installed shims from `honcho/_shims/registry`.
-`honcho-ai/_shims/auto/runtime` exports web runtime shims.
-If the `node` export condition is set, the export map replaces it with `honcho-ai/_shims/auto/runtime-node`.
+`honcho/_shims/auto/runtime` exports web runtime shims.
+If the `node` export condition is set, the export map replaces it with `honcho/_shims/auto/runtime-node`.
### How it works - Type time
-All client code imports shim types from `honcho-ai/_shims/index`, which selects the manual types from `honcho-ai/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `honcho-ai/_shims/auto/types`.
+All client code imports shim types from `honcho/_shims/index`, which selects the manual types from `honcho/_shims/manual-types` if they have been declared, otherwise it exports the auto types from `honcho/_shims/auto/types`.
-`honcho-ai/_shims/manual-types` exports an empty namespace.
-Manually importing `honcho-ai/shims/node` or `honcho-ai/shims/web` merges declarations into this empty namespace, so they get picked up by `honcho-ai/_shims/index`.
+`honcho/_shims/manual-types` exports an empty namespace.
+Manually importing `honcho/shims/node` or `honcho/shims/web` merges declarations into this empty namespace, so they get picked up by `honcho/_shims/index`.
-`honcho-ai/_shims/auto/types` exports web type definitions.
-If the `node` export condition is set, the export map replaces it with `honcho-ai/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
+`honcho/_shims/auto/types` exports web type definitions.
+If the `node` export condition is set, the export map replaces it with `honcho/_shims/auto/types-node`, though TS only picks this up if `"moduleResolution": "nodenext"` or `"moduleResolution": "bundler"`.
diff --git a/src/_shims/index.d.ts b/src/_shims/index.d.ts
index e0a4587..13f102a 100644
--- a/src/_shims/index.d.ts
+++ b/src/_shims/index.d.ts
@@ -2,7 +2,7 @@
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
*/
import { manual } from './manual-types';
-import * as auto from 'honcho-ai/_shims/auto/types';
+import * as auto from 'honcho/_shims/auto/types';
import { type RequestOptions } from '../core';
type SelectType = unknown extends Manual ? Auto : Manual;
diff --git a/src/_shims/index.js b/src/_shims/index.js
index 017f781..dc692ed 100644
--- a/src/_shims/index.js
+++ b/src/_shims/index.js
@@ -2,7 +2,7 @@
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
*/
const shims = require('./registry');
-const auto = require('honcho-ai/_shims/auto/runtime');
+const auto = require('honcho/_shims/auto/runtime');
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
for (const property of Object.keys(shims)) {
Object.defineProperty(exports, property, {
diff --git a/src/_shims/index.mjs b/src/_shims/index.mjs
index a1391a4..8442380 100644
--- a/src/_shims/index.mjs
+++ b/src/_shims/index.mjs
@@ -2,6 +2,6 @@
* Disclaimer: modules in _shims aren't intended to be imported by SDK users.
*/
import * as shims from './registry.mjs';
-import * as auto from 'honcho-ai/_shims/auto/runtime';
+import * as auto from 'honcho/_shims/auto/runtime';
if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true });
export * from './registry.mjs';
diff --git a/src/_shims/manual-types.d.ts b/src/_shims/manual-types.d.ts
index 1501772..32a4ba3 100644
--- a/src/_shims/manual-types.d.ts
+++ b/src/_shims/manual-types.d.ts
@@ -4,8 +4,8 @@
/**
* Types will get added to this namespace when you import one of the following:
*
- * import 'honcho-ai/shims/node'
- * import 'honcho-ai/shims/web'
+ * import 'honcho/shims/node'
+ * import 'honcho/shims/web'
*
* Importing more than one will cause type and runtime errors.
*/
diff --git a/src/_shims/registry.ts b/src/_shims/registry.ts
index ebea666..ced84aa 100644
--- a/src/_shims/registry.ts
+++ b/src/_shims/registry.ts
@@ -42,13 +42,11 @@ export let isFsReadStream: Shims['isFsReadStream'] | undefined = undefined;
export function setShims(shims: Shims, options: { auto: boolean } = { auto: false }) {
if (auto) {
throw new Error(
- `you must \`import 'honcho-ai/shims/${shims.kind}'\` before importing anything else from honcho-ai`,
+ `you must \`import 'honcho/shims/${shims.kind}'\` before importing anything else from honcho`,
);
}
if (kind) {
- throw new Error(
- `can't \`import 'honcho-ai/shims/${shims.kind}'\` after \`import 'honcho-ai/shims/${kind}'\``,
- );
+ throw new Error(`can't \`import 'honcho/shims/${shims.kind}'\` after \`import 'honcho/shims/${kind}'\``);
}
auto = options.auto;
kind = shims.kind;
diff --git a/src/_shims/web-runtime.ts b/src/_shims/web-runtime.ts
index afe73a5..e02b68a 100644
--- a/src/_shims/web-runtime.ts
+++ b/src/_shims/web-runtime.ts
@@ -9,9 +9,9 @@ export function getRuntime({ manuallyImported }: { manuallyImported?: boolean }
const recommendation =
manuallyImported ?
`You may need to use polyfills`
- : `Add one of these imports before your first \`import … from 'honcho-ai'\`:
-- \`import 'honcho-ai/shims/node'\` (if you're running on Node)
-- \`import 'honcho-ai/shims/web'\` (otherwise)
+ : `Add one of these imports before your first \`import … from 'honcho'\`:
+- \`import 'honcho/shims/node'\` (if you're running on Node)
+- \`import 'honcho/shims/web'\` (otherwise)
`;
let _fetch, _Request, _Response, _Headers;
diff --git a/src/core.ts b/src/core.ts
index 2132746..2389e75 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -97,9 +97,9 @@ export class APIPromise extends Promise {
*
* 👋 Getting the wrong TypeScript type for `Response`?
* Try setting `"moduleResolution": "NodeNext"` if you can,
- * or add one of these imports before your first `import … from 'honcho-ai'`:
- * - `import 'honcho-ai/shims/node'` (if you're running on Node)
- * - `import 'honcho-ai/shims/web'` (otherwise)
+ * or add one of these imports before your first `import … from 'honcho'`:
+ * - `import 'honcho/shims/node'` (if you're running on Node)
+ * - `import 'honcho/shims/web'` (otherwise)
*/
asResponse(): Promise {
return this.responsePromise.then((p) => p.response);
@@ -113,9 +113,9 @@ export class APIPromise extends Promise {
*
* 👋 Getting the wrong TypeScript type for `Response`?
* Try setting `"moduleResolution": "NodeNext"` if you can,
- * or add one of these imports before your first `import … from 'honcho-ai'`:
- * - `import 'honcho-ai/shims/node'` (if you're running on Node)
- * - `import 'honcho-ai/shims/web'` (otherwise)
+ * or add one of these imports before your first `import … from 'honcho'`:
+ * - `import 'honcho/shims/node'` (if you're running on Node)
+ * - `import 'honcho/shims/web'` (otherwise)
*/
async withResponse(): Promise<{ data: T; response: Response }> {
const [data, response] = await Promise.all([this.parse(), this.asResponse()]);
diff --git a/src/resources/apps/users/collections/collections.ts b/src/resources/apps/users/collections/collections.ts
index e896fc6..5251c42 100644
--- a/src/resources/apps/users/collections/collections.ts
+++ b/src/resources/apps/users/collections/collections.ts
@@ -108,22 +108,6 @@ export class Collections extends APIResource {
): Core.APIPromise {
return this._client.get(`/apps/${appId}/users/${userId}/collections/name/${name}`, options);
}
-
- /**
- * Query Documents
- */
- query(
- appId: string,
- userId: string,
- collectionId: string,
- query: CollectionQueryParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/collections/${collectionId}/documents/query`, {
- query,
- ...options,
- });
- }
}
export class CollectionsPage extends Page {}
@@ -154,8 +138,6 @@ export interface PageCollection {
export type CollectionDeleteResponse = unknown;
-export type CollectionQueryResponse = Array;
-
export interface CollectionCreateParams {
name: string;
@@ -174,24 +156,14 @@ export interface CollectionListParams extends PageParams {
reverse?: boolean | null;
}
-export interface CollectionQueryParams {
- query: string;
-
- filter?: string | null;
-
- top_k?: number;
-}
-
export namespace Collections {
export import Collection = CollectionsAPI.Collection;
export import PageCollection = CollectionsAPI.PageCollection;
export import CollectionDeleteResponse = CollectionsAPI.CollectionDeleteResponse;
- export import CollectionQueryResponse = CollectionsAPI.CollectionQueryResponse;
export import CollectionsPage = CollectionsAPI.CollectionsPage;
export import CollectionCreateParams = CollectionsAPI.CollectionCreateParams;
export import CollectionUpdateParams = CollectionsAPI.CollectionUpdateParams;
export import CollectionListParams = CollectionsAPI.CollectionListParams;
- export import CollectionQueryParams = CollectionsAPI.CollectionQueryParams;
export import Documents = DocumentsAPI.Documents;
export import Document = DocumentsAPI.Document;
export import PageDocument = DocumentsAPI.PageDocument;
diff --git a/src/resources/apps/users/collections/index.ts b/src/resources/apps/users/collections/index.ts
index b8db4f6..8362151 100644
--- a/src/resources/apps/users/collections/index.ts
+++ b/src/resources/apps/users/collections/index.ts
@@ -4,11 +4,9 @@ export {
Collection,
PageCollection,
CollectionDeleteResponse,
- CollectionQueryResponse,
CollectionCreateParams,
CollectionUpdateParams,
CollectionListParams,
- CollectionQueryParams,
CollectionsPage,
Collections,
} from './collections';
diff --git a/src/resources/apps/users/index.ts b/src/resources/apps/users/index.ts
index 63b66a7..b3f0f6a 100644
--- a/src/resources/apps/users/index.ts
+++ b/src/resources/apps/users/index.ts
@@ -5,12 +5,9 @@ export {
PageSession,
Session,
SessionDeleteResponse,
- SessionStreamResponse,
SessionCreateParams,
SessionUpdateParams,
SessionListParams,
- SessionChatParams,
- SessionStreamParams,
SessionsPage,
Sessions,
} from './sessions/index';
@@ -18,14 +15,13 @@ export {
Collection,
PageCollection,
CollectionDeleteResponse,
- CollectionQueryResponse,
CollectionCreateParams,
CollectionUpdateParams,
CollectionListParams,
- CollectionQueryParams,
CollectionsPage,
Collections,
} from './collections/index';
+export { PageMetamessage, MetamessageListParams, Metamessages } from './metamessages';
export {
PageUser,
User,
diff --git a/src/resources/apps/users/metamessages.ts b/src/resources/apps/users/metamessages.ts
new file mode 100644
index 0000000..1ee1554
--- /dev/null
+++ b/src/resources/apps/users/metamessages.ts
@@ -0,0 +1,75 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { APIResource } from '../../../resource';
+import { isRequestOptions } from '../../../core';
+import * as Core from '../../../core';
+import * as MetamessagesAPI from './metamessages';
+import * as SessionsMetamessagesAPI from './sessions/metamessages';
+import { MetamessagesPage } from './sessions/metamessages';
+import { type PageParams } from '../../../pagination';
+
+export class Metamessages extends APIResource {
+ /**
+ * Paginate through the user metamessages for a user
+ *
+ * Args: app_id (uuid.UUID): The ID of the app representing the client application
+ * using honcho user_id (str): The User ID representing the user, managed by the
+ * user reverse (bool): Whether to reverse the order of the metamessages
+ *
+ * Returns: list[schemas.Message]: List of Message objects
+ *
+ * Raises: HTTPException: If the session is not found
+ */
+ list(
+ appId: string,
+ userId: string,
+ query?: MetamessageListParams,
+ options?: Core.RequestOptions,
+ ): Core.PagePromise;
+ list(
+ appId: string,
+ userId: string,
+ options?: Core.RequestOptions,
+ ): Core.PagePromise;
+ list(
+ appId: string,
+ userId: string,
+ query: MetamessageListParams | Core.RequestOptions = {},
+ options?: Core.RequestOptions,
+ ): Core.PagePromise {
+ if (isRequestOptions(query)) {
+ return this.list(appId, userId, {}, query);
+ }
+ return this._client.getAPIList(`/apps/${appId}/users/${userId}/metamessages`, MetamessagesPage, {
+ query,
+ ...options,
+ });
+ }
+}
+
+export interface PageMetamessage {
+ items: Array;
+
+ page: number;
+
+ size: number;
+
+ total: number;
+
+ pages?: number;
+}
+
+export interface MetamessageListParams extends PageParams {
+ filter?: string | null;
+
+ metamessage_type?: string | null;
+
+ reverse?: boolean | null;
+}
+
+export namespace Metamessages {
+ export import PageMetamessage = MetamessagesAPI.PageMetamessage;
+ export import MetamessageListParams = MetamessagesAPI.MetamessageListParams;
+}
+
+export { MetamessagesPage };
diff --git a/src/resources/apps/users/sessions/index.ts b/src/resources/apps/users/sessions/index.ts
index 4580149..d72bc29 100644
--- a/src/resources/apps/users/sessions/index.ts
+++ b/src/resources/apps/users/sessions/index.ts
@@ -5,12 +5,9 @@ export {
PageSession,
Session,
SessionDeleteResponse,
- SessionStreamResponse,
SessionCreateParams,
SessionUpdateParams,
SessionListParams,
- SessionChatParams,
- SessionStreamParams,
SessionsPage,
Sessions,
} from './sessions';
diff --git a/src/resources/apps/users/sessions/sessions.ts b/src/resources/apps/users/sessions/sessions.ts
index 0535a9c..ce5ade7 100644
--- a/src/resources/apps/users/sessions/sessions.ts
+++ b/src/resources/apps/users/sessions/sessions.ts
@@ -102,22 +102,6 @@ export class Sessions extends APIResource {
return this._client.delete(`/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
}
- /**
- * Chat
- */
- chat(
- appId: string,
- userId: string,
- sessionId: string,
- body: SessionChatParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat`, {
- body,
- ...options,
- });
- }
-
/**
* Get a specific session for a user by ID
*
@@ -137,22 +121,6 @@ export class Sessions extends APIResource {
): Core.APIPromise {
return this._client.get(`/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
}
-
- /**
- * Get Chat Stream
- */
- stream(
- appId: string,
- userId: string,
- sessionId: string,
- body: SessionStreamParams,
- options?: Core.RequestOptions,
- ): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat/stream`, {
- body,
- ...options,
- });
- }
}
export class SessionsPage extends Page {}
@@ -187,8 +155,6 @@ export interface Session {
export type SessionDeleteResponse = unknown;
-export type SessionStreamResponse = unknown;
-
export interface SessionCreateParams {
metadata?: Record | null;
}
@@ -205,30 +171,15 @@ export interface SessionListParams extends PageParams {
reverse?: boolean | null;
}
-export interface SessionChatParams {
- queries: string | Array;
-
- collections?: string | Array;
-}
-
-export interface SessionStreamParams {
- queries: string | Array;
-
- collections?: string | Array;
-}
-
export namespace Sessions {
export import AgentChat = SessionsAPI.AgentChat;
export import PageSession = SessionsAPI.PageSession;
export import Session = SessionsAPI.Session;
export import SessionDeleteResponse = SessionsAPI.SessionDeleteResponse;
- export import SessionStreamResponse = SessionsAPI.SessionStreamResponse;
export import SessionsPage = SessionsAPI.SessionsPage;
export import SessionCreateParams = SessionsAPI.SessionCreateParams;
export import SessionUpdateParams = SessionsAPI.SessionUpdateParams;
export import SessionListParams = SessionsAPI.SessionListParams;
- export import SessionChatParams = SessionsAPI.SessionChatParams;
- export import SessionStreamParams = SessionsAPI.SessionStreamParams;
export import Messages = MessagesAPI.Messages;
export import Message = MessagesAPI.Message;
export import PageMessage = MessagesAPI.PageMessage;
diff --git a/src/resources/apps/users/users.ts b/src/resources/apps/users/users.ts
index 97c4641..24432f0 100644
--- a/src/resources/apps/users/users.ts
+++ b/src/resources/apps/users/users.ts
@@ -4,11 +4,13 @@ import { APIResource } from '../../../resource';
import { isRequestOptions } from '../../../core';
import * as Core from '../../../core';
import * as UsersAPI from './users';
+import * as MetamessagesAPI from './metamessages';
import * as CollectionsAPI from './collections/collections';
import * as SessionsAPI from './sessions/sessions';
import { Page, type PageParams } from '../../../pagination';
export class Users extends APIResource {
+ metamessages: MetamessagesAPI.Metamessages = new MetamessagesAPI.Metamessages(this._client);
sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client);
collections: CollectionsAPI.Collections = new CollectionsAPI.Collections(this._client);
@@ -158,26 +160,24 @@ export namespace Users {
export import UserCreateParams = UsersAPI.UserCreateParams;
export import UserUpdateParams = UsersAPI.UserUpdateParams;
export import UserListParams = UsersAPI.UserListParams;
+ export import Metamessages = MetamessagesAPI.Metamessages;
+ export import PageMetamessage = MetamessagesAPI.PageMetamessage;
+ export import MetamessageListParams = MetamessagesAPI.MetamessageListParams;
export import Sessions = SessionsAPI.Sessions;
export import AgentChat = SessionsAPI.AgentChat;
export import PageSession = SessionsAPI.PageSession;
export import Session = SessionsAPI.Session;
export import SessionDeleteResponse = SessionsAPI.SessionDeleteResponse;
- export import SessionStreamResponse = SessionsAPI.SessionStreamResponse;
export import SessionsPage = SessionsAPI.SessionsPage;
export import SessionCreateParams = SessionsAPI.SessionCreateParams;
export import SessionUpdateParams = SessionsAPI.SessionUpdateParams;
export import SessionListParams = SessionsAPI.SessionListParams;
- export import SessionChatParams = SessionsAPI.SessionChatParams;
- export import SessionStreamParams = SessionsAPI.SessionStreamParams;
export import Collections = CollectionsAPI.Collections;
export import Collection = CollectionsAPI.Collection;
export import PageCollection = CollectionsAPI.PageCollection;
export import CollectionDeleteResponse = CollectionsAPI.CollectionDeleteResponse;
- export import CollectionQueryResponse = CollectionsAPI.CollectionQueryResponse;
export import CollectionsPage = CollectionsAPI.CollectionsPage;
export import CollectionCreateParams = CollectionsAPI.CollectionCreateParams;
export import CollectionUpdateParams = CollectionsAPI.CollectionUpdateParams;
export import CollectionListParams = CollectionsAPI.CollectionListParams;
- export import CollectionQueryParams = CollectionsAPI.CollectionQueryParams;
}
diff --git a/tests/api-resources/apps/apps.test.ts b/tests/api-resources/apps/apps.test.ts
index b4bb873..a8f7e1b 100644
--- a/tests/api-resources/apps/apps.test.ts
+++ b/tests/api-resources/apps/apps.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
import { Response } from 'node-fetch';
const client = new Honcho({
diff --git a/tests/api-resources/apps/users/collections/collections.test.ts b/tests/api-resources/apps/users/collections/collections.test.ts
index 8b20218..445b940 100644
--- a/tests/api-resources/apps/users/collections/collections.test.ts
+++ b/tests/api-resources/apps/users/collections/collections.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
import { Response } from 'node-fetch';
const client = new Honcho({
@@ -165,29 +165,4 @@ describe('resource collections', () => {
),
).rejects.toThrow(Honcho.NotFoundError);
});
-
- test('query: only required params', async () => {
- const responsePromise = client.apps.users.collections.query(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { query: 'query' },
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- test('query: required and optional params', async () => {
- const response = await client.apps.users.collections.query(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { query: 'query', filter: 'filter', top_k: 0 },
- );
- });
});
diff --git a/tests/api-resources/apps/users/collections/documents.test.ts b/tests/api-resources/apps/users/collections/documents.test.ts
index 147ba52..db6c165 100644
--- a/tests/api-resources/apps/users/collections/documents.test.ts
+++ b/tests/api-resources/apps/users/collections/documents.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
import { Response } from 'node-fetch';
const client = new Honcho({
diff --git a/tests/api-resources/apps/users/metamessages.test.ts b/tests/api-resources/apps/users/metamessages.test.ts
new file mode 100644
index 0000000..ab1d0a6
--- /dev/null
+++ b/tests/api-resources/apps/users/metamessages.test.ts
@@ -0,0 +1,48 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import Honcho from 'honcho';
+import { Response } from 'node-fetch';
+
+const client = new Honcho({
+ apiKey: 'My API Key',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('resource metamessages', () => {
+ test('list', async () => {
+ const responsePromise = client.apps.users.metamessages.list(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ );
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('list: request options instead of params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ client.apps.users.metamessages.list(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { path: '/_stainless_unknown_path' },
+ ),
+ ).rejects.toThrow(Honcho.NotFoundError);
+ });
+
+ test('list: request options and params are passed correctly', async () => {
+ // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
+ await expect(
+ client.apps.users.metamessages.list(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { filter: 'filter', metamessage_type: 'metamessage_type', page: 1, reverse: true, size: 1 },
+ { path: '/_stainless_unknown_path' },
+ ),
+ ).rejects.toThrow(Honcho.NotFoundError);
+ });
+});
diff --git a/tests/api-resources/apps/users/sessions/messages.test.ts b/tests/api-resources/apps/users/sessions/messages.test.ts
index 3c75884..d8702be 100644
--- a/tests/api-resources/apps/users/sessions/messages.test.ts
+++ b/tests/api-resources/apps/users/sessions/messages.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
import { Response } from 'node-fetch';
const client = new Honcho({
diff --git a/tests/api-resources/apps/users/sessions/metamessages.test.ts b/tests/api-resources/apps/users/sessions/metamessages.test.ts
index a3c5b60..faa2a1b 100644
--- a/tests/api-resources/apps/users/sessions/metamessages.test.ts
+++ b/tests/api-resources/apps/users/sessions/metamessages.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
import { Response } from 'node-fetch';
const client = new Honcho({
diff --git a/tests/api-resources/apps/users/sessions/sessions.test.ts b/tests/api-resources/apps/users/sessions/sessions.test.ts
index 465d21b..8f81a68 100644
--- a/tests/api-resources/apps/users/sessions/sessions.test.ts
+++ b/tests/api-resources/apps/users/sessions/sessions.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
import { Response } from 'node-fetch';
const client = new Honcho({
@@ -104,31 +104,6 @@ describe('resource sessions', () => {
).rejects.toThrow(Honcho.NotFoundError);
});
- test('chat: only required params', async () => {
- const responsePromise = client.apps.users.sessions.chat(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string' },
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- test('chat: required and optional params', async () => {
- const response = await client.apps.users.sessions.chat(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string', collections: 'string' },
- );
- });
-
test('get', async () => {
const responsePromise = client.apps.users.sessions.get(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
@@ -155,29 +130,4 @@ describe('resource sessions', () => {
),
).rejects.toThrow(Honcho.NotFoundError);
});
-
- test('stream: only required params', async () => {
- const responsePromise = client.apps.users.sessions.stream(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string' },
- );
- const rawResponse = await responsePromise.asResponse();
- expect(rawResponse).toBeInstanceOf(Response);
- const response = await responsePromise;
- expect(response).not.toBeInstanceOf(Response);
- const dataAndResponse = await responsePromise.withResponse();
- expect(dataAndResponse.data).toBe(response);
- expect(dataAndResponse.response).toBe(rawResponse);
- });
-
- test('stream: required and optional params', async () => {
- const response = await client.apps.users.sessions.stream(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string', collections: 'string' },
- );
- });
});
diff --git a/tests/api-resources/apps/users/users.test.ts b/tests/api-resources/apps/users/users.test.ts
index 5724af2..a67db27 100644
--- a/tests/api-resources/apps/users/users.test.ts
+++ b/tests/api-resources/apps/users/users.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
+import Honcho from 'honcho';
import { Response } from 'node-fetch';
const client = new Honcho({
diff --git a/tests/form.test.ts b/tests/form.test.ts
index 2f922e0..d0412be 100644
--- a/tests/form.test.ts
+++ b/tests/form.test.ts
@@ -1,6 +1,6 @@
-import { multipartFormRequestOptions, createForm } from 'honcho-ai/core';
-import { Blob } from 'honcho-ai/_shims/index';
-import { toFile } from 'honcho-ai';
+import { multipartFormRequestOptions, createForm } from 'honcho/core';
+import { Blob } from 'honcho/_shims/index';
+import { toFile } from 'honcho';
describe('form data validation', () => {
test('valid values do not error', async () => {
diff --git a/tests/index.test.ts b/tests/index.test.ts
index b0376ba..f263c9d 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -1,8 +1,8 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import Honcho from 'honcho-ai';
-import { APIUserAbortError } from 'honcho-ai';
-import { Headers } from 'honcho-ai/core';
+import Honcho from 'honcho';
+import { APIUserAbortError } from 'honcho';
+import { Headers } from 'honcho/core';
import defaultFetch, { Response, type RequestInit, type RequestInfo } from 'node-fetch';
describe('instantiate client', () => {
diff --git a/tests/responses.test.ts b/tests/responses.test.ts
index d037c23..cc29ab0 100644
--- a/tests/responses.test.ts
+++ b/tests/responses.test.ts
@@ -1,5 +1,5 @@
-import { createResponseHeaders } from 'honcho-ai/core';
-import { Headers } from 'honcho-ai/_shims/index';
+import { createResponseHeaders } from 'honcho/core';
+import { Headers } from 'honcho/_shims/index';
describe('response parsing', () => {
// TODO: test unicode characters
diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts
index 467dc37..d951599 100644
--- a/tests/stringifyQuery.test.ts
+++ b/tests/stringifyQuery.test.ts
@@ -1,6 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import { Honcho } from 'honcho-ai';
+import { Honcho } from 'honcho';
const { stringifyQuery } = Honcho.prototype as any;
diff --git a/tests/uploads.test.ts b/tests/uploads.test.ts
index 403ba13..2a0facb 100644
--- a/tests/uploads.test.ts
+++ b/tests/uploads.test.ts
@@ -1,6 +1,6 @@
import fs from 'fs';
-import { toFile, type ResponseLike } from 'honcho-ai/uploads';
-import { File } from 'honcho-ai/_shims/index';
+import { toFile, type ResponseLike } from 'honcho/uploads';
+import { File } from 'honcho/_shims/index';
class MyClass {
name: string = 'foo';
diff --git a/tsconfig.build.json b/tsconfig.build.json
index 17390a4..1837cdb 100644
--- a/tsconfig.build.json
+++ b/tsconfig.build.json
@@ -5,8 +5,8 @@
"compilerOptions": {
"rootDir": "./dist/src",
"paths": {
- "honcho-ai/*": ["dist/src/*"],
- "honcho-ai": ["dist/src/index.ts"],
+ "honcho/*": ["dist/src/*"],
+ "honcho": ["dist/src/index.ts"],
},
"noEmit": false,
"declaration": true,
diff --git a/tsconfig.deno.json b/tsconfig.deno.json
index ea3e86c..5c37192 100644
--- a/tsconfig.deno.json
+++ b/tsconfig.deno.json
@@ -6,9 +6,9 @@
"rootDir": "./deno",
"lib": ["es2020", "DOM"],
"paths": {
- "honcho-ai/_shims/auto/*": ["deno/_shims/auto/*-deno"],
- "honcho-ai/*": ["deno/*"],
- "honcho-ai": ["deno/index.ts"],
+ "honcho/_shims/auto/*": ["deno/_shims/auto/*-deno"],
+ "honcho/*": ["deno/*"],
+ "honcho": ["deno/index.ts"],
},
"noEmit": true,
"declaration": true,
diff --git a/tsconfig.json b/tsconfig.json
index 2665dd2..de575dc 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -9,9 +9,9 @@
"esModuleInterop": true,
"baseUrl": "./",
"paths": {
- "honcho-ai/_shims/auto/*": ["src/_shims/auto/*-node"],
- "honcho-ai/*": ["src/*"],
- "honcho-ai": ["src/index.ts"],
+ "honcho/_shims/auto/*": ["src/_shims/auto/*-node"],
+ "honcho/*": ["src/*"],
+ "honcho": ["src/index.ts"],
},
"noEmit": true,
From d937f2dc21350a2f04f4385fc0e42b93c2f9acc2 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 10 Oct 2024 02:21:51 +0000
Subject: [PATCH 08/11] feat(api): api update (#42)
---
.stats.yml | 2 +-
api.md | 7 ++-
src/resources/apps/users/index.ts | 5 +-
src/resources/apps/users/metamessages.ts | 13 -----
src/resources/apps/users/sessions/index.ts | 3 ++
src/resources/apps/users/sessions/sessions.ts | 45 +++++++++++++++++
src/resources/apps/users/users.ts | 4 +-
.../apps/users/sessions/sessions.test.ts | 50 +++++++++++++++++++
8 files changed, 109 insertions(+), 20 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index d0bac8d..c385371 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 36
+configured_endpoints: 38
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-d259b106accde65e100275c3eee2d01d0b91792abc0e67ae807dae74fb32f4de.yml
diff --git a/api.md b/api.md
index fe4ea4f..8d265da 100644
--- a/api.md
+++ b/api.md
@@ -30,10 +30,6 @@ Methods:
### Metamessages
-Types:
-
-- PageMetamessage
-
Methods:
- client.apps.users.metamessages.list(appId, userId, { ...params }) -> MetamessagesPage
@@ -46,6 +42,7 @@ Types:
- PageSession
- Session
- SessionDeleteResponse
+- SessionStreamResponse
Methods:
@@ -53,7 +50,9 @@ Methods:
- client.apps.users.sessions.update(appId, userId, sessionId, { ...params }) -> Session
- client.apps.users.sessions.list(appId, userId, { ...params }) -> SessionsPage
- client.apps.users.sessions.delete(appId, userId, sessionId) -> unknown
+- client.apps.users.sessions.chat(appId, userId, sessionId, { ...params }) -> AgentChat
- client.apps.users.sessions.get(appId, userId, sessionId) -> Session
+- client.apps.users.sessions.stream(appId, userId, sessionId, { ...params }) -> unknown
#### Messages
diff --git a/src/resources/apps/users/index.ts b/src/resources/apps/users/index.ts
index b3f0f6a..c9036ce 100644
--- a/src/resources/apps/users/index.ts
+++ b/src/resources/apps/users/index.ts
@@ -5,9 +5,12 @@ export {
PageSession,
Session,
SessionDeleteResponse,
+ SessionStreamResponse,
SessionCreateParams,
SessionUpdateParams,
SessionListParams,
+ SessionChatParams,
+ SessionStreamParams,
SessionsPage,
Sessions,
} from './sessions/index';
@@ -21,7 +24,7 @@ export {
CollectionsPage,
Collections,
} from './collections/index';
-export { PageMetamessage, MetamessageListParams, Metamessages } from './metamessages';
+export { MetamessageListParams, Metamessages } from './metamessages';
export {
PageUser,
User,
diff --git a/src/resources/apps/users/metamessages.ts b/src/resources/apps/users/metamessages.ts
index 1ee1554..b999ccb 100644
--- a/src/resources/apps/users/metamessages.ts
+++ b/src/resources/apps/users/metamessages.ts
@@ -47,18 +47,6 @@ export class Metamessages extends APIResource {
}
}
-export interface PageMetamessage {
- items: Array;
-
- page: number;
-
- size: number;
-
- total: number;
-
- pages?: number;
-}
-
export interface MetamessageListParams extends PageParams {
filter?: string | null;
@@ -68,7 +56,6 @@ export interface MetamessageListParams extends PageParams {
}
export namespace Metamessages {
- export import PageMetamessage = MetamessagesAPI.PageMetamessage;
export import MetamessageListParams = MetamessagesAPI.MetamessageListParams;
}
diff --git a/src/resources/apps/users/sessions/index.ts b/src/resources/apps/users/sessions/index.ts
index d72bc29..4580149 100644
--- a/src/resources/apps/users/sessions/index.ts
+++ b/src/resources/apps/users/sessions/index.ts
@@ -5,9 +5,12 @@ export {
PageSession,
Session,
SessionDeleteResponse,
+ SessionStreamResponse,
SessionCreateParams,
SessionUpdateParams,
SessionListParams,
+ SessionChatParams,
+ SessionStreamParams,
SessionsPage,
Sessions,
} from './sessions';
diff --git a/src/resources/apps/users/sessions/sessions.ts b/src/resources/apps/users/sessions/sessions.ts
index ce5ade7..67da642 100644
--- a/src/resources/apps/users/sessions/sessions.ts
+++ b/src/resources/apps/users/sessions/sessions.ts
@@ -102,6 +102,22 @@ export class Sessions extends APIResource {
return this._client.delete(`/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
}
+ /**
+ * Chat
+ */
+ chat(
+ appId: string,
+ userId: string,
+ sessionId: string,
+ body: SessionChatParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat`, {
+ body,
+ ...options,
+ });
+ }
+
/**
* Get a specific session for a user by ID
*
@@ -121,6 +137,22 @@ export class Sessions extends APIResource {
): Core.APIPromise {
return this._client.get(`/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
}
+
+ /**
+ * Get Chat Stream
+ */
+ stream(
+ appId: string,
+ userId: string,
+ sessionId: string,
+ body: SessionStreamParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat/stream`, {
+ body,
+ ...options,
+ });
+ }
}
export class SessionsPage extends Page {}
@@ -155,6 +187,8 @@ export interface Session {
export type SessionDeleteResponse = unknown;
+export type SessionStreamResponse = unknown;
+
export interface SessionCreateParams {
metadata?: Record | null;
}
@@ -171,15 +205,26 @@ export interface SessionListParams extends PageParams {
reverse?: boolean | null;
}
+export interface SessionChatParams {
+ queries: string | Array;
+}
+
+export interface SessionStreamParams {
+ queries: string | Array;
+}
+
export namespace Sessions {
export import AgentChat = SessionsAPI.AgentChat;
export import PageSession = SessionsAPI.PageSession;
export import Session = SessionsAPI.Session;
export import SessionDeleteResponse = SessionsAPI.SessionDeleteResponse;
+ export import SessionStreamResponse = SessionsAPI.SessionStreamResponse;
export import SessionsPage = SessionsAPI.SessionsPage;
export import SessionCreateParams = SessionsAPI.SessionCreateParams;
export import SessionUpdateParams = SessionsAPI.SessionUpdateParams;
export import SessionListParams = SessionsAPI.SessionListParams;
+ export import SessionChatParams = SessionsAPI.SessionChatParams;
+ export import SessionStreamParams = SessionsAPI.SessionStreamParams;
export import Messages = MessagesAPI.Messages;
export import Message = MessagesAPI.Message;
export import PageMessage = MessagesAPI.PageMessage;
diff --git a/src/resources/apps/users/users.ts b/src/resources/apps/users/users.ts
index 24432f0..0655e15 100644
--- a/src/resources/apps/users/users.ts
+++ b/src/resources/apps/users/users.ts
@@ -161,17 +161,19 @@ export namespace Users {
export import UserUpdateParams = UsersAPI.UserUpdateParams;
export import UserListParams = UsersAPI.UserListParams;
export import Metamessages = MetamessagesAPI.Metamessages;
- export import PageMetamessage = MetamessagesAPI.PageMetamessage;
export import MetamessageListParams = MetamessagesAPI.MetamessageListParams;
export import Sessions = SessionsAPI.Sessions;
export import AgentChat = SessionsAPI.AgentChat;
export import PageSession = SessionsAPI.PageSession;
export import Session = SessionsAPI.Session;
export import SessionDeleteResponse = SessionsAPI.SessionDeleteResponse;
+ export import SessionStreamResponse = SessionsAPI.SessionStreamResponse;
export import SessionsPage = SessionsAPI.SessionsPage;
export import SessionCreateParams = SessionsAPI.SessionCreateParams;
export import SessionUpdateParams = SessionsAPI.SessionUpdateParams;
export import SessionListParams = SessionsAPI.SessionListParams;
+ export import SessionChatParams = SessionsAPI.SessionChatParams;
+ export import SessionStreamParams = SessionsAPI.SessionStreamParams;
export import Collections = CollectionsAPI.Collections;
export import Collection = CollectionsAPI.Collection;
export import PageCollection = CollectionsAPI.PageCollection;
diff --git a/tests/api-resources/apps/users/sessions/sessions.test.ts b/tests/api-resources/apps/users/sessions/sessions.test.ts
index 8f81a68..458bf61 100644
--- a/tests/api-resources/apps/users/sessions/sessions.test.ts
+++ b/tests/api-resources/apps/users/sessions/sessions.test.ts
@@ -104,6 +104,31 @@ describe('resource sessions', () => {
).rejects.toThrow(Honcho.NotFoundError);
});
+ test('chat: only required params', async () => {
+ const responsePromise = client.apps.users.sessions.chat(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { queries: 'string' },
+ );
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('chat: required and optional params', async () => {
+ const response = await client.apps.users.sessions.chat(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { queries: 'string' },
+ );
+ });
+
test('get', async () => {
const responsePromise = client.apps.users.sessions.get(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
@@ -130,4 +155,29 @@ describe('resource sessions', () => {
),
).rejects.toThrow(Honcho.NotFoundError);
});
+
+ test('stream: only required params', async () => {
+ const responsePromise = client.apps.users.sessions.stream(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { queries: 'string' },
+ );
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('stream: required and optional params', async () => {
+ const response = await client.apps.users.sessions.stream(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { queries: 'string' },
+ );
+ });
});
From 4094526e55badf52050a5d486d7583ca2f489753 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Thu, 10 Oct 2024 02:26:55 +0000
Subject: [PATCH 09/11] feat(api): api update (#43)
---
.stats.yml | 2 +-
api.md | 2 ++
.../apps/users/collections/collections.ts | 2 ++
.../apps/users/collections/documents.ts | 28 +++++++++++++++++++
src/resources/apps/users/collections/index.ts | 2 ++
.../apps/users/collections/documents.test.ts | 25 +++++++++++++++++
6 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/.stats.yml b/.stats.yml
index c385371..f37c12c 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 38
+configured_endpoints: 39
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-d259b106accde65e100275c3eee2d01d0b91792abc0e67ae807dae74fb32f4de.yml
diff --git a/api.md b/api.md
index 8d265da..34d4c5d 100644
--- a/api.md
+++ b/api.md
@@ -106,6 +106,7 @@ Types:
- Document
- PageDocument
- DocumentDeleteResponse
+- DocumentQueryResponse
Methods:
@@ -114,3 +115,4 @@ Methods:
- client.apps.users.collections.documents.list(appId, userId, collectionId, { ...params }) -> DocumentsPage
- client.apps.users.collections.documents.delete(appId, userId, collectionId, documentId) -> unknown
- client.apps.users.collections.documents.get(appId, userId, collectionId, documentId) -> Document
+- client.apps.users.collections.documents.query(appId, userId, collectionId, { ...params }) -> DocumentQueryResponse
diff --git a/src/resources/apps/users/collections/collections.ts b/src/resources/apps/users/collections/collections.ts
index 5251c42..4d44468 100644
--- a/src/resources/apps/users/collections/collections.ts
+++ b/src/resources/apps/users/collections/collections.ts
@@ -168,8 +168,10 @@ export namespace Collections {
export import Document = DocumentsAPI.Document;
export import PageDocument = DocumentsAPI.PageDocument;
export import DocumentDeleteResponse = DocumentsAPI.DocumentDeleteResponse;
+ export import DocumentQueryResponse = DocumentsAPI.DocumentQueryResponse;
export import DocumentsPage = DocumentsAPI.DocumentsPage;
export import DocumentCreateParams = DocumentsAPI.DocumentCreateParams;
export import DocumentUpdateParams = DocumentsAPI.DocumentUpdateParams;
export import DocumentListParams = DocumentsAPI.DocumentListParams;
+ export import DocumentQueryParams = DocumentsAPI.DocumentQueryParams;
}
diff --git a/src/resources/apps/users/collections/documents.ts b/src/resources/apps/users/collections/documents.ts
index a89863f..50bb5e3 100644
--- a/src/resources/apps/users/collections/documents.ts
+++ b/src/resources/apps/users/collections/documents.ts
@@ -104,6 +104,22 @@ export class Documents extends APIResource {
options,
);
}
+
+ /**
+ * Query Documents
+ */
+ query(
+ appId: string,
+ userId: string,
+ collectionId: string,
+ query: DocumentQueryParams,
+ options?: Core.RequestOptions,
+ ): Core.APIPromise {
+ return this._client.get(`/apps/${appId}/users/${userId}/collections/${collectionId}/documents/query`, {
+ query,
+ ...options,
+ });
+ }
}
export class DocumentsPage extends Page {}
@@ -134,6 +150,8 @@ export interface PageDocument {
export type DocumentDeleteResponse = unknown;
+export type DocumentQueryResponse = Array;
+
export interface DocumentCreateParams {
content: string;
@@ -152,12 +170,22 @@ export interface DocumentListParams extends PageParams {
reverse?: boolean | null;
}
+export interface DocumentQueryParams {
+ query: string;
+
+ filter?: string | null;
+
+ top_k?: number;
+}
+
export namespace Documents {
export import Document = DocumentsAPI.Document;
export import PageDocument = DocumentsAPI.PageDocument;
export import DocumentDeleteResponse = DocumentsAPI.DocumentDeleteResponse;
+ export import DocumentQueryResponse = DocumentsAPI.DocumentQueryResponse;
export import DocumentsPage = DocumentsAPI.DocumentsPage;
export import DocumentCreateParams = DocumentsAPI.DocumentCreateParams;
export import DocumentUpdateParams = DocumentsAPI.DocumentUpdateParams;
export import DocumentListParams = DocumentsAPI.DocumentListParams;
+ export import DocumentQueryParams = DocumentsAPI.DocumentQueryParams;
}
diff --git a/src/resources/apps/users/collections/index.ts b/src/resources/apps/users/collections/index.ts
index 8362151..59af63b 100644
--- a/src/resources/apps/users/collections/index.ts
+++ b/src/resources/apps/users/collections/index.ts
@@ -14,9 +14,11 @@ export {
Document,
PageDocument,
DocumentDeleteResponse,
+ DocumentQueryResponse,
DocumentCreateParams,
DocumentUpdateParams,
DocumentListParams,
+ DocumentQueryParams,
DocumentsPage,
Documents,
} from './documents';
diff --git a/tests/api-resources/apps/users/collections/documents.test.ts b/tests/api-resources/apps/users/collections/documents.test.ts
index db6c165..5422441 100644
--- a/tests/api-resources/apps/users/collections/documents.test.ts
+++ b/tests/api-resources/apps/users/collections/documents.test.ts
@@ -148,4 +148,29 @@ describe('resource documents', () => {
),
).rejects.toThrow(Honcho.NotFoundError);
});
+
+ test('query: only required params', async () => {
+ const responsePromise = client.apps.users.collections.documents.query(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { query: 'query' },
+ );
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('query: required and optional params', async () => {
+ const response = await client.apps.users.collections.documents.query(
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ { query: 'query', filter: 'filter', top_k: 0 },
+ );
+ });
});
From f36f035b23769442fc8cb9102654d6494e1119a1 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 21 Oct 2024 19:31:30 +0000
Subject: [PATCH 10/11] feat(api): api update (#44)
---
.stats.yml | 2 +-
CONTRIBUTING.md | 46 +++----
README.md | 35 +-----
api.md | 78 ++++++------
package.json | 1 +
src/_shims/node-types.d.ts | 2 +-
src/core.ts | 42 +++++--
src/resources/apps/apps.ts | 18 +--
.../apps/users/collections/collections.ts | 49 ++++----
.../apps/users/collections/documents.ts | 44 +++----
src/resources/apps/users/metamessages.ts | 45 ++++---
src/resources/apps/users/sessions/messages.ts | 56 ++++-----
.../apps/users/sessions/metamessages.ts | 68 +++++-----
src/resources/apps/users/sessions/sessions.ts | 79 ++++++------
src/resources/apps/users/users.ts | 71 ++++++-----
tests/api-resources/apps/apps.test.ts | 10 +-
.../users/collections/collections.test.ts | 95 +++-----------
.../apps/users/collections/documents.test.ts | 100 +++++----------
.../apps/users/metamessages.test.ts | 28 +----
.../apps/users/sessions/messages.test.ts | 78 ++++--------
.../apps/users/sessions/metamessages.test.ts | 112 +++++------------
.../apps/users/sessions/sessions.test.ts | 105 ++++------------
tests/api-resources/apps/users/users.test.ts | 56 ++-------
tests/index.test.ts | 116 ++++++++++++++++++
yarn.lock | 12 ++
25 files changed, 573 insertions(+), 775 deletions(-)
diff --git a/.stats.yml b/.stats.yml
index f37c12c..b37ef5d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 39
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-d259b106accde65e100275c3eee2d01d0b91792abc0e67ae807dae74fb32f4de.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2Fhoncho-3b94ec668fd95755a2447237b113b61d5c82e62960832d065e8a6f06a1916286.yml
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e508f2b..bea6750 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -5,9 +5,9 @@ Other package managers may work but are not officially supported for development
To set up the repository, run:
-```bash
-yarn
-yarn build
+```sh
+$ yarn
+$ yarn build
```
This will install all the required dependencies and build output files to `dist/`.
@@ -22,7 +22,7 @@ modify the contents of the `src/lib/` and `examples/` directories.
All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
-```bash
+```ts
// add an example to examples/.ts
#!/usr/bin/env -S npm run tsn -T
@@ -41,38 +41,38 @@ If you’d like to use the repository from source, you can either install from g
To install via git:
-```bash
-npm install git+ssh://git@github.com:plastic-labs/honcho-node.git
+```sh
+$ npm install git+ssh://git@github.com:plastic-labs/honcho-node.git
```
Alternatively, to link a local copy of the repo:
-```bash
+```sh
# Clone
-git clone https://www.github.com/plastic-labs/honcho-node
-cd honcho-node
+$ git clone https://www.github.com/plastic-labs/honcho-node
+$ cd honcho-node
# With yarn
-yarn link
-cd ../my-package
-yarn link honcho
+$ yarn link
+$ cd ../my-package
+$ yarn link honcho
# With pnpm
-pnpm link --global
-cd ../my-package
-pnpm link -—global honcho
+$ pnpm link --global
+$ cd ../my-package
+$ pnpm link -—global honcho
```
## Running tests
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
-```bash
-npx prism mock path/to/your/openapi.yml
+```sh
+$ npx prism mock path/to/your/openapi.yml
```
-```bash
-yarn run test
+```sh
+$ yarn run test
```
## Linting and formatting
@@ -82,14 +82,14 @@ This repository uses [prettier](https://www.npmjs.com/package/prettier) and
To lint:
-```bash
-yarn lint
+```sh
+$ yarn lint
```
To format and fix all lint issues automatically:
-```bash
-yarn fix
+```sh
+$ yarn fix
```
## Publishing and releases
diff --git a/README.md b/README.md
index 96b9490..ec444ca 100644
--- a/README.md
+++ b/README.md
@@ -137,37 +137,6 @@ On timeout, an `APIConnectionTimeoutError` is thrown.
Note that requests which time out will be [retried twice by default](#retries).
-## Auto-pagination
-
-List methods in the Honcho API are paginated.
-You can use `for await … of` syntax to iterate through items across all pages:
-
-```ts
-async function fetchAllAppsUsers(params) {
- const allAppsUsers = [];
- // Automatically fetches more pages as needed.
- for await (const user of client.apps.users.list('REPLACE_ME')) {
- allAppsUsers.push(user);
- }
- return allAppsUsers;
-}
-```
-
-Alternatively, you can make request a single page at a time:
-
-```ts
-let page = await client.apps.users.list('REPLACE_ME');
-for (const user of page.items) {
- console.log(user);
-}
-
-// Convenience methods are provided for manually paginating:
-while (page.hasNextPage()) {
- page = page.getNextPage();
- // ...
-}
-```
-
## Advanced Usage
### Accessing raw Response data (e.g., headers)
@@ -319,3 +288,7 @@ The following runtimes are supported:
Note that React Native is not supported at this time.
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
+
+## Contributing
+
+See [the contributing documentation](./CONTRIBUTING.md).
diff --git a/api.md b/api.md
index 34d4c5d..94d7ada 100644
--- a/api.md
+++ b/api.md
@@ -6,11 +6,11 @@ Types:
Methods:
-- client.apps.create({ ...params }) -> App
-- client.apps.update(appId, { ...params }) -> App
-- client.apps.get(appId) -> App
-- client.apps.getByName(name) -> App
-- client.apps.getOrCreate(name) -> App
+- client.apps.create({ ...params }) -> App
+- client.apps.update(appId, { ...params }) -> App
+- client.apps.get(appId) -> App
+- client.apps.getByName(name) -> App
+- client.apps.getOrCreate(name) -> App
## Users
@@ -21,18 +21,18 @@ Types:
Methods:
-- client.apps.users.create(appId, { ...params }) -> User
-- client.apps.users.update(appId, userId, { ...params }) -> User
-- client.apps.users.list(appId, { ...params }) -> UsersPage
-- client.apps.users.get(appId, userId) -> User
-- client.apps.users.getByName(appId, name) -> User
-- client.apps.users.getOrCreate(appId, name) -> User
+- client.apps.users.create(appId, { ...params }) -> User
+- client.apps.users.update(appId, userId, { ...params }) -> User
+- client.apps.users.list(appId, { ...params }) -> UsersPage
+- client.apps.users.get(appId, userId) -> User
+- client.apps.users.getByName(appId, name) -> User
+- client.apps.users.getOrCreate(appId, name) -> User
### Metamessages
Methods:
-- client.apps.users.metamessages.list(appId, userId, { ...params }) -> MetamessagesPage
+- client.apps.users.metamessages.list(appId, userId, { ...params }) -> MetamessagesPage
### Sessions
@@ -46,13 +46,13 @@ Types:
Methods:
-- client.apps.users.sessions.create(appId, userId, { ...params }) -> Session
-- client.apps.users.sessions.update(appId, userId, sessionId, { ...params }) -> Session
-- client.apps.users.sessions.list(appId, userId, { ...params }) -> SessionsPage
-- client.apps.users.sessions.delete(appId, userId, sessionId) -> unknown
-- client.apps.users.sessions.chat(appId, userId, sessionId, { ...params }) -> AgentChat
-- client.apps.users.sessions.get(appId, userId, sessionId) -> Session
-- client.apps.users.sessions.stream(appId, userId, sessionId, { ...params }) -> unknown
+- client.apps.users.sessions.create(appId, userId, { ...params }) -> Session
+- client.apps.users.sessions.update(appId, userId, sessionId, { ...params }) -> Session
+- client.apps.users.sessions.list(appId, userId, { ...params }) -> SessionsPage
+- client.apps.users.sessions.delete(appId, userId, sessionId) -> unknown
+- client.apps.users.sessions.chat(appId, userId, sessionId, { ...params }) -> AgentChat
+- client.apps.users.sessions.get(appId, userId, sessionId) -> Session
+- client.apps.users.sessions.stream(appId, userId, sessionId, { ...params }) -> unknown
#### Messages
@@ -63,10 +63,10 @@ Types:
Methods:
-- client.apps.users.sessions.messages.create(appId, userId, sessionId, { ...params }) -> Message
-- client.apps.users.sessions.messages.update(appId, userId, sessionId, messageId, { ...params }) -> Message
-- client.apps.users.sessions.messages.list(appId, userId, sessionId, { ...params }) -> MessagesPage
-- client.apps.users.sessions.messages.get(appId, userId, sessionId, messageId) -> Message
+- client.apps.users.sessions.messages.create(appId, userId, sessionId, { ...params }) -> Message
+- client.apps.users.sessions.messages.update(appId, userId, sessionId, messageId, { ...params }) -> Message
+- client.apps.users.sessions.messages.list(appId, userId, sessionId, { ...params }) -> MessagesPage
+- client.apps.users.sessions.messages.get(appId, userId, sessionId, messageId) -> Message
#### Metamessages
@@ -77,10 +77,10 @@ Types:
Methods:
-- client.apps.users.sessions.metamessages.create(appId, userId, sessionId, { ...params }) -> Metamessage
-- client.apps.users.sessions.metamessages.update(appId, userId, sessionId, metamessageId, { ...params }) -> Metamessage
-- client.apps.users.sessions.metamessages.list(appId, userId, sessionId, { ...params }) -> MetamessagesPage
-- client.apps.users.sessions.metamessages.get(appId, userId, sessionId, metamessageId, { ...params }) -> Metamessage
+- client.apps.users.sessions.metamessages.create(appId, userId, sessionId, { ...params }) -> Metamessage
+- client.apps.users.sessions.metamessages.update(appId, userId, sessionId, metamessageId, { ...params }) -> Metamessage
+- client.apps.users.sessions.metamessages.list(appId, userId, sessionId, { ...params }) -> MetamessagesPage
+- client.apps.users.sessions.metamessages.get(appId, userId, sessionId, metamessageId, { ...params }) -> Metamessage
### Collections
@@ -92,12 +92,12 @@ Types:
Methods:
-- client.apps.users.collections.create(appId, userId, { ...params }) -> Collection
-- client.apps.users.collections.update(appId, userId, collectionId, { ...params }) -> Collection
-- client.apps.users.collections.list(appId, userId, { ...params }) -> CollectionsPage
-- client.apps.users.collections.delete(appId, userId, collectionId) -> unknown
-- client.apps.users.collections.get(appId, userId, collectionId) -> Collection
-- client.apps.users.collections.getByName(appId, userId, name) -> Collection
+- client.apps.users.collections.create(appId, userId, { ...params }) -> Collection
+- client.apps.users.collections.update(appId, userId, collectionId, { ...params }) -> Collection
+- client.apps.users.collections.list(appId, userId, { ...params }) -> CollectionsPage
+- client.apps.users.collections.delete(appId, userId, collectionId) -> unknown
+- client.apps.users.collections.get(appId, userId, collectionId) -> Collection
+- client.apps.users.collections.getByName(appId, userId, name) -> Collection
#### Documents
@@ -110,9 +110,9 @@ Types:
Methods:
-- client.apps.users.collections.documents.create(appId, userId, collectionId, { ...params }) -> Document
-- client.apps.users.collections.documents.update(appId, userId, collectionId, documentId, { ...params }) -> Document
-- client.apps.users.collections.documents.list(appId, userId, collectionId, { ...params }) -> DocumentsPage
-- client.apps.users.collections.documents.delete(appId, userId, collectionId, documentId) -> unknown
-- client.apps.users.collections.documents.get(appId, userId, collectionId, documentId) -> Document
-- client.apps.users.collections.documents.query(appId, userId, collectionId, { ...params }) -> DocumentQueryResponse
+- client.apps.users.collections.documents.create(appId, userId, collectionId, { ...params }) -> Document
+- client.apps.users.collections.documents.update(appId, userId, collectionId, documentId, { ...params }) -> Document
+- client.apps.users.collections.documents.list(appId, userId, collectionId, { ...params }) -> DocumentsPage
+- client.apps.users.collections.documents.delete(appId, userId, collectionId, documentId) -> unknown
+- client.apps.users.collections.documents.get(appId, userId, collectionId, documentId) -> Document
+- client.apps.users.collections.documents.query(appId, userId, collectionId, { ...params }) -> DocumentQueryResponse
diff --git a/package.json b/package.json
index 557b1bb..c313376 100644
--- a/package.json
+++ b/package.json
@@ -41,6 +41,7 @@
"eslint": "^8.49.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unused-imports": "^3.0.0",
+ "iconv-lite": "^0.6.3",
"jest": "^29.4.0",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
diff --git a/src/_shims/node-types.d.ts b/src/_shims/node-types.d.ts
index b31698f..c159e5f 100644
--- a/src/_shims/node-types.d.ts
+++ b/src/_shims/node-types.d.ts
@@ -7,7 +7,7 @@ import * as fd from 'formdata-node';
export { type Agent } from 'node:http';
export { type Readable } from 'node:stream';
export { type ReadStream as FsReadStream } from 'node:fs';
-export { ReadableStream } from 'web-streams-polyfill';
+export { ReadableStream } from 'node:stream/web';
export const fetch: typeof nf.default;
diff --git a/src/core.ts b/src/core.ts
index 2389e75..4215121 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -84,8 +84,10 @@ export class APIPromise extends Promise {
});
}
- _thenUnwrap(transform: (data: T) => U): APIPromise {
- return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props)));
+ _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise {
+ return new APIPromise(this.responsePromise, async (props) =>
+ transform(await this.parseResponse(props), props),
+ );
}
/**
@@ -274,7 +276,10 @@ export abstract class APIClient {
return null;
}
- buildRequest(options: FinalRequestOptions): { req: RequestInit; url: string; timeout: number } {
+ buildRequest(
+ options: FinalRequestOptions,
+ { retryCount = 0 }: { retryCount?: number } = {},
+ ): { req: RequestInit; url: string; timeout: number } {
const { method, path, query, headers: headers = {} } = options;
const body =
@@ -306,7 +311,7 @@ export abstract class APIClient {
headers[this.idempotencyHeader] = options.idempotencyKey;
}
- const reqHeaders = this.buildHeaders({ options, headers, contentLength });
+ const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount });
const req: RequestInit = {
method,
@@ -325,10 +330,12 @@ export abstract class APIClient {
options,
headers,
contentLength,
+ retryCount,
}: {
options: FinalRequestOptions;
headers: Record;
contentLength: string | null | undefined;
+ retryCount: number;
}): Record {
const reqHeaders: Record = {};
if (contentLength) {
@@ -344,6 +351,16 @@ export abstract class APIClient {
delete reqHeaders['content-type'];
}
+ // Don't set the retry count header if it was already set or removed through default headers or by the
+ // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
+ // account for the removal case.
+ if (
+ getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
+ getHeader(headers, 'x-stainless-retry-count') === undefined
+ ) {
+ reqHeaders['x-stainless-retry-count'] = String(retryCount);
+ }
+
this.validateHeaders(reqHeaders, headers);
return reqHeaders;
@@ -395,13 +412,14 @@ export abstract class APIClient {
retriesRemaining: number | null,
): Promise {
const options = await optionsInput;
+ const maxRetries = options.maxRetries ?? this.maxRetries;
if (retriesRemaining == null) {
- retriesRemaining = options.maxRetries ?? this.maxRetries;
+ retriesRemaining = maxRetries;
}
await this.prepareOptions(options);
- const { req, url, timeout } = this.buildRequest(options);
+ const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining });
await this.prepareRequest(req, { url, options });
@@ -1120,7 +1138,15 @@ export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => {
return typeof headers?.get === 'function';
};
-export const getRequiredHeader = (headers: HeadersLike, header: string): string => {
+export const getRequiredHeader = (headers: HeadersLike | Headers, header: string): string => {
+ const foundHeader = getHeader(headers, header);
+ if (foundHeader === undefined) {
+ throw new Error(`Could not find ${header} header`);
+ }
+ return foundHeader;
+};
+
+export const getHeader = (headers: HeadersLike | Headers, header: string): string | undefined => {
const lowerCasedHeader = header.toLowerCase();
if (isHeadersProtocol(headers)) {
// to deal with the case where the header looks like Stainless-Event-Id
@@ -1146,7 +1172,7 @@ export const getRequiredHeader = (headers: HeadersLike, header: string): string
}
}
- throw new Error(`Could not find ${header} header`);
+ return undefined;
};
/**
diff --git a/src/resources/apps/apps.ts b/src/resources/apps/apps.ts
index 4a2e929..9b3ab8a 100644
--- a/src/resources/apps/apps.ts
+++ b/src/resources/apps/apps.ts
@@ -16,30 +16,30 @@ export class Apps extends APIResource {
* Returns: schemas.App: Created App object
*/
create(body: AppCreateParams, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.post('/apps', { body, ...options });
+ return this._client.post('/v1/apps', { body, ...options });
}
/**
* Update an App
*
- * Args: app_id (uuid.UUID): The ID of the app to update app (schemas.AppUpdate):
- * The App object containing any new metadata
+ * Args: app_id (str): The ID of the app to update app (schemas.AppUpdate): The App
+ * object containing any new metadata
*
* Returns: schemas.App: The App object of the updated App
*/
update(appId: string, body: AppUpdateParams, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.put(`/apps/${appId}`, { body, ...options });
+ return this._client.put(`/v1/apps/${appId}`, { body, ...options });
}
/**
* Get an App by ID
*
- * Args: app_id (uuid.UUID): The ID of the app
+ * Args: app_id (str): The ID of the app
*
* Returns: schemas.App: App object
*/
get(appId: string, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.get(`/apps/${appId}`, options);
+ return this._client.get(`/v1/apps/${appId}`, options);
}
/**
@@ -50,7 +50,7 @@ export class Apps extends APIResource {
* Returns: schemas.App: App object
*/
getByName(name: string, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.get(`/apps/name/${name}`, options);
+ return this._client.get(`/v1/apps/name/${name}`, options);
}
/**
@@ -61,7 +61,7 @@ export class Apps extends APIResource {
* Returns: schemas.App: App object
*/
getOrCreate(name: string, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.get(`/apps/get_or_create/${name}`, options);
+ return this._client.get(`/v1/apps/get_or_create/${name}`, options);
}
}
@@ -78,7 +78,7 @@ export interface App {
export interface AppCreateParams {
name: string;
- metadata?: Record | null;
+ metadata?: Record;
}
export interface AppUpdateParams {
diff --git a/src/resources/apps/users/collections/collections.ts b/src/resources/apps/users/collections/collections.ts
index 4d44468..1b9f629 100644
--- a/src/resources/apps/users/collections/collections.ts
+++ b/src/resources/apps/users/collections/collections.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../../resource';
-import { isRequestOptions } from '../../../../core';
import * as Core from '../../../../core';
import * as CollectionsAPI from './collections';
import * as DocumentsAPI from './documents';
@@ -19,7 +18,7 @@ export class Collections extends APIResource {
body: CollectionCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/collections`, { body, ...options });
+ return this._client.post(`/v1/apps/${appId}/users/${userId}/collections`, { body, ...options });
}
/**
@@ -32,7 +31,7 @@ export class Collections extends APIResource {
body: CollectionUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.put(`/apps/${appId}/users/${userId}/collections/${collectionId}`, {
+ return this._client.put(`/v1/apps/${appId}/users/${userId}/collections/${collectionId}`, {
body,
...options,
});
@@ -41,34 +40,22 @@ export class Collections extends APIResource {
/**
* Get All Collections for a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (uuid.UUID): The User ID representing the user, managed by
- * the user
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
*
* Returns: list[schemas.Collection]: List of Collection objects
*/
list(
appId: string,
userId: string,
- query?: CollectionListParams,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- query: CollectionListParams | Core.RequestOptions = {},
+ params: CollectionListParams,
options?: Core.RequestOptions,
): Core.PagePromise {
- if (isRequestOptions(query)) {
- return this.list(appId, userId, {}, query);
- }
- return this._client.getAPIList(`/apps/${appId}/users/${userId}/collections`, CollectionsPage, {
- query,
+ const { page, reverse, size, ...body } = params;
+ return this._client.getAPIList(`/v1/apps/${appId}/users/${userId}/collections/list`, CollectionsPage, {
+ query: { page, reverse, size },
+ body,
+ method: 'post',
...options,
});
}
@@ -82,7 +69,7 @@ export class Collections extends APIResource {
collectionId: string,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.delete(`/apps/${appId}/users/${userId}/collections/${collectionId}`, options);
+ return this._client.delete(`/v1/apps/${appId}/users/${userId}/collections/${collectionId}`, options);
}
/**
@@ -94,7 +81,7 @@ export class Collections extends APIResource {
collectionId: string,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/collections/${collectionId}`, options);
+ return this._client.get(`/v1/apps/${appId}/users/${userId}/collections/${collectionId}`, options);
}
/**
@@ -106,7 +93,7 @@ export class Collections extends APIResource {
name: string,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/collections/name/${name}`, options);
+ return this._client.get(`/v1/apps/${appId}/users/${userId}/collections/name/${name}`, options);
}
}
@@ -151,9 +138,15 @@ export interface CollectionUpdateParams {
}
export interface CollectionListParams extends PageParams {
- filter?: string | null;
-
+ /**
+ * Query param:
+ */
reverse?: boolean | null;
+
+ /**
+ * Body param:
+ */
+ filter?: Record | null;
}
export namespace Collections {
diff --git a/src/resources/apps/users/collections/documents.ts b/src/resources/apps/users/collections/documents.ts
index 50bb5e3..c1d7229 100644
--- a/src/resources/apps/users/collections/documents.ts
+++ b/src/resources/apps/users/collections/documents.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../../resource';
-import { isRequestOptions } from '../../../../core';
import * as Core from '../../../../core';
import * as DocumentsAPI from './documents';
import { Page, type PageParams } from '../../../../pagination';
@@ -17,7 +16,7 @@ export class Documents extends APIResource {
body: DocumentCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/collections/${collectionId}/documents`, {
+ return this._client.post(`/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents`, {
body,
...options,
});
@@ -35,7 +34,7 @@ export class Documents extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise {
return this._client.put(
- `/apps/${appId}/users/${userId}/collections/${collectionId}/documents/${documentId}`,
+ `/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents/${documentId}`,
{ body, ...options },
);
}
@@ -47,29 +46,14 @@ export class Documents extends APIResource {
appId: string,
userId: string,
collectionId: string,
- query?: DocumentListParams,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- collectionId: string,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- collectionId: string,
- query: DocumentListParams | Core.RequestOptions = {},
+ params: DocumentListParams,
options?: Core.RequestOptions,
): Core.PagePromise {
- if (isRequestOptions(query)) {
- return this.list(appId, userId, collectionId, {}, query);
- }
+ const { page, reverse, size, ...body } = params;
return this._client.getAPIList(
- `/apps/${appId}/users/${userId}/collections/${collectionId}/documents`,
+ `/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents/list`,
DocumentsPage,
- { query, ...options },
+ { query: { page, reverse, size }, body, method: 'post', ...options },
);
}
@@ -84,7 +68,7 @@ export class Documents extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise {
return this._client.delete(
- `/apps/${appId}/users/${userId}/collections/${collectionId}/documents/${documentId}`,
+ `/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents/${documentId}`,
options,
);
}
@@ -100,7 +84,7 @@ export class Documents extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise {
return this._client.get(
- `/apps/${appId}/users/${userId}/collections/${collectionId}/documents/${documentId}`,
+ `/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents/${documentId}`,
options,
);
}
@@ -115,7 +99,7 @@ export class Documents extends APIResource {
query: DocumentQueryParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/collections/${collectionId}/documents/query`, {
+ return this._client.get(`/v1/apps/${appId}/users/${userId}/collections/${collectionId}/documents/query`, {
query,
...options,
});
@@ -165,9 +149,15 @@ export interface DocumentUpdateParams {
}
export interface DocumentListParams extends PageParams {
- filter?: string | null;
-
+ /**
+ * Query param:
+ */
reverse?: boolean | null;
+
+ /**
+ * Body param:
+ */
+ filter?: Record | null;
}
export interface DocumentQueryParams {
diff --git a/src/resources/apps/users/metamessages.ts b/src/resources/apps/users/metamessages.ts
index b999ccb..87d004f 100644
--- a/src/resources/apps/users/metamessages.ts
+++ b/src/resources/apps/users/metamessages.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../resource';
-import { isRequestOptions } from '../../../core';
import * as Core from '../../../core';
import * as MetamessagesAPI from './metamessages';
import * as SessionsMetamessagesAPI from './sessions/metamessages';
@@ -12,9 +11,9 @@ export class Metamessages extends APIResource {
/**
* Paginate through the user metamessages for a user
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user reverse (bool): Whether to reverse the order of the metamessages
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * reverse (bool): Whether to reverse the order of the metamessages
*
* Returns: list[schemas.Message]: List of Message objects
*
@@ -23,36 +22,34 @@ export class Metamessages extends APIResource {
list(
appId: string,
userId: string,
- query?: MetamessageListParams,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- query: MetamessageListParams | Core.RequestOptions = {},
+ params: MetamessageListParams,
options?: Core.RequestOptions,
): Core.PagePromise {
- if (isRequestOptions(query)) {
- return this.list(appId, userId, {}, query);
- }
- return this._client.getAPIList(`/apps/${appId}/users/${userId}/metamessages`, MetamessagesPage, {
- query,
+ const { page, reverse, size, ...body } = params;
+ return this._client.getAPIList(`/v1/apps/${appId}/users/${userId}/metamessages/list`, MetamessagesPage, {
+ query: { page, reverse, size },
+ body,
+ method: 'post',
...options,
});
}
}
export interface MetamessageListParams extends PageParams {
- filter?: string | null;
+ /**
+ * Query param:
+ */
+ reverse?: boolean | null;
- metamessage_type?: string | null;
+ /**
+ * Body param:
+ */
+ filter?: Record | null;
- reverse?: boolean | null;
+ /**
+ * Body param:
+ */
+ metamessage_type?: string | null;
}
export namespace Metamessages {
diff --git a/src/resources/apps/users/sessions/messages.ts b/src/resources/apps/users/sessions/messages.ts
index 8387161..0547481 100644
--- a/src/resources/apps/users/sessions/messages.ts
+++ b/src/resources/apps/users/sessions/messages.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../../resource';
-import { isRequestOptions } from '../../../../core';
import * as Core from '../../../../core';
import * as MessagesAPI from './messages';
import { Page, type PageParams } from '../../../../pagination';
@@ -10,9 +9,9 @@ export class Messages extends APIResource {
/**
* Adds a message to a session
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user session_id (int): The ID of the Session to add the message to message
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (int): The ID of the Session to add the message to message
* (schemas.MessageCreate): The Message object to add containing the message
* content and type
*
@@ -27,7 +26,7 @@ export class Messages extends APIResource {
body: MessageCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/messages`, {
+ return this._client.post(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/messages`, {
body,
...options,
});
@@ -44,7 +43,7 @@ export class Messages extends APIResource {
body: MessageUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.put(`/apps/${appId}/users/${userId}/sessions/${sessionId}/messages/${messageId}`, {
+ return this._client.put(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/messages/${messageId}`, {
body,
...options,
});
@@ -53,10 +52,10 @@ export class Messages extends APIResource {
/**
* Get all messages for a session
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user session_id (int): The ID of the Session to retrieve reverse (bool): Whether
- * to reverse the order of the messages
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (int): The ID of the Session to retrieve reverse (bool): Whether to
+ * reverse the order of the messages
*
* Returns: list[schemas.Message]: List of Message objects
*
@@ -66,29 +65,14 @@ export class Messages extends APIResource {
appId: string,
userId: string,
sessionId: string,
- query?: MessageListParams,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- sessionId: string,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- sessionId: string,
- query: MessageListParams | Core.RequestOptions = {},
+ params: MessageListParams,
options?: Core.RequestOptions,
): Core.PagePromise {
- if (isRequestOptions(query)) {
- return this.list(appId, userId, sessionId, {}, query);
- }
+ const { page, reverse, size, ...body } = params;
return this._client.getAPIList(
- `/apps/${appId}/users/${userId}/sessions/${sessionId}/messages`,
+ `/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/messages/list`,
MessagesPage,
- { query, ...options },
+ { query: { page, reverse, size }, body, method: 'post', ...options },
);
}
@@ -103,7 +87,7 @@ export class Messages extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise {
return this._client.get(
- `/apps/${appId}/users/${userId}/sessions/${sessionId}/messages/${messageId}`,
+ `/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/messages/${messageId}`,
options,
);
}
@@ -142,7 +126,7 @@ export interface MessageCreateParams {
is_user: boolean;
- metadata?: Record | null;
+ metadata?: Record;
}
export interface MessageUpdateParams {
@@ -150,9 +134,15 @@ export interface MessageUpdateParams {
}
export interface MessageListParams extends PageParams {
- filter?: string | null;
-
+ /**
+ * Query param:
+ */
reverse?: boolean | null;
+
+ /**
+ * Body param:
+ */
+ filter?: Record | null;
}
export namespace Messages {
diff --git a/src/resources/apps/users/sessions/metamessages.ts b/src/resources/apps/users/sessions/metamessages.ts
index bc9fdbf..92f9e38 100644
--- a/src/resources/apps/users/sessions/metamessages.ts
+++ b/src/resources/apps/users/sessions/metamessages.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../../resource';
-import { isRequestOptions } from '../../../../core';
import * as Core from '../../../../core';
import * as MetamessagesAPI from './metamessages';
import { Page, type PageParams } from '../../../../pagination';
@@ -10,9 +9,9 @@ export class Metamessages extends APIResource {
/**
* Adds a message to a session
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user session_id (int): The ID of the Session to add the message to metamessage
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (int): The ID of the Session to add the message to metamessage
* (schemas.MeteamessageCreate): The metamessage creation object
*
* Returns: schemas.Metamessage: The Metamessage object of the added metamessage
@@ -26,7 +25,7 @@ export class Metamessages extends APIResource {
body: MetamessageCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages`, {
+ return this._client.post(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages`, {
body,
...options,
});
@@ -44,7 +43,7 @@ export class Metamessages extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise {
return this._client.put(
- `/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages/${metamessageId}`,
+ `/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages/${metamessageId}`,
{ body, ...options },
);
}
@@ -52,10 +51,10 @@ export class Metamessages extends APIResource {
/**
* Get all messages for a session
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user session_id (int): The ID of the Session to retrieve reverse (bool): Whether
- * to reverse the order of the metamessages
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (int): The ID of the Session to retrieve reverse (bool): Whether to
+ * reverse the order of the metamessages
*
* Returns: list[schemas.Message]: List of Message objects
*
@@ -65,38 +64,23 @@ export class Metamessages extends APIResource {
appId: string,
userId: string,
sessionId: string,
- query?: MetamessageListParams,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- sessionId: string,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- sessionId: string,
- query: MetamessageListParams | Core.RequestOptions = {},
+ params: MetamessageListParams,
options?: Core.RequestOptions,
): Core.PagePromise {
- if (isRequestOptions(query)) {
- return this.list(appId, userId, sessionId, {}, query);
- }
+ const { page, reverse, size, ...body } = params;
return this._client.getAPIList(
- `/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages`,
+ `/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages/list`,
MetamessagesPage,
- { query, ...options },
+ { query: { page, reverse, size }, body, method: 'post', ...options },
);
}
/**
* Get a specific Metamessage by ID
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user session_id (int): The ID of the Session to retrieve
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (int): The ID of the Session to retrieve
*
* Returns: schemas.Session: The Session object of the requested Session
*
@@ -111,7 +95,7 @@ export class Metamessages extends APIResource {
options?: Core.RequestOptions,
): Core.APIPromise {
return this._client.get(
- `/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages/${metamessageId}`,
+ `/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/metamessages/${metamessageId}`,
{ query, ...options },
);
}
@@ -164,13 +148,25 @@ export interface MetamessageUpdateParams {
}
export interface MetamessageListParams extends PageParams {
- filter?: string | null;
+ /**
+ * Query param:
+ */
+ reverse?: boolean | null;
+
+ /**
+ * Body param:
+ */
+ filter?: Record | null;
+ /**
+ * Body param:
+ */
message_id?: string | null;
+ /**
+ * Body param:
+ */
metamessage_type?: string | null;
-
- reverse?: boolean | null;
}
export interface MetamessageGetParams {
diff --git a/src/resources/apps/users/sessions/sessions.ts b/src/resources/apps/users/sessions/sessions.ts
index 67da642..10df414 100644
--- a/src/resources/apps/users/sessions/sessions.ts
+++ b/src/resources/apps/users/sessions/sessions.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../../resource';
-import { isRequestOptions } from '../../../../core';
import * as Core from '../../../../core';
import * as SessionsAPI from './sessions';
import * as MessagesAPI from './messages';
@@ -15,10 +14,9 @@ export class Sessions extends APIResource {
/**
* Create a Session for a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (uuid.UUID): The User ID representing the user, managed by
- * the user session (schemas.SessionCreate): The Session object containing any
- * metadata
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session (schemas.SessionCreate): The Session object containing any metadata
*
* Returns: schemas.Session: The Session object of the new Session
*/
@@ -28,15 +26,15 @@ export class Sessions extends APIResource {
body: SessionCreateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/sessions`, { body, ...options });
+ return this._client.post(`/v1/apps/${appId}/users/${userId}/sessions`, { body, ...options });
}
/**
* Update the metadata of a Session
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (uuid.UUID): The User ID representing the user, managed by
- * the user session_id (uuid.UUID): The ID of the Session to update session
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (str): The ID of the Session to update session
* (schemas.SessionUpdate): The Session object containing any new metadata
*
* Returns: schemas.Session: The Session object of the updated Session
@@ -48,36 +46,28 @@ export class Sessions extends APIResource {
body: SessionUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.put(`/apps/${appId}/users/${userId}/sessions/${sessionId}`, { body, ...options });
+ return this._client.put(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}`, { body, ...options });
}
/**
* Get All Sessions for a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (uuid.UUID): The User ID representing the user, managed by
- * the user
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
*
* Returns: list[schemas.Session]: List of Session objects
*/
list(
appId: string,
userId: string,
- query?: SessionListParams,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(appId: string, userId: string, options?: Core.RequestOptions): Core.PagePromise;
- list(
- appId: string,
- userId: string,
- query: SessionListParams | Core.RequestOptions = {},
+ params: SessionListParams,
options?: Core.RequestOptions,
): Core.PagePromise {
- if (isRequestOptions(query)) {
- return this.list(appId, userId, {}, query);
- }
- return this._client.getAPIList(`/apps/${appId}/users/${userId}/sessions`, SessionsPage, {
- query,
+ const { page, reverse, size, ...body } = params;
+ return this._client.getAPIList(`/v1/apps/${appId}/users/${userId}/sessions/list`, SessionsPage, {
+ query: { page, reverse, size },
+ body,
+ method: 'post',
...options,
});
}
@@ -85,9 +75,9 @@ export class Sessions extends APIResource {
/**
* Delete a session by marking it as inactive
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (uuid.UUID): The User ID representing the user, managed by
- * the user session_id (uuid.UUID): The ID of the Session to delete
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (str): The ID of the Session to delete
*
* Returns: dict: A message indicating that the session was deleted
*
@@ -99,7 +89,7 @@ export class Sessions extends APIResource {
sessionId: string,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.delete(`/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
+ return this._client.delete(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
}
/**
@@ -112,7 +102,7 @@ export class Sessions extends APIResource {
body: SessionChatParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat`, {
+ return this._client.post(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/chat`, {
body,
...options,
});
@@ -121,9 +111,9 @@ export class Sessions extends APIResource {
/**
* Get a specific session for a user by ID
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (uuid.UUID): The User ID representing the user, managed by
- * the user session_id (uuid.UUID): The ID of the Session to retrieve
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * session_id (str): The ID of the Session to retrieve
*
* Returns: schemas.Session: The Session object of the requested Session
*
@@ -135,7 +125,7 @@ export class Sessions extends APIResource {
sessionId: string,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
+ return this._client.get(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}`, options);
}
/**
@@ -148,7 +138,7 @@ export class Sessions extends APIResource {
body: SessionStreamParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users/${userId}/sessions/${sessionId}/chat/stream`, {
+ return this._client.post(`/v1/apps/${appId}/users/${userId}/sessions/${sessionId}/chat/stream`, {
body,
...options,
});
@@ -190,7 +180,7 @@ export type SessionDeleteResponse = unknown;
export type SessionStreamResponse = unknown;
export interface SessionCreateParams {
- metadata?: Record | null;
+ metadata?: Record;
}
export interface SessionUpdateParams {
@@ -198,11 +188,20 @@ export interface SessionUpdateParams {
}
export interface SessionListParams extends PageParams {
- filter?: string | null;
+ /**
+ * Query param:
+ */
+ reverse?: boolean | null;
- is_active?: boolean | null;
+ /**
+ * Body param:
+ */
+ filter?: Record | null;
- reverse?: boolean | null;
+ /**
+ * Body param:
+ */
+ is_active?: boolean;
}
export interface SessionChatParams {
diff --git a/src/resources/apps/users/users.ts b/src/resources/apps/users/users.ts
index 0655e15..1c45147 100644
--- a/src/resources/apps/users/users.ts
+++ b/src/resources/apps/users/users.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../../resource';
-import { isRequestOptions } from '../../../core';
import * as Core from '../../../core';
import * as UsersAPI from './users';
import * as MetamessagesAPI from './metamessages';
@@ -17,21 +16,21 @@ export class Users extends APIResource {
/**
* Create a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user (schemas.UserCreate): The User object containing any metadata
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user (schemas.UserCreate): The User object containing any metadata
*
* Returns: schemas.User: Created User object
*/
create(appId: string, body: UserCreateParams, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.post(`/apps/${appId}/users`, { body, ...options });
+ return this._client.post(`/v1/apps/${appId}/users`, { body, ...options });
}
/**
* Update a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user user (schemas.UserCreate): The User object containing any metadata
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
+ * user (schemas.UserCreate): The User object containing any metadata
*
* Returns: schemas.User: Updated User object
*/
@@ -41,71 +40,65 @@ export class Users extends APIResource {
body: UserUpdateParams,
options?: Core.RequestOptions,
): Core.APIPromise {
- return this._client.put(`/apps/${appId}/users/${userId}`, { body, ...options });
+ return this._client.put(`/v1/apps/${appId}/users/${userId}`, { body, ...options });
}
/**
* Get All Users for an App
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho
*
* Returns: list[schemas.User]: List of User objects
*/
list(
appId: string,
- query?: UserListParams,
- options?: Core.RequestOptions,
- ): Core.PagePromise;
- list(appId: string, options?: Core.RequestOptions): Core.PagePromise;
- list(
- appId: string,
- query: UserListParams | Core.RequestOptions = {},
+ params: UserListParams,
options?: Core.RequestOptions,
): Core.PagePromise {
- if (isRequestOptions(query)) {
- return this.list(appId, {}, query);
- }
- return this._client.getAPIList(`/apps/${appId}/users`, UsersPage, { query, ...options });
+ const { page, reverse, size, ...body } = params;
+ return this._client.getAPIList(`/v1/apps/${appId}/users/list`, UsersPage, {
+ query: { page, reverse, size },
+ body,
+ method: 'post',
+ ...options,
+ });
}
/**
* Get a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
*
* Returns: schemas.User: User object
*/
get(appId: string, userId: string, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/${userId}`, options);
+ return this._client.get(`/v1/apps/${appId}/users/${userId}`, options);
}
/**
* Get a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
*
* Returns: schemas.User: User object
*/
getByName(appId: string, name: string, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/name/${name}`, options);
+ return this._client.get(`/v1/apps/${appId}/users/name/${name}`, options);
}
/**
* Get or Create a User
*
- * Args: app_id (uuid.UUID): The ID of the app representing the client application
- * using honcho user_id (str): The User ID representing the user, managed by the
- * user
+ * Args: app_id (str): The ID of the app representing the client application using
+ * honcho user_id (str): The User ID representing the user, managed by the user
*
* Returns: schemas.User: User object
*/
getOrCreate(appId: string, name: string, options?: Core.RequestOptions): Core.APIPromise {
- return this._client.get(`/apps/${appId}/users/get_or_create/${name}`, options);
+ return this._client.get(`/v1/apps/${appId}/users/get_or_create/${name}`, options);
}
}
@@ -138,7 +131,7 @@ export interface User {
export interface UserCreateParams {
name: string;
- metadata?: Record | null;
+ metadata?: Record;
}
export interface UserUpdateParams {
@@ -148,9 +141,15 @@ export interface UserUpdateParams {
}
export interface UserListParams extends PageParams {
- filter?: string | null;
-
+ /**
+ * Query param:
+ */
reverse?: boolean;
+
+ /**
+ * Body param:
+ */
+ filter?: Record | null;
}
export namespace Users {
diff --git a/tests/api-resources/apps/apps.test.ts b/tests/api-resources/apps/apps.test.ts
index a8f7e1b..7ffdb5f 100644
--- a/tests/api-resources/apps/apps.test.ts
+++ b/tests/api-resources/apps/apps.test.ts
@@ -25,7 +25,7 @@ describe('resource apps', () => {
});
test('update', async () => {
- const responsePromise = client.apps.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {});
+ const responsePromise = client.apps.update('app_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -36,7 +36,7 @@ describe('resource apps', () => {
});
test('get', async () => {
- const responsePromise = client.apps.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
+ const responsePromise = client.apps.get('app_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -48,9 +48,9 @@ describe('resource apps', () => {
test('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { path: '/_stainless_unknown_path' }),
- ).rejects.toThrow(Honcho.NotFoundError);
+ await expect(client.apps.get('app_id', { path: '/_stainless_unknown_path' })).rejects.toThrow(
+ Honcho.NotFoundError,
+ );
});
test('getByName', async () => {
diff --git a/tests/api-resources/apps/users/collections/collections.test.ts b/tests/api-resources/apps/users/collections/collections.test.ts
index 445b940..5b57bea 100644
--- a/tests/api-resources/apps/users/collections/collections.test.ts
+++ b/tests/api-resources/apps/users/collections/collections.test.ts
@@ -10,11 +10,7 @@ const client = new Honcho({
describe('resource collections', () => {
test('create: only required params', async () => {
- const responsePromise = client.apps.users.collections.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { name: 'name' },
- );
+ const responsePromise = client.apps.users.collections.create('app_id', 'user_id', { name: 'name' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -25,20 +21,14 @@ describe('resource collections', () => {
});
test('create: required and optional params', async () => {
- const response = await client.apps.users.collections.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { name: 'name', metadata: { foo: 'bar' } },
- );
+ const response = await client.apps.users.collections.create('app_id', 'user_id', {
+ name: 'name',
+ metadata: { foo: 'bar' },
+ });
});
test('update', async () => {
- const responsePromise = client.apps.users.collections.update(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {},
- );
+ const responsePromise = client.apps.users.collections.update('app_id', 'user_id', 'collection_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -49,10 +39,7 @@ describe('resource collections', () => {
});
test('list', async () => {
- const responsePromise = client.apps.users.collections.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.collections.list('app_id', 'user_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -62,35 +49,8 @@ describe('resource collections', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.collections.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
- test('list: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.collections.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { filter: 'filter', page: 1, reverse: true, size: 1 },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
test('delete', async () => {
- const responsePromise = client.apps.users.collections.delete(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.collections.delete('app_id', 'user_id', 'collection_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -103,21 +63,14 @@ describe('resource collections', () => {
test('delete: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.collections.delete(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.collections.delete('app_id', 'user_id', 'collection_id', {
+ path: '/_stainless_unknown_path',
+ }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('get', async () => {
- const responsePromise = client.apps.users.collections.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.collections.get('app_id', 'user_id', 'collection_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -130,21 +83,14 @@ describe('resource collections', () => {
test('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.collections.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.collections.get('app_id', 'user_id', 'collection_id', {
+ path: '/_stainless_unknown_path',
+ }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('getByName', async () => {
- const responsePromise = client.apps.users.collections.getByName(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- 'name',
- );
+ const responsePromise = client.apps.users.collections.getByName('app_id', 'user_id', 'name');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -157,12 +103,9 @@ describe('resource collections', () => {
test('getByName: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.collections.getByName(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- 'name',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.collections.getByName('app_id', 'user_id', 'name', {
+ path: '/_stainless_unknown_path',
+ }),
).rejects.toThrow(Honcho.NotFoundError);
});
});
diff --git a/tests/api-resources/apps/users/collections/documents.test.ts b/tests/api-resources/apps/users/collections/documents.test.ts
index 5422441..feec7c8 100644
--- a/tests/api-resources/apps/users/collections/documents.test.ts
+++ b/tests/api-resources/apps/users/collections/documents.test.ts
@@ -11,9 +11,9 @@ const client = new Honcho({
describe('resource documents', () => {
test('create: only required params', async () => {
const responsePromise = client.apps.users.collections.documents.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
{ content: 'content' },
);
const rawResponse = await responsePromise.asResponse();
@@ -27,19 +27,19 @@ describe('resource documents', () => {
test('create: required and optional params', async () => {
const response = await client.apps.users.collections.documents.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
{ content: 'content', metadata: { foo: 'bar' } },
);
});
test('update', async () => {
const responsePromise = client.apps.users.collections.documents.update(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
+ 'document_id',
{},
);
const rawResponse = await responsePromise.asResponse();
@@ -53,9 +53,10 @@ describe('resource documents', () => {
test('list', async () => {
const responsePromise = client.apps.users.collections.documents.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
+ {},
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -66,37 +67,12 @@ describe('resource documents', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.collections.documents.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
- test('list: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.collections.documents.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { filter: 'filter', page: 1, reverse: true, size: 1 },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
test('delete', async () => {
const responsePromise = client.apps.users.collections.documents.delete(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
+ 'document_id',
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -110,22 +86,18 @@ describe('resource documents', () => {
test('delete: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.collections.documents.delete(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.collections.documents.delete('app_id', 'user_id', 'collection_id', 'document_id', {
+ path: '/_stainless_unknown_path',
+ }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('get', async () => {
const responsePromise = client.apps.users.collections.documents.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
+ 'document_id',
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -139,21 +111,17 @@ describe('resource documents', () => {
test('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.collections.documents.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.collections.documents.get('app_id', 'user_id', 'collection_id', 'document_id', {
+ path: '/_stainless_unknown_path',
+ }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('query: only required params', async () => {
const responsePromise = client.apps.users.collections.documents.query(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
{ query: 'query' },
);
const rawResponse = await responsePromise.asResponse();
@@ -167,9 +135,9 @@ describe('resource documents', () => {
test('query: required and optional params', async () => {
const response = await client.apps.users.collections.documents.query(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'collection_id',
{ query: 'query', filter: 'filter', top_k: 0 },
);
});
diff --git a/tests/api-resources/apps/users/metamessages.test.ts b/tests/api-resources/apps/users/metamessages.test.ts
index ab1d0a6..0bfb20f 100644
--- a/tests/api-resources/apps/users/metamessages.test.ts
+++ b/tests/api-resources/apps/users/metamessages.test.ts
@@ -10,10 +10,7 @@ const client = new Honcho({
describe('resource metamessages', () => {
test('list', async () => {
- const responsePromise = client.apps.users.metamessages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.metamessages.list('app_id', 'user_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -22,27 +19,4 @@ describe('resource metamessages', () => {
expect(dataAndResponse.data).toBe(response);
expect(dataAndResponse.response).toBe(rawResponse);
});
-
- test('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.metamessages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
- test('list: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.metamessages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { filter: 'filter', metamessage_type: 'metamessage_type', page: 1, reverse: true, size: 1 },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
});
diff --git a/tests/api-resources/apps/users/sessions/messages.test.ts b/tests/api-resources/apps/users/sessions/messages.test.ts
index d8702be..c24b603 100644
--- a/tests/api-resources/apps/users/sessions/messages.test.ts
+++ b/tests/api-resources/apps/users/sessions/messages.test.ts
@@ -10,12 +10,10 @@ const client = new Honcho({
describe('resource messages', () => {
test('create: only required params', async () => {
- const responsePromise = client.apps.users.sessions.messages.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { content: 'content', is_user: true },
- );
+ const responsePromise = client.apps.users.sessions.messages.create('app_id', 'user_id', 'session_id', {
+ content: 'content',
+ is_user: true,
+ });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -26,20 +24,19 @@ describe('resource messages', () => {
});
test('create: required and optional params', async () => {
- const response = await client.apps.users.sessions.messages.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { content: 'content', is_user: true, metadata: { foo: 'bar' } },
- );
+ const response = await client.apps.users.sessions.messages.create('app_id', 'user_id', 'session_id', {
+ content: 'content',
+ is_user: true,
+ metadata: { foo: 'bar' },
+ });
});
test('update', async () => {
const responsePromise = client.apps.users.sessions.messages.update(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ 'message_id',
{},
);
const rawResponse = await responsePromise.asResponse();
@@ -52,11 +49,7 @@ describe('resource messages', () => {
});
test('list', async () => {
- const responsePromise = client.apps.users.sessions.messages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.sessions.messages.list('app_id', 'user_id', 'session_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -66,37 +59,12 @@ describe('resource messages', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.sessions.messages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
- test('list: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.sessions.messages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { filter: 'filter', page: 1, reverse: true, size: 1 },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
test('get', async () => {
const responsePromise = client.apps.users.sessions.messages.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ 'message_id',
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -110,13 +78,9 @@ describe('resource messages', () => {
test('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.sessions.messages.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.sessions.messages.get('app_id', 'user_id', 'session_id', 'message_id', {
+ path: '/_stainless_unknown_path',
+ }),
).rejects.toThrow(Honcho.NotFoundError);
});
});
diff --git a/tests/api-resources/apps/users/sessions/metamessages.test.ts b/tests/api-resources/apps/users/sessions/metamessages.test.ts
index faa2a1b..941f2b9 100644
--- a/tests/api-resources/apps/users/sessions/metamessages.test.ts
+++ b/tests/api-resources/apps/users/sessions/metamessages.test.ts
@@ -11,14 +11,10 @@ const client = new Honcho({
describe('resource metamessages', () => {
test('create: only required params', async () => {
const responsePromise = client.apps.users.sessions.metamessages.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {
- content: 'content',
- message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- metamessage_type: 'metamessage_type',
- },
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ { content: 'content', message_id: 'message_id', metamessage_type: 'metamessage_type' },
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -30,26 +26,21 @@ describe('resource metamessages', () => {
});
test('create: required and optional params', async () => {
- const response = await client.apps.users.sessions.metamessages.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {
- content: 'content',
- message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- metamessage_type: 'metamessage_type',
- metadata: { foo: 'bar' },
- },
- );
+ const response = await client.apps.users.sessions.metamessages.create('app_id', 'user_id', 'session_id', {
+ content: 'content',
+ message_id: 'message_id',
+ metamessage_type: 'metamessage_type',
+ metadata: { foo: 'bar' },
+ });
});
test('update: only required params', async () => {
const responsePromise = client.apps.users.sessions.metamessages.update(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ 'metamessage_id',
+ { message_id: 'message_id' },
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -62,23 +53,20 @@ describe('resource metamessages', () => {
test('update: required and optional params', async () => {
const response = await client.apps.users.sessions.metamessages.update(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {
- message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- metadata: { foo: 'bar' },
- metamessage_type: 'metamessage_type',
- },
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ 'metamessage_id',
+ { message_id: 'message_id', metadata: { foo: 'bar' }, metamessage_type: 'metamessage_type' },
);
});
test('list', async () => {
const responsePromise = client.apps.users.sessions.metamessages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ {},
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -89,45 +77,13 @@ describe('resource metamessages', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.sessions.metamessages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
- test('list: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.sessions.metamessages.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {
- filter: 'filter',
- message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- metamessage_type: 'metamessage_type',
- page: 1,
- reverse: true,
- size: 1,
- },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
test('get: only required params', async () => {
const responsePromise = client.apps.users.sessions.metamessages.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ 'metamessage_id',
+ { message_id: 'message_id' },
);
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -140,11 +96,11 @@ describe('resource metamessages', () => {
test('get: required and optional params', async () => {
const response = await client.apps.users.sessions.metamessages.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { message_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
+ 'app_id',
+ 'user_id',
+ 'session_id',
+ 'metamessage_id',
+ { message_id: 'message_id' },
);
});
});
diff --git a/tests/api-resources/apps/users/sessions/sessions.test.ts b/tests/api-resources/apps/users/sessions/sessions.test.ts
index 458bf61..c033d9c 100644
--- a/tests/api-resources/apps/users/sessions/sessions.test.ts
+++ b/tests/api-resources/apps/users/sessions/sessions.test.ts
@@ -10,11 +10,7 @@ const client = new Honcho({
describe('resource sessions', () => {
test('create', async () => {
- const responsePromise = client.apps.users.sessions.create(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {},
- );
+ const responsePromise = client.apps.users.sessions.create('app_id', 'user_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -25,12 +21,7 @@ describe('resource sessions', () => {
});
test('update', async () => {
- const responsePromise = client.apps.users.sessions.update(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {},
- );
+ const responsePromise = client.apps.users.sessions.update('app_id', 'user_id', 'session_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -41,10 +32,7 @@ describe('resource sessions', () => {
});
test('list', async () => {
- const responsePromise = client.apps.users.sessions.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.sessions.list('app_id', 'user_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -54,35 +42,8 @@ describe('resource sessions', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.sessions.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
- test('list: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.sessions.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { filter: 'filter', is_active: true, page: 1, reverse: true, size: 1 },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
test('delete', async () => {
- const responsePromise = client.apps.users.sessions.delete(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.sessions.delete('app_id', 'user_id', 'session_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -95,22 +56,16 @@ describe('resource sessions', () => {
test('delete: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.sessions.delete(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.sessions.delete('app_id', 'user_id', 'session_id', {
+ path: '/_stainless_unknown_path',
+ }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('chat: only required params', async () => {
- const responsePromise = client.apps.users.sessions.chat(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string' },
- );
+ const responsePromise = client.apps.users.sessions.chat('app_id', 'user_id', 'session_id', {
+ queries: 'string',
+ });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -121,20 +76,13 @@ describe('resource sessions', () => {
});
test('chat: required and optional params', async () => {
- const response = await client.apps.users.sessions.chat(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string' },
- );
+ const response = await client.apps.users.sessions.chat('app_id', 'user_id', 'session_id', {
+ queries: 'string',
+ });
});
test('get', async () => {
- const responsePromise = client.apps.users.sessions.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.sessions.get('app_id', 'user_id', 'session_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -147,22 +95,14 @@ describe('resource sessions', () => {
test('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.sessions.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { path: '/_stainless_unknown_path' },
- ),
+ client.apps.users.sessions.get('app_id', 'user_id', 'session_id', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('stream: only required params', async () => {
- const responsePromise = client.apps.users.sessions.stream(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string' },
- );
+ const responsePromise = client.apps.users.sessions.stream('app_id', 'user_id', 'session_id', {
+ queries: 'string',
+ });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -173,11 +113,8 @@ describe('resource sessions', () => {
});
test('stream: required and optional params', async () => {
- const response = await client.apps.users.sessions.stream(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { queries: 'string' },
- );
+ const response = await client.apps.users.sessions.stream('app_id', 'user_id', 'session_id', {
+ queries: 'string',
+ });
});
});
diff --git a/tests/api-resources/apps/users/users.test.ts b/tests/api-resources/apps/users/users.test.ts
index a67db27..38333ed 100644
--- a/tests/api-resources/apps/users/users.test.ts
+++ b/tests/api-resources/apps/users/users.test.ts
@@ -10,9 +10,7 @@ const client = new Honcho({
describe('resource users', () => {
test('create: only required params', async () => {
- const responsePromise = client.apps.users.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
- name: 'name',
- });
+ const responsePromise = client.apps.users.create('app_id', { name: 'name' });
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -23,18 +21,11 @@ describe('resource users', () => {
});
test('create: required and optional params', async () => {
- const response = await client.apps.users.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
- name: 'name',
- metadata: { foo: 'bar' },
- });
+ const response = await client.apps.users.create('app_id', { name: 'name', metadata: { foo: 'bar' } });
});
test('update', async () => {
- const responsePromise = client.apps.users.update(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- {},
- );
+ const responsePromise = client.apps.users.update('app_id', 'user_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -45,7 +36,7 @@ describe('resource users', () => {
});
test('list', async () => {
- const responsePromise = client.apps.users.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
+ const responsePromise = client.apps.users.list('app_id', {});
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -55,29 +46,8 @@ describe('resource users', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- test('list: request options instead of params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { path: '/_stainless_unknown_path' }),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
- test('list: request options and params are passed correctly', async () => {
- // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
- await expect(
- client.apps.users.list(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- { filter: 'filter', page: 1, reverse: true, size: 1 },
- { path: '/_stainless_unknown_path' },
- ),
- ).rejects.toThrow(Honcho.NotFoundError);
- });
-
test('get', async () => {
- const responsePromise = client.apps.users.get(
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
- );
+ const responsePromise = client.apps.users.get('app_id', 'user_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -90,14 +60,12 @@ describe('resource users', () => {
test('get: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.get('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
- path: '/_stainless_unknown_path',
- }),
+ client.apps.users.get('app_id', 'user_id', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('getByName', async () => {
- const responsePromise = client.apps.users.getByName('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'name');
+ const responsePromise = client.apps.users.getByName('app_id', 'name');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -110,14 +78,12 @@ describe('resource users', () => {
test('getByName: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.getByName('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'name', {
- path: '/_stainless_unknown_path',
- }),
+ client.apps.users.getByName('app_id', 'name', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(Honcho.NotFoundError);
});
test('getOrCreate', async () => {
- const responsePromise = client.apps.users.getOrCreate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'name');
+ const responsePromise = client.apps.users.getOrCreate('app_id', 'name');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
const response = await responsePromise;
@@ -130,9 +96,7 @@ describe('resource users', () => {
test('getOrCreate: request options instead of params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
- client.apps.users.getOrCreate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'name', {
- path: '/_stainless_unknown_path',
- }),
+ client.apps.users.getOrCreate('app_id', 'name', { path: '/_stainless_unknown_path' }),
).rejects.toThrow(Honcho.NotFoundError);
});
});
diff --git a/tests/index.test.ts b/tests/index.test.ts
index f263c9d..b5b9023 100644
--- a/tests/index.test.ts
+++ b/tests/index.test.ts
@@ -254,6 +254,122 @@ describe('retries', () => {
expect(count).toEqual(3);
});
+ test('retry count header', async () => {
+ let count = 0;
+ let capturedRequest: RequestInit | undefined;
+ const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => {
+ count++;
+ if (count <= 2) {
+ return new Response(undefined, {
+ status: 429,
+ headers: {
+ 'Retry-After': '0.1',
+ },
+ });
+ }
+ capturedRequest = init;
+ return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
+ };
+
+ const client = new Honcho({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
+
+ expect(await client.request({ path: '/foo', method: 'get' })).toEqual({ a: 1 });
+
+ expect((capturedRequest!.headers as Headers)['x-stainless-retry-count']).toEqual('2');
+ expect(count).toEqual(3);
+ });
+
+ test('omit retry count header', async () => {
+ let count = 0;
+ let capturedRequest: RequestInit | undefined;
+ const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => {
+ count++;
+ if (count <= 2) {
+ return new Response(undefined, {
+ status: 429,
+ headers: {
+ 'Retry-After': '0.1',
+ },
+ });
+ }
+ capturedRequest = init;
+ return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
+ };
+ const client = new Honcho({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
+
+ expect(
+ await client.request({
+ path: '/foo',
+ method: 'get',
+ headers: { 'X-Stainless-Retry-Count': null },
+ }),
+ ).toEqual({ a: 1 });
+
+ expect(capturedRequest!.headers as Headers).not.toHaveProperty('x-stainless-retry-count');
+ });
+
+ test('omit retry count header by default', async () => {
+ let count = 0;
+ let capturedRequest: RequestInit | undefined;
+ const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => {
+ count++;
+ if (count <= 2) {
+ return new Response(undefined, {
+ status: 429,
+ headers: {
+ 'Retry-After': '0.1',
+ },
+ });
+ }
+ capturedRequest = init;
+ return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
+ };
+ const client = new Honcho({
+ apiKey: 'My API Key',
+ fetch: testFetch,
+ maxRetries: 4,
+ defaultHeaders: { 'X-Stainless-Retry-Count': null },
+ });
+
+ expect(
+ await client.request({
+ path: '/foo',
+ method: 'get',
+ }),
+ ).toEqual({ a: 1 });
+
+ expect(capturedRequest!.headers as Headers).not.toHaveProperty('x-stainless-retry-count');
+ });
+
+ test('overwrite retry count header', async () => {
+ let count = 0;
+ let capturedRequest: RequestInit | undefined;
+ const testFetch = async (url: RequestInfo, init: RequestInit = {}): Promise => {
+ count++;
+ if (count <= 2) {
+ return new Response(undefined, {
+ status: 429,
+ headers: {
+ 'Retry-After': '0.1',
+ },
+ });
+ }
+ capturedRequest = init;
+ return new Response(JSON.stringify({ a: 1 }), { headers: { 'Content-Type': 'application/json' } });
+ };
+ const client = new Honcho({ apiKey: 'My API Key', fetch: testFetch, maxRetries: 4 });
+
+ expect(
+ await client.request({
+ path: '/foo',
+ method: 'get',
+ headers: { 'X-Stainless-Retry-Count': '42' },
+ }),
+ ).toEqual({ a: 1 });
+
+ expect((capturedRequest!.headers as Headers)['x-stainless-retry-count']).toBe('42');
+ });
+
test('retry on 429 with retry-after', async () => {
let count = 0;
const testFetch = async (url: RequestInfo, { signal }: RequestInit = {}): Promise => {
diff --git a/yarn.lock b/yarn.lock
index 0f17a27..10ebd6d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1959,6 +1959,13 @@ humanize-ms@^1.2.1:
dependencies:
ms "^2.0.0"
+iconv-lite@^0.6.3:
+ version "0.6.3"
+ resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.6.3.tgz#a52f80bf38da1952eb5c681790719871a1a72501"
+ integrity sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==
+ dependencies:
+ safer-buffer ">= 2.1.2 < 3.0.0"
+
ignore@^5.2.0, ignore@^5.2.4:
version "5.2.4"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.4.tgz#a291c0c6178ff1b960befe47fcdec301674a6324"
@@ -3041,6 +3048,11 @@ safe-buffer@~5.2.0:
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
+"safer-buffer@>= 2.1.2 < 3.0.0":
+ version "2.1.2"
+ resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
+ integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==
+
semver@^6.3.0, semver@^6.3.1:
version "6.3.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4"
From 670f007bb32f3a08ef016d8bf615ca7f12e071e9 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 21 Oct 2024 21:48:58 +0000
Subject: [PATCH 11/11] release: 0.0.7
---
.release-please-manifest.json | 2 +-
CHANGELOG.md | 29 +++++++++++++++++++++++++++++
package.json | 2 +-
src/version.ts | 2 +-
4 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index b68e780..07194f6 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.0.6"
+ ".": "0.0.7"
}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0056843..888a9e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,34 @@
# Changelog
+## 0.0.7 (2024-10-21)
+
+Full Changelog: [v0.0.6...v0.0.7](https://github.com/plastic-labs/honcho-node/compare/v0.0.6...v0.0.7)
+
+### Features
+
+* **api:** api update ([#40](https://github.com/plastic-labs/honcho-node/issues/40)) ([404f89c](https://github.com/plastic-labs/honcho-node/commit/404f89cd152afcdd9a482ff9487c852298ff3ab9))
+* **api:** api update ([#42](https://github.com/plastic-labs/honcho-node/issues/42)) ([d937f2d](https://github.com/plastic-labs/honcho-node/commit/d937f2dc21350a2f04f4385fc0e42b93c2f9acc2))
+* **api:** api update ([#43](https://github.com/plastic-labs/honcho-node/issues/43)) ([4094526](https://github.com/plastic-labs/honcho-node/commit/4094526e55badf52050a5d486d7583ca2f489753))
+* **api:** api update ([#44](https://github.com/plastic-labs/honcho-node/issues/44)) ([f36f035](https://github.com/plastic-labs/honcho-node/commit/f36f035b23769442fc8cb9102654d6494e1119a1))
+* **api:** update via SDK Studio ([#35](https://github.com/plastic-labs/honcho-node/issues/35)) ([0fe4e34](https://github.com/plastic-labs/honcho-node/commit/0fe4e34b9adb0c6aefb97a7f86255f17ef07a605))
+
+
+### Bug Fixes
+
+* **errors:** pass message through to APIConnectionError ([#37](https://github.com/plastic-labs/honcho-node/issues/37)) ([099c25b](https://github.com/plastic-labs/honcho-node/commit/099c25b0a9bdfde9404f2760027c868f99565e3c))
+
+
+### Chores
+
+* better object fallback behaviour for casting errors ([#38](https://github.com/plastic-labs/honcho-node/issues/38)) ([3e16bc1](https://github.com/plastic-labs/honcho-node/commit/3e16bc162793c14e925f40868f85ec89bfda9c8f))
+* **internal:** codegen related update ([#33](https://github.com/plastic-labs/honcho-node/issues/33)) ([9d50dfc](https://github.com/plastic-labs/honcho-node/commit/9d50dfc7b638295f9af0a11869fd47f4f319c4e5))
+* **internal:** codegen related update ([#36](https://github.com/plastic-labs/honcho-node/issues/36)) ([dbade17](https://github.com/plastic-labs/honcho-node/commit/dbade177ef333f740138ff026a346a6e25bec229))
+
+
+### Documentation
+
+* update CONTRIBUTING.md ([#39](https://github.com/plastic-labs/honcho-node/issues/39)) ([0b370d5](https://github.com/plastic-labs/honcho-node/commit/0b370d587c6a73a78563f2faf807e2844fe9dc8f))
+
## 0.0.6 (2024-08-07)
Full Changelog: [v0.0.5...v0.0.6](https://github.com/plastic-labs/honcho-node/compare/v0.0.5...v0.0.6)
diff --git a/package.json b/package.json
index c313376..447f854 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "honcho",
- "version": "0.0.6",
+ "version": "0.0.7",
"description": "The official TypeScript library for the Honcho API",
"author": "Honcho ",
"types": "dist/index.d.ts",
diff --git a/src/version.ts b/src/version.ts
index 889bbf1..4ca879e 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.0.6'; // x-release-please-version
+export const VERSION = '0.0.7'; // x-release-please-version