Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add getProjectId method #34

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading