growwer 2.0.0 → 2.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.
- checksums.yaml +4 -4
- data/README.md +61 -6
- data/docs/AccountApi.md +1 -1
- data/docs/AdvanceTestOrderRequest.md +18 -0
- data/docs/BalanceLowEventData.md +20 -0
- data/docs/BalanceLowEventDataWallet.md +20 -0
- data/docs/CatalogueApi.md +2 -2
- data/docs/CreateWebhookRequest.md +24 -0
- data/docs/GetMe200Response.md +3 -1
- data/docs/ListWebhookDeliveries200Response.md +20 -0
- data/docs/ListWebhooks200Response.md +20 -0
- data/docs/Money.md +4 -2
- data/docs/MoneyOrNull.md +4 -2
- data/docs/OrderCreateRequest.md +1 -1
- data/docs/OrderEventData.md +18 -0
- data/docs/SellerMedia.md +3 -1
- data/docs/SellerMediaCompetitiveFeesByLinkTypeInner.md +22 -0
- data/docs/SellerMediasApi.md +5 -5
- data/docs/TestHelpersApi.md +222 -0
- data/docs/TopUpTestWallet200Response.md +20 -0
- data/docs/TopUpTestWalletRequest.md +18 -0
- data/docs/UpdateWebhookRequest.md +26 -0
- data/docs/Webhook.md +38 -0
- data/docs/WebhookDelivery.md +32 -0
- data/docs/WebhookDeliveryAttempt.md +26 -0
- data/docs/WebhookEvent.md +28 -0
- data/docs/WebhookEventData.md +51 -0
- data/docs/WebhookEventType.md +15 -0
- data/docs/WebhookTestEventData.md +18 -0
- data/docs/WebhookWithSecret.md +40 -0
- data/docs/WebhooksApi.md +662 -0
- data/growwer.gemspec +1 -1
- data/lib/growwer/api/account_api.rb +3 -3
- data/lib/growwer/api/buyer_orders_api.rb +1 -1
- data/lib/growwer/api/buyer_wallet_api.rb +1 -1
- data/lib/growwer/api/catalogue_api.rb +5 -5
- data/lib/growwer/api/files_api.rb +1 -1
- data/lib/growwer/api/managed_services_api.rb +1 -1
- data/lib/growwer/api/projects_api.rb +1 -1
- data/lib/growwer/api/saved_filters_api.rb +1 -1
- data/lib/growwer/api/seller_account_api.rb +1 -1
- data/lib/growwer/api/seller_medias_api.rb +5 -5
- data/lib/growwer/api/seller_orders_api.rb +1 -1
- data/lib/growwer/api/seller_wallet_api.rb +1 -1
- data/lib/growwer/api/test_helpers_api.rb +254 -0
- data/lib/growwer/api/webhooks_api.rb +707 -0
- data/lib/growwer/api_client.rb +2 -2
- data/lib/growwer/api_error.rb +1 -1
- data/lib/growwer/api_model_base.rb +1 -1
- data/lib/growwer/configuration.rb +1 -1
- data/lib/growwer/models/advance_test_order_request.rb +189 -0
- data/lib/growwer/models/balance.rb +1 -1
- data/lib/growwer/models/balance_low_event_data.rb +192 -0
- data/lib/growwer/models/balance_low_event_data_wallet.rb +192 -0
- data/lib/growwer/models/catalogue_media.rb +1 -1
- data/lib/growwer/models/catalogue_media_flash_offer.rb +1 -1
- data/lib/growwer/models/catalogue_media_metrics.rb +1 -1
- data/lib/growwer/models/catalogue_offer.rb +1 -1
- data/lib/growwer/models/catalogue_offer_or_null.rb +1 -1
- data/lib/growwer/models/catalogue_post_offer.rb +1 -1
- data/lib/growwer/models/catalogue_post_offer_all_of_extras.rb +1 -1
- data/lib/growwer/models/catalogue_post_offer_all_of_extras_sensitive_topic.rb +1 -1
- data/lib/growwer/models/code_name.rb +1 -1
- data/lib/growwer/models/count_saved_filter_medias200_response.rb +1 -1
- data/lib/growwer/models/create_project_request.rb +1 -1
- data/lib/growwer/models/create_saved_filter_request.rb +1 -1
- data/lib/growwer/models/create_seller_media_request.rb +1 -1
- data/lib/growwer/models/create_seller_media_request_post_offer.rb +1 -1
- data/lib/growwer/models/create_webhook_request.rb +248 -0
- data/lib/growwer/models/error.rb +1 -1
- data/lib/growwer/models/get_buyer_wallet200_response.rb +1 -1
- data/lib/growwer/models/get_me200_response.rb +57 -20
- data/lib/growwer/models/get_me200_response_buyer.rb +1 -1
- data/lib/growwer/models/get_me200_response_catalogue.rb +1 -1
- data/lib/growwer/models/get_me200_response_managed_service.rb +1 -1
- data/lib/growwer/models/get_me200_response_seller.rb +2 -1
- data/lib/growwer/models/get_seller_wallet200_response.rb +1 -1
- data/lib/growwer/models/get_vocabulary200_response.rb +1 -1
- data/lib/growwer/models/get_vocabulary200_response_topics_inner.rb +1 -1
- data/lib/growwer/models/invoice.rb +1 -1
- data/lib/growwer/models/link_addition_order_briefing.rb +1 -1
- data/lib/growwer/models/link_addition_order_briefing_request.rb +1 -1
- data/lib/growwer/models/list_buyer_transactions200_response.rb +1 -1
- data/lib/growwer/models/list_flash_offers200_response.rb +1 -1
- data/lib/growwer/models/list_invoices200_response.rb +1 -1
- data/lib/growwer/models/list_managed_service_campaigns200_response.rb +1 -1
- data/lib/growwer/models/list_managed_service_proposals200_response.rb +1 -1
- data/lib/growwer/models/list_orders200_response.rb +1 -1
- data/lib/growwer/models/list_projects200_response.rb +1 -1
- data/lib/growwer/models/list_saved_filters200_response.rb +1 -1
- data/lib/growwer/models/list_seller_medias200_response.rb +1 -1
- data/lib/growwer/models/list_seller_orders200_response.rb +1 -1
- data/lib/growwer/models/list_seller_transactions200_response.rb +1 -1
- data/lib/growwer/models/list_webhook_deliveries200_response.rb +192 -0
- data/lib/growwer/models/list_webhooks200_response.rb +192 -0
- data/lib/growwer/models/list_withdrawals200_response.rb +1 -1
- data/lib/growwer/models/managed_service_campaign.rb +1 -1
- data/lib/growwer/models/managed_service_campaign_project.rb +1 -1
- data/lib/growwer/models/managed_service_campaign_proposal_counts.rb +1 -1
- data/lib/growwer/models/managed_service_campaign_strategy.rb +1 -1
- data/lib/growwer/models/managed_service_proposal.rb +1 -1
- data/lib/growwer/models/managed_service_proposal_briefing.rb +1 -1
- data/lib/growwer/models/managed_service_proposal_briefing_links_inner.rb +1 -1
- data/lib/growwer/models/managed_service_proposal_media.rb +1 -1
- data/lib/growwer/models/managed_service_proposal_review.rb +1 -1
- data/lib/growwer/models/managed_service_proposal_review_request.rb +1 -1
- data/lib/growwer/models/managed_service_proposal_review_request_reviews_inner.rb +1 -1
- data/lib/growwer/models/managed_service_proposals_estimate.rb +1 -1
- data/lib/growwer/models/managed_service_proposals_estimate_request.rb +1 -1
- data/lib/growwer/models/managed_service_request.rb +1 -1
- data/lib/growwer/models/managed_service_request_sent.rb +1 -1
- data/lib/growwer/models/money.rb +16 -6
- data/lib/growwer/models/money_or_null.rb +16 -6
- data/lib/growwer/models/order.rb +1 -1
- data/lib/growwer/models/order_action_reason.rb +1 -1
- data/lib/growwer/models/order_briefing.rb +1 -1
- data/lib/growwer/models/order_channel.rb +1 -1
- data/lib/growwer/models/order_create_request.rb +2 -2
- data/lib/growwer/models/order_delivery.rb +1 -1
- data/lib/growwer/models/order_draft.rb +1 -1
- data/lib/growwer/models/order_estimate.rb +1 -1
- data/lib/growwer/models/order_estimate_request.rb +1 -1
- data/lib/growwer/models/order_estimate_request_briefing.rb +1 -1
- data/lib/growwer/models/order_event_data.rb +165 -0
- data/lib/growwer/models/order_link.rb +1 -1
- data/lib/growwer/models/order_link_request.rb +1 -1
- data/lib/growwer/models/order_media.rb +1 -1
- data/lib/growwer/models/order_project.rb +1 -1
- data/lib/growwer/models/order_state_history_inner.rb +1 -1
- data/lib/growwer/models/order_state_history_inner_reason.rb +1 -1
- data/lib/growwer/models/post_order_briefing.rb +1 -1
- data/lib/growwer/models/post_order_briefing_request.rb +1 -1
- data/lib/growwer/models/project.rb +1 -1
- data/lib/growwer/models/project_catalogue_media.rb +1 -1
- data/lib/growwer/models/project_catalogue_media_all_of_project.rb +1 -1
- data/lib/growwer/models/project_catalogue_media_all_of_project_ai_keywords.rb +1 -1
- data/lib/growwer/models/put_seller_holiday200_response.rb +1 -1
- data/lib/growwer/models/put_seller_holiday_request.rb +1 -1
- data/lib/growwer/models/request_medias201_response.rb +1 -1
- data/lib/growwer/models/request_medias_request.rb +1 -1
- data/lib/growwer/models/saved_filter.rb +1 -1
- data/lib/growwer/models/saved_filter_notifications.rb +1 -1
- data/lib/growwer/models/seller_fees.rb +1 -1
- data/lib/growwer/models/seller_fees_or_null.rb +1 -1
- data/lib/growwer/models/seller_media.rb +18 -3
- data/lib/growwer/models/seller_media_competitive_fees_by_link_type_inner.rb +214 -0
- data/lib/growwer/models/seller_media_flash_offer.rb +1 -1
- data/lib/growwer/models/seller_media_link_addition_offer.rb +1 -1
- data/lib/growwer/models/seller_media_link_addition_offer_pricing_options_inner.rb +1 -1
- data/lib/growwer/models/seller_media_post_offer.rb +1 -1
- data/lib/growwer/models/seller_media_post_offer_pricing_options_inner.rb +1 -1
- data/lib/growwer/models/seller_order.rb +1 -1
- data/lib/growwer/models/seller_order_briefing.rb +1 -1
- data/lib/growwer/models/seller_order_channel.rb +1 -1
- data/lib/growwer/models/seller_order_draft.rb +1 -1
- data/lib/growwer/models/seller_order_draft_file.rb +1 -1
- data/lib/growwer/models/seller_order_post_delivery.rb +1 -1
- data/lib/growwer/models/seller_order_project.rb +1 -1
- data/lib/growwer/models/seller_order_refutation.rb +1 -1
- data/lib/growwer/models/seller_order_rejection.rb +1 -1
- data/lib/growwer/models/seller_order_rejection_reason.rb +1 -1
- data/lib/growwer/models/seller_post_order_briefing.rb +1 -1
- data/lib/growwer/models/seller_transaction.rb +1 -1
- data/lib/growwer/models/top_up_test_wallet200_response.rb +191 -0
- data/lib/growwer/models/top_up_test_wallet_request.rb +165 -0
- data/lib/growwer/models/transaction.rb +1 -1
- data/lib/growwer/models/update_project_request.rb +1 -1
- data/lib/growwer/models/update_seller_media_request.rb +1 -1
- data/lib/growwer/models/update_seller_media_request_extra_services_inner.rb +1 -1
- data/lib/growwer/models/update_seller_media_request_link_addition_offer.rb +1 -1
- data/lib/growwer/models/update_seller_media_request_link_addition_offer_pricing_options_inner.rb +1 -1
- data/lib/growwer/models/update_seller_media_request_post_offer.rb +1 -1
- data/lib/growwer/models/update_seller_media_request_post_offer_pricing_options_inner.rb +1 -1
- data/lib/growwer/models/update_webhook_request.rb +245 -0
- data/lib/growwer/models/upload_file201_response.rb +1 -1
- data/lib/growwer/models/webhook.rb +395 -0
- data/lib/growwer/models/webhook_delivery.rb +365 -0
- data/lib/growwer/models/webhook_delivery_attempt.rb +264 -0
- data/lib/growwer/models/webhook_event.rb +324 -0
- data/lib/growwer/models/webhook_event_data.rb +104 -0
- data/lib/growwer/models/webhook_event_type.rb +46 -0
- data/lib/growwer/models/webhook_test_event_data.rb +166 -0
- data/lib/growwer/models/webhook_with_secret.rb +413 -0
- data/lib/growwer/models/withdrawal.rb +1 -1
- data/lib/growwer/version.rb +2 -2
- data/lib/growwer.rb +22 -1
- data/spec/api/test_helpers_api_spec.rb +74 -0
- data/spec/api/webhooks_api_spec.rb +154 -0
- data/spec/models/advance_test_order_request_spec.rb +40 -0
- data/spec/models/balance_low_event_data_spec.rb +42 -0
- data/spec/models/balance_low_event_data_wallet_spec.rb +42 -0
- data/spec/models/create_webhook_request_spec.rb +54 -0
- data/spec/models/list_webhook_deliveries200_response_spec.rb +42 -0
- data/spec/models/list_webhooks200_response_spec.rb +42 -0
- data/spec/models/order_event_data_spec.rb +36 -0
- data/spec/models/seller_media_competitive_fees_by_link_type_inner_spec.rb +52 -0
- data/spec/models/top_up_test_wallet200_response_spec.rb +42 -0
- data/spec/models/top_up_test_wallet_request_spec.rb +36 -0
- data/spec/models/update_webhook_request_spec.rb +60 -0
- data/spec/models/webhook_delivery_attempt_spec.rb +64 -0
- data/spec/models/webhook_delivery_spec.rb +86 -0
- data/spec/models/webhook_event_data_spec.rb +32 -0
- data/spec/models/webhook_event_spec.rb +78 -0
- data/spec/models/webhook_event_type_spec.rb +30 -0
- data/spec/models/webhook_spec.rb +100 -0
- data/spec/models/webhook_test_event_data_spec.rb +36 -0
- data/spec/models/webhook_with_secret_spec.rb +106 -0
- data/spec/spec_helper.rb +1 -1
- metadata +86 -2
|
@@ -0,0 +1,707 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Growwer API
|
|
3
|
+
|
|
4
|
+
#The Growwer customer API. Authenticate every call with an API key created on your profile page, sent as `Authorization: Bearer <key>`. A read key can call every GET operation; writes need a read and write key and an `Idempotency-Key` header. Idempotency: use a new `Idempotency-Key` (1 to 255 printable ASCII characters without spaces) for each operation and reuse it only to retry that same operation. Keys belong to your account, not to one API key. - A successful write is stored for 30 days: a retry with the same key and the same request replays its response with `Idempotent-Replayed: true` and does nothing again. - A refused write (4xx) has no effect and releases its key: once you fix the cause, retry with the same key and the write runs. - A failed write (5xx) may have taken effect, so it is never run again under its key: a retry gets 409 `idempotency_outcome_unknown`. Check whether it took effect before retrying with a new key. - A retry while the first request is still running gets 409 `idempotency_request_in_progress`. A request still running after 5 minutes is treated as failed: a retry gets 409 `idempotency_outcome_unknown`. - The same key with a different request (method, path, query or body) gets 409 `idempotency_key_reused`. A write without the header gets 400 `idempotency_key_required`. Test mode: a test key (`gw_sk_test_` plus 43 characters) works on your account's test data alone, apart from the real catalogue: test projects, orders and files, and a test wallet that starts at 1,000.00 EUR. Every response to a test key carries `Growwer-Mode: test`, and an id of the other mode answers 404 as a missing object would. - A test order is validated and debited from the test wallet as a live one is. A simulated seller accepts it a minute later and delivers it two minutes after that; you approve the delivery or request an update. - The Test helpers top the test wallet up, move a test order on at once and reset your test data. A live key on them gets 403 `test_mode_only`. - A test key on the seller and managed service operations, on a project's catalogue writes and on media requests gets 403 `not_available_in_test_mode`. - Idempotency keys are scoped per mode: the same `Idempotency-Key` sent with a live and a test key never replays the other mode's response. Webhooks: a subscription receives the events of its mode, signed as Standard Webhooks. A subscription created with a live key gets the events of your orders and your wallet; one created with a test key gets those of your test orders and test wallet, with `mode: test`, and never a live event. `x-webhooks` lists every event Growwer POSTs and its payload; the WebhookEvent schema describes the headers, the signature and the retries. Every response carries `X-Request-Id`. Errors share one shape, `{code, message, requestId, details?}`. Money is integer cents plus a currency code (12500 is 125.00 EUR), answered with `amountDecimal`, the same amount as an exact decimal string (\"125.00\"); dates are ISO-8601.
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1
|
|
7
|
+
Contact: support@growwer.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.24.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'cgi'
|
|
14
|
+
|
|
15
|
+
module Growwer
|
|
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 a webhook subscription
|
|
23
|
+
# Subscribes an HTTPS URL to the events you list. Growwer then POSTs each event to it, signed as Standard Webhooks signs (`webhook-id`, `webhook-timestamp`, `webhook-signature`) with the `secret` this answer carries. The secret is shown only here and on POST /webhooks/{id}/rotate-secret: store it now. A replay of this request under its `Idempotency-Key` answers the subscription without it. The URL must be HTTPS and its host must resolve to public addresses only: a loopback, private, link-local, multicast or metadata address is refused with 422 `webhook_url_not_public`, a host that does not resolve with 422 `webhook_url_unresolvable`. `lowBalanceThreshold` is required with `balance.low` and refused without it. An account has at most 20 subscriptions per mode. A test key subscribes in test mode: its subscriptions get the events of its test orders and test wallet, never live ones.
|
|
24
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
25
|
+
# @param create_webhook_request [CreateWebhookRequest]
|
|
26
|
+
# @param [Hash] opts the optional parameters
|
|
27
|
+
# @return [WebhookWithSecret]
|
|
28
|
+
def create_webhook(idempotency_key, create_webhook_request, opts = {})
|
|
29
|
+
data, _status_code, _headers = create_webhook_with_http_info(idempotency_key, create_webhook_request, opts)
|
|
30
|
+
data
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Create a webhook subscription
|
|
34
|
+
# Subscribes an HTTPS URL to the events you list. Growwer then POSTs each event to it, signed as Standard Webhooks signs (`webhook-id`, `webhook-timestamp`, `webhook-signature`) with the `secret` this answer carries. The secret is shown only here and on POST /webhooks/{id}/rotate-secret: store it now. A replay of this request under its `Idempotency-Key` answers the subscription without it. The URL must be HTTPS and its host must resolve to public addresses only: a loopback, private, link-local, multicast or metadata address is refused with 422 `webhook_url_not_public`, a host that does not resolve with 422 `webhook_url_unresolvable`. `lowBalanceThreshold` is required with `balance.low` and refused without it. An account has at most 20 subscriptions per mode. A test key subscribes in test mode: its subscriptions get the events of its test orders and test wallet, never live ones.
|
|
35
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
36
|
+
# @param create_webhook_request [CreateWebhookRequest]
|
|
37
|
+
# @param [Hash] opts the optional parameters
|
|
38
|
+
# @return [Array<(WebhookWithSecret, Integer, Hash)>] WebhookWithSecret data, response status code and response headers
|
|
39
|
+
def create_webhook_with_http_info(idempotency_key, create_webhook_request, opts = {})
|
|
40
|
+
if @api_client.config.debugging
|
|
41
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.create_webhook ...'
|
|
42
|
+
end
|
|
43
|
+
# verify the required parameter 'idempotency_key' is set
|
|
44
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
45
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling WebhooksApi.create_webhook"
|
|
46
|
+
end
|
|
47
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
|
|
48
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling WebhooksApi.create_webhook, the character length must be smaller than or equal to 255.'
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# verify the required parameter 'create_webhook_request' is set
|
|
52
|
+
if @api_client.config.client_side_validation && create_webhook_request.nil?
|
|
53
|
+
fail ArgumentError, "Missing the required parameter 'create_webhook_request' when calling WebhooksApi.create_webhook"
|
|
54
|
+
end
|
|
55
|
+
# resource path
|
|
56
|
+
local_var_path = '/api/v1/webhooks'
|
|
57
|
+
|
|
58
|
+
# query parameters
|
|
59
|
+
query_params = opts[:query_params] || {}
|
|
60
|
+
|
|
61
|
+
# header parameters
|
|
62
|
+
header_params = opts[:header_params] || {}
|
|
63
|
+
# HTTP header 'Accept' (if needed)
|
|
64
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
65
|
+
# HTTP header 'Content-Type'
|
|
66
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
67
|
+
if !content_type.nil?
|
|
68
|
+
header_params['Content-Type'] = content_type
|
|
69
|
+
end
|
|
70
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
71
|
+
|
|
72
|
+
# form parameters
|
|
73
|
+
form_params = opts[:form_params] || {}
|
|
74
|
+
|
|
75
|
+
# http body (model)
|
|
76
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(create_webhook_request)
|
|
77
|
+
|
|
78
|
+
# return_type
|
|
79
|
+
return_type = opts[:debug_return_type] || 'WebhookWithSecret'
|
|
80
|
+
|
|
81
|
+
# auth_names
|
|
82
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
83
|
+
|
|
84
|
+
new_options = opts.merge(
|
|
85
|
+
:operation => :"WebhooksApi.create_webhook",
|
|
86
|
+
:header_params => header_params,
|
|
87
|
+
:query_params => query_params,
|
|
88
|
+
:form_params => form_params,
|
|
89
|
+
:body => post_body,
|
|
90
|
+
:auth_names => auth_names,
|
|
91
|
+
:return_type => return_type
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
95
|
+
if @api_client.config.debugging
|
|
96
|
+
@api_client.config.logger.debug "API called: WebhooksApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
97
|
+
end
|
|
98
|
+
return data, status_code, headers
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# Delete a webhook subscription
|
|
102
|
+
# Deletes one of your webhook subscriptions and its delivery log. Deliveries still pending are not sent.
|
|
103
|
+
# @param id [String] The subscription.
|
|
104
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
105
|
+
# @param [Hash] opts the optional parameters
|
|
106
|
+
# @return [nil]
|
|
107
|
+
def delete_webhook(id, idempotency_key, opts = {})
|
|
108
|
+
delete_webhook_with_http_info(id, idempotency_key, opts)
|
|
109
|
+
nil
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
# Delete a webhook subscription
|
|
113
|
+
# Deletes one of your webhook subscriptions and its delivery log. Deliveries still pending are not sent.
|
|
114
|
+
# @param id [String] The subscription.
|
|
115
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
116
|
+
# @param [Hash] opts the optional parameters
|
|
117
|
+
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
|
|
118
|
+
def delete_webhook_with_http_info(id, idempotency_key, opts = {})
|
|
119
|
+
if @api_client.config.debugging
|
|
120
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.delete_webhook ...'
|
|
121
|
+
end
|
|
122
|
+
# verify the required parameter 'id' is set
|
|
123
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
124
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.delete_webhook"
|
|
125
|
+
end
|
|
126
|
+
# verify the required parameter 'idempotency_key' is set
|
|
127
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
128
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling WebhooksApi.delete_webhook"
|
|
129
|
+
end
|
|
130
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
|
|
131
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling WebhooksApi.delete_webhook, the character length must be smaller than or equal to 255.'
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
# resource path
|
|
135
|
+
local_var_path = '/api/v1/webhooks/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
136
|
+
|
|
137
|
+
# query parameters
|
|
138
|
+
query_params = opts[:query_params] || {}
|
|
139
|
+
|
|
140
|
+
# header parameters
|
|
141
|
+
header_params = opts[:header_params] || {}
|
|
142
|
+
# HTTP header 'Accept' (if needed)
|
|
143
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
144
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
145
|
+
|
|
146
|
+
# form parameters
|
|
147
|
+
form_params = opts[:form_params] || {}
|
|
148
|
+
|
|
149
|
+
# http body (model)
|
|
150
|
+
post_body = opts[:debug_body]
|
|
151
|
+
|
|
152
|
+
# return_type
|
|
153
|
+
return_type = opts[:debug_return_type]
|
|
154
|
+
|
|
155
|
+
# auth_names
|
|
156
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
157
|
+
|
|
158
|
+
new_options = opts.merge(
|
|
159
|
+
:operation => :"WebhooksApi.delete_webhook",
|
|
160
|
+
:header_params => header_params,
|
|
161
|
+
:query_params => query_params,
|
|
162
|
+
:form_params => form_params,
|
|
163
|
+
:body => post_body,
|
|
164
|
+
:auth_names => auth_names,
|
|
165
|
+
:return_type => return_type
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
|
|
169
|
+
if @api_client.config.debugging
|
|
170
|
+
@api_client.config.logger.debug "API called: WebhooksApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
171
|
+
end
|
|
172
|
+
return data, status_code, headers
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
# Get a webhook subscription
|
|
176
|
+
# One of your webhook subscriptions, without its secret. A subscription of the other mode is not found.
|
|
177
|
+
# @param id [String] The subscription.
|
|
178
|
+
# @param [Hash] opts the optional parameters
|
|
179
|
+
# @return [Webhook]
|
|
180
|
+
def get_webhook(id, opts = {})
|
|
181
|
+
data, _status_code, _headers = get_webhook_with_http_info(id, opts)
|
|
182
|
+
data
|
|
183
|
+
end
|
|
184
|
+
|
|
185
|
+
# Get a webhook subscription
|
|
186
|
+
# One of your webhook subscriptions, without its secret. A subscription of the other mode is not found.
|
|
187
|
+
# @param id [String] The subscription.
|
|
188
|
+
# @param [Hash] opts the optional parameters
|
|
189
|
+
# @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
|
|
190
|
+
def get_webhook_with_http_info(id, opts = {})
|
|
191
|
+
if @api_client.config.debugging
|
|
192
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.get_webhook ...'
|
|
193
|
+
end
|
|
194
|
+
# verify the required parameter 'id' is set
|
|
195
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
196
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.get_webhook"
|
|
197
|
+
end
|
|
198
|
+
# resource path
|
|
199
|
+
local_var_path = '/api/v1/webhooks/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
200
|
+
|
|
201
|
+
# query parameters
|
|
202
|
+
query_params = opts[:query_params] || {}
|
|
203
|
+
|
|
204
|
+
# header parameters
|
|
205
|
+
header_params = opts[:header_params] || {}
|
|
206
|
+
# HTTP header 'Accept' (if needed)
|
|
207
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
208
|
+
|
|
209
|
+
# form parameters
|
|
210
|
+
form_params = opts[:form_params] || {}
|
|
211
|
+
|
|
212
|
+
# http body (model)
|
|
213
|
+
post_body = opts[:debug_body]
|
|
214
|
+
|
|
215
|
+
# return_type
|
|
216
|
+
return_type = opts[:debug_return_type] || 'Webhook'
|
|
217
|
+
|
|
218
|
+
# auth_names
|
|
219
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
220
|
+
|
|
221
|
+
new_options = opts.merge(
|
|
222
|
+
:operation => :"WebhooksApi.get_webhook",
|
|
223
|
+
:header_params => header_params,
|
|
224
|
+
:query_params => query_params,
|
|
225
|
+
:form_params => form_params,
|
|
226
|
+
:body => post_body,
|
|
227
|
+
:auth_names => auth_names,
|
|
228
|
+
:return_type => return_type
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
232
|
+
if @api_client.config.debugging
|
|
233
|
+
@api_client.config.logger.debug "API called: WebhooksApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
234
|
+
end
|
|
235
|
+
return data, status_code, headers
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# List the deliveries of a webhook subscription
|
|
239
|
+
# The events sent to the subscription in the last 30 days, newest first, each with its status and its latest 10 attempts: when, the status code your endpoint answered, how long it took and the start of its response body. Older deliveries are deleted.
|
|
240
|
+
# @param id [String] The subscription.
|
|
241
|
+
# @param [Hash] opts the optional parameters
|
|
242
|
+
# @option opts [Integer] :limit Deliveries per page, 1 to 100. (default to 20)
|
|
243
|
+
# @option opts [Integer] :offset Deliveries to skip. (default to 0)
|
|
244
|
+
# @return [ListWebhookDeliveries200Response]
|
|
245
|
+
def list_webhook_deliveries(id, opts = {})
|
|
246
|
+
data, _status_code, _headers = list_webhook_deliveries_with_http_info(id, opts)
|
|
247
|
+
data
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# List the deliveries of a webhook subscription
|
|
251
|
+
# The events sent to the subscription in the last 30 days, newest first, each with its status and its latest 10 attempts: when, the status code your endpoint answered, how long it took and the start of its response body. Older deliveries are deleted.
|
|
252
|
+
# @param id [String] The subscription.
|
|
253
|
+
# @param [Hash] opts the optional parameters
|
|
254
|
+
# @option opts [Integer] :limit Deliveries per page, 1 to 100. (default to 20)
|
|
255
|
+
# @option opts [Integer] :offset Deliveries to skip. (default to 0)
|
|
256
|
+
# @return [Array<(ListWebhookDeliveries200Response, Integer, Hash)>] ListWebhookDeliveries200Response data, response status code and response headers
|
|
257
|
+
def list_webhook_deliveries_with_http_info(id, opts = {})
|
|
258
|
+
if @api_client.config.debugging
|
|
259
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhook_deliveries ...'
|
|
260
|
+
end
|
|
261
|
+
# verify the required parameter 'id' is set
|
|
262
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
263
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.list_webhook_deliveries"
|
|
264
|
+
end
|
|
265
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
|
|
266
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.list_webhook_deliveries, must be smaller than or equal to 100.'
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
270
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.list_webhook_deliveries, must be greater than or equal to 1.'
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
|
274
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling WebhooksApi.list_webhook_deliveries, must be greater than or equal to 0.'
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
# resource path
|
|
278
|
+
local_var_path = '/api/v1/webhooks/{id}/deliveries'.sub('{id}', CGI.escape(id.to_s))
|
|
279
|
+
|
|
280
|
+
# query parameters
|
|
281
|
+
query_params = opts[:query_params] || {}
|
|
282
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
283
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
284
|
+
|
|
285
|
+
# header parameters
|
|
286
|
+
header_params = opts[:header_params] || {}
|
|
287
|
+
# HTTP header 'Accept' (if needed)
|
|
288
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
289
|
+
|
|
290
|
+
# form parameters
|
|
291
|
+
form_params = opts[:form_params] || {}
|
|
292
|
+
|
|
293
|
+
# http body (model)
|
|
294
|
+
post_body = opts[:debug_body]
|
|
295
|
+
|
|
296
|
+
# return_type
|
|
297
|
+
return_type = opts[:debug_return_type] || 'ListWebhookDeliveries200Response'
|
|
298
|
+
|
|
299
|
+
# auth_names
|
|
300
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
301
|
+
|
|
302
|
+
new_options = opts.merge(
|
|
303
|
+
:operation => :"WebhooksApi.list_webhook_deliveries",
|
|
304
|
+
:header_params => header_params,
|
|
305
|
+
:query_params => query_params,
|
|
306
|
+
:form_params => form_params,
|
|
307
|
+
:body => post_body,
|
|
308
|
+
:auth_names => auth_names,
|
|
309
|
+
:return_type => return_type
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
313
|
+
if @api_client.config.debugging
|
|
314
|
+
@api_client.config.logger.debug "API called: WebhooksApi#list_webhook_deliveries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
315
|
+
end
|
|
316
|
+
return data, status_code, headers
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
# List your webhook subscriptions
|
|
320
|
+
# Your webhook subscriptions in the mode of the key, newest first, disabled ones included. A live key lists the live ones and a test key the test ones.
|
|
321
|
+
# @param [Hash] opts the optional parameters
|
|
322
|
+
# @option opts [Integer] :limit Subscriptions per page, 1 to 100. (default to 20)
|
|
323
|
+
# @option opts [Integer] :offset Subscriptions to skip. (default to 0)
|
|
324
|
+
# @return [ListWebhooks200Response]
|
|
325
|
+
def list_webhooks(opts = {})
|
|
326
|
+
data, _status_code, _headers = list_webhooks_with_http_info(opts)
|
|
327
|
+
data
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
# List your webhook subscriptions
|
|
331
|
+
# Your webhook subscriptions in the mode of the key, newest first, disabled ones included. A live key lists the live ones and a test key the test ones.
|
|
332
|
+
# @param [Hash] opts the optional parameters
|
|
333
|
+
# @option opts [Integer] :limit Subscriptions per page, 1 to 100. (default to 20)
|
|
334
|
+
# @option opts [Integer] :offset Subscriptions to skip. (default to 0)
|
|
335
|
+
# @return [Array<(ListWebhooks200Response, Integer, Hash)>] ListWebhooks200Response data, response status code and response headers
|
|
336
|
+
def list_webhooks_with_http_info(opts = {})
|
|
337
|
+
if @api_client.config.debugging
|
|
338
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.list_webhooks ...'
|
|
339
|
+
end
|
|
340
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
|
|
341
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.list_webhooks, must be smaller than or equal to 100.'
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
|
|
345
|
+
fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling WebhooksApi.list_webhooks, must be greater than or equal to 1.'
|
|
346
|
+
end
|
|
347
|
+
|
|
348
|
+
if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0
|
|
349
|
+
fail ArgumentError, 'invalid value for "opts[:"offset"]" when calling WebhooksApi.list_webhooks, must be greater than or equal to 0.'
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
# resource path
|
|
353
|
+
local_var_path = '/api/v1/webhooks'
|
|
354
|
+
|
|
355
|
+
# query parameters
|
|
356
|
+
query_params = opts[:query_params] || {}
|
|
357
|
+
query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
|
|
358
|
+
query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
|
|
359
|
+
|
|
360
|
+
# header parameters
|
|
361
|
+
header_params = opts[:header_params] || {}
|
|
362
|
+
# HTTP header 'Accept' (if needed)
|
|
363
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
364
|
+
|
|
365
|
+
# form parameters
|
|
366
|
+
form_params = opts[:form_params] || {}
|
|
367
|
+
|
|
368
|
+
# http body (model)
|
|
369
|
+
post_body = opts[:debug_body]
|
|
370
|
+
|
|
371
|
+
# return_type
|
|
372
|
+
return_type = opts[:debug_return_type] || 'ListWebhooks200Response'
|
|
373
|
+
|
|
374
|
+
# auth_names
|
|
375
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
376
|
+
|
|
377
|
+
new_options = opts.merge(
|
|
378
|
+
:operation => :"WebhooksApi.list_webhooks",
|
|
379
|
+
:header_params => header_params,
|
|
380
|
+
:query_params => query_params,
|
|
381
|
+
:form_params => form_params,
|
|
382
|
+
:body => post_body,
|
|
383
|
+
:auth_names => auth_names,
|
|
384
|
+
:return_type => return_type
|
|
385
|
+
)
|
|
386
|
+
|
|
387
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
|
388
|
+
if @api_client.config.debugging
|
|
389
|
+
@api_client.config.logger.debug "API called: WebhooksApi#list_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
390
|
+
end
|
|
391
|
+
return data, status_code, headers
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
# Redeliver a webhook event
|
|
395
|
+
# Queues a delivery that has succeeded or failed again, in a new round of retries, and answers it. It sends the same event with the same `webhook-id`, so a consumer that dedupes by it handles it once. Deliveries are kept 30 days. A delivery still pending, being sent or waiting for its next retry, answers 409 `webhook_delivery_pending` and takes none of the hour's sends; so does a redelivery while the subscription has 10 test events and redeliveries pending, its limit for a redelivery, given in `details.limit`. The pending deliveries of events never redelivered do not count. A subscription takes at most 10 test events and redeliveries an hour: past them it answers 429 `webhook_send_limit_reached` with `Retry-After`. A disabled subscription answers 409 `webhook_disabled`.
|
|
396
|
+
# @param id [String] The subscription.
|
|
397
|
+
# @param delivery_id [String] The delivery.
|
|
398
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
399
|
+
# @param [Hash] opts the optional parameters
|
|
400
|
+
# @return [WebhookDelivery]
|
|
401
|
+
def redeliver_webhook(id, delivery_id, idempotency_key, opts = {})
|
|
402
|
+
data, _status_code, _headers = redeliver_webhook_with_http_info(id, delivery_id, idempotency_key, opts)
|
|
403
|
+
data
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
# Redeliver a webhook event
|
|
407
|
+
# Queues a delivery that has succeeded or failed again, in a new round of retries, and answers it. It sends the same event with the same `webhook-id`, so a consumer that dedupes by it handles it once. Deliveries are kept 30 days. A delivery still pending, being sent or waiting for its next retry, answers 409 `webhook_delivery_pending` and takes none of the hour's sends; so does a redelivery while the subscription has 10 test events and redeliveries pending, its limit for a redelivery, given in `details.limit`. The pending deliveries of events never redelivered do not count. A subscription takes at most 10 test events and redeliveries an hour: past them it answers 429 `webhook_send_limit_reached` with `Retry-After`. A disabled subscription answers 409 `webhook_disabled`.
|
|
408
|
+
# @param id [String] The subscription.
|
|
409
|
+
# @param delivery_id [String] The delivery.
|
|
410
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
411
|
+
# @param [Hash] opts the optional parameters
|
|
412
|
+
# @return [Array<(WebhookDelivery, Integer, Hash)>] WebhookDelivery data, response status code and response headers
|
|
413
|
+
def redeliver_webhook_with_http_info(id, delivery_id, idempotency_key, opts = {})
|
|
414
|
+
if @api_client.config.debugging
|
|
415
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.redeliver_webhook ...'
|
|
416
|
+
end
|
|
417
|
+
# verify the required parameter 'id' is set
|
|
418
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
419
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.redeliver_webhook"
|
|
420
|
+
end
|
|
421
|
+
# verify the required parameter 'delivery_id' is set
|
|
422
|
+
if @api_client.config.client_side_validation && delivery_id.nil?
|
|
423
|
+
fail ArgumentError, "Missing the required parameter 'delivery_id' when calling WebhooksApi.redeliver_webhook"
|
|
424
|
+
end
|
|
425
|
+
# verify the required parameter 'idempotency_key' is set
|
|
426
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
427
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling WebhooksApi.redeliver_webhook"
|
|
428
|
+
end
|
|
429
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
|
|
430
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling WebhooksApi.redeliver_webhook, the character length must be smaller than or equal to 255.'
|
|
431
|
+
end
|
|
432
|
+
|
|
433
|
+
# resource path
|
|
434
|
+
local_var_path = '/api/v1/webhooks/{id}/deliveries/{deliveryId}/redeliver'.sub('{id}', CGI.escape(id.to_s)).sub('{deliveryId}', CGI.escape(delivery_id.to_s))
|
|
435
|
+
|
|
436
|
+
# query parameters
|
|
437
|
+
query_params = opts[:query_params] || {}
|
|
438
|
+
|
|
439
|
+
# header parameters
|
|
440
|
+
header_params = opts[:header_params] || {}
|
|
441
|
+
# HTTP header 'Accept' (if needed)
|
|
442
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
443
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
444
|
+
|
|
445
|
+
# form parameters
|
|
446
|
+
form_params = opts[:form_params] || {}
|
|
447
|
+
|
|
448
|
+
# http body (model)
|
|
449
|
+
post_body = opts[:debug_body]
|
|
450
|
+
|
|
451
|
+
# return_type
|
|
452
|
+
return_type = opts[:debug_return_type] || 'WebhookDelivery'
|
|
453
|
+
|
|
454
|
+
# auth_names
|
|
455
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
456
|
+
|
|
457
|
+
new_options = opts.merge(
|
|
458
|
+
:operation => :"WebhooksApi.redeliver_webhook",
|
|
459
|
+
:header_params => header_params,
|
|
460
|
+
:query_params => query_params,
|
|
461
|
+
:form_params => form_params,
|
|
462
|
+
:body => post_body,
|
|
463
|
+
:auth_names => auth_names,
|
|
464
|
+
:return_type => return_type
|
|
465
|
+
)
|
|
466
|
+
|
|
467
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
468
|
+
if @api_client.config.debugging
|
|
469
|
+
@api_client.config.logger.debug "API called: WebhooksApi#redeliver_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
470
|
+
end
|
|
471
|
+
return data, status_code, headers
|
|
472
|
+
end
|
|
473
|
+
|
|
474
|
+
# Rotate a webhook secret
|
|
475
|
+
# Gives the subscription a new signing secret and answers it: it is shown only here, so store it now. For 24 hours, until `previousSecretExpiresAt`, every delivery carries two signatures in `webhook-signature`, one with each secret, so you can switch without missing an event; after that only the new secret signs. A replay of this request under its `Idempotency-Key` answers the subscription without the secret.
|
|
476
|
+
# @param id [String] The subscription.
|
|
477
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
478
|
+
# @param [Hash] opts the optional parameters
|
|
479
|
+
# @return [WebhookWithSecret]
|
|
480
|
+
def rotate_webhook_secret(id, idempotency_key, opts = {})
|
|
481
|
+
data, _status_code, _headers = rotate_webhook_secret_with_http_info(id, idempotency_key, opts)
|
|
482
|
+
data
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
# Rotate a webhook secret
|
|
486
|
+
# Gives the subscription a new signing secret and answers it: it is shown only here, so store it now. For 24 hours, until `previousSecretExpiresAt`, every delivery carries two signatures in `webhook-signature`, one with each secret, so you can switch without missing an event; after that only the new secret signs. A replay of this request under its `Idempotency-Key` answers the subscription without the secret.
|
|
487
|
+
# @param id [String] The subscription.
|
|
488
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
489
|
+
# @param [Hash] opts the optional parameters
|
|
490
|
+
# @return [Array<(WebhookWithSecret, Integer, Hash)>] WebhookWithSecret data, response status code and response headers
|
|
491
|
+
def rotate_webhook_secret_with_http_info(id, idempotency_key, opts = {})
|
|
492
|
+
if @api_client.config.debugging
|
|
493
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.rotate_webhook_secret ...'
|
|
494
|
+
end
|
|
495
|
+
# verify the required parameter 'id' is set
|
|
496
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
497
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.rotate_webhook_secret"
|
|
498
|
+
end
|
|
499
|
+
# verify the required parameter 'idempotency_key' is set
|
|
500
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
501
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling WebhooksApi.rotate_webhook_secret"
|
|
502
|
+
end
|
|
503
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
|
|
504
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling WebhooksApi.rotate_webhook_secret, the character length must be smaller than or equal to 255.'
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
# resource path
|
|
508
|
+
local_var_path = '/api/v1/webhooks/{id}/rotate-secret'.sub('{id}', CGI.escape(id.to_s))
|
|
509
|
+
|
|
510
|
+
# query parameters
|
|
511
|
+
query_params = opts[:query_params] || {}
|
|
512
|
+
|
|
513
|
+
# header parameters
|
|
514
|
+
header_params = opts[:header_params] || {}
|
|
515
|
+
# HTTP header 'Accept' (if needed)
|
|
516
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
517
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
518
|
+
|
|
519
|
+
# form parameters
|
|
520
|
+
form_params = opts[:form_params] || {}
|
|
521
|
+
|
|
522
|
+
# http body (model)
|
|
523
|
+
post_body = opts[:debug_body]
|
|
524
|
+
|
|
525
|
+
# return_type
|
|
526
|
+
return_type = opts[:debug_return_type] || 'WebhookWithSecret'
|
|
527
|
+
|
|
528
|
+
# auth_names
|
|
529
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
530
|
+
|
|
531
|
+
new_options = opts.merge(
|
|
532
|
+
:operation => :"WebhooksApi.rotate_webhook_secret",
|
|
533
|
+
:header_params => header_params,
|
|
534
|
+
:query_params => query_params,
|
|
535
|
+
:form_params => form_params,
|
|
536
|
+
:body => post_body,
|
|
537
|
+
:auth_names => auth_names,
|
|
538
|
+
:return_type => return_type
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
542
|
+
if @api_client.config.debugging
|
|
543
|
+
@api_client.config.logger.debug "API called: WebhooksApi#rotate_webhook_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
544
|
+
end
|
|
545
|
+
return data, status_code, headers
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
# Send a test event
|
|
549
|
+
# Queues a `webhook.test` event for the subscription, whatever events it lists, and answers its delivery: follow it on GET /webhooks/{id}/deliveries. It is signed, retried and logged as any event. It normally supersedes the subscription's earlier test events still pending: their deliveries fail and are not retried, so a test right after fixing the endpoint does not wait behind them; one that cannot be failed then is failed by the next test. A subscription takes at most 10 test events and redeliveries an hour: past them it answers 429 `webhook_send_limit_reached` with `Retry-After`. A disabled subscription answers 409 `webhook_disabled`. A test event that cannot be recorded answers 503 `webhook_test_unavailable`: nothing was sent, the attempt counts toward the hourly limit, and a retry needs a new `Idempotency-Key`.
|
|
550
|
+
# @param id [String] The subscription.
|
|
551
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
552
|
+
# @param [Hash] opts the optional parameters
|
|
553
|
+
# @return [WebhookDelivery]
|
|
554
|
+
def send_webhook_test(id, idempotency_key, opts = {})
|
|
555
|
+
data, _status_code, _headers = send_webhook_test_with_http_info(id, idempotency_key, opts)
|
|
556
|
+
data
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
# Send a test event
|
|
560
|
+
# Queues a `webhook.test` event for the subscription, whatever events it lists, and answers its delivery: follow it on GET /webhooks/{id}/deliveries. It is signed, retried and logged as any event. It normally supersedes the subscription's earlier test events still pending: their deliveries fail and are not retried, so a test right after fixing the endpoint does not wait behind them; one that cannot be failed then is failed by the next test. A subscription takes at most 10 test events and redeliveries an hour: past them it answers 429 `webhook_send_limit_reached` with `Retry-After`. A disabled subscription answers 409 `webhook_disabled`. A test event that cannot be recorded answers 503 `webhook_test_unavailable`: nothing was sent, the attempt counts toward the hourly limit, and a retry needs a new `Idempotency-Key`.
|
|
561
|
+
# @param id [String] The subscription.
|
|
562
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
563
|
+
# @param [Hash] opts the optional parameters
|
|
564
|
+
# @return [Array<(WebhookDelivery, Integer, Hash)>] WebhookDelivery data, response status code and response headers
|
|
565
|
+
def send_webhook_test_with_http_info(id, idempotency_key, opts = {})
|
|
566
|
+
if @api_client.config.debugging
|
|
567
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.send_webhook_test ...'
|
|
568
|
+
end
|
|
569
|
+
# verify the required parameter 'id' is set
|
|
570
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
571
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.send_webhook_test"
|
|
572
|
+
end
|
|
573
|
+
# verify the required parameter 'idempotency_key' is set
|
|
574
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
575
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling WebhooksApi.send_webhook_test"
|
|
576
|
+
end
|
|
577
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
|
|
578
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling WebhooksApi.send_webhook_test, the character length must be smaller than or equal to 255.'
|
|
579
|
+
end
|
|
580
|
+
|
|
581
|
+
# resource path
|
|
582
|
+
local_var_path = '/api/v1/webhooks/{id}/test'.sub('{id}', CGI.escape(id.to_s))
|
|
583
|
+
|
|
584
|
+
# query parameters
|
|
585
|
+
query_params = opts[:query_params] || {}
|
|
586
|
+
|
|
587
|
+
# header parameters
|
|
588
|
+
header_params = opts[:header_params] || {}
|
|
589
|
+
# HTTP header 'Accept' (if needed)
|
|
590
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
591
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
592
|
+
|
|
593
|
+
# form parameters
|
|
594
|
+
form_params = opts[:form_params] || {}
|
|
595
|
+
|
|
596
|
+
# http body (model)
|
|
597
|
+
post_body = opts[:debug_body]
|
|
598
|
+
|
|
599
|
+
# return_type
|
|
600
|
+
return_type = opts[:debug_return_type] || 'WebhookDelivery'
|
|
601
|
+
|
|
602
|
+
# auth_names
|
|
603
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
604
|
+
|
|
605
|
+
new_options = opts.merge(
|
|
606
|
+
:operation => :"WebhooksApi.send_webhook_test",
|
|
607
|
+
:header_params => header_params,
|
|
608
|
+
:query_params => query_params,
|
|
609
|
+
:form_params => form_params,
|
|
610
|
+
:body => post_body,
|
|
611
|
+
:auth_names => auth_names,
|
|
612
|
+
:return_type => return_type
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
|
|
616
|
+
if @api_client.config.debugging
|
|
617
|
+
@api_client.config.logger.debug "API called: WebhooksApi#send_webhook_test\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
618
|
+
end
|
|
619
|
+
return data, status_code, headers
|
|
620
|
+
end
|
|
621
|
+
|
|
622
|
+
# Edit a webhook subscription
|
|
623
|
+
# Changes only the fields you send. A new `url` is checked as on create. Dropping `balance.low` from `events` drops the threshold with it. `enabled: false` disables the subscription, which then gets no events; `enabled: true` enables it again, including one Growwer disabled because its endpoint answered 410 or failed for 5 days, and forgets its failures.
|
|
624
|
+
# @param id [String] The subscription.
|
|
625
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
626
|
+
# @param update_webhook_request [UpdateWebhookRequest]
|
|
627
|
+
# @param [Hash] opts the optional parameters
|
|
628
|
+
# @return [Webhook]
|
|
629
|
+
def update_webhook(id, idempotency_key, update_webhook_request, opts = {})
|
|
630
|
+
data, _status_code, _headers = update_webhook_with_http_info(id, idempotency_key, update_webhook_request, opts)
|
|
631
|
+
data
|
|
632
|
+
end
|
|
633
|
+
|
|
634
|
+
# Edit a webhook subscription
|
|
635
|
+
# Changes only the fields you send. A new `url` is checked as on create. Dropping `balance.low` from `events` drops the threshold with it. `enabled: false` disables the subscription, which then gets no events; `enabled: true` enables it again, including one Growwer disabled because its endpoint answered 410 or failed for 5 days, and forgets its failures.
|
|
636
|
+
# @param id [String] The subscription.
|
|
637
|
+
# @param idempotency_key [String] A new key for each write, reused only to retry that same write. 1 to 255 printable ASCII characters without spaces (`!` to `~`); any other value answers 400 `invalid_idempotency_key`.
|
|
638
|
+
# @param update_webhook_request [UpdateWebhookRequest]
|
|
639
|
+
# @param [Hash] opts the optional parameters
|
|
640
|
+
# @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
|
|
641
|
+
def update_webhook_with_http_info(id, idempotency_key, update_webhook_request, opts = {})
|
|
642
|
+
if @api_client.config.debugging
|
|
643
|
+
@api_client.config.logger.debug 'Calling API: WebhooksApi.update_webhook ...'
|
|
644
|
+
end
|
|
645
|
+
# verify the required parameter 'id' is set
|
|
646
|
+
if @api_client.config.client_side_validation && id.nil?
|
|
647
|
+
fail ArgumentError, "Missing the required parameter 'id' when calling WebhooksApi.update_webhook"
|
|
648
|
+
end
|
|
649
|
+
# verify the required parameter 'idempotency_key' is set
|
|
650
|
+
if @api_client.config.client_side_validation && idempotency_key.nil?
|
|
651
|
+
fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling WebhooksApi.update_webhook"
|
|
652
|
+
end
|
|
653
|
+
if @api_client.config.client_side_validation && idempotency_key.to_s.length > 255
|
|
654
|
+
fail ArgumentError, 'invalid value for "idempotency_key" when calling WebhooksApi.update_webhook, the character length must be smaller than or equal to 255.'
|
|
655
|
+
end
|
|
656
|
+
|
|
657
|
+
# verify the required parameter 'update_webhook_request' is set
|
|
658
|
+
if @api_client.config.client_side_validation && update_webhook_request.nil?
|
|
659
|
+
fail ArgumentError, "Missing the required parameter 'update_webhook_request' when calling WebhooksApi.update_webhook"
|
|
660
|
+
end
|
|
661
|
+
# resource path
|
|
662
|
+
local_var_path = '/api/v1/webhooks/{id}'.sub('{id}', CGI.escape(id.to_s))
|
|
663
|
+
|
|
664
|
+
# query parameters
|
|
665
|
+
query_params = opts[:query_params] || {}
|
|
666
|
+
|
|
667
|
+
# header parameters
|
|
668
|
+
header_params = opts[:header_params] || {}
|
|
669
|
+
# HTTP header 'Accept' (if needed)
|
|
670
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
|
|
671
|
+
# HTTP header 'Content-Type'
|
|
672
|
+
content_type = @api_client.select_header_content_type(['application/json'])
|
|
673
|
+
if !content_type.nil?
|
|
674
|
+
header_params['Content-Type'] = content_type
|
|
675
|
+
end
|
|
676
|
+
header_params[:'Idempotency-Key'] = idempotency_key
|
|
677
|
+
|
|
678
|
+
# form parameters
|
|
679
|
+
form_params = opts[:form_params] || {}
|
|
680
|
+
|
|
681
|
+
# http body (model)
|
|
682
|
+
post_body = opts[:debug_body] || @api_client.object_to_http_body(update_webhook_request)
|
|
683
|
+
|
|
684
|
+
# return_type
|
|
685
|
+
return_type = opts[:debug_return_type] || 'Webhook'
|
|
686
|
+
|
|
687
|
+
# auth_names
|
|
688
|
+
auth_names = opts[:debug_auth_names] || ['apiKey']
|
|
689
|
+
|
|
690
|
+
new_options = opts.merge(
|
|
691
|
+
:operation => :"WebhooksApi.update_webhook",
|
|
692
|
+
:header_params => header_params,
|
|
693
|
+
:query_params => query_params,
|
|
694
|
+
:form_params => form_params,
|
|
695
|
+
:body => post_body,
|
|
696
|
+
:auth_names => auth_names,
|
|
697
|
+
:return_type => return_type
|
|
698
|
+
)
|
|
699
|
+
|
|
700
|
+
data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
|
|
701
|
+
if @api_client.config.debugging
|
|
702
|
+
@api_client.config.logger.debug "API called: WebhooksApi#update_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
|
703
|
+
end
|
|
704
|
+
return data, status_code, headers
|
|
705
|
+
end
|
|
706
|
+
end
|
|
707
|
+
end
|