Trait pact_models::interaction::Interaction [−][src]
pub trait Interaction: Debug {
Show 21 methods
fn type_of(&self) -> String;
fn is_request_response(&self) -> bool;
fn as_request_response(&self) -> Option<RequestResponseInteraction>;
fn is_message(&self) -> bool;
fn as_message(&self) -> Option<Message>;
fn id(&self) -> Option<String>;
fn description(&self) -> String;
fn provider_states(&self) -> Vec<ProviderState>;
fn contents(&self) -> OptionalBody;
fn contents_for_verification(&self) -> OptionalBody;
fn content_type(&self) -> Option<ContentType>;
fn is_v4(&self) -> bool;
fn as_v4(&self) -> Option<Box<dyn V4Interaction>>;
fn as_v4_http(&self) -> Option<SynchronousHttp>;
fn as_v4_async_message(&self) -> Option<AsynchronousMessage>;
fn as_v4_sync_message(&self) -> Option<SynchronousMessage>;
fn boxed(&self) -> Box<dyn Interaction + Send + Sync>;
fn arced(&self) -> Arc<dyn Interaction + Send + Sync>;
fn thread_safe(&self) -> Arc<Mutex<dyn Interaction + Send + Sync>>;
fn matching_rules(&self) -> Option<MatchingRules>;
fn pending(&self) -> bool { ... }
}
Expand description
Interaction Trait
Required methods
fn is_request_response(&self) -> bool
fn is_request_response(&self) -> bool
If this is a request/response interaction
fn as_request_response(&self) -> Option<RequestResponseInteraction>
fn as_request_response(&self) -> Option<RequestResponseInteraction>
Returns the request/response interaction if it is one
fn is_message(&self) -> bool
fn is_message(&self) -> bool
If this is a message interaction
fn as_message(&self) -> Option<Message>
fn as_message(&self) -> Option<Message>
Returns the message interaction if it is one
Interaction ID. This will only be set if the Pact file was fetched from a Pact Broker
fn description(&self) -> String
fn description(&self) -> String
Description of this interaction. This needs to be unique in the pact file.
fn provider_states(&self) -> Vec<ProviderState>
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.
fn contents(&self) -> OptionalBody
fn contents(&self) -> OptionalBody
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
fn contents_for_verification(&self) -> OptionalBody
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
fn content_type(&self) -> Option<ContentType>
fn content_type(&self) -> Option<ContentType>
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.
fn as_v4(&self) -> Option<Box<dyn V4Interaction>>
fn as_v4(&self) -> Option<Box<dyn V4Interaction>>
Returns the interaction in V4 format
fn as_v4_http(&self) -> Option<SynchronousHttp>
fn as_v4_http(&self) -> Option<SynchronousHttp>
Returns the interaction in V4 format
fn as_v4_async_message(&self) -> Option<AsynchronousMessage>
fn as_v4_async_message(&self) -> Option<AsynchronousMessage>
Returns the interaction in V4 format
fn as_v4_sync_message(&self) -> Option<SynchronousMessage>
fn as_v4_sync_message(&self) -> Option<SynchronousMessage>
Returns the interaction in V4 format
Clones this interaction and wraps it in a Box
Clones this interaction and wraps it in an Arc
fn thread_safe(&self) -> Arc<Mutex<dyn Interaction + Send + Sync>>
fn thread_safe(&self) -> Arc<Mutex<dyn Interaction + Send + Sync>>
Clones this interaction and wraps it in an Arc and Mutex
fn matching_rules(&self) -> Option<MatchingRules>
fn matching_rules(&self) -> Option<MatchingRules>
Returns the matching rules associated with this interaction (if there are any)