=begin #Svix API #No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The version of the OpenAPI document: 1.1.1 Generated by: https://openapi-generator.tech OpenAPI Generator version: 5.2.0 =end require 'cgi' module Svix class MessageApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create Message Attempt For Endpoint # Creates and sends a message to the specified endpoint. The message attempt and response from the endpoint is returned. FIXME: use MessageIn for expediency, even though the `application` parameter is unused. Since this endpoint isn't publicly documented anyway, it should be fine # @param app_id [String] The app's ID or UID # @param endpoint_id [String] The ep's ID or UID # @param message_in [MessageIn] # @param [Hash] opts the optional parameters # @option opts [String] :idempotency_key The request's idempotency key # @return [MessageAttemptOut] def create_message_attempt_for_endpoint(app_id, endpoint_id, message_in, opts = {}) data, _status_code, _headers = create_message_attempt_for_endpoint_with_http_info(app_id, endpoint_id, message_in, opts) data end # Create Message Attempt For Endpoint # Creates and sends a message to the specified endpoint. The message attempt and response from the endpoint is returned. FIXME: use MessageIn for expediency, even though the `application` parameter is unused. Since this endpoint isn't publicly documented anyway, it should be fine # @param app_id [String] The app's ID or UID # @param endpoint_id [String] The ep's ID or UID # @param message_in [MessageIn] # @param [Hash] opts the optional parameters # @option opts [String] :idempotency_key The request's idempotency key # @return [Array<(MessageAttemptOut, Integer, Hash)>] MessageAttemptOut data, response status code and response headers def create_message_attempt_for_endpoint_with_http_info(app_id, endpoint_id, message_in, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessageApi.create_message_attempt_for_endpoint ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.create_message_attempt_for_endpoint" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.create_message_attempt_for_endpoint, must conform to the pattern #{pattern}." end # verify the required parameter 'endpoint_id' is set if @api_client.config.client_side_validation && endpoint_id.nil? fail ArgumentError, "Missing the required parameter 'endpoint_id' when calling MessageApi.create_message_attempt_for_endpoint" end if @api_client.config.client_side_validation && endpoint_id.to_s.length > 256 fail ArgumentError, 'invalid value for "endpoint_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && endpoint_id.to_s.length < 1 fail ArgumentError, 'invalid value for "endpoint_id" when calling MessageApi.create_message_attempt_for_endpoint, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && endpoint_id !~ pattern fail ArgumentError, "invalid value for 'endpoint_id' when calling MessageApi.create_message_attempt_for_endpoint, must conform to the pattern #{pattern}." end # verify the required parameter 'message_in' is set if @api_client.config.client_side_validation && message_in.nil? fail ArgumentError, "Missing the required parameter 'message_in' when calling MessageApi.create_message_attempt_for_endpoint" end # resource path local_var_path = '/api/v1/app/{app_id}/endpoint/{endpoint_id}/msg/test-attempt/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'endpoint_id' + '}', CGI.escape(endpoint_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(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(message_in) # return_type return_type = opts[:debug_return_type] || 'MessageAttemptOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"MessageApi.create_message_attempt_for_endpoint", :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: MessageApi#create_message_attempt_for_endpoint\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create Message # Creates a new message and dispatches it to all of the application's endpoints. The `eventId` is an optional custom unique ID. It's verified to be unique only up to a day, after that no verification will be made. If a message with the same `eventId` already exists for any application in your environment, a 409 conflict error will be returned. The `eventType` indicates the type and schema of the event. All messages of a certain `eventType` are expected to have the same schema. Endpoints can choose to only listen to specific event types. Messages can also have `channels`, which similar to event types let endpoints filter by them. Unlike event types, messages can have multiple channels, and channels don't imply a specific message content or schema. The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to ~350kb, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb. # @param app_id [String] The app's ID or UID # @param message_in [MessageIn] # @param [Hash] opts the optional parameters # @option opts [Boolean] :with_content When `true` message payloads are included in the response (default to true) # @option opts [String] :idempotency_key The request's idempotency key # @return [MessageOut] def v1_message_create(app_id, message_in, opts = {}) data, _status_code, _headers = v1_message_create_with_http_info(app_id, message_in, opts) data end # Create Message # Creates a new message and dispatches it to all of the application's endpoints. The `eventId` is an optional custom unique ID. It's verified to be unique only up to a day, after that no verification will be made. If a message with the same `eventId` already exists for any application in your environment, a 409 conflict error will be returned. The `eventType` indicates the type and schema of the event. All messages of a certain `eventType` are expected to have the same schema. Endpoints can choose to only listen to specific event types. Messages can also have `channels`, which similar to event types let endpoints filter by them. Unlike event types, messages can have multiple channels, and channels don't imply a specific message content or schema. The `payload` property is the webhook's body (the actual webhook message). Svix supports payload sizes of up to ~350kb, though it's generally a good idea to keep webhook payloads small, probably no larger than 40kb. # @param app_id [String] The app's ID or UID # @param message_in [MessageIn] # @param [Hash] opts the optional parameters # @option opts [Boolean] :with_content When `true` message payloads are included in the response # @option opts [String] :idempotency_key The request's idempotency key # @return [Array<(MessageOut, Integer, Hash)>] MessageOut data, response status code and response headers def v1_message_create_with_http_info(app_id, message_in, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessageApi.v1_message_create ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.v1_message_create" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_create, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_create, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.v1_message_create, must conform to the pattern #{pattern}." end # verify the required parameter 'message_in' is set if @api_client.config.client_side_validation && message_in.nil? fail ArgumentError, "Missing the required parameter 'message_in' when calling MessageApi.v1_message_create" end # resource path local_var_path = '/api/v1/app/{app_id}/msg/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'with_content'] = opts[:'with_content'] if !opts[:'with_content'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'idempotency-key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(message_in) # return_type return_type = opts[:debug_return_type] || 'MessageOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"MessageApi.v1_message_create", :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: MessageApi#v1_message_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete message payload # Delete the given message's payload. Useful in cases when a message was accidentally sent with sensitive content. The message can't be replayed or resent once its payload has been deleted or expired. # @param app_id [String] The app's ID or UID # @param msg_id [String] The msg's ID or UID # @param [Hash] opts the optional parameters # @return [nil] def v1_message_expunge_content(app_id, msg_id, opts = {}) v1_message_expunge_content_with_http_info(app_id, msg_id, opts) nil end # Delete message payload # Delete the given message's payload. Useful in cases when a message was accidentally sent with sensitive content. The message can't be replayed or resent once its payload has been deleted or expired. # @param app_id [String] The app's ID or UID # @param msg_id [String] The msg's ID or UID # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def v1_message_expunge_content_with_http_info(app_id, msg_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessageApi.v1_message_expunge_content ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.v1_message_expunge_content" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_expunge_content, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_expunge_content, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.v1_message_expunge_content, must conform to the pattern #{pattern}." end # verify the required parameter 'msg_id' is set if @api_client.config.client_side_validation && msg_id.nil? fail ArgumentError, "Missing the required parameter 'msg_id' when calling MessageApi.v1_message_expunge_content" end if @api_client.config.client_side_validation && msg_id.to_s.length > 256 fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.v1_message_expunge_content, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && msg_id.to_s.length < 1 fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.v1_message_expunge_content, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && msg_id !~ pattern fail ArgumentError, "invalid value for 'msg_id' when calling MessageApi.v1_message_expunge_content, must conform to the pattern #{pattern}." end # resource path local_var_path = '/api/v1/app/{app_id}/msg/{msg_id}/content/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'msg_id' + '}', CGI.escape(msg_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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"MessageApi.v1_message_expunge_content", :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: MessageApi#v1_message_expunge_content\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Message # Get a message by its ID or eventID. # @param app_id [String] The app's ID or UID # @param msg_id [String] The msg's ID or UID # @param [Hash] opts the optional parameters # @option opts [Boolean] :with_content When `true` message payloads are included in the response (default to true) # @return [MessageOut] def v1_message_get(app_id, msg_id, opts = {}) data, _status_code, _headers = v1_message_get_with_http_info(app_id, msg_id, opts) data end # Get Message # Get a message by its ID or eventID. # @param app_id [String] The app's ID or UID # @param msg_id [String] The msg's ID or UID # @param [Hash] opts the optional parameters # @option opts [Boolean] :with_content When `true` message payloads are included in the response # @return [Array<(MessageOut, Integer, Hash)>] MessageOut data, response status code and response headers def v1_message_get_with_http_info(app_id, msg_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessageApi.v1_message_get ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.v1_message_get" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_get, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_get, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.v1_message_get, must conform to the pattern #{pattern}." end # verify the required parameter 'msg_id' is set if @api_client.config.client_side_validation && msg_id.nil? fail ArgumentError, "Missing the required parameter 'msg_id' when calling MessageApi.v1_message_get" end if @api_client.config.client_side_validation && msg_id.to_s.length > 256 fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.v1_message_get, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && msg_id.to_s.length < 1 fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.v1_message_get, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && msg_id !~ pattern fail ArgumentError, "invalid value for 'msg_id' when calling MessageApi.v1_message_get, must conform to the pattern #{pattern}." end # resource path local_var_path = '/api/v1/app/{app_id}/msg/{msg_id}/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'msg_id' + '}', CGI.escape(msg_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'with_content'] = opts[:'with_content'] if !opts[:'with_content'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'MessageOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"MessageApi.v1_message_get", :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: MessageApi#v1_message_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get Raw Message Payload # Get a message raw payload by its ID or eventID. # @param app_id [String] The app's ID or UID # @param msg_id [String] The msg's ID or UID # @param [Hash] opts the optional parameters # @return [MessageRawPayloadOut] def v1_message_get_raw_payload(app_id, msg_id, opts = {}) data, _status_code, _headers = v1_message_get_raw_payload_with_http_info(app_id, msg_id, opts) data end # Get Raw Message Payload # Get a message raw payload by its ID or eventID. # @param app_id [String] The app's ID or UID # @param msg_id [String] The msg's ID or UID # @param [Hash] opts the optional parameters # @return [Array<(MessageRawPayloadOut, Integer, Hash)>] MessageRawPayloadOut data, response status code and response headers def v1_message_get_raw_payload_with_http_info(app_id, msg_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessageApi.v1_message_get_raw_payload ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.v1_message_get_raw_payload" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_get_raw_payload, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_get_raw_payload, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.v1_message_get_raw_payload, must conform to the pattern #{pattern}." end # verify the required parameter 'msg_id' is set if @api_client.config.client_side_validation && msg_id.nil? fail ArgumentError, "Missing the required parameter 'msg_id' when calling MessageApi.v1_message_get_raw_payload" end if @api_client.config.client_side_validation && msg_id.to_s.length > 256 fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.v1_message_get_raw_payload, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && msg_id.to_s.length < 1 fail ArgumentError, 'invalid value for "msg_id" when calling MessageApi.v1_message_get_raw_payload, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && msg_id !~ pattern fail ArgumentError, "invalid value for 'msg_id' when calling MessageApi.v1_message_get_raw_payload, must conform to the pattern #{pattern}." end # resource path local_var_path = '/api/v1/app/{app_id}/msg/{msg_id}/raw/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)).sub('{' + 'msg_id' + '}', CGI.escape(msg_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(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'MessageRawPayloadOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"MessageApi.v1_message_get_raw_payload", :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: MessageApi#v1_message_get_raw_payload\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Messages # List all of the application's messages. The `before` and `after` parameters let you filter all items created before or after a certain date. These can be used alongside an iterator to paginate over results within a certain window. Note that by default this endpoint is limited to retrieving 90 days' worth of data relative to now or, if an iterator is provided, 90 days before/after the time indicated by the iterator ID. If you require data beyond those time ranges, you will need to explicitly set the `before` or `after` parameter as appropriate. # @param app_id [String] The app's ID or UID # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Limit the number of returned items # @option opts [String] :iterator The iterator returned from a prior invocation # @option opts [String] :channel Filter response based on the channel # @option opts [Time] :before Only include items created before a certain date # @option opts [Time] :after Only include items created after a certain date # @option opts [Boolean] :with_content When `true` message payloads are included in the response (default to true) # @option opts [Array] :event_types Filter response based on the event type # @return [ListResponseMessageOut] def v1_message_list(app_id, opts = {}) data, _status_code, _headers = v1_message_list_with_http_info(app_id, opts) data end # List Messages # List all of the application's messages. The `before` and `after` parameters let you filter all items created before or after a certain date. These can be used alongside an iterator to paginate over results within a certain window. Note that by default this endpoint is limited to retrieving 90 days' worth of data relative to now or, if an iterator is provided, 90 days before/after the time indicated by the iterator ID. If you require data beyond those time ranges, you will need to explicitly set the `before` or `after` parameter as appropriate. # @param app_id [String] The app's ID or UID # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Limit the number of returned items # @option opts [String] :iterator The iterator returned from a prior invocation # @option opts [String] :channel Filter response based on the channel # @option opts [Time] :before Only include items created before a certain date # @option opts [Time] :after Only include items created after a certain date # @option opts [Boolean] :with_content When `true` message payloads are included in the response # @option opts [Array] :event_types Filter response based on the event type # @return [Array<(ListResponseMessageOut, Integer, Hash)>] ListResponseMessageOut data, response status code and response headers def v1_message_list_with_http_info(app_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MessageApi.v1_message_list ...' end # verify the required parameter 'app_id' is set if @api_client.config.client_side_validation && app_id.nil? fail ArgumentError, "Missing the required parameter 'app_id' when calling MessageApi.v1_message_list" end if @api_client.config.client_side_validation && app_id.to_s.length > 256 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_list, the character length must be smaller than or equal to 256.' end if @api_client.config.client_side_validation && app_id.to_s.length < 1 fail ArgumentError, 'invalid value for "app_id" when calling MessageApi.v1_message_list, the character length must be great than or equal to 1.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && app_id !~ pattern fail ArgumentError, "invalid value for 'app_id' when calling MessageApi.v1_message_list, must conform to the pattern #{pattern}." end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 250 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessageApi.v1_message_list, must be smaller than or equal to 250.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MessageApi.v1_message_list, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'channel'].nil? && opts[:'channel'].to_s.length > 128 fail ArgumentError, 'invalid value for "opts[:"channel"]" when calling MessageApi.v1_message_list, the character length must be smaller than or equal to 128.' end pattern = Regexp.new(/^[a-zA-Z0-9\-_.]+$/) if @api_client.config.client_side_validation && !opts[:'channel'].nil? && opts[:'channel'] !~ pattern fail ArgumentError, "invalid value for 'opts[:\"channel\"]' when calling MessageApi.v1_message_list, must conform to the pattern #{pattern}." end # resource path local_var_path = '/api/v1/app/{app_id}/msg/'.sub('{' + 'app_id' + '}', CGI.escape(app_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'iterator'] = opts[:'iterator'] if !opts[:'iterator'].nil? query_params[:'channel'] = opts[:'channel'] if !opts[:'channel'].nil? query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil? query_params[:'with_content'] = opts[:'with_content'] if !opts[:'with_content'].nil? query_params[:'event_types'] = @api_client.build_collection_param(opts[:'event_types'], :multi) if !opts[:'event_types'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'ListResponseMessageOut' # auth_names auth_names = opts[:debug_auth_names] || ['HTTPBearer'] new_options = opts.merge( :operation => :"MessageApi.v1_message_list", :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: MessageApi#v1_message_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end