Skip to content

Commit 73b7e7c

Browse files
committed
feat(contexts): add Contexts class and methods
1 parent 6508862 commit 73b7e7c

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

src/contexts/@types/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type AllContexts = {
2+
created_at: string;
3+
id: string;
4+
name: string;
5+
}[];

src/contexts/contexts.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Hyper } from '../hyper';
2+
import type { AllContexts } from './@types';
3+
4+
export class Contexts {
5+
constructor(private readonly hyper: Hyper) {}
6+
7+
async list() {
8+
const res = await this.hyper.get<AllContexts>({
9+
endpoint: '/contexts',
10+
});
11+
12+
return res;
13+
}
14+
}

src/contexts/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { Contexts } from './contexts';

src/hyper.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Types } from './types';
22
import { Search } from './search';
3+
import { Contexts } from './contexts';
34

45
const baseUrl = process.env.HYPER_BASE_URL || 'https://api.gethyper.ai/v1';
56

@@ -14,6 +15,7 @@ export class Hyper {
1415

1516
readonly types = new Types(this);
1617
readonly search = new Search(this);
18+
readonly contexts = new Contexts(this);
1719

1820
constructor(private readonly apiKey?: string) {
1921
if (!apiKey) {

0 commit comments

Comments
 (0)