Skip to content

Commit

Permalink
feat: add getProjectId method (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Granipouss authored Jun 19, 2024
1 parent 9a34167 commit 4113ffd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,16 @@ export class API {
}
}

/**
* Get the project id associated with the API key.
*
* @returns the project id
*/
async getProjectId(): Promise<string> {
const response = await this.makeApiCall('/my-project', {});
return response['projectId'];
}

/**
* Sends a collection of steps to the GraphQL endpoint.
*
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,11 @@ describe('End to end tests for the SDK', function () {
await client.api.deleteThread(thread.id);
});

it('should get project id', async () => {
const projectId = await client.api.getProjectId();
expect(projectId).toEqual(expect.any(String));
});

describe('dataset api', () => {
it('should create a dataset', async () => {
const datasetName = `test_${uuidv4()}`;
Expand Down

0 comments on commit 4113ffd

Please sign in to comment.