=begin #SendinBlue API #SendinBlue 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/sendinblue **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@sendinblue.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.19 =end require 'uri' module SibApiV3Sdk class MasterAccountApi 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?('sendinblue_') @api_client.default_headers['User-Agent'] = @user_agent end end # Get the details of requested master account # This endpoint will provide the details of the master account. # @param [Hash] opts the optional parameters # @return [MasterDetailsResponse] def corporate_master_account_get(opts = {}) data, _status_code, _headers = corporate_master_account_get_with_http_info(opts) data end # Get the details of requested master account # This endpoint will provide the details of the master account. # @param [Hash] opts the optional parameters # @return [Array<(MasterDetailsResponse, Fixnum, Hash)>] MasterDetailsResponse data, response status code and response headers def corporate_master_account_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_master_account_get ...' end # resource path local_var_path = '/corporate/masterAccount' # 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 => 'MasterDetailsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_master_account_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the list of all the sub-accounts of the master account. # This endpoint will provide the list all the sub-accounts of the master account. # @param offset Page number of sub-accounts listing # @param limit Number of sub-accounts to be displayed on each page # @param [Hash] opts the optional parameters # @return [SubAccountsResponse] def corporate_sub_account_get(offset, limit, opts = {}) data, _status_code, _headers = corporate_sub_account_get_with_http_info(offset, limit, opts) data end # Get the list of all the sub-accounts of the master account. # This endpoint will provide the list all the sub-accounts of the master account. # @param offset Page number of sub-accounts listing # @param limit Number of sub-accounts to be displayed on each page # @param [Hash] opts the optional parameters # @return [Array<(SubAccountsResponse, Fixnum, Hash)>] SubAccountsResponse data, response status code and response headers def corporate_sub_account_get_with_http_info(offset, limit, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_get ...' end # verify the required parameter 'offset' is set if @api_client.config.client_side_validation && offset.nil? fail ArgumentError, "Missing the required parameter 'offset' when calling MasterAccountApi.corporate_sub_account_get" end # verify the required parameter 'limit' is set if @api_client.config.client_side_validation && limit.nil? fail ArgumentError, "Missing the required parameter 'limit' when calling MasterAccountApi.corporate_sub_account_get" end # resource path local_var_path = '/corporate/subAccount' # query parameters query_params = {} query_params[:'offset'] = offset query_params[:'limit'] = limit # 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 => 'SubAccountsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_sub_account_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete a sub-account # @param id Id of the sub-account organization to be deleted # @param [Hash] opts the optional parameters # @return [nil] def corporate_sub_account_id_delete(id, opts = {}) corporate_sub_account_id_delete_with_http_info(id, opts) nil end # Delete a sub-account # @param id Id of the sub-account organization to be deleted # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def corporate_sub_account_id_delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_id_delete ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling MasterAccountApi.corporate_sub_account_id_delete" end # resource path local_var_path = '/corporate/subAccount/{id}'.sub('{' + 'id' + '}', id.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: MasterAccountApi#corporate_sub_account_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get sub-account details # This endpoint will provide the details of specified sub-account organization # @param id Id of the sub-account organization # @param [Hash] opts the optional parameters # @return [SubAccountDetailsResponse] def corporate_sub_account_id_get(id, opts = {}) data, _status_code, _headers = corporate_sub_account_id_get_with_http_info(id, opts) data end # Get sub-account details # This endpoint will provide the details of specified sub-account organization # @param id Id of the sub-account organization # @param [Hash] opts the optional parameters # @return [Array<(SubAccountDetailsResponse, Fixnum, Hash)>] SubAccountDetailsResponse data, response status code and response headers def corporate_sub_account_id_get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_id_get ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling MasterAccountApi.corporate_sub_account_id_get" end # resource path local_var_path = '/corporate/subAccount/{id}'.sub('{' + 'id' + '}', id.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 => 'SubAccountDetailsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_sub_account_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update sub-account plan # This endpoint will update the sub-account plan # @param id Id of the sub-account organization # @param update_plan_details Values to update a sub-account plan # @param [Hash] opts the optional parameters # @return [nil] def corporate_sub_account_id_plan_put(id, update_plan_details, opts = {}) corporate_sub_account_id_plan_put_with_http_info(id, update_plan_details, opts) nil end # Update sub-account plan # This endpoint will update the sub-account plan # @param id Id of the sub-account organization # @param update_plan_details Values to update a sub-account plan # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def corporate_sub_account_id_plan_put_with_http_info(id, update_plan_details, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_id_plan_put ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling MasterAccountApi.corporate_sub_account_id_plan_put" end # verify the required parameter 'update_plan_details' is set if @api_client.config.client_side_validation && update_plan_details.nil? fail ArgumentError, "Missing the required parameter 'update_plan_details' when calling MasterAccountApi.corporate_sub_account_id_plan_put" end # resource path local_var_path = '/corporate/subAccount/{id}/plan'.sub('{' + 'id' + '}', id.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 = @api_client.object_to_http_body(update_plan_details) 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) if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_sub_account_id_plan_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new sub-account under a master account. # This endpoint will create a new sub-account under a master account # @param sub_account_create values to create new sub-account # @param [Hash] opts the optional parameters # @return [CreateModel] def corporate_sub_account_post(sub_account_create, opts = {}) data, _status_code, _headers = corporate_sub_account_post_with_http_info(sub_account_create, opts) data end # Create a new sub-account under a master account. # This endpoint will create a new sub-account under a master account # @param sub_account_create values to create new sub-account # @param [Hash] opts the optional parameters # @return [Array<(CreateModel, Fixnum, Hash)>] CreateModel data, response status code and response headers def corporate_sub_account_post_with_http_info(sub_account_create, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_post ...' end # verify the required parameter 'sub_account_create' is set if @api_client.config.client_side_validation && sub_account_create.nil? fail ArgumentError, "Missing the required parameter 'sub_account_create' when calling MasterAccountApi.corporate_sub_account_post" end # resource path local_var_path = '/corporate/subAccount' # 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(sub_account_create) 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 => 'CreateModel') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_sub_account_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Generate SSO token to access Sendinblue # This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://app.sendinblue.com/account/login/sub-account/sso/[token], where [token] will be replaced with actual token. # @param sso_token_request Values to generate SSO token for sub-account # @param [Hash] opts the optional parameters # @return [GetSsoToken] def corporate_sub_account_sso_token_post(sso_token_request, opts = {}) data, _status_code, _headers = corporate_sub_account_sso_token_post_with_http_info(sso_token_request, opts) data end # Generate SSO token to access Sendinblue # This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://app.sendinblue.com/account/login/sub-account/sso/[token], where [token] will be replaced with actual token. # @param sso_token_request Values to generate SSO token for sub-account # @param [Hash] opts the optional parameters # @return [Array<(GetSsoToken, Fixnum, Hash)>] GetSsoToken data, response status code and response headers def corporate_sub_account_sso_token_post_with_http_info(sso_token_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_sso_token_post ...' end # verify the required parameter 'sso_token_request' is set if @api_client.config.client_side_validation && sso_token_request.nil? fail ArgumentError, "Missing the required parameter 'sso_token_request' when calling MasterAccountApi.corporate_sub_account_sso_token_post" end # resource path local_var_path = '/corporate/subAccount/ssoToken' # 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(sso_token_request) 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 => 'GetSsoToken') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_sub_account_sso_token_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end