=begin #Voucherify API #Voucherify promotion engine REST API. Please see https://docs.voucherify.io/docs for more details. The version of the OpenAPI document: v2018-08-01 Contact: support@voucherify.io Generated by: https://openapi-generator.tech OpenAPI Generator version: 7.0.1 =end require 'cgi' module VoucherifySdk class BinApi attr_accessor :api_client def initialize(api_client = ApiClient.default) @api_client = api_client end # Delete Bin Entry # Deletes permanently a bin entry with a given ID.The following resources can be moved to the bin and permanently deleted: - campaigns - vouchers - products - SKUs To use this endpoint and delete a given resource type, you must have the following permissions: - vouchers.delete to delete a voucher, - campaigns.delete to delete a campaign, - products.delete to delete a product or SKU. # @param bin_entry_id [String] Provide the unique identifier of the bin entry. # @param [Hash] opts the optional parameters # @return [nil] def delete_bin_entry(bin_entry_id, opts = {}) delete_bin_entry_with_http_info(bin_entry_id, opts) nil end # Delete Bin Entry # Deletes permanently a bin entry with a given ID.The following resources can be moved to the bin and permanently deleted: - campaigns - vouchers - products - SKUs To use this endpoint and delete a given resource type, you must have the following permissions: - vouchers.delete to delete a voucher, - campaigns.delete to delete a campaign, - products.delete to delete a product or SKU. # @param bin_entry_id [String] Provide the unique identifier of the bin entry. # @param [Hash] opts the optional parameters # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers private def delete_bin_entry_with_http_info(bin_entry_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BinApi.delete_bin_entry ...' end # resource path local_var_path = '/v1/trash-bin/{binEntryId}'.sub('{' + 'binEntryId' + '}', CGI.escape(bin_entry_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"BinApi.delete_bin_entry", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BinApi#delete_bin_entry\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end # List Bin Entries # Retrieves a list of resources moved to the bin. The following resources can be moved to the bin: - campaigns - vouchers - products - SKUs To use this endpoint, you must have the following permissions: - vouchers.read - campaigns.read - products.read # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [ParameterOrderListBin] :order Orders the bin entries according the date and time when they were moved to the bin or according to the bin entry ID. The dash - preceding a sorting option means sorting in a descending order. # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. # @option opts [ParameterFiltersListBin] :filters Filters for listing bin entries. # @return [TrashBinListResponseBody] def list_bin_entries(opts = {}) data, _status_code, _headers = list_bin_entries_with_http_info(opts) data end # List Bin Entries # Retrieves a list of resources moved to the bin. The following resources can be moved to the bin: - campaigns - vouchers - products - SKUs To use this endpoint, you must have the following permissions: - vouchers.read - campaigns.read - products.read # @param [Hash] opts the optional parameters # @option opts [Integer] :limit Limits the number of objects to be returned. The limit can range between 1 and 100 items. If no limit is set, it returns 10 items. # @option opts [ParameterOrderListBin] :order Orders the bin entries according the date and time when they were moved to the bin or according to the bin entry ID. The dash - preceding a sorting option means sorting in a descending order. # @option opts [String] :starting_after_id A cursor for pagination. It retrieves the events starting after an event with the given ID. # @option opts [ParameterFiltersListBin] :filters Filters for listing bin entries. # @return [Array<(TrashBinListResponseBody, Integer, Hash)>] TrashBinListResponseBody data, response status code and response headers private def list_bin_entries_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: BinApi.list_bin_entries ...' end # resource path local_var_path = '/v1/trash-bin' # query parameters query_params = opts[:query_params] || {} query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil? query_params[:'starting_after_id'] = opts[:'starting_after_id'] if !opts[:'starting_after_id'].nil? query_params[:'filters'] = opts[:'filters'] if !opts[:'filters'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'TrashBinListResponseBody' # auth_names auth_names = opts[:debug_auth_names] || ['X-App-Id', 'X-App-Token'] new_options = opts.merge( :operation => :"BinApi.list_bin_entries", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: BinApi#list_bin_entries\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end end end