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
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private async Task<int> ExecuteAsync(
}

var choice = await console.PromptAsync(
"Do you want to create the API key scoped to an API or the whole workspace?",
Prompts.CreateApiKeyScope,
["Api", "Workspace"],
cancellationToken);

Expand All @@ -76,7 +76,7 @@ private async Task<int> ExecuteAsync(
apiId = await console.PromptForApiIdAsync(
apisClient,
workspaceId,
"For which API do you want to create an API key?",
Prompts.SelectApiForCreateApiKey,
cancellationToken);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static async Task<int> ExecuteAsync(
if (!force)
{
var confirmed = await console.ConfirmAsync(
$"Do you really want to delete API key with ID '{keyId}'?",
Prompts.ConfirmDeleteApiKey(keyId),
cancellationToken);

if (!confirmed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private static async Task<int> ExecuteAsync(
if (!force)
{
var confirmed = await console.ConfirmAsync(
$"Do you really want to delete API {apiName.AsHighlight()}",
Prompts.ConfirmDeleteApi(apiName.AsHighlight()),
cancellationToken);

if (!confirmed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ private static async Task<int> ExecuteAsync(
.ConfirmAsync(
parseResult,
Opt<TreatDangerousAsBreakingOption>.Instance,
"Treat dangerous changes as breaking?",
Prompts.TreatDangerousChangesAsBreaking,
ct);

var allowBreakingSchemaChanges = await console
.ConfirmAsync(
parseResult,
Opt<AllowBreakingSchemaChangesOption>.Instance,
"Allow breaking schema changes when no client breaks?",
Prompts.AllowBreakingSchemaChanges,
ct);

await using var activity = console.StartActivity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static async Task<int> ExecuteAsync(
parseResult.AssertHasAuthentication(sessionService);

var apiId = await console.GetOrPromptForApiIdAsync(
"For which API do you want to create a client?",
Prompts.SelectApiForCreateClient,
parseResult,
apisClient,
sessionService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ private static async Task<int> ExecuteAsync(

parseResult.AssertHasAuthentication(sessionService);

const string clientMessage = "Which client do you want to delete?";
const string clientMessage = Prompts.DeleteClient;

var clientId = parseResult.GetRequiredValueIfNotInteractive(Opt<OptionalIdArgument>.Instance, console);

Expand All @@ -50,7 +50,7 @@ private static async Task<int> ExecuteAsync(
var apiId = await console.PromptForApiIdAsync(
apisClient,
workspaceId,
"For which API do you want to delete a client?",
Prompts.SelectApiForDeleteClient,
cancellationToken);

var selectedClient = await SelectClientPrompt
Expand All @@ -72,7 +72,7 @@ private static async Task<int> ExecuteAsync(
if (!force)
{
var confirmed = await console.ConfirmAsync(
$"Do you want to delete the client with ID {clientId}?".EscapeMarkup(),
Prompts.ConfirmDeleteClient(clientId).EscapeMarkup(),
cancellationToken);

if (!confirmed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private static async Task<int> ExecuteAsync(

var cursor = parseResult.GetValue(Opt<OptionalCursorOption>.Instance);
var apiId = await console.GetOrPromptForApiIdAsync(
"For which API do you want to list the clients?",
Prompts.SelectApiForListClients,
parseResult,
apisClient,
sessionService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private static async Task<int> RenderInteractiveAsync(
if (clientId is null)
{
var apiId = await console.GetOrPromptForApiIdAsync(
"For which API do you want to list client versions?",
Prompts.SelectApiForListClientVersions,
parseResult, apisClient, sessionService, ct);

var selectedClient = await SelectClientPrompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static async Task<int> RenderInteractiveAsync(
if (clientId is null)
{
var apiId = await console.GetOrPromptForApiIdAsync(
"For which API do you want to list client versions?",
Prompts.SelectApiForListClientVersions,
parseResult, apisClient, sessionService, ct);

var selectedClient = await SelectClientPrompt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ await sessionService.SelectWorkspaceAsync(
var paginationContainer = PaginationContainer.CreateConnectionData(client.SelectWorkspacesAsync);
var selected = await PagedSelectionPrompt
.New(paginationContainer)
.Title("Which workspace do you want to use as your default?".AsQuestion())
.Title(Prompts.SelectDefaultWorkspace.AsQuestion())
.UseConverter(x => x.Name)
.RenderAsync(console, cancellationToken);

Expand All @@ -100,7 +100,7 @@ await sessionService.SelectWorkspaceAsync(
new Workspace(selected.Id, selected.Name),
cancellationToken);

console.MarkupLine($"(Workspace: [green]{selected.Name.EscapeMarkup()}[/])");
console.OkQuestion(Prompts.SelectDefaultWorkspace, selected.Name);

return ExitCodes.Success;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static async Task<int> ExecuteAsync(

parseResult.AssertHasAuthentication(sessionService);

var apiId = await console.GetOrPromptForApiIdAsync("For which API do you want to create an MCP Feature Collection?", parseResult, apisClient, sessionService, cancellationToken);
var apiId = await console.GetOrPromptForApiIdAsync(Prompts.SelectApiForCreateMcpFeatureCollection, parseResult, apisClient, sessionService, cancellationToken);

var name = await console
.PromptAsync("Name", defaultValue: null, parseResult, Opt<McpFeatureCollectionNameOption>.Instance, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ private static async Task<int> ExecuteAsync(
var apiId = await console.PromptForApiIdAsync(
apisClient,
workspaceId,
"For which API do you want to delete an MCP Feature Collection?",
Prompts.SelectApiForDeleteMcpFeatureCollection,
cancellationToken);

var selectedMcpFeatureCollection = await SelectMcpFeatureCollectionPrompt
.New(client, apiId)
.Title("Which MCP Feature Collection do you want to delete?")
.Title(Prompts.DeleteMcpFeatureCollection)
.RenderAsync(console, cancellationToken) ?? throw new ExitException("You did not select an MCP Feature Collection!");

mcpFeatureCollectionId = selectedMcpFeatureCollection.Id;
Expand All @@ -62,7 +62,7 @@ private static async Task<int> ExecuteAsync(
if (!force)
{
var confirmed = await console.ConfirmAsync(
$"Do you want to delete the MCP Feature Collection with the ID {mcpFeatureCollectionId}?"
Prompts.ConfirmDeleteMcpFeatureCollection(mcpFeatureCollectionId)
.EscapeMarkup(),
cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static async Task<int> RenderInteractiveAsync(
string? cursor,
CancellationToken ct)
{
var apiId = await console.GetOrPromptForApiIdAsync("For which API do you want to list the MCP Feature Collections?", parseResult, apisClient, sessionService, ct);
var apiId = await console.GetOrPromptForApiIdAsync(Prompts.SelectApiForListMcpFeatureCollections, parseResult, apisClient, sessionService, ct);

var container = PaginationContainer
.CreateConnectionData(async (after, first, token) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static async Task<int> ExecuteAsync(
parseResult.GetRequiredValue(Opt<MockSchemaNameOption>.Instance);

var apiId = await console.GetOrPromptForApiIdAsync(
"For which API do you want to create a mock schema?",
Prompts.SelectApiForCreateMockSchema,
parseResult,
apisClient,
sessionService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static async Task<int> RenderInteractiveAsync(
string? cursor,
CancellationToken ct)
{
var apiId = await console.GetOrPromptForApiIdAsync("For which API do you want to list the mock schemas?", parseResult, apisClient, sessionService, ct);
var apiId = await console.GetOrPromptForApiIdAsync(Prompts.SelectApiForListMockSchemas, parseResult, apisClient, sessionService, ct);

var container = PaginationContainer
.CreateConnectionData((after, first, token) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static async Task<int> ExecuteAsync(

parseResult.AssertHasAuthentication(sessionService);

var apiId = await console.GetOrPromptForApiIdAsync("For which API do you want to create an OpenAPI collection?", parseResult, apisClient, sessionService, cancellationToken);
var apiId = await console.GetOrPromptForApiIdAsync(Prompts.SelectApiForCreateOpenApiCollection, parseResult, apisClient, sessionService, cancellationToken);

var name = await console
.PromptAsync("Name", defaultValue: null, parseResult, Opt<OpenApiCollectionNameOption>.Instance, cancellationToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ private static async Task<int> ExecuteAsync(
var apiId = await console.PromptForApiIdAsync(
apisClient,
workspaceId,
"For which API do you want to delete an OpenAPI collection?",
Prompts.SelectApiForDeleteOpenApiCollection,
cancellationToken);

var selectedOpenApiCollection = await SelectOpenApiCollectionPrompt
.New(client, apiId)
.Title("Which OpenAPI collection do you want to delete?")
.Title(Prompts.DeleteOpenApiCollection)
.RenderAsync(console, cancellationToken) ?? throw new ExitException("You did not select an OpenAPI collection!");

openApiCollectionId = selectedOpenApiCollection.Id;
Expand All @@ -62,7 +62,7 @@ private static async Task<int> ExecuteAsync(
if (!force)
{
var confirmed = await console.ConfirmAsync(
$"Do you want to delete the OpenAPI collection with the ID {openApiCollectionId}?"
Prompts.ConfirmDeleteOpenApiCollection(openApiCollectionId)
.EscapeMarkup(),
cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static async Task<int> RenderInteractiveAsync(
string? cursor,
CancellationToken ct)
{
var apiId = await console.GetOrPromptForApiIdAsync("For which API do you want to list the OpenAPI collections?", parseResult, apisClient, sessionService, ct);
var apiId = await console.GetOrPromptForApiIdAsync(Prompts.SelectApiForListOpenApiCollections, parseResult, apisClient, sessionService, ct);

var container = PaginationContainer
.CreateConnectionData(async (after, first, token) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private static async Task<int> ExecuteAsync(
if (!force)
{
var confirmed = await console.ConfirmAsync(
$"Do you really want to delete PAT with ID {patId}",
Prompts.ConfirmRevokePersonalAccessToken(patId),
cancellationToken);

if (!confirmed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static async Task<int> ExecuteAsync(
parseResult.AssertHasAuthentication(sessionService);

var apiId = await console.GetOrPromptForApiIdAsync(
"For which API do you want to force delete a stage?",
Prompts.SelectApiForForceDeleteStage,
parseResult,
apisClient,
sessionService,
Expand All @@ -57,7 +57,7 @@ private static async Task<int> ExecuteAsync(
if (!force)
{
var confirmed = await console.ConfirmAsync(
$"Do you really want to force delete stage {stageName.AsHighlight()}",
Prompts.ConfirmDeleteStage(stageName.AsHighlight()),
cancellationToken);

if (!confirmed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static async Task<int> ExecuteAsync(
parseResult.AssertHasAuthentication(sessionService);

var apiId = await console.GetOrPromptForApiIdAsync(
"For which API do you want to edit the stages?",
Prompts.SelectApiForEditStages,
parseResult,
apisClient,
sessionService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private static async Task<int> RenderInteractiveAsync(
IResultHolder resultHolder,
CancellationToken ct)
{
var apiId = await console.GetOrPromptForApiIdAsync("For which API do you want to display the clients?", parseResult, apisClient, sessionService, ct);
var apiId = await console.GetOrPromptForApiIdAsync(Prompts.SelectApiForDisplayClients, parseResult, apisClient, sessionService, ct);

var stages = await client.ListStagesAsync(apiId, ct) ?? [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private static async Task<int> ExecuteAsync(
.ConfirmAsync(
parseResult,
Opt<SetAsDefaultWorkspaceOption>.Instance,
"Set as default workspace?",
Prompts.SetAsDefaultWorkspace,
ct);

await using (var activity = console.StartActivity(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static async Task<int> ExecuteAsync(

var selected = await PagedSelectionPrompt
.New(paginationContainer)
.Title("Which workspace do you want to use as your default?".AsQuestion())
.Title(Prompts.SelectDefaultWorkspace.AsQuestion())
.UseConverter(x => x.Name)
.RenderAsync(console, cancellationToken);

Expand All @@ -73,7 +73,7 @@ private static async Task<int> ExecuteAsync(
var selectedWorkspace = new Workspace(selected.Id, selected.Name);
await sessionService.SelectWorkspaceAsync(selectedWorkspace, cancellationToken);

console.OkQuestion("Which workspace do you want to use as your default?", selectedWorkspace.Name);
console.OkQuestion(Prompts.SelectDefaultWorkspace, selectedWorkspace.Name);

return ExitCodes.Success;
}
Expand Down
Loading
Loading