# `Pact.Builders.PactBuilder`

Builder for `Pact` objects.

# `interaction`

```elixir
@spec interaction(
  builder :: Pact.Native.PactConsumer.PactBuilder.t(),
  description :: String.t(),
  interaction_type :: String.t(),
  build_fn :: (interaction_builder ::
                 Pact.Native.PactConsumer.InteractionBuilder.t() -&gt;
                 Pact.Native.PactConsumer.InteractionBuilder.t())
) :: Pact.Native.PactConsumer.PactBuilder.t()
```

Add a new HTTP `Interaction` to the `Pact`. Needs to return a clone of the builder that is passed in.

# `message_interaction`

```elixir
@spec message_interaction(
  builder :: Pact.Native.PactConsumer.PactBuilder.t(),
  description :: String.t(),
  build_fn :: (message_interaction_builder ::
                 Pact.Native.PactConsumer.MessageInteractionBuilder.t() -&gt;
                 Pact.Native.PactConsumer.MessageInteractionBuilder.t())
) :: Pact.Native.PactConsumer.PactBuilder.t()
```

Add a new Asynchronous message `Interaction` to the `Pact`

# `messages`

```elixir
@spec messages(builder :: Pact.Native.PactConsumer.PactBuilder.t()) :: [
  Pact.Native.PactConsumer.AsynchronousMessage.t()
]
```

Returns an iterator over the asynchronous messages in the Pact

# `new`

```elixir
@spec new(consumer :: String.t(), provider :: String.t()) ::
  Pact.Native.PactConsumer.PactBuilder.t()
```

Create a new `PactBuilder`, specifying the names of the service
consuming the API and the service providing it.

# `new_v4`

```elixir
@spec new_v4(consumer :: String.t(), provider :: String.t()) ::
  Pact.Native.PactConsumer.PactBuilder.t()
```

Create a new `PactBuilder` for a V4 specification Pact, specifying the names of the service consuming the API and the service providing it.

# `start_mock_server`

```elixir
@spec start_mock_server(builder :: Pact.Native.PactConsumer.PactBuilder.t()) ::
  :ignore | {:error, any()} | {:ok, pid()}
```

Start a mock server running in a background thread. If the catalog entry is omitted, then a standard HTTP mock server will be started.

# `using_plugin`

```elixir
@spec using_plugin(
  builder :: Pact.Native.PactConsumer.PactBuilder.t(),
  name :: String.t(),
  version :: String.t() | nil
) :: Pact.Native.PactConsumer.PactBuilder.t()
```

Add a plugin to be used by the test. This requires the plugins feature.

Panics: Plugins only work with V4 specification pacts. This method will panic if the pact being built is V3 format. Use PactBuilder::new_v4 to create a builder with a V4 format pact.

# `v4?`

```elixir
@spec v4?(builder :: Pact.Native.PactConsumer.PactBuilder.t()) :: bool()
```

Checks whether the given pact builder is using the V4 specification.

---

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