=begin #Brevo API #Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at https://github.com/orgs/brevo **Possible responses** | Code | Message | | :-------------: | ------------- | | 200 | OK. Successful Request | | 201 | OK. Successful Creation | | 202 | OK. Request accepted | | 204 | OK. Successful Update/Deletion | | 400 | Error. Bad Request | | 401 | Error. Authentication Needed | | 402 | Error. Not enough credit, plan upgrade needed | | 403 | Error. Permission denied | | 404 | Error. Object does not exist | | 405 | Error. Method not allowed | | 406 | Error. Not Acceptable | OpenAPI spec version: 3.0.0 Contact: contact@brevo.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.19 =end require 'uri' module Brevo class DomainsApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Set custom user_agent if explicitly passed in api # default will still remain Swagger-Codegen/#{VERSION}/ruby def setUserAgent(user_agent) @user_agent = user_agent if user_agent.is_a?(String) && user_agent.downcase.start_with?('brevo_') @api_client.default_headers['User-Agent'] = @user_agent end end # Authenticate a domain # @param domain_name Domain name # @param [Hash] opts the optional parameters # @return [AuthenticateDomainModel] def authenticate_domain(domain_name, opts = {}) data, _status_code, _headers = authenticate_domain_with_http_info(domain_name, opts) data end # Authenticate a domain # @param domain_name Domain name # @param [Hash] opts the optional parameters # @return [Array<(AuthenticateDomainModel, Fixnum, Hash)>] AuthenticateDomainModel data, response status code and response headers def authenticate_domain_with_http_info(domain_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainsApi.authenticate_domain ...' end # verify the required parameter 'domain_name' is set if @api_client.config.client_side_validation && domain_name.nil? fail ArgumentError, "Missing the required parameter 'domain_name' when calling DomainsApi.authenticate_domain" end # resource path local_var_path = '/senders/domains/{domainName}/authenticate'.sub('{' + 'domainName' + '}', domain_name.to_s) # query parameters query_params = {} # header parameters 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'AuthenticateDomainModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainsApi#authenticate_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new domain # @param [Hash] opts the optional parameters # @option opts [CreateDomain] :domain_name domain's name # @return [CreateDomainModel] def create_domain(opts = {}) data, _status_code, _headers = create_domain_with_http_info(opts) data end # Create a new domain # @param [Hash] opts the optional parameters # @option opts [CreateDomain] :domain_name domain's name # @return [Array<(CreateDomainModel, Fixnum, Hash)>] CreateDomainModel data, response status code and response headers def create_domain_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainsApi.create_domain ...' end # resource path local_var_path = '/senders/domains' # query parameters query_params = {} # header parameters 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']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'domain_name']) auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateDomainModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainsApi#create_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a domain # @param domain_name Domain name # @param [Hash] opts the optional parameters # @return [nil] def delete_domain(domain_name, opts = {}) delete_domain_with_http_info(domain_name, opts) nil end # Delete a domain # @param domain_name Domain name # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_domain_with_http_info(domain_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainsApi.delete_domain ...' end # verify the required parameter 'domain_name' is set if @api_client.config.client_side_validation && domain_name.nil? fail ArgumentError, "Missing the required parameter 'domain_name' when calling DomainsApi.delete_domain" end # resource path local_var_path = '/senders/domains/{domainName}'.sub('{' + 'domainName' + '}', domain_name.to_s) # query parameters query_params = {} # header parameters 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainsApi#delete_domain\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Validate domain configuration # @param domain_name Domain name # @param [Hash] opts the optional parameters # @return [GetDomainConfigurationModel] def get_domain_configuration(domain_name, opts = {}) data, _status_code, _headers = get_domain_configuration_with_http_info(domain_name, opts) data end # Validate domain configuration # @param domain_name Domain name # @param [Hash] opts the optional parameters # @return [Array<(GetDomainConfigurationModel, Fixnum, Hash)>] GetDomainConfigurationModel data, response status code and response headers def get_domain_configuration_with_http_info(domain_name, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainsApi.get_domain_configuration ...' end # verify the required parameter 'domain_name' is set if @api_client.config.client_side_validation && domain_name.nil? fail ArgumentError, "Missing the required parameter 'domain_name' when calling DomainsApi.get_domain_configuration" end # resource path local_var_path = '/senders/domains/{domainName}'.sub('{' + 'domainName' + '}', domain_name.to_s) # query parameters query_params = {} # header parameters 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetDomainConfigurationModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainsApi#get_domain_configuration\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the list of all your domains # @param [Hash] opts the optional parameters # @return [GetDomainsList] def get_domains(opts = {}) data, _status_code, _headers = get_domains_with_http_info(opts) data end # Get the list of all your domains # @param [Hash] opts the optional parameters # @return [Array<(GetDomainsList, Fixnum, Hash)>] GetDomainsList data, response status code and response headers def get_domains_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: DomainsApi.get_domains ...' end # resource path local_var_path = '/senders/domains' # query parameters query_params = {} # header parameters 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']) # form parameters form_params = {} # http body (model) post_body = nil auth_names = ['api-key', 'partner-key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'GetDomainsList') if @api_client.config.debugging @api_client.config.logger.debug "API called: DomainsApi#get_domains\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end