pact_plugin_driver/
proto.rs

1use pact_models::prelude::OptionalBody;
2use pact_models::content_types::ContentTypeHint;
3
4// Build with PACT_PLUGIN_BUILD_PROTOBUFS set, then include the following
5// tonic::include_proto!("io.pact.plugin");
6
7// ------------------ Generated --------------------------//
8// This file is @generated by prost-build.
9/// Request to verify the plugin has loaded OK
10#[derive(Clone, PartialEq, ::prost::Message)]
11pub struct InitPluginRequest {
12  /// Implementation calling the plugin
13  #[prost(string, tag = "1")]
14  pub implementation: ::prost::alloc::string::String,
15  /// Version of the implementation
16  #[prost(string, tag = "2")]
17  pub version: ::prost::alloc::string::String,
18}
19/// Entry to be added to the core catalogue. Each entry describes one of the features the plugin provides.
20/// Entries will be stored in the catalogue under the key "plugin/$name/$type/$key".
21#[derive(Clone, PartialEq, ::prost::Message)]
22pub struct CatalogueEntry {
23  /// Entry type
24  #[prost(enumeration = "catalogue_entry::EntryType", tag = "1")]
25  pub r#type: i32,
26  /// Entry key
27  #[prost(string, tag = "2")]
28  pub key: ::prost::alloc::string::String,
29  /// Associated data required for the entry. For CONTENT_MATCHER and CONTENT_GENERATOR types, a "content-types"
30  /// value (separated by semi-colons) is required for all the content types the plugin supports.
31  #[prost(map = "string, string", tag = "3")]
32  pub values: ::std::collections::HashMap<
33    ::prost::alloc::string::String,
34    ::prost::alloc::string::String,
35  >,
36}
37/// Nested message and enum types in `CatalogueEntry`.
38pub mod catalogue_entry {
39  #[derive(
40    Clone,
41    Copy,
42    Debug,
43    PartialEq,
44    Eq,
45    Hash,
46    PartialOrd,
47    Ord,
48    ::prost::Enumeration
49  )]
50  #[repr(i32)]
51  pub enum EntryType {
52    /// Matcher for contents of messages, requests or response bodies
53    ContentMatcher = 0,
54    /// Generator for contents of messages, requests or response bodies
55    ContentGenerator = 1,
56    /// Transport for a network protocol
57    Transport = 2,
58    /// Matching rule for content field/values
59    Matcher = 3,
60    /// Type of interaction
61    Interaction = 4,
62  }
63  impl EntryType {
64    /// String value of the enum field names used in the ProtoBuf definition.
65    ///
66    /// The values are not transformed in any way and thus are considered stable
67    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
68    pub fn as_str_name(&self) -> &'static str {
69      match self {
70        Self::ContentMatcher => "CONTENT_MATCHER",
71        Self::ContentGenerator => "CONTENT_GENERATOR",
72        Self::Transport => "TRANSPORT",
73        Self::Matcher => "MATCHER",
74        Self::Interaction => "INTERACTION",
75      }
76    }
77    /// Creates an enum from field names used in the ProtoBuf definition.
78    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
79      match value {
80        "CONTENT_MATCHER" => Some(Self::ContentMatcher),
81        "CONTENT_GENERATOR" => Some(Self::ContentGenerator),
82        "TRANSPORT" => Some(Self::Transport),
83        "MATCHER" => Some(Self::Matcher),
84        "INTERACTION" => Some(Self::Interaction),
85        _ => None,
86      }
87    }
88  }
89}
90/// Response to init plugin, providing the catalogue entries the plugin provides
91#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct InitPluginResponse {
93  /// List of entries the plugin supports
94  #[prost(message, repeated, tag = "1")]
95  pub catalogue: ::prost::alloc::vec::Vec<CatalogueEntry>,
96}
97/// Catalogue of Core Pact + Plugin features
98#[derive(Clone, PartialEq, ::prost::Message)]
99pub struct Catalogue {
100  /// List of entries from the core catalogue
101  #[prost(message, repeated, tag = "1")]
102  pub catalogue: ::prost::alloc::vec::Vec<CatalogueEntry>,
103}
104/// Message representing a request, response or message body
105#[derive(Clone, PartialEq, ::prost::Message)]
106pub struct Body {
107  /// The content type of the body in MIME format (i.e. application/json)
108  #[prost(string, tag = "1")]
109  pub content_type: ::prost::alloc::string::String,
110  /// Bytes of the actual content
111  #[prost(message, optional, tag = "2")]
112  pub content: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
113  /// Content type override to apply (if required). If omitted, the default rules of the Pact implementation
114  /// will be used
115  #[prost(enumeration = "body::ContentTypeHint", tag = "3")]
116  pub content_type_hint: i32,
117}
118/// Nested message and enum types in `Body`.
119pub mod body {
120  /// Enum of content type override. This is a hint on how the content type should be treated.
121  #[derive(
122    Clone,
123    Copy,
124    Debug,
125    PartialEq,
126    Eq,
127    Hash,
128    PartialOrd,
129    Ord,
130    ::prost::Enumeration
131  )]
132  #[repr(i32)]
133  pub enum ContentTypeHint {
134    /// Determine the form of the content using the default rules of the Pact implementation
135    Default = 0,
136    /// Contents must always be treated as a text form
137    Text = 1,
138    /// Contents must always be treated as a binary form
139    Binary = 2,
140  }
141  impl ContentTypeHint {
142    /// String value of the enum field names used in the ProtoBuf definition.
143    ///
144    /// The values are not transformed in any way and thus are considered stable
145    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
146    pub fn as_str_name(&self) -> &'static str {
147      match self {
148        Self::Default => "DEFAULT",
149        Self::Text => "TEXT",
150        Self::Binary => "BINARY",
151      }
152    }
153    /// Creates an enum from field names used in the ProtoBuf definition.
154    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
155      match value {
156        "DEFAULT" => Some(Self::Default),
157        "TEXT" => Some(Self::Text),
158        "BINARY" => Some(Self::Binary),
159        _ => None,
160      }
161    }
162  }
163}
164/// Request to preform a comparison on an actual body given the expected one
165#[derive(Clone, PartialEq, ::prost::Message)]
166pub struct CompareContentsRequest {
167  /// Expected body from the Pact interaction
168  #[prost(message, optional, tag = "1")]
169  pub expected: ::core::option::Option<Body>,
170  /// Actual received body
171  #[prost(message, optional, tag = "2")]
172  pub actual: ::core::option::Option<Body>,
173  /// If unexpected keys or attributes should be allowed. Setting this to false results in additional keys or fields
174  /// will cause a mismatch
175  #[prost(bool, tag = "3")]
176  pub allow_unexpected_keys: bool,
177  /// Map of expressions to matching rules. The expressions follow the documented Pact matching rule expressions
178  #[prost(map = "string, message", tag = "4")]
179  pub rules: ::std::collections::HashMap<
180    ::prost::alloc::string::String,
181    MatchingRules,
182  >,
183  /// Additional data added to the Pact/Interaction by the plugin
184  #[prost(message, optional, tag = "5")]
185  pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
186}
187/// Indicates that there was a mismatch with the content type
188#[derive(Clone, PartialEq, ::prost::Message)]
189pub struct ContentTypeMismatch {
190  /// Expected content type (MIME format)
191  #[prost(string, tag = "1")]
192  pub expected: ::prost::alloc::string::String,
193  /// Actual content type received (MIME format)
194  #[prost(string, tag = "2")]
195  pub actual: ::prost::alloc::string::String,
196}
197/// A mismatch for an particular item of content
198#[derive(Clone, PartialEq, ::prost::Message)]
199pub struct ContentMismatch {
200  /// Expected data bytes
201  #[prost(message, optional, tag = "1")]
202  pub expected: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
203  /// Actual data bytes
204  #[prost(message, optional, tag = "2")]
205  pub actual: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
206  /// Description of the mismatch
207  #[prost(string, tag = "3")]
208  pub mismatch: ::prost::alloc::string::String,
209  /// Path to the item that was matched. This is the value as per the documented Pact matching rule expressions.
210  #[prost(string, tag = "4")]
211  pub path: ::prost::alloc::string::String,
212  /// Optional diff of the contents
213  #[prost(string, tag = "5")]
214  pub diff: ::prost::alloc::string::String,
215  /// Part of the interaction that the mismatch is for: body, headers, metadata, etc.
216  #[prost(string, tag = "6")]
217  pub mismatch_type: ::prost::alloc::string::String,
218}
219/// List of content mismatches
220#[derive(Clone, PartialEq, ::prost::Message)]
221pub struct ContentMismatches {
222  #[prost(message, repeated, tag = "1")]
223  pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
224}
225/// Response to the CompareContentsRequest with the results of the comparison
226#[derive(Clone, PartialEq, ::prost::Message)]
227pub struct CompareContentsResponse {
228  /// Error message if an error occurred. If this field is set, the remaining fields will be ignored and the
229  /// verification marked as failed
230  #[prost(string, tag = "1")]
231  pub error: ::prost::alloc::string::String,
232  /// There was a mismatch with the types of content. If this is set, the results may not be set.
233  #[prost(message, optional, tag = "2")]
234  pub type_mismatch: ::core::option::Option<ContentTypeMismatch>,
235  /// Results of the match, keyed by matching rule expression
236  #[prost(map = "string, message", tag = "3")]
237  pub results: ::std::collections::HashMap<
238    ::prost::alloc::string::String,
239    ContentMismatches,
240  >,
241}
242/// Request to configure/setup an interaction so that it can be verified later
243#[derive(Clone, PartialEq, ::prost::Message)]
244pub struct ConfigureInteractionRequest {
245  /// Content type of the interaction (MIME format)
246  #[prost(string, tag = "1")]
247  pub content_type: ::prost::alloc::string::String,
248  /// This is data specified by the user in the consumer test
249  #[prost(message, optional, tag = "2")]
250  pub contents_config: ::core::option::Option<::prost_types::Struct>,
251}
252/// Represents a matching rule
253#[derive(Clone, PartialEq, ::prost::Message)]
254pub struct MatchingRule {
255  /// Type of the matching rule
256  #[prost(string, tag = "1")]
257  pub r#type: ::prost::alloc::string::String,
258  /// Associated data for the matching rule
259  #[prost(message, optional, tag = "2")]
260  pub values: ::core::option::Option<::prost_types::Struct>,
261}
262/// List of matching rules
263#[derive(Clone, PartialEq, ::prost::Message)]
264pub struct MatchingRules {
265  #[prost(message, repeated, tag = "1")]
266  pub rule: ::prost::alloc::vec::Vec<MatchingRule>,
267}
268/// Example generator
269#[derive(Clone, PartialEq, ::prost::Message)]
270pub struct Generator {
271  /// Type of generator
272  #[prost(string, tag = "1")]
273  pub r#type: ::prost::alloc::string::String,
274  /// Associated data for the generator
275  #[prost(message, optional, tag = "2")]
276  pub values: ::core::option::Option<::prost_types::Struct>,
277}
278/// Plugin configuration added to the pact file by the ConfigureInteraction step
279#[derive(Clone, PartialEq, ::prost::Message)]
280pub struct PluginConfiguration {
281  /// Data to be persisted against the interaction
282  #[prost(message, optional, tag = "1")]
283  pub interaction_configuration: ::core::option::Option<::prost_types::Struct>,
284  /// Data to be persisted in the Pact file metadata (Global data)
285  #[prost(message, optional, tag = "2")]
286  pub pact_configuration: ::core::option::Option<::prost_types::Struct>,
287}
288/// Response to the configure/setup an interaction request
289#[derive(Clone, PartialEq, ::prost::Message)]
290pub struct InteractionResponse {
291  /// Contents for the interaction
292  #[prost(message, optional, tag = "1")]
293  pub contents: ::core::option::Option<Body>,
294  /// All matching rules to apply
295  #[prost(map = "string, message", tag = "2")]
296  pub rules: ::std::collections::HashMap<
297    ::prost::alloc::string::String,
298    MatchingRules,
299  >,
300  /// Generators to apply
301  #[prost(map = "string, message", tag = "3")]
302  pub generators: ::std::collections::HashMap<
303    ::prost::alloc::string::String,
304    Generator,
305  >,
306  /// For message interactions, any metadata to be applied
307  #[prost(message, optional, tag = "4")]
308  pub message_metadata: ::core::option::Option<::prost_types::Struct>,
309  /// Plugin specific data to be persisted in the pact file
310  #[prost(message, optional, tag = "5")]
311  pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
312  /// Markdown/HTML formatted text representation of the interaction
313  #[prost(string, tag = "6")]
314  pub interaction_markup: ::prost::alloc::string::String,
315  #[prost(enumeration = "interaction_response::MarkupType", tag = "7")]
316  pub interaction_markup_type: i32,
317  /// Description of what part this interaction belongs to (in the case of there being more than one, for instance,
318  /// request/response messages)
319  #[prost(string, tag = "8")]
320  pub part_name: ::prost::alloc::string::String,
321  /// All matching rules to apply to any message metadata
322  #[prost(map = "string, message", tag = "9")]
323  pub metadata_rules: ::std::collections::HashMap<
324    ::prost::alloc::string::String,
325    MatchingRules,
326  >,
327  /// Generators to apply to any message metadata
328  #[prost(map = "string, message", tag = "10")]
329  pub metadata_generators: ::std::collections::HashMap<
330    ::prost::alloc::string::String,
331    Generator,
332  >,
333}
334/// Nested message and enum types in `InteractionResponse`.
335pub mod interaction_response {
336  /// Type of markup used
337  #[derive(
338    Clone,
339    Copy,
340    Debug,
341    PartialEq,
342    Eq,
343    Hash,
344    PartialOrd,
345    Ord,
346    ::prost::Enumeration
347  )]
348  #[repr(i32)]
349  pub enum MarkupType {
350    /// CommonMark format
351    CommonMark = 0,
352    /// HTML format
353    Html = 1,
354  }
355  impl MarkupType {
356    /// String value of the enum field names used in the ProtoBuf definition.
357    ///
358    /// The values are not transformed in any way and thus are considered stable
359    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
360    pub fn as_str_name(&self) -> &'static str {
361      match self {
362        Self::CommonMark => "COMMON_MARK",
363        Self::Html => "HTML",
364      }
365    }
366    /// Creates an enum from field names used in the ProtoBuf definition.
367    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
368      match value {
369        "COMMON_MARK" => Some(Self::CommonMark),
370        "HTML" => Some(Self::Html),
371        _ => None,
372      }
373    }
374  }
375}
376/// Response to the configure/setup an interaction request
377#[derive(Clone, PartialEq, ::prost::Message)]
378pub struct ConfigureInteractionResponse {
379  /// If an error occurred. In this case, the other fields will be ignored/not set
380  #[prost(string, tag = "1")]
381  pub error: ::prost::alloc::string::String,
382  /// The actual response if no error occurred.
383  #[prost(message, repeated, tag = "2")]
384  pub interaction: ::prost::alloc::vec::Vec<InteractionResponse>,
385  /// Plugin specific data to be persisted in the pact file
386  #[prost(message, optional, tag = "3")]
387  pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
388}
389/// Request to generate the contents using any defined generators
390#[derive(Clone, PartialEq, ::prost::Message)]
391pub struct GenerateContentRequest {
392  /// Original contents
393  #[prost(message, optional, tag = "1")]
394  pub contents: ::core::option::Option<Body>,
395  /// Generators to apply
396  #[prost(map = "string, message", tag = "2")]
397  pub generators: ::std::collections::HashMap<
398    ::prost::alloc::string::String,
399    Generator,
400  >,
401  /// Additional data added to the Pact/Interaction by the plugin
402  #[prost(message, optional, tag = "3")]
403  pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
404  /// Context data provided by the test framework
405  #[prost(message, optional, tag = "4")]
406  pub test_context: ::core::option::Option<::prost_types::Struct>,
407  #[prost(enumeration = "generate_content_request::TestMode", tag = "5")]
408  pub test_mode: i32,
409  #[prost(enumeration = "generate_content_request::ContentFor", tag = "6")]
410  pub content_for: i32,
411}
412/// Nested message and enum types in `GenerateContentRequest`.
413pub mod generate_content_request {
414  /// The mode of the generation, if running from a consumer test or during provider verification
415  #[derive(
416    Clone,
417    Copy,
418    Debug,
419    PartialEq,
420    Eq,
421    Hash,
422    PartialOrd,
423    Ord,
424    ::prost::Enumeration
425  )]
426  #[repr(i32)]
427  pub enum TestMode {
428    Unknown = 0,
429    /// Running on the consumer side
430    Consumer = 1,
431    /// Running on the provider side
432    Provider = 2,
433  }
434  impl TestMode {
435    /// String value of the enum field names used in the ProtoBuf definition.
436    ///
437    /// The values are not transformed in any way and thus are considered stable
438    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
439    pub fn as_str_name(&self) -> &'static str {
440      match self {
441        Self::Unknown => "Unknown",
442        Self::Consumer => "Consumer",
443        Self::Provider => "Provider",
444      }
445    }
446    /// Creates an enum from field names used in the ProtoBuf definition.
447    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
448      match value {
449        "Unknown" => Some(Self::Unknown),
450        "Consumer" => Some(Self::Consumer),
451        "Provider" => Some(Self::Provider),
452        _ => None,
453      }
454    }
455  }
456  /// Which part the content is for
457  #[derive(
458    Clone,
459    Copy,
460    Debug,
461    PartialEq,
462    Eq,
463    Hash,
464    PartialOrd,
465    Ord,
466    ::prost::Enumeration
467  )]
468  #[repr(i32)]
469  pub enum ContentFor {
470    Request = 0,
471    Response = 1,
472  }
473  impl ContentFor {
474    /// String value of the enum field names used in the ProtoBuf definition.
475    ///
476    /// The values are not transformed in any way and thus are considered stable
477    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
478    pub fn as_str_name(&self) -> &'static str {
479      match self {
480        Self::Request => "Request",
481        Self::Response => "Response",
482      }
483    }
484    /// Creates an enum from field names used in the ProtoBuf definition.
485    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
486      match value {
487        "Request" => Some(Self::Request),
488        "Response" => Some(Self::Response),
489        _ => None,
490      }
491    }
492  }
493}
494/// Generated body/message response
495#[derive(Clone, PartialEq, ::prost::Message)]
496pub struct GenerateContentResponse {
497  #[prost(message, optional, tag = "1")]
498  pub contents: ::core::option::Option<Body>,
499}
500/// Request to start a mock server
501#[derive(Clone, PartialEq, ::prost::Message)]
502pub struct StartMockServerRequest {
503  /// Interface to bind to. Will default to the loopback adapter
504  #[prost(string, tag = "1")]
505  pub host_interface: ::prost::alloc::string::String,
506  /// Port to bind to. Default (or a value of 0) get the OS to open a random port
507  #[prost(uint32, tag = "2")]
508  pub port: u32,
509  /// If TLS should be used (if supported by the mock server)
510  #[prost(bool, tag = "3")]
511  pub tls: bool,
512  /// Pact as JSON to use for the mock server behaviour
513  #[prost(string, tag = "4")]
514  pub pact: ::prost::alloc::string::String,
515  /// Context data provided by the test framework
516  #[prost(message, optional, tag = "5")]
517  pub test_context: ::core::option::Option<::prost_types::Struct>,
518}
519/// Response to the start mock server request
520#[derive(Clone, PartialEq, ::prost::Message)]
521pub struct StartMockServerResponse {
522  #[prost(oneof = "start_mock_server_response::Response", tags = "1, 2")]
523  pub response: ::core::option::Option<start_mock_server_response::Response>,
524}
525/// Nested message and enum types in `StartMockServerResponse`.
526pub mod start_mock_server_response {
527  #[derive(Clone, PartialEq, ::prost::Oneof)]
528  pub enum Response {
529    /// If an error occurred
530    #[prost(string, tag = "1")]
531    Error(::prost::alloc::string::String),
532    /// Mock server details
533    #[prost(message, tag = "2")]
534    Details(super::MockServerDetails),
535  }
536}
537/// Details on a running mock server
538#[derive(Clone, PartialEq, ::prost::Message)]
539pub struct MockServerDetails {
540  /// Mock server unique ID
541  #[prost(string, tag = "1")]
542  pub key: ::prost::alloc::string::String,
543  /// Port the mock server is running on
544  #[prost(uint32, tag = "2")]
545  pub port: u32,
546  /// IP address the mock server is bound to. Probably an IP6 address, but may be IP4
547  #[prost(string, tag = "3")]
548  pub address: ::prost::alloc::string::String,
549}
550/// Request to shut down a running mock server
551/// TODO: replace this with MockServerRequest in the next major version
552#[derive(Clone, PartialEq, ::prost::Message)]
553pub struct ShutdownMockServerRequest {
554  /// The server ID to shutdown
555  #[prost(string, tag = "1")]
556  pub server_key: ::prost::alloc::string::String,
557}
558/// Request for a running mock server by ID
559#[derive(Clone, PartialEq, ::prost::Message)]
560pub struct MockServerRequest {
561  /// The server ID to shutdown
562  #[prost(string, tag = "1")]
563  pub server_key: ::prost::alloc::string::String,
564}
565/// Result of a request that the mock server received
566#[derive(Clone, PartialEq, ::prost::Message)]
567pub struct MockServerResult {
568  /// service + method that was requested
569  #[prost(string, tag = "1")]
570  pub path: ::prost::alloc::string::String,
571  /// If an error occurred trying to handle the request
572  #[prost(string, tag = "2")]
573  pub error: ::prost::alloc::string::String,
574  /// Any mismatches that occurred
575  #[prost(message, repeated, tag = "3")]
576  pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
577}
578/// Response to the shut down mock server request
579/// TODO: replace this with MockServerResults in the next major version
580#[derive(Clone, PartialEq, ::prost::Message)]
581pub struct ShutdownMockServerResponse {
582  /// If the mock status is all ok
583  #[prost(bool, tag = "1")]
584  pub ok: bool,
585  /// The results of the test run, will contain an entry for each request received by the mock server
586  #[prost(message, repeated, tag = "2")]
587  pub results: ::prost::alloc::vec::Vec<MockServerResult>,
588}
589/// Matching results of the mock server.
590#[derive(Clone, PartialEq, ::prost::Message)]
591pub struct MockServerResults {
592  /// If the mock status is all ok
593  #[prost(bool, tag = "1")]
594  pub ok: bool,
595  /// The results of the test run, will contain an entry for each request received by the mock server
596  #[prost(message, repeated, tag = "2")]
597  pub results: ::prost::alloc::vec::Vec<MockServerResult>,
598}
599/// Request to prepare an interaction for verification
600#[derive(Clone, PartialEq, ::prost::Message)]
601pub struct VerificationPreparationRequest {
602  /// Pact as JSON to use for the verification
603  #[prost(string, tag = "1")]
604  pub pact: ::prost::alloc::string::String,
605  /// Interaction key for the interaction from the Pact that is being verified
606  #[prost(string, tag = "2")]
607  pub interaction_key: ::prost::alloc::string::String,
608  /// Any data supplied by the user to verify the interaction
609  #[prost(message, optional, tag = "3")]
610  pub config: ::core::option::Option<::prost_types::Struct>,
611}
612/// Request metadata value. Will either be a JSON-like value, or binary data
613#[derive(Clone, PartialEq, ::prost::Message)]
614pub struct MetadataValue {
615  #[prost(oneof = "metadata_value::Value", tags = "1, 2")]
616  pub value: ::core::option::Option<metadata_value::Value>,
617}
618/// Nested message and enum types in `MetadataValue`.
619pub mod metadata_value {
620  #[derive(Clone, PartialEq, ::prost::Oneof)]
621  pub enum Value {
622    #[prost(message, tag = "1")]
623    NonBinaryValue(::prost_types::Value),
624    #[prost(bytes, tag = "2")]
625    BinaryValue(::prost::alloc::vec::Vec<u8>),
626  }
627}
628/// Interaction request data to be sent or received for verification
629#[derive(Clone, PartialEq, ::prost::Message)]
630pub struct InteractionData {
631  /// Request/Response body as bytes
632  #[prost(message, optional, tag = "1")]
633  pub body: ::core::option::Option<Body>,
634  /// Metadata associated with the request/response
635  #[prost(map = "string, message", tag = "2")]
636  pub metadata: ::std::collections::HashMap<
637    ::prost::alloc::string::String,
638    MetadataValue,
639  >,
640}
641/// Response for the prepare an interaction for verification request
642#[derive(Clone, PartialEq, ::prost::Message)]
643pub struct VerificationPreparationResponse {
644  #[prost(oneof = "verification_preparation_response::Response", tags = "1, 2")]
645  pub response: ::core::option::Option<verification_preparation_response::Response>,
646}
647/// Nested message and enum types in `VerificationPreparationResponse`.
648pub mod verification_preparation_response {
649  #[derive(Clone, PartialEq, ::prost::Oneof)]
650  pub enum Response {
651    /// If an error occurred
652    #[prost(string, tag = "1")]
653    Error(::prost::alloc::string::String),
654    /// Interaction data required to construct any request
655    #[prost(message, tag = "2")]
656    InteractionData(super::InteractionData),
657  }
658}
659/// Request data to verify an interaction
660#[derive(Clone, PartialEq, ::prost::Message)]
661pub struct VerifyInteractionRequest {
662  /// Interaction data required to construct the request
663  #[prost(message, optional, tag = "1")]
664  pub interaction_data: ::core::option::Option<InteractionData>,
665  /// Any data supplied by the user to verify the interaction
666  #[prost(message, optional, tag = "2")]
667  pub config: ::core::option::Option<::prost_types::Struct>,
668  /// Pact as JSON to use for the verification
669  #[prost(string, tag = "3")]
670  pub pact: ::prost::alloc::string::String,
671  /// Interaction key for the interaction from the Pact that is being verified
672  #[prost(string, tag = "4")]
673  pub interaction_key: ::prost::alloc::string::String,
674}
675#[derive(Clone, PartialEq, ::prost::Message)]
676pub struct VerificationResultItem {
677  #[prost(oneof = "verification_result_item::Result", tags = "1, 2")]
678  pub result: ::core::option::Option<verification_result_item::Result>,
679}
680/// Nested message and enum types in `VerificationResultItem`.
681pub mod verification_result_item {
682  #[derive(Clone, PartialEq, ::prost::Oneof)]
683  pub enum Result {
684    #[prost(string, tag = "1")]
685    Error(::prost::alloc::string::String),
686    #[prost(message, tag = "2")]
687    Mismatch(super::ContentMismatch),
688  }
689}
690/// Result of running the verification
691#[derive(Clone, PartialEq, ::prost::Message)]
692pub struct VerificationResult {
693  /// Was the verification successful?
694  #[prost(bool, tag = "1")]
695  pub success: bool,
696  /// Interaction data retrieved from the provider (optional)
697  #[prost(message, optional, tag = "2")]
698  pub response_data: ::core::option::Option<InteractionData>,
699  /// Any mismatches that occurred
700  #[prost(message, repeated, tag = "3")]
701  pub mismatches: ::prost::alloc::vec::Vec<VerificationResultItem>,
702  /// Output for the verification to display to the user
703  #[prost(string, repeated, tag = "4")]
704  pub output: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
705}
706/// Result of running the verification
707#[derive(Clone, PartialEq, ::prost::Message)]
708pub struct VerifyInteractionResponse {
709  #[prost(oneof = "verify_interaction_response::Response", tags = "1, 2")]
710  pub response: ::core::option::Option<verify_interaction_response::Response>,
711}
712/// Nested message and enum types in `VerifyInteractionResponse`.
713pub mod verify_interaction_response {
714  #[derive(Clone, PartialEq, ::prost::Oneof)]
715  pub enum Response {
716    /// If an error occurred trying to run the verification
717    #[prost(string, tag = "1")]
718    Error(::prost::alloc::string::String),
719    #[prost(message, tag = "2")]
720    Result(super::VerificationResult),
721  }
722}
723/// Generated client implementations.
724pub mod pact_plugin_client {
725  #![allow(
726    unused_variables,
727    dead_code,
728    missing_docs,
729    clippy::wildcard_imports,
730    clippy::let_unit_value,
731  )]
732  use tonic::codegen::*;
733  use tonic::codegen::http::Uri;
734  #[derive(Debug, Clone)]
735  pub struct PactPluginClient<T> {
736    inner: tonic::client::Grpc<T>,
737  }
738  impl PactPluginClient<tonic::transport::Channel> {
739    /// Attempt to create a new client by connecting to a given endpoint.
740    pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
741    where
742      D: TryInto<tonic::transport::Endpoint>,
743      D::Error: Into<StdError>,
744    {
745      let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
746      Ok(Self::new(conn))
747    }
748  }
749  impl<T> PactPluginClient<T>
750  where
751    T: tonic::client::GrpcService<tonic::body::Body>,
752    T::Error: Into<StdError>,
753    T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
754    <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
755  {
756    pub fn new(inner: T) -> Self {
757      let inner = tonic::client::Grpc::new(inner);
758      Self { inner }
759    }
760    pub fn with_origin(inner: T, origin: Uri) -> Self {
761      let inner = tonic::client::Grpc::with_origin(inner, origin);
762      Self { inner }
763    }
764    pub fn with_interceptor<F>(
765      inner: T,
766      interceptor: F,
767    ) -> PactPluginClient<InterceptedService<T, F>>
768    where
769      F: tonic::service::Interceptor,
770      T::ResponseBody: Default,
771      T: tonic::codegen::Service<
772        http::Request<tonic::body::Body>,
773        Response = http::Response<
774          <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
775        >,
776      >,
777      <T as tonic::codegen::Service<
778        http::Request<tonic::body::Body>,
779      >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
780    {
781      PactPluginClient::new(InterceptedService::new(inner, interceptor))
782    }
783    /// Compress requests with the given encoding.
784    ///
785    /// This requires the server to support it otherwise it might respond with an
786    /// error.
787    #[must_use]
788    pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
789      self.inner = self.inner.send_compressed(encoding);
790      self
791    }
792    /// Enable decompressing responses.
793    #[must_use]
794    pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
795      self.inner = self.inner.accept_compressed(encoding);
796      self
797    }
798    /// Limits the maximum size of a decoded message.
799    ///
800    /// Default: `4MB`
801    #[must_use]
802    pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
803      self.inner = self.inner.max_decoding_message_size(limit);
804      self
805    }
806    /// Limits the maximum size of an encoded message.
807    ///
808    /// Default: `usize::MAX`
809    #[must_use]
810    pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
811      self.inner = self.inner.max_encoding_message_size(limit);
812      self
813    }
814    /// Check that the plugin loaded OK. Returns the catalogue entries describing what the plugin provides
815    pub async fn init_plugin(
816      &mut self,
817      request: impl tonic::IntoRequest<super::InitPluginRequest>,
818    ) -> std::result::Result<
819      tonic::Response<super::InitPluginResponse>,
820      tonic::Status,
821    > {
822      self.inner
823        .ready()
824        .await
825        .map_err(|e| {
826          tonic::Status::unknown(
827            format!("Service was not ready: {}", e.into()),
828          )
829        })?;
830      let codec = tonic::codec::ProstCodec::default();
831      let path = http::uri::PathAndQuery::from_static(
832        "/io.pact.plugin.PactPlugin/InitPlugin",
833      );
834      let mut req = request.into_request();
835      req.extensions_mut()
836        .insert(GrpcMethod::new("io.pact.plugin.PactPlugin", "InitPlugin"));
837      self.inner.unary(req, path, codec).await
838    }
839    /// Updated catalogue. This will be sent when the core catalogue has been updated (probably by a plugin loading).
840    pub async fn update_catalogue(
841      &mut self,
842      request: impl tonic::IntoRequest<super::Catalogue>,
843    ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
844      self.inner
845        .ready()
846        .await
847        .map_err(|e| {
848          tonic::Status::unknown(
849            format!("Service was not ready: {}", e.into()),
850          )
851        })?;
852      let codec = tonic::codec::ProstCodec::default();
853      let path = http::uri::PathAndQuery::from_static(
854        "/io.pact.plugin.PactPlugin/UpdateCatalogue",
855      );
856      let mut req = request.into_request();
857      req.extensions_mut()
858        .insert(GrpcMethod::new("io.pact.plugin.PactPlugin", "UpdateCatalogue"));
859      self.inner.unary(req, path, codec).await
860    }
861    /// Request to perform a comparison of some contents (matching request)
862    pub async fn compare_contents(
863      &mut self,
864      request: impl tonic::IntoRequest<super::CompareContentsRequest>,
865    ) -> std::result::Result<
866      tonic::Response<super::CompareContentsResponse>,
867      tonic::Status,
868    > {
869      self.inner
870        .ready()
871        .await
872        .map_err(|e| {
873          tonic::Status::unknown(
874            format!("Service was not ready: {}", e.into()),
875          )
876        })?;
877      let codec = tonic::codec::ProstCodec::default();
878      let path = http::uri::PathAndQuery::from_static(
879        "/io.pact.plugin.PactPlugin/CompareContents",
880      );
881      let mut req = request.into_request();
882      req.extensions_mut()
883        .insert(GrpcMethod::new("io.pact.plugin.PactPlugin", "CompareContents"));
884      self.inner.unary(req, path, codec).await
885    }
886    /// Request to configure/setup the interaction for later verification. Data returned will be persisted in the pact file.
887    pub async fn configure_interaction(
888      &mut self,
889      request: impl tonic::IntoRequest<super::ConfigureInteractionRequest>,
890    ) -> std::result::Result<
891      tonic::Response<super::ConfigureInteractionResponse>,
892      tonic::Status,
893    > {
894      self.inner
895        .ready()
896        .await
897        .map_err(|e| {
898          tonic::Status::unknown(
899            format!("Service was not ready: {}", e.into()),
900          )
901        })?;
902      let codec = tonic::codec::ProstCodec::default();
903      let path = http::uri::PathAndQuery::from_static(
904        "/io.pact.plugin.PactPlugin/ConfigureInteraction",
905      );
906      let mut req = request.into_request();
907      req.extensions_mut()
908        .insert(
909          GrpcMethod::new("io.pact.plugin.PactPlugin", "ConfigureInteraction"),
910        );
911      self.inner.unary(req, path, codec).await
912    }
913    /// Request to generate the content using any defined generators
914    pub async fn generate_content(
915      &mut self,
916      request: impl tonic::IntoRequest<super::GenerateContentRequest>,
917    ) -> std::result::Result<
918      tonic::Response<super::GenerateContentResponse>,
919      tonic::Status,
920    > {
921      self.inner
922        .ready()
923        .await
924        .map_err(|e| {
925          tonic::Status::unknown(
926            format!("Service was not ready: {}", e.into()),
927          )
928        })?;
929      let codec = tonic::codec::ProstCodec::default();
930      let path = http::uri::PathAndQuery::from_static(
931        "/io.pact.plugin.PactPlugin/GenerateContent",
932      );
933      let mut req = request.into_request();
934      req.extensions_mut()
935        .insert(GrpcMethod::new("io.pact.plugin.PactPlugin", "GenerateContent"));
936      self.inner.unary(req, path, codec).await
937    }
938    /// Start a mock server
939    pub async fn start_mock_server(
940      &mut self,
941      request: impl tonic::IntoRequest<super::StartMockServerRequest>,
942    ) -> std::result::Result<
943      tonic::Response<super::StartMockServerResponse>,
944      tonic::Status,
945    > {
946      self.inner
947        .ready()
948        .await
949        .map_err(|e| {
950          tonic::Status::unknown(
951            format!("Service was not ready: {}", e.into()),
952          )
953        })?;
954      let codec = tonic::codec::ProstCodec::default();
955      let path = http::uri::PathAndQuery::from_static(
956        "/io.pact.plugin.PactPlugin/StartMockServer",
957      );
958      let mut req = request.into_request();
959      req.extensions_mut()
960        .insert(GrpcMethod::new("io.pact.plugin.PactPlugin", "StartMockServer"));
961      self.inner.unary(req, path, codec).await
962    }
963    /// Shutdown a running mock server
964    /// TODO: Replace the message types with MockServerRequest and MockServerResults in the next major version
965    pub async fn shutdown_mock_server(
966      &mut self,
967      request: impl tonic::IntoRequest<super::ShutdownMockServerRequest>,
968    ) -> std::result::Result<
969      tonic::Response<super::ShutdownMockServerResponse>,
970      tonic::Status,
971    > {
972      self.inner
973        .ready()
974        .await
975        .map_err(|e| {
976          tonic::Status::unknown(
977            format!("Service was not ready: {}", e.into()),
978          )
979        })?;
980      let codec = tonic::codec::ProstCodec::default();
981      let path = http::uri::PathAndQuery::from_static(
982        "/io.pact.plugin.PactPlugin/ShutdownMockServer",
983      );
984      let mut req = request.into_request();
985      req.extensions_mut()
986        .insert(
987          GrpcMethod::new("io.pact.plugin.PactPlugin", "ShutdownMockServer"),
988        );
989      self.inner.unary(req, path, codec).await
990    }
991    /// Get the matching results from a running mock server
992    pub async fn get_mock_server_results(
993      &mut self,
994      request: impl tonic::IntoRequest<super::MockServerRequest>,
995    ) -> std::result::Result<
996      tonic::Response<super::MockServerResults>,
997      tonic::Status,
998    > {
999      self.inner
1000        .ready()
1001        .await
1002        .map_err(|e| {
1003          tonic::Status::unknown(
1004            format!("Service was not ready: {}", e.into()),
1005          )
1006        })?;
1007      let codec = tonic::codec::ProstCodec::default();
1008      let path = http::uri::PathAndQuery::from_static(
1009        "/io.pact.plugin.PactPlugin/GetMockServerResults",
1010      );
1011      let mut req = request.into_request();
1012      req.extensions_mut()
1013        .insert(
1014          GrpcMethod::new("io.pact.plugin.PactPlugin", "GetMockServerResults"),
1015        );
1016      self.inner.unary(req, path, codec).await
1017    }
1018    /// Prepare an interaction for verification. This should return any data required to construct any request
1019    /// so that it can be amended before the verification is run
1020    pub async fn prepare_interaction_for_verification(
1021      &mut self,
1022      request: impl tonic::IntoRequest<super::VerificationPreparationRequest>,
1023    ) -> std::result::Result<
1024      tonic::Response<super::VerificationPreparationResponse>,
1025      tonic::Status,
1026    > {
1027      self.inner
1028        .ready()
1029        .await
1030        .map_err(|e| {
1031          tonic::Status::unknown(
1032            format!("Service was not ready: {}", e.into()),
1033          )
1034        })?;
1035      let codec = tonic::codec::ProstCodec::default();
1036      let path = http::uri::PathAndQuery::from_static(
1037        "/io.pact.plugin.PactPlugin/PrepareInteractionForVerification",
1038      );
1039      let mut req = request.into_request();
1040      req.extensions_mut()
1041        .insert(
1042          GrpcMethod::new(
1043            "io.pact.plugin.PactPlugin",
1044            "PrepareInteractionForVerification",
1045          ),
1046        );
1047      self.inner.unary(req, path, codec).await
1048    }
1049    /// Execute the verification for the interaction.
1050    pub async fn verify_interaction(
1051      &mut self,
1052      request: impl tonic::IntoRequest<super::VerifyInteractionRequest>,
1053    ) -> std::result::Result<
1054      tonic::Response<super::VerifyInteractionResponse>,
1055      tonic::Status,
1056    > {
1057      self.inner
1058        .ready()
1059        .await
1060        .map_err(|e| {
1061          tonic::Status::unknown(
1062            format!("Service was not ready: {}", e.into()),
1063          )
1064        })?;
1065      let codec = tonic::codec::ProstCodec::default();
1066      let path = http::uri::PathAndQuery::from_static(
1067        "/io.pact.plugin.PactPlugin/VerifyInteraction",
1068      );
1069      let mut req = request.into_request();
1070      req.extensions_mut()
1071        .insert(
1072          GrpcMethod::new("io.pact.plugin.PactPlugin", "VerifyInteraction"),
1073        );
1074      self.inner.unary(req, path, codec).await
1075    }
1076  }
1077}
1078/// Generated server implementations.
1079pub mod pact_plugin_server {
1080  #![allow(
1081    unused_variables,
1082    dead_code,
1083    missing_docs,
1084    clippy::wildcard_imports,
1085    clippy::let_unit_value,
1086  )]
1087  use tonic::codegen::*;
1088  /// Generated trait containing gRPC methods that should be implemented for use with PactPluginServer.
1089  #[async_trait]
1090  pub trait PactPlugin: std::marker::Send + std::marker::Sync + 'static {
1091    /// Check that the plugin loaded OK. Returns the catalogue entries describing what the plugin provides
1092    async fn init_plugin(
1093      &self,
1094      request: tonic::Request<super::InitPluginRequest>,
1095    ) -> std::result::Result<
1096      tonic::Response<super::InitPluginResponse>,
1097      tonic::Status,
1098    >;
1099    /// Updated catalogue. This will be sent when the core catalogue has been updated (probably by a plugin loading).
1100    async fn update_catalogue(
1101      &self,
1102      request: tonic::Request<super::Catalogue>,
1103    ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
1104    /// Request to perform a comparison of some contents (matching request)
1105    async fn compare_contents(
1106      &self,
1107      request: tonic::Request<super::CompareContentsRequest>,
1108    ) -> std::result::Result<
1109      tonic::Response<super::CompareContentsResponse>,
1110      tonic::Status,
1111    >;
1112    /// Request to configure/setup the interaction for later verification. Data returned will be persisted in the pact file.
1113    async fn configure_interaction(
1114      &self,
1115      request: tonic::Request<super::ConfigureInteractionRequest>,
1116    ) -> std::result::Result<
1117      tonic::Response<super::ConfigureInteractionResponse>,
1118      tonic::Status,
1119    >;
1120    /// Request to generate the content using any defined generators
1121    async fn generate_content(
1122      &self,
1123      request: tonic::Request<super::GenerateContentRequest>,
1124    ) -> std::result::Result<
1125      tonic::Response<super::GenerateContentResponse>,
1126      tonic::Status,
1127    >;
1128    /// Start a mock server
1129    async fn start_mock_server(
1130      &self,
1131      request: tonic::Request<super::StartMockServerRequest>,
1132    ) -> std::result::Result<
1133      tonic::Response<super::StartMockServerResponse>,
1134      tonic::Status,
1135    >;
1136    /// Shutdown a running mock server
1137    /// TODO: Replace the message types with MockServerRequest and MockServerResults in the next major version
1138    async fn shutdown_mock_server(
1139      &self,
1140      request: tonic::Request<super::ShutdownMockServerRequest>,
1141    ) -> std::result::Result<
1142      tonic::Response<super::ShutdownMockServerResponse>,
1143      tonic::Status,
1144    >;
1145    /// Get the matching results from a running mock server
1146    async fn get_mock_server_results(
1147      &self,
1148      request: tonic::Request<super::MockServerRequest>,
1149    ) -> std::result::Result<
1150      tonic::Response<super::MockServerResults>,
1151      tonic::Status,
1152    >;
1153    /// Prepare an interaction for verification. This should return any data required to construct any request
1154    /// so that it can be amended before the verification is run
1155    async fn prepare_interaction_for_verification(
1156      &self,
1157      request: tonic::Request<super::VerificationPreparationRequest>,
1158    ) -> std::result::Result<
1159      tonic::Response<super::VerificationPreparationResponse>,
1160      tonic::Status,
1161    >;
1162    /// Execute the verification for the interaction.
1163    async fn verify_interaction(
1164      &self,
1165      request: tonic::Request<super::VerifyInteractionRequest>,
1166    ) -> std::result::Result<
1167      tonic::Response<super::VerifyInteractionResponse>,
1168      tonic::Status,
1169    >;
1170  }
1171  #[derive(Debug)]
1172  pub struct PactPluginServer<T> {
1173    inner: Arc<T>,
1174    accept_compression_encodings: EnabledCompressionEncodings,
1175    send_compression_encodings: EnabledCompressionEncodings,
1176    max_decoding_message_size: Option<usize>,
1177    max_encoding_message_size: Option<usize>,
1178  }
1179  impl<T> PactPluginServer<T> {
1180    pub fn new(inner: T) -> Self {
1181      Self::from_arc(Arc::new(inner))
1182    }
1183    pub fn from_arc(inner: Arc<T>) -> Self {
1184      Self {
1185        inner,
1186        accept_compression_encodings: Default::default(),
1187        send_compression_encodings: Default::default(),
1188        max_decoding_message_size: None,
1189        max_encoding_message_size: None,
1190      }
1191    }
1192    pub fn with_interceptor<F>(
1193      inner: T,
1194      interceptor: F,
1195    ) -> InterceptedService<Self, F>
1196    where
1197      F: tonic::service::Interceptor,
1198    {
1199      InterceptedService::new(Self::new(inner), interceptor)
1200    }
1201    /// Enable decompressing requests with the given encoding.
1202    #[must_use]
1203    pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1204      self.accept_compression_encodings.enable(encoding);
1205      self
1206    }
1207    /// Compress responses with the given encoding, if the client supports it.
1208    #[must_use]
1209    pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1210      self.send_compression_encodings.enable(encoding);
1211      self
1212    }
1213    /// Limits the maximum size of a decoded message.
1214    ///
1215    /// Default: `4MB`
1216    #[must_use]
1217    pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1218      self.max_decoding_message_size = Some(limit);
1219      self
1220    }
1221    /// Limits the maximum size of an encoded message.
1222    ///
1223    /// Default: `usize::MAX`
1224    #[must_use]
1225    pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1226      self.max_encoding_message_size = Some(limit);
1227      self
1228    }
1229  }
1230  impl<T, B> tonic::codegen::Service<http::Request<B>> for PactPluginServer<T>
1231  where
1232    T: PactPlugin,
1233    B: Body + std::marker::Send + 'static,
1234    B::Error: Into<StdError> + std::marker::Send + 'static,
1235  {
1236    type Response = http::Response<tonic::body::Body>;
1237    type Error = std::convert::Infallible;
1238    type Future = BoxFuture<Self::Response, Self::Error>;
1239    fn poll_ready(
1240      &mut self,
1241      _cx: &mut Context<'_>,
1242    ) -> Poll<std::result::Result<(), Self::Error>> {
1243      Poll::Ready(Ok(()))
1244    }
1245    fn call(&mut self, req: http::Request<B>) -> Self::Future {
1246      match req.uri().path() {
1247        "/io.pact.plugin.PactPlugin/InitPlugin" => {
1248          #[allow(non_camel_case_types)]
1249          struct InitPluginSvc<T: PactPlugin>(pub Arc<T>);
1250          impl<
1251            T: PactPlugin,
1252          > tonic::server::UnaryService<super::InitPluginRequest>
1253          for InitPluginSvc<T> {
1254            type Response = super::InitPluginResponse;
1255            type Future = BoxFuture<
1256              tonic::Response<Self::Response>,
1257              tonic::Status,
1258            >;
1259            fn call(
1260              &mut self,
1261              request: tonic::Request<super::InitPluginRequest>,
1262            ) -> Self::Future {
1263              let inner = Arc::clone(&self.0);
1264              let fut = async move {
1265                <T as PactPlugin>::init_plugin(&inner, request).await
1266              };
1267              Box::pin(fut)
1268            }
1269          }
1270          let accept_compression_encodings = self.accept_compression_encodings;
1271          let send_compression_encodings = self.send_compression_encodings;
1272          let max_decoding_message_size = self.max_decoding_message_size;
1273          let max_encoding_message_size = self.max_encoding_message_size;
1274          let inner = self.inner.clone();
1275          let fut = async move {
1276            let method = InitPluginSvc(inner);
1277            let codec = tonic::codec::ProstCodec::default();
1278            let mut grpc = tonic::server::Grpc::new(codec)
1279              .apply_compression_config(
1280                accept_compression_encodings,
1281                send_compression_encodings,
1282              )
1283              .apply_max_message_size_config(
1284                max_decoding_message_size,
1285                max_encoding_message_size,
1286              );
1287            let res = grpc.unary(method, req).await;
1288            Ok(res)
1289          };
1290          Box::pin(fut)
1291        }
1292        "/io.pact.plugin.PactPlugin/UpdateCatalogue" => {
1293          #[allow(non_camel_case_types)]
1294          struct UpdateCatalogueSvc<T: PactPlugin>(pub Arc<T>);
1295          impl<T: PactPlugin> tonic::server::UnaryService<super::Catalogue>
1296          for UpdateCatalogueSvc<T> {
1297            type Response = ();
1298            type Future = BoxFuture<
1299              tonic::Response<Self::Response>,
1300              tonic::Status,
1301            >;
1302            fn call(
1303              &mut self,
1304              request: tonic::Request<super::Catalogue>,
1305            ) -> Self::Future {
1306              let inner = Arc::clone(&self.0);
1307              let fut = async move {
1308                <T as PactPlugin>::update_catalogue(&inner, request).await
1309              };
1310              Box::pin(fut)
1311            }
1312          }
1313          let accept_compression_encodings = self.accept_compression_encodings;
1314          let send_compression_encodings = self.send_compression_encodings;
1315          let max_decoding_message_size = self.max_decoding_message_size;
1316          let max_encoding_message_size = self.max_encoding_message_size;
1317          let inner = self.inner.clone();
1318          let fut = async move {
1319            let method = UpdateCatalogueSvc(inner);
1320            let codec = tonic::codec::ProstCodec::default();
1321            let mut grpc = tonic::server::Grpc::new(codec)
1322              .apply_compression_config(
1323                accept_compression_encodings,
1324                send_compression_encodings,
1325              )
1326              .apply_max_message_size_config(
1327                max_decoding_message_size,
1328                max_encoding_message_size,
1329              );
1330            let res = grpc.unary(method, req).await;
1331            Ok(res)
1332          };
1333          Box::pin(fut)
1334        }
1335        "/io.pact.plugin.PactPlugin/CompareContents" => {
1336          #[allow(non_camel_case_types)]
1337          struct CompareContentsSvc<T: PactPlugin>(pub Arc<T>);
1338          impl<
1339            T: PactPlugin,
1340          > tonic::server::UnaryService<super::CompareContentsRequest>
1341          for CompareContentsSvc<T> {
1342            type Response = super::CompareContentsResponse;
1343            type Future = BoxFuture<
1344              tonic::Response<Self::Response>,
1345              tonic::Status,
1346            >;
1347            fn call(
1348              &mut self,
1349              request: tonic::Request<super::CompareContentsRequest>,
1350            ) -> Self::Future {
1351              let inner = Arc::clone(&self.0);
1352              let fut = async move {
1353                <T as PactPlugin>::compare_contents(&inner, request).await
1354              };
1355              Box::pin(fut)
1356            }
1357          }
1358          let accept_compression_encodings = self.accept_compression_encodings;
1359          let send_compression_encodings = self.send_compression_encodings;
1360          let max_decoding_message_size = self.max_decoding_message_size;
1361          let max_encoding_message_size = self.max_encoding_message_size;
1362          let inner = self.inner.clone();
1363          let fut = async move {
1364            let method = CompareContentsSvc(inner);
1365            let codec = tonic::codec::ProstCodec::default();
1366            let mut grpc = tonic::server::Grpc::new(codec)
1367              .apply_compression_config(
1368                accept_compression_encodings,
1369                send_compression_encodings,
1370              )
1371              .apply_max_message_size_config(
1372                max_decoding_message_size,
1373                max_encoding_message_size,
1374              );
1375            let res = grpc.unary(method, req).await;
1376            Ok(res)
1377          };
1378          Box::pin(fut)
1379        }
1380        "/io.pact.plugin.PactPlugin/ConfigureInteraction" => {
1381          #[allow(non_camel_case_types)]
1382          struct ConfigureInteractionSvc<T: PactPlugin>(pub Arc<T>);
1383          impl<
1384            T: PactPlugin,
1385          > tonic::server::UnaryService<super::ConfigureInteractionRequest>
1386          for ConfigureInteractionSvc<T> {
1387            type Response = super::ConfigureInteractionResponse;
1388            type Future = BoxFuture<
1389              tonic::Response<Self::Response>,
1390              tonic::Status,
1391            >;
1392            fn call(
1393              &mut self,
1394              request: tonic::Request<super::ConfigureInteractionRequest>,
1395            ) -> Self::Future {
1396              let inner = Arc::clone(&self.0);
1397              let fut = async move {
1398                <T as PactPlugin>::configure_interaction(&inner, request)
1399                  .await
1400              };
1401              Box::pin(fut)
1402            }
1403          }
1404          let accept_compression_encodings = self.accept_compression_encodings;
1405          let send_compression_encodings = self.send_compression_encodings;
1406          let max_decoding_message_size = self.max_decoding_message_size;
1407          let max_encoding_message_size = self.max_encoding_message_size;
1408          let inner = self.inner.clone();
1409          let fut = async move {
1410            let method = ConfigureInteractionSvc(inner);
1411            let codec = tonic::codec::ProstCodec::default();
1412            let mut grpc = tonic::server::Grpc::new(codec)
1413              .apply_compression_config(
1414                accept_compression_encodings,
1415                send_compression_encodings,
1416              )
1417              .apply_max_message_size_config(
1418                max_decoding_message_size,
1419                max_encoding_message_size,
1420              );
1421            let res = grpc.unary(method, req).await;
1422            Ok(res)
1423          };
1424          Box::pin(fut)
1425        }
1426        "/io.pact.plugin.PactPlugin/GenerateContent" => {
1427          #[allow(non_camel_case_types)]
1428          struct GenerateContentSvc<T: PactPlugin>(pub Arc<T>);
1429          impl<
1430            T: PactPlugin,
1431          > tonic::server::UnaryService<super::GenerateContentRequest>
1432          for GenerateContentSvc<T> {
1433            type Response = super::GenerateContentResponse;
1434            type Future = BoxFuture<
1435              tonic::Response<Self::Response>,
1436              tonic::Status,
1437            >;
1438            fn call(
1439              &mut self,
1440              request: tonic::Request<super::GenerateContentRequest>,
1441            ) -> Self::Future {
1442              let inner = Arc::clone(&self.0);
1443              let fut = async move {
1444                <T as PactPlugin>::generate_content(&inner, request).await
1445              };
1446              Box::pin(fut)
1447            }
1448          }
1449          let accept_compression_encodings = self.accept_compression_encodings;
1450          let send_compression_encodings = self.send_compression_encodings;
1451          let max_decoding_message_size = self.max_decoding_message_size;
1452          let max_encoding_message_size = self.max_encoding_message_size;
1453          let inner = self.inner.clone();
1454          let fut = async move {
1455            let method = GenerateContentSvc(inner);
1456            let codec = tonic::codec::ProstCodec::default();
1457            let mut grpc = tonic::server::Grpc::new(codec)
1458              .apply_compression_config(
1459                accept_compression_encodings,
1460                send_compression_encodings,
1461              )
1462              .apply_max_message_size_config(
1463                max_decoding_message_size,
1464                max_encoding_message_size,
1465              );
1466            let res = grpc.unary(method, req).await;
1467            Ok(res)
1468          };
1469          Box::pin(fut)
1470        }
1471        "/io.pact.plugin.PactPlugin/StartMockServer" => {
1472          #[allow(non_camel_case_types)]
1473          struct StartMockServerSvc<T: PactPlugin>(pub Arc<T>);
1474          impl<
1475            T: PactPlugin,
1476          > tonic::server::UnaryService<super::StartMockServerRequest>
1477          for StartMockServerSvc<T> {
1478            type Response = super::StartMockServerResponse;
1479            type Future = BoxFuture<
1480              tonic::Response<Self::Response>,
1481              tonic::Status,
1482            >;
1483            fn call(
1484              &mut self,
1485              request: tonic::Request<super::StartMockServerRequest>,
1486            ) -> Self::Future {
1487              let inner = Arc::clone(&self.0);
1488              let fut = async move {
1489                <T as PactPlugin>::start_mock_server(&inner, request).await
1490              };
1491              Box::pin(fut)
1492            }
1493          }
1494          let accept_compression_encodings = self.accept_compression_encodings;
1495          let send_compression_encodings = self.send_compression_encodings;
1496          let max_decoding_message_size = self.max_decoding_message_size;
1497          let max_encoding_message_size = self.max_encoding_message_size;
1498          let inner = self.inner.clone();
1499          let fut = async move {
1500            let method = StartMockServerSvc(inner);
1501            let codec = tonic::codec::ProstCodec::default();
1502            let mut grpc = tonic::server::Grpc::new(codec)
1503              .apply_compression_config(
1504                accept_compression_encodings,
1505                send_compression_encodings,
1506              )
1507              .apply_max_message_size_config(
1508                max_decoding_message_size,
1509                max_encoding_message_size,
1510              );
1511            let res = grpc.unary(method, req).await;
1512            Ok(res)
1513          };
1514          Box::pin(fut)
1515        }
1516        "/io.pact.plugin.PactPlugin/ShutdownMockServer" => {
1517          #[allow(non_camel_case_types)]
1518          struct ShutdownMockServerSvc<T: PactPlugin>(pub Arc<T>);
1519          impl<
1520            T: PactPlugin,
1521          > tonic::server::UnaryService<super::ShutdownMockServerRequest>
1522          for ShutdownMockServerSvc<T> {
1523            type Response = super::ShutdownMockServerResponse;
1524            type Future = BoxFuture<
1525              tonic::Response<Self::Response>,
1526              tonic::Status,
1527            >;
1528            fn call(
1529              &mut self,
1530              request: tonic::Request<super::ShutdownMockServerRequest>,
1531            ) -> Self::Future {
1532              let inner = Arc::clone(&self.0);
1533              let fut = async move {
1534                <T as PactPlugin>::shutdown_mock_server(&inner, request)
1535                  .await
1536              };
1537              Box::pin(fut)
1538            }
1539          }
1540          let accept_compression_encodings = self.accept_compression_encodings;
1541          let send_compression_encodings = self.send_compression_encodings;
1542          let max_decoding_message_size = self.max_decoding_message_size;
1543          let max_encoding_message_size = self.max_encoding_message_size;
1544          let inner = self.inner.clone();
1545          let fut = async move {
1546            let method = ShutdownMockServerSvc(inner);
1547            let codec = tonic::codec::ProstCodec::default();
1548            let mut grpc = tonic::server::Grpc::new(codec)
1549              .apply_compression_config(
1550                accept_compression_encodings,
1551                send_compression_encodings,
1552              )
1553              .apply_max_message_size_config(
1554                max_decoding_message_size,
1555                max_encoding_message_size,
1556              );
1557            let res = grpc.unary(method, req).await;
1558            Ok(res)
1559          };
1560          Box::pin(fut)
1561        }
1562        "/io.pact.plugin.PactPlugin/GetMockServerResults" => {
1563          #[allow(non_camel_case_types)]
1564          struct GetMockServerResultsSvc<T: PactPlugin>(pub Arc<T>);
1565          impl<
1566            T: PactPlugin,
1567          > tonic::server::UnaryService<super::MockServerRequest>
1568          for GetMockServerResultsSvc<T> {
1569            type Response = super::MockServerResults;
1570            type Future = BoxFuture<
1571              tonic::Response<Self::Response>,
1572              tonic::Status,
1573            >;
1574            fn call(
1575              &mut self,
1576              request: tonic::Request<super::MockServerRequest>,
1577            ) -> Self::Future {
1578              let inner = Arc::clone(&self.0);
1579              let fut = async move {
1580                <T as PactPlugin>::get_mock_server_results(&inner, request)
1581                  .await
1582              };
1583              Box::pin(fut)
1584            }
1585          }
1586          let accept_compression_encodings = self.accept_compression_encodings;
1587          let send_compression_encodings = self.send_compression_encodings;
1588          let max_decoding_message_size = self.max_decoding_message_size;
1589          let max_encoding_message_size = self.max_encoding_message_size;
1590          let inner = self.inner.clone();
1591          let fut = async move {
1592            let method = GetMockServerResultsSvc(inner);
1593            let codec = tonic::codec::ProstCodec::default();
1594            let mut grpc = tonic::server::Grpc::new(codec)
1595              .apply_compression_config(
1596                accept_compression_encodings,
1597                send_compression_encodings,
1598              )
1599              .apply_max_message_size_config(
1600                max_decoding_message_size,
1601                max_encoding_message_size,
1602              );
1603            let res = grpc.unary(method, req).await;
1604            Ok(res)
1605          };
1606          Box::pin(fut)
1607        }
1608        "/io.pact.plugin.PactPlugin/PrepareInteractionForVerification" => {
1609          #[allow(non_camel_case_types)]
1610          struct PrepareInteractionForVerificationSvc<T: PactPlugin>(
1611            pub Arc<T>,
1612          );
1613          impl<
1614            T: PactPlugin,
1615          > tonic::server::UnaryService<super::VerificationPreparationRequest>
1616          for PrepareInteractionForVerificationSvc<T> {
1617            type Response = super::VerificationPreparationResponse;
1618            type Future = BoxFuture<
1619              tonic::Response<Self::Response>,
1620              tonic::Status,
1621            >;
1622            fn call(
1623              &mut self,
1624              request: tonic::Request<
1625                super::VerificationPreparationRequest,
1626              >,
1627            ) -> Self::Future {
1628              let inner = Arc::clone(&self.0);
1629              let fut = async move {
1630                <T as PactPlugin>::prepare_interaction_for_verification(
1631                  &inner,
1632                  request,
1633                )
1634                  .await
1635              };
1636              Box::pin(fut)
1637            }
1638          }
1639          let accept_compression_encodings = self.accept_compression_encodings;
1640          let send_compression_encodings = self.send_compression_encodings;
1641          let max_decoding_message_size = self.max_decoding_message_size;
1642          let max_encoding_message_size = self.max_encoding_message_size;
1643          let inner = self.inner.clone();
1644          let fut = async move {
1645            let method = PrepareInteractionForVerificationSvc(inner);
1646            let codec = tonic::codec::ProstCodec::default();
1647            let mut grpc = tonic::server::Grpc::new(codec)
1648              .apply_compression_config(
1649                accept_compression_encodings,
1650                send_compression_encodings,
1651              )
1652              .apply_max_message_size_config(
1653                max_decoding_message_size,
1654                max_encoding_message_size,
1655              );
1656            let res = grpc.unary(method, req).await;
1657            Ok(res)
1658          };
1659          Box::pin(fut)
1660        }
1661        "/io.pact.plugin.PactPlugin/VerifyInteraction" => {
1662          #[allow(non_camel_case_types)]
1663          struct VerifyInteractionSvc<T: PactPlugin>(pub Arc<T>);
1664          impl<
1665            T: PactPlugin,
1666          > tonic::server::UnaryService<super::VerifyInteractionRequest>
1667          for VerifyInteractionSvc<T> {
1668            type Response = super::VerifyInteractionResponse;
1669            type Future = BoxFuture<
1670              tonic::Response<Self::Response>,
1671              tonic::Status,
1672            >;
1673            fn call(
1674              &mut self,
1675              request: tonic::Request<super::VerifyInteractionRequest>,
1676            ) -> Self::Future {
1677              let inner = Arc::clone(&self.0);
1678              let fut = async move {
1679                <T as PactPlugin>::verify_interaction(&inner, request).await
1680              };
1681              Box::pin(fut)
1682            }
1683          }
1684          let accept_compression_encodings = self.accept_compression_encodings;
1685          let send_compression_encodings = self.send_compression_encodings;
1686          let max_decoding_message_size = self.max_decoding_message_size;
1687          let max_encoding_message_size = self.max_encoding_message_size;
1688          let inner = self.inner.clone();
1689          let fut = async move {
1690            let method = VerifyInteractionSvc(inner);
1691            let codec = tonic::codec::ProstCodec::default();
1692            let mut grpc = tonic::server::Grpc::new(codec)
1693              .apply_compression_config(
1694                accept_compression_encodings,
1695                send_compression_encodings,
1696              )
1697              .apply_max_message_size_config(
1698                max_decoding_message_size,
1699                max_encoding_message_size,
1700              );
1701            let res = grpc.unary(method, req).await;
1702            Ok(res)
1703          };
1704          Box::pin(fut)
1705        }
1706        _ => {
1707          Box::pin(async move {
1708            let mut response = http::Response::new(
1709              tonic::body::Body::default(),
1710            );
1711            let headers = response.headers_mut();
1712            headers
1713              .insert(
1714                tonic::Status::GRPC_STATUS,
1715                (tonic::Code::Unimplemented as i32).into(),
1716              );
1717            headers
1718              .insert(
1719                http::header::CONTENT_TYPE,
1720                tonic::metadata::GRPC_CONTENT_TYPE,
1721              );
1722            Ok(response)
1723          })
1724        }
1725      }
1726    }
1727  }
1728  impl<T> Clone for PactPluginServer<T> {
1729    fn clone(&self) -> Self {
1730      let inner = self.inner.clone();
1731      Self {
1732        inner,
1733        accept_compression_encodings: self.accept_compression_encodings,
1734        send_compression_encodings: self.send_compression_encodings,
1735        max_decoding_message_size: self.max_decoding_message_size,
1736        max_encoding_message_size: self.max_encoding_message_size,
1737      }
1738    }
1739  }
1740  /// Generated gRPC service name
1741  pub const SERVICE_NAME: &str = "io.pact.plugin.PactPlugin";
1742  impl<T> tonic::server::NamedService for PactPluginServer<T> {
1743    const NAME: &'static str = SERVICE_NAME;
1744  }
1745}
1746
1747// ------------------ Generated --------------------------//
1748
1749impl From<&OptionalBody> for Body {
1750  fn from(body: &OptionalBody) -> Self {
1751    match body {
1752      OptionalBody::Present(bytes, ct, ct_hint) => Body {
1753        content_type: ct.as_ref().map(|ct| ct.to_string()).unwrap_or_default(),
1754        content: Some(bytes.to_vec()),
1755        content_type_hint: match ct_hint {
1756          Some(ct_hint) => match ct_hint {
1757            ContentTypeHint::BINARY => body::ContentTypeHint::Binary as i32,
1758            ContentTypeHint::TEXT => body::ContentTypeHint::Text as i32,
1759            ContentTypeHint::DEFAULT => body::ContentTypeHint::Default as i32
1760          }
1761          None => body::ContentTypeHint::Default as i32
1762        }
1763      },
1764      _ => Body {
1765        content_type: "".to_string(),
1766        content: None,
1767        content_type_hint: body::ContentTypeHint::Default as i32
1768      }
1769    }
1770  }
1771}