=begin #MailSlurp API #MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository The version of the OpenAPI document: 6.5.2 Contact: contact@mailslurp.dev Generated by: https://openapi-generator.tech OpenAPI Generator version: 4.3.1 =end require 'cgi' module MailSlurpClient class WebhookControllerApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Attach a WebHook URL to an inbox # Get notified of account level events such as bounce and bounce recipient. # @param create_webhook_options [CreateWebhookOptions] # @param [Hash] opts the optional parameters # @return [WebhookDto] def create_account_webhook(create_webhook_options, opts = {}) data, _status_code, _headers = create_account_webhook_with_http_info(create_webhook_options, opts) data end # Attach a WebHook URL to an inbox # Get notified of account level events such as bounce and bounce recipient. # @param create_webhook_options [CreateWebhookOptions] # @param [Hash] opts the optional parameters # @return [Array<(WebhookDto, Integer, Hash)>] WebhookDto data, response status code and response headers def create_account_webhook_with_http_info(create_webhook_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.create_account_webhook ...' end # verify the required parameter 'create_webhook_options' is set if @api_client.config.client_side_validation && create_webhook_options.nil? fail ArgumentError, "Missing the required parameter 'create_webhook_options' when calling WebhookControllerApi.create_account_webhook" end # resource path local_var_path = '/webhooks' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_webhook_options) # return_type return_type = opts[:return_type] || 'WebhookDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#create_account_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Attach a WebHook URL to an inbox # Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint. # @param inbox_id [String] # @param create_webhook_options [CreateWebhookOptions] # @param [Hash] opts the optional parameters # @return [WebhookDto] def create_webhook(inbox_id, create_webhook_options, opts = {}) data, _status_code, _headers = create_webhook_with_http_info(inbox_id, create_webhook_options, opts) data end # Attach a WebHook URL to an inbox # Get notified whenever an inbox receives an email via a WebHook URL. An emailID will be posted to this URL every time an email is received for this inbox. The URL must be publicly reachable by the MailSlurp server. You can provide basicAuth values if you wish to secure this endpoint. # @param inbox_id [String] # @param create_webhook_options [CreateWebhookOptions] # @param [Hash] opts the optional parameters # @return [Array<(WebhookDto, Integer, Hash)>] WebhookDto data, response status code and response headers def create_webhook_with_http_info(inbox_id, create_webhook_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.create_webhook ...' end # verify the required parameter 'inbox_id' is set if @api_client.config.client_side_validation && inbox_id.nil? fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WebhookControllerApi.create_webhook" end # verify the required parameter 'create_webhook_options' is set if @api_client.config.client_side_validation && create_webhook_options.nil? fail ArgumentError, "Missing the required parameter 'create_webhook_options' when calling WebhookControllerApi.create_webhook" end # resource path local_var_path = '/inboxes/{inboxId}/webhooks'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_webhook_options) # return_type return_type = opts[:return_type] || 'WebhookDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#create_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Attach a WebHook URL to a phone number # Get notified whenever a phone number receives an SMS via a WebHook URL. # @param phone_number_id [String] # @param create_webhook_options [CreateWebhookOptions] # @param [Hash] opts the optional parameters # @return [WebhookDto] def create_webhook_for_phone_number(phone_number_id, create_webhook_options, opts = {}) data, _status_code, _headers = create_webhook_for_phone_number_with_http_info(phone_number_id, create_webhook_options, opts) data end # Attach a WebHook URL to a phone number # Get notified whenever a phone number receives an SMS via a WebHook URL. # @param phone_number_id [String] # @param create_webhook_options [CreateWebhookOptions] # @param [Hash] opts the optional parameters # @return [Array<(WebhookDto, Integer, Hash)>] WebhookDto data, response status code and response headers def create_webhook_for_phone_number_with_http_info(phone_number_id, create_webhook_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.create_webhook_for_phone_number ...' end # verify the required parameter 'phone_number_id' is set if @api_client.config.client_side_validation && phone_number_id.nil? fail ArgumentError, "Missing the required parameter 'phone_number_id' when calling WebhookControllerApi.create_webhook_for_phone_number" end # verify the required parameter 'create_webhook_options' is set if @api_client.config.client_side_validation && create_webhook_options.nil? fail ArgumentError, "Missing the required parameter 'create_webhook_options' when calling WebhookControllerApi.create_webhook_for_phone_number" end # resource path local_var_path = '/phone/numbers/{phoneNumberId}/webhooks'.sub('{' + 'phoneNumberId' + '}', CGI.escape(phone_number_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(create_webhook_options) # return_type return_type = opts[:return_type] || 'WebhookDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#create_webhook_for_phone_number\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete all webhooks # @param [Hash] opts the optional parameters # @option opts [DateTime] :before before # @return [nil] def delete_all_webhooks(opts = {}) delete_all_webhooks_with_http_info(opts) nil end # Delete all webhooks # @param [Hash] opts the optional parameters # @option opts [DateTime] :before before # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_all_webhooks_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.delete_all_webhooks ...' end # resource path local_var_path = '/webhooks' # query parameters query_params = opts[:query_params] || {} query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#delete_all_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete and disable a Webhook for an Inbox # @param inbox_id [String] # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [nil] def delete_webhook(inbox_id, webhook_id, opts = {}) delete_webhook_with_http_info(inbox_id, webhook_id, opts) nil end # Delete and disable a Webhook for an Inbox # @param inbox_id [String] # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_webhook_with_http_info(inbox_id, webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.delete_webhook ...' end # verify the required parameter 'inbox_id' is set if @api_client.config.client_side_validation && inbox_id.nil? fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WebhookControllerApi.delete_webhook" end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.delete_webhook" end # resource path local_var_path = '/inboxes/{inboxId}/webhooks/{webhookId}'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s)).sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#delete_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a webhook # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [nil] def delete_webhook_by_id(webhook_id, opts = {}) delete_webhook_by_id_with_http_info(webhook_id, opts) nil end # Delete a webhook # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_webhook_by_id_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.delete_webhook_by_id ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.delete_webhook_by_id" end # resource path local_var_path = '/webhooks/{webhookId}'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#delete_webhook_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get results for all webhooks # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination (default to 0) # @option opts [Integer] :size Optional page size in list pagination (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [Boolean] :unseen_only Filter for unseen exceptions only # @return [PageWebhookResult] def get_all_webhook_results(opts = {}) data, _status_code, _headers = get_all_webhook_results_with_http_info(opts) data end # Get results for all webhooks # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination # @option opts [Integer] :size Optional page size in list pagination # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [Boolean] :unseen_only Filter for unseen exceptions only # @return [Array<(PageWebhookResult, Integer, Hash)>] PageWebhookResult data, response status code and response headers def get_all_webhook_results_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_all_webhook_results ...' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/webhooks/results' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'unseenOnly'] = opts[:'unseen_only'] if !opts[:'unseen_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageWebhookResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_all_webhook_results\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Webhooks Paginated # List webhooks in paginated form. Allows for page index, page size, and sort direction. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination (default to 0) # @option opts [Integer] :size Optional page size for paginated result list. (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'DESC') # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [String] :inbox_id Filter by inboxId # @option opts [String] :phone_id Filter by phoneId # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [PageWebhookProjection] def get_all_webhooks(opts = {}) data, _status_code, _headers = get_all_webhooks_with_http_info(opts) data end # List Webhooks Paginated # List webhooks in paginated form. Allows for page index, page size, and sort direction. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination # @option opts [Integer] :size Optional page size for paginated result list. # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [String] :inbox_id Filter by inboxId # @option opts [String] :phone_id Filter by phoneId # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [Array<(PageWebhookProjection, Integer, Hash)>] PageWebhookProjection data, response status code and response headers def get_all_webhooks_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_all_webhooks ...' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] > 9223372036854775807 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling WebhookControllerApi.get_all_webhooks, must be smaller than or equal to 9223372036854775807.' end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling WebhookControllerApi.get_all_webhooks, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling WebhookControllerApi.get_all_webhooks, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] < 1 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling WebhookControllerApi.get_all_webhooks, must be greater than or equal to 1.' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/webhooks/paginated' # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? query_params[:'phoneId'] = opts[:'phone_id'] if !opts[:'phone_id'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageWebhookProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_all_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get paginated webhooks for an Inbox # @param inbox_id [String] # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination (default to 0) # @option opts [Integer] :size Optional page size in list pagination (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [PageWebhookProjection] def get_inbox_webhooks_paginated(inbox_id, opts = {}) data, _status_code, _headers = get_inbox_webhooks_paginated_with_http_info(inbox_id, opts) data end # Get paginated webhooks for an Inbox # @param inbox_id [String] # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination # @option opts [Integer] :size Optional page size in list pagination # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [Array<(PageWebhookProjection, Integer, Hash)>] PageWebhookProjection data, response status code and response headers def get_inbox_webhooks_paginated_with_http_info(inbox_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_inbox_webhooks_paginated ...' end # verify the required parameter 'inbox_id' is set if @api_client.config.client_side_validation && inbox_id.nil? fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WebhookControllerApi.get_inbox_webhooks_paginated" end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/inboxes/{inboxId}/webhooks/paginated'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageWebhookProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_inbox_webhooks_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get JSON Schema definition for webhook payload by event # @param event [String] # @param [Hash] opts the optional parameters # @return [JSONSchemaDto] def get_json_schema_for_webhook_event(event, opts = {}) data, _status_code, _headers = get_json_schema_for_webhook_event_with_http_info(event, opts) data end # Get JSON Schema definition for webhook payload by event # @param event [String] # @param [Hash] opts the optional parameters # @return [Array<(JSONSchemaDto, Integer, Hash)>] JSONSchemaDto data, response status code and response headers def get_json_schema_for_webhook_event_with_http_info(event, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_json_schema_for_webhook_event ...' end # verify the required parameter 'event' is set if @api_client.config.client_side_validation && event.nil? fail ArgumentError, "Missing the required parameter 'event' when calling WebhookControllerApi.get_json_schema_for_webhook_event" end # verify enum value allowable_values = ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "DELIVERY_STATUS", "BOUNCE", "BOUNCE_RECIPIENT", "NEW_SMS"] if @api_client.config.client_side_validation && !allowable_values.include?(event) fail ArgumentError, "invalid value for \"event\", must be one of #{allowable_values}" end # resource path local_var_path = '/webhooks/schema' # query parameters query_params = opts[:query_params] || {} query_params[:'event'] = event # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'JSONSchemaDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_json_schema_for_webhook_event\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get JSON Schema definition for webhook payload # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [JSONSchemaDto] def get_json_schema_for_webhook_payload(webhook_id, opts = {}) data, _status_code, _headers = get_json_schema_for_webhook_payload_with_http_info(webhook_id, opts) data end # Get JSON Schema definition for webhook payload # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [Array<(JSONSchemaDto, Integer, Hash)>] JSONSchemaDto data, response status code and response headers def get_json_schema_for_webhook_payload_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_json_schema_for_webhook_payload ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.get_json_schema_for_webhook_payload" end # resource path local_var_path = '/webhooks/{webhookId}/schema'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'JSONSchemaDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_json_schema_for_webhook_payload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get paginated webhooks for a phone number # @param phone_id [String] # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination (default to 0) # @option opts [Integer] :size Optional page size in list pagination (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [PageWebhookProjection] def get_phone_number_webhooks_paginated(phone_id, opts = {}) data, _status_code, _headers = get_phone_number_webhooks_paginated_with_http_info(phone_id, opts) data end # Get paginated webhooks for a phone number # @param phone_id [String] # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination # @option opts [Integer] :size Optional page size in list pagination # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @return [Array<(PageWebhookProjection, Integer, Hash)>] PageWebhookProjection data, response status code and response headers def get_phone_number_webhooks_paginated_with_http_info(phone_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_phone_number_webhooks_paginated ...' end # verify the required parameter 'phone_id' is set if @api_client.config.client_side_validation && phone_id.nil? fail ArgumentError, "Missing the required parameter 'phone_id' when calling WebhookControllerApi.get_phone_number_webhooks_paginated" end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/phone/numbers/{phoneId}/webhooks/paginated'.sub('{' + 'phoneId' + '}', CGI.escape(phone_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageWebhookProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_phone_number_webhooks_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get test webhook payload example. Response content depends on eventName passed. Uses `EMAIL_RECEIVED` as default. # @param [Hash] opts the optional parameters # @option opts [String] :event_name # @return [AbstractWebhookPayload] def get_test_webhook_payload(opts = {}) data, _status_code, _headers = get_test_webhook_payload_with_http_info(opts) data end # Get test webhook payload example. Response content depends on eventName passed. Uses `EMAIL_RECEIVED` as default. # @param [Hash] opts the optional parameters # @option opts [String] :event_name # @return [Array<(AbstractWebhookPayload, Integer, Hash)>] AbstractWebhookPayload data, response status code and response headers def get_test_webhook_payload_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload ...' end allowable_values = ["EMAIL_RECEIVED", "NEW_EMAIL", "NEW_CONTACT", "NEW_ATTACHMENT", "EMAIL_OPENED", "EMAIL_READ", "DELIVERY_STATUS", "BOUNCE", "BOUNCE_RECIPIENT", "NEW_SMS"] if @api_client.config.client_side_validation && opts[:'event_name'] && !allowable_values.include?(opts[:'event_name']) fail ArgumentError, "invalid value for \"event_name\", must be one of #{allowable_values}" end # resource path local_var_path = '/webhooks/test' # query parameters query_params = opts[:query_params] || {} query_params[:'eventName'] = opts[:'event_name'] if !opts[:'event_name'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'AbstractWebhookPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for bounce # @param [Hash] opts the optional parameters # @return [WebhookBouncePayload] def get_test_webhook_payload_bounce(opts = {}) data, _status_code, _headers = get_test_webhook_payload_bounce_with_http_info(opts) data end # Get webhook test payload for bounce # @param [Hash] opts the optional parameters # @return [Array<(WebhookBouncePayload, Integer, Hash)>] WebhookBouncePayload data, response status code and response headers def get_test_webhook_payload_bounce_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_bounce ...' end # resource path local_var_path = '/webhooks/test/email-bounce-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookBouncePayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_bounce\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for bounce recipient # @param [Hash] opts the optional parameters # @return [WebhookBounceRecipientPayload] def get_test_webhook_payload_bounce_recipient(opts = {}) data, _status_code, _headers = get_test_webhook_payload_bounce_recipient_with_http_info(opts) data end # Get webhook test payload for bounce recipient # @param [Hash] opts the optional parameters # @return [Array<(WebhookBounceRecipientPayload, Integer, Hash)>] WebhookBounceRecipientPayload data, response status code and response headers def get_test_webhook_payload_bounce_recipient_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_bounce_recipient ...' end # resource path local_var_path = '/webhooks/test/email-bounce-recipient-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookBounceRecipientPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_bounce_recipient\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for delivery status event # @param [Hash] opts the optional parameters # @return [WebhookDeliveryStatusPayload] def get_test_webhook_payload_delivery_status(opts = {}) data, _status_code, _headers = get_test_webhook_payload_delivery_status_with_http_info(opts) data end # Get webhook test payload for delivery status event # @param [Hash] opts the optional parameters # @return [Array<(WebhookDeliveryStatusPayload, Integer, Hash)>] WebhookDeliveryStatusPayload data, response status code and response headers def get_test_webhook_payload_delivery_status_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_delivery_status ...' end # resource path local_var_path = '/webhooks/test/delivery-status-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookDeliveryStatusPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_delivery_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for email opened event # @param [Hash] opts the optional parameters # @return [WebhookEmailOpenedPayload] def get_test_webhook_payload_email_opened(opts = {}) data, _status_code, _headers = get_test_webhook_payload_email_opened_with_http_info(opts) data end # Get webhook test payload for email opened event # @param [Hash] opts the optional parameters # @return [Array<(WebhookEmailOpenedPayload, Integer, Hash)>] WebhookEmailOpenedPayload data, response status code and response headers def get_test_webhook_payload_email_opened_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_email_opened ...' end # resource path local_var_path = '/webhooks/test/email-opened-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookEmailOpenedPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_email_opened\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for email opened event # @param [Hash] opts the optional parameters # @return [WebhookEmailReadPayload] def get_test_webhook_payload_email_read(opts = {}) data, _status_code, _headers = get_test_webhook_payload_email_read_with_http_info(opts) data end # Get webhook test payload for email opened event # @param [Hash] opts the optional parameters # @return [Array<(WebhookEmailReadPayload, Integer, Hash)>] WebhookEmailReadPayload data, response status code and response headers def get_test_webhook_payload_email_read_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_email_read ...' end # resource path local_var_path = '/webhooks/test/email-read-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookEmailReadPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_email_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get example payload for webhook # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [AbstractWebhookPayload] def get_test_webhook_payload_for_webhook(webhook_id, opts = {}) data, _status_code, _headers = get_test_webhook_payload_for_webhook_with_http_info(webhook_id, opts) data end # Get example payload for webhook # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [Array<(AbstractWebhookPayload, Integer, Hash)>] AbstractWebhookPayload data, response status code and response headers def get_test_webhook_payload_for_webhook_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_for_webhook ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.get_test_webhook_payload_for_webhook" end # resource path local_var_path = '/webhooks/{webhookId}/example'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'AbstractWebhookPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_for_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for new attachment event # @param [Hash] opts the optional parameters # @return [WebhookNewAttachmentPayload] def get_test_webhook_payload_new_attachment(opts = {}) data, _status_code, _headers = get_test_webhook_payload_new_attachment_with_http_info(opts) data end # Get webhook test payload for new attachment event # @param [Hash] opts the optional parameters # @return [Array<(WebhookNewAttachmentPayload, Integer, Hash)>] WebhookNewAttachmentPayload data, response status code and response headers def get_test_webhook_payload_new_attachment_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_new_attachment ...' end # resource path local_var_path = '/webhooks/test/new-attachment-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookNewAttachmentPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_new_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for new contact event # @param [Hash] opts the optional parameters # @return [WebhookNewContactPayload] def get_test_webhook_payload_new_contact(opts = {}) data, _status_code, _headers = get_test_webhook_payload_new_contact_with_http_info(opts) data end # Get webhook test payload for new contact event # @param [Hash] opts the optional parameters # @return [Array<(WebhookNewContactPayload, Integer, Hash)>] WebhookNewContactPayload data, response status code and response headers def get_test_webhook_payload_new_contact_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_new_contact ...' end # resource path local_var_path = '/webhooks/test/new-contact-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookNewContactPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_new_contact\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for new email event # @param [Hash] opts the optional parameters # @return [WebhookNewEmailPayload] def get_test_webhook_payload_new_email(opts = {}) data, _status_code, _headers = get_test_webhook_payload_new_email_with_http_info(opts) data end # Get webhook test payload for new email event # @param [Hash] opts the optional parameters # @return [Array<(WebhookNewEmailPayload, Integer, Hash)>] WebhookNewEmailPayload data, response status code and response headers def get_test_webhook_payload_new_email_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_new_email ...' end # resource path local_var_path = '/webhooks/test/new-email-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookNewEmailPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_new_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get webhook test payload for new sms event # @param [Hash] opts the optional parameters # @return [WebhookNewSmsPayload] def get_test_webhook_payload_new_sms(opts = {}) data, _status_code, _headers = get_test_webhook_payload_new_sms_with_http_info(opts) data end # Get webhook test payload for new sms event # @param [Hash] opts the optional parameters # @return [Array<(WebhookNewSmsPayload, Integer, Hash)>] WebhookNewSmsPayload data, response status code and response headers def get_test_webhook_payload_new_sms_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_test_webhook_payload_new_sms ...' end # resource path local_var_path = '/webhooks/test/new-sms-payload' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookNewSmsPayload' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_test_webhook_payload_new_sms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a webhook # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [WebhookDto] def get_webhook(webhook_id, opts = {}) data, _status_code, _headers = get_webhook_with_http_info(webhook_id, opts) data end # Get a webhook # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [Array<(WebhookDto, Integer, Hash)>] WebhookDto data, response status code and response headers def get_webhook_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_webhook ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.get_webhook" end # resource path local_var_path = '/webhooks/{webhookId}'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_webhook\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a webhook result for a webhook # @param webhook_result_id [String] Webhook Result ID # @param [Hash] opts the optional parameters # @return [WebhookResultDto] def get_webhook_result(webhook_result_id, opts = {}) data, _status_code, _headers = get_webhook_result_with_http_info(webhook_result_id, opts) data end # Get a webhook result for a webhook # @param webhook_result_id [String] Webhook Result ID # @param [Hash] opts the optional parameters # @return [Array<(WebhookResultDto, Integer, Hash)>] WebhookResultDto data, response status code and response headers def get_webhook_result_with_http_info(webhook_result_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_webhook_result ...' end # verify the required parameter 'webhook_result_id' is set if @api_client.config.client_side_validation && webhook_result_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_result_id' when calling WebhookControllerApi.get_webhook_result" end # resource path local_var_path = '/webhooks/results/{webhookResultId}'.sub('{' + 'webhookResultId' + '}', CGI.escape(webhook_result_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookResultDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_webhook_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a webhook results for a webhook # @param webhook_id [String] ID of webhook to get results for # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination (default to 0) # @option opts [Integer] :size Optional page size in list pagination (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [Boolean] :unseen_only Filter for unseen exceptions only # @return [PageWebhookResult] def get_webhook_results(webhook_id, opts = {}) data, _status_code, _headers = get_webhook_results_with_http_info(webhook_id, opts) data end # Get a webhook results for a webhook # @param webhook_id [String] ID of webhook to get results for # @param [Hash] opts the optional parameters # @option opts [Integer] :page Optional page index in list pagination # @option opts [Integer] :size Optional page size in list pagination # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [String] :search_filter Optional search filter # @option opts [DateTime] :since Filter by created at after the given timestamp # @option opts [DateTime] :before Filter by created at before the given timestamp # @option opts [Boolean] :unseen_only Filter for unseen exceptions only # @return [Array<(PageWebhookResult, Integer, Hash)>] PageWebhookResult data, response status code and response headers def get_webhook_results_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_webhook_results ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.get_webhook_results" end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/webhooks/{webhookId}/results'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'unseenOnly'] = opts[:'unseen_only'] if !opts[:'unseen_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageWebhookResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_webhook_results\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get count of unseen webhook results with error status # @param [Hash] opts the optional parameters # @return [UnseenErrorCountDto] def get_webhook_results_unseen_error_count(opts = {}) data, _status_code, _headers = get_webhook_results_unseen_error_count_with_http_info(opts) data end # Get count of unseen webhook results with error status # @param [Hash] opts the optional parameters # @return [Array<(UnseenErrorCountDto, Integer, Hash)>] UnseenErrorCountDto data, response status code and response headers def get_webhook_results_unseen_error_count_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_webhook_results_unseen_error_count ...' end # resource path local_var_path = '/webhooks/results/unseen-count' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'UnseenErrorCountDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_webhook_results_unseen_error_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all webhooks for an Inbox # @param inbox_id [String] # @param [Hash] opts the optional parameters # @return [Array] def get_webhooks(inbox_id, opts = {}) data, _status_code, _headers = get_webhooks_with_http_info(inbox_id, opts) data end # Get all webhooks for an Inbox # @param inbox_id [String] # @param [Hash] opts the optional parameters # @return [Array<(Array, Integer, Hash)>] Array data, response status code and response headers def get_webhooks_with_http_info(inbox_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.get_webhooks ...' end # verify the required parameter 'inbox_id' is set if @api_client.config.client_side_validation && inbox_id.nil? fail ArgumentError, "Missing the required parameter 'inbox_id' when calling WebhookControllerApi.get_webhooks" end # resource path local_var_path = '/inboxes/{inboxId}/webhooks'.sub('{' + 'inboxId' + '}', CGI.escape(inbox_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#get_webhooks\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get a webhook result and try to resend the original webhook payload # Allows you to resend a webhook payload that was already sent. Webhooks that fail are retried automatically for 24 hours and then put in a dead letter queue. You can retry results manually using this method. # @param webhook_result_id [String] Webhook Result ID # @param [Hash] opts the optional parameters # @return [WebhookRedriveResult] def redrive_webhook_result(webhook_result_id, opts = {}) data, _status_code, _headers = redrive_webhook_result_with_http_info(webhook_result_id, opts) data end # Get a webhook result and try to resend the original webhook payload # Allows you to resend a webhook payload that was already sent. Webhooks that fail are retried automatically for 24 hours and then put in a dead letter queue. You can retry results manually using this method. # @param webhook_result_id [String] Webhook Result ID # @param [Hash] opts the optional parameters # @return [Array<(WebhookRedriveResult, Integer, Hash)>] WebhookRedriveResult data, response status code and response headers def redrive_webhook_result_with_http_info(webhook_result_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.redrive_webhook_result ...' end # verify the required parameter 'webhook_result_id' is set if @api_client.config.client_side_validation && webhook_result_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_result_id' when calling WebhookControllerApi.redrive_webhook_result" end # resource path local_var_path = '/webhooks/results/{webhookResultId}/redrive'.sub('{' + 'webhookResultId' + '}', CGI.escape(webhook_result_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookRedriveResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#redrive_webhook_result\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Send webhook test data # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [WebhookTestResult] def send_test_data(webhook_id, opts = {}) data, _status_code, _headers = send_test_data_with_http_info(webhook_id, opts) data end # Send webhook test data # @param webhook_id [String] # @param [Hash] opts the optional parameters # @return [Array<(WebhookTestResult, Integer, Hash)>] WebhookTestResult data, response status code and response headers def send_test_data_with_http_info(webhook_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.send_test_data ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.send_test_data" end # resource path local_var_path = '/webhooks/{webhookId}/test'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'WebhookTestResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#send_test_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a webhook request headers # @param webhook_id [String] # @param webhook_headers [WebhookHeaders] # @param [Hash] opts the optional parameters # @return [WebhookDto] def update_webhook_headers(webhook_id, webhook_headers, opts = {}) data, _status_code, _headers = update_webhook_headers_with_http_info(webhook_id, webhook_headers, opts) data end # Update a webhook request headers # @param webhook_id [String] # @param webhook_headers [WebhookHeaders] # @param [Hash] opts the optional parameters # @return [Array<(WebhookDto, Integer, Hash)>] WebhookDto data, response status code and response headers def update_webhook_headers_with_http_info(webhook_id, webhook_headers, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.update_webhook_headers ...' end # verify the required parameter 'webhook_id' is set if @api_client.config.client_side_validation && webhook_id.nil? fail ArgumentError, "Missing the required parameter 'webhook_id' when calling WebhookControllerApi.update_webhook_headers" end # verify the required parameter 'webhook_headers' is set if @api_client.config.client_side_validation && webhook_headers.nil? fail ArgumentError, "Missing the required parameter 'webhook_headers' when calling WebhookControllerApi.update_webhook_headers" end # resource path local_var_path = '/webhooks/{webhookId}/headers'.sub('{' + 'webhookId' + '}', CGI.escape(webhook_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(webhook_headers) # return_type return_type = opts[:return_type] || 'WebhookDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#update_webhook_headers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Verify a webhook payload signature # Verify a webhook payload using the messageId and signature. This allows you to be sure that MailSlurp sent the payload and not another server. # @param verify_webhook_signature_options [VerifyWebhookSignatureOptions] # @param [Hash] opts the optional parameters # @return [VerifyWebhookSignatureResults] def verify_webhook_signature(verify_webhook_signature_options, opts = {}) data, _status_code, _headers = verify_webhook_signature_with_http_info(verify_webhook_signature_options, opts) data end # Verify a webhook payload signature # Verify a webhook payload using the messageId and signature. This allows you to be sure that MailSlurp sent the payload and not another server. # @param verify_webhook_signature_options [VerifyWebhookSignatureOptions] # @param [Hash] opts the optional parameters # @return [Array<(VerifyWebhookSignatureResults, Integer, Hash)>] VerifyWebhookSignatureResults data, response status code and response headers def verify_webhook_signature_with_http_info(verify_webhook_signature_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: WebhookControllerApi.verify_webhook_signature ...' end # verify the required parameter 'verify_webhook_signature_options' is set if @api_client.config.client_side_validation && verify_webhook_signature_options.nil? fail ArgumentError, "Missing the required parameter 'verify_webhook_signature_options' when calling WebhookControllerApi.verify_webhook_signature" end # resource path local_var_path = '/webhooks/verify' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['*/*']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(verify_webhook_signature_options) # return_type return_type = opts[:return_type] || 'VerifyWebhookSignatureResults' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: WebhookControllerApi#verify_webhook_signature\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end