Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
18 changes: 18 additions & 0 deletions src/services/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
SessionEventLogListParams,
SessionEventLogListResponse,
UpdateSessionProfileParams,
UpdateSessionProxyParams,
SessionGetParams,
} from "../types/session";
import { BaseService } from "./base";
Expand Down Expand Up @@ -382,6 +383,23 @@ export class SessionsService extends BaseService {
}
}

async updateProxyParams(
id: string,
params: UpdateSessionProxyParams
): Promise<BasicResponse> {
try {
return await this.request<BasicResponse>(`/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 {
Expand Down
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ export {
SessionProfile,
SessionLaunchState,
UpdateSessionProfileParams,
UpdateSessionProxyLocationParams,
UpdateSessionProxyParams,
} from "./session";
export {
SandboxStatus,
Expand Down
12 changes: 12 additions & 0 deletions src/types/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}