diff --git a/package.json b/package.json index aca31a3..74fc3af 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperbrowser/sdk", - "version": "0.86.0", + "version": "0.87.0", "description": "Node SDK for Hyperbrowser API", "author": "", "main": "dist/index.js", diff --git a/src/services/sessions.ts b/src/services/sessions.ts index bd4a283..033b1aa 100644 --- a/src/services/sessions.ts +++ b/src/services/sessions.ts @@ -18,6 +18,7 @@ import { SessionEventLogListParams, SessionEventLogListResponse, UpdateSessionProfileParams, + UpdateSessionProxyParams, SessionGetParams, } from "../types/session"; import { BaseService } from "./base"; @@ -382,6 +383,23 @@ export class SessionsService extends BaseService { } } + async updateProxyParams( + id: string, + params: UpdateSessionProxyParams + ): Promise { + try { + return await this.request(`/session/${id}/update`, { + method: "PUT", + body: JSON.stringify({ type: "proxy", params }), + }); + } catch (error) { + if (error instanceof HyperbrowserError) { + throw error; + } + throw new HyperbrowserError(`Failed to update proxy for session ${id}`, undefined); + } + } + private static hasWarnedUpdateSessionProfileParamsBooleanDeprecated = false; private warnUpdateSessionProfileParamsBooleanDeprecated(): void { diff --git a/src/types/index.ts b/src/types/index.ts index e863c89..beb4c04 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -114,6 +114,8 @@ export { SessionProfile, SessionLaunchState, UpdateSessionProfileParams, + UpdateSessionProxyLocationParams, + UpdateSessionProxyParams, } from "./session"; export { SandboxStatus, diff --git a/src/types/session.ts b/src/types/session.ts index 31ca412..57b9c4d 100644 --- a/src/types/session.ts +++ b/src/types/session.ts @@ -220,3 +220,15 @@ export interface UpdateSessionProfileParams { persistChanges?: boolean; persistNetworkCache?: boolean; } + +export interface UpdateSessionProxyLocationParams { + country?: Country; + state?: State; + city?: string; +} + +export interface UpdateSessionProxyParams { + enabled: boolean; + staticIpId?: string; + location?: UpdateSessionProxyLocationParams; +}