-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprofiles.ts
More file actions
82 lines (72 loc) · 2.64 KB
/
profiles.ts
File metadata and controls
82 lines (72 loc) · 2.64 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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource';
import * as BrowsersAPI from './browsers/browsers';
import { ProfilesOffsetPagination } from './browsers/browsers';
import { APIPromise } from '../core/api-promise';
import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../core/pagination';
import { buildHeaders } from '../internal/headers';
import { RequestOptions } from '../internal/request-options';
import { path } from '../internal/utils/path';
/**
* Create, list, retrieve, and delete browser profiles.
*/
export class Profiles extends APIResource {
/**
* Create a browser profile that can be used to load state into future browser
* sessions.
*/
create(body: ProfileCreateParams, options?: RequestOptions): APIPromise<BrowsersAPI.Profile> {
return this._client.post('/profiles', { body, ...options });
}
/**
* Retrieve details for a single profile by its ID or name.
*/
retrieve(idOrName: string, options?: RequestOptions): APIPromise<BrowsersAPI.Profile> {
return this._client.get(path`/profiles/${idOrName}`, options);
}
/**
* List profiles with optional filtering and pagination.
*/
list(
query: ProfileListParams | null | undefined = {},
options?: RequestOptions,
): PagePromise<ProfilesOffsetPagination, BrowsersAPI.Profile> {
return this._client.getAPIList('/profiles', OffsetPagination<BrowsersAPI.Profile>, { query, ...options });
}
/**
* Delete a profile by its ID or by its name.
*/
delete(idOrName: string, options?: RequestOptions): APIPromise<void> {
return this._client.delete(path`/profiles/${idOrName}`, {
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}
/**
* Download the profile. Profiles are JSON files containing the pieces of state
* that we save.
*/
download(idOrName: string, options?: RequestOptions): APIPromise<Response> {
return this._client.get(path`/profiles/${idOrName}/download`, {
...options,
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
__binaryResponse: true,
});
}
}
export interface ProfileCreateParams {
/**
* Optional name of the profile. Must be unique within the organization.
*/
name?: string;
}
export interface ProfileListParams extends OffsetPaginationParams {
/**
* Search profiles by name or ID.
*/
query?: string;
}
export declare namespace Profiles {
export { type ProfileCreateParams as ProfileCreateParams, type ProfileListParams as ProfileListParams };
}
export { type ProfilesOffsetPagination };