pub struct RequestResponseInteraction {
    pub id: Option<String>,
    pub description: String,
    pub provider_states: Vec<ProviderState>,
    pub request: Request,
    pub response: Response,
}
Expand description

Struct that defines an interaction (request and response pair)

Fields§

§id: Option<String>

Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker

§description: String

Description of this interaction. This needs to be unique in the pact file.

§provider_states: Vec<ProviderState>

Optional provider states for the interaction. See <https://docs.pact.io/getting_started/provider_states> for more info on provider states.

§request: Request

Request of the interaction

§response: Response

Response of the interaction

Implementations§

source§

impl RequestResponseInteraction

source

pub fn from_json( index: usize, pact_json: &Value, spec_version: &PactSpecification ) -> Result<RequestResponseInteraction>

Constructs an Interaction from the Value struct.

source

pub fn to_json(&self, spec_version: &PactSpecification) -> Value

Converts this interaction to a Value struct.

source

pub fn conflicts_with(&self, other: &dyn Interaction) -> Vec<PactConflict>

Returns list of conflicts if this interaction conflicts with the other interaction.

Two interactions conflict if they have the same description and provider state, but they request and responses are not equal

source

pub fn schema(_spec_version: PactSpecification) -> Value

Generate the JSON schema properties for the given Pact specification

Trait Implementations§

source§

impl Clone for RequestResponseInteraction

source§

fn clone(&self) -> RequestResponseInteraction

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RequestResponseInteraction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for RequestResponseInteraction

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for RequestResponseInteraction

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for RequestResponseInteraction

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Interaction for RequestResponseInteraction

source§

fn type_of(&self) -> String

The type of the interaction
source§

fn is_request_response(&self) -> bool

If this is a request/response interaction
source§

fn as_request_response(&self) -> Option<RequestResponseInteraction>

Returns the request/response interaction if it is one
source§

fn is_message(&self) -> bool

If this is a message interaction
source§

fn as_message(&self) -> Option<Message>

Returns the message interaction if it is one
source§

fn id(&self) -> Option<String>

Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker
source§

fn description(&self) -> String

Description of this interaction. This needs to be unique in the pact file.
source§

fn set_id(&mut self, id: Option<String>)

Set the Interaction ID
source§

fn set_description(&mut self, description: &str)

Set the description of this interaction. This needs to be unique in the pact file.
source§

fn provider_states(&self) -> Vec<ProviderState>

Optional provider states for the interaction. See <https://docs.pact.io/getting_started/provider_states> for more info on provider states.
source§

fn provider_states_mut(&mut self) -> &mut Vec<ProviderState>

Mutable Optional provider states for the interaction. See <https://docs.pact.io/getting_started/provider_states> for more info on provider states.
source§

fn contents(&self) -> OptionalBody

👎Deprecated since 0.1.0: Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
Body of the response or message
source§

fn contents_for_verification(&self) -> OptionalBody

The contents of the part to use for verification. For example, with HTTP interactions, this will be the response body
source§

fn content_type(&self) -> Option<ContentType>

👎Deprecated since 0.1.0: Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
Determine the content type of the interaction. If a Content-Type header or metadata value is present, the value of that value will be returned. Otherwise, the contents will be inspected.
source§

fn is_v4(&self) -> bool

If this is a V4 interaction
source§

fn as_v4(&self) -> Option<Box<dyn V4Interaction + Send + Sync + RefUnwindSafe>>

Returns the interaction in V4 format
source§

fn as_v4_mut(&mut self) -> Option<&mut dyn V4Interaction>

Returns a mutable reference for the interaction. If the interaction is not a V4 format, will return None. The as_v4 method can convert to V4 format (via cloning the data).
source§

fn as_v4_http(&self) -> Option<SynchronousHttp>

Returns the interaction in V4 format
source§

fn as_v4_async_message(&self) -> Option<AsynchronousMessage>

Returns the interaction in V4 format
source§

fn as_v4_sync_message(&self) -> Option<SynchronousMessage>

Returns the interaction in V4 format
source§

fn as_v4_http_mut(&mut self) -> Option<&mut SynchronousHttp>

Returns the interaction in V4 format
source§

fn as_v4_async_message_mut(&mut self) -> Option<&mut AsynchronousMessage>

Returns the interaction in V4 format
source§

fn as_v4_sync_message_mut(&mut self) -> Option<&mut SynchronousMessage>

Returns the interaction in V4 format
source§

fn boxed(&self) -> Box<dyn Interaction + Send + Sync + RefUnwindSafe>

Clones this interaction and wraps it in a Box
source§

fn arced(&self) -> Arc<dyn Interaction + Send + Sync + RefUnwindSafe>

Clones this interaction and wraps it in an Arc
source§

fn thread_safe( &self ) -> Arc<Mutex<dyn Interaction + Send + Sync + RefUnwindSafe>>

Clones this interaction and wraps it in an Arc and Mutex
source§

fn matching_rules(&self) -> Option<MatchingRules>

👎Deprecated since 0.2.1: Some interactions have multiple contents (like request/response), so it is impossible to know which to return for this method
Returns the matching rules associated with this interaction (if there are any)
source§

fn is_v4_http(&self) -> bool

If the interaction is V4 HTTP
source§

fn is_v4_async_message(&self) -> bool

If the interaction is a V4 message
source§

fn is_v4_sync_message(&self) -> bool

If the interaction is a V4 synchronous request/response message
source§

fn pending(&self) -> bool

If this interaction is pending (V4 only)
source§

impl PactJsonVerifier for RequestResponseInteraction

source§

fn verify_json( path: &str, pact_json: &Value, strict: bool, spec_version: PactSpecification ) -> Vec<PactFileVerificationResult>

Verify the JSON format. Will return an error if the list contains any Error result
source§

impl PartialEq for RequestResponseInteraction

source§

fn eq(&self, other: &RequestResponseInteraction) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for RequestResponseInteraction

source§

impl StructuralEq for RequestResponseInteraction

source§

impl StructuralPartialEq for RequestResponseInteraction

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> Fmt for T
where T: Display,

source§

fn fg<C>(self, color: C) -> Foreground<Self>
where C: Into<Option<Color>>, Self: Display,

Give this value the specified foreground colour.
source§

fn bg<C>(self, color: C) -> Background<Self>
where C: Into<Option<Color>>, Self: Display,

Give this value the specified background colour.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more