Skip to content
Merged
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: 2 additions & 0 deletions src/cli/Browserbase.CLI/Commands/DefaultApiGroupCommand.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ public static Command Create()
command.Subcommands.Add(ProjectsUsageCommandApiCommand.Create());
command.Subcommands.Add(SearchWebCommandApiCommand.Create());
command.Subcommands.Add(SessionsCreateCommandApiCommand.Create());
command.Subcommands.Add(SessionsCreateRecordingDownloadsCommandApiCommand.Create());
command.Subcommands.Add(SessionsGetCommandApiCommand.Create());
command.Subcommands.Add(SessionsGetDebugCommandApiCommand.Create());
command.Subcommands.Add(SessionsGetLogsCommandApiCommand.Create());
command.Subcommands.Add(SessionsGetRecordingCommandApiCommand.Create());
command.Subcommands.Add(SessionsGetReplayCommandApiCommand.Create());
command.Subcommands.Add(SessionsGetReplayPageCommandApiCommand.Create());
command.Subcommands.Add(SessionsListCommandApiCommand.Create());
command.Subcommands.Add(SessionsListRecordingDownloadsCommandApiCommand.Create());
command.Subcommands.Add(SessionsUpdateCommandApiCommand.Create());
command.Subcommands.Add(SessionsUploadFileCommandApiCommand.Create());
return command;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace Browserbase.CLI.Commands;

internal static partial class SessionsCreateRecordingDownloadsCommandApiCommand
{
private static Argument<global::System.Guid> Id { get; } = new(
name: @"id")
{
Description = @"Session ID",
};

private static string FormatResponse(ParseResult parseResult, global::Browserbase.SessionsCreateRecordingDownloadsResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::Browserbase.SessionsCreateRecordingDownloadsResponse value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


public static Command Create()
{
var command = new Command(@"sessions-create-recording-downloads", @"Create Session Recording Downloads
Requests one downloadable MP4 per recorded page of a session. Assembly runs asynchronously and every page returns as `PENDING`. Re-posting re-enqueues all pages and retries any that failed. Poll the GET endpoint for per-page status and, on standard (non-BYOS) projects, download URLs.");
command.Arguments.Add(Id);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var id = parseResult.GetRequiredValue(Id);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.SessionsCreateRecordingDownloadsAsync(
id: id,
cancellationToken: cancellationToken).ConfigureAwait(false);


if (!await CliRuntime.TryWriteOutputDirectoryAsync(
parseResult,
response,
global::Browserbase.SourceGenerationContext.Default,
@"Downloads",
cancellationToken).ConfigureAwait(false))
{
await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::Browserbase.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}
}, cancellationToken).ConfigureAwait(false));
return command;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace Browserbase.CLI.Commands;

internal static partial class SessionsListRecordingDownloadsCommandApiCommand
{
private static Argument<global::System.Guid> Id { get; } = new(
name: @"id")
{
Description = @"Session ID",
};

private static string FormatResponse(ParseResult parseResult, global::Browserbase.SessionsListRecordingDownloadsResponse value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::Browserbase.SessionsListRecordingDownloadsResponse value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


public static Command Create()
{
var command = new Command(@"sessions-list-recording-downloads", @"List Session Recording Downloads
Returns the per-page download status for a session, with a short-lived signed URL for each completed page on standard (non-BYOS) projects.");
command.Arguments.Add(Id);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var id = parseResult.GetRequiredValue(Id);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.SessionsListRecordingDownloadsAsync(
id: id,
cancellationToken: cancellationToken).ConfigureAwait(false);


if (!await CliRuntime.TryWriteOutputDirectoryAsync(
parseResult,
response,
global::Browserbase.SourceGenerationContext.Default,
@"Downloads",
cancellationToken).ConfigureAwait(false))
{
await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::Browserbase.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}
}, cancellationToken).ConfigureAwait(false));
return command;
}
}
Loading