repull 0.2.0

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 (222) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +10 -0
  3. data/LICENSE +21 -0
  4. data/README.md +121 -0
  5. data/Rakefile +10 -0
  6. data/examples/connect_airbnb.rb +33 -0
  7. data/examples/quickstart.rb +22 -0
  8. data/lib/repull/api/ai_api.rb +86 -0
  9. data/lib/repull/api/airbnb_api.rb +1155 -0
  10. data/lib/repull/api/atlas_api.rb +194 -0
  11. data/lib/repull/api/availability_api.rb +167 -0
  12. data/lib/repull/api/billing_api.rb +139 -0
  13. data/lib/repull/api/booking_com_api.rb +617 -0
  14. data/lib/repull/api/connect_api.rb +672 -0
  15. data/lib/repull/api/conversations_api.rb +263 -0
  16. data/lib/repull/api/guests_api.rb +171 -0
  17. data/lib/repull/api/listings_api.rb +509 -0
  18. data/lib/repull/api/markets_api.rb +320 -0
  19. data/lib/repull/api/plumguide_api.rb +299 -0
  20. data/lib/repull/api/pricing_api.rb +453 -0
  21. data/lib/repull/api/properties_api.rb +166 -0
  22. data/lib/repull/api/reservations_api.rb +387 -0
  23. data/lib/repull/api/reviews_api.rb +208 -0
  24. data/lib/repull/api/schema_api.rb +347 -0
  25. data/lib/repull/api/system_api.rb +79 -0
  26. data/lib/repull/api/vrbo_api.rb +262 -0
  27. data/lib/repull/api/webhooks_api.rb +867 -0
  28. data/lib/repull/api_client.rb +397 -0
  29. data/lib/repull/api_error.rb +58 -0
  30. data/lib/repull/api_model_base.rb +88 -0
  31. data/lib/repull/configuration.rb +313 -0
  32. data/lib/repull/models/ai_operation.rb +158 -0
  33. data/lib/repull/models/airbnb_listing.rb +229 -0
  34. data/lib/repull/models/airbnb_listing_list_response.rb +158 -0
  35. data/lib/repull/models/airbnb_reservation.rb +224 -0
  36. data/lib/repull/models/airbnb_reservation_list_response.rb +158 -0
  37. data/lib/repull/models/airbnb_review.rb +222 -0
  38. data/lib/repull/models/airbnb_review_list_response.rb +158 -0
  39. data/lib/repull/models/airbnb_thread.rb +188 -0
  40. data/lib/repull/models/airbnb_thread_list_response.rb +158 -0
  41. data/lib/repull/models/booking_connect_listing_option.rb +201 -0
  42. data/lib/repull/models/booking_connect_room.rb +251 -0
  43. data/lib/repull/models/booking_connect_rooms_response.rb +274 -0
  44. data/lib/repull/models/booking_conversation.rb +178 -0
  45. data/lib/repull/models/booking_conversation_list_response.rb +158 -0
  46. data/lib/repull/models/booking_pricing_rate_update.rb +310 -0
  47. data/lib/repull/models/booking_pricing_rate_update_date_range.rb +190 -0
  48. data/lib/repull/models/booking_pricing_rate_update_restrictions.rb +179 -0
  49. data/lib/repull/models/booking_pricing_response.rb +157 -0
  50. data/lib/repull/models/booking_pricing_update_request.rb +176 -0
  51. data/lib/repull/models/booking_pricing_update_response.rb +199 -0
  52. data/lib/repull/models/booking_property.rb +188 -0
  53. data/lib/repull/models/booking_property_list_response.rb +158 -0
  54. data/lib/repull/models/booking_room_mapping.rb +177 -0
  55. data/lib/repull/models/booking_verify_hotel_request.rb +193 -0
  56. data/lib/repull/models/booking_verify_hotel_response.rb +285 -0
  57. data/lib/repull/models/bulk_pricing_failure.rb +177 -0
  58. data/lib/repull/models/bulk_pricing_item.rb +202 -0
  59. data/lib/repull/models/bulk_pricing_request.rb +212 -0
  60. data/lib/repull/models/bulk_pricing_response.rb +170 -0
  61. data/lib/repull/models/calendar_day.rb +174 -0
  62. data/lib/repull/models/calendar_response.rb +149 -0
  63. data/lib/repull/models/connect_host.rb +194 -0
  64. data/lib/repull/models/connect_provider.rb +365 -0
  65. data/lib/repull/models/connect_provider_list_response.rb +149 -0
  66. data/lib/repull/models/connect_session.rb +228 -0
  67. data/lib/repull/models/connect_status.rb +207 -0
  68. data/lib/repull/models/connection.rb +195 -0
  69. data/lib/repull/models/connection_list_response.rb +158 -0
  70. data/lib/repull/models/conversation.rb +257 -0
  71. data/lib/repull/models/conversation_detail.rb +284 -0
  72. data/lib/repull/models/conversation_guest.rb +178 -0
  73. data/lib/repull/models/conversation_guest_contact.rb +174 -0
  74. data/lib/repull/models/conversation_host.rb +186 -0
  75. data/lib/repull/models/conversation_list_response.rb +159 -0
  76. data/lib/repull/models/conversation_message_attachment.rb +174 -0
  77. data/lib/repull/models/create_ai_operation200_response.rb +156 -0
  78. data/lib/repull/models/create_billing_checkout_request.rb +181 -0
  79. data/lib/repull/models/create_connect_session_request.rb +189 -0
  80. data/lib/repull/models/create_connection_request.rb +225 -0
  81. data/lib/repull/models/create_reservation_request.rb +313 -0
  82. data/lib/repull/models/create_webhook_request.rb +211 -0
  83. data/lib/repull/models/custom_schema.rb +303 -0
  84. data/lib/repull/models/custom_schema_create.rb +253 -0
  85. data/lib/repull/models/custom_schema_create_response.rb +300 -0
  86. data/lib/repull/models/custom_schema_delete_response.rb +164 -0
  87. data/lib/repull/models/custom_schema_list_response.rb +159 -0
  88. data/lib/repull/models/custom_schema_summary.rb +300 -0
  89. data/lib/repull/models/custom_schema_update.rb +199 -0
  90. data/lib/repull/models/error.rb +165 -0
  91. data/lib/repull/models/error_error.rb +357 -0
  92. data/lib/repull/models/error_error_support.rb +167 -0
  93. data/lib/repull/models/get_health200_response.rb +156 -0
  94. data/lib/repull/models/guest.rb +271 -0
  95. data/lib/repull/models/guest_contact.rb +186 -0
  96. data/lib/repull/models/guest_flag.rb +179 -0
  97. data/lib/repull/models/guest_list_response.rb +159 -0
  98. data/lib/repull/models/guest_note.rb +187 -0
  99. data/lib/repull/models/guest_profile.rb +337 -0
  100. data/lib/repull/models/guest_reservations_summary.rb +175 -0
  101. data/lib/repull/models/listing.rb +216 -0
  102. data/lib/repull/models/listing_address.rb +158 -0
  103. data/lib/repull/models/listing_channel.rb +176 -0
  104. data/lib/repull/models/listing_comp.rb +272 -0
  105. data/lib/repull/models/listing_comp_nightly.rb +166 -0
  106. data/lib/repull/models/listing_comp_ratings.rb +157 -0
  107. data/lib/repull/models/listing_comps_response.rb +197 -0
  108. data/lib/repull/models/listing_content.rb +249 -0
  109. data/lib/repull/models/listing_create_request.rb +364 -0
  110. data/lib/repull/models/listing_create_response.rb +148 -0
  111. data/lib/repull/models/listing_generate_content_request.rb +192 -0
  112. data/lib/repull/models/listing_generate_content_response.rb +165 -0
  113. data/lib/repull/models/listing_list_response.rb +158 -0
  114. data/lib/repull/models/listing_pricing_apply_request.rb +193 -0
  115. data/lib/repull/models/listing_pricing_apply_response.rb +169 -0
  116. data/lib/repull/models/listing_pricing_history_entry.rb +212 -0
  117. data/lib/repull/models/listing_pricing_history_response.rb +159 -0
  118. data/lib/repull/models/listing_pricing_recommendation.rb +269 -0
  119. data/lib/repull/models/listing_pricing_response.rb +187 -0
  120. data/lib/repull/models/listing_pricing_response_comp_summary.rb +178 -0
  121. data/lib/repull/models/listing_pricing_response_date_range.rb +156 -0
  122. data/lib/repull/models/listing_pricing_response_listing.rb +191 -0
  123. data/lib/repull/models/listing_pricing_strategy.rb +317 -0
  124. data/lib/repull/models/listing_pricing_strategy_input.rb +264 -0
  125. data/lib/repull/models/listing_publish_airbnb_request.rb +171 -0
  126. data/lib/repull/models/listing_publish_response.rb +166 -0
  127. data/lib/repull/models/listing_publish_status_channel.rb +197 -0
  128. data/lib/repull/models/listing_publish_status_response.rb +158 -0
  129. data/lib/repull/models/listing_quality_tier.rb +175 -0
  130. data/lib/repull/models/listing_segment.rb +229 -0
  131. data/lib/repull/models/listing_segment_recommendation.rb +170 -0
  132. data/lib/repull/models/listing_segments_response.rb +230 -0
  133. data/lib/repull/models/listing_segments_response_scope.rb +159 -0
  134. data/lib/repull/models/map_connect_booking_rooms_request.rb +202 -0
  135. data/lib/repull/models/map_connect_booking_rooms_response.rb +243 -0
  136. data/lib/repull/models/market_browse_category.rb +158 -0
  137. data/lib/repull/models/market_browse_entry.rb +197 -0
  138. data/lib/repull/models/market_browse_featured.rb +188 -0
  139. data/lib/repull/models/market_browse_response.rb +158 -0
  140. data/lib/repull/models/market_calendar_day.rb +257 -0
  141. data/lib/repull/models/market_calendar_day_events_inner.rb +177 -0
  142. data/lib/repull/models/market_calendar_response.rb +178 -0
  143. data/lib/repull/models/market_detail_response.rb +269 -0
  144. data/lib/repull/models/market_detail_response_price_distribution_inner.rb +186 -0
  145. data/lib/repull/models/market_detail_response_property_type_mix_inner.rb +166 -0
  146. data/lib/repull/models/market_detail_response_supply_trend_inner.rb +156 -0
  147. data/lib/repull/models/market_detail_response_top_comps.rb +187 -0
  148. data/lib/repull/models/market_event.rb +257 -0
  149. data/lib/repull/models/market_my_listing.rb +242 -0
  150. data/lib/repull/models/market_summary.rb +259 -0
  151. data/lib/repull/models/market_top_comp.rb +275 -0
  152. data/lib/repull/models/markets_overview_response.rb +219 -0
  153. data/lib/repull/models/markets_overview_response_browse.rb +173 -0
  154. data/lib/repull/models/markets_overview_response_subscriptions.rb +157 -0
  155. data/lib/repull/models/markets_overview_response_totals.rb +165 -0
  156. data/lib/repull/models/message.rb +289 -0
  157. data/lib/repull/models/message_list_response.rb +159 -0
  158. data/lib/repull/models/pagination.rb +188 -0
  159. data/lib/repull/models/plumguide_listing.rb +167 -0
  160. data/lib/repull/models/plumguide_listing_list_response.rb +158 -0
  161. data/lib/repull/models/property.rb +271 -0
  162. data/lib/repull/models/property_list_response.rb +158 -0
  163. data/lib/repull/models/reservation.rb +457 -0
  164. data/lib/repull/models/reservation_list_response.rb +159 -0
  165. data/lib/repull/models/review.rb +357 -0
  166. data/lib/repull/models/review_category.rb +169 -0
  167. data/lib/repull/models/review_list_response.rb +159 -0
  168. data/lib/repull/models/review_response.rb +158 -0
  169. data/lib/repull/models/rotate_webhook_secret200_response.rb +165 -0
  170. data/lib/repull/models/select_connect_provider_request.rb +165 -0
  171. data/lib/repull/models/select_provider_response.rb +176 -0
  172. data/lib/repull/models/test_webhook_request.rb +165 -0
  173. data/lib/repull/models/update_availability_request.rb +149 -0
  174. data/lib/repull/models/update_listing_pricing_strategy200_response.rb +147 -0
  175. data/lib/repull/models/update_reservation_request.rb +174 -0
  176. data/lib/repull/models/update_webhook_request.rb +211 -0
  177. data/lib/repull/models/vrbo_listing.rb +167 -0
  178. data/lib/repull/models/vrbo_listing_list_response.rb +158 -0
  179. data/lib/repull/models/vrbo_reservation.rb +185 -0
  180. data/lib/repull/models/vrbo_reservation_list_response.rb +158 -0
  181. data/lib/repull/models/webhook_delivery.rb +243 -0
  182. data/lib/repull/models/webhook_delivery_detail.rb +261 -0
  183. data/lib/repull/models/webhook_delivery_list_response.rb +158 -0
  184. data/lib/repull/models/webhook_event_catalog.rb +149 -0
  185. data/lib/repull/models/webhook_event_catalog_domains_inner.rb +167 -0
  186. data/lib/repull/models/webhook_event_catalog_domains_inner_events_inner.rb +183 -0
  187. data/lib/repull/models/webhook_list_response.rb +158 -0
  188. data/lib/repull/models/webhook_subscription.rb +294 -0
  189. data/lib/repull/version.rb +15 -0
  190. data/lib/repull.rb +217 -0
  191. data/openapi/v1.json +8923 -0
  192. data/repull.gemspec +43 -0
  193. data/scripts/regen.sh +55 -0
  194. data/spec/api/ai_api_spec.rb +47 -0
  195. data/spec/api/airbnb_api_spec.rb +238 -0
  196. data/spec/api/availability_api_spec.rb +62 -0
  197. data/spec/api/billing_api_spec.rb +57 -0
  198. data/spec/api/booking_com_api_spec.rb +115 -0
  199. data/spec/api/connect_api_spec.rb +82 -0
  200. data/spec/api/conversations_api_spec.rb +68 -0
  201. data/spec/api/guests_api_spec.rb +59 -0
  202. data/spec/api/plumguide_api_spec.rb +85 -0
  203. data/spec/api/properties_api_spec.rb +60 -0
  204. data/spec/api/reservations_api_spec.rb +97 -0
  205. data/spec/api/system_api_spec.rb +45 -0
  206. data/spec/api/vrbo_api_spec.rb +55 -0
  207. data/spec/api/webhooks_api_spec.rb +69 -0
  208. data/spec/models/ai_operation_spec.rb +46 -0
  209. data/spec/models/calendar_day_spec.rb +54 -0
  210. data/spec/models/connect_host_spec.rb +60 -0
  211. data/spec/models/connect_status_spec.rb +76 -0
  212. data/spec/models/connection_spec.rb +70 -0
  213. data/spec/models/conversation_spec.rb +66 -0
  214. data/spec/models/error_error_spec.rb +54 -0
  215. data/spec/models/error_spec.rb +36 -0
  216. data/spec/models/guest_spec.rb +72 -0
  217. data/spec/models/message_spec.rb +70 -0
  218. data/spec/models/property_spec.rb +114 -0
  219. data/spec/models/reservation_spec.rb +128 -0
  220. data/spec/models/webhook_subscription_spec.rb +60 -0
  221. data/spec/spec_helper.rb +111 -0
  222. metadata +337 -0
