@pact-foundation/pact-core 13.4.1-beta.14 → 13.4.1-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/bin/pact-broker.d.ts +2 -0
  2. package/bin/pact-broker.js +10 -0
  3. package/bin/pact-broker.js.map +1 -0
  4. package/bin/pact-message.d.ts +2 -0
  5. package/bin/pact-message.js +10 -0
  6. package/bin/pact-message.js.map +1 -0
  7. package/bin/pact-mock-service.d.ts +2 -0
  8. package/bin/pact-mock-service.js +8 -0
  9. package/bin/pact-mock-service.js.map +1 -0
  10. package/bin/pact-provider-verifier.d.ts +2 -0
  11. package/bin/pact-provider-verifier.js +10 -0
  12. package/bin/pact-provider-verifier.js.map +1 -0
  13. package/bin/pact-stub-service.d.ts +2 -0
  14. package/bin/pact-stub-service.js +10 -0
  15. package/bin/pact-stub-service.js.map +1 -0
  16. package/bin/pact.d.ts +2 -0
  17. package/bin/pact.js +10 -0
  18. package/bin/pact.js.map +1 -0
  19. package/build/Makefile +2 -2
  20. package/build/pact.target.mk +14 -14
  21. package/ffi/libpact_ffi.dylib +0 -0
  22. package/{native/pact.h → ffi/pact-cpp.h} +0 -0
  23. package/ffi/pact.h +171 -177
  24. package/native/consumer.cc +1 -1
  25. package/native/ffi.cc +1 -1
  26. package/{src/ffi/pact.h → native/pact-cpp.h} +57 -12
  27. package/native/plugin.cc +1 -1
  28. package/native/provider.cc +1 -10
  29. package/package.json +2 -2
  30. package/src/can-deploy.d.ts +49 -0
  31. package/src/can-deploy.js +148 -0
  32. package/src/can-deploy.js.map +1 -0
  33. package/src/consumer/__testoutput__/foo-consumer-bar-provider.json +2 -2
  34. package/src/consumer/checkErrors.d.ts +7 -0
  35. package/src/consumer/checkErrors.js +41 -0
  36. package/src/consumer/checkErrors.js.map +1 -0
  37. package/src/consumer/index.d.ts +4 -0
  38. package/src/consumer/index.js +145 -0
  39. package/src/consumer/index.js.map +1 -0
  40. package/src/consumer/types.d.ts +109 -0
  41. package/src/consumer/types.js +3 -0
  42. package/src/consumer/types.js.map +1 -0
  43. package/src/ffi/index.d.ts +7 -0
  44. package/src/ffi/index.js +32 -0
  45. package/src/ffi/index.js.map +1 -0
  46. package/src/ffi/internals/index.d.ts +2 -0
  47. package/src/ffi/internals/index.js +41 -0
  48. package/src/ffi/internals/index.js.map +1 -0
  49. package/src/ffi/types.d.ts +81 -0
  50. package/src/ffi/types.js +50 -0
  51. package/src/ffi/types.js.map +1 -0
  52. package/src/index.d.ts +11 -0
  53. package/src/index.js +25 -0
  54. package/src/index.js.map +1 -0
  55. package/src/logger/crashMessage.d.ts +1 -0
  56. package/src/logger/crashMessage.js +6 -0
  57. package/src/logger/crashMessage.js.map +1 -0
  58. package/src/logger/index.d.ts +16 -0
  59. package/src/logger/index.js +63 -0
  60. package/src/logger/index.js.map +1 -0
  61. package/src/logger/pino.d.ts +3 -0
  62. package/src/logger/pino.js +14 -0
  63. package/src/logger/pino.js.map +1 -0
  64. package/src/logger/types.d.ts +9 -0
  65. package/src/logger/types.js +3 -0
  66. package/src/logger/types.js.map +1 -0
  67. package/src/message.d.ts +16 -0
  68. package/src/message.js +96 -0
  69. package/src/message.js.map +1 -0
  70. package/src/pact-environment.d.ts +6 -0
  71. package/src/pact-environment.js +23 -0
  72. package/src/pact-environment.js.map +1 -0
  73. package/src/pact-standalone.d.ts +18 -0
  74. package/src/pact-standalone.js +44 -0
  75. package/src/pact-standalone.js.map +1 -0
  76. package/src/pact.d.ts +27 -0
  77. package/src/pact.js +120 -0
  78. package/src/pact.js.map +1 -0
  79. package/src/publisher.d.ts +20 -0
  80. package/src/publisher.js +99 -0
  81. package/src/publisher.js.map +1 -0
  82. package/src/server.d.ts +25 -0
  83. package/src/server.js +96 -0
  84. package/src/server.js.map +1 -0
  85. package/src/service.d.ts +46 -0
  86. package/src/service.js +252 -0
  87. package/src/service.js.map +1 -0
  88. package/src/spawn/arguments.d.ts +20 -0
  89. package/src/spawn/arguments.js +48 -0
  90. package/src/spawn/arguments.js.map +1 -0
  91. package/src/spawn/index.d.ts +2 -0
  92. package/src/spawn/index.js +17 -0
  93. package/src/spawn/index.js.map +1 -0
  94. package/src/spawn/spawn.d.ts +12 -0
  95. package/src/spawn/spawn.js +78 -0
  96. package/src/spawn/spawn.js.map +1 -0
  97. package/src/stub.d.ts +20 -0
  98. package/src/stub.js +51 -0
  99. package/src/stub.js.map +1 -0
  100. package/src/verifier/argumentMapper/arguments.d.ts +5 -0
  101. package/src/verifier/argumentMapper/arguments.js +103 -0
  102. package/src/verifier/argumentMapper/arguments.js.map +1 -0
  103. package/src/verifier/argumentMapper/index.d.ts +1 -0
  104. package/src/verifier/argumentMapper/index.js +63 -0
  105. package/src/verifier/argumentMapper/index.js.map +1 -0
  106. package/src/verifier/argumentMapper/types.d.ts +1 -0
  107. package/src/verifier/argumentMapper/types.js +3 -0
  108. package/src/verifier/argumentMapper/types.js.map +1 -0
  109. package/src/verifier/filesystem/index.d.ts +2 -0
  110. package/src/verifier/filesystem/index.js +24 -0
  111. package/src/verifier/filesystem/index.js.map +1 -0
  112. package/src/verifier/filesystem/types.d.ts +1 -0
  113. package/src/verifier/filesystem/types.js +3 -0
  114. package/src/verifier/filesystem/types.js.map +1 -0
  115. package/src/verifier/index.d.ts +8 -0
  116. package/src/verifier/index.js +31 -0
  117. package/src/verifier/index.js.map +1 -0
  118. package/src/verifier/nativeVerifier.d.ts +2 -0
  119. package/src/verifier/nativeVerifier.js +111 -0
  120. package/src/verifier/nativeVerifier.js.map +1 -0
  121. package/src/verifier/types.d.ts +54 -0
  122. package/src/verifier/types.js +3 -0
  123. package/src/verifier/types.js.map +1 -0
  124. package/src/verifier/validateOptions.d.ts +2 -0
  125. package/src/verifier/validateOptions.js +132 -0
  126. package/src/verifier/validateOptions.js.map +1 -0
  127. package/standalone/install.d.ts +32 -0
  128. package/standalone/install.js +96 -0
  129. package/standalone/install.js.map +1 -0
  130. package/test.js +1 -1
  131. package/ffi/libpact_ffi.dylib.gz +0 -0
  132. package/ffi/libpact_ffi.so.gz +0 -0
  133. package/ffi/osxaarch64/libpact_ffi.dylib.gz +0 -0
  134. package/ffi/pact_ffi.dll.gz +0 -0
  135. package/ffi/pact_ffi.dll.lib.gz +0 -0
  136. package/native/provider.cc.bak +0 -749
package/ffi/pact.h CHANGED
@@ -11,16 +11,15 @@
11
11
 
12
12
  /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */
13
13
 
14
- #include <cstdarg>
15
- #include <cstdint>
16
- #include <cstdlib>
17
- #include <ostream>
18
- #include <new>
14
+ #include <stdarg.h>
15
+ #include <stdbool.h>
16
+ #include <stdint.h>
17
+ #include <stdlib.h>
19
18
 
