Class ContractBroker
- Namespace
- Kuestenlogik.Bowire.Contracts
- Assembly
- Kuestenlogik.Bowire.Contracts.dll
Minimal Pact Broker REST client (#191). Only two operations — publish a consumer contract and retrieve the latest contract for a provider — over the broker's documented, stable URL scheme. Reused rather than reinvented, per the issue.
Every method here reaches the network, so the whole broker path is
gated behind an explicit --broker-url on the CLI: outbound
calls stay opt-in, never a default.
public static class ContractBroker
- Inheritance
-
ContractBroker
- Inherited Members
Methods
FetchLatestAsync(HttpClient, string, string, string?, CancellationToken)
Retrieve the latest contract for a provider:
GET {broker}/pacts/provider/{P}/latest, or
.../latest/{tag} when tag is set.
Returns the parsed contract, or throws
ContractBrokerException on a non-success status.
public static Task<PactContract> FetchLatestAsync(HttpClient http, string brokerUrl, string provider, string? tag, CancellationToken ct)
Parameters
httpHttpClientbrokerUrlstringproviderstringtagstringctCancellationToken
Returns
PublishAsync(HttpClient, string, PactContract, string, string?, CancellationToken)
Publish a consumer contract:
PUT {broker}/pacts/provider/{P}/consumer/{C}/version/{version}.
When tag is set, also tag the consumer version:
PUT {broker}/pacticipants/{C}/versions/{version}/tags/{tag}.
public static Task PublishAsync(HttpClient http, string brokerUrl, PactContract contract, string version, string? tag, CancellationToken ct)
Parameters
httpHttpClientbrokerUrlstringcontractPactContractversionstringtagstringctCancellationToken