-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlogs.ts
More file actions
53 lines (46 loc) · 1.4 KB
/
logs.ts
File metadata and controls
53 lines (46 loc) · 1.4 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
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import * as Shared from '../shared';
import { APIPromise } from '../../core/api-promise';
import { Stream } from '../../core/streaming';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
/**
* Stream logs from the browser instance.
*/
export class Logs extends APIResource {
/**
* Stream log files on the browser instance via SSE
*
* @example
* ```ts
* const logEvent = await client.browsers.logs.stream('id', {
* source: 'path',
* });
* ```
*/
stream(id: string, query: LogStreamParams, options?: RequestOptions): APIPromise<Stream<Shared.LogEvent>> {
return this._client.get(path`/browsers/${id}/logs/stream`, {
query,
...options,
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
stream: true,
}) as APIPromise<Stream<Shared.LogEvent>>;
}
}
export interface LogStreamParams {
source: 'path' | 'supervisor';
follow?: boolean;
/**
* only required if source is path
*/
path?: string;
/**
* only required if source is supervisor
*/
supervisor_process?: string;
}
export declare namespace Logs {
export { type LogStreamParams as LogStreamParams };
}