=begin #Smooch #The Smooch API is a unified interface for powering messaging in your customer experiences across every channel. Our API speeds access to new markets, reduces time to ship, eliminates complexity, and helps you build the best experiences for your customers. For more information, visit our [official documentation](https://docs.smooch.io). OpenAPI spec version: 3.12 Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.2.3-SNAPSHOT =end require "uri" module SmoochApi class ServiceAccountApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # # Create a secret key for the specified service account. # @param service_account_id Identifies the service account. # @param secret_key_create_body Body for a createSecretKey request. # @param [Hash] opts the optional parameters # @return [SecretKeyResponse] def create_secret_key(service_account_id, secret_key_create_body, opts = {}) data, _status_code, _headers = create_secret_key_with_http_info(service_account_id, secret_key_create_body, opts) return data end # # Create a secret key for the specified service account. # @param service_account_id Identifies the service account. # @param secret_key_create_body Body for a createSecretKey request. # @param [Hash] opts the optional parameters # @return [Array<(SecretKeyResponse, Fixnum, Hash)>] SecretKeyResponse data, response status code and response headers def create_secret_key_with_http_info(service_account_id, secret_key_create_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.create_secret_key ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.create_secret_key" end # verify the required parameter 'secret_key_create_body' is set if @api_client.config.client_side_validation && secret_key_create_body.nil? fail ArgumentError, "Missing the required parameter 'secret_key_create_body' when calling ServiceAccountApi.create_secret_key" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}/keys".sub('{' + 'serviceAccountId' + '}', service_account_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(secret_key_create_body) auth_names = ['jwt'] 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 => 'SecretKeyResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#create_secret_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # Create a new service account. # @param service_account_create_body Body for a createServiceAccount request. # @param [Hash] opts the optional parameters # @return [ServiceAccountResponse] def create_service_account(service_account_create_body, opts = {}) data, _status_code, _headers = create_service_account_with_http_info(service_account_create_body, opts) return data end # # Create a new service account. # @param service_account_create_body Body for a createServiceAccount request. # @param [Hash] opts the optional parameters # @return [Array<(ServiceAccountResponse, Fixnum, Hash)>] ServiceAccountResponse data, response status code and response headers def create_service_account_with_http_info(service_account_create_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.create_service_account ..." end # verify the required parameter 'service_account_create_body' is set if @api_client.config.client_side_validation && service_account_create_body.nil? fail ArgumentError, "Missing the required parameter 'service_account_create_body' when calling ServiceAccountApi.create_service_account" end # resource path local_var_path = "/v1/serviceaccounts" # 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(service_account_create_body) auth_names = ['jwt'] 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 => 'ServiceAccountResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#create_service_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # Delete the specified service account secret key. # @param service_account_id Identifies the service account. # @param key_id Identifies the secret key. # @param [Hash] opts the optional parameters # @return [nil] def delete_secret_key(service_account_id, key_id, opts = {}) delete_secret_key_with_http_info(service_account_id, key_id, opts) return nil end # # Delete the specified service account secret key. # @param service_account_id Identifies the service account. # @param key_id Identifies the secret key. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_secret_key_with_http_info(service_account_id, key_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.delete_secret_key ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.delete_secret_key" end # verify the required parameter 'key_id' is set if @api_client.config.client_side_validation && key_id.nil? fail ArgumentError, "Missing the required parameter 'key_id' when calling ServiceAccountApi.delete_secret_key" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}/keys/{keyId}".sub('{' + 'serviceAccountId' + '}', service_account_id.to_s).sub('{' + 'keyId' + '}', key_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 = ['jwt'] 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: ServiceAccountApi#delete_secret_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # Delete the specified service account. # @param service_account_id Identifies the service account. # @param [Hash] opts the optional parameters # @return [nil] def delete_service_account(service_account_id, opts = {}) delete_service_account_with_http_info(service_account_id, opts) return nil end # # Delete the specified service account. # @param service_account_id Identifies the service account. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_service_account_with_http_info(service_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.delete_service_account ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.delete_service_account" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}".sub('{' + 'serviceAccountId' + '}', service_account_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 = ['jwt'] 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: ServiceAccountApi#delete_service_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # Get an account-scoped JWT for the specified service account secret key. # @param service_account_id Identifies the service account. # @param key_id Identifies the secret key. # @param [Hash] opts the optional parameters # @return [JwtResponse] def get_jwt(service_account_id, key_id, opts = {}) data, _status_code, _headers = get_jwt_with_http_info(service_account_id, key_id, opts) return data end # # Get an account-scoped JWT for the specified service account secret key. # @param service_account_id Identifies the service account. # @param key_id Identifies the secret key. # @param [Hash] opts the optional parameters # @return [Array<(JwtResponse, Fixnum, Hash)>] JwtResponse data, response status code and response headers def get_jwt_with_http_info(service_account_id, key_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.get_jwt ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.get_jwt" end # verify the required parameter 'key_id' is set if @api_client.config.client_side_validation && key_id.nil? fail ArgumentError, "Missing the required parameter 'key_id' when calling ServiceAccountApi.get_jwt" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}/keys/{keyId}/jwt".sub('{' + 'serviceAccountId' + '}', service_account_id.to_s).sub('{' + 'keyId' + '}', key_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 = ['jwt'] 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 => 'JwtResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#get_jwt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # Get the specified service account secret key. # @param service_account_id Identifies the service account. # @param key_id Identifies the secret key. # @param [Hash] opts the optional parameters # @return [SecretKeyResponse] def get_secret_key(service_account_id, key_id, opts = {}) data, _status_code, _headers = get_secret_key_with_http_info(service_account_id, key_id, opts) return data end # # Get the specified service account secret key. # @param service_account_id Identifies the service account. # @param key_id Identifies the secret key. # @param [Hash] opts the optional parameters # @return [Array<(SecretKeyResponse, Fixnum, Hash)>] SecretKeyResponse data, response status code and response headers def get_secret_key_with_http_info(service_account_id, key_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.get_secret_key ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.get_secret_key" end # verify the required parameter 'key_id' is set if @api_client.config.client_side_validation && key_id.nil? fail ArgumentError, "Missing the required parameter 'key_id' when calling ServiceAccountApi.get_secret_key" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}/keys/{keyId}".sub('{' + 'serviceAccountId' + '}', service_account_id.to_s).sub('{' + 'keyId' + '}', key_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 = ['jwt'] 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 => 'SecretKeyResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#get_secret_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # Get the specified service account. # @param service_account_id Identifies the service account. # @param [Hash] opts the optional parameters # @return [ServiceAccountResponse] def get_service_account(service_account_id, opts = {}) data, _status_code, _headers = get_service_account_with_http_info(service_account_id, opts) return data end # # Get the specified service account. # @param service_account_id Identifies the service account. # @param [Hash] opts the optional parameters # @return [Array<(ServiceAccountResponse, Fixnum, Hash)>] ServiceAccountResponse data, response status code and response headers def get_service_account_with_http_info(service_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.get_service_account ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.get_service_account" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}".sub('{' + 'serviceAccountId' + '}', service_account_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 = ['jwt'] 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 => 'ServiceAccountResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#get_service_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # List the secret keys for the specified service account. # @param service_account_id Identifies the service account. # @param [Hash] opts the optional parameters # @return [ListSecretKeysResponse] def list_secret_keys(service_account_id, opts = {}) data, _status_code, _headers = list_secret_keys_with_http_info(service_account_id, opts) return data end # # List the secret keys for the specified service account. # @param service_account_id Identifies the service account. # @param [Hash] opts the optional parameters # @return [Array<(ListSecretKeysResponse, Fixnum, Hash)>] ListSecretKeysResponse data, response status code and response headers def list_secret_keys_with_http_info(service_account_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.list_secret_keys ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.list_secret_keys" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}/keys".sub('{' + 'serviceAccountId' + '}', service_account_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 = ['jwt'] 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 => 'ListSecretKeysResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#list_secret_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # List all service accounts configured. # @param [Hash] opts the optional parameters # @option opts [Integer] :limit The number of records to return. (default to 25) # @option opts [Integer] :offset The number of initial records to skip before picking records to return. (default to 0) # @return [ListServiceAccountsResponse] def list_service_accounts(opts = {}) data, _status_code, _headers = list_service_accounts_with_http_info(opts) return data end # # List all service accounts configured. # @param [Hash] opts the optional parameters # @option opts [Integer] :limit The number of records to return. # @option opts [Integer] :offset The number of initial records to skip before picking records to return. # @return [Array<(ListServiceAccountsResponse, Fixnum, Hash)>] ListServiceAccountsResponse data, response status code and response headers def list_service_accounts_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.list_service_accounts ..." end # resource path local_var_path = "/v1/serviceaccounts" # query parameters query_params = {} 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 = ['jwt'] 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 => 'ListServiceAccountsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#list_service_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # # Update the specified service account. # @param service_account_id Identifies the service account. # @param service_account_update_body Body for an updateServiceAccount request. # @param [Hash] opts the optional parameters # @return [ServiceAccountResponse] def update_service_account(service_account_id, service_account_update_body, opts = {}) data, _status_code, _headers = update_service_account_with_http_info(service_account_id, service_account_update_body, opts) return data end # # Update the specified service account. # @param service_account_id Identifies the service account. # @param service_account_update_body Body for an updateServiceAccount request. # @param [Hash] opts the optional parameters # @return [Array<(ServiceAccountResponse, Fixnum, Hash)>] ServiceAccountResponse data, response status code and response headers def update_service_account_with_http_info(service_account_id, service_account_update_body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ServiceAccountApi.update_service_account ..." end # verify the required parameter 'service_account_id' is set if @api_client.config.client_side_validation && service_account_id.nil? fail ArgumentError, "Missing the required parameter 'service_account_id' when calling ServiceAccountApi.update_service_account" end # verify the required parameter 'service_account_update_body' is set if @api_client.config.client_side_validation && service_account_update_body.nil? fail ArgumentError, "Missing the required parameter 'service_account_update_body' when calling ServiceAccountApi.update_service_account" end # resource path local_var_path = "/v1/serviceaccounts/{serviceAccountId}".sub('{' + 'serviceAccountId' + '}', service_account_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(service_account_update_body) auth_names = ['jwt'] 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 => 'ServiceAccountResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: ServiceAccountApi#update_service_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end