20
19
  /**
21
20
  * Request or Response enum
22
21
  */
23
- enum class InteractionPart {
22
+ typedef enum InteractionPart {
24
23
  /**
25
24
  * Request part
26
25
  */
@@ -29,7 +28,7 @@ enum class InteractionPart {
29
28
  * Response part
30
29
  */
31
30
  InteractionPart_Response,
32
- };
31
+ } InteractionPart;
33
32
 
34
33
  /**
35
34
  * An enum representing the log level to use.
@@ -37,19 +36,19 @@ enum class InteractionPart {
37
36
  * This enum is passed to `log_attach_sink`, which defines where to direct
38
37
  * log output at the specified level or lower.
39
38
  */
40
- enum class LevelFilter {
39
+ typedef enum LevelFilter {
41
40
  LevelFilter_Off,
42
41
  LevelFilter_Error,
43
42
  LevelFilter_Warn,
44
43
  LevelFilter_Info,
45
44
  LevelFilter_Debug,
46
45
  LevelFilter_Trace,
47
- };
46
+ } LevelFilter;
48
47
 
49
48
  /**
50
49
  * Enum defining the pact specification versions supported by the library
51
50
  */
52
- enum class PactSpecification {
51
+ typedef enum PactSpecification {
53
52
  /**
54
53
  * Unknown or unsupported specification version
55
54
  */
@@ -74,17 +73,17 @@ enum class PactSpecification {
74
73
  * Version four of the pact specification (<https://github.com/pact-foundation/pact-specification/tree/version-4>)
75
74
  */
76
75
  PactSpecification_V4,
77
- };
76
+ } PactSpecification;
78
77
 
79
78
  /**
80
79
  * Struct that defines the consumer of the pact.
81
80
  */
82
- struct Consumer;
81
+ typedef struct Consumer Consumer;
83
82
 
84
83
  /**
85
84
  * Struct that defines a message.
86
85
  */
87
- struct Message;
86
+ typedef struct Message Message;
88
87
 
89
88
  /**
90
89
  * An iterator that enables FFI iteration over metadata by putting all the keys on the heap
@@ -92,19 +91,19 @@ struct Message;
92
91
  *
93
92
  * This assumes no mutation of the underlying metadata happens while the iterator is live.
94
93
  */
95
- struct MessageMetadataIterator;
94
+ typedef struct MessageMetadataIterator MessageMetadataIterator;
96
95
 
97
96
  /**
98
97
  * Struct that represents a pact between the consumer and provider of a service.
99
98
  * It contains a list of Messages instead of Interactions, but is otherwise
100
99
  * identical to `struct Pact`.
101
100
  */
102
- struct MessagePact;
101
+ typedef struct MessagePact MessagePact;
103
102
 
104
103
  /**
105
104
  * An iterator over messages in a message pact.
106
105
  */
107
- struct MessagePactMessageIterator;
106
+ typedef struct MessagePactMessageIterator MessagePactMessageIterator;
108
107
 
109
108
  /**
110
109
  * An iterator that enables FFI iteration over metadata by putting all the keys on the heap
@@ -112,47 +111,47 @@ struct MessagePactMessageIterator;
112
111
  *
113
112
  * This assumes no mutation of the underlying metadata happens while the iterator is live.
114
113
  */
115
- struct MessagePactMetadataIterator;
114
+ typedef struct MessagePactMetadataIterator MessagePactMetadataIterator;
116
115
 
117
116
  /**
118
117
  * Enum that defines the different types of mismatches that can occur.
119
118
  */
120
- struct Mismatch;
119
+ typedef struct Mismatch Mismatch;
121
120
 
122
121
  /**
123
122
  * A collection of mismatches from a matching comparison.
124
123
  */
125
- struct Mismatches;
124
+ typedef struct Mismatches Mismatches;
126
125
 
127
126
  /**
128
127
  * An iterator over mismatches.
129
128
  */
130
- struct MismatchesIterator;
129
+ typedef struct MismatchesIterator MismatchesIterator;
131
130
 
132
131
  /**
133
132
  * An iterator over messages in a pact.
134
133
  */
135
- struct PactMessageIterator;
134
+ typedef struct PactMessageIterator PactMessageIterator;
136
135
 
137
136
  /**
138
137
  * An iterator over synchronous request/response messages in a pact.
139
138
  */
140
- struct PactSyncMessageIterator;
139
+ typedef struct PactSyncMessageIterator PactSyncMessageIterator;
141
140
 
142
141
  /**
143
142
  * Struct that defines a provider of a pact.
144
143
  */
145
- struct Provider;
144
+ typedef struct Provider Provider;
146
145
 
147
146
  /**
148
147
  * Struct that encapsulates all the info about a provider state
149
148
  */
150
- struct ProviderState;
149
+ typedef struct ProviderState ProviderState;
151
150
 
152
151
  /**
153
152
  * Iterator over individual provider states.
154
153
  */
155
- struct ProviderStateIterator;
154
+ typedef struct ProviderStateIterator ProviderStateIterator;
156
155
 
157
156
  /**
158
157
  * An iterator that enables FFI iteration over provider state params by putting all the keys on the heap
@@ -160,22 +159,22 @@ struct ProviderStateIterator;
160
159
  *
161
160
  * This assumes no mutation of the underlying provider state happens while the iterator is live.
162
161
  */
163
- struct ProviderStateParamIterator;
162
+ typedef struct ProviderStateParamIterator ProviderStateParamIterator;
164
163
 
165
164
  /**
166
165
  * Synchronous interactions as a request message to a sequence of response messages
167
166
  */
168
- struct SynchronousMessage;
167
+ typedef struct SynchronousMessage SynchronousMessage;
169
168
 
170
169
  /**
171
170
  * Wraps a Pact verifier
172
171
  */
173
- struct VerifierHandle;
172
+ typedef struct VerifierHandle VerifierHandle;
174
173
 
175
174
  /**
176
175
  * A single key-value pair exported to the C-side.
177
176
  */
178
- struct MessageMetadataPair {
177
+ typedef struct MessageMetadataPair {
179
178
  /**
180
179
  * The metadata key.
181
180
  */
@@ -184,12 +183,12 @@ struct MessageMetadataPair {
184
183
  * The metadata value.
185
184
  */
186
185
  const char *value;
187
- };
186
+ } MessageMetadataPair;
188
187
 
189
188
  /**
190
189
  * A triple, containing the outer key, inner key, and value, exported to the C-side.
191
190
  */
192
- struct MessagePactMetadataTriple {
191
+ typedef struct MessagePactMetadataTriple {
193
192
  /**
194
193
  * The outer key of the `MessagePact` metadata.
195
194
  */
@@ -202,12 +201,12 @@ struct MessagePactMetadataTriple {
202
201
  * The value of the `MessagePact` metadata.
203
202
  */
204
203
  const char *value;
205
- };
204
+ } MessagePactMetadataTriple;
206
205
 
207
206
  /**
208
207
  * A single key-value pair exported to the C-side.
209
208
  */
210
- struct ProviderStateParamPair {
209
+ typedef struct ProviderStateParamPair {
211
210
  /**
212
211
  * The key of the `ProviderState` parameter.
213
212
  */
@@ -216,64 +215,58 @@ struct ProviderStateParamPair {
216
215
  * The value of the `ProviderState` parameter.
217
216
  */
218
217
  const char *value;
219
- };
218
+ } ProviderStateParamPair;
220
219
 
221
220
  /**
222
221
  * Wraps a Pact model struct
223
222
  */
224
- using PactHandle = uint16_t;
223
+ typedef uint16_t PactHandle;
225
224
 
226
225
  /**
227
226
  * Result of wrapping a string value
228
227
  */
229
- struct StringResult {
230
- enum class Tag {
231
- /**
232
- * Was generated OK
233
- */
234
- StringResult_Ok,
235
- /**
236
- * There was an error generating the string
237
- */
238
- StringResult_Failed,
239
- };
240
-
241
- struct StringResult_Ok_Body {
242
- char *_0;
243
- };
244
-
245
- struct StringResult_Failed_Body {
246
- char *_0;
247
- };
228
+ typedef enum StringResult_Tag {
229
+ /**
230
+ * Was generated OK
231
+ */
232
+ StringResult_Ok,
233
+ /**
234
+ * There was an error generating the string
235
+ */
236
+ StringResult_Failed,
237
+ } StringResult_Tag;
248
238
 
249
- Tag tag;
239
+ typedef struct StringResult {
240
+ StringResult_Tag tag;
250
241
  union {
251
- StringResult_Ok_Body ok;
252
- StringResult_Failed_Body failed;
242
+ struct {
243
+ char *ok;
244
+ };
245
+ struct {
246
+ char *failed;
247
+ };
253
248
  };
254
- };
249
+ } StringResult;
255
250
 
256
251
  /**
257
252
  * Wraps a Pact model struct
258
253
  */
259
- using InteractionHandle = uint32_t;
254
+ typedef uint32_t InteractionHandle;
260
255
 
261
256
  /**
262
257
  * Wraps a Pact model struct
263
258
  */
264
- using MessagePactHandle = uint16_t;
259
+ typedef uint16_t MessagePactHandle;
265
260
 
266
261
  /**
267
262
  * Wraps a Pact model struct
268
263
  */
269
- using MessageHandle = uint32_t;
270
-
271
- extern "C" {
264
+ typedef uint32_t MessageHandle;
272
265
 
273
266
  /**
274
267
  * Get the current library version
275
268
  */
276
- const char *pactffi_version();
269
+ const char *pactffi_version(void);
277
270
 
278
271
  /**
279
272
  * Initialise the mock server library, can provide an environment variable name to use to
@@ -301,7 +294,7 @@ void pactffi_init_with_log_level(const char *level);
301
294
  *
302
295
  * This function is safe.
303
296
  */
304
- void pactffi_enable_ansi_support();
297
+ void pactffi_enable_ansi_support(void);
305
298
 
306
299
  /**
307
300
  * Log using the shared core logging facility.
@@ -322,54 +315,55 @@ void pactffi_log_message(const char *source, const char *log_level, const char *
322
315
  * Match a pair of messages, producing a collection of mismatches,
323
316
  * which is empty if the two messages matched.
324
317
  */
325
- const Mismatches *pactffi_match_message(const Message *msg_1, const Message *msg_2);
318
+ const struct Mismatches *pactffi_match_message(const struct Message *msg_1,
319
+ const struct Message *msg_2);
326
320
 
327
321
  /**
328
322
  * Get an iterator over mismatches.
329
323
  */
330
- MismatchesIterator *pactffi_mismatches_get_iter(const Mismatches *mismatches);
324
+ struct MismatchesIterator *pactffi_mismatches_get_iter(const struct Mismatches *mismatches);
331
325
 
332
326
  /**
333
327
  * Delete mismatches
334
328
  */
335
- void pactffi_mismatches_delete(const Mismatches *mismatches);
329
+ void pactffi_mismatches_delete(const struct Mismatches *mismatches);
336
330
 
337
331
  /**
338
332
  * Get the next mismatch from a mismatches iterator.
339
333
  *
340
334
  * Returns a null pointer if no mismatches remain.
341
335
  */
342
- const Mismatch *pactffi_mismatches_iter_next(MismatchesIterator *iter);
336
+ const struct Mismatch *pactffi_mismatches_iter_next(struct MismatchesIterator *iter);
343
337
 
344
338
  /**
345
339
  * Delete a mismatches iterator when you're done with it.
346
340
  */
347
- void pactffi_mismatches_iter_delete(MismatchesIterator *iter);
341
+ void pactffi_mismatches_iter_delete(struct MismatchesIterator *iter);
348
342
 
349
343
  /**
350
344
  * Get a JSON representation of the mismatch.
351
345
  */
352
- const char *pactffi_mismatch_to_json(const Mismatch *mismatch);
346
+ const char *pactffi_mismatch_to_json(const struct Mismatch *mismatch);
353
347
 
354
348
  /**
355
349
  * Get the type of a mismatch.
356
350
  */
357
- const char *pactffi_mismatch_type(const Mismatch *mismatch);
351
+ const char *pactffi_mismatch_type(const struct Mismatch *mismatch);
358
352
 
359
353
  /**
360
354
  * Get a summary of a mismatch.
361
355
  */
362
- const char *pactffi_mismatch_summary(const Mismatch *mismatch);
356
+ const char *pactffi_mismatch_summary(const struct Mismatch *mismatch);
363
357
 
364
358
  /**
365
359
  * Get a description of a mismatch.
366
360
  */
367
- const char *pactffi_mismatch_description(const Mismatch *mismatch);
361
+ const char *pactffi_mismatch_description(const struct Mismatch *mismatch);
368
362
 
369
363
  /**
370
364
  * Get an ANSI-compatible description of a mismatch.
371
365
  */
372
- const char *pactffi_mismatch_ansi_description(const Mismatch *mismatch);
366
+ const char *pactffi_mismatch_ansi_description(const struct Mismatch *mismatch);
373
367
 
374
368
  /**
375
369
  * Provide the error message from `LAST_ERROR` to the calling C code.
@@ -414,12 +408,12 @@ int pactffi_get_error_message(char *buffer,
414
408
  /**
415
409
  * Convenience function to direct all logging to stdout.
416
410
  */
417
- int pactffi_log_to_stdout(LevelFilter level_filter);
411
+ int pactffi_log_to_stdout(enum LevelFilter level_filter);
418
412
 
419
413
  /**
420
414
  * Convenience function to direct all logging to stderr.
421
415
  */
422
- int pactffi_log_to_stderr(LevelFilter level_filter);
416
+ int pactffi_log_to_stderr(enum LevelFilter level_filter);
423
417
 
424
418
  /**
425
419
  * Convenience function to direct all logging to a file.
@@ -428,12 +422,12 @@ int pactffi_log_to_stderr(LevelFilter level_filter);
428
422
  * This function will fail if the file_name pointer is invalid or does not point to a NULL
429
423
  * terminated string.
430
424
  */
431
- int pactffi_log_to_file(const char *file_name, LevelFilter level_filter);
425
+ int pactffi_log_to_file(const char *file_name, enum LevelFilter level_filter);
432
426
 
433
427
  /**
434
428
  * Convenience function to direct all logging to a task local memory buffer.
435
429
  */
436
- int pactffi_log_to_buffer(LevelFilter level_filter);
430
+ int pactffi_log_to_buffer(enum LevelFilter level_filter);
437
431
 
438
432
  /**
439
433
  * Initialize the thread-local logger with no sinks.
@@ -450,7 +444,7 @@ int pactffi_log_to_buffer(LevelFilter level_filter);
450
444
  *
451
445
  * This function is always safe to call.
452
446
  */
453
- void pactffi_logger_init();
447
+ void pactffi_logger_init(void);
454
448
 
455
449
  /**
456
450
  * Attach an additional sink to the thread-local logger.
@@ -487,14 +481,14 @@ void pactffi_logger_init();
487
481
  * out if the specifier isn't valid UTF-8.
488
482
  */
489
483
  int pactffi_logger_attach_sink(const char *sink_specifier,
490
- LevelFilter level_filter);
484
+ enum LevelFilter level_filter);
491
485
 
492
486
  /**
493
487
  * Apply the thread-local logger to the program.
494
488
  *
495
489
  * Any attempts to modify the logger after the call to `logger_apply` will fail.
496
490
  */
497
- int pactffi_logger_apply();
491
+ int pactffi_logger_apply(void);
498
492
 
499
493
  /**
500
494
  * Fetch the in-memory logger buffer contents. This will only have any contents if the `buffer`
@@ -550,7 +544,7 @@ const char *pactffi_fetch_log_buffer(const char *log_id);
550
544
  * or the Rust string contains an embedded NULL byte.
551
545
  * In the case of error, a NULL pointer will be returned.
552
546
  */
553
- const char *pactffi_consumer_get_name(const Consumer *consumer);
547
+ const char *pactffi_consumer_get_name(const struct Consumer *consumer);
554
548
 
555
549
  /**
556
550
  * Get a mutable pointer to a newly-created default message on the heap.
@@ -563,7 +557,7 @@ const char *pactffi_consumer_get_name(const Consumer *consumer);
563
557
  *
564
558
  * Returns NULL on error.
565
559
  */
566
- Message *pactffi_message_new();
560
+ struct Message *pactffi_message_new(void);
567
561
 
568
562
  /**
569
563
  * Constructs a `Message` from the JSON string
@@ -576,9 +570,9 @@ Message *pactffi_message_new();
576
570
  *
577
571
  * If the JSON string is invalid or not UTF-8 encoded, returns a NULL.
578
572
  */
579
- Message *pactffi_message_new_from_json(unsigned int index,
580
- const char *json_str,
581
- PactSpecification spec_version);
573
+ struct Message *pactffi_message_new_from_json(unsigned int index,
574
+ const char *json_str,
575
+ enum PactSpecification spec_version);
582
576
 
583
577
  /**
584
578
  * Constructs a `Message` from a body with a given content-type.
@@ -591,12 +585,12 @@ Message *pactffi_message_new_from_json(unsigned int index,
591
585
  *
592
586
  * If the body or content type are invalid or not UTF-8 encoded, returns NULL.
593
587
  */
594
- Message *pactffi_message_new_from_body(const char *body, const char *content_type);
588
+ struct Message *pactffi_message_new_from_body(const char *body, const char *content_type);
595
589
 
596
590
  /**
597
591
  * Destroy the `Message` being pointed to.
598
592
  */
599
- void pactffi_message_delete(Message *message);
593
+ void pactffi_message_delete(struct Message *message);
600
594
 
601
595
  /**
602
596
  * Get the contents of a `Message` in string form.
@@ -614,7 +608,7 @@ void pactffi_message_delete(Message *message);
614
608
  * no mechanism to differentiate with this function call alone between
615
609
  * a NULL message and a missing message body.
616
610
  */
617
- const char *pactffi_message_get_contents(const Message *message);
611
+ const char *pactffi_message_get_contents(const struct Message *message);
618
612
 
619
613
  /**
620
614
  * Get the length of the contents of a `Message`.
@@ -628,7 +622,7 @@ const char *pactffi_message_get_contents(const Message *message);
628
622
  * If the message is NULL, returns 0. If the body of the message
629
623
  * is missing, then this function also returns 0.
630
624
  */
631
- size_t pactffi_message_get_contents_length(const Message *message);
625
+ size_t pactffi_message_get_contents_length(const struct Message *message);
632
626
 
633
627
  /**
634
628
  * Get the contents of a `Message` as a pointer to an array of bytes.
@@ -644,7 +638,7 @@ size_t pactffi_message_get_contents_length(const Message *message);
644
638
  * If the message is NULL, returns NULL. If the body of the message
645
639
  * is missing, then this function also returns NULL.
646
640
  */
647
- const unsigned char *pactffi_message_get_contents_bin(const Message *message);
641
+ const unsigned char *pactffi_message_get_contents_bin(const struct Message *message);
648
642
 
649
643
  /**
650
644
  * Get a copy of the description.
@@ -663,7 +657,7 @@ const unsigned char *pactffi_message_get_contents_bin(const Message *message);
663
657
  * This function may fail if the Rust string contains embedded
664
658
  * null ('\0') bytes.
665
659
  */
666
- const char *pactffi_message_get_description(const Message *message);
660
+ const char *pactffi_message_get_description(const struct Message *message);
667
661
 
668
662
  /**
669
663
  * Write the `description` field on the `Message`.
@@ -680,7 +674,7 @@ const char *pactffi_message_get_description(const Message *message);
680
674
  *
681
675
  * Errors will be reported with a non-zero return value.
682
676
  */
683
- int pactffi_message_set_description(Message *message, const char *description);
677
+ int pactffi_message_set_description(struct Message *message, const char *description);
684
678
 
685
679
  /**
686
680
  * Get a copy of the provider state at the given index from this message.
@@ -699,7 +693,8 @@ int pactffi_message_set_description(Message *message, const char *description);
699
693
  * This function may fail if the index requested is out of bounds,
700
694
  * or if any of the Rust strings contain embedded null ('\0') bytes.
701
695
  */
702
- const ProviderState *pactffi_message_get_provider_state(const Message *message, unsigned int index);
696
+ const struct ProviderState *pactffi_message_get_provider_state(const struct Message *message,
697
+ unsigned int index);
703
698
 
704
699
  /**
705
700
  * Get an iterator over provider states.
@@ -712,7 +707,7 @@ const ProviderState *pactffi_message_get_provider_state(const Message *message,
712
707
  *
713
708
  * Returns NULL if an error occurs.
714
709
  */
715
- ProviderStateIterator *pactffi_message_get_provider_state_iter(Message *message);
710
+ struct ProviderStateIterator *pactffi_message_get_provider_state_iter(struct Message *message);
716
711
 
717
712
  /**
718
713
  * Get the next value from the iterator.
@@ -728,12 +723,12 @@ ProviderStateIterator *pactffi_message_get_provider_state_iter(Message *message)
728
723
  *
729
724
  * Returns NULL if an error occurs.
730
725
  */
731
- ProviderState *pactffi_provider_state_iter_next(ProviderStateIterator *iter);
726
+ struct ProviderState *pactffi_provider_state_iter_next(struct ProviderStateIterator *iter);
732
727
 
733
728
  /**
734
729
  * Delete the iterator.
735
730
  */
736
- void pactffi_provider_state_iter_delete(ProviderStateIterator *iter);
731
+ void pactffi_provider_state_iter_delete(struct ProviderStateIterator *iter);
737
732
 
738
733
  /**
739
734
  * Get a copy of the metadata value indexed by `key`.
@@ -756,7 +751,7 @@ void pactffi_provider_state_iter_delete(ProviderStateIterator *iter);
756
751
  * invalid UTF-8, or if the Rust string contains embedded null ('\0')
757
752
  * bytes.
758
753
  */
759
- const char *pactffi_message_find_metadata(const Message *message, const char *key);
754
+ const char *pactffi_message_find_metadata(const struct Message *message, const char *key);
760
755
 
761
756
  /**
762
757
  * Insert the (`key`, `value`) pair into this Message's
@@ -772,7 +767,7 @@ const char *pactffi_message_find_metadata(const Message *message, const char *ke
772
767
  * This function may fail if the provided `key` or `value` strings
773
768
  * contain invalid UTF-8.
774
769
  */
775
- int pactffi_message_insert_metadata(Message *message, const char *key, const char *value);
770
+ int pactffi_message_insert_metadata(struct Message *message, const char *key, const char *value);
776
771
 
777
772
  /**
778
773
  * Get an iterator over the metadata of a message.
@@ -792,7 +787,7 @@ int pactffi_message_insert_metadata(Message *message, const char *key, const cha
792
787
  * This function may fail if any of the Rust strings contain
793
788
  * embedded null ('\0') bytes.
794
789
  */
795
- MessageMetadataIterator *pactffi_message_get_metadata_iter(Message *message);
790
+ struct MessageMetadataIterator *pactffi_message_get_metadata_iter(struct Message *message);
796
791
 
797
792
  /**
798
793
  * Get the next key and value out of the iterator, if possible
@@ -805,17 +800,17 @@ MessageMetadataIterator *pactffi_message_get_metadata_iter(Message *message);
805
800
  *
806
801
  * If no further data is present, returns NULL.
807
802
  */
808
- MessageMetadataPair *pactffi_message_metadata_iter_next(MessageMetadataIterator *iter);
803
+ struct MessageMetadataPair *pactffi_message_metadata_iter_next(struct MessageMetadataIterator *iter);
809
804
 
810
805
  /**
811
806
  * Free the metadata iterator when you're done using it.
812
807
  */
813
- void pactffi_message_metadata_iter_delete(MessageMetadataIterator *iter);
808
+ void pactffi_message_metadata_iter_delete(struct MessageMetadataIterator *iter);
814
809
 
815
810
  /**
816
811
  * Free a pair of key and value returned from `message_metadata_iter_next`.
817
812
  */
818
- void pactffi_message_metadata_pair_delete(MessageMetadataPair *pair);
813
+ void pactffi_message_metadata_pair_delete(struct MessageMetadataPair *pair);
819
814
 
820
815
  /**
821
816
  * Construct a new `MessagePact` from the JSON string.
@@ -830,12 +825,12 @@ void pactffi_message_metadata_pair_delete(MessageMetadataPair *pair);
830
825
  *
831
826
  * On error, this function will return a null pointer.
832
827
  */
833
- MessagePact *pactffi_message_pact_new_from_json(const char *file_name, const char *json_str);
828
+ struct MessagePact *pactffi_message_pact_new_from_json(const char *file_name, const char *json_str);
834
829
 
835
830
  /**
836
831
  * Delete the `MessagePact` being pointed to.
837
832
  */
838
- void pactffi_message_pact_delete(MessagePact *message_pact);
833
+ void pactffi_message_pact_delete(struct MessagePact *message_pact);
839
834
 
840
835
  /**
841
836
  * Get a pointer to the Consumer struct inside the MessagePact.
@@ -851,7 +846,7 @@ void pactffi_message_pact_delete(MessagePact *message_pact);
851
846
  * This function will only fail if it is passed a NULL pointer.
852
847
  * In the case of error, a NULL pointer will be returned.
853
848
  */
854
- Consumer *pactffi_message_pact_get_consumer(MessagePact *message_pact);
849
+ struct Consumer *pactffi_message_pact_get_consumer(struct MessagePact *message_pact);
855
850
 
856
851
  /**
857
852
  * Get a pointer to the Provider struct inside the MessagePact.
@@ -867,7 +862,7 @@ Consumer *pactffi_message_pact_get_consumer(MessagePact *message_pact);
867
862
  * This function will only fail if it is passed a NULL pointer.
868
863
  * In the case of error, a NULL pointer will be returned.
869
864
  */
870
- Provider *pactffi_message_pact_get_provider(MessagePact *message_pact);
865
+ struct Provider *pactffi_message_pact_get_provider(struct MessagePact *message_pact);
871
866
 
872
867
  /**
873
868
  * Get an iterator over the messages of a message pact.
@@ -887,7 +882,7 @@ Provider *pactffi_message_pact_get_provider(MessagePact *message_pact);
887
882
  * This function may fail if any of the Rust strings contain embedded
888
883
  * null ('\0') bytes.
889
884
  */
890
- MessagePactMessageIterator *pactffi_message_pact_get_message_iter(MessagePact *message_pact);
885
+ struct MessagePactMessageIterator *pactffi_message_pact_get_message_iter(struct MessagePact *message_pact);
891
886
 
892
887
  /**
893
888
  * Get the next message from the message pact.
@@ -900,12 +895,12 @@ MessagePactMessageIterator *pactffi_message_pact_get_message_iter(MessagePact *m
900
895
  *
901
896
  * This function will return a NULL pointer if passed a NULL pointer or if an error occurs.
902
897
  */
903
- Message *pactffi_message_pact_message_iter_next(MessagePactMessageIterator *iter);
898
+ struct Message *pactffi_message_pact_message_iter_next(struct MessagePactMessageIterator *iter);
904
899
 
905
900
  /**
906
901
  * Delete the iterator.
907
902
  */
908
- void pactffi_message_pact_message_iter_delete(MessagePactMessageIterator *iter);
903
+ void pactffi_message_pact_message_iter_delete(struct MessagePactMessageIterator *iter);
909
904
 
910
905
  /**
911
906
  * Get a copy of the metadata value indexed by `key1` and `key2`.
@@ -928,7 +923,7 @@ void pactffi_message_pact_message_iter_delete(MessagePactMessageIterator *iter);
928
923
  * invalid UTF-8, or if the Rust string contains embedded null ('\0')
929
924
  * bytes.
930
925
  */
931
- const char *pactffi_message_pact_find_metadata(const MessagePact *message_pact,
926
+ const char *pactffi_message_pact_find_metadata(const struct MessagePact *message_pact,
932
927
  const char *key1,
933
928
  const char *key2);
934
929
 
@@ -950,7 +945,7 @@ const char *pactffi_message_pact_find_metadata(const MessagePact *message_pact,
950
945
  * This function may fail if any of the Rust strings contain
951
946
  * embedded null ('\0') bytes.
952
947
  */
953
- MessagePactMetadataIterator *pactffi_message_pact_get_metadata_iter(MessagePact *message_pact);
948
+ struct MessagePactMetadataIterator *pactffi_message_pact_get_metadata_iter(struct MessagePact *message_pact);
954
949
 
955
950
  /**
956
951
  * Get the next triple out of the iterator, if possible
@@ -963,17 +958,17 @@ MessagePactMetadataIterator *pactffi_message_pact_get_metadata_iter(MessagePact
963
958
  *
964
959
  * Returns null if no next element is present.
965
960
  */
966
- MessagePactMetadataTriple *pactffi_message_pact_metadata_iter_next(MessagePactMetadataIterator *iter);
961
+ struct MessagePactMetadataTriple *pactffi_message_pact_metadata_iter_next(struct MessagePactMetadataIterator *iter);
967
962
 
968
963
  /**
969
964
  * Free the metadata iterator when you're done using it.
970
965
  */
971
- void pactffi_message_pact_metadata_iter_delete(MessagePactMetadataIterator *iter);
966
+ void pactffi_message_pact_metadata_iter_delete(struct MessagePactMetadataIterator *iter);
972
967
 
973
968
  /**
974
969
  * Free a triple returned from `pactffi_message_pact_metadata_iter_next`.
975
970
  */
976
- void pactffi_message_pact_metadata_triple_delete(MessagePactMetadataTriple *triple);
971
+ void pactffi_message_pact_metadata_triple_delete(struct MessagePactMetadataTriple *triple);
977
972
 
978
973
  /**
979
974
  * Get a copy of this provider's name.
@@ -1011,7 +1006,7 @@ void pactffi_message_pact_metadata_triple_delete(MessagePactMetadataTriple *trip
1011
1006
  * or the Rust string contains an embedded NULL byte.
1012
1007
  * In the case of error, a NULL pointer will be returned.
1013
1008
  */
1014
- const char *pactffi_provider_get_name(const Provider *provider);
1009
+ const char *pactffi_provider_get_name(const struct Provider *provider);
1015
1010
 
1016
1011
  /**
1017
1012
  * Get the name of the provider state as a string, which needs to be deleted with `pactffi_string_delete`.
@@ -1024,7 +1019,7 @@ const char *pactffi_provider_get_name(const Provider *provider);
1024
1019
  *
1025
1020
  * If the provider_state param is NULL, this returns NULL.
1026
1021
  */
1027
- const char *pactffi_provider_state_get_name(const ProviderState *provider_state);
1022
+ const char *pactffi_provider_state_get_name(const struct ProviderState *provider_state);
1028
1023
 
1029
1024
  /**
1030
1025
  * Get an iterator over the params of a provider state.
@@ -1044,7 +1039,7 @@ const char *pactffi_provider_state_get_name(const ProviderState *provider_state)
1044
1039
  * This function may fail if any of the Rust strings contain
1045
1040
  * embedded null ('\0') bytes.
1046
1041
  */
1047
- ProviderStateParamIterator *pactffi_provider_state_get_param_iter(ProviderState *provider_state);
1042
+ struct ProviderStateParamIterator *pactffi_provider_state_get_param_iter(struct ProviderState *provider_state);
1048
1043
 
1049
1044
  /**
1050
1045
  * Get the next key and value out of the iterator, if possible
@@ -1062,27 +1057,27 @@ ProviderStateParamIterator *pactffi_provider_state_get_param_iter(ProviderState
1062
1057
  *
1063
1058
  * Returns NULL if there's no further elements or the iterator is NULL.
1064
1059
  */
1065
- ProviderStateParamPair *pactffi_provider_state_param_iter_next(ProviderStateParamIterator *iter);
1060
+ struct ProviderStateParamPair *pactffi_provider_state_param_iter_next(struct ProviderStateParamIterator *iter);
1066
1061
 
1067
1062
  /**
1068
1063
  * Free the provider state when you're done using it.
1069
1064
  */
1070
- void pactffi_provider_state_delete(ProviderState *provider_state);
1065
+ void pactffi_provider_state_delete(struct ProviderState *provider_state);
1071
1066
 
1072
1067
  /**
1073
1068
  * Free the provider state param iterator when you're done using it.
1074
1069
  */
1075
- void pactffi_provider_state_param_iter_delete(ProviderStateParamIterator *iter);
1070
+ void pactffi_provider_state_param_iter_delete(struct ProviderStateParamIterator *iter);
1076
1071
 
1077
1072
  /**
1078
1073
  * Free a pair of key and value returned from `pactffi_provider_state_param_iter_next`.
1079
1074
  */
1080
- void pactffi_provider_state_param_pair_delete(ProviderStateParamPair *pair);
1075
+ void pactffi_provider_state_param_pair_delete(struct ProviderStateParamPair *pair);
1081
1076
 
1082
1077
  /**
1083
1078
  * Free the iterator when you're done using it.
1084
1079
  */
1085
- void pactffi_pact_message_iter_delete(PactMessageIterator *iter);
1080
+ void pactffi_pact_message_iter_delete(struct PactMessageIterator *iter);
1086
1081
 
1087
1082
  /**
1088
1083
  * Get the next message from the message pact. As the messages returned are owned by the
@@ -1099,7 +1094,7 @@ void pactffi_pact_message_iter_delete(PactMessageIterator *iter);
1099
1094
  *
1100
1095
  * This function will return a NULL pointer if passed a NULL pointer or if an error occurs.
1101
1096
  */
1102
- Message *pactffi_pact_message_iter_next(PactMessageIterator *iter);
1097
+ struct Message *pactffi_pact_message_iter_next(struct PactMessageIterator *iter);
1103
1098
 
1104
1099
  /**
1105
1100
  * Get the next synchronous request/response message from the pact. As the messages returned are owned by the
@@ -1116,17 +1111,17 @@ Message *pactffi_pact_message_iter_next(PactMessageIterator *iter);
1116
1111
  *
1117
1112
  * This function will return a NULL pointer if passed a NULL pointer or if an error occurs.
1118
1113
  */
1119
- SynchronousMessage *pactffi_pact_sync_message_iter_next(PactSyncMessageIterator *iter);
1114
+ struct SynchronousMessage *pactffi_pact_sync_message_iter_next(struct PactSyncMessageIterator *iter);
1120
1115
 
1121
1116
  /**
1122
1117
  * Free the iterator when you're done using it.
1123
1118
  */
1124
- void pactffi_pact_sync_message_iter_delete(PactSyncMessageIterator *iter);
1119
+ void pactffi_pact_sync_message_iter_delete(struct PactSyncMessageIterator *iter);
1125
1120
 
1126
1121
  /**
1127
1122
  * Destroy the `Message` being pointed to.
1128
1123
  */
1129
- void pactffi_sync_message_delete(SynchronousMessage *message);
1124
+ void pactffi_sync_message_delete(struct SynchronousMessage *message);
1130
1125
 
1131
1126
  /**
1132
1127
  * Get the request contents of a `SynchronousMessage` in string form.
@@ -1144,7 +1139,7 @@ void pactffi_sync_message_delete(SynchronousMessage *message);
1144
1139
  * no mechanism to differentiate with this function call alone between
1145
1140
  * a NULL message and a missing message body.
1146
1141
  */
1147
- const char *pactffi_sync_message_get_request_contents(const SynchronousMessage *message);
1142
+ const char *pactffi_sync_message_get_request_contents(const struct SynchronousMessage *message);
1148
1143
 
1149
1144
  /**
1150
1145
  * Get the length of the request contents of a `SynchronousMessage`.
@@ -1158,7 +1153,7 @@ const char *pactffi_sync_message_get_request_contents(const SynchronousMessage *
1158
1153
  * If the message is NULL, returns 0. If the body of the request
1159
1154
  * is missing, then this function also returns 0.
1160
1155
  */
1161
- size_t pactffi_sync_message_get_request_contents_length(const SynchronousMessage *message);
1156
+ size_t pactffi_sync_message_get_request_contents_length(const struct SynchronousMessage *message);
1162
1157
 
1163
1158
  /**
1164
1159
  * Get the request contents of a `SynchronousMessage` as a pointer to an array of bytes.
@@ -1174,7 +1169,7 @@ size_t pactffi_sync_message_get_request_contents_length(const SynchronousMessage
1174
1169
  * If the message is NULL, returns NULL. If the body of the message
1175
1170
  * is missing, then this function also returns NULL.
1176
1171
  */
1177
- const unsigned char *pactffi_sync_message_get_request_contents_bin(const SynchronousMessage *message);
1172
+ const unsigned char *pactffi_sync_message_get_request_contents_bin(const struct SynchronousMessage *message);
1178
1173
 
1179
1174
  /**
1180
1175
  * Get the number of response messages in the `SynchronousMessage`.
@@ -1187,7 +1182,7 @@ const unsigned char *pactffi_sync_message_get_request_contents_bin(const Synchro
1187
1182
  *
1188
1183
  * If the message is NULL, returns 0.
1189
1184
  */
1190
- size_t pactffi_sync_message_get_number_responses(const SynchronousMessage *message);
1185
+ size_t pactffi_sync_message_get_number_responses(const struct SynchronousMessage *message);
1191
1186
 
1192
1187
  /**
1193
1188
  * Get the response contents of a `SynchronousMessage` in string form.
@@ -1206,7 +1201,7 @@ size_t pactffi_sync_message_get_number_responses(const SynchronousMessage *messa
1206
1201
  * This means there's no mechanism to differentiate with this function call alone between
1207
1202
  * a NULL message and a missing message body.
1208
1203
  */
1209
- const char *pactffi_sync_message_get_response_contents(const SynchronousMessage *message,
1204
+ const char *pactffi_sync_message_get_response_contents(const struct SynchronousMessage *message,
1210
1205
  size_t index);
1211
1206
 
1212
1207
  /**
@@ -1221,7 +1216,7 @@ const char *pactffi_sync_message_get_response_contents(const SynchronousMessage
1221
1216
  * If the message is NULL or the index is not valid, returns 0. If the body of the request
1222
1217
  * is missing, then this function also returns 0.
1223
1218
  */
1224
- size_t pactffi_sync_message_get_response_contents_length(const SynchronousMessage *message,
1219
+ size_t pactffi_sync_message_get_response_contents_length(const struct SynchronousMessage *message,
1225
1220
  size_t index);
1226
1221
 
1227
1222
  /**
@@ -1238,7 +1233,7 @@ size_t pactffi_sync_message_get_response_contents_length(const SynchronousMessag
1238
1233
  * If the message is NULL or the index is not valid, returns NULL. If the body of the message
1239
1234
  * is missing, then this function also returns NULL.
1240
1235
  */
1241
- const unsigned char *pactffi_sync_message_get_response_contents_bin(const SynchronousMessage *message,
1236
+ const unsigned char *pactffi_sync_message_get_response_contents_bin(const struct SynchronousMessage *message,
1242
1237
  size_t index);
1243
1238
 
1244
1239
  /**
@@ -1258,7 +1253,7 @@ const unsigned char *pactffi_sync_message_get_response_contents_bin(const Synchr
1258
1253
  * This function may fail if the Rust string contains embedded
1259
1254
  * null ('\0') bytes.
1260
1255
  */
1261
- const char *pactffi_sync_message_get_description(const SynchronousMessage *message);
1256
+ const char *pactffi_sync_message_get_description(const struct SynchronousMessage *message);
1262
1257
 
1263
1258
  /**
1264
1259
  * Write the `description` field on the `SynchronousMessage`.
@@ -1275,7 +1270,8 @@ const char *pactffi_sync_message_get_description(const SynchronousMessage *messa
1275
1270
  *
1276
1271
  * Errors will be reported with a non-zero return value.
1277
1272
  */
1278
- int pactffi_sync_message_set_description(SynchronousMessage *message, const char *description);
1273
+ int pactffi_sync_message_set_description(struct SynchronousMessage *message,
1274
+ const char *description);
1279
1275
 
1280
1276
  /**
1281
1277
  * Get a copy of the provider state at the given index from this message.
@@ -1294,8 +1290,8 @@ int pactffi_sync_message_set_description(SynchronousMessage *message, const char
1294
1290
  * This function may fail if the index requested is out of bounds,
1295
1291
  * or if any of the Rust strings contain embedded null ('\0') bytes.
1296
1292
  */
1297
- const ProviderState *pactffi_sync_message_get_provider_state(const SynchronousMessage *message,
1298
- unsigned int index);
1293
+ const struct ProviderState *pactffi_sync_message_get_provider_state(const struct SynchronousMessage *message,
1294
+ unsigned int index);
1299
1295
 
1300
1296
  /**
1301
1297
  * Get an iterator over provider states.
@@ -1308,7 +1304,7 @@ const ProviderState *pactffi_sync_message_get_provider_state(const SynchronousMe
1308
1304
  *
1309
1305
  * Returns NULL if an error occurs.
1310
1306
  */
1311
- ProviderStateIterator *pactffi_sync_message_get_provider_state_iter(SynchronousMessage *message);
1307
+ struct ProviderStateIterator *pactffi_sync_message_get_provider_state_iter(struct SynchronousMessage *message);
1312
1308
 
1313
1309
  /**
1314
1310
  * Delete a string previously returned by this FFI.
@@ -1355,7 +1351,7 @@ int32_t pactffi_create_mock_server(const char *pact_str,
1355
1351
  *
1356
1352
  * An empty string indicates an error reading the pem file
1357
1353
  */
1358
- char *pactffi_get_tls_ca_certificate();
1354
+ char *pactffi_get_tls_ca_certificate(void);
1359
1355
 
1360
1356
  /**
1361
1357
  * External interface to create a mock server. A Pact handle is passed in,
@@ -1455,7 +1451,7 @@ const char *pactffi_mock_server_logs(int32_t mock_server_port);
1455
1451
  *
1456
1452
  * Exported functions are inherently unsafe.
1457
1453
  */
1458
- StringResult pactffi_generate_datetime_string(const char *format);
1454
+ struct StringResult pactffi_generate_datetime_string(const char *format);
1459
1455
 
1460
1456
  /**
1461
1457
  * Checks that the example string matches the given regex
@@ -1474,7 +1470,7 @@ bool pactffi_check_regex(const char *regex, const char *example);
1474
1470
  *
1475
1471
  * Exported functions are inherently unsafe.
1476
1472
  */
1477
- StringResult pactffi_generate_regex_value(const char *regex);
1473
+ struct StringResult pactffi_generate_regex_value(const char *regex);
1478
1474
 
1479
1475
  /**
1480
1476
  * [DEPRECATED] Frees the memory allocated to a string by another function
@@ -1602,7 +1598,7 @@ bool pactffi_with_query_parameter(InteractionHandle interaction,
1602
1598
  * * `version` - the spec version to use
1603
1599
  */
1604
1600
  bool pactffi_with_specification(PactHandle pact,
1605
- PactSpecification version);
1601
+ enum PactSpecification version);
1606
1602
 
1607
1603
  /**
1608
1604
  * Sets the additional metadata on the Pact file. Common uses are to add the client library details such as the name and version
@@ -1628,7 +1624,7 @@ bool pactffi_with_pact_metadata(PactHandle pact,
1628
1624
  * * `index` - the index of the value (starts at 0). You can use this to create a header with multiple values
1629
1625
  */
1630
1626
  bool pactffi_with_header(InteractionHandle interaction,
1631
- InteractionPart part,
1627
+ enum InteractionPart part,
1632
1628
  const char *name,
1633
1629
  size_t index,
1634
1630
  const char *value);
@@ -1651,7 +1647,7 @@ bool pactffi_response_status(InteractionHandle interaction, unsigned short statu
1651
1647
  * * `body` - The body contents. For JSON payloads, matching rules can be embedded in the body.
1652
1648
  */
1653
1649
  bool pactffi_with_body(InteractionHandle interaction,
1654
- InteractionPart part,
1650
+ enum InteractionPart part,
1655
1651
  const char *content_type,
1656
1652
  const char *body);
1657
1653
 
@@ -1667,7 +1663,7 @@ bool pactffi_with_body(InteractionHandle interaction,
1667
1663
  * * `size` - number of bytes in the body
1668
1664
  */
1669
1665
  bool pactffi_with_binary_file(InteractionHandle interaction,
1670
- InteractionPart part,
1666
+ enum InteractionPart part,
1671
1667
  const char *content_type,
1672
1668
  const uint8_t *body,
1673
1669
  size_t size);
@@ -1683,11 +1679,11 @@ bool pactffi_with_binary_file(InteractionHandle interaction,
1683
1679
  * * `file` - path to the example file
1684
1680
  * * `part_name` - name for the mime part
1685
1681
  */
1686
- StringResult pactffi_with_multipart_file(InteractionHandle interaction,
1687
- InteractionPart part,
1688
- const char *content_type,
1689
- const char *file,
1690
- const char *part_name);
1682
+ struct StringResult pactffi_with_multipart_file(InteractionHandle interaction,
1683
+ enum InteractionPart part,
1684
+ const char *content_type,
1685
+ const char *file,
1686
+ const char *part_name);
1691
1687
 
1692
1688
  /**
1693
1689
  * Get an iterator over all the messages of the Pact. The returned iterator needs to be
@@ -1704,7 +1700,7 @@ StringResult pactffi_with_multipart_file(InteractionHandle interaction,
1704
1700
  * This function may fail if any of the Rust strings contain embedded
1705
1701
  * null ('\0') bytes.
1706
1702
  */
1707
- PactMessageIterator *pactffi_pact_handle_get_message_iter(PactHandle pact);
1703
+ struct PactMessageIterator *pactffi_pact_handle_get_message_iter(PactHandle pact);
1708
1704
 
1709
1705
  /**
1710
1706
  * Get an iterator over all the synchronous request/response messages of the Pact.
@@ -1721,7 +1717,7 @@ PactMessageIterator *pactffi_pact_handle_get_message_iter(PactHandle pact);
1721
1717
  * This function may fail if any of the Rust strings contain embedded
1722
1718
  * null ('\0') bytes.
1723
1719
  */
1724
- PactSyncMessageIterator *pactffi_pact_handle_get_sync_message_iter(PactHandle pact);
1720
+ struct PactSyncMessageIterator *pactffi_pact_handle_get_sync_message_iter(PactHandle pact);
1725
1721
 
1726
1722
  /**
1727
1723
  * Creates a new Pact Message model and returns a handle to it.
@@ -1941,7 +1937,7 @@ int32_t pactffi_verify(const char *args);
1941
1937
  *
1942
1938
  * Returns NULL on error.
1943
1939
  */
1944
- VerifierHandle *pactffi_verifier_new();
1940
+ struct VerifierHandle *pactffi_verifier_new(void);
1945
1941
 
1946
1942
  /**
1947
1943
  * Get a Handle to a newly created verifier. You should call `pactffi_verifier_shutdown` when
@@ -1955,12 +1951,12 @@ VerifierHandle *pactffi_verifier_new();
1955
1951
  *
1956
1952
  * Returns NULL on error.
1957
1953
  */
1958
- VerifierHandle *pactffi_verifier_new_for_application(const char *name, const char *version);
1954
+ struct VerifierHandle *pactffi_verifier_new_for_application(const char *name, const char *version);
1959
1955
 
1960
1956
  /**
1961
1957
  * Shutdown the verifier and release all resources
1962
1958
  */
1963
- void pactffi_verifier_shutdown(VerifierHandle *handle);
1959
+ void pactffi_verifier_shutdown(struct VerifierHandle *handle);
1964
1960
 
1965
1961
  /**
1966
1962
  * Set the provider details for the Pact verifier. Passing a NULL for any field will
@@ -1972,7 +1968,7 @@ void pactffi_verifier_shutdown(VerifierHandle *handle);
1972
1968
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
1973
1969
  *
1974
1970
  */
1975
- void pactffi_verifier_set_provider_info(VerifierHandle *handle,
1971
+ void pactffi_verifier_set_provider_info(struct VerifierHandle *handle,
1976
1972
  const char *name,
1977
1973
  const char *scheme,
1978
1974
  const char *host,
@@ -1992,7 +1988,7 @@ void pactffi_verifier_set_provider_info(VerifierHandle *handle,
1992
1988
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
1993
1989
  *
1994
1990
  */
1995
- void pactffi_verifier_set_filter_info(VerifierHandle *handle,
1991
+ void pactffi_verifier_set_filter_info(struct VerifierHandle *handle,
1996
1992
  const char *filter_description,
1997
1993
  const char *filter_state,
1998
1994
  unsigned char filter_no_state);
@@ -2009,7 +2005,7 @@ void pactffi_verifier_set_filter_info(VerifierHandle *handle,
2009
2005
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2010
2006
  *
2011
2007
  */
2012
- void pactffi_verifier_set_provider_state(VerifierHandle *handle,
2008
+ void pactffi_verifier_set_provider_state(struct VerifierHandle *handle,
2013
2009
  const char *url,
2014
2010
  unsigned char teardown,
2015
2011
  unsigned char body);
@@ -2025,7 +2021,7 @@ void pactffi_verifier_set_provider_state(VerifierHandle *handle,
2025
2021
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2026
2022
  *
2027
2023
  */
2028
- int pactffi_verifier_set_verification_options(VerifierHandle *handle,
2024
+ int pactffi_verifier_set_verification_options(struct VerifierHandle *handle,
2029
2025
  unsigned char disable_ssl_verification,
2030
2026
  unsigned long request_timeout);
2031
2027
 
@@ -2047,7 +2043,7 @@ int pactffi_verifier_set_verification_options(VerifierHandle *handle,
2047
2043
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2048
2044
  *
2049
2045
  */
2050
- int pactffi_verifier_set_publish_options(VerifierHandle *handle,
2046
+ int pactffi_verifier_set_publish_options(struct VerifierHandle *handle,
2051
2047
  const char *provider_version,
2052
2048
  const char *build_url,
2053
2049
  const char *const *provider_tags,
@@ -2063,7 +2059,7 @@ int pactffi_verifier_set_publish_options(VerifierHandle *handle,
2063
2059
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2064
2060
  *
2065
2061
  */
2066
- void pactffi_verifier_set_consumer_filters(VerifierHandle *handle,
2062
+ void pactffi_verifier_set_consumer_filters(struct VerifierHandle *handle,
2067
2063
  const char *const *consumer_filters,
2068
2064
  unsigned short consumer_filters_len);
2069
2065
 
@@ -2076,7 +2072,7 @@ void pactffi_verifier_set_consumer_filters(VerifierHandle *handle,
2076
2072
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2077
2073
  *
2078
2074
  */
2079
- void pactffi_verifier_add_file_source(VerifierHandle *handle, const char *file);
2075
+ void pactffi_verifier_add_file_source(struct VerifierHandle *handle, const char *file);
2080
2076
 
2081
2077
  /**
2082
2078
  * Adds a Pact directory as a source to verify. All pacts from the directory that match the
@@ -2088,7 +2084,7 @@ void pactffi_verifier_add_file_source(VerifierHandle *handle, const char *file);
2088
2084
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2089
2085
  *
2090
2086
  */
2091
- void pactffi_verifier_add_directory_source(VerifierHandle *handle, const char *directory);
2087
+ void pactffi_verifier_add_directory_source(struct VerifierHandle *handle, const char *directory);
2092
2088
 
2093
2089
  /**
2094
2090
  * Adds a URL as a source to verify. The Pact file will be fetched from the URL.
@@ -2102,7 +2098,7 @@ void pactffi_verifier_add_directory_source(VerifierHandle *handle, const char *d
2102
2098
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2103
2099
  *
2104
2100
  */
2105
- void pactffi_verifier_url_source(VerifierHandle *handle,
2101
+ void pactffi_verifier_url_source(struct VerifierHandle *handle,
2106
2102
  const char *url,
2107
2103
  const char *username,
2108
2104
  const char *password,
@@ -2121,7 +2117,7 @@ void pactffi_verifier_url_source(VerifierHandle *handle,
2121
2117
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2122
2118
  *
2123
2119
  */
2124
- void pactffi_verifier_broker_source(VerifierHandle *handle,
2120
+ void pactffi_verifier_broker_source(struct VerifierHandle *handle,
2125
2121
  const char *url,
2126
2122
  const char *username,
2127
2123
  const char *password,
@@ -2148,7 +2144,7 @@ void pactffi_verifier_broker_source(VerifierHandle *handle,
2148
2144
  * will be replaced with U+FFFD REPLACEMENT CHARACTER.
2149
2145
  *
2150
2146
  */
2151
- void pactffi_verifier_broker_source_with_selectors(VerifierHandle *handle,
2147
+ void pactffi_verifier_broker_source_with_selectors(struct VerifierHandle *handle,
2152
2148
  const char *url,
2153
2149
  const char *username,
2154
2150
  const char *password,
@@ -2170,7 +2166,7 @@ void pactffi_verifier_broker_source_with_selectors(VerifierHandle *handle,
2170
2166
  *
2171
2167
  * Errors will be reported with a non-zero return value.
2172
2168
  */
2173
- int pactffi_verifier_execute(VerifierHandle *handle);
2169
+ int pactffi_verifier_execute(struct VerifierHandle *handle);
2174
2170
 
2175
2171
  /**
2176
2172
  * External interface to retrieve the options and arguments available when calling the CLI interface,
@@ -2221,7 +2217,7 @@ int pactffi_verifier_execute(VerifierHandle *handle);
2221
2217
  *
2222
2218
  * Exported functions are inherently unsafe.
2223
2219
  */
2224
- const char *pactffi_verifier_cli_args();
2220
+ const char *pactffi_verifier_cli_args(void);
2225
2221
 
2226
2222
  /**
2227
2223
  * Extracts the logs for the verification run. This needs the memory buffer log sink to be
@@ -2230,7 +2226,7 @@ const char *pactffi_verifier_cli_args();
2230
2226
  *
2231
2227
  * Will return a NULL pointer if the logs for the verification can not be retrieved.
2232
2228
  */
2233
- const char *pactffi_verifier_logs(const VerifierHandle *handle);
2229
+ const char *pactffi_verifier_logs(const struct VerifierHandle *handle);
2234
2230
 
2235
2231
  /**
2236
2232
  * Extracts the logs for the verification run for the provider name. This needs the memory
@@ -2250,7 +2246,7 @@ const char *pactffi_verifier_logs_for_provider(const char *provider_name);
2250
2246
  *
2251
2247
  * Will return a NULL pointer if the handle is invalid.
2252
2248
  */
2253
- const char *pactffi_verifier_output(const VerifierHandle *handle, unsigned char strip_ansi);
2249
+ const char *pactffi_verifier_output(const struct VerifierHandle *handle, unsigned char strip_ansi);
2254
2250
 
2255
2251
  /**
2256
2252
  * Extracts the verification result as a JSON document. The returned string will need to be
@@ -2258,7 +2254,7 @@ const char *pactffi_verifier_output(const VerifierHandle *handle, unsigned char
2258
2254
  *
2259
2255
  * Will return a NULL pointer if the handle is invalid.
2260
2256
  */
2261
- const char *pactffi_verifier_json(const VerifierHandle *handle);
2257
+ const char *pactffi_verifier_json(const struct VerifierHandle *handle);
2262
2258
 
2263
2259
  /**
2264
2260
  * Add a plugin to be used by the test. The plugin needs to be installed correctly for this
@@ -2323,10 +2319,8 @@ void pactffi_cleanup_plugins(PactHandle pact);
2323
2319
  * When an error errors, LAST_ERROR will contain the error message.
2324
2320
  */
2325
2321
  unsigned int pactffi_interaction_contents(InteractionHandle interaction,
2326
- InteractionPart part,
2322
+ enum InteractionPart part,
2327
2323
  const char *content_type,
2328
2324
  const char *contents);
2329
2325
 
2330
- } // extern "C"
2331
-
2332
- #endif // pact_ffi_h
2326
+ #endif /* pact_ffi_h */