=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 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?('brevo_') @api_client.default_headers['User-Agent'] = @user_agent end end # Delete a group # This endpoint allows you to delete a group of sub-organizations. When a group is deleted, the sub-organizations are no longer part of this group. The users associated with the group are no longer associated with the group once deleted. # @param id Id of the group # @param [Hash] opts the optional parameters # @return [nil] def corporate_group_id_delete(id, opts = {}) corporate_group_id_delete_with_http_info(id, opts) nil end # Delete a group # This endpoint allows you to delete a group of sub-organizations. When a group is deleted, the sub-organizations are no longer part of this group. The users associated with the group are no longer associated with the group once deleted. # @param id Id of the group # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def corporate_group_id_delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_group_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_group_id_delete" end # resource path local_var_path = '/corporate/group/{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_group_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # GET a group details # This endpoint allows you to retrieve a specific group’s information such as the list of sub-organizations and the user associated with the group. # @param id Id of the group of sub-organization # @param [Hash] opts the optional parameters # @return [CorporateGroupDetailsResponse] def corporate_group_id_get(id, opts = {}) data, _status_code, _headers = corporate_group_id_get_with_http_info(id, opts) data end # GET a group details # This endpoint allows you to retrieve a specific group’s information such as the list of sub-organizations and the user associated with the group. # @param id Id of the group of sub-organization # @param [Hash] opts the optional parameters # @return [Array<(CorporateGroupDetailsResponse, Fixnum, Hash)>] CorporateGroupDetailsResponse data, response status code and response headers def corporate_group_id_get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_group_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_group_id_get" end # resource path local_var_path = '/corporate/group/{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 => 'CorporateGroupDetailsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_group_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update a group of sub-accounts # This endpoint allows you to update a group of sub-accounts # @param id Id of the group # @param body Group details to be updated. # @param [Hash] opts the optional parameters # @return [nil] def corporate_group_id_put(id, body, opts = {}) corporate_group_id_put_with_http_info(id, body, opts) nil end # Update a group of sub-accounts # This endpoint allows you to update a group of sub-accounts # @param id Id of the group # @param body Group details to be updated. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def corporate_group_id_put_with_http_info(id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_group_id_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_group_id_put" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling MasterAccountApi.corporate_group_id_put" end # resource path local_var_path = '/corporate/group/{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 = @api_client.object_to_http_body(body) 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_group_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Create a new group of sub-accounts # This endpoint allows to create a group of sub-accounts # @param body Group details to be created. # @param [Hash] opts the optional parameters # @return [InlineResponse201] def corporate_group_post(body, opts = {}) data, _status_code, _headers = corporate_group_post_with_http_info(body, opts) data end # Create a new group of sub-accounts # This endpoint allows to create a group of sub-accounts # @param body Group details to be created. # @param [Hash] opts the optional parameters # @return [Array<(InlineResponse201, Fixnum, Hash)>] InlineResponse201 data, response status code and response headers def corporate_group_post_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_group_post ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling MasterAccountApi.corporate_group_post" end # resource path local_var_path = '/corporate/group' # 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(body) 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 => 'InlineResponse201') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_group_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete sub-account from group # This endpoint allows you to remove a sub-organization from a group. # @param group_id Id of the group # @param body List of sub-account ids # @param [Hash] opts the optional parameters # @return [nil] def corporate_group_unlink_group_id_sub_accounts_put(group_id, body, opts = {}) corporate_group_unlink_group_id_sub_accounts_put_with_http_info(group_id, body, opts) nil end # Delete sub-account from group # This endpoint allows you to remove a sub-organization from a group. # @param group_id Id of the group # @param body List of sub-account ids # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def corporate_group_unlink_group_id_sub_accounts_put_with_http_info(group_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_group_unlink_group_id_sub_accounts_put ...' end # verify the required parameter 'group_id' is set if @api_client.config.client_side_validation && group_id.nil? fail ArgumentError, "Missing the required parameter 'group_id' when calling MasterAccountApi.corporate_group_unlink_group_id_sub_accounts_put" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling MasterAccountApi.corporate_group_unlink_group_id_sub_accounts_put" end # resource path local_var_path = '/corporate/group/unlink/{groupId}/subAccounts'.sub('{' + 'groupId' + '}', group_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(body) 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_group_unlink_group_id_sub_accounts_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers 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 # Generate SSO token to access admin account # This endpoint generates an SSO token to authenticate and access the admin account using the endpoint https://account-app.brevo.com/account/login/corporate/sso/[token], where [token] will be replaced by the actual token. # @param sso_token_request_corporate User email of admin account # @param [Hash] opts the optional parameters # @return [GetSsoToken] def corporate_sso_token_post(sso_token_request_corporate, opts = {}) data, _status_code, _headers = corporate_sso_token_post_with_http_info(sso_token_request_corporate, opts) data end # Generate SSO token to access admin account # This endpoint generates an SSO token to authenticate and access the admin account using the endpoint https://account-app.brevo.com/account/login/corporate/sso/[token], where [token] will be replaced by the actual token. # @param sso_token_request_corporate User email of admin account # @param [Hash] opts the optional parameters # @return [Array<(GetSsoToken, Fixnum, Hash)>] GetSsoToken data, response status code and response headers def corporate_sso_token_post_with_http_info(sso_token_request_corporate, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sso_token_post ...' end # verify the required parameter 'sso_token_request_corporate' is set if @api_client.config.client_side_validation && sso_token_request_corporate.nil? fail ArgumentError, "Missing the required parameter 'sso_token_request_corporate' when calling MasterAccountApi.corporate_sso_token_post" end # resource path local_var_path = '/corporate/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_corporate) 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_sso_token_post\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 Index of the first sub-account in the page # @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 Index of the first sub-account in the page # @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 # Enable/disable sub-account application(s) # API endpoint for the Corporate owner to enable/disable applications on the sub-account # @param id Id of the sub-account organization (mandatory) # @param toggle_applications List of applications to activate or deactivate on a sub-account # @param [Hash] opts the optional parameters # @return [nil] def corporate_sub_account_id_applications_toggle_put(id, toggle_applications, opts = {}) corporate_sub_account_id_applications_toggle_put_with_http_info(id, toggle_applications, opts) nil end # Enable/disable sub-account application(s) # API endpoint for the Corporate owner to enable/disable applications on the sub-account # @param id Id of the sub-account organization (mandatory) # @param toggle_applications List of applications to activate or deactivate on a sub-account # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def corporate_sub_account_id_applications_toggle_put_with_http_info(id, toggle_applications, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_id_applications_toggle_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_applications_toggle_put" end # verify the required parameter 'toggle_applications' is set if @api_client.config.client_side_validation && toggle_applications.nil? fail ArgumentError, "Missing the required parameter 'toggle_applications' when calling MasterAccountApi.corporate_sub_account_id_applications_toggle_put" end # resource path local_var_path = '/corporate/subAccount/{id}/applications/toggle'.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(toggle_applications) 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_applications_toggle_put\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 for the specified sub-account company # @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 for the specified sub-account company # @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 an API key for a sub-account # This endpoint will generate an API v3 key for a sub account # @param create_api_key_request Values to generate API key for sub-account # @param [Hash] opts the optional parameters # @return [CreateApiKeyResponse] def corporate_sub_account_key_post(create_api_key_request, opts = {}) data, _status_code, _headers = corporate_sub_account_key_post_with_http_info(create_api_key_request, opts) data end # Create an API key for a sub-account # This endpoint will generate an API v3 key for a sub account # @param create_api_key_request Values to generate API key for sub-account # @param [Hash] opts the optional parameters # @return [Array<(CreateApiKeyResponse, Fixnum, Hash)>] CreateApiKeyResponse data, response status code and response headers def corporate_sub_account_key_post_with_http_info(create_api_key_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_sub_account_key_post ...' end # verify the required parameter 'create_api_key_request' is set if @api_client.config.client_side_validation && create_api_key_request.nil? fail ArgumentError, "Missing the required parameter 'create_api_key_request' when calling MasterAccountApi.corporate_sub_account_key_post" end # resource path local_var_path = '/corporate/subAccount/key' # 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(create_api_key_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 => 'CreateApiKeyResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_sub_account_key_post\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 [CreateSubAccountResponse] 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<(CreateSubAccountResponse, Fixnum, Hash)>] CreateSubAccountResponse 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 => 'CreateSubAccountResponse') 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 sub-account # This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://account-app.brevo.com/account/login/sub-account/sso/[token], where [token] will be replaced by the 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 sub-account # This endpoint generates an sso token to authenticate and access a sub-account of the master using the account endpoint https://account-app.brevo.com/account/login/sub-account/sso/[token], where [token] will be replaced by the 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 # Resend / cancel admin user invitation # This endpoint will allow the user to: - Resend an admin user invitation - Cancel an admin user invitation # @param action Action to be performed (cancel / resend) # @param email Email address of the recipient # @param [Hash] opts the optional parameters # @return [InlineResponse200] def corporate_user_invitation_action_email_put(action, email, opts = {}) data, _status_code, _headers = corporate_user_invitation_action_email_put_with_http_info(action, email, opts) data end # Resend / cancel admin user invitation # This endpoint will allow the user to: - Resend an admin user invitation - Cancel an admin user invitation # @param action Action to be performed (cancel / resend) # @param email Email address of the recipient # @param [Hash] opts the optional parameters # @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers def corporate_user_invitation_action_email_put_with_http_info(action, email, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_user_invitation_action_email_put ...' end # verify the required parameter 'action' is set if @api_client.config.client_side_validation && action.nil? fail ArgumentError, "Missing the required parameter 'action' when calling MasterAccountApi.corporate_user_invitation_action_email_put" end # verify the required parameter 'email' is set if @api_client.config.client_side_validation && email.nil? fail ArgumentError, "Missing the required parameter 'email' when calling MasterAccountApi.corporate_user_invitation_action_email_put" end # resource path local_var_path = '/corporate/user/invitation/{action}/{email}'.sub('{' + 'action' + '}', action.to_s).sub('{' + 'email' + '}', email.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 => 'InlineResponse200') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#corporate_user_invitation_action_email_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Revoke an admin user # This endpoint allows to revoke/remove an invited member of your Admin account # @param email Email of the invited user # @param [Hash] opts the optional parameters # @return [nil] def corporate_user_revoke_email_delete(email, opts = {}) corporate_user_revoke_email_delete_with_http_info(email, opts) nil end # Revoke an admin user # This endpoint allows to revoke/remove an invited member of your Admin account # @param email Email of the invited user # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def corporate_user_revoke_email_delete_with_http_info(email, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.corporate_user_revoke_email_delete ...' end # verify the required parameter 'email' is set if @api_client.config.client_side_validation && email.nil? fail ArgumentError, "Missing the required parameter 'email' when calling MasterAccountApi.corporate_user_revoke_email_delete" end # resource path local_var_path = '/corporate/user/revoke/{email}'.sub('{' + 'email' + '}', email.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_user_revoke_email_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get user activity logs # @param [Hash] opts the optional parameters # @option opts [String] :start_date Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. # @option opts [String] :end_date Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. # @option opts [Integer] :limit Number of documents per page (default to 10) # @option opts [Integer] :offset Index of the first document in the page. (default to 0) # @return [GetAccountActivity] def get_account_activity(opts = {}) data, _status_code, _headers = get_account_activity_with_http_info(opts) data end # Get user activity logs # @param [Hash] opts the optional parameters # @option opts [String] :start_date Mandatory if endDate is used. Enter start date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. Additionally, you can retrieve activity logs from the past 12 months from the date of your search. # @option opts [String] :end_date Mandatory if startDate is used. Enter end date in UTC date (YYYY-MM-DD) format to filter the activity in your account. Maximum time period that can be selected is one month. # @option opts [Integer] :limit Number of documents per page # @option opts [Integer] :offset Index of the first document in the page. # @return [Array<(GetAccountActivity, Fixnum, Hash)>] GetAccountActivity data, response status code and response headers def get_account_activity_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.get_account_activity ...' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MasterAccountApi.get_account_activity, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling MasterAccountApi.get_account_activity, must be greater than or equal to 1.' end # resource path local_var_path = '/organization/activities' # query parameters query_params = {} query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil? query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? # 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 => 'GetAccountActivity') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#get_account_activity\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the list of all admin users # This endpoint allows you to list all Admin users of your Admin account # @param [Hash] opts the optional parameters # @return [GetCorporateInvitedUsersList] def get_corporate_invited_users_list(opts = {}) data, _status_code, _headers = get_corporate_invited_users_list_with_http_info(opts) data end # Get the list of all admin users # This endpoint allows you to list all Admin users of your Admin account # @param [Hash] opts the optional parameters # @return [Array<(GetCorporateInvitedUsersList, Fixnum, Hash)>] GetCorporateInvitedUsersList data, response status code and response headers def get_corporate_invited_users_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.get_corporate_invited_users_list ...' end # resource path local_var_path = '/corporate/invited/users' # 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 => 'GetCorporateInvitedUsersList') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#get_corporate_invited_users_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Check admin user permissions # @param email Email of the invited user # @param [Hash] opts the optional parameters # @return [GetCorporateUserPermission] def get_corporate_user_permission(email, opts = {}) data, _status_code, _headers = get_corporate_user_permission_with_http_info(email, opts) data end # Check admin user permissions # @param email Email of the invited user # @param [Hash] opts the optional parameters # @return [Array<(GetCorporateUserPermission, Fixnum, Hash)>] GetCorporateUserPermission data, response status code and response headers def get_corporate_user_permission_with_http_info(email, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.get_corporate_user_permission ...' end # verify the required parameter 'email' is set if @api_client.config.client_side_validation && email.nil? fail ArgumentError, "Missing the required parameter 'email' when calling MasterAccountApi.get_corporate_user_permission" end # resource path local_var_path = '/corporate/user/{email}/permissions'.sub('{' + 'email' + '}', email.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 => 'GetCorporateUserPermission') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#get_corporate_user_permission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get the list of groups # This endpoint allows you to list all groups created on your Admin account. # @param [Hash] opts the optional parameters # @return [Array] def get_sub_account_groups(opts = {}) data, _status_code, _headers = get_sub_account_groups_with_http_info(opts) data end # Get the list of groups # This endpoint allows you to list all groups created on your Admin account. # @param [Hash] opts the optional parameters # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers def get_sub_account_groups_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.get_sub_account_groups ...' end # resource path local_var_path = '/corporate/groups' # 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 => 'Array') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#get_sub_account_groups\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Send invitation to an admin user # `This endpoint allows you to invite a member to manage the Admin account Features and their respective permissions are as below: - `my_plan`: - \"all\" - `api`: - \"none\" - `user_management`: - \"all\" - `app_management` | Not available in ENTv2: - \"all\" **Note**: - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited admin user. # @param send_invitation Payload to send an invitation # @param [Hash] opts the optional parameters # @return [InviteAdminUser] def invite_admin_user(send_invitation, opts = {}) data, _status_code, _headers = invite_admin_user_with_http_info(send_invitation, opts) data end # Send invitation to an admin user # `This endpoint allows you to invite a member to manage the Admin account Features and their respective permissions are as below: - `my_plan`: - \"all\" - `api`: - \"none\" - `user_management`: - \"all\" - `app_management` | Not available in ENTv2: - \"all\" **Note**: - If `all_features_access: false` then only privileges are required otherwise if `true` then it's assumed that all permissions will be there for the invited admin user. # @param send_invitation Payload to send an invitation # @param [Hash] opts the optional parameters # @return [Array<(InviteAdminUser, Fixnum, Hash)>] InviteAdminUser data, response status code and response headers def invite_admin_user_with_http_info(send_invitation, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MasterAccountApi.invite_admin_user ...' end # verify the required parameter 'send_invitation' is set if @api_client.config.client_side_validation && send_invitation.nil? fail ArgumentError, "Missing the required parameter 'send_invitation' when calling MasterAccountApi.invite_admin_user" end # resource path local_var_path = '/corporate/user/invitation/send' # 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(send_invitation) 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 => 'InviteAdminUser') if @api_client.config.debugging @api_client.config.logger.debug "API called: MasterAccountApi#invite_admin_user\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end