Skip to main content

pact_plugin_driver/
proto_v2.rs

1// Build with PACT_PLUGIN_BUILD_PROTOBUFS set, then include the following
2// tonic::include_proto!("io.pact.plugin.v2");
3
4// ------------------ Generated --------------------------//
5
6// This file is @generated by prost-build.
7/// Request to verify the plugin has loaded OK
8#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
9pub struct InitPluginRequest {
10    /// Implementation calling the plugin
11    #[prost(string, tag = "1")]
12    pub implementation: ::prost::alloc::string::String,
13    /// Version of the implementation
14    #[prost(string, tag = "2")]
15    pub version: ::prost::alloc::string::String,
16    /// Host capabilities provided by the driver and available to the plugin
17    #[prost(string, repeated, tag = "3")]
18    pub host_capabilities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
19    /// UUID assigned by the driver at process start; the plugin includes this in every log record it emits
20    #[prost(string, tag = "4")]
21    pub plugin_instance_id: ::prost::alloc::string::String,
22}
23/// Entry to be added to the core catalogue. Each entry describes one of the features the plugin provides.
24/// Entries will be stored in the catalogue under the key "plugin/$name/$type/$key".
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct CatalogueEntry {
27    /// Entry type
28    #[prost(enumeration = "catalogue_entry::EntryType", tag = "1")]
29    pub r#type: i32,
30    /// Entry key
31    #[prost(string, tag = "2")]
32    pub key: ::prost::alloc::string::String,
33    /// Associated data required for the entry. For CONTENT_MATCHER and CONTENT_GENERATOR types, a "content-types"
34    /// value (separated by semi-colons) is required for all the content types the plugin supports.
35    #[prost(map = "string, string", tag = "3")]
36    pub values: ::std::collections::HashMap<
37        ::prost::alloc::string::String,
38        ::prost::alloc::string::String,
39    >,
40}
41/// Nested message and enum types in `CatalogueEntry`.
42pub mod catalogue_entry {
43    #[derive(
44        Clone,
45        Copy,
46        Debug,
47        PartialEq,
48        Eq,
49        Hash,
50        PartialOrd,
51        Ord,
52        ::prost::Enumeration
53    )]
54    #[repr(i32)]
55    pub enum EntryType {
56        /// Matcher for contents of messages, requests or response bodies
57        ContentMatcher = 0,
58        /// Generator for contents of messages, requests or response bodies
59        ContentGenerator = 1,
60        /// Transport for a network protocol
61        Transport = 2,
62        /// Matching rule for content field/values
63        Matcher = 3,
64        /// Type of interaction
65        Interaction = 4,
66        /// Generator for a content field/value. See proposal 006 (Field-level matchers and generators).
67        Generator = 5,
68    }
69    impl EntryType {
70        /// String value of the enum field names used in the ProtoBuf definition.
71        ///
72        /// The values are not transformed in any way and thus are considered stable
73        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
74        pub fn as_str_name(&self) -> &'static str {
75            match self {
76                Self::ContentMatcher => "CONTENT_MATCHER",
77                Self::ContentGenerator => "CONTENT_GENERATOR",
78                Self::Transport => "TRANSPORT",
79                Self::Matcher => "MATCHER",
80                Self::Interaction => "INTERACTION",
81                Self::Generator => "GENERATOR",
82            }
83        }
84        /// Creates an enum from field names used in the ProtoBuf definition.
85        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
86            match value {
87                "CONTENT_MATCHER" => Some(Self::ContentMatcher),
88                "CONTENT_GENERATOR" => Some(Self::ContentGenerator),
89                "TRANSPORT" => Some(Self::Transport),
90                "MATCHER" => Some(Self::Matcher),
91                "INTERACTION" => Some(Self::Interaction),
92                "GENERATOR" => Some(Self::Generator),
93                _ => None,
94            }
95        }
96    }
97}
98/// Successful result of initialising the plugin
99#[derive(Clone, PartialEq, ::prost::Message)]
100pub struct InitPluginSuccess {
101    /// List of entries the plugin supports
102    #[prost(message, repeated, tag = "1")]
103    pub catalogue: ::prost::alloc::vec::Vec<CatalogueEntry>,
104    /// Optional capabilities negotiated for this plugin instance
105    #[prost(string, repeated, tag = "2")]
106    pub plugin_capabilities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
107}
108/// Failure result of initialising the plugin
109#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
110pub struct InitPluginFailure {
111    /// Error explaining why initialisation failed
112    #[prost(string, tag = "1")]
113    pub error: ::prost::alloc::string::String,
114    /// Host capabilities the plugin requires but were not provided by the driver
115    #[prost(string, repeated, tag = "2")]
116    pub missing_host_capabilities: ::prost::alloc::vec::Vec<
117        ::prost::alloc::string::String,
118    >,
119}
120/// Response to init plugin, providing either the negotiated success response or a structured failure
121#[derive(Clone, PartialEq, ::prost::Message)]
122pub struct InitPluginResponse {
123    #[prost(oneof = "init_plugin_response::Response", tags = "1, 2")]
124    pub response: ::core::option::Option<init_plugin_response::Response>,
125}
126/// Nested message and enum types in `InitPluginResponse`.
127pub mod init_plugin_response {
128    #[derive(Clone, PartialEq, ::prost::Oneof)]
129    pub enum Response {
130        #[prost(message, tag = "1")]
131        Success(super::InitPluginSuccess),
132        #[prost(message, tag = "2")]
133        Failure(super::InitPluginFailure),
134    }
135}
136/// Catalogue of Core Pact + Plugin features
137#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct Catalogue {
139    /// List of entries from the core catalogue
140    #[prost(message, repeated, tag = "1")]
141    pub catalogue: ::prost::alloc::vec::Vec<CatalogueEntry>,
142}
143/// Message representing a request, response or message body
144#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
145pub struct Body {
146    /// The content type of the body in MIME format (i.e. application/json)
147    #[prost(string, tag = "1")]
148    pub content_type: ::prost::alloc::string::String,
149    /// Bytes of the actual content
150    #[prost(message, optional, tag = "2")]
151    pub content: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
152    /// Content type override to apply (if required). If omitted, the default rules of the Pact implementation
153    /// will be used
154    #[prost(enumeration = "body::ContentTypeHint", tag = "3")]
155    pub content_type_hint: i32,
156}
157/// Nested message and enum types in `Body`.
158pub mod body {
159    /// Enum of content type override. This is a hint on how the content type should be treated.
160    #[derive(
161        Clone,
162        Copy,
163        Debug,
164        PartialEq,
165        Eq,
166        Hash,
167        PartialOrd,
168        Ord,
169        ::prost::Enumeration
170    )]
171    #[repr(i32)]
172    pub enum ContentTypeHint {
173        /// Determine the form of the content using the default rules of the Pact implementation
174        Default = 0,
175        /// Contents must always be treated as a text form
176        Text = 1,
177        /// Contents must always be treated as a binary form
178        Binary = 2,
179    }
180    impl ContentTypeHint {
181        /// String value of the enum field names used in the ProtoBuf definition.
182        ///
183        /// The values are not transformed in any way and thus are considered stable
184        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
185        pub fn as_str_name(&self) -> &'static str {
186            match self {
187                Self::Default => "DEFAULT",
188                Self::Text => "TEXT",
189                Self::Binary => "BINARY",
190            }
191        }
192        /// Creates an enum from field names used in the ProtoBuf definition.
193        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
194            match value {
195                "DEFAULT" => Some(Self::Default),
196                "TEXT" => Some(Self::Text),
197                "BINARY" => Some(Self::Binary),
198                _ => None,
199            }
200        }
201    }
202}
203/// Request to preform a comparison on an actual body given the expected one
204#[derive(Clone, PartialEq, ::prost::Message)]
205pub struct CompareContentsRequest {
206    /// Expected body from the Pact interaction
207    #[prost(message, optional, tag = "1")]
208    pub expected: ::core::option::Option<Body>,
209    /// Actual received body
210    #[prost(message, optional, tag = "2")]
211    pub actual: ::core::option::Option<Body>,
212    /// If unexpected keys or attributes should be allowed. Setting this to false results in additional keys or fields
213    /// will cause a mismatch
214    #[prost(bool, tag = "3")]
215    pub allow_unexpected_keys: bool,
216    /// Map of expressions to matching rules. The expressions follow the documented Pact matching rule expressions
217    #[prost(map = "string, message", tag = "4")]
218    pub rules: ::std::collections::HashMap<
219        ::prost::alloc::string::String,
220        MatchingRules,
221    >,
222    /// Additional data added to the Pact/Interaction by the plugin
223    #[prost(message, optional, tag = "5")]
224    pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
225    /// Context data provided by the test framework (carries testRunId for log correlation)
226    #[prost(message, optional, tag = "6")]
227    pub test_context: ::core::option::Option<::prost_types::Struct>,
228}
229/// Indicates that there was a mismatch with the content type
230#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
231pub struct ContentTypeMismatch {
232    /// Expected content type (MIME format)
233    #[prost(string, tag = "1")]
234    pub expected: ::prost::alloc::string::String,
235    /// Actual content type received (MIME format)
236    #[prost(string, tag = "2")]
237    pub actual: ::prost::alloc::string::String,
238}
239/// A mismatch for an particular item of content
240#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
241pub struct ContentMismatch {
242    /// Expected data bytes
243    #[prost(message, optional, tag = "1")]
244    pub expected: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
245    /// Actual data bytes
246    #[prost(message, optional, tag = "2")]
247    pub actual: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
248    /// Description of the mismatch
249    #[prost(string, tag = "3")]
250    pub mismatch: ::prost::alloc::string::String,
251    /// Path to the item that was matched. This is the value as per the documented Pact matching rule expressions.
252    #[prost(string, tag = "4")]
253    pub path: ::prost::alloc::string::String,
254    /// Optional diff of the contents
255    #[prost(string, tag = "5")]
256    pub diff: ::prost::alloc::string::String,
257    /// Part of the interaction that the mismatch is for: body, headers, metadata, etc.
258    #[prost(string, tag = "6")]
259    pub mismatch_type: ::prost::alloc::string::String,
260}
261/// List of content mismatches
262#[derive(Clone, PartialEq, ::prost::Message)]
263pub struct ContentMismatches {
264    #[prost(message, repeated, tag = "1")]
265    pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
266}
267/// Response to the CompareContentsRequest with the results of the comparison
268#[derive(Clone, PartialEq, ::prost::Message)]
269pub struct CompareContentsResponse {
270    /// Error message if an error occurred. If this field is set, the remaining fields will be ignored and the
271    /// verification marked as failed
272    #[prost(string, tag = "1")]
273    pub error: ::prost::alloc::string::String,
274    /// There was a mismatch with the types of content. If this is set, the results may not be set.
275    #[prost(message, optional, tag = "2")]
276    pub type_mismatch: ::core::option::Option<ContentTypeMismatch>,
277    /// Results of the match, keyed by matching rule expression
278    #[prost(map = "string, message", tag = "3")]
279    pub results: ::std::collections::HashMap<
280        ::prost::alloc::string::String,
281        ContentMismatches,
282    >,
283}
284/// Request to configure/setup an interaction so that it can be verified later
285#[derive(Clone, PartialEq, ::prost::Message)]
286pub struct ConfigureInteractionRequest {
287    /// Content type of the interaction (MIME format)
288    #[prost(string, tag = "1")]
289    pub content_type: ::prost::alloc::string::String,
290    /// This is data specified by the user in the consumer test
291    #[prost(message, optional, tag = "2")]
292    pub contents_config: ::core::option::Option<::prost_types::Struct>,
293    /// Context data provided by the test framework (carries testRunId for log correlation)
294    #[prost(message, optional, tag = "3")]
295    pub test_context: ::core::option::Option<::prost_types::Struct>,
296}
297/// Represents a matching rule
298#[derive(Clone, PartialEq, ::prost::Message)]
299pub struct MatchingRule {
300    /// Type of the matching rule
301    #[prost(string, tag = "1")]
302    pub r#type: ::prost::alloc::string::String,
303    /// Associated data for the matching rule
304    #[prost(message, optional, tag = "2")]
305    pub values: ::core::option::Option<::prost_types::Struct>,
306}
307/// List of matching rules
308#[derive(Clone, PartialEq, ::prost::Message)]
309pub struct MatchingRules {
310    #[prost(message, repeated, tag = "1")]
311    pub rule: ::prost::alloc::vec::Vec<MatchingRule>,
312}
313/// Example generator
314#[derive(Clone, PartialEq, ::prost::Message)]
315pub struct Generator {
316    /// Type of generator
317    #[prost(string, tag = "1")]
318    pub r#type: ::prost::alloc::string::String,
319    /// Associated data for the generator
320    #[prost(message, optional, tag = "2")]
321    pub values: ::core::option::Option<::prost_types::Struct>,
322}
323/// Plugin configuration added to the pact file by the ConfigureInteraction step
324#[derive(Clone, PartialEq, ::prost::Message)]
325pub struct PluginConfiguration {
326    /// Data to be persisted against the interaction
327    #[prost(message, optional, tag = "1")]
328    pub interaction_configuration: ::core::option::Option<::prost_types::Struct>,
329    /// Data to be persisted in the Pact file metadata (Global data)
330    #[prost(message, optional, tag = "2")]
331    pub pact_configuration: ::core::option::Option<::prost_types::Struct>,
332}
333/// Structured interaction data sent to V2 plugins in place of raw pact JSON.
334/// Contains only the data the plugin needs, eliminating the need for plugins
335/// to parse full Pact documents.
336#[derive(Clone, PartialEq, ::prost::Message)]
337pub struct InteractionContents {
338    /// The V4 interaction type (e.g. "Synchronous/HTTP", "Synchronous/Messages")
339    #[prost(string, tag = "1")]
340    pub interaction_type: ::prost::alloc::string::String,
341    /// Plugin configuration stored by the plugin during the consumer test
342    #[prost(message, optional, tag = "2")]
343    pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
344    /// Consumer name, for result reporting and log correlation
345    #[prost(string, tag = "3")]
346    pub consumer: ::prost::alloc::string::String,
347    /// Provider name, for result reporting and log correlation
348    #[prost(string, tag = "4")]
349    pub provider: ::prost::alloc::string::String,
350}
351/// Response to the configure/setup an interaction request
352#[derive(Clone, PartialEq, ::prost::Message)]
353pub struct InteractionResponse {
354    /// Contents for the interaction
355    #[prost(message, optional, tag = "1")]
356    pub contents: ::core::option::Option<Body>,
357    /// All matching rules to apply
358    #[prost(map = "string, message", tag = "2")]
359    pub rules: ::std::collections::HashMap<
360        ::prost::alloc::string::String,
361        MatchingRules,
362    >,
363    /// Generators to apply
364    #[prost(map = "string, message", tag = "3")]
365    pub generators: ::std::collections::HashMap<
366        ::prost::alloc::string::String,
367        Generator,
368    >,
369    /// For message interactions, any metadata to be applied
370    #[prost(message, optional, tag = "4")]
371    pub message_metadata: ::core::option::Option<::prost_types::Struct>,
372    /// Plugin specific data to be persisted in the pact file
373    #[prost(message, optional, tag = "5")]
374    pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
375    /// Markdown/HTML formatted text representation of the interaction
376    #[prost(string, tag = "6")]
377    pub interaction_markup: ::prost::alloc::string::String,
378    #[prost(enumeration = "interaction_response::MarkupType", tag = "7")]
379    pub interaction_markup_type: i32,
380    /// Description of what part this interaction belongs to (in the case of there being more than one, for instance,
381    /// request/response messages)
382    #[prost(string, tag = "8")]
383    pub part_name: ::prost::alloc::string::String,
384    /// All matching rules to apply to any message metadata
385    #[prost(map = "string, message", tag = "9")]
386    pub metadata_rules: ::std::collections::HashMap<
387        ::prost::alloc::string::String,
388        MatchingRules,
389    >,
390    /// Generators to apply to any message metadata
391    #[prost(map = "string, message", tag = "10")]
392    pub metadata_generators: ::std::collections::HashMap<
393        ::prost::alloc::string::String,
394        Generator,
395    >,
396}
397/// Nested message and enum types in `InteractionResponse`.
398pub mod interaction_response {
399    /// Type of markup used
400    #[derive(
401        Clone,
402        Copy,
403        Debug,
404        PartialEq,
405        Eq,
406        Hash,
407        PartialOrd,
408        Ord,
409        ::prost::Enumeration
410    )]
411    #[repr(i32)]
412    pub enum MarkupType {
413        /// CommonMark format
414        CommonMark = 0,
415        /// HTML format
416        Html = 1,
417    }
418    impl MarkupType {
419        /// String value of the enum field names used in the ProtoBuf definition.
420        ///
421        /// The values are not transformed in any way and thus are considered stable
422        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
423        pub fn as_str_name(&self) -> &'static str {
424            match self {
425                Self::CommonMark => "COMMON_MARK",
426                Self::Html => "HTML",
427            }
428        }
429        /// Creates an enum from field names used in the ProtoBuf definition.
430        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
431            match value {
432                "COMMON_MARK" => Some(Self::CommonMark),
433                "HTML" => Some(Self::Html),
434                _ => None,
435            }
436        }
437    }
438}
439/// Response to the configure/setup an interaction request
440#[derive(Clone, PartialEq, ::prost::Message)]
441pub struct ConfigureInteractionResponse {
442    /// If an error occurred. In this case, the other fields will be ignored/not set
443    #[prost(string, tag = "1")]
444    pub error: ::prost::alloc::string::String,
445    /// The actual response if no error occurred.
446    #[prost(message, repeated, tag = "2")]
447    pub interaction: ::prost::alloc::vec::Vec<InteractionResponse>,
448    /// Plugin specific data to be persisted in the pact file
449    #[prost(message, optional, tag = "3")]
450    pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
451}
452/// Request to generate the contents using any defined generators
453#[derive(Clone, PartialEq, ::prost::Message)]
454pub struct GenerateContentRequest {
455    /// Original contents
456    #[prost(message, optional, tag = "1")]
457    pub contents: ::core::option::Option<Body>,
458    /// Generators to apply
459    #[prost(map = "string, message", tag = "2")]
460    pub generators: ::std::collections::HashMap<
461        ::prost::alloc::string::String,
462        Generator,
463    >,
464    /// Additional data added to the Pact/Interaction by the plugin
465    #[prost(message, optional, tag = "3")]
466    pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
467    /// Context data provided by the test framework
468    #[prost(message, optional, tag = "4")]
469    pub test_context: ::core::option::Option<::prost_types::Struct>,
470    #[prost(enumeration = "generate_content_request::TestMode", tag = "5")]
471    pub test_mode: i32,
472    #[prost(enumeration = "generate_content_request::ContentFor", tag = "6")]
473    pub content_for: i32,
474}
475/// Nested message and enum types in `GenerateContentRequest`.
476pub mod generate_content_request {
477    /// The mode of the generation, if running from a consumer test or during provider verification
478    #[derive(
479        Clone,
480        Copy,
481        Debug,
482        PartialEq,
483        Eq,
484        Hash,
485        PartialOrd,
486        Ord,
487        ::prost::Enumeration
488    )]
489    #[repr(i32)]
490    pub enum TestMode {
491        Unknown = 0,
492        /// Running on the consumer side
493        Consumer = 1,
494        /// Running on the provider side
495        Provider = 2,
496    }
497    impl TestMode {
498        /// String value of the enum field names used in the ProtoBuf definition.
499        ///
500        /// The values are not transformed in any way and thus are considered stable
501        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
502        pub fn as_str_name(&self) -> &'static str {
503            match self {
504                Self::Unknown => "Unknown",
505                Self::Consumer => "Consumer",
506                Self::Provider => "Provider",
507            }
508        }
509        /// Creates an enum from field names used in the ProtoBuf definition.
510        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
511            match value {
512                "Unknown" => Some(Self::Unknown),
513                "Consumer" => Some(Self::Consumer),
514                "Provider" => Some(Self::Provider),
515                _ => None,
516            }
517        }
518    }
519    /// Which part the content is for
520    #[derive(
521        Clone,
522        Copy,
523        Debug,
524        PartialEq,
525        Eq,
526        Hash,
527        PartialOrd,
528        Ord,
529        ::prost::Enumeration
530    )]
531    #[repr(i32)]
532    pub enum ContentFor {
533        Request = 0,
534        Response = 1,
535    }
536    impl ContentFor {
537        /// String value of the enum field names used in the ProtoBuf definition.
538        ///
539        /// The values are not transformed in any way and thus are considered stable
540        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
541        pub fn as_str_name(&self) -> &'static str {
542            match self {
543                Self::Request => "Request",
544                Self::Response => "Response",
545            }
546        }
547        /// Creates an enum from field names used in the ProtoBuf definition.
548        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
549            match value {
550                "Request" => Some(Self::Request),
551                "Response" => Some(Self::Response),
552                _ => None,
553            }
554        }
555    }
556}
557/// Generated body/message response
558#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
559pub struct GenerateContentResponse {
560    #[prost(message, optional, tag = "1")]
561    pub contents: ::core::option::Option<Body>,
562}
563/// A single value being matched or generated at the field/element level.
564///
565/// Each type Pact's matching rules discriminate has its own arm, rather than everything
566/// JSON-representable sharing a google.protobuf.Value. That type carries a single number type (a
567/// double), which would make `integer` and `decimal` indistinguishable and `type` wrong between a
568/// whole number and a decimal - and these are exactly the rules whose job is to check the runtime
569/// type of a value. Binary data has its own arm for the same reason: so it never has to be
570/// stringified into a form it does not fit.
571///
572/// See proposal 006 (Field-level matchers and generators).
573#[derive(Clone, PartialEq, ::prost::Message)]
574pub struct FieldValue {
575    #[prost(oneof = "field_value::Value", tags = "1, 2, 3, 4, 5, 6, 7")]
576    pub value: ::core::option::Option<field_value::Value>,
577}
578/// Nested message and enum types in `FieldValue`.
579pub mod field_value {
580    #[derive(Clone, PartialEq, ::prost::Oneof)]
581    pub enum Value {
582        /// A null value
583        #[prost(enumeration = "::prost_types::NullValue", tag = "1")]
584        NullValue(i32),
585        /// A boolean
586        #[prost(bool, tag = "2")]
587        BooleanValue(bool),
588        /// A string
589        #[prost(string, tag = "3")]
590        StringValue(::prost::alloc::string::String),
591        /// A whole number
592        #[prost(int64, tag = "4")]
593        IntegerValue(i64),
594        /// A number with a fractional part
595        #[prost(double, tag = "5")]
596        DecimalValue(f64),
597        /// Raw bytes, for a value that is not representable as text
598        #[prost(bytes, tag = "6")]
599        BinaryValue(::prost::alloc::vec::Vec<u8>),
600        /// A map or list, for a rule applied to a collection rather than a scalar. Numbers nested
601        /// inside follow JSON semantics (every number is a double) - a collection rule only needs the
602        /// shape and size of the collection, and the values inside it are matched by their own
603        /// field-level calls, at their own paths, where they arrive under the arms above.
604        #[prost(message, tag = "7")]
605        StructuredValue(::prost_types::Value),
606    }
607}
608/// Request to apply a plugin-provided matching rule to a single value. The plugin sees the value,
609/// its path and the rule's own configuration, but not the document that contains it - a rule that
610/// needs the surrounding document is a content matcher. See proposal 006.
611#[derive(Clone, PartialEq, ::prost::Message)]
612pub struct MatchFieldRequest {
613    /// Catalogue entry key of the rule being applied, e.g. "creditcard" for matcher/creditcard
614    #[prost(string, tag = "1")]
615    pub key: ::prost::alloc::string::String,
616    /// The rule as stored in the Pact file: its name and configured values
617    #[prost(message, optional, tag = "2")]
618    pub rule: ::core::option::Option<MatchingRule>,
619    /// Path to the value being matched. This is the value as per the documented Pact matching rule expressions.
620    #[prost(string, tag = "3")]
621    pub path: ::prost::alloc::string::String,
622    /// Part of the interaction the value came from: body, headers, metadata, query, path, status
623    #[prost(string, tag = "4")]
624    pub mismatch_type: ::prost::alloc::string::String,
625    /// Expected value from the Pact interaction
626    #[prost(message, optional, tag = "5")]
627    pub expected: ::core::option::Option<FieldValue>,
628    /// Actual value received
629    #[prost(message, optional, tag = "6")]
630    pub actual: ::core::option::Option<FieldValue>,
631    /// Additional data added to the Pact/Interaction by the plugin
632    #[prost(message, optional, tag = "7")]
633    pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
634    /// Context data provided by the test framework (carries testRunId for log correlation)
635    #[prost(message, optional, tag = "8")]
636    pub test_context: ::core::option::Option<::prost_types::Struct>,
637}
638/// Response to the MatchFieldRequest with the result of applying the rule
639#[derive(Clone, PartialEq, ::prost::Message)]
640pub struct MatchFieldResponse {
641    /// Error message if the rule could not be applied at all. If this field is set, the remaining
642    /// fields will be ignored and the verification marked as failed
643    #[prost(string, tag = "1")]
644    pub error: ::prost::alloc::string::String,
645    /// Mismatches found. An empty list means the value matched. A mismatch with an empty path is
646    /// reported against the path from the request
647    #[prost(message, repeated, tag = "2")]
648    pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
649}
650/// Request to generate a single value using a plugin-provided generator. Generators are pure
651/// functions of this request: anything from the host they need arrives in testContext or is
652/// fetched with an explicit callback. See proposal 006.
653#[derive(Clone, PartialEq, ::prost::Message)]
654pub struct GenerateFieldRequest {
655    /// Catalogue entry key of the generator being applied, e.g. "creditcard" for generator/creditcard
656    #[prost(string, tag = "1")]
657    pub key: ::prost::alloc::string::String,
658    /// The generator as stored in the Pact file: its name and configured values
659    #[prost(message, optional, tag = "2")]
660    pub generator: ::core::option::Option<Generator>,
661    /// Path to the value being generated. This is the value as per the documented Pact matching rule expressions.
662    #[prost(string, tag = "3")]
663    pub path: ::prost::alloc::string::String,
664    /// The example value from the Pact interaction that the generated value replaces
665    #[prost(message, optional, tag = "4")]
666    pub example_value: ::core::option::Option<FieldValue>,
667    /// Additional data added to the Pact/Interaction by the plugin
668    #[prost(message, optional, tag = "5")]
669    pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
670    /// Context data provided by the test framework
671    #[prost(message, optional, tag = "6")]
672    pub test_context: ::core::option::Option<::prost_types::Struct>,
673    /// The mode of the generation, if running from a consumer test or during provider verification
674    #[prost(enumeration = "generate_content_request::TestMode", tag = "7")]
675    pub test_mode: i32,
676}
677/// Response to the GenerateFieldRequest with the generated value
678#[derive(Clone, PartialEq, ::prost::Message)]
679pub struct GenerateFieldResponse {
680    /// Error message if the value could not be generated. If this field is set, the value will be
681    /// ignored
682    #[prost(string, tag = "1")]
683    pub error: ::prost::alloc::string::String,
684    /// The generated value
685    #[prost(message, optional, tag = "2")]
686    pub value: ::core::option::Option<FieldValue>,
687}
688/// Request to start a mock server
689#[derive(Clone, PartialEq, ::prost::Message)]
690pub struct StartMockServerRequest {
691    /// Interface to bind to. Will default to the loopback adapter
692    #[prost(string, tag = "1")]
693    pub host_interface: ::prost::alloc::string::String,
694    /// Port to bind to. Default (or a value of 0) get the OS to open a random port
695    #[prost(uint32, tag = "2")]
696    pub port: u32,
697    /// If TLS should be used (if supported by the mock server)
698    #[prost(bool, tag = "3")]
699    pub tls: bool,
700    /// Structured interaction data (replaces the pact JSON string from V1)
701    #[prost(message, repeated, tag = "4")]
702    pub interactions: ::prost::alloc::vec::Vec<InteractionContents>,
703    /// Context data provided by the test framework
704    #[prost(message, optional, tag = "5")]
705    pub test_context: ::core::option::Option<::prost_types::Struct>,
706}
707/// Response to the start mock server request
708#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
709pub struct StartMockServerResponse {
710    #[prost(oneof = "start_mock_server_response::Response", tags = "1, 2")]
711    pub response: ::core::option::Option<start_mock_server_response::Response>,
712}
713/// Nested message and enum types in `StartMockServerResponse`.
714pub mod start_mock_server_response {
715    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
716    pub enum Response {
717        /// If an error occurred
718        #[prost(string, tag = "1")]
719        Error(::prost::alloc::string::String),
720        /// Mock server details
721        #[prost(message, tag = "2")]
722        Details(super::MockServerDetails),
723    }
724}
725/// Details on a running mock server
726#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
727pub struct MockServerDetails {
728    /// Mock server unique ID
729    #[prost(string, tag = "1")]
730    pub key: ::prost::alloc::string::String,
731    /// Port the mock server is running on
732    #[prost(uint32, tag = "2")]
733    pub port: u32,
734    /// IP address the mock server is bound to. Probably an IP6 address, but may be IP4
735    #[prost(string, tag = "3")]
736    pub address: ::prost::alloc::string::String,
737}
738/// Request for a running mock server by ID
739#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
740pub struct MockServerRequest {
741    /// The server ID to shutdown
742    #[prost(string, tag = "1")]
743    pub server_key: ::prost::alloc::string::String,
744}
745/// Result of a request that the mock server received
746#[derive(Clone, PartialEq, ::prost::Message)]
747pub struct MockServerResult {
748    /// service + method that was requested
749    #[prost(string, tag = "1")]
750    pub path: ::prost::alloc::string::String,
751    /// If an error occurred trying to handle the request
752    #[prost(string, tag = "2")]
753    pub error: ::prost::alloc::string::String,
754    /// Any mismatches that occurred
755    #[prost(message, repeated, tag = "3")]
756    pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
757}
758/// Matching results of the mock server.
759#[derive(Clone, PartialEq, ::prost::Message)]
760pub struct MockServerResults {
761    /// If the mock status is all ok
762    #[prost(bool, tag = "1")]
763    pub ok: bool,
764    /// The results of the test run, will contain an entry for each request received by the mock server
765    #[prost(message, repeated, tag = "2")]
766    pub results: ::prost::alloc::vec::Vec<MockServerResult>,
767}
768/// Request to prepare an interaction for verification
769#[derive(Clone, PartialEq, ::prost::Message)]
770pub struct VerificationPreparationRequest {
771    /// Structured interaction data (replaces pact JSON + interactionKey from V1)
772    #[prost(message, optional, tag = "1")]
773    pub interaction_contents: ::core::option::Option<InteractionContents>,
774    /// Any data supplied by the user to verify the interaction
775    #[prost(message, optional, tag = "2")]
776    pub config: ::core::option::Option<::prost_types::Struct>,
777    /// Context data provided by the test framework
778    #[prost(message, optional, tag = "3")]
779    pub test_context: ::core::option::Option<::prost_types::Struct>,
780}
781/// Request metadata value. Will either be a JSON-like value, or binary data
782#[derive(Clone, PartialEq, ::prost::Message)]
783pub struct MetadataValue {
784    #[prost(oneof = "metadata_value::Value", tags = "1, 2")]
785    pub value: ::core::option::Option<metadata_value::Value>,
786}
787/// Nested message and enum types in `MetadataValue`.
788pub mod metadata_value {
789    #[derive(Clone, PartialEq, ::prost::Oneof)]
790    pub enum Value {
791        #[prost(message, tag = "1")]
792        NonBinaryValue(::prost_types::Value),
793        #[prost(bytes, tag = "2")]
794        BinaryValue(::prost::alloc::vec::Vec<u8>),
795    }
796}
797/// Interaction request data to be sent or received for verification
798#[derive(Clone, PartialEq, ::prost::Message)]
799pub struct InteractionData {
800    /// Request/Response body as bytes
801    #[prost(message, optional, tag = "1")]
802    pub body: ::core::option::Option<Body>,
803    /// Metadata associated with the request/response
804    #[prost(map = "string, message", tag = "2")]
805    pub metadata: ::std::collections::HashMap<
806        ::prost::alloc::string::String,
807        MetadataValue,
808    >,
809}
810/// Response for the prepare an interaction for verification request
811#[derive(Clone, PartialEq, ::prost::Message)]
812pub struct VerificationPreparationResponse {
813    #[prost(oneof = "verification_preparation_response::Response", tags = "1, 2")]
814    pub response: ::core::option::Option<verification_preparation_response::Response>,
815}
816/// Nested message and enum types in `VerificationPreparationResponse`.
817pub mod verification_preparation_response {
818    #[derive(Clone, PartialEq, ::prost::Oneof)]
819    pub enum Response {
820        /// If an error occurred
821        #[prost(string, tag = "1")]
822        Error(::prost::alloc::string::String),
823        /// Interaction data required to construct any request
824        #[prost(message, tag = "2")]
825        InteractionData(super::InteractionData),
826    }
827}
828/// Request data to verify an interaction
829#[derive(Clone, PartialEq, ::prost::Message)]
830pub struct VerifyInteractionRequest {
831    /// Interaction data required to construct the request
832    #[prost(message, optional, tag = "1")]
833    pub interaction_data: ::core::option::Option<InteractionData>,
834    /// Any data supplied by the user to verify the interaction
835    #[prost(message, optional, tag = "2")]
836    pub config: ::core::option::Option<::prost_types::Struct>,
837    /// Structured interaction data (replaces pact JSON + interactionKey from V1)
838    #[prost(message, optional, tag = "3")]
839    pub interaction_contents: ::core::option::Option<InteractionContents>,
840    /// Context data provided by the test framework
841    #[prost(message, optional, tag = "4")]
842    pub test_context: ::core::option::Option<::prost_types::Struct>,
843}
844#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
845pub struct VerificationResultItem {
846    #[prost(oneof = "verification_result_item::Result", tags = "1, 2")]
847    pub result: ::core::option::Option<verification_result_item::Result>,
848}
849/// Nested message and enum types in `VerificationResultItem`.
850pub mod verification_result_item {
851    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
852    pub enum Result {
853        #[prost(string, tag = "1")]
854        Error(::prost::alloc::string::String),
855        #[prost(message, tag = "2")]
856        Mismatch(super::ContentMismatch),
857    }
858}
859/// Result of running the verification
860#[derive(Clone, PartialEq, ::prost::Message)]
861pub struct VerificationResult {
862    /// Was the verification successful?
863    #[prost(bool, tag = "1")]
864    pub success: bool,
865    /// Interaction data retrieved from the provider (optional)
866    #[prost(message, optional, tag = "2")]
867    pub response_data: ::core::option::Option<InteractionData>,
868    /// Any mismatches that occurred
869    #[prost(message, repeated, tag = "3")]
870    pub mismatches: ::prost::alloc::vec::Vec<VerificationResultItem>,
871    /// Output for the verification to display to the user
872    #[prost(string, repeated, tag = "4")]
873    pub output: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
874}
875/// Result of running the verification
876#[derive(Clone, PartialEq, ::prost::Message)]
877pub struct VerifyInteractionResponse {
878    #[prost(oneof = "verify_interaction_response::Response", tags = "1, 2")]
879    pub response: ::core::option::Option<verify_interaction_response::Response>,
880}
881/// Nested message and enum types in `VerifyInteractionResponse`.
882pub mod verify_interaction_response {
883    #[derive(Clone, PartialEq, ::prost::Oneof)]
884    pub enum Response {
885        /// If an error occurred trying to run the verification
886        #[prost(string, tag = "1")]
887        Error(::prost::alloc::string::String),
888        #[prost(message, tag = "2")]
889        Result(super::VerificationResult),
890    }
891}
892/// Structured log record emitted by a plugin and forwarded to the driver via the Log RPC
893#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
894pub struct LogMessage {
895    /// Plugin instance UUID (from InitPluginRequest.pluginInstanceId)
896    #[prost(string, tag = "1")]
897    pub plugin_instance_id: ::prost::alloc::string::String,
898    /// Test run UUID (from testContext\["testRunId"\], if available)
899    #[prost(string, tag = "2")]
900    pub test_run_id: ::prost::alloc::string::String,
901    /// Log level: TRACE, DEBUG, INFO, WARN, ERROR
902    #[prost(string, tag = "3")]
903    pub level: ::prost::alloc::string::String,
904    /// Human-readable log message
905    #[prost(string, tag = "4")]
906    pub message: ::prost::alloc::string::String,
907    /// Logger name / module path (e.g. "pact_csv_plugin::matching")
908    #[prost(string, tag = "5")]
909    pub target: ::prost::alloc::string::String,
910    /// Unix epoch milliseconds
911    #[prost(int64, tag = "6")]
912    pub timestamp_ms: i64,
913}
914/// Callback request from a plugin to invoke a content matcher capability - host-provided or
915/// owned by another plugin - resolved by catalogue entry key. See proposal 007 (Driver-plugin
916/// callback model).
917#[derive(Clone, PartialEq, ::prost::Message)]
918pub struct HostCompareContentsRequest {
919    /// Catalogue entry key identifying the capability to invoke, e.g. "xml" for content-matcher/xml
920    #[prost(string, tag = "1")]
921    pub entry_key: ::prost::alloc::string::String,
922    /// The comparison request, in the same shape as PactPlugin.CompareContents
923    #[prost(message, optional, tag = "2")]
924    pub request: ::core::option::Option<CompareContentsRequest>,
925}
926/// Callback request from a plugin to invoke a content generator capability - host-provided or
927/// owned by another plugin - resolved by catalogue entry key. See proposal 007 (Driver-plugin
928/// callback model).
929#[derive(Clone, PartialEq, ::prost::Message)]
930pub struct HostGenerateContentRequest {
931    /// Catalogue entry key identifying the capability to invoke, e.g. "xml" for content-generator/xml
932    #[prost(string, tag = "1")]
933    pub entry_key: ::prost::alloc::string::String,
934    /// The generation request, in the same shape as PactPlugin.GenerateContent
935    #[prost(message, optional, tag = "2")]
936    pub request: ::core::option::Option<GenerateContentRequest>,
937}
938/// Callback request from a plugin to invoke a field-level matching rule - host-provided (one of the
939/// standard Pact rules) or owned by another plugin - resolved by catalogue entry key. See proposals
940/// 006 (Field-level matchers and generators) and 007 (Driver-plugin callback model).
941#[derive(Clone, PartialEq, ::prost::Message)]
942pub struct HostMatchFieldRequest {
943    /// Catalogue entry key identifying the rule to invoke. Either the rule name on its own ("type",
944    /// "content-type" - the same string MatchFieldRequest.rule.type carries), or more of the
945    /// catalogue key to disambiguate it ("matcher/type", "core/matcher/type").
946    #[prost(string, tag = "1")]
947    pub entry_key: ::prost::alloc::string::String,
948    /// The match request, in the same shape as PactPlugin.MatchField
949    #[prost(message, optional, tag = "2")]
950    pub request: ::core::option::Option<MatchFieldRequest>,
951}
952/// Callback request from a plugin to invoke a field-level generator - host-provided or owned by
953/// another plugin - resolved by catalogue entry key. See proposals 006 and 007.
954#[derive(Clone, PartialEq, ::prost::Message)]
955pub struct HostGenerateFieldRequest {
956    /// Catalogue entry key identifying the generator to invoke, e.g. "date" or "generator/date".
957    /// See HostMatchFieldRequest.entryKey.
958    #[prost(string, tag = "1")]
959    pub entry_key: ::prost::alloc::string::String,
960    /// The generation request, in the same shape as PactPlugin.GenerateField
961    #[prost(message, optional, tag = "2")]
962    pub request: ::core::option::Option<GenerateFieldRequest>,
963}
964/// Generated client implementations.
965pub mod plugin_host_client {
966    #![allow(
967        unused_variables,
968        dead_code,
969        missing_docs,
970        clippy::wildcard_imports,
971        clippy::let_unit_value,
972    )]
973    use tonic::codegen::*;
974    use tonic::codegen::http::Uri;
975    /// Driver-side service implemented by the driver and called by plugins
976    #[derive(Debug, Clone)]
977    pub struct PluginHostClient<T> {
978        inner: tonic::client::Grpc<T>,
979    }
980    impl PluginHostClient<tonic::transport::Channel> {
981        /// Attempt to create a new client by connecting to a given endpoint.
982        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
983        where
984            D: TryInto<tonic::transport::Endpoint>,
985            D::Error: Into<StdError>,
986        {
987            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
988            Ok(Self::new(conn))
989        }
990    }
991    impl<T> PluginHostClient<T>
992    where
993        T: tonic::client::GrpcService<tonic::body::Body>,
994        T::Error: Into<StdError>,
995        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
996        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
997    {
998        pub fn new(inner: T) -> Self {
999            let inner = tonic::client::Grpc::new(inner);
1000            Self { inner }
1001        }
1002        pub fn with_origin(inner: T, origin: Uri) -> Self {
1003            let inner = tonic::client::Grpc::with_origin(inner, origin);
1004            Self { inner }
1005        }
1006        pub fn with_interceptor<F>(
1007            inner: T,
1008            interceptor: F,
1009        ) -> PluginHostClient<InterceptedService<T, F>>
1010        where
1011            F: tonic::service::Interceptor,
1012            T::ResponseBody: Default,
1013            T: tonic::codegen::Service<
1014                http::Request<tonic::body::Body>,
1015                Response = http::Response<
1016                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1017                >,
1018            >,
1019            <T as tonic::codegen::Service<
1020                http::Request<tonic::body::Body>,
1021            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1022        {
1023            PluginHostClient::new(InterceptedService::new(inner, interceptor))
1024        }
1025        /// Compress requests with the given encoding.
1026        ///
1027        /// This requires the server to support it otherwise it might respond with an
1028        /// error.
1029        #[must_use]
1030        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1031            self.inner = self.inner.send_compressed(encoding);
1032            self
1033        }
1034        /// Enable decompressing responses.
1035        #[must_use]
1036        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1037            self.inner = self.inner.accept_compressed(encoding);
1038            self
1039        }
1040        /// Limits the maximum size of a decoded message.
1041        ///
1042        /// Default: `4MB`
1043        #[must_use]
1044        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1045            self.inner = self.inner.max_decoding_message_size(limit);
1046            self
1047        }
1048        /// Limits the maximum size of an encoded message.
1049        ///
1050        /// Default: `usize::MAX`
1051        #[must_use]
1052        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1053            self.inner = self.inner.max_encoding_message_size(limit);
1054            self
1055        }
1056        /// Forward a structured log record from the plugin to the driver's logging framework
1057        pub async fn log(
1058            &mut self,
1059            request: impl tonic::IntoRequest<super::LogMessage>,
1060        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
1061            self.inner
1062                .ready()
1063                .await
1064                .map_err(|e| {
1065                    tonic::Status::unknown(
1066                        format!("Service was not ready: {}", e.into()),
1067                    )
1068                })?;
1069            let codec = tonic_prost::ProstCodec::default();
1070            let path = http::uri::PathAndQuery::from_static(
1071                "/io.pact.plugin.v2.PluginHost/Log",
1072            );
1073            let mut req = request.into_request();
1074            req.extensions_mut()
1075                .insert(GrpcMethod::new("io.pact.plugin.v2.PluginHost", "Log"));
1076            self.inner.unary(req, path, codec).await
1077        }
1078        /// Invoke a content matcher capability by catalogue entry key. The driver resolves the key to
1079        /// either a host-registered core handler or another running plugin. See proposal 007.
1080        pub async fn compare_contents(
1081            &mut self,
1082            request: impl tonic::IntoRequest<super::HostCompareContentsRequest>,
1083        ) -> std::result::Result<
1084            tonic::Response<super::CompareContentsResponse>,
1085            tonic::Status,
1086        > {
1087            self.inner
1088                .ready()
1089                .await
1090                .map_err(|e| {
1091                    tonic::Status::unknown(
1092                        format!("Service was not ready: {}", e.into()),
1093                    )
1094                })?;
1095            let codec = tonic_prost::ProstCodec::default();
1096            let path = http::uri::PathAndQuery::from_static(
1097                "/io.pact.plugin.v2.PluginHost/CompareContents",
1098            );
1099            let mut req = request.into_request();
1100            req.extensions_mut()
1101                .insert(
1102                    GrpcMethod::new("io.pact.plugin.v2.PluginHost", "CompareContents"),
1103                );
1104            self.inner.unary(req, path, codec).await
1105        }
1106        /// Invoke a content generator capability by catalogue entry key. The driver resolves the key to
1107        /// either a host-registered core handler or another running plugin. See proposal 007.
1108        pub async fn generate_content(
1109            &mut self,
1110            request: impl tonic::IntoRequest<super::HostGenerateContentRequest>,
1111        ) -> std::result::Result<
1112            tonic::Response<super::GenerateContentResponse>,
1113            tonic::Status,
1114        > {
1115            self.inner
1116                .ready()
1117                .await
1118                .map_err(|e| {
1119                    tonic::Status::unknown(
1120                        format!("Service was not ready: {}", e.into()),
1121                    )
1122                })?;
1123            let codec = tonic_prost::ProstCodec::default();
1124            let path = http::uri::PathAndQuery::from_static(
1125                "/io.pact.plugin.v2.PluginHost/GenerateContent",
1126            );
1127            let mut req = request.into_request();
1128            req.extensions_mut()
1129                .insert(
1130                    GrpcMethod::new("io.pact.plugin.v2.PluginHost", "GenerateContent"),
1131                );
1132            self.inner.unary(req, path, codec).await
1133        }
1134        /// Invoke a field-level matching rule by catalogue entry key, resolved the same way. This is how
1135        /// a plugin delegates one field of a document it owns to a standard Pact rule instead of
1136        /// reimplementing it. See proposals 006 and 009.
1137        pub async fn match_field(
1138            &mut self,
1139            request: impl tonic::IntoRequest<super::HostMatchFieldRequest>,
1140        ) -> std::result::Result<
1141            tonic::Response<super::MatchFieldResponse>,
1142            tonic::Status,
1143        > {
1144            self.inner
1145                .ready()
1146                .await
1147                .map_err(|e| {
1148                    tonic::Status::unknown(
1149                        format!("Service was not ready: {}", e.into()),
1150                    )
1151                })?;
1152            let codec = tonic_prost::ProstCodec::default();
1153            let path = http::uri::PathAndQuery::from_static(
1154                "/io.pact.plugin.v2.PluginHost/MatchField",
1155            );
1156            let mut req = request.into_request();
1157            req.extensions_mut()
1158                .insert(GrpcMethod::new("io.pact.plugin.v2.PluginHost", "MatchField"));
1159            self.inner.unary(req, path, codec).await
1160        }
1161        /// Invoke a field-level generator by catalogue entry key, resolved the same way.
1162        /// See proposals 006 and 009.
1163        pub async fn generate_field(
1164            &mut self,
1165            request: impl tonic::IntoRequest<super::HostGenerateFieldRequest>,
1166        ) -> std::result::Result<
1167            tonic::Response<super::GenerateFieldResponse>,
1168            tonic::Status,
1169        > {
1170            self.inner
1171                .ready()
1172                .await
1173                .map_err(|e| {
1174                    tonic::Status::unknown(
1175                        format!("Service was not ready: {}", e.into()),
1176                    )
1177                })?;
1178            let codec = tonic_prost::ProstCodec::default();
1179            let path = http::uri::PathAndQuery::from_static(
1180                "/io.pact.plugin.v2.PluginHost/GenerateField",
1181            );
1182            let mut req = request.into_request();
1183            req.extensions_mut()
1184                .insert(
1185                    GrpcMethod::new("io.pact.plugin.v2.PluginHost", "GenerateField"),
1186                );
1187            self.inner.unary(req, path, codec).await
1188        }
1189    }
1190}
1191/// Generated server implementations.
1192pub mod plugin_host_server {
1193    #![allow(
1194        unused_variables,
1195        dead_code,
1196        missing_docs,
1197        clippy::wildcard_imports,
1198        clippy::let_unit_value,
1199    )]
1200    use tonic::codegen::*;
1201    /// Generated trait containing gRPC methods that should be implemented for use with PluginHostServer.
1202    #[async_trait]
1203    pub trait PluginHost: std::marker::Send + std::marker::Sync + 'static {
1204        /// Forward a structured log record from the plugin to the driver's logging framework
1205        async fn log(
1206            &self,
1207            request: tonic::Request<super::LogMessage>,
1208        ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
1209        /// Invoke a content matcher capability by catalogue entry key. The driver resolves the key to
1210        /// either a host-registered core handler or another running plugin. See proposal 007.
1211        async fn compare_contents(
1212            &self,
1213            request: tonic::Request<super::HostCompareContentsRequest>,
1214        ) -> std::result::Result<
1215            tonic::Response<super::CompareContentsResponse>,
1216            tonic::Status,
1217        >;
1218        /// Invoke a content generator capability by catalogue entry key. The driver resolves the key to
1219        /// either a host-registered core handler or another running plugin. See proposal 007.
1220        async fn generate_content(
1221            &self,
1222            request: tonic::Request<super::HostGenerateContentRequest>,
1223        ) -> std::result::Result<
1224            tonic::Response<super::GenerateContentResponse>,
1225            tonic::Status,
1226        >;
1227        /// Invoke a field-level matching rule by catalogue entry key, resolved the same way. This is how
1228        /// a plugin delegates one field of a document it owns to a standard Pact rule instead of
1229        /// reimplementing it. See proposals 006 and 009.
1230        async fn match_field(
1231            &self,
1232            request: tonic::Request<super::HostMatchFieldRequest>,
1233        ) -> std::result::Result<
1234            tonic::Response<super::MatchFieldResponse>,
1235            tonic::Status,
1236        >;
1237        /// Invoke a field-level generator by catalogue entry key, resolved the same way.
1238        /// See proposals 006 and 009.
1239        async fn generate_field(
1240            &self,
1241            request: tonic::Request<super::HostGenerateFieldRequest>,
1242        ) -> std::result::Result<
1243            tonic::Response<super::GenerateFieldResponse>,
1244            tonic::Status,
1245        >;
1246    }
1247    /// Driver-side service implemented by the driver and called by plugins
1248    #[derive(Debug)]
1249    pub struct PluginHostServer<T> {
1250        inner: Arc<T>,
1251        accept_compression_encodings: EnabledCompressionEncodings,
1252        send_compression_encodings: EnabledCompressionEncodings,
1253        max_decoding_message_size: Option<usize>,
1254        max_encoding_message_size: Option<usize>,
1255    }
1256    impl<T> PluginHostServer<T> {
1257        pub fn new(inner: T) -> Self {
1258            Self::from_arc(Arc::new(inner))
1259        }
1260        pub fn from_arc(inner: Arc<T>) -> Self {
1261            Self {
1262                inner,
1263                accept_compression_encodings: Default::default(),
1264                send_compression_encodings: Default::default(),
1265                max_decoding_message_size: None,
1266                max_encoding_message_size: None,
1267            }
1268        }
1269        pub fn with_interceptor<F>(
1270            inner: T,
1271            interceptor: F,
1272        ) -> InterceptedService<Self, F>
1273        where
1274            F: tonic::service::Interceptor,
1275        {
1276            InterceptedService::new(Self::new(inner), interceptor)
1277        }
1278        /// Enable decompressing requests with the given encoding.
1279        #[must_use]
1280        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1281            self.accept_compression_encodings.enable(encoding);
1282            self
1283        }
1284        /// Compress responses with the given encoding, if the client supports it.
1285        #[must_use]
1286        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1287            self.send_compression_encodings.enable(encoding);
1288            self
1289        }
1290        /// Limits the maximum size of a decoded message.
1291        ///
1292        /// Default: `4MB`
1293        #[must_use]
1294        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1295            self.max_decoding_message_size = Some(limit);
1296            self
1297        }
1298        /// Limits the maximum size of an encoded message.
1299        ///
1300        /// Default: `usize::MAX`
1301        #[must_use]
1302        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1303            self.max_encoding_message_size = Some(limit);
1304            self
1305        }
1306    }
1307    impl<T, B> tonic::codegen::Service<http::Request<B>> for PluginHostServer<T>
1308    where
1309        T: PluginHost,
1310        B: Body + std::marker::Send + 'static,
1311        B::Error: Into<StdError> + std::marker::Send + 'static,
1312    {
1313        type Response = http::Response<tonic::body::Body>;
1314        type Error = std::convert::Infallible;
1315        type Future = BoxFuture<Self::Response, Self::Error>;
1316        fn poll_ready(
1317            &mut self,
1318            _cx: &mut Context<'_>,
1319        ) -> Poll<std::result::Result<(), Self::Error>> {
1320            Poll::Ready(Ok(()))
1321        }
1322        fn call(&mut self, req: http::Request<B>) -> Self::Future {
1323            match req.uri().path() {
1324                "/io.pact.plugin.v2.PluginHost/Log" => {
1325                    #[allow(non_camel_case_types)]
1326                    struct LogSvc<T: PluginHost>(pub Arc<T>);
1327                    impl<T: PluginHost> tonic::server::UnaryService<super::LogMessage>
1328                    for LogSvc<T> {
1329                        type Response = ();
1330                        type Future = BoxFuture<
1331                            tonic::Response<Self::Response>,
1332                            tonic::Status,
1333                        >;
1334                        fn call(
1335                            &mut self,
1336                            request: tonic::Request<super::LogMessage>,
1337                        ) -> Self::Future {
1338                            let inner = Arc::clone(&self.0);
1339                            let fut = async move {
1340                                <T as PluginHost>::log(&inner, request).await
1341                            };
1342                            Box::pin(fut)
1343                        }
1344                    }
1345                    let accept_compression_encodings = self.accept_compression_encodings;
1346                    let send_compression_encodings = self.send_compression_encodings;
1347                    let max_decoding_message_size = self.max_decoding_message_size;
1348                    let max_encoding_message_size = self.max_encoding_message_size;
1349                    let inner = self.inner.clone();
1350                    let fut = async move {
1351                        let method = LogSvc(inner);
1352                        let codec = tonic_prost::ProstCodec::default();
1353                        let mut grpc = tonic::server::Grpc::new(codec)
1354                            .apply_compression_config(
1355                                accept_compression_encodings,
1356                                send_compression_encodings,
1357                            )
1358                            .apply_max_message_size_config(
1359                                max_decoding_message_size,
1360                                max_encoding_message_size,
1361                            );
1362                        let res = grpc.unary(method, req).await;
1363                        Ok(res)
1364                    };
1365                    Box::pin(fut)
1366                }
1367                "/io.pact.plugin.v2.PluginHost/CompareContents" => {
1368                    #[allow(non_camel_case_types)]
1369                    struct CompareContentsSvc<T: PluginHost>(pub Arc<T>);
1370                    impl<
1371                        T: PluginHost,
1372                    > tonic::server::UnaryService<super::HostCompareContentsRequest>
1373                    for CompareContentsSvc<T> {
1374                        type Response = super::CompareContentsResponse;
1375                        type Future = BoxFuture<
1376                            tonic::Response<Self::Response>,
1377                            tonic::Status,
1378                        >;
1379                        fn call(
1380                            &mut self,
1381                            request: tonic::Request<super::HostCompareContentsRequest>,
1382                        ) -> Self::Future {
1383                            let inner = Arc::clone(&self.0);
1384                            let fut = async move {
1385                                <T as PluginHost>::compare_contents(&inner, request).await
1386                            };
1387                            Box::pin(fut)
1388                        }
1389                    }
1390                    let accept_compression_encodings = self.accept_compression_encodings;
1391                    let send_compression_encodings = self.send_compression_encodings;
1392                    let max_decoding_message_size = self.max_decoding_message_size;
1393                    let max_encoding_message_size = self.max_encoding_message_size;
1394                    let inner = self.inner.clone();
1395                    let fut = async move {
1396                        let method = CompareContentsSvc(inner);
1397                        let codec = tonic_prost::ProstCodec::default();
1398                        let mut grpc = tonic::server::Grpc::new(codec)
1399                            .apply_compression_config(
1400                                accept_compression_encodings,
1401                                send_compression_encodings,
1402                            )
1403                            .apply_max_message_size_config(
1404                                max_decoding_message_size,
1405                                max_encoding_message_size,
1406                            );
1407                        let res = grpc.unary(method, req).await;
1408                        Ok(res)
1409                    };
1410                    Box::pin(fut)
1411                }
1412                "/io.pact.plugin.v2.PluginHost/GenerateContent" => {
1413                    #[allow(non_camel_case_types)]
1414                    struct GenerateContentSvc<T: PluginHost>(pub Arc<T>);
1415                    impl<
1416                        T: PluginHost,
1417                    > tonic::server::UnaryService<super::HostGenerateContentRequest>
1418                    for GenerateContentSvc<T> {
1419                        type Response = super::GenerateContentResponse;
1420                        type Future = BoxFuture<
1421                            tonic::Response<Self::Response>,
1422                            tonic::Status,
1423                        >;
1424                        fn call(
1425                            &mut self,
1426                            request: tonic::Request<super::HostGenerateContentRequest>,
1427                        ) -> Self::Future {
1428                            let inner = Arc::clone(&self.0);
1429                            let fut = async move {
1430                                <T as PluginHost>::generate_content(&inner, request).await
1431                            };
1432                            Box::pin(fut)
1433                        }
1434                    }
1435                    let accept_compression_encodings = self.accept_compression_encodings;
1436                    let send_compression_encodings = self.send_compression_encodings;
1437                    let max_decoding_message_size = self.max_decoding_message_size;
1438                    let max_encoding_message_size = self.max_encoding_message_size;
1439                    let inner = self.inner.clone();
1440                    let fut = async move {
1441                        let method = GenerateContentSvc(inner);
1442                        let codec = tonic_prost::ProstCodec::default();
1443                        let mut grpc = tonic::server::Grpc::new(codec)
1444                            .apply_compression_config(
1445                                accept_compression_encodings,
1446                                send_compression_encodings,
1447                            )
1448                            .apply_max_message_size_config(
1449                                max_decoding_message_size,
1450                                max_encoding_message_size,
1451                            );
1452                        let res = grpc.unary(method, req).await;
1453                        Ok(res)
1454                    };
1455                    Box::pin(fut)
1456                }
1457                "/io.pact.plugin.v2.PluginHost/MatchField" => {
1458                    #[allow(non_camel_case_types)]
1459                    struct MatchFieldSvc<T: PluginHost>(pub Arc<T>);
1460                    impl<
1461                        T: PluginHost,
1462                    > tonic::server::UnaryService<super::HostMatchFieldRequest>
1463                    for MatchFieldSvc<T> {
1464                        type Response = super::MatchFieldResponse;
1465                        type Future = BoxFuture<
1466                            tonic::Response<Self::Response>,
1467                            tonic::Status,
1468                        >;
1469                        fn call(
1470                            &mut self,
1471                            request: tonic::Request<super::HostMatchFieldRequest>,
1472                        ) -> Self::Future {
1473                            let inner = Arc::clone(&self.0);
1474                            let fut = async move {
1475                                <T as PluginHost>::match_field(&inner, request).await
1476                            };
1477                            Box::pin(fut)
1478                        }
1479                    }
1480                    let accept_compression_encodings = self.accept_compression_encodings;
1481                    let send_compression_encodings = self.send_compression_encodings;
1482                    let max_decoding_message_size = self.max_decoding_message_size;
1483                    let max_encoding_message_size = self.max_encoding_message_size;
1484                    let inner = self.inner.clone();
1485                    let fut = async move {
1486                        let method = MatchFieldSvc(inner);
1487                        let codec = tonic_prost::ProstCodec::default();
1488                        let mut grpc = tonic::server::Grpc::new(codec)
1489                            .apply_compression_config(
1490                                accept_compression_encodings,
1491                                send_compression_encodings,
1492                            )
1493                            .apply_max_message_size_config(
1494                                max_decoding_message_size,
1495                                max_encoding_message_size,
1496                            );
1497                        let res = grpc.unary(method, req).await;
1498                        Ok(res)
1499                    };
1500                    Box::pin(fut)
1501                }
1502                "/io.pact.plugin.v2.PluginHost/GenerateField" => {
1503                    #[allow(non_camel_case_types)]
1504                    struct GenerateFieldSvc<T: PluginHost>(pub Arc<T>);
1505                    impl<
1506                        T: PluginHost,
1507                    > tonic::server::UnaryService<super::HostGenerateFieldRequest>
1508                    for GenerateFieldSvc<T> {
1509                        type Response = super::GenerateFieldResponse;
1510                        type Future = BoxFuture<
1511                            tonic::Response<Self::Response>,
1512                            tonic::Status,
1513                        >;
1514                        fn call(
1515                            &mut self,
1516                            request: tonic::Request<super::HostGenerateFieldRequest>,
1517                        ) -> Self::Future {
1518                            let inner = Arc::clone(&self.0);
1519                            let fut = async move {
1520                                <T as PluginHost>::generate_field(&inner, request).await
1521                            };
1522                            Box::pin(fut)
1523                        }
1524                    }
1525                    let accept_compression_encodings = self.accept_compression_encodings;
1526                    let send_compression_encodings = self.send_compression_encodings;
1527                    let max_decoding_message_size = self.max_decoding_message_size;
1528                    let max_encoding_message_size = self.max_encoding_message_size;
1529                    let inner = self.inner.clone();
1530                    let fut = async move {
1531                        let method = GenerateFieldSvc(inner);
1532                        let codec = tonic_prost::ProstCodec::default();
1533                        let mut grpc = tonic::server::Grpc::new(codec)
1534                            .apply_compression_config(
1535                                accept_compression_encodings,
1536                                send_compression_encodings,
1537                            )
1538                            .apply_max_message_size_config(
1539                                max_decoding_message_size,
1540                                max_encoding_message_size,
1541                            );
1542                        let res = grpc.unary(method, req).await;
1543                        Ok(res)
1544                    };
1545                    Box::pin(fut)
1546                }
1547                _ => {
1548                    Box::pin(async move {
1549                        let mut response = http::Response::new(
1550                            tonic::body::Body::default(),
1551                        );
1552                        let headers = response.headers_mut();
1553                        headers
1554                            .insert(
1555                                tonic::Status::GRPC_STATUS,
1556                                (tonic::Code::Unimplemented as i32).into(),
1557                            );
1558                        headers
1559                            .insert(
1560                                http::header::CONTENT_TYPE,
1561                                tonic::metadata::GRPC_CONTENT_TYPE,
1562                            );
1563                        Ok(response)
1564                    })
1565                }
1566            }
1567        }
1568    }
1569    impl<T> Clone for PluginHostServer<T> {
1570        fn clone(&self) -> Self {
1571            let inner = self.inner.clone();
1572            Self {
1573                inner,
1574                accept_compression_encodings: self.accept_compression_encodings,
1575                send_compression_encodings: self.send_compression_encodings,
1576                max_decoding_message_size: self.max_decoding_message_size,
1577                max_encoding_message_size: self.max_encoding_message_size,
1578            }
1579        }
1580    }
1581    /// Generated gRPC service name
1582    pub const SERVICE_NAME: &str = "io.pact.plugin.v2.PluginHost";
1583    impl<T> tonic::server::NamedService for PluginHostServer<T> {
1584        const NAME: &'static str = SERVICE_NAME;
1585    }
1586}
1587/// Generated client implementations.
1588pub mod pact_plugin_client {
1589    #![allow(
1590        unused_variables,
1591        dead_code,
1592        missing_docs,
1593        clippy::wildcard_imports,
1594        clippy::let_unit_value,
1595    )]
1596    use tonic::codegen::*;
1597    use tonic::codegen::http::Uri;
1598    #[derive(Debug, Clone)]
1599    pub struct PactPluginClient<T> {
1600        inner: tonic::client::Grpc<T>,
1601    }
1602    impl PactPluginClient<tonic::transport::Channel> {
1603        /// Attempt to create a new client by connecting to a given endpoint.
1604        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
1605        where
1606            D: TryInto<tonic::transport::Endpoint>,
1607            D::Error: Into<StdError>,
1608        {
1609            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
1610            Ok(Self::new(conn))
1611        }
1612    }
1613    impl<T> PactPluginClient<T>
1614    where
1615        T: tonic::client::GrpcService<tonic::body::Body>,
1616        T::Error: Into<StdError>,
1617        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
1618        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
1619    {
1620        pub fn new(inner: T) -> Self {
1621            let inner = tonic::client::Grpc::new(inner);
1622            Self { inner }
1623        }
1624        pub fn with_origin(inner: T, origin: Uri) -> Self {
1625            let inner = tonic::client::Grpc::with_origin(inner, origin);
1626            Self { inner }
1627        }
1628        pub fn with_interceptor<F>(
1629            inner: T,
1630            interceptor: F,
1631        ) -> PactPluginClient<InterceptedService<T, F>>
1632        where
1633            F: tonic::service::Interceptor,
1634            T::ResponseBody: Default,
1635            T: tonic::codegen::Service<
1636                http::Request<tonic::body::Body>,
1637                Response = http::Response<
1638                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
1639                >,
1640            >,
1641            <T as tonic::codegen::Service<
1642                http::Request<tonic::body::Body>,
1643            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
1644        {
1645            PactPluginClient::new(InterceptedService::new(inner, interceptor))
1646        }
1647        /// Compress requests with the given encoding.
1648        ///
1649        /// This requires the server to support it otherwise it might respond with an
1650        /// error.
1651        #[must_use]
1652        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1653            self.inner = self.inner.send_compressed(encoding);
1654            self
1655        }
1656        /// Enable decompressing responses.
1657        #[must_use]
1658        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1659            self.inner = self.inner.accept_compressed(encoding);
1660            self
1661        }
1662        /// Limits the maximum size of a decoded message.
1663        ///
1664        /// Default: `4MB`
1665        #[must_use]
1666        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1667            self.inner = self.inner.max_decoding_message_size(limit);
1668            self
1669        }
1670        /// Limits the maximum size of an encoded message.
1671        ///
1672        /// Default: `usize::MAX`
1673        #[must_use]
1674        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1675            self.inner = self.inner.max_encoding_message_size(limit);
1676            self
1677        }
1678        /// Check that the plugin loaded OK. Returns the catalogue entries describing what the plugin provides
1679        pub async fn init_plugin(
1680            &mut self,
1681            request: impl tonic::IntoRequest<super::InitPluginRequest>,
1682        ) -> std::result::Result<
1683            tonic::Response<super::InitPluginResponse>,
1684            tonic::Status,
1685        > {
1686            self.inner
1687                .ready()
1688                .await
1689                .map_err(|e| {
1690                    tonic::Status::unknown(
1691                        format!("Service was not ready: {}", e.into()),
1692                    )
1693                })?;
1694            let codec = tonic_prost::ProstCodec::default();
1695            let path = http::uri::PathAndQuery::from_static(
1696                "/io.pact.plugin.v2.PactPlugin/InitPlugin",
1697            );
1698            let mut req = request.into_request();
1699            req.extensions_mut()
1700                .insert(GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "InitPlugin"));
1701            self.inner.unary(req, path, codec).await
1702        }
1703        /// Updated catalogue. This will be sent when the core catalogue has been updated (probably by a plugin loading).
1704        pub async fn update_catalogue(
1705            &mut self,
1706            request: impl tonic::IntoRequest<super::Catalogue>,
1707        ) -> std::result::Result<tonic::Response<()>, tonic::Status> {
1708            self.inner
1709                .ready()
1710                .await
1711                .map_err(|e| {
1712                    tonic::Status::unknown(
1713                        format!("Service was not ready: {}", e.into()),
1714                    )
1715                })?;
1716            let codec = tonic_prost::ProstCodec::default();
1717            let path = http::uri::PathAndQuery::from_static(
1718                "/io.pact.plugin.v2.PactPlugin/UpdateCatalogue",
1719            );
1720            let mut req = request.into_request();
1721            req.extensions_mut()
1722                .insert(
1723                    GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "UpdateCatalogue"),
1724                );
1725            self.inner.unary(req, path, codec).await
1726        }
1727        /// Request to perform a comparison of some contents (matching request)
1728        pub async fn compare_contents(
1729            &mut self,
1730            request: impl tonic::IntoRequest<super::CompareContentsRequest>,
1731        ) -> std::result::Result<
1732            tonic::Response<super::CompareContentsResponse>,
1733            tonic::Status,
1734        > {
1735            self.inner
1736                .ready()
1737                .await
1738                .map_err(|e| {
1739                    tonic::Status::unknown(
1740                        format!("Service was not ready: {}", e.into()),
1741                    )
1742                })?;
1743            let codec = tonic_prost::ProstCodec::default();
1744            let path = http::uri::PathAndQuery::from_static(
1745                "/io.pact.plugin.v2.PactPlugin/CompareContents",
1746            );
1747            let mut req = request.into_request();
1748            req.extensions_mut()
1749                .insert(
1750                    GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "CompareContents"),
1751                );
1752            self.inner.unary(req, path, codec).await
1753        }
1754        /// Request to configure/setup the interaction for later verification. Data returned will be persisted in the pact file.
1755        pub async fn configure_interaction(
1756            &mut self,
1757            request: impl tonic::IntoRequest<super::ConfigureInteractionRequest>,
1758        ) -> std::result::Result<
1759            tonic::Response<super::ConfigureInteractionResponse>,
1760            tonic::Status,
1761        > {
1762            self.inner
1763                .ready()
1764                .await
1765                .map_err(|e| {
1766                    tonic::Status::unknown(
1767                        format!("Service was not ready: {}", e.into()),
1768                    )
1769                })?;
1770            let codec = tonic_prost::ProstCodec::default();
1771            let path = http::uri::PathAndQuery::from_static(
1772                "/io.pact.plugin.v2.PactPlugin/ConfigureInteraction",
1773            );
1774            let mut req = request.into_request();
1775            req.extensions_mut()
1776                .insert(
1777                    GrpcMethod::new(
1778                        "io.pact.plugin.v2.PactPlugin",
1779                        "ConfigureInteraction",
1780                    ),
1781                );
1782            self.inner.unary(req, path, codec).await
1783        }
1784        /// Request to generate the content using any defined generators
1785        pub async fn generate_content(
1786            &mut self,
1787            request: impl tonic::IntoRequest<super::GenerateContentRequest>,
1788        ) -> std::result::Result<
1789            tonic::Response<super::GenerateContentResponse>,
1790            tonic::Status,
1791        > {
1792            self.inner
1793                .ready()
1794                .await
1795                .map_err(|e| {
1796                    tonic::Status::unknown(
1797                        format!("Service was not ready: {}", e.into()),
1798                    )
1799                })?;
1800            let codec = tonic_prost::ProstCodec::default();
1801            let path = http::uri::PathAndQuery::from_static(
1802                "/io.pact.plugin.v2.PactPlugin/GenerateContent",
1803            );
1804            let mut req = request.into_request();
1805            req.extensions_mut()
1806                .insert(
1807                    GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "GenerateContent"),
1808                );
1809            self.inner.unary(req, path, codec).await
1810        }
1811        /// Apply a plugin-provided matching rule to a single value. Required for any plugin that
1812        /// registers a MATCHER catalogue entry. See proposal 006 (Field-level matchers and generators).
1813        pub async fn match_field(
1814            &mut self,
1815            request: impl tonic::IntoRequest<super::MatchFieldRequest>,
1816        ) -> std::result::Result<
1817            tonic::Response<super::MatchFieldResponse>,
1818            tonic::Status,
1819        > {
1820            self.inner
1821                .ready()
1822                .await
1823                .map_err(|e| {
1824                    tonic::Status::unknown(
1825                        format!("Service was not ready: {}", e.into()),
1826                    )
1827                })?;
1828            let codec = tonic_prost::ProstCodec::default();
1829            let path = http::uri::PathAndQuery::from_static(
1830                "/io.pact.plugin.v2.PactPlugin/MatchField",
1831            );
1832            let mut req = request.into_request();
1833            req.extensions_mut()
1834                .insert(GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "MatchField"));
1835            self.inner.unary(req, path, codec).await
1836        }
1837        /// Apply a plugin-provided generator to a single value. Required for any plugin that registers
1838        /// a GENERATOR catalogue entry. See proposal 006.
1839        pub async fn generate_field(
1840            &mut self,
1841            request: impl tonic::IntoRequest<super::GenerateFieldRequest>,
1842        ) -> std::result::Result<
1843            tonic::Response<super::GenerateFieldResponse>,
1844            tonic::Status,
1845        > {
1846            self.inner
1847                .ready()
1848                .await
1849                .map_err(|e| {
1850                    tonic::Status::unknown(
1851                        format!("Service was not ready: {}", e.into()),
1852                    )
1853                })?;
1854            let codec = tonic_prost::ProstCodec::default();
1855            let path = http::uri::PathAndQuery::from_static(
1856                "/io.pact.plugin.v2.PactPlugin/GenerateField",
1857            );
1858            let mut req = request.into_request();
1859            req.extensions_mut()
1860                .insert(
1861                    GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "GenerateField"),
1862                );
1863            self.inner.unary(req, path, codec).await
1864        }
1865        /// Start a mock server
1866        pub async fn start_mock_server(
1867            &mut self,
1868            request: impl tonic::IntoRequest<super::StartMockServerRequest>,
1869        ) -> std::result::Result<
1870            tonic::Response<super::StartMockServerResponse>,
1871            tonic::Status,
1872        > {
1873            self.inner
1874                .ready()
1875                .await
1876                .map_err(|e| {
1877                    tonic::Status::unknown(
1878                        format!("Service was not ready: {}", e.into()),
1879                    )
1880                })?;
1881            let codec = tonic_prost::ProstCodec::default();
1882            let path = http::uri::PathAndQuery::from_static(
1883                "/io.pact.plugin.v2.PactPlugin/StartMockServer",
1884            );
1885            let mut req = request.into_request();
1886            req.extensions_mut()
1887                .insert(
1888                    GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "StartMockServer"),
1889                );
1890            self.inner.unary(req, path, codec).await
1891        }
1892        /// Shutdown a running mock server
1893        pub async fn shutdown_mock_server(
1894            &mut self,
1895            request: impl tonic::IntoRequest<super::MockServerRequest>,
1896        ) -> std::result::Result<
1897            tonic::Response<super::MockServerResults>,
1898            tonic::Status,
1899        > {
1900            self.inner
1901                .ready()
1902                .await
1903                .map_err(|e| {
1904                    tonic::Status::unknown(
1905                        format!("Service was not ready: {}", e.into()),
1906                    )
1907                })?;
1908            let codec = tonic_prost::ProstCodec::default();
1909            let path = http::uri::PathAndQuery::from_static(
1910                "/io.pact.plugin.v2.PactPlugin/ShutdownMockServer",
1911            );
1912            let mut req = request.into_request();
1913            req.extensions_mut()
1914                .insert(
1915                    GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "ShutdownMockServer"),
1916                );
1917            self.inner.unary(req, path, codec).await
1918        }
1919        /// Get the matching results from a running mock server
1920        pub async fn get_mock_server_results(
1921            &mut self,
1922            request: impl tonic::IntoRequest<super::MockServerRequest>,
1923        ) -> std::result::Result<
1924            tonic::Response<super::MockServerResults>,
1925            tonic::Status,
1926        > {
1927            self.inner
1928                .ready()
1929                .await
1930                .map_err(|e| {
1931                    tonic::Status::unknown(
1932                        format!("Service was not ready: {}", e.into()),
1933                    )
1934                })?;
1935            let codec = tonic_prost::ProstCodec::default();
1936            let path = http::uri::PathAndQuery::from_static(
1937                "/io.pact.plugin.v2.PactPlugin/GetMockServerResults",
1938            );
1939            let mut req = request.into_request();
1940            req.extensions_mut()
1941                .insert(
1942                    GrpcMethod::new(
1943                        "io.pact.plugin.v2.PactPlugin",
1944                        "GetMockServerResults",
1945                    ),
1946                );
1947            self.inner.unary(req, path, codec).await
1948        }
1949        /// Prepare an interaction for verification. This should return any data required to construct any request
1950        /// so that it can be amended before the verification is run
1951        pub async fn prepare_interaction_for_verification(
1952            &mut self,
1953            request: impl tonic::IntoRequest<super::VerificationPreparationRequest>,
1954        ) -> std::result::Result<
1955            tonic::Response<super::VerificationPreparationResponse>,
1956            tonic::Status,
1957        > {
1958            self.inner
1959                .ready()
1960                .await
1961                .map_err(|e| {
1962                    tonic::Status::unknown(
1963                        format!("Service was not ready: {}", e.into()),
1964                    )
1965                })?;
1966            let codec = tonic_prost::ProstCodec::default();
1967            let path = http::uri::PathAndQuery::from_static(
1968                "/io.pact.plugin.v2.PactPlugin/PrepareInteractionForVerification",
1969            );
1970            let mut req = request.into_request();
1971            req.extensions_mut()
1972                .insert(
1973                    GrpcMethod::new(
1974                        "io.pact.plugin.v2.PactPlugin",
1975                        "PrepareInteractionForVerification",
1976                    ),
1977                );
1978            self.inner.unary(req, path, codec).await
1979        }
1980        /// Execute the verification for the interaction.
1981        pub async fn verify_interaction(
1982            &mut self,
1983            request: impl tonic::IntoRequest<super::VerifyInteractionRequest>,
1984        ) -> std::result::Result<
1985            tonic::Response<super::VerifyInteractionResponse>,
1986            tonic::Status,
1987        > {
1988            self.inner
1989                .ready()
1990                .await
1991                .map_err(|e| {
1992                    tonic::Status::unknown(
1993                        format!("Service was not ready: {}", e.into()),
1994                    )
1995                })?;
1996            let codec = tonic_prost::ProstCodec::default();
1997            let path = http::uri::PathAndQuery::from_static(
1998                "/io.pact.plugin.v2.PactPlugin/VerifyInteraction",
1999            );
2000            let mut req = request.into_request();
2001            req.extensions_mut()
2002                .insert(
2003                    GrpcMethod::new("io.pact.plugin.v2.PactPlugin", "VerifyInteraction"),
2004                );
2005            self.inner.unary(req, path, codec).await
2006        }
2007    }
2008}
2009/// Generated server implementations.
2010pub mod pact_plugin_server {
2011    #![allow(
2012        unused_variables,
2013        dead_code,
2014        missing_docs,
2015        clippy::wildcard_imports,
2016        clippy::let_unit_value,
2017    )]
2018    use tonic::codegen::*;
2019    /// Generated trait containing gRPC methods that should be implemented for use with PactPluginServer.
2020    #[async_trait]
2021    pub trait PactPlugin: std::marker::Send + std::marker::Sync + 'static {
2022        /// Check that the plugin loaded OK. Returns the catalogue entries describing what the plugin provides
2023        async fn init_plugin(
2024            &self,
2025            request: tonic::Request<super::InitPluginRequest>,
2026        ) -> std::result::Result<
2027            tonic::Response<super::InitPluginResponse>,
2028            tonic::Status,
2029        >;
2030        /// Updated catalogue. This will be sent when the core catalogue has been updated (probably by a plugin loading).
2031        async fn update_catalogue(
2032            &self,
2033            request: tonic::Request<super::Catalogue>,
2034        ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
2035        /// Request to perform a comparison of some contents (matching request)
2036        async fn compare_contents(
2037            &self,
2038            request: tonic::Request<super::CompareContentsRequest>,
2039        ) -> std::result::Result<
2040            tonic::Response<super::CompareContentsResponse>,
2041            tonic::Status,
2042        >;
2043        /// Request to configure/setup the interaction for later verification. Data returned will be persisted in the pact file.
2044        async fn configure_interaction(
2045            &self,
2046            request: tonic::Request<super::ConfigureInteractionRequest>,
2047        ) -> std::result::Result<
2048            tonic::Response<super::ConfigureInteractionResponse>,
2049            tonic::Status,
2050        >;
2051        /// Request to generate the content using any defined generators
2052        async fn generate_content(
2053            &self,
2054            request: tonic::Request<super::GenerateContentRequest>,
2055        ) -> std::result::Result<
2056            tonic::Response<super::GenerateContentResponse>,
2057            tonic::Status,
2058        >;
2059        /// Apply a plugin-provided matching rule to a single value. Required for any plugin that
2060        /// registers a MATCHER catalogue entry. See proposal 006 (Field-level matchers and generators).
2061        async fn match_field(
2062            &self,
2063            request: tonic::Request<super::MatchFieldRequest>,
2064        ) -> std::result::Result<
2065            tonic::Response<super::MatchFieldResponse>,
2066            tonic::Status,
2067        >;
2068        /// Apply a plugin-provided generator to a single value. Required for any plugin that registers
2069        /// a GENERATOR catalogue entry. See proposal 006.
2070        async fn generate_field(
2071            &self,
2072            request: tonic::Request<super::GenerateFieldRequest>,
2073        ) -> std::result::Result<
2074            tonic::Response<super::GenerateFieldResponse>,
2075            tonic::Status,
2076        >;
2077        /// Start a mock server
2078        async fn start_mock_server(
2079            &self,
2080            request: tonic::Request<super::StartMockServerRequest>,
2081        ) -> std::result::Result<
2082            tonic::Response<super::StartMockServerResponse>,
2083            tonic::Status,
2084        >;
2085        /// Shutdown a running mock server
2086        async fn shutdown_mock_server(
2087            &self,
2088            request: tonic::Request<super::MockServerRequest>,
2089        ) -> std::result::Result<
2090            tonic::Response<super::MockServerResults>,
2091            tonic::Status,
2092        >;
2093        /// Get the matching results from a running mock server
2094        async fn get_mock_server_results(
2095            &self,
2096            request: tonic::Request<super::MockServerRequest>,
2097        ) -> std::result::Result<
2098            tonic::Response<super::MockServerResults>,
2099            tonic::Status,
2100        >;
2101        /// Prepare an interaction for verification. This should return any data required to construct any request
2102        /// so that it can be amended before the verification is run
2103        async fn prepare_interaction_for_verification(
2104            &self,
2105            request: tonic::Request<super::VerificationPreparationRequest>,
2106        ) -> std::result::Result<
2107            tonic::Response<super::VerificationPreparationResponse>,
2108            tonic::Status,
2109        >;
2110        /// Execute the verification for the interaction.
2111        async fn verify_interaction(
2112            &self,
2113            request: tonic::Request<super::VerifyInteractionRequest>,
2114        ) -> std::result::Result<
2115            tonic::Response<super::VerifyInteractionResponse>,
2116            tonic::Status,
2117        >;
2118    }
2119    #[derive(Debug)]
2120    pub struct PactPluginServer<T> {
2121        inner: Arc<T>,
2122        accept_compression_encodings: EnabledCompressionEncodings,
2123        send_compression_encodings: EnabledCompressionEncodings,
2124        max_decoding_message_size: Option<usize>,
2125        max_encoding_message_size: Option<usize>,
2126    }
2127    impl<T> PactPluginServer<T> {
2128        pub fn new(inner: T) -> Self {
2129            Self::from_arc(Arc::new(inner))
2130        }
2131        pub fn from_arc(inner: Arc<T>) -> Self {
2132            Self {
2133                inner,
2134                accept_compression_encodings: Default::default(),
2135                send_compression_encodings: Default::default(),
2136                max_decoding_message_size: None,
2137                max_encoding_message_size: None,
2138            }
2139        }
2140        pub fn with_interceptor<F>(
2141            inner: T,
2142            interceptor: F,
2143        ) -> InterceptedService<Self, F>
2144        where
2145            F: tonic::service::Interceptor,
2146        {
2147            InterceptedService::new(Self::new(inner), interceptor)
2148        }
2149        /// Enable decompressing requests with the given encoding.
2150        #[must_use]
2151        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2152            self.accept_compression_encodings.enable(encoding);
2153            self
2154        }
2155        /// Compress responses with the given encoding, if the client supports it.
2156        #[must_use]
2157        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2158            self.send_compression_encodings.enable(encoding);
2159            self
2160        }
2161        /// Limits the maximum size of a decoded message.
2162        ///
2163        /// Default: `4MB`
2164        #[must_use]
2165        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
2166            self.max_decoding_message_size = Some(limit);
2167            self
2168        }
2169        /// Limits the maximum size of an encoded message.
2170        ///
2171        /// Default: `usize::MAX`
2172        #[must_use]
2173        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
2174            self.max_encoding_message_size = Some(limit);
2175            self
2176        }
2177    }
2178    impl<T, B> tonic::codegen::Service<http::Request<B>> for PactPluginServer<T>
2179    where
2180        T: PactPlugin,
2181        B: Body + std::marker::Send + 'static,
2182        B::Error: Into<StdError> + std::marker::Send + 'static,
2183    {
2184        type Response = http::Response<tonic::body::Body>;
2185        type Error = std::convert::Infallible;
2186        type Future = BoxFuture<Self::Response, Self::Error>;
2187        fn poll_ready(
2188            &mut self,
2189            _cx: &mut Context<'_>,
2190        ) -> Poll<std::result::Result<(), Self::Error>> {
2191            Poll::Ready(Ok(()))
2192        }
2193        fn call(&mut self, req: http::Request<B>) -> Self::Future {
2194            match req.uri().path() {
2195                "/io.pact.plugin.v2.PactPlugin/InitPlugin" => {
2196                    #[allow(non_camel_case_types)]
2197                    struct InitPluginSvc<T: PactPlugin>(pub Arc<T>);
2198                    impl<
2199                        T: PactPlugin,
2200                    > tonic::server::UnaryService<super::InitPluginRequest>
2201                    for InitPluginSvc<T> {
2202                        type Response = super::InitPluginResponse;
2203                        type Future = BoxFuture<
2204                            tonic::Response<Self::Response>,
2205                            tonic::Status,
2206                        >;
2207                        fn call(
2208                            &mut self,
2209                            request: tonic::Request<super::InitPluginRequest>,
2210                        ) -> Self::Future {
2211                            let inner = Arc::clone(&self.0);
2212                            let fut = async move {
2213                                <T as PactPlugin>::init_plugin(&inner, request).await
2214                            };
2215                            Box::pin(fut)
2216                        }
2217                    }
2218                    let accept_compression_encodings = self.accept_compression_encodings;
2219                    let send_compression_encodings = self.send_compression_encodings;
2220                    let max_decoding_message_size = self.max_decoding_message_size;
2221                    let max_encoding_message_size = self.max_encoding_message_size;
2222                    let inner = self.inner.clone();
2223                    let fut = async move {
2224                        let method = InitPluginSvc(inner);
2225                        let codec = tonic_prost::ProstCodec::default();
2226                        let mut grpc = tonic::server::Grpc::new(codec)
2227                            .apply_compression_config(
2228                                accept_compression_encodings,
2229                                send_compression_encodings,
2230                            )
2231                            .apply_max_message_size_config(
2232                                max_decoding_message_size,
2233                                max_encoding_message_size,
2234                            );
2235                        let res = grpc.unary(method, req).await;
2236                        Ok(res)
2237                    };
2238                    Box::pin(fut)
2239                }
2240                "/io.pact.plugin.v2.PactPlugin/UpdateCatalogue" => {
2241                    #[allow(non_camel_case_types)]
2242                    struct UpdateCatalogueSvc<T: PactPlugin>(pub Arc<T>);
2243                    impl<T: PactPlugin> tonic::server::UnaryService<super::Catalogue>
2244                    for UpdateCatalogueSvc<T> {
2245                        type Response = ();
2246                        type Future = BoxFuture<
2247                            tonic::Response<Self::Response>,
2248                            tonic::Status,
2249                        >;
2250                        fn call(
2251                            &mut self,
2252                            request: tonic::Request<super::Catalogue>,
2253                        ) -> Self::Future {
2254                            let inner = Arc::clone(&self.0);
2255                            let fut = async move {
2256                                <T as PactPlugin>::update_catalogue(&inner, request).await
2257                            };
2258                            Box::pin(fut)
2259                        }
2260                    }
2261                    let accept_compression_encodings = self.accept_compression_encodings;
2262                    let send_compression_encodings = self.send_compression_encodings;
2263                    let max_decoding_message_size = self.max_decoding_message_size;
2264                    let max_encoding_message_size = self.max_encoding_message_size;
2265                    let inner = self.inner.clone();
2266                    let fut = async move {
2267                        let method = UpdateCatalogueSvc(inner);
2268                        let codec = tonic_prost::ProstCodec::default();
2269                        let mut grpc = tonic::server::Grpc::new(codec)
2270                            .apply_compression_config(
2271                                accept_compression_encodings,
2272                                send_compression_encodings,
2273                            )
2274                            .apply_max_message_size_config(
2275                                max_decoding_message_size,
2276                                max_encoding_message_size,
2277                            );
2278                        let res = grpc.unary(method, req).await;
2279                        Ok(res)
2280                    };
2281                    Box::pin(fut)
2282                }
2283                "/io.pact.plugin.v2.PactPlugin/CompareContents" => {
2284                    #[allow(non_camel_case_types)]
2285                    struct CompareContentsSvc<T: PactPlugin>(pub Arc<T>);
2286                    impl<
2287                        T: PactPlugin,
2288                    > tonic::server::UnaryService<super::CompareContentsRequest>
2289                    for CompareContentsSvc<T> {
2290                        type Response = super::CompareContentsResponse;
2291                        type Future = BoxFuture<
2292                            tonic::Response<Self::Response>,
2293                            tonic::Status,
2294                        >;
2295                        fn call(
2296                            &mut self,
2297                            request: tonic::Request<super::CompareContentsRequest>,
2298                        ) -> Self::Future {
2299                            let inner = Arc::clone(&self.0);
2300                            let fut = async move {
2301                                <T as PactPlugin>::compare_contents(&inner, request).await
2302                            };
2303                            Box::pin(fut)
2304                        }
2305                    }
2306                    let accept_compression_encodings = self.accept_compression_encodings;
2307                    let send_compression_encodings = self.send_compression_encodings;
2308                    let max_decoding_message_size = self.max_decoding_message_size;
2309                    let max_encoding_message_size = self.max_encoding_message_size;
2310                    let inner = self.inner.clone();
2311                    let fut = async move {
2312                        let method = CompareContentsSvc(inner);
2313                        let codec = tonic_prost::ProstCodec::default();
2314                        let mut grpc = tonic::server::Grpc::new(codec)
2315                            .apply_compression_config(
2316                                accept_compression_encodings,
2317                                send_compression_encodings,
2318                            )
2319                            .apply_max_message_size_config(
2320                                max_decoding_message_size,
2321                                max_encoding_message_size,
2322                            );
2323                        let res = grpc.unary(method, req).await;
2324                        Ok(res)
2325                    };
2326                    Box::pin(fut)
2327                }
2328                "/io.pact.plugin.v2.PactPlugin/ConfigureInteraction" => {
2329                    #[allow(non_camel_case_types)]
2330                    struct ConfigureInteractionSvc<T: PactPlugin>(pub Arc<T>);
2331                    impl<
2332                        T: PactPlugin,
2333                    > tonic::server::UnaryService<super::ConfigureInteractionRequest>
2334                    for ConfigureInteractionSvc<T> {
2335                        type Response = super::ConfigureInteractionResponse;
2336                        type Future = BoxFuture<
2337                            tonic::Response<Self::Response>,
2338                            tonic::Status,
2339                        >;
2340                        fn call(
2341                            &mut self,
2342                            request: tonic::Request<super::ConfigureInteractionRequest>,
2343                        ) -> Self::Future {
2344                            let inner = Arc::clone(&self.0);
2345                            let fut = async move {
2346                                <T as PactPlugin>::configure_interaction(&inner, request)
2347                                    .await
2348                            };
2349                            Box::pin(fut)
2350                        }
2351                    }
2352                    let accept_compression_encodings = self.accept_compression_encodings;
2353                    let send_compression_encodings = self.send_compression_encodings;
2354                    let max_decoding_message_size = self.max_decoding_message_size;
2355                    let max_encoding_message_size = self.max_encoding_message_size;
2356                    let inner = self.inner.clone();
2357                    let fut = async move {
2358                        let method = ConfigureInteractionSvc(inner);
2359                        let codec = tonic_prost::ProstCodec::default();
2360                        let mut grpc = tonic::server::Grpc::new(codec)
2361                            .apply_compression_config(
2362                                accept_compression_encodings,
2363                                send_compression_encodings,
2364                            )
2365                            .apply_max_message_size_config(
2366                                max_decoding_message_size,
2367                                max_encoding_message_size,
2368                            );
2369                        let res = grpc.unary(method, req).await;
2370                        Ok(res)
2371                    };
2372                    Box::pin(fut)
2373                }
2374                "/io.pact.plugin.v2.PactPlugin/GenerateContent" => {
2375                    #[allow(non_camel_case_types)]
2376                    struct GenerateContentSvc<T: PactPlugin>(pub Arc<T>);
2377                    impl<
2378                        T: PactPlugin,
2379                    > tonic::server::UnaryService<super::GenerateContentRequest>
2380                    for GenerateContentSvc<T> {
2381                        type Response = super::GenerateContentResponse;
2382                        type Future = BoxFuture<
2383                            tonic::Response<Self::Response>,
2384                            tonic::Status,
2385                        >;
2386                        fn call(
2387                            &mut self,
2388                            request: tonic::Request<super::GenerateContentRequest>,
2389                        ) -> Self::Future {
2390                            let inner = Arc::clone(&self.0);
2391                            let fut = async move {
2392                                <T as PactPlugin>::generate_content(&inner, request).await
2393                            };
2394                            Box::pin(fut)
2395                        }
2396                    }
2397                    let accept_compression_encodings = self.accept_compression_encodings;
2398                    let send_compression_encodings = self.send_compression_encodings;
2399                    let max_decoding_message_size = self.max_decoding_message_size;
2400                    let max_encoding_message_size = self.max_encoding_message_size;
2401                    let inner = self.inner.clone();
2402                    let fut = async move {
2403                        let method = GenerateContentSvc(inner);
2404                        let codec = tonic_prost::ProstCodec::default();
2405                        let mut grpc = tonic::server::Grpc::new(codec)
2406                            .apply_compression_config(
2407                                accept_compression_encodings,
2408                                send_compression_encodings,
2409                            )
2410                            .apply_max_message_size_config(
2411                                max_decoding_message_size,
2412                                max_encoding_message_size,
2413                            );
2414                        let res = grpc.unary(method, req).await;
2415                        Ok(res)
2416                    };
2417                    Box::pin(fut)
2418                }
2419                "/io.pact.plugin.v2.PactPlugin/MatchField" => {
2420                    #[allow(non_camel_case_types)]
2421                    struct MatchFieldSvc<T: PactPlugin>(pub Arc<T>);
2422                    impl<
2423                        T: PactPlugin,
2424                    > tonic::server::UnaryService<super::MatchFieldRequest>
2425                    for MatchFieldSvc<T> {
2426                        type Response = super::MatchFieldResponse;
2427                        type Future = BoxFuture<
2428                            tonic::Response<Self::Response>,
2429                            tonic::Status,
2430                        >;
2431                        fn call(
2432                            &mut self,
2433                            request: tonic::Request<super::MatchFieldRequest>,
2434                        ) -> Self::Future {
2435                            let inner = Arc::clone(&self.0);
2436                            let fut = async move {
2437                                <T as PactPlugin>::match_field(&inner, request).await
2438                            };
2439                            Box::pin(fut)
2440                        }
2441                    }
2442                    let accept_compression_encodings = self.accept_compression_encodings;
2443                    let send_compression_encodings = self.send_compression_encodings;
2444                    let max_decoding_message_size = self.max_decoding_message_size;
2445                    let max_encoding_message_size = self.max_encoding_message_size;
2446                    let inner = self.inner.clone();
2447                    let fut = async move {
2448                        let method = MatchFieldSvc(inner);
2449                        let codec = tonic_prost::ProstCodec::default();
2450                        let mut grpc = tonic::server::Grpc::new(codec)
2451                            .apply_compression_config(
2452                                accept_compression_encodings,
2453                                send_compression_encodings,
2454                            )
2455                            .apply_max_message_size_config(
2456                                max_decoding_message_size,
2457                                max_encoding_message_size,
2458                            );
2459                        let res = grpc.unary(method, req).await;
2460                        Ok(res)
2461                    };
2462                    Box::pin(fut)
2463                }
2464                "/io.pact.plugin.v2.PactPlugin/GenerateField" => {
2465                    #[allow(non_camel_case_types)]
2466                    struct GenerateFieldSvc<T: PactPlugin>(pub Arc<T>);
2467                    impl<
2468                        T: PactPlugin,
2469                    > tonic::server::UnaryService<super::GenerateFieldRequest>
2470                    for GenerateFieldSvc<T> {
2471                        type Response = super::GenerateFieldResponse;
2472                        type Future = BoxFuture<
2473                            tonic::Response<Self::Response>,
2474                            tonic::Status,
2475                        >;
2476                        fn call(
2477                            &mut self,
2478                            request: tonic::Request<super::GenerateFieldRequest>,
2479                        ) -> Self::Future {
2480                            let inner = Arc::clone(&self.0);
2481                            let fut = async move {
2482                                <T as PactPlugin>::generate_field(&inner, request).await
2483                            };
2484                            Box::pin(fut)
2485                        }
2486                    }
2487                    let accept_compression_encodings = self.accept_compression_encodings;
2488                    let send_compression_encodings = self.send_compression_encodings;
2489                    let max_decoding_message_size = self.max_decoding_message_size;
2490                    let max_encoding_message_size = self.max_encoding_message_size;
2491                    let inner = self.inner.clone();
2492                    let fut = async move {
2493                        let method = GenerateFieldSvc(inner);
2494                        let codec = tonic_prost::ProstCodec::default();
2495                        let mut grpc = tonic::server::Grpc::new(codec)
2496                            .apply_compression_config(
2497                                accept_compression_encodings,
2498                                send_compression_encodings,
2499                            )
2500                            .apply_max_message_size_config(
2501                                max_decoding_message_size,
2502                                max_encoding_message_size,
2503                            );
2504                        let res = grpc.unary(method, req).await;
2505                        Ok(res)
2506                    };
2507                    Box::pin(fut)
2508                }
2509                "/io.pact.plugin.v2.PactPlugin/StartMockServer" => {
2510                    #[allow(non_camel_case_types)]
2511                    struct StartMockServerSvc<T: PactPlugin>(pub Arc<T>);
2512                    impl<
2513                        T: PactPlugin,
2514                    > tonic::server::UnaryService<super::StartMockServerRequest>
2515                    for StartMockServerSvc<T> {
2516                        type Response = super::StartMockServerResponse;
2517                        type Future = BoxFuture<
2518                            tonic::Response<Self::Response>,
2519                            tonic::Status,
2520                        >;
2521                        fn call(
2522                            &mut self,
2523                            request: tonic::Request<super::StartMockServerRequest>,
2524                        ) -> Self::Future {
2525                            let inner = Arc::clone(&self.0);
2526                            let fut = async move {
2527                                <T as PactPlugin>::start_mock_server(&inner, request).await
2528                            };
2529                            Box::pin(fut)
2530                        }
2531                    }
2532                    let accept_compression_encodings = self.accept_compression_encodings;
2533                    let send_compression_encodings = self.send_compression_encodings;
2534                    let max_decoding_message_size = self.max_decoding_message_size;
2535                    let max_encoding_message_size = self.max_encoding_message_size;
2536                    let inner = self.inner.clone();
2537                    let fut = async move {
2538                        let method = StartMockServerSvc(inner);
2539                        let codec = tonic_prost::ProstCodec::default();
2540                        let mut grpc = tonic::server::Grpc::new(codec)
2541                            .apply_compression_config(
2542                                accept_compression_encodings,
2543                                send_compression_encodings,
2544                            )
2545                            .apply_max_message_size_config(
2546                                max_decoding_message_size,
2547                                max_encoding_message_size,
2548                            );
2549                        let res = grpc.unary(method, req).await;
2550                        Ok(res)
2551                    };
2552                    Box::pin(fut)
2553                }
2554                "/io.pact.plugin.v2.PactPlugin/ShutdownMockServer" => {
2555                    #[allow(non_camel_case_types)]
2556                    struct ShutdownMockServerSvc<T: PactPlugin>(pub Arc<T>);
2557                    impl<
2558                        T: PactPlugin,
2559                    > tonic::server::UnaryService<super::MockServerRequest>
2560                    for ShutdownMockServerSvc<T> {
2561                        type Response = super::MockServerResults;
2562                        type Future = BoxFuture<
2563                            tonic::Response<Self::Response>,
2564                            tonic::Status,
2565                        >;
2566                        fn call(
2567                            &mut self,
2568                            request: tonic::Request<super::MockServerRequest>,
2569                        ) -> Self::Future {
2570                            let inner = Arc::clone(&self.0);
2571                            let fut = async move {
2572                                <T as PactPlugin>::shutdown_mock_server(&inner, request)
2573                                    .await
2574                            };
2575                            Box::pin(fut)
2576                        }
2577                    }
2578                    let accept_compression_encodings = self.accept_compression_encodings;
2579                    let send_compression_encodings = self.send_compression_encodings;
2580                    let max_decoding_message_size = self.max_decoding_message_size;
2581                    let max_encoding_message_size = self.max_encoding_message_size;
2582                    let inner = self.inner.clone();
2583                    let fut = async move {
2584                        let method = ShutdownMockServerSvc(inner);
2585                        let codec = tonic_prost::ProstCodec::default();
2586                        let mut grpc = tonic::server::Grpc::new(codec)
2587                            .apply_compression_config(
2588                                accept_compression_encodings,
2589                                send_compression_encodings,
2590                            )
2591                            .apply_max_message_size_config(
2592                                max_decoding_message_size,
2593                                max_encoding_message_size,
2594                            );
2595                        let res = grpc.unary(method, req).await;
2596                        Ok(res)
2597                    };
2598                    Box::pin(fut)
2599                }
2600                "/io.pact.plugin.v2.PactPlugin/GetMockServerResults" => {
2601                    #[allow(non_camel_case_types)]
2602                    struct GetMockServerResultsSvc<T: PactPlugin>(pub Arc<T>);
2603                    impl<
2604                        T: PactPlugin,
2605                    > tonic::server::UnaryService<super::MockServerRequest>
2606                    for GetMockServerResultsSvc<T> {
2607                        type Response = super::MockServerResults;
2608                        type Future = BoxFuture<
2609                            tonic::Response<Self::Response>,
2610                            tonic::Status,
2611                        >;
2612                        fn call(
2613                            &mut self,
2614                            request: tonic::Request<super::MockServerRequest>,
2615                        ) -> Self::Future {
2616                            let inner = Arc::clone(&self.0);
2617                            let fut = async move {
2618                                <T as PactPlugin>::get_mock_server_results(&inner, request)
2619                                    .await
2620                            };
2621                            Box::pin(fut)
2622                        }
2623                    }
2624                    let accept_compression_encodings = self.accept_compression_encodings;
2625                    let send_compression_encodings = self.send_compression_encodings;
2626                    let max_decoding_message_size = self.max_decoding_message_size;
2627                    let max_encoding_message_size = self.max_encoding_message_size;
2628                    let inner = self.inner.clone();
2629                    let fut = async move {
2630                        let method = GetMockServerResultsSvc(inner);
2631                        let codec = tonic_prost::ProstCodec::default();
2632                        let mut grpc = tonic::server::Grpc::new(codec)
2633                            .apply_compression_config(
2634                                accept_compression_encodings,
2635                                send_compression_encodings,
2636                            )
2637                            .apply_max_message_size_config(
2638                                max_decoding_message_size,
2639                                max_encoding_message_size,
2640                            );
2641                        let res = grpc.unary(method, req).await;
2642                        Ok(res)
2643                    };
2644                    Box::pin(fut)
2645                }
2646                "/io.pact.plugin.v2.PactPlugin/PrepareInteractionForVerification" => {
2647                    #[allow(non_camel_case_types)]
2648                    struct PrepareInteractionForVerificationSvc<T: PactPlugin>(
2649                        pub Arc<T>,
2650                    );
2651                    impl<
2652                        T: PactPlugin,
2653                    > tonic::server::UnaryService<super::VerificationPreparationRequest>
2654                    for PrepareInteractionForVerificationSvc<T> {
2655                        type Response = super::VerificationPreparationResponse;
2656                        type Future = BoxFuture<
2657                            tonic::Response<Self::Response>,
2658                            tonic::Status,
2659                        >;
2660                        fn call(
2661                            &mut self,
2662                            request: tonic::Request<
2663                                super::VerificationPreparationRequest,
2664                            >,
2665                        ) -> Self::Future {
2666                            let inner = Arc::clone(&self.0);
2667                            let fut = async move {
2668                                <T as PactPlugin>::prepare_interaction_for_verification(
2669                                        &inner,
2670                                        request,
2671                                    )
2672                                    .await
2673                            };
2674                            Box::pin(fut)
2675                        }
2676                    }
2677                    let accept_compression_encodings = self.accept_compression_encodings;
2678                    let send_compression_encodings = self.send_compression_encodings;
2679                    let max_decoding_message_size = self.max_decoding_message_size;
2680                    let max_encoding_message_size = self.max_encoding_message_size;
2681                    let inner = self.inner.clone();
2682                    let fut = async move {
2683                        let method = PrepareInteractionForVerificationSvc(inner);
2684                        let codec = tonic_prost::ProstCodec::default();
2685                        let mut grpc = tonic::server::Grpc::new(codec)
2686                            .apply_compression_config(
2687                                accept_compression_encodings,
2688                                send_compression_encodings,
2689                            )
2690                            .apply_max_message_size_config(
2691                                max_decoding_message_size,
2692                                max_encoding_message_size,
2693                            );
2694                        let res = grpc.unary(method, req).await;
2695                        Ok(res)
2696                    };
2697                    Box::pin(fut)
2698                }
2699                "/io.pact.plugin.v2.PactPlugin/VerifyInteraction" => {
2700                    #[allow(non_camel_case_types)]
2701                    struct VerifyInteractionSvc<T: PactPlugin>(pub Arc<T>);
2702                    impl<
2703                        T: PactPlugin,
2704                    > tonic::server::UnaryService<super::VerifyInteractionRequest>
2705                    for VerifyInteractionSvc<T> {
2706                        type Response = super::VerifyInteractionResponse;
2707                        type Future = BoxFuture<
2708                            tonic::Response<Self::Response>,
2709                            tonic::Status,
2710                        >;
2711                        fn call(
2712                            &mut self,
2713                            request: tonic::Request<super::VerifyInteractionRequest>,
2714                        ) -> Self::Future {
2715                            let inner = Arc::clone(&self.0);
2716                            let fut = async move {
2717                                <T as PactPlugin>::verify_interaction(&inner, request).await
2718                            };
2719                            Box::pin(fut)
2720                        }
2721                    }
2722                    let accept_compression_encodings = self.accept_compression_encodings;
2723                    let send_compression_encodings = self.send_compression_encodings;
2724                    let max_decoding_message_size = self.max_decoding_message_size;
2725                    let max_encoding_message_size = self.max_encoding_message_size;
2726                    let inner = self.inner.clone();
2727                    let fut = async move {
2728                        let method = VerifyInteractionSvc(inner);
2729                        let codec = tonic_prost::ProstCodec::default();
2730                        let mut grpc = tonic::server::Grpc::new(codec)
2731                            .apply_compression_config(
2732                                accept_compression_encodings,
2733                                send_compression_encodings,
2734                            )
2735                            .apply_max_message_size_config(
2736                                max_decoding_message_size,
2737                                max_encoding_message_size,
2738                            );
2739                        let res = grpc.unary(method, req).await;
2740                        Ok(res)
2741                    };
2742                    Box::pin(fut)
2743                }
2744                _ => {
2745                    Box::pin(async move {
2746                        let mut response = http::Response::new(
2747                            tonic::body::Body::default(),
2748                        );
2749                        let headers = response.headers_mut();
2750                        headers
2751                            .insert(
2752                                tonic::Status::GRPC_STATUS,
2753                                (tonic::Code::Unimplemented as i32).into(),
2754                            );
2755                        headers
2756                            .insert(
2757                                http::header::CONTENT_TYPE,
2758                                tonic::metadata::GRPC_CONTENT_TYPE,
2759                            );
2760                        Ok(response)
2761                    })
2762                }
2763            }
2764        }
2765    }
2766    impl<T> Clone for PactPluginServer<T> {
2767        fn clone(&self) -> Self {
2768            let inner = self.inner.clone();
2769            Self {
2770                inner,
2771                accept_compression_encodings: self.accept_compression_encodings,
2772                send_compression_encodings: self.send_compression_encodings,
2773                max_decoding_message_size: self.max_decoding_message_size,
2774                max_encoding_message_size: self.max_encoding_message_size,
2775            }
2776        }
2777    }
2778    /// Generated gRPC service name
2779    pub const SERVICE_NAME: &str = "io.pact.plugin.v2.PactPlugin";
2780    impl<T> tonic::server::NamedService for PactPluginServer<T> {
2781        const NAME: &'static str = SERVICE_NAME;
2782    }
2783}