diff --git a/.stats.yml b/.stats.yml index a479c92..0fb48e4 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-7967581df14089cda98ce7bd258102d5da5ec541dc5b17aa918f96be11a2bde8.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/plastic-labs%2FHoncho-9de9efee1447340a4b99258885f8c5472ee853fa3bc7327fd632be3c5f23f161.yml diff --git a/README.md b/README.md index 64dce2e..96b9490 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Honcho API Library +# honcho-ai API Library [![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) diff --git a/scripts/build b/scripts/build index a9284b7..a60d4e7 100755 --- a/scripts/build +++ b/scripts/build @@ -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 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 diff --git a/src/index.ts b/src/index.ts index 9bb335d..3e6c217 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,7 @@ type Environment = keyof typeof environments; export interface ClientOptions { /** - * API Key + * Defaults to process.env['HONCHO_API_KEY']. */ apiKey?: string | null | undefined; diff --git a/src/resources/apps/users/collections/collections.ts b/src/resources/apps/users/collections/collections.ts index a96e10e..35f1e3b 100644 --- a/src/resources/apps/users/collections/collections.ts +++ b/src/resources/apps/users/collections/collections.ts @@ -163,9 +163,9 @@ export interface CollectionCreateParams { } export interface CollectionUpdateParams { - name: string; - metadata?: Record | null; + + name?: string | null; } export interface CollectionListParams extends PageParams { diff --git a/src/resources/apps/users/sessions/metamessages.ts b/src/resources/apps/users/sessions/metamessages.ts index ff43e72..156dd4e 100644 --- a/src/resources/apps/users/sessions/metamessages.ts +++ b/src/resources/apps/users/sessions/metamessages.ts @@ -8,15 +8,15 @@ import { Page, type PageParams } from '../../../../pagination'; export class Metamessages extends APIResource { /** - * Adds a message to a session + * Adds a metamessage 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 - * (schemas.MessageCreate): The Message object to add containing the message - * content and type + * 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 * - * Returns: schemas.Message: The Message object of the added message + * Returns: schemas.Metamessage: The Metamessage object of the added metamessage * * Raises: HTTPException: If the session is not found */ diff --git a/src/resources/apps/users/sessions/sessions.ts b/src/resources/apps/users/sessions/sessions.ts index 4100186..f697aeb 100644 --- a/src/resources/apps/users/sessions/sessions.ts +++ b/src/resources/apps/users/sessions/sessions.ts @@ -18,7 +18,7 @@ export class Sessions extends APIResource { * 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 and a location ID + * metadata * * Returns: schemas.Session: The Session object of the new Session */ @@ -56,8 +56,7 @@ export class Sessions extends APIResource { * * 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 location_id (str, optional): Optional Location ID representing the - * location of a session + * the user * * Returns: list[schemas.Session]: List of Session objects */ @@ -181,8 +180,6 @@ export interface Session { is_active: boolean; - location_id: string; - metadata: Record; user_id: string; @@ -193,8 +190,6 @@ export type SessionDeleteResponse = unknown; export type SessionStreamResponse = unknown; export interface SessionCreateParams { - location_id: string; - metadata?: Record | null; } @@ -207,8 +202,6 @@ export interface SessionListParams extends PageParams { is_active?: boolean | null; - location_id?: string | null; - reverse?: boolean | null; } diff --git a/tests/api-resources/apps/users/collections/collections.test.ts b/tests/api-resources/apps/users/collections/collections.test.ts index 79d5798..9efe7e6 100644 --- a/tests/api-resources/apps/users/collections/collections.test.ts +++ b/tests/api-resources/apps/users/collections/collections.test.ts @@ -32,12 +32,12 @@ describe('resource collections', () => { ); }); - test('update: only required params', async () => { + 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', - { name: 'name' }, + {}, ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -48,15 +48,6 @@ describe('resource collections', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: required and optional params', async () => { - const response = await client.apps.users.collections.update( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { name: 'name', metadata: { foo: 'bar' } }, - ); - }); - test('list', async () => { const responsePromise = client.apps.users.collections.list( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', diff --git a/tests/api-resources/apps/users/sessions/sessions.test.ts b/tests/api-resources/apps/users/sessions/sessions.test.ts index 9b6a6a5..be02671 100644 --- a/tests/api-resources/apps/users/sessions/sessions.test.ts +++ b/tests/api-resources/apps/users/sessions/sessions.test.ts @@ -9,11 +9,11 @@ const client = new Honcho({ }); describe('resource sessions', () => { - test('create: only required params', async () => { + test('create', async () => { const responsePromise = client.apps.users.sessions.create( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { location_id: 'location_id' }, + {}, ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -24,14 +24,6 @@ describe('resource sessions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { - const response = await client.apps.users.sessions.create( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { location_id: 'location_id', metadata: { foo: 'bar' } }, - ); - }); - test('update', async () => { const responsePromise = client.apps.users.sessions.update( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', @@ -79,7 +71,7 @@ describe('resource sessions', () => { client.apps.users.sessions.list( '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { filter: 'filter', is_active: true, location_id: 'location_id', page: 1, reverse: true, size: 1 }, + { filter: 'filter', is_active: true, page: 1, reverse: true, size: 1 }, { path: '/_stainless_unknown_path' }, ), ).rejects.toThrow(Honcho.NotFoundError);