@@ -0,0 +1,867 @@
1
+ =begin
2
+ #Repull API
3
+
4
+ #The unified API for vacation rental tech. Connect to 50+ PMS platforms and 4 OTA channels through one REST API. Built-in AI operations for guest communication, pricing, and listing optimization. ## Designed for AI agents Every error response on this API includes machine-parseable fields so an LLM (Claude in MCP, Cursor, Cline, GPT, etc.) can self-recover without escalating to a human: - `error.code` — stable string identifier (e.g. `invalid_params`, `rate_limit_exceeded`) - `error.message` — human-readable cause - `error.fix` — exact recovery steps (e.g. \"Pass `check_in_after` as ISO 8601: `?check_in_after=2026-01-15`\") - `error.docs_url` — link to the canonical write-up at `https://repull.dev/docs/errors/{code}` - `error.request_id` — id to correlate with server-side logs - `error.field` / `error.value_received` / `error.valid_values` / `error.did_you_mean` — when the error is parameter-specific - `error.retry_after` — seconds to wait before retrying (rate-limit + transient upstream) `Access-Control-Expose-Headers` lists `x-request-id` and the `X-RateLimit-*` family so browsers can read them on cross-origin responses. ## Quick Start 1. Get an API key at https://repull.dev/dashboard 2. Connect a PMS: `POST /v1/connect/{provider}` 3. List properties: `GET /v1/properties` 4. Get reservations: `GET /v1/reservations` ## Authentication All requests require a Bearer token: ``` Authorization: Bearer sk_test_YOUR_API_KEY ``` Sandbox keys start with `sk_test_`, production with `sk_live_`. ## Request Correlation (X-Request-ID) Every response carries an `X-Request-ID` header, e.g. `X-Request-ID: req_01HXY...`. Include this id in support tickets and bug reports — we can trace the full request lifecycle (auth, rate limit, handler, downstream calls, log row) from a single id. You may set the header on the inbound request to forward your own trace id; we will echo it back instead of generating a new one. Accepted format: `^[\\\\w.-]{1,128}$`. The id is also embedded in error envelopes as `request_id` so server-side log diffs work even when the response headers are stripped by an intermediate proxy. ## Rate Limits The public API enforces a per-API-key sliding-window rate limit on top of the per-tier monthly + daily-AI quotas. **Default policy:** 600 requests per 60 seconds, per API key. Sliding window — there is no fixed-minute boundary you can burst across. Every response includes: | Header | Meaning | |---|---| | `X-RateLimit-Limit` | Requests permitted in the current window. | | `X-RateLimit-Remaining` | Requests left in the current window after this call. | | `X-RateLimit-Reset` | Unix epoch (seconds) when the next slot opens. | | `X-RateLimit-Policy` | Machine-readable policy descriptor, e.g. `600;w=60`. | | `Retry-After` | Seconds to wait before retrying. **Only present on 429 responses.** | **On 429 (rate_limit_exceeded):** the response body matches the standard error envelope with `code: \"rate_limit_exceeded\"`, plus `limit`, `window_seconds`, `retry_after`, and `request_id` fields. SDKs MUST honor `Retry-After` and use exponential backoff with jitter on subsequent retries — never a tight loop. Recommended backoff: ``` sleep_ms = (Retry-After * 1000) + random(0..250) ``` Monthly + daily-AI tier quotas (`free`, `starter`, `pro`, `enterprise`) are enforced separately and also surface as 429s; they include `tier`, `scope`, and `resets_at` fields.
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: ivan@vanio.ai
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.22.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module Repull
16
+ class WebhooksApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create webhook subscription
23
+ # Register a new endpoint. Returns the plaintext signing secret ONCE — capture it from the response and store it securely. After this call the secret is masked everywhere; mint a new one with `POST /v1/webhooks/{id}/rotate-secret` if you lose it. See `GET /v1/webhooks/event-types` for the full list of subscribable events.
24
+ # @param create_webhook_request [CreateWebhookRequest]
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [WebhookSubscription]
27
+ def create_webhook(create_webhook_request, opts = {})
28
+ data, _status_code, _headers = create_webhook_with_http_info(create_webhook_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create webhook subscription
33
+ # Register a new endpoint. Returns the plaintext signing secret ONCE — capture it from the response and store it securely. After this call the secret is masked everywhere; mint a new one with `POST /v1/webhooks/{id}/rotate-secret` if you lose it. See `GET /v1/webhooks/event-types` for the full list of subscribable events.
34
+ # @param create_webhook_request [CreateWebhookRequest]
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(WebhookSubscription, Integer, Hash)>] WebhookSubscription data, response status code and response headers
37
+ def create_webhook_with_http_info(create_webhook_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook ...'
40
+ end
41
+ # verify the required parameter 'create_webhook_request' is set
42
+ if @api_client.config.client_side_validation && create_webhook_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'create_webhook_request' when calling WebhooksApi.create_webhook"
44
+ end
45
+ # resource path
46
+ local_var_path = '/v1/webhooks'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_webhook_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'WebhookSubscription'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"WebhooksApi.create_webhook",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
90
+ # Delete webhook subscription
91
+ # Delete a webhook subscription. In-flight deliveries already on the queue are still attempted; new events stop firing immediately.
92
+ # @param id [String]
93
+ # @param [Hash] opts the optional parameters
94
+ # @return [nil]
95
+ def delete_webhook(id, opts = {})
96
+ delete_webhook_with_http_info(id, opts)
97
+ nil
98
+ end
99
+
100
+ # Delete webhook subscription
101
+ # Delete a webhook subscription. In-flight deliveries already on the queue are still attempted; new events stop firing immediately.
102
+ # @param id [String]
103
+ # @param [Hash] opts the optional parameters
104
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
105
+ def delete_webhook_with_http_info(id, opts = {})
106
+ if @api_client.config.debugging
107
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'
108
+ end
109
+ # verify the required parameter 'id' is set
110
+ if @api_client.config.client_side_validation && id.nil?
111
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.delete_webhook"
112
+ end
113
+ # resource path
114
+ local_var_path = '/v1/webhooks/{id}'.sub('{id}', CGI.escape(id.to_s))
115
+
116
+ # query parameters
117
+ query_params = opts[:query_params] || {}
118
+
119
+ # header parameters
120
+ header_params = opts[:header_params] || {}
121
+
122
+ # form parameters
123
+ form_params = opts[:form_params] || {}
124
+
125
+ # http body (model)
126
+ post_body = opts[:debug_body]
127
+
128
+ # return_type
129
+ return_type = opts[:debug_return_type]
130
+
131
+ # auth_names
132
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
133
+
134
+ new_options = opts.merge(
135
+ :operation => :"WebhooksApi.delete_webhook",
136
+ :header_params => header_params,
137
+ :query_params => query_params,
138
+ :form_params => form_params,
139
+ :body => post_body,
140
+ :auth_names => auth_names,
141
+ :return_type => return_type
142
+ )
143
+
144
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
145
+ if @api_client.config.debugging
146
+ @api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
147
+ end
148
+ return data, status_code, headers
149
+ end
150
+
151
+ # Get webhook subscription
152
+ # Fetch a single webhook subscription by id. Use the `deliveries` sub-resource to list recent attempts, and `ping` to send a test event.
153
+ # @param id [String]
154
+ # @param [Hash] opts the optional parameters
155
+ # @return [WebhookSubscription]
156
+ def get_webhook(id, opts = {})
157
+ data, _status_code, _headers = get_webhook_with_http_info(id, opts)
158
+ data
159
+ end
160
+
161
+ # Get webhook subscription
162
+ # Fetch a single webhook subscription by id. Use the &#x60;deliveries&#x60; sub-resource to list recent attempts, and &#x60;ping&#x60; to send a test event.
163
+ # @param id [String]
164
+ # @param [Hash] opts the optional parameters
165
+ # @return [Array<(WebhookSubscription, Integer, Hash)>] WebhookSubscription data, response status code and response headers
166
+ def get_webhook_with_http_info(id, opts = {})
167
+ if @api_client.config.debugging
168
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook ...'
169
+ end
170
+ # verify the required parameter 'id' is set
171
+ if @api_client.config.client_side_validation && id.nil?
172
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.get_webhook"
173
+ end
174
+ # resource path
175
+ local_var_path = '/v1/webhooks/{id}'.sub('{id}', CGI.escape(id.to_s))
176
+
177
+ # query parameters
178
+ query_params = opts[:query_params] || {}
179
+
180
+ # header parameters
181
+ header_params = opts[:header_params] || {}
182
+ # HTTP header 'Accept' (if needed)
183
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
184
+
185
+ # form parameters
186
+ form_params = opts[:form_params] || {}
187
+
188
+ # http body (model)
189
+ post_body = opts[:debug_body]
190
+
191
+ # return_type
192
+ return_type = opts[:debug_return_type] || 'WebhookSubscription'
193
+
194
+ # auth_names
195
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
196
+
197
+ new_options = opts.merge(
198
+ :operation => :"WebhooksApi.get_webhook",
199
+ :header_params => header_params,
200
+ :query_params => query_params,
201
+ :form_params => form_params,
202
+ :body => post_body,
203
+ :auth_names => auth_names,
204
+ :return_type => return_type
205
+ )
206
+
207
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
208
+ if @api_client.config.debugging
209
+ @api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
210
+ end
211
+ return data, status_code, headers
212
+ end
213
+
214
+ # Get webhook delivery
215
+ # Full request + response capture for one delivery attempt.
216
+ # @param id [String]
217
+ # @param delivery_id [String]
218
+ # @param [Hash] opts the optional parameters
219
+ # @return [WebhookDeliveryDetail]
220
+ def get_webhook_delivery(id, delivery_id, opts = {})
221
+ data, _status_code, _headers = get_webhook_delivery_with_http_info(id, delivery_id, opts)
222
+ data
223
+ end
224
+
225
+ # Get webhook delivery
226
+ # Full request + response capture for one delivery attempt.
227
+ # @param id [String]
228
+ # @param delivery_id [String]
229
+ # @param [Hash] opts the optional parameters
230
+ # @return [Array<(WebhookDeliveryDetail, Integer, Hash)>] WebhookDeliveryDetail data, response status code and response headers
231
+ def get_webhook_delivery_with_http_info(id, delivery_id, opts = {})
232
+ if @api_client.config.debugging
233
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook_delivery ...'
234
+ end
235
+ # verify the required parameter 'id' is set
236
+ if @api_client.config.client_side_validation && id.nil?
237
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.get_webhook_delivery"
238
+ end
239
+ # verify the required parameter 'delivery_id' is set
240
+ if @api_client.config.client_side_validation && delivery_id.nil?
241
+ fail ArgumentError, "Missing the required parameter 'delivery_id' when calling WebhooksApi.get_webhook_delivery"
242
+ end
243
+ # resource path
244
+ local_var_path = '/v1/webhooks/{id}/deliveries/{delivery_id}'.sub('{id}', CGI.escape(id.to_s)).sub('{delivery_id}', CGI.escape(delivery_id.to_s))
245
+
246
+ # query parameters
247
+ query_params = opts[:query_params] || {}
248
+
249
+ # header parameters
250
+ header_params = opts[:header_params] || {}
251
+ # HTTP header 'Accept' (if needed)
252
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
253
+
254
+ # form parameters
255
+ form_params = opts[:form_params] || {}
256
+
257
+ # http body (model)
258
+ post_body = opts[:debug_body]
259
+
260
+ # return_type
261
+ return_type = opts[:debug_return_type] || 'WebhookDeliveryDetail'
262
+
263
+ # auth_names
264
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
265
+
266
+ new_options = opts.merge(
267
+ :operation => :"WebhooksApi.get_webhook_delivery",
268
+ :header_params => header_params,
269
+ :query_params => query_params,
270
+ :form_params => form_params,
271
+ :body => post_body,
272
+ :auth_names => auth_names,
273
+ :return_type => return_type
274
+ )
275
+
276
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
277
+ if @api_client.config.debugging
278
+ @api_client.config.logger.debug "API called: WebhooksApi#get_webhook_delivery\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
279
+ end
280
+ return data, status_code, headers
281
+ end
282
+
283
+ # List webhook deliveries
284
+ # Cursor-paginated history of every delivery attempt for this subscription. Walk pages with `?cursor=<pagination.nextCursor>`; stop when `pagination.hasMore` is `false`. The cursor is opaque base64 — do not parse it.
285
+ # @param id [String]
286
+ # @param [Hash] opts the optional parameters
287
+ # @option opts [Integer] :limit (default to 25)
288
+ # @option opts [String] :cursor
289
+ # @option opts [String] :status (default to 'all')
290
+ # @return [WebhookDeliveryListResponse]
291
+ def list_webhook_deliveries(id, opts = {})
292
+ data, _status_code, _headers = list_webhook_deliveries_with_http_info(id, opts)
293
+ data
294
+ end
295
+
296
+ # List webhook deliveries
297
+ # Cursor-paginated history of every delivery attempt for this subscription. Walk pages with &#x60;?cursor&#x3D;&lt;pagination.nextCursor&gt;&#x60;; stop when &#x60;pagination.hasMore&#x60; is &#x60;false&#x60;. The cursor is opaque base64 — do not parse it.
298
+ # @param id [String]
299
+ # @param [Hash] opts the optional parameters
300
+ # @option opts [Integer] :limit (default to 25)
301
+ # @option opts [String] :cursor
302
+ # @option opts [String] :status (default to 'all')
303
+ # @return [Array<(WebhookDeliveryListResponse, Integer, Hash)>] WebhookDeliveryListResponse data, response status code and response headers
304
+ def list_webhook_deliveries_with_http_info(id, opts = {})
305
+ if @api_client.config.debugging
306
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhook_deliveries ...'
307
+ end
308
+ # verify the required parameter 'id' is set
309
+ if @api_client.config.client_side_validation && id.nil?
310
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.list_webhook_deliveries"
311
+ end
312
+ if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
313
+ fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.list_webhook_deliveries, must be smaller than or equal to 100.'
314
+ end
315
+
316
+ allowable_values = ["success", "failure", "all"]
317
+ if @api_client.config.client_side_validation && opts[:'status'] && !allowable_values.include?(opts[:'status'])
318
+ fail ArgumentError, "invalid value for \"status\", must be one of #{allowable_values}"
319
+ end
320
+ # resource path
321
+ local_var_path = '/v1/webhooks/{id}/deliveries'.sub('{id}', CGI.escape(id.to_s))
322
+
323
+ # query parameters
324
+ query_params = opts[:query_params] || {}
325
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
326
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
327
+ query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
328
+
329
+ # header parameters
330
+ header_params = opts[:header_params] || {}
331
+ # HTTP header 'Accept' (if needed)
332
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
333
+
334
+ # form parameters
335
+ form_params = opts[:form_params] || {}
336
+
337
+ # http body (model)
338
+ post_body = opts[:debug_body]
339
+
340
+ # return_type
341
+ return_type = opts[:debug_return_type] || 'WebhookDeliveryListResponse'
342
+
343
+ # auth_names
344
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
345
+
346
+ new_options = opts.merge(
347
+ :operation => :"WebhooksApi.list_webhook_deliveries",
348
+ :header_params => header_params,
349
+ :query_params => query_params,
350
+ :form_params => form_params,
351
+ :body => post_body,
352
+ :auth_names => auth_names,
353
+ :return_type => return_type
354
+ )
355
+
356
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
357
+ if @api_client.config.debugging
358
+ @api_client.config.logger.debug "API called: WebhooksApi#list_webhook_deliveries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
359
+ end
360
+ return data, status_code, headers
361
+ end
362
+
363
+ # List webhook event types
364
+ # The canonical catalog of every event the API can deliver, grouped by domain, with realistic sample payloads.
365
+ # @param [Hash] opts the optional parameters
366
+ # @return [WebhookEventCatalog]
367
+ def list_webhook_event_types(opts = {})
368
+ data, _status_code, _headers = list_webhook_event_types_with_http_info(opts)
369
+ data
370
+ end
371
+
372
+ # List webhook event types
373
+ # The canonical catalog of every event the API can deliver, grouped by domain, with realistic sample payloads.
374
+ # @param [Hash] opts the optional parameters
375
+ # @return [Array<(WebhookEventCatalog, Integer, Hash)>] WebhookEventCatalog data, response status code and response headers
376
+ def list_webhook_event_types_with_http_info(opts = {})
377
+ if @api_client.config.debugging
378
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhook_event_types ...'
379
+ end
380
+ # resource path
381
+ local_var_path = '/v1/webhooks/event-types'
382
+
383
+ # query parameters
384
+ query_params = opts[:query_params] || {}
385
+
386
+ # header parameters
387
+ header_params = opts[:header_params] || {}
388
+ # HTTP header 'Accept' (if needed)
389
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
390
+
391
+ # form parameters
392
+ form_params = opts[:form_params] || {}
393
+
394
+ # http body (model)
395
+ post_body = opts[:debug_body]
396
+
397
+ # return_type
398
+ return_type = opts[:debug_return_type] || 'WebhookEventCatalog'
399
+
400
+ # auth_names
401
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
402
+
403
+ new_options = opts.merge(
404
+ :operation => :"WebhooksApi.list_webhook_event_types",
405
+ :header_params => header_params,
406
+ :query_params => query_params,
407
+ :form_params => form_params,
408
+ :body => post_body,
409
+ :auth_names => auth_names,
410
+ :return_type => return_type
411
+ )
412
+
413
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
414
+ if @api_client.config.debugging
415
+ @api_client.config.logger.debug "API called: WebhooksApi#list_webhook_event_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
416
+ end
417
+ return data, status_code, headers
418
+ end
419
+
420
+ # List webhook subscriptions
421
+ # List every webhook subscription registered for this workspace. Each row includes the destination URL, subscribed event types, and the most recent delivery summary.
422
+ # @param [Hash] opts the optional parameters
423
+ # @return [WebhookListResponse]
424
+ def list_webhooks(opts = {})
425
+ data, _status_code, _headers = list_webhooks_with_http_info(opts)
426
+ data
427
+ end
428
+
429
+ # List webhook subscriptions
430
+ # List every webhook subscription registered for this workspace. Each row includes the destination URL, subscribed event types, and the most recent delivery summary.
431
+ # @param [Hash] opts the optional parameters
432
+ # @return [Array<(WebhookListResponse, Integer, Hash)>] WebhookListResponse data, response status code and response headers
433
+ def list_webhooks_with_http_info(opts = {})
434
+ if @api_client.config.debugging
435
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...'
436
+ end
437
+ # resource path
438
+ local_var_path = '/v1/webhooks'
439
+
440
+ # query parameters
441
+ query_params = opts[:query_params] || {}
442
+
443
+ # header parameters
444
+ header_params = opts[:header_params] || {}
445
+ # HTTP header 'Accept' (if needed)
446
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
447
+
448
+ # form parameters
449
+ form_params = opts[:form_params] || {}
450
+
451
+ # http body (model)
452
+ post_body = opts[:debug_body]
453
+
454
+ # return_type
455
+ return_type = opts[:debug_return_type] || 'WebhookListResponse'
456
+
457
+ # auth_names
458
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
459
+
460
+ new_options = opts.merge(
461
+ :operation => :"WebhooksApi.list_webhooks",
462
+ :header_params => header_params,
463
+ :query_params => query_params,
464
+ :form_params => form_params,
465
+ :body => post_body,
466
+ :auth_names => auth_names,
467
+ :return_type => return_type
468
+ )
469
+
470
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
471
+ if @api_client.config.debugging
472
+ @api_client.config.logger.debug "API called: WebhooksApi#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
473
+ end
474
+ return data, status_code, headers
475
+ end
476
+
477
+ # Send ping event
478
+ # Fires a synthetic `repull.ping` at the subscription URL and returns the full delivery cycle inline. Used by dashboards and health-check probes.
479
+ # @param id [String]
480
+ # @param [Hash] opts the optional parameters
481
+ # @return [nil]
482
+ def ping_webhook(id, opts = {})
483
+ ping_webhook_with_http_info(id, opts)
484
+ nil
485
+ end
486
+
487
+ # Send ping event
488
+ # Fires a synthetic &#x60;repull.ping&#x60; at the subscription URL and returns the full delivery cycle inline. Used by dashboards and health-check probes.
489
+ # @param id [String]
490
+ # @param [Hash] opts the optional parameters
491
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
492
+ def ping_webhook_with_http_info(id, opts = {})
493
+ if @api_client.config.debugging
494
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.ping_webhook ...'
495
+ end
496
+ # verify the required parameter 'id' is set
497
+ if @api_client.config.client_side_validation && id.nil?
498
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.ping_webhook"
499
+ end
500
+ # resource path
501
+ local_var_path = '/v1/webhooks/{id}/ping'.sub('{id}', CGI.escape(id.to_s))
502
+
503
+ # query parameters
504
+ query_params = opts[:query_params] || {}
505
+
506
+ # header parameters
507
+ header_params = opts[:header_params] || {}
508
+
509
+ # form parameters
510
+ form_params = opts[:form_params] || {}
511
+
512
+ # http body (model)
513
+ post_body = opts[:debug_body]
514
+
515
+ # return_type
516
+ return_type = opts[:debug_return_type]
517
+
518
+ # auth_names
519
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
520
+
521
+ new_options = opts.merge(
522
+ :operation => :"WebhooksApi.ping_webhook",
523
+ :header_params => header_params,
524
+ :query_params => query_params,
525
+ :form_params => form_params,
526
+ :body => post_body,
527
+ :auth_names => auth_names,
528
+ :return_type => return_type
529
+ )
530
+
531
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
532
+ if @api_client.config.debugging
533
+ @api_client.config.logger.debug "API called: WebhooksApi#ping_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
534
+ end
535
+ return data, status_code, headers
536
+ end
537
+
538
+ # Replay webhook delivery
539
+ # Re-sends the original payload (same eventId, fresh deliveryId, attempt + 1).
540
+ # @param id [String]
541
+ # @param delivery_id [String]
542
+ # @param [Hash] opts the optional parameters
543
+ # @return [nil]
544
+ def replay_webhook_delivery(id, delivery_id, opts = {})
545
+ replay_webhook_delivery_with_http_info(id, delivery_id, opts)
546
+ nil
547
+ end
548
+
549
+ # Replay webhook delivery
550
+ # Re-sends the original payload (same eventId, fresh deliveryId, attempt + 1).
551
+ # @param id [String]
552
+ # @param delivery_id [String]
553
+ # @param [Hash] opts the optional parameters
554
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
555
+ def replay_webhook_delivery_with_http_info(id, delivery_id, opts = {})
556
+ if @api_client.config.debugging
557
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.replay_webhook_delivery ...'
558
+ end
559
+ # verify the required parameter 'id' is set
560
+ if @api_client.config.client_side_validation && id.nil?
561
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.replay_webhook_delivery"
562
+ end
563
+ # verify the required parameter 'delivery_id' is set
564
+ if @api_client.config.client_side_validation && delivery_id.nil?
565
+ fail ArgumentError, "Missing the required parameter 'delivery_id' when calling WebhooksApi.replay_webhook_delivery"
566
+ end
567
+ # resource path
568
+ local_var_path = '/v1/webhooks/{id}/deliveries/{delivery_id}/replay'.sub('{id}', CGI.escape(id.to_s)).sub('{delivery_id}', CGI.escape(delivery_id.to_s))
569
+
570
+ # query parameters
571
+ query_params = opts[:query_params] || {}
572
+
573
+ # header parameters
574
+ header_params = opts[:header_params] || {}
575
+
576
+ # form parameters
577
+ form_params = opts[:form_params] || {}
578
+
579
+ # http body (model)
580
+ post_body = opts[:debug_body]
581
+
582
+ # return_type
583
+ return_type = opts[:debug_return_type]
584
+
585
+ # auth_names
586
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
587
+
588
+ new_options = opts.merge(
589
+ :operation => :"WebhooksApi.replay_webhook_delivery",
590
+ :header_params => header_params,
591
+ :query_params => query_params,
592
+ :form_params => form_params,
593
+ :body => post_body,
594
+ :auth_names => auth_names,
595
+ :return_type => return_type
596
+ )
597
+
598
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
599
+ if @api_client.config.debugging
600
+ @api_client.config.logger.debug "API called: WebhooksApi#replay_webhook_delivery\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
601
+ end
602
+ return data, status_code, headers
603
+ end
604
+
605
+ # Rotate signing secret
606
+ # Mints a fresh signing secret and returns the plaintext ONCE. After this response the secret is masked everywhere — capture and store it now.
607
+ # @param id [String]
608
+ # @param [Hash] opts the optional parameters
609
+ # @return [RotateWebhookSecret200Response]
610
+ def rotate_webhook_secret(id, opts = {})
611
+ data, _status_code, _headers = rotate_webhook_secret_with_http_info(id, opts)
612
+ data
613
+ end
614
+
615
+ # Rotate signing secret
616
+ # Mints a fresh signing secret and returns the plaintext ONCE. After this response the secret is masked everywhere — capture and store it now.
617
+ # @param id [String]
618
+ # @param [Hash] opts the optional parameters
619
+ # @return [Array<(RotateWebhookSecret200Response, Integer, Hash)>] RotateWebhookSecret200Response data, response status code and response headers
620
+ def rotate_webhook_secret_with_http_info(id, opts = {})
621
+ if @api_client.config.debugging
622
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.rotate_webhook_secret ...'
623
+ end
624
+ # verify the required parameter 'id' is set
625
+ if @api_client.config.client_side_validation && id.nil?
626
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.rotate_webhook_secret"
627
+ end
628
+ # resource path
629
+ local_var_path = '/v1/webhooks/{id}/rotate-secret'.sub('{id}', CGI.escape(id.to_s))
630
+
631
+ # query parameters
632
+ query_params = opts[:query_params] || {}
633
+
634
+ # header parameters
635
+ header_params = opts[:header_params] || {}
636
+ # HTTP header 'Accept' (if needed)
637
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
638
+
639
+ # form parameters
640
+ form_params = opts[:form_params] || {}
641
+
642
+ # http body (model)
643
+ post_body = opts[:debug_body]
644
+
645
+ # return_type
646
+ return_type = opts[:debug_return_type] || 'RotateWebhookSecret200Response'
647
+
648
+ # auth_names
649
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
650
+
651
+ new_options = opts.merge(
652
+ :operation => :"WebhooksApi.rotate_webhook_secret",
653
+ :header_params => header_params,
654
+ :query_params => query_params,
655
+ :form_params => form_params,
656
+ :body => post_body,
657
+ :auth_names => auth_names,
658
+ :return_type => return_type
659
+ )
660
+
661
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
662
+ if @api_client.config.debugging
663
+ @api_client.config.logger.debug "API called: WebhooksApi#rotate_webhook_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
664
+ end
665
+ return data, status_code, headers
666
+ end
667
+
668
+ # Send test event of a specific type
669
+ # Delivers a realistic fixture payload of the requested event type to the subscription URL.
670
+ # @param id [String]
671
+ # @param event_type [String]
672
+ # @param [Hash] opts the optional parameters
673
+ # @return [nil]
674
+ def test_fire_webhook(id, event_type, opts = {})
675
+ test_fire_webhook_with_http_info(id, event_type, opts)
676
+ nil
677
+ end
678
+
679
+ # Send test event of a specific type
680
+ # Delivers a realistic fixture payload of the requested event type to the subscription URL.
681
+ # @param id [String]
682
+ # @param event_type [String]
683
+ # @param [Hash] opts the optional parameters
684
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
685
+ def test_fire_webhook_with_http_info(id, event_type, opts = {})
686
+ if @api_client.config.debugging
687
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.test_fire_webhook ...'
688
+ end
689
+ # verify the required parameter 'id' is set
690
+ if @api_client.config.client_side_validation && id.nil?
691
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.test_fire_webhook"
692
+ end
693
+ # verify the required parameter 'event_type' is set
694
+ if @api_client.config.client_side_validation && event_type.nil?
695
+ fail ArgumentError, "Missing the required parameter 'event_type' when calling WebhooksApi.test_fire_webhook"
696
+ end
697
+ # resource path
698
+ local_var_path = '/v1/webhooks/{id}/test/{event_type}'.sub('{id}', CGI.escape(id.to_s)).sub('{event_type}', CGI.escape(event_type.to_s))
699
+
700
+ # query parameters
701
+ query_params = opts[:query_params] || {}
702
+
703
+ # header parameters
704
+ header_params = opts[:header_params] || {}
705
+
706
+ # form parameters
707
+ form_params = opts[:form_params] || {}
708
+
709
+ # http body (model)
710
+ post_body = opts[:debug_body]
711
+
712
+ # return_type
713
+ return_type = opts[:debug_return_type]
714
+
715
+ # auth_names
716
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
717
+
718
+ new_options = opts.merge(
719
+ :operation => :"WebhooksApi.test_fire_webhook",
720
+ :header_params => header_params,
721
+ :query_params => query_params,
722
+ :form_params => form_params,
723
+ :body => post_body,
724
+ :auth_names => auth_names,
725
+ :return_type => return_type
726
+ )
727
+
728
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
729
+ if @api_client.config.debugging
730
+ @api_client.config.logger.debug "API called: WebhooksApi#test_fire_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
731
+ end
732
+ return data, status_code, headers
733
+ end
734
+
735
+ # [Legacy] Send test webhook to a URL
736
+ # Deprecated: prefer creating a subscription then calling `POST /v1/webhooks/{id}/ping`. Kept for back-compat.
737
+ # @param [Hash] opts the optional parameters
738
+ # @option opts [TestWebhookRequest] :test_webhook_request
739
+ # @return [nil]
740
+ def test_webhook(opts = {})
741
+ test_webhook_with_http_info(opts)
742
+ nil
743
+ end
744
+
745
+ # [Legacy] Send test webhook to a URL
746
+ # Deprecated: prefer creating a subscription then calling &#x60;POST /v1/webhooks/{id}/ping&#x60;. Kept for back-compat.
747
+ # @param [Hash] opts the optional parameters
748
+ # @option opts [TestWebhookRequest] :test_webhook_request
749
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
750
+ def test_webhook_with_http_info(opts = {})
751
+ if @api_client.config.debugging
752
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.test_webhook ...'
753
+ end
754
+ # resource path
755
+ local_var_path = '/v1/webhooks/test'
756
+
757
+ # query parameters
758
+ query_params = opts[:query_params] || {}
759
+
760
+ # header parameters
761
+ header_params = opts[:header_params] || {}
762
+ # HTTP header 'Content-Type'
763
+ content_type = @api_client.select_header_content_type(['application/json'])
764
+ if !content_type.nil?
765
+ header_params['Content-Type'] = content_type
766
+ end
767
+
768
+ # form parameters
769
+ form_params = opts[:form_params] || {}
770
+
771
+ # http body (model)
772
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'test_webhook_request'])
773
+
774
+ # return_type
775
+ return_type = opts[:debug_return_type]
776
+
777
+ # auth_names
778
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
779
+
780
+ new_options = opts.merge(
781
+ :operation => :"WebhooksApi.test_webhook",
782
+ :header_params => header_params,
783
+ :query_params => query_params,
784
+ :form_params => form_params,
785
+ :body => post_body,
786
+ :auth_names => auth_names,
787
+ :return_type => return_type
788
+ )
789
+
790
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
791
+ if @api_client.config.debugging
792
+ @api_client.config.logger.debug "API called: WebhooksApi#test_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
793
+ end
794
+ return data, status_code, headers
795
+ end
796
+
797
+ # Update webhook subscription
798
+ # Update url, description, events, or status (active|paused). Re-enabling clears `consecutive_failures` and `disabled_at`.
799
+ # @param id [String]
800
+ # @param [Hash] opts the optional parameters
801
+ # @option opts [UpdateWebhookRequest] :update_webhook_request
802
+ # @return [WebhookSubscription]
803
+ def update_webhook(id, opts = {})
804
+ data, _status_code, _headers = update_webhook_with_http_info(id, opts)
805
+ data
806
+ end
807
+
808
+ # Update webhook subscription
809
+ # Update url, description, events, or status (active|paused). Re-enabling clears &#x60;consecutive_failures&#x60; and &#x60;disabled_at&#x60;.
810
+ # @param id [String]
811
+ # @param [Hash] opts the optional parameters
812
+ # @option opts [UpdateWebhookRequest] :update_webhook_request
813
+ # @return [Array<(WebhookSubscription, Integer, Hash)>] WebhookSubscription data, response status code and response headers
814
+ def update_webhook_with_http_info(id, opts = {})
815
+ if @api_client.config.debugging
816
+ @api_client.config.logger.debug 'Calling API: WebhooksApi.update_webhook ...'
817
+ end
818
+ # verify the required parameter 'id' is set
819
+ if @api_client.config.client_side_validation && id.nil?
820
+ fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.update_webhook"
821
+ end
822
+ # resource path
823
+ local_var_path = '/v1/webhooks/{id}'.sub('{id}', CGI.escape(id.to_s))
824
+
825
+ # query parameters
826
+ query_params = opts[:query_params] || {}
827
+
828
+ # header parameters
829
+ header_params = opts[:header_params] || {}
830
+ # HTTP header 'Accept' (if needed)
831
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
832
+ # HTTP header 'Content-Type'
833
+ content_type = @api_client.select_header_content_type(['application/json'])
834
+ if !content_type.nil?
835
+ header_params['Content-Type'] = content_type
836
+ end
837
+
838
+ # form parameters
839
+ form_params = opts[:form_params] || {}
840
+
841
+ # http body (model)
842
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'update_webhook_request'])
843
+
844
+ # return_type
845
+ return_type = opts[:debug_return_type] || 'WebhookSubscription'
846
+
847
+ # auth_names
848
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
849
+
850
+ new_options = opts.merge(
851
+ :operation => :"WebhooksApi.update_webhook",
852
+ :header_params => header_params,
853
+ :query_params => query_params,
854
+ :form_params => form_params,
855
+ :body => post_body,
856
+ :auth_names => auth_names,
857
+ :return_type => return_type
858
+ )
859
+
860
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
861
+ if @api_client.config.debugging
862
+ @api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
863
+ end
864
+ return data, status_code, headers
865
+ end
866
+ end
867
+ end