# IInteractionService Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [IInteractionService](/reference/api/csharp/aspire.hosting/iinteractionservice.md)
- Kind: `Methods`
- Members: `6`

A service to interact with the current development environment.

## PromptConfirmationAsync(string, string, MessageBoxInteractionOptions?, CancellationToken)

- Name: `PromptConfirmationAsync(string, string, MessageBoxInteractionOptions?, CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task<InteractionResult<bool>>`

Prompts the user for confirmation with a dialog.

```csharp
public interface IInteractionService
{
    public abstract Task<InteractionResult<bool>> PromptConfirmationAsync(
        string title,
        string message,
        MessageBoxInteractionOptions? options = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `title` (`string`)
  The title of the dialog.
- `message` (`string`)
  The message to display in the dialog.
- `options` ([MessageBoxInteractionOptions?](/reference/api/csharp/aspire.hosting/messageboxinteractionoptions.md)) `optional`
  Optional configuration for the message box interaction.
- `cancellationToken` (`CancellationToken`) `optional`
  A token to cancel the operation.

## Returns

`Task<InteractionResult<bool>>` -- An `Hosting.InteractionResult`1` containing `true` if the user confirmed, `false` otherwise.

## PromptInputAsync(string, string?, string, string, InputsDialogInteractionOptions?, CancellationToken)

- Name: `PromptInputAsync(string, string?, string, string, InputsDialogInteractionOptions?, CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task<InteractionResult<InteractionInput>>`

Prompts the user for a single text input.

```csharp
public interface IInteractionService
{
    public abstract Task<InteractionResult<InteractionInput>> PromptInputAsync(
        string title,
        string? message,
        string inputLabel,
        string placeHolder,
        InputsDialogInteractionOptions? options = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `title` (`string`)
  The title of the input dialog.
- `message` (`string?`)
  The message to display in the dialog.
- `inputLabel` (`string`)
  The label for the input field.
- `placeHolder` (`string`)
  The placeholder text for the input field.
- `options` ([InputsDialogInteractionOptions?](/reference/api/csharp/aspire.hosting/inputsdialoginteractionoptions.md)) `optional`
  Optional configuration for the input dialog interaction.
- `cancellationToken` (`CancellationToken`) `optional`
  A token to cancel the operation.

## Returns

`Task<InteractionResult<InteractionInput>>` -- An `Hosting.InteractionResult`1` containing the user's input.

## PromptInputAsync(string, string?, InteractionInput, InputsDialogInteractionOptions?, CancellationToken)

- Name: `PromptInputAsync(string, string?, InteractionInput, InputsDialogInteractionOptions?, CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task<InteractionResult<InteractionInput>>`

Prompts the user for a single input using a specified [InteractionInput](/reference/api/csharp/aspire.hosting/interactioninput.md).

```csharp
public interface IInteractionService
{
    public abstract Task<InteractionResult<InteractionInput>> PromptInputAsync(
        string title,
        string? message,
        InteractionInput input,
        InputsDialogInteractionOptions? options = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `title` (`string`)
  The title of the input dialog.
- `message` (`string?`)
  The message to display in the dialog.
- `input` ([InteractionInput](/reference/api/csharp/aspire.hosting/interactioninput.md))
  The input configuration.
- `options` ([InputsDialogInteractionOptions?](/reference/api/csharp/aspire.hosting/inputsdialoginteractionoptions.md)) `optional`
  Optional configuration for the input dialog interaction.
- `cancellationToken` (`CancellationToken`) `optional`
  A token to cancel the operation.

## Returns

`Task<InteractionResult<InteractionInput>>` -- An `Hosting.InteractionResult`1` containing the user's input.

## PromptInputsAsync(string, string?, IReadOnlyList<InteractionInput>, InputsDialogInteractionOptions?, CancellationToken)

- Name: `PromptInputsAsync(string, string?, IReadOnlyList<InteractionInput>, InputsDialogInteractionOptions?, CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task<InteractionResult<InteractionInputCollection>>`

Prompts the user for multiple inputs.

```csharp
public interface IInteractionService
{
    public abstract Task<InteractionResult<InteractionInputCollection>> PromptInputsAsync(
        string title,
        string? message,
        IReadOnlyList<InteractionInput> inputs,
        InputsDialogInteractionOptions? options = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `title` (`string`)
  The title of the input dialog.
- `message` (`string?`)
  The message to display in the dialog.
- `inputs` ([IReadOnlyList<InteractionInput>](/reference/api/csharp/aspire.hosting/interactioninput.md))
  A collection of [InteractionInput](/reference/api/csharp/aspire.hosting/interactioninput.md) to prompt for.
- `options` ([InputsDialogInteractionOptions?](/reference/api/csharp/aspire.hosting/inputsdialoginteractionoptions.md)) `optional`
  Optional configuration for the input dialog interaction.
- `cancellationToken` (`CancellationToken`) `optional`
  A token to cancel the operation.

## Returns

`Task<InteractionResult<InteractionInputCollection>>` -- An `Hosting.InteractionResult`1` containing the user's inputs as an [InteractionInputCollection](/reference/api/csharp/aspire.hosting/interactioninputcollection.md).

## PromptMessageBoxAsync(string, string, MessageBoxInteractionOptions?, CancellationToken)

- Name: `PromptMessageBoxAsync(string, string, MessageBoxInteractionOptions?, CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task<InteractionResult<bool>>`

Prompts the user with a message box dialog.

```csharp
public interface IInteractionService
{
    public abstract Task<InteractionResult<bool>> PromptMessageBoxAsync(
        string title,
        string message,
        MessageBoxInteractionOptions? options = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `title` (`string`)
  The title of the message box.
- `message` (`string`)
  The message to display in the message box.
- `options` ([MessageBoxInteractionOptions?](/reference/api/csharp/aspire.hosting/messageboxinteractionoptions.md)) `optional`
  Optional configuration for the message box interaction.
- `cancellationToken` (`CancellationToken`) `optional`
  A token to cancel the operation.

## Returns

`Task<InteractionResult<bool>>` -- An `Hosting.InteractionResult`1` containing `true` if the user accepted, `false` otherwise.

## PromptNotificationAsync(string, string, NotificationInteractionOptions?, CancellationToken)

- Name: `PromptNotificationAsync(string, string, NotificationInteractionOptions?, CancellationToken)`
- Modifiers: `abstract`
- Returns: `Task<InteractionResult<bool>>`

Prompts the user with a notification.

```csharp
public interface IInteractionService
{
    public abstract Task<InteractionResult<bool>> PromptNotificationAsync(
        string title,
        string message,
        NotificationInteractionOptions? options = null,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `title` (`string`)
  The title of the notification.
- `message` (`string`)
  The message to display in the notification.
- `options` ([NotificationInteractionOptions?](/reference/api/csharp/aspire.hosting/notificationinteractionoptions.md)) `optional`
  Optional configuration for the notification interaction.
- `cancellationToken` (`CancellationToken`) `optional`
  A token to cancel the operation.

## Returns

`Task<InteractionResult<bool>>` -- An `Hosting.InteractionResult`1` containing `true` if the user accepted, `false` otherwise.
