-
Notifications
You must be signed in to change notification settings - Fork 105
Expand file tree
/
Copy pathapi.d.ts
More file actions
105 lines (89 loc) · 2.98 KB
/
Copy pathapi.d.ts
File metadata and controls
105 lines (89 loc) · 2.98 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
import { Browser } from 'puppeteer-core/lib/Browser';
import { CreateCustomBrowserValidation, BrowserProxyCreateValidation } from './types/profile-params';
export declare const OPERATING_SYSTEMS: {
readonly win: 'win';
readonly lin: 'lin';
readonly mac: 'mac';
readonly android: 'android';
};
export type OsType = (typeof OPERATING_SYSTEMS)[keyof typeof OPERATING_SYSTEMS];
type CloudLaunchParams = {
cloud: true;
geolocation?: string;
};
type LocalLaunchParams = {
cloud: false;
headless: boolean;
};
type ExistingProfileLaunchParams = {
profileId: string;
};
type NewProfileLaunchParams = {
proxyGeolocation: string;
};
type LaunchParams =
| CloudLaunchParams
| LocalLaunchParams
| ExistingProfileLaunchParams
| NewProfileLaunchParams
| {
defaultDelay: number;
os: OsType;
};
type Cookie = {
name: string;
value: string;
domain: string;
path: string;
expirationDate?: number;
creationDate?: number;
hostOnly?: boolean;
httpOnly?: boolean;
sameSite?: 'no_restriction' | 'lax' | 'strict';
secure?: boolean;
session?: boolean;
url?: string;
};
type TrafficData = {
trafficUsedBytes: number;
trafficLimitBytes: number;
};
type AvailableTrafficData = {
mobileTrafficData: TrafficData;
residentialTrafficData: TrafficData;
dataCenterTrafficData: TrafficData;
};
type ProxyType = 'mobile' | 'resident' | 'dataCenter';
type ProxyResponse = {
trafficLimitBytes: number;
trafficUsedBytes: number;
};
type ProfileResponse = {
id: string;
};
type GologinApiType = {
launch: (params?: LaunchParams) => Promise<{ browser: Browser }>;
createProfileWithCustomParams: (options: CreateCustomBrowserValidation) => Promise<string>;
refreshProfilesFingerprint: (profileIds: string[]) => Promise<Record<string, unknown>>;
createProfileRandomFingerprint: (name?: string) => Promise<ProfileResponse>;
updateUserAgentToLatestBrowser: (profileIds: string[], workspaceId?: string) => Promise<Record<string, unknown>>;
changeProfileProxy: (profileId: string, proxyData: BrowserProxyCreateValidation) => Promise<number>;
getAvailableType: (availableTrafficData: AvailableTrafficData) => ProxyType | 'none';
addGologinProxyToProfile: (profileId: string, countryCode: string, proxyType?: ProxyType | '') => Promise<ProxyResponse>;
addCookiesToProfile: (profileId: string, cookies: Cookie[]) => Promise<number>;
deleteProfile: (profileId: string) => Promise<number>;
exit: () => Promise<void>;
createCustom: (params: CreateCustomBrowserValidation) => Promise<string>;
updateProfileFingerprint: (profileId: string[]) => Promise<void>;
updateProfileProxy: (profileId: string, proxyData: BrowserProxyCreateValidation) => Promise<void>;
};
type GologinApiParams = {
token: string;
};
export declare function getDefaultParams(): {
token: string | undefined;
profile_id: string | undefined;
executablePath: string | undefined;
};
export declare function GologinApi(params: GologinApiParams): GologinApiType;
export declare function exitAll(): Promise<void>;