1#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
9pub struct InitPluginRequest {
10 #[prost(string, tag = "1")]
12 pub implementation: ::prost::alloc::string::String,
13 #[prost(string, tag = "2")]
15 pub version: ::prost::alloc::string::String,
16 #[prost(string, repeated, tag = "3")]
18 pub host_capabilities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
19 #[prost(string, tag = "4")]
21 pub plugin_instance_id: ::prost::alloc::string::String,
22}
23#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct CatalogueEntry {
27 #[prost(enumeration = "catalogue_entry::EntryType", tag = "1")]
29 pub r#type: i32,
30 #[prost(string, tag = "2")]
32 pub key: ::prost::alloc::string::String,
33 #[prost(map = "string, string", tag = "3")]
36 pub values: ::std::collections::HashMap<
37 ::prost::alloc::string::String,
38 ::prost::alloc::string::String,
39 >,
40}
41pub 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 ContentMatcher = 0,
58 ContentGenerator = 1,
60 Transport = 2,
62 Matcher = 3,
64 Interaction = 4,
66 Generator = 5,
68 }
69 impl EntryType {
70 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 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#[derive(Clone, PartialEq, ::prost::Message)]
100pub struct InitPluginSuccess {
101 #[prost(message, repeated, tag = "1")]
103 pub catalogue: ::prost::alloc::vec::Vec<CatalogueEntry>,
104 #[prost(string, repeated, tag = "2")]
106 pub plugin_capabilities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
107}
108#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
110pub struct InitPluginFailure {
111 #[prost(string, tag = "1")]
113 pub error: ::prost::alloc::string::String,
114 #[prost(string, repeated, tag = "2")]
116 pub missing_host_capabilities: ::prost::alloc::vec::Vec<
117 ::prost::alloc::string::String,
118 >,
119}
120#[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}
126pub 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#[derive(Clone, PartialEq, ::prost::Message)]
138pub struct Catalogue {
139 #[prost(message, repeated, tag = "1")]
141 pub catalogue: ::prost::alloc::vec::Vec<CatalogueEntry>,
142}
143#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
145pub struct Body {
146 #[prost(string, tag = "1")]
148 pub content_type: ::prost::alloc::string::String,
149 #[prost(message, optional, tag = "2")]
151 pub content: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
152 #[prost(enumeration = "body::ContentTypeHint", tag = "3")]
155 pub content_type_hint: i32,
156}
157pub mod body {
159 #[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 Default = 0,
175 Text = 1,
177 Binary = 2,
179 }
180 impl ContentTypeHint {
181 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 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#[derive(Clone, PartialEq, ::prost::Message)]
205pub struct CompareContentsRequest {
206 #[prost(message, optional, tag = "1")]
208 pub expected: ::core::option::Option<Body>,
209 #[prost(message, optional, tag = "2")]
211 pub actual: ::core::option::Option<Body>,
212 #[prost(bool, tag = "3")]
215 pub allow_unexpected_keys: bool,
216 #[prost(map = "string, message", tag = "4")]
218 pub rules: ::std::collections::HashMap<
219 ::prost::alloc::string::String,
220 MatchingRules,
221 >,
222 #[prost(message, optional, tag = "5")]
224 pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
225 #[prost(message, optional, tag = "6")]
227 pub test_context: ::core::option::Option<::prost_types::Struct>,
228}
229#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
231pub struct ContentTypeMismatch {
232 #[prost(string, tag = "1")]
234 pub expected: ::prost::alloc::string::String,
235 #[prost(string, tag = "2")]
237 pub actual: ::prost::alloc::string::String,
238}
239#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
241pub struct ContentMismatch {
242 #[prost(message, optional, tag = "1")]
244 pub expected: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
245 #[prost(message, optional, tag = "2")]
247 pub actual: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
248 #[prost(string, tag = "3")]
250 pub mismatch: ::prost::alloc::string::String,
251 #[prost(string, tag = "4")]
253 pub path: ::prost::alloc::string::String,
254 #[prost(string, tag = "5")]
256 pub diff: ::prost::alloc::string::String,
257 #[prost(string, tag = "6")]
259 pub mismatch_type: ::prost::alloc::string::String,
260}
261#[derive(Clone, PartialEq, ::prost::Message)]
263pub struct ContentMismatches {
264 #[prost(message, repeated, tag = "1")]
265 pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
266}
267#[derive(Clone, PartialEq, ::prost::Message)]
269pub struct CompareContentsResponse {
270 #[prost(string, tag = "1")]
273 pub error: ::prost::alloc::string::String,
274 #[prost(message, optional, tag = "2")]
276 pub type_mismatch: ::core::option::Option<ContentTypeMismatch>,
277 #[prost(map = "string, message", tag = "3")]
279 pub results: ::std::collections::HashMap<
280 ::prost::alloc::string::String,
281 ContentMismatches,
282 >,
283}
284#[derive(Clone, PartialEq, ::prost::Message)]
286pub struct ConfigureInteractionRequest {
287 #[prost(string, tag = "1")]
289 pub content_type: ::prost::alloc::string::String,
290 #[prost(message, optional, tag = "2")]
292 pub contents_config: ::core::option::Option<::prost_types::Struct>,
293 #[prost(message, optional, tag = "3")]
295 pub test_context: ::core::option::Option<::prost_types::Struct>,
296}
297#[derive(Clone, PartialEq, ::prost::Message)]
299pub struct MatchingRule {
300 #[prost(string, tag = "1")]
302 pub r#type: ::prost::alloc::string::String,
303 #[prost(message, optional, tag = "2")]
305 pub values: ::core::option::Option<::prost_types::Struct>,
306}
307#[derive(Clone, PartialEq, ::prost::Message)]
309pub struct MatchingRules {
310 #[prost(message, repeated, tag = "1")]
311 pub rule: ::prost::alloc::vec::Vec<MatchingRule>,
312}
313#[derive(Clone, PartialEq, ::prost::Message)]
315pub struct Generator {
316 #[prost(string, tag = "1")]
318 pub r#type: ::prost::alloc::string::String,
319 #[prost(message, optional, tag = "2")]
321 pub values: ::core::option::Option<::prost_types::Struct>,
322}
323#[derive(Clone, PartialEq, ::prost::Message)]
325pub struct PluginConfiguration {
326 #[prost(message, optional, tag = "1")]
328 pub interaction_configuration: ::core::option::Option<::prost_types::Struct>,
329 #[prost(message, optional, tag = "2")]
331 pub pact_configuration: ::core::option::Option<::prost_types::Struct>,
332}
333#[derive(Clone, PartialEq, ::prost::Message)]
337pub struct InteractionContents {
338 #[prost(string, tag = "1")]
340 pub interaction_type: ::prost::alloc::string::String,
341 #[prost(message, optional, tag = "2")]
343 pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
344 #[prost(string, tag = "3")]
346 pub consumer: ::prost::alloc::string::String,
347 #[prost(string, tag = "4")]
349 pub provider: ::prost::alloc::string::String,
350}
351#[derive(Clone, PartialEq, ::prost::Message)]
353pub struct InteractionResponse {
354 #[prost(message, optional, tag = "1")]
356 pub contents: ::core::option::Option<Body>,
357 #[prost(map = "string, message", tag = "2")]
359 pub rules: ::std::collections::HashMap<
360 ::prost::alloc::string::String,
361 MatchingRules,
362 >,
363 #[prost(map = "string, message", tag = "3")]
365 pub generators: ::std::collections::HashMap<
366 ::prost::alloc::string::String,
367 Generator,
368 >,
369 #[prost(message, optional, tag = "4")]
371 pub message_metadata: ::core::option::Option<::prost_types::Struct>,
372 #[prost(message, optional, tag = "5")]
374 pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
375 #[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 #[prost(string, tag = "8")]
383 pub part_name: ::prost::alloc::string::String,
384 #[prost(map = "string, message", tag = "9")]
386 pub metadata_rules: ::std::collections::HashMap<
387 ::prost::alloc::string::String,
388 MatchingRules,
389 >,
390 #[prost(map = "string, message", tag = "10")]
392 pub metadata_generators: ::std::collections::HashMap<
393 ::prost::alloc::string::String,
394 Generator,
395 >,
396}
397pub mod interaction_response {
399 #[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 = 0,
415 Html = 1,
417 }
418 impl MarkupType {
419 pub fn as_str_name(&self) -> &'static str {
424 match self {
425 Self::CommonMark => "COMMON_MARK",
426 Self::Html => "HTML",
427 }
428 }
429 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#[derive(Clone, PartialEq, ::prost::Message)]
441pub struct ConfigureInteractionResponse {
442 #[prost(string, tag = "1")]
444 pub error: ::prost::alloc::string::String,
445 #[prost(message, repeated, tag = "2")]
447 pub interaction: ::prost::alloc::vec::Vec<InteractionResponse>,
448 #[prost(message, optional, tag = "3")]
450 pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
451}
452#[derive(Clone, PartialEq, ::prost::Message)]
454pub struct GenerateContentRequest {
455 #[prost(message, optional, tag = "1")]
457 pub contents: ::core::option::Option<Body>,
458 #[prost(map = "string, message", tag = "2")]
460 pub generators: ::std::collections::HashMap<
461 ::prost::alloc::string::String,
462 Generator,
463 >,
464 #[prost(message, optional, tag = "3")]
466 pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
467 #[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}
475pub mod generate_content_request {
477 #[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 Consumer = 1,
494 Provider = 2,
496 }
497 impl TestMode {
498 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 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 #[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 pub fn as_str_name(&self) -> &'static str {
542 match self {
543 Self::Request => "Request",
544 Self::Response => "Response",
545 }
546 }
547 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#[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#[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}
578pub mod field_value {
580 #[derive(Clone, PartialEq, ::prost::Oneof)]
581 pub enum Value {
582 #[prost(enumeration = "::prost_types::NullValue", tag = "1")]
584 NullValue(i32),
585 #[prost(bool, tag = "2")]
587 BooleanValue(bool),
588 #[prost(string, tag = "3")]
590 StringValue(::prost::alloc::string::String),
591 #[prost(int64, tag = "4")]
593 IntegerValue(i64),
594 #[prost(double, tag = "5")]
596 DecimalValue(f64),
597 #[prost(bytes, tag = "6")]
599 BinaryValue(::prost::alloc::vec::Vec<u8>),
600 #[prost(message, tag = "7")]
605 StructuredValue(::prost_types::Value),
606 }
607}
608#[derive(Clone, PartialEq, ::prost::Message)]
612pub struct MatchFieldRequest {
613 #[prost(string, tag = "1")]
615 pub key: ::prost::alloc::string::String,
616 #[prost(message, optional, tag = "2")]
618 pub rule: ::core::option::Option<MatchingRule>,
619 #[prost(string, tag = "3")]
621 pub path: ::prost::alloc::string::String,
622 #[prost(string, tag = "4")]
624 pub mismatch_type: ::prost::alloc::string::String,
625 #[prost(message, optional, tag = "5")]
627 pub expected: ::core::option::Option<FieldValue>,
628 #[prost(message, optional, tag = "6")]
630 pub actual: ::core::option::Option<FieldValue>,
631 #[prost(message, optional, tag = "7")]
633 pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
634 #[prost(message, optional, tag = "8")]
636 pub test_context: ::core::option::Option<::prost_types::Struct>,
637}
638#[derive(Clone, PartialEq, ::prost::Message)]
640pub struct MatchFieldResponse {
641 #[prost(string, tag = "1")]
644 pub error: ::prost::alloc::string::String,
645 #[prost(message, repeated, tag = "2")]
648 pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
649}
650#[derive(Clone, PartialEq, ::prost::Message)]
654pub struct GenerateFieldRequest {
655 #[prost(string, tag = "1")]
657 pub key: ::prost::alloc::string::String,
658 #[prost(message, optional, tag = "2")]
660 pub generator: ::core::option::Option<Generator>,
661 #[prost(string, tag = "3")]
663 pub path: ::prost::alloc::string::String,
664 #[prost(message, optional, tag = "4")]
666 pub example_value: ::core::option::Option<FieldValue>,
667 #[prost(message, optional, tag = "5")]
669 pub plugin_configuration: ::core::option::Option<PluginConfiguration>,
670 #[prost(message, optional, tag = "6")]
672 pub test_context: ::core::option::Option<::prost_types::Struct>,
673 #[prost(enumeration = "generate_content_request::TestMode", tag = "7")]
675 pub test_mode: i32,
676}
677#[derive(Clone, PartialEq, ::prost::Message)]
679pub struct GenerateFieldResponse {
680 #[prost(string, tag = "1")]
683 pub error: ::prost::alloc::string::String,
684 #[prost(message, optional, tag = "2")]
686 pub value: ::core::option::Option<FieldValue>,
687}
688#[derive(Clone, PartialEq, ::prost::Message)]
690pub struct StartMockServerRequest {
691 #[prost(string, tag = "1")]
693 pub host_interface: ::prost::alloc::string::String,
694 #[prost(uint32, tag = "2")]
696 pub port: u32,
697 #[prost(bool, tag = "3")]
699 pub tls: bool,
700 #[prost(message, repeated, tag = "4")]
702 pub interactions: ::prost::alloc::vec::Vec<InteractionContents>,
703 #[prost(message, optional, tag = "5")]
705 pub test_context: ::core::option::Option<::prost_types::Struct>,
706}
707#[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}
713pub mod start_mock_server_response {
715 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
716 pub enum Response {
717 #[prost(string, tag = "1")]
719 Error(::prost::alloc::string::String),
720 #[prost(message, tag = "2")]
722 Details(super::MockServerDetails),
723 }
724}
725#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
727pub struct MockServerDetails {
728 #[prost(string, tag = "1")]
730 pub key: ::prost::alloc::string::String,
731 #[prost(uint32, tag = "2")]
733 pub port: u32,
734 #[prost(string, tag = "3")]
736 pub address: ::prost::alloc::string::String,
737}
738#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
740pub struct MockServerRequest {
741 #[prost(string, tag = "1")]
743 pub server_key: ::prost::alloc::string::String,
744}
745#[derive(Clone, PartialEq, ::prost::Message)]
747pub struct MockServerResult {
748 #[prost(string, tag = "1")]
750 pub path: ::prost::alloc::string::String,
751 #[prost(string, tag = "2")]
753 pub error: ::prost::alloc::string::String,
754 #[prost(message, repeated, tag = "3")]
756 pub mismatches: ::prost::alloc::vec::Vec<ContentMismatch>,
757}
758#[derive(Clone, PartialEq, ::prost::Message)]
760pub struct MockServerResults {
761 #[prost(bool, tag = "1")]
763 pub ok: bool,
764 #[prost(message, repeated, tag = "2")]
766 pub results: ::prost::alloc::vec::Vec<MockServerResult>,
767}
768#[derive(Clone, PartialEq, ::prost::Message)]
770pub struct VerificationPreparationRequest {
771 #[prost(message, optional, tag = "1")]
773 pub interaction_contents: ::core::option::Option<InteractionContents>,
774 #[prost(message, optional, tag = "2")]
776 pub config: ::core::option::Option<::prost_types::Struct>,
777 #[prost(message, optional, tag = "3")]
779 pub test_context: ::core::option::Option<::prost_types::Struct>,
780}
781#[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}
787pub 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#[derive(Clone, PartialEq, ::prost::Message)]
799pub struct InteractionData {
800 #[prost(message, optional, tag = "1")]
802 pub body: ::core::option::Option<Body>,
803 #[prost(map = "string, message", tag = "2")]
805 pub metadata: ::std::collections::HashMap<
806 ::prost::alloc::string::String,
807 MetadataValue,
808 >,
809}
810#[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}
816pub mod verification_preparation_response {
818 #[derive(Clone, PartialEq, ::prost::Oneof)]
819 pub enum Response {
820 #[prost(string, tag = "1")]
822 Error(::prost::alloc::string::String),
823 #[prost(message, tag = "2")]
825 InteractionData(super::InteractionData),
826 }
827}
828#[derive(Clone, PartialEq, ::prost::Message)]
830pub struct VerifyInteractionRequest {
831 #[prost(message, optional, tag = "1")]
833 pub interaction_data: ::core::option::Option<InteractionData>,
834 #[prost(message, optional, tag = "2")]
836 pub config: ::core::option::Option<::prost_types::Struct>,
837 #[prost(message, optional, tag = "3")]
839 pub interaction_contents: ::core::option::Option<InteractionContents>,
840 #[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}
849pub 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#[derive(Clone, PartialEq, ::prost::Message)]
861pub struct VerificationResult {
862 #[prost(bool, tag = "1")]
864 pub success: bool,
865 #[prost(message, optional, tag = "2")]
867 pub response_data: ::core::option::Option<InteractionData>,
868 #[prost(message, repeated, tag = "3")]
870 pub mismatches: ::prost::alloc::vec::Vec<VerificationResultItem>,
871 #[prost(string, repeated, tag = "4")]
873 pub output: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
874}
875#[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}
881pub mod verify_interaction_response {
883 #[derive(Clone, PartialEq, ::prost::Oneof)]
884 pub enum Response {
885 #[prost(string, tag = "1")]
887 Error(::prost::alloc::string::String),
888 #[prost(message, tag = "2")]
889 Result(super::VerificationResult),
890 }
891}
892#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
894pub struct LogMessage {
895 #[prost(string, tag = "1")]
897 pub plugin_instance_id: ::prost::alloc::string::String,
898 #[prost(string, tag = "2")]
900 pub test_run_id: ::prost::alloc::string::String,
901 #[prost(string, tag = "3")]
903 pub level: ::prost::alloc::string::String,
904 #[prost(string, tag = "4")]
906 pub message: ::prost::alloc::string::String,
907 #[prost(string, tag = "5")]
909 pub target: ::prost::alloc::string::String,
910 #[prost(int64, tag = "6")]
912 pub timestamp_ms: i64,
913}
914#[derive(Clone, PartialEq, ::prost::Message)]
918pub struct HostCompareContentsRequest {
919 #[prost(string, tag = "1")]
921 pub entry_key: ::prost::alloc::string::String,
922 #[prost(message, optional, tag = "2")]
924 pub request: ::core::option::Option<CompareContentsRequest>,
925}
926#[derive(Clone, PartialEq, ::prost::Message)]
930pub struct HostGenerateContentRequest {
931 #[prost(string, tag = "1")]
933 pub entry_key: ::prost::alloc::string::String,
934 #[prost(message, optional, tag = "2")]
936 pub request: ::core::option::Option<GenerateContentRequest>,
937}
938#[derive(Clone, PartialEq, ::prost::Message)]
942pub struct HostMatchFieldRequest {
943 #[prost(string, tag = "1")]
947 pub entry_key: ::prost::alloc::string::String,
948 #[prost(message, optional, tag = "2")]
950 pub request: ::core::option::Option<MatchFieldRequest>,
951}
952#[derive(Clone, PartialEq, ::prost::Message)]
955pub struct HostGenerateFieldRequest {
956 #[prost(string, tag = "1")]
959 pub entry_key: ::prost::alloc::string::String,
960 #[prost(message, optional, tag = "2")]
962 pub request: ::core::option::Option<GenerateFieldRequest>,
963}
964pub 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 #[derive(Debug, Clone)]
977 pub struct PluginHostClient<T> {
978 inner: tonic::client::Grpc<T>,
979 }
980 impl PluginHostClient<tonic::transport::Channel> {
981 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 #[must_use]
1030 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1031 self.inner = self.inner.send_compressed(encoding);
1032 self
1033 }
1034 #[must_use]
1036 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1037 self.inner = self.inner.accept_compressed(encoding);
1038 self
1039 }
1040 #[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 #[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 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 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 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 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 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}
1191pub 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 #[async_trait]
1203 pub trait PluginHost: std::marker::Send + std::marker::Sync + 'static {
1204 async fn log(
1206 &self,
1207 request: tonic::Request<super::LogMessage>,
1208 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
1209 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 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 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 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 #[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 #[must_use]
1280 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1281 self.accept_compression_encodings.enable(encoding);
1282 self
1283 }
1284 #[must_use]
1286 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1287 self.send_compression_encodings.enable(encoding);
1288 self
1289 }
1290 #[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 #[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 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}
1587pub 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 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 #[must_use]
1652 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1653 self.inner = self.inner.send_compressed(encoding);
1654 self
1655 }
1656 #[must_use]
1658 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1659 self.inner = self.inner.accept_compressed(encoding);
1660 self
1661 }
1662 #[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 #[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 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 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 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 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 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 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 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 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 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 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 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 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}
2009pub 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 #[async_trait]
2021 pub trait PactPlugin: std::marker::Send + std::marker::Sync + 'static {
2022 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 async fn update_catalogue(
2032 &self,
2033 request: tonic::Request<super::Catalogue>,
2034 ) -> std::result::Result<tonic::Response<()>, tonic::Status>;
2035 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 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 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 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 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 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 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 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 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 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 #[must_use]
2151 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
2152 self.accept_compression_encodings.enable(encoding);
2153 self
2154 }
2155 #[must_use]
2157 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
2158 self.send_compression_encodings.enable(encoding);
2159 self
2160 }
2161 #[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 #[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 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}