# `Pact.Builders.InteractionBuilder`

Builder for `Interaction` objects. Normally created via
`Pact.Builder.PactBuilder.interaction`.

# `build`

```elixir
@spec build(builder :: Pact.Native.PactConsumer.InteractionBuilder.t()) ::
  Pact.Native.PactConsumer.Interaction.t()
```

The interaction we've built.

# `build_v4`

```elixir
@spec build_v4(builder :: Pact.Native.PactConsumer.InteractionBuilder.t()) ::
  Pact.Native.PactConsumer.Interaction.t()
```

The interaction we've built (in V4 format).

# `comment`

```elixir
@spec comment(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  comment :: String.t()
) ::
  Pact.Native.PactConsumer.InteractionBuilder.t()
```

Adds a text comment to this interaction. This allows to specify just a bit more information about the interaction. It has no functional impact, but can be displayed in the broker HTML page, and potentially in the test output.

# `given`

```elixir
@spec given(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  given :: String.t()
) ::
  Pact.Native.PactConsumer.InteractionBuilder.t()
```

Specify a "provider state" for this interaction. This is normally use to
set up database fixtures when using a pact to test a provider.

# `given_with_params`

```elixir
@spec given_with_params(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  given :: String.t(),
  params :: term()
) :: Pact.Native.PactConsumer.InteractionBuilder.t()
```

Specify a "provider state" for this interaction with some defined parameters. This is normally use to set up database fixtures when using a pact to test a provider.

# `new`

```elixir
@spec new(description :: String.t(), interaction_type :: String.t()) ::
  Pact.Native.PactConsumer.InteractionBuilder.t()
```

Create a new interaction.

# `pending`

```elixir
@spec pending(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  pending :: bool()
) ::
  Pact.Native.PactConsumer.InteractionBuilder.t()
```

Sets this interaction as pending. This will permantly mark the interaction as pending in the
Pact file, and it will not cause a verification failure.

# `request`

```elixir
@spec request(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  build_fn :: (request_builder :: Pact.Native.PactConsumer.RequestBuilder.t() -&gt;
                 Pact.Native.PactConsumer.RequestBuilder.t())
) :: Pact.Native.PactConsumer.InteractionBuilder.t()
```

Define the request for this interaction.

# `response`

```elixir
@spec response(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  build_fn :: (response_builder :: Pact.Native.PactConsumer.RequestBuilder.t() -&gt;
                 Pact.Native.PactConsumer.RequestBuilder.t())
) :: Pact.Native.PactConsumer.InteractionBuilder.t()
```

Define the response for this interaction.

# `test_name`

```elixir
@spec test_name(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  name :: String.t()
) ::
  Pact.Native.PactConsumer.InteractionBuilder.t()
```

Sets the test name for this interaction. This allows to specify just a bit more information about the interaction. It has no functional impact, but can be displayed in the broker HTML page, and potentially in the test output.

# `transport`

```elixir
@spec transport(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  name :: String.t()
) ::
  Pact.Native.PactConsumer.InteractionBuilder.t()
```

Sets the protocol transport for this interaction. This would be required when there are different types of interactions in the Pact file (i.e. HTTP and messages).

# `with_key`

```elixir
@spec with_key(
  builder :: Pact.Native.PactConsumer.InteractionBuilder.t(),
  key :: String.t()
) ::
  Pact.Native.PactConsumer.InteractionBuilder.t()
```

Specify a unique key for this interaction. This key will be used to determin
equality of the interaction, so must be unique.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
