-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathcontexts.ts
More file actions
129 lines (108 loc) · 3.18 KB
/
contexts.ts
File metadata and controls
129 lines (108 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// 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';
export class Contexts extends APIResource {
/**
* Create a Context
*/
create(body?: ContextCreateParams, options?: Core.RequestOptions): Core.APIPromise<ContextCreateResponse>;
create(options?: Core.RequestOptions): Core.APIPromise<ContextCreateResponse>;
create(
body: ContextCreateParams | Core.RequestOptions = {},
options?: Core.RequestOptions,
): Core.APIPromise<ContextCreateResponse> {
if (isRequestOptions(body)) {
return this.create({}, body);
}
return this._client.post('/v1/contexts', { body, ...options });
}
/**
* Get a Context
*/
retrieve(id: string, options?: Core.RequestOptions): Core.APIPromise<Context> {
return this._client.get(`/v1/contexts/${id}`, options);
}
/**
* Update a Context
*/
update(id: string, options?: Core.RequestOptions): Core.APIPromise<ContextUpdateResponse> {
return this._client.put(`/v1/contexts/${id}`, options);
}
/**
* Delete a Context
*/
delete(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
return this._client.delete(`/v1/contexts/${id}`, {
...options,
headers: { Accept: '*/*', ...options?.headers },
});
}
}
export interface Context {
id: string;
createdAt: string;
/**
* The Project ID linked to the uploaded Context.
*/
projectId: string;
updatedAt: string;
}
export interface ContextCreateResponse {
id: string;
/**
* The cipher algorithm used to encrypt the user-data-directory. AES-256-CBC is
* currently the only supported algorithm.
*/
cipherAlgorithm: string;
/**
* The initialization vector size used to encrypt the user-data-directory.
* [Read more about how to use it](/features/contexts).
*/
initializationVectorSize: number;
/**
* The public key to encrypt the user-data-directory.
*/
publicKey: string;
/**
* An upload URL to upload a custom user-data-directory.
*/
uploadUrl: string;
}
export interface ContextUpdateResponse {
id: string;
/**
* The cipher algorithm used to encrypt the user-data-directory. AES-256-CBC is
* currently the only supported algorithm.
*/
cipherAlgorithm: string;
/**
* The initialization vector size used to encrypt the user-data-directory.
* [Read more about how to use it](/features/contexts).
*/
initializationVectorSize: number;
/**
* The public key to encrypt the user-data-directory.
*/
publicKey: string;
/**
* An upload URL to upload a custom user-data-directory.
*/
uploadUrl: string;
}
export interface ContextCreateParams {
/**
* The Project ID. Can be found in
* [Settings](https://www.browserbase.com/settings). Optional - if not provided,
* the project will be inferred from the API key.
*/
projectId?: string;
}
export declare namespace Contexts {
export {
type Context as Context,
type ContextCreateResponse as ContextCreateResponse,
type ContextUpdateResponse as ContextUpdateResponse,
type ContextCreateParams as ContextCreateParams,
};
}