[−][src]Struct pact_matching::models::Pact
Struct that represents a pact between the consumer and provider of a service.
Fields
consumer: Consumer
Consumer side of the pact
provider: Provider
Provider side of the pact
interactions: Vec<Interaction>
List of interactions between the consumer and provider.
metadata: BTreeMap<String, BTreeMap<String, String>>
Metadata associated with this pact file.
specification_version: PactSpecification
Specification version of this pact
Methods
impl Pact
[src]
pub fn spec_version(&self) -> PactSpecification
[src]
Returns the specification version of this pact
pub fn from_json(file: &String, pact_json: &Value) -> Pact
[src]
Creates a Pact
from a Value
struct.
pub fn to_json(&self, pact_spec: PactSpecification) -> Value
[src]
Converts this pact to a Value
struct.
pub fn metadata_to_json(
&self,
pact_spec: &PactSpecification
) -> BTreeMap<String, Value>
[src]
&self,
pact_spec: &PactSpecification
) -> BTreeMap<String, Value>
Creates a BTreeMap of the metadata of this pact.
pub fn merge(&self, pact: &Pact) -> Result<Pact, String>
[src]
Merges this pact with the other pact, and returns a new Pact with the interactions sorted. Returns an error if there is a merge conflict, which will occur if any interaction has the same description and provider state and the requests and responses are different.
pub fn default_file_name(&self) -> String
[src]
Determines the default file name for the pact. This is based on the consumer and provider names.
pub fn read_pact(file: &Path) -> Result<Pact>
[src]
Reads the pact file and parses the resulting JSON into a Pact
struct
pub fn from_url(url: &String, auth: &Option<HttpAuth>) -> Result<Pact, String>
[src]
Reads the pact file from a URL and parses the resulting JSON into a Pact
struct
pub fn write_pact(
&self,
path: &Path,
pact_spec: PactSpecification
) -> Result<()>
[src]
&self,
path: &Path,
pact_spec: PactSpecification
) -> Result<()>
Writes this pact out to the provided file path. All directories in the path will automatically created. If an existing pact is found at the path, this pact will be merged into the pact file.
pub fn default() -> Pact
[src]
Returns a default Pact struct
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Pact
impl Send for Pact
impl Sync for Pact
impl Unpin for Pact
impl UnwindSafe for Pact
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
U: TryFrom<T>,