=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 SmsControllerApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete SMS message. # Delete an SMS message # @param sms_id [String] # @param [Hash] opts the optional parameters # @return [nil] def delete_sms_message(sms_id, opts = {}) delete_sms_message_with_http_info(sms_id, opts) nil end # Delete SMS message. # Delete an SMS message # @param sms_id [String] # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_sms_message_with_http_info(sms_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SmsControllerApi.delete_sms_message ...' end # verify the required parameter 'sms_id' is set if @api_client.config.client_side_validation && sms_id.nil? fail ArgumentError, "Missing the required parameter 'sms_id' when calling SmsControllerApi.delete_sms_message" end # resource path local_var_path = '/sms/{smsId}'.sub('{' + 'smsId' + '}', CGI.escape(sms_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: SmsControllerApi#delete_sms_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete all SMS messages # Delete all SMS messages or all messages for a given phone number # @param [Hash] opts the optional parameters # @option opts [String] :phone_number_id # @return [nil] def delete_sms_messages(opts = {}) delete_sms_messages_with_http_info(opts) nil end # Delete all SMS messages # Delete all SMS messages or all messages for a given phone number # @param [Hash] opts the optional parameters # @option opts [String] :phone_number_id # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers def delete_sms_messages_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SmsControllerApi.delete_sms_messages ...' end # resource path local_var_path = '/sms' # query parameters query_params = opts[:query_params] || {} query_params[:'phoneNumberId'] = opts[:'phone_number_id'] if !opts[:'phone_number_id'].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: SmsControllerApi#delete_sms_messages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. # Returns a SMS summary object with content. # @param sms_id [String] # @param [Hash] opts the optional parameters # @return [SmsMessage] def get_sms_message(sms_id, opts = {}) data, _status_code, _headers = get_sms_message_with_http_info(sms_id, opts) data end # Get SMS content including body. Expects SMS to exist by ID. For SMS that may not have arrived yet use the WaitForController. # Returns a SMS summary object with content. # @param sms_id [String] # @param [Hash] opts the optional parameters # @return [Array<(SmsMessage, Integer, Hash)>] SmsMessage data, response status code and response headers def get_sms_message_with_http_info(sms_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SmsControllerApi.get_sms_message ...' end # verify the required parameter 'sms_id' is set if @api_client.config.client_side_validation && sms_id.nil? fail ArgumentError, "Missing the required parameter 'sms_id' when calling SmsControllerApi.get_sms_message" end # resource path local_var_path = '/sms/{smsId}'.sub('{' + 'smsId' + '}', CGI.escape(sms_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] || 'SmsMessage' # 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: SmsControllerApi#get_sms_message\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all SMS messages in all phone numbers in paginated form. . # By default returns all SMS messages across all phone numbers sorted by ascending created at date. Responses are paginated. You can restrict results to a list of phone number IDs. You can also filter out read messages # @param [Hash] opts the optional parameters # @option opts [String] :phone_number Optional receiving phone number to filter SMS messages for # @option opts [Integer] :page Optional page index in SMS list pagination (default to 0) # @option opts [Integer] :size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results (default to 20) # @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') # @option opts [Boolean] :unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly (default to false) # @option opts [DateTime] :since Optional filter SMSs received after given date time # @option opts [DateTime] :before Optional filter SMSs received before given date time # @return [PageSmsProjection] def get_sms_messages_paginated(opts = {}) data, _status_code, _headers = get_sms_messages_paginated_with_http_info(opts) data end # Get all SMS messages in all phone numbers in paginated form. . # By default returns all SMS messages across all phone numbers sorted by ascending created at date. Responses are paginated. You can restrict results to a list of phone number IDs. You can also filter out read messages # @param [Hash] opts the optional parameters # @option opts [String] :phone_number Optional receiving phone number to filter SMS messages for # @option opts [Integer] :page Optional page index in SMS list pagination # @option opts [Integer] :size Optional page size in SMS list pagination. Maximum size is 100. Use page index and sort to page through larger results # @option opts [String] :sort Optional createdAt sort direction ASC or DESC # @option opts [Boolean] :unread_only Optional filter for unread SMS only. All SMS are considered unread until they are viewed in the dashboard or requested directly # @option opts [DateTime] :since Optional filter SMSs received after given date time # @option opts [DateTime] :before Optional filter SMSs received before given date time # @return [Array<(PageSmsProjection, Integer, Hash)>] PageSmsProjection data, response status code and response headers def get_sms_messages_paginated_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: SmsControllerApi.get_sms_messages_paginated ...' end if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100 fail ArgumentError, 'invalid value for "opts[:"size"]" when calling SmsControllerApi.get_sms_messages_paginated, must be smaller than or equal to 100.' 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 = '/sms' # query parameters query_params = opts[:query_params] || {} query_params[:'phoneNumber'] = opts[:'phone_number'] if !opts[:'phone_number'].nil? 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[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].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] || 'PageSmsProjection' # 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: SmsControllerApi#get_sms_messages_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end