=begin #RadioManager #RadioManager OpenAPI spec version: 2.0 Contact: support@pluxbox.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.3.0 =end require "uri" module RadioManagerClient class PresenterApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Create presenter. # Create presenter. # @param data Data **(Required)** # @param [Hash] opts the optional parameters # @return [PostSuccess] def create_presenter(data, opts = {}) data, _status_code, _headers = create_presenter_with_http_info(data, opts) return data end # Create presenter. # Create presenter. # @param data Data **(Required)** # @param [Hash] opts the optional parameters # @return [Array<(PostSuccess, Fixnum, Hash)>] PostSuccess data, response status code and response headers def create_presenter_with_http_info(data, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenterApi.create_presenter ..." end # verify the required parameter 'data' is set if @api_client.config.client_side_validation && data.nil? fail ArgumentError, "Missing the required parameter 'data' when calling PresenterApi.create_presenter" end # resource path local_var_path = "/presenters" # 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(data) auth_names = ['API 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 => 'PostSuccess') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenterApi#create_presenter\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Delete presenter by id # Delete presenter by id # @param id id of presenter # @param [Hash] opts the optional parameters # @return [Success] def delete_presenter_by_id(id, opts = {}) data, _status_code, _headers = delete_presenter_by_id_with_http_info(id, opts) return data end # Delete presenter by id # Delete presenter by id # @param id id of presenter # @param [Hash] opts the optional parameters # @return [Array<(Success, Fixnum, Hash)>] Success data, response status code and response headers def delete_presenter_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenterApi.delete_presenter_by_id ..." 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 PresenterApi.delete_presenter_by_id" end if @api_client.config.client_side_validation && id < 0 fail ArgumentError, 'invalid value for "id" when calling PresenterApi.delete_presenter_by_id, must be greater than or equal to 0.' end # resource path local_var_path = "/presenters/{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'] 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, :return_type => 'Success') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenterApi#delete_presenter_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get presenter by id # Get presenter by id # @param id id of Presenter # @param [Hash] opts the optional parameters # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)* # @return [PresenterResult] def get_presenter_by_id(id, opts = {}) data, _status_code, _headers = get_presenter_by_id_with_http_info(id, opts) return data end # Get presenter by id # Get presenter by id # @param id id of Presenter # @param [Hash] opts the optional parameters # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)* # @return [Array<(PresenterResult, Fixnum, Hash)>] PresenterResult data, response status code and response headers def get_presenter_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenterApi.get_presenter_by_id ..." 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 PresenterApi.get_presenter_by_id" end if @api_client.config.client_side_validation && id < 0 fail ArgumentError, 'invalid value for "id" when calling PresenterApi.get_presenter_by_id, must be greater than or equal to 0.' end # resource path local_var_path = "/presenters/{id}".sub('{' + 'id' + '}', id.to_s) # query parameters query_params = {} query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].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'] 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 => 'PresenterResult') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenterApi#get_presenter_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Get all presenters. # List all presenters. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Current page *(Optional)* # @option opts [Integer] :program_id Search on Program ID *(Optional)* `(Relation)` # @option opts [Integer] :broadcast_id Search on Broadcast ID *(Optional)* `(Relation)` # @option opts [Integer] :model_type_id Search on ModelType ID (Optional) # @option opts [Integer] :limit Results per page *(Optional)* # @option opts [String] :order_by Field to order the results *(Optional)* # @option opts [String] :order_direction Direction of ordering *(Optional)* # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)* # @return [PresenterResults] def list_presenters(opts = {}) data, _status_code, _headers = list_presenters_with_http_info(opts) return data end # Get all presenters. # List all presenters. # @param [Hash] opts the optional parameters # @option opts [Integer] :page Current page *(Optional)* # @option opts [Integer] :program_id Search on Program ID *(Optional)* `(Relation)` # @option opts [Integer] :broadcast_id Search on Broadcast ID *(Optional)* `(Relation)` # @option opts [Integer] :model_type_id Search on ModelType ID (Optional) # @option opts [Integer] :limit Results per page *(Optional)* # @option opts [String] :order_by Field to order the results *(Optional)* # @option opts [String] :order_direction Direction of ordering *(Optional)* # @option opts [Integer] :_external_station_id Query on a different (content providing) station *(Optional)* # @return [Array<(PresenterResults, Fixnum, Hash)>] PresenterResults data, response status code and response headers def list_presenters_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenterApi.list_presenters ..." end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 0 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling PresenterApi.list_presenters, must be greater than or equal to 0.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PresenterApi.list_presenters, must be smaller than or equal to 50.' end if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1 fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling PresenterApi.list_presenters, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && opts[:'order_direction'] && !['asc', 'desc'].include?(opts[:'order_direction']) fail ArgumentError, 'invalid value for "order_direction", must be one of asc, desc' end # resource path local_var_path = "/presenters" # query parameters query_params = {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'program_id'] = opts[:'program_id'] if !opts[:'program_id'].nil? query_params[:'broadcast_id'] = opts[:'broadcast_id'] if !opts[:'broadcast_id'].nil? query_params[:'model_type_id'] = opts[:'model_type_id'] if !opts[:'model_type_id'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'order-by'] = opts[:'order_by'] if !opts[:'order_by'].nil? query_params[:'order-direction'] = opts[:'order_direction'] if !opts[:'order_direction'].nil? query_params[:'_external_station_id'] = opts[:'_external_station_id'] if !opts[:'_external_station_id'].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'] 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 => 'PresenterResults') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenterApi#list_presenters\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # Update presenter by id # Update presenter by id # @param id id of Presenter # @param [Hash] opts the optional parameters # @option opts [PresenterDataInput] :data Data *(Optional)* # @return [Success] def update_presenter_by_id(id, opts = {}) data, _status_code, _headers = update_presenter_by_id_with_http_info(id, opts) return data end # Update presenter by id # Update presenter by id # @param id id of Presenter # @param [Hash] opts the optional parameters # @option opts [PresenterDataInput] :data Data *(Optional)* # @return [Array<(Success, Fixnum, Hash)>] Success data, response status code and response headers def update_presenter_by_id_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PresenterApi.update_presenter_by_id ..." 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 PresenterApi.update_presenter_by_id" end if @api_client.config.client_side_validation && id < 0 fail ArgumentError, 'invalid value for "id" when calling PresenterApi.update_presenter_by_id, must be greater than or equal to 0.' end # resource path local_var_path = "/presenters/{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(opts[:'data']) auth_names = ['API Key'] data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Success') if @api_client.config.debugging @api_client.config.logger.debug "API called: PresenterApi#update_presenter_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end