=begin #Mailchimp Marketing API #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: 3.0.5 Contact: apihelp@mailchimp.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.12 =end require 'uri' module MailchimpMarketing class BatchesApi attr_accessor :api_client def initialize(api_client) @api_client = api_client end # Delete batch request # Stops a batch request from running. Since only one batch request is run at a time, this can be used to cancel a long running request. The results of any completed operations will not be available after this call. # @param batch_id The unique id for the batch operation. # @param [Hash] opts the optional parameters # @return [nil] def delete_request(batch_id = {}, opts = {}) delete_request_with_http_info(batch_id, opts) nil end # Delete batch request # Stops a batch request from running. Since only one batch request is run at a time, this can be used to cancel a long running request. The results of any completed operations will not be available after this call. # @param batch_id The unique id for the batch operation. # @param [Hash] opts the optional parameters # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers def delete_request_with_http_info(batch_id, opts = {}) # resource path local_var_path = '/batches/{batch_id}'.sub('{' + 'batch_id' + '}', batch_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', 'application/problem+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 = ['basicAuth'] 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 data, status_code, headers end # List batch requests # Get a summary of batch requests that have been made. # @param [Hash] opts the optional parameters # @option opts [Array] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation. # @option opts [Array] :exclude_fields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation. # @option opts [Integer] :count The number of records to return. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is **10**. [Maximum value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is **1000** (default to 10) # @option opts [Integer] :offset The number of records from a collection to skip. Iterating over large collections with this parameter can be slow. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is **0**. (default to 0) # @return [BatchOperations] def list(opts = {}) data, _status_code, _headers = list_with_http_info(opts) data end # List batch requests # Get a summary of batch requests that have been made. # @param [Hash] opts the optional parameters # @option opts [Array] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation. # @option opts [Array] :exclude_fields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation. # @option opts [Integer] :count The number of records to return. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is **10**. [Maximum value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is **1000** # @option opts [Integer] :offset The number of records from a collection to skip. Iterating over large collections with this parameter can be slow. [Default value](/developer/guides/get-started-with-mailchimp-api-3/#Parameters) is **0**. # @return [Array<(BatchOperations, Fixnum, Hash)>] BatchOperations data, response status code and response headers def list_with_http_info(opts = {}) # resource path local_var_path = '/batches' # query parameters query_params = {} query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil? query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil? query_params[:'count'] = opts[:'count'] if !opts[:'count'].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', 'application/problem+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 = ['basicAuth'] 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 => 'BatchOperations') return data, status_code, headers end # Get batch operation status # Get the status of a batch request. # @param batch_id The unique id for the batch operation. # @param [Hash] opts the optional parameters # @option opts [Array] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation. # @option opts [Array] :exclude_fields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation. # @return [Batch] def status(batch_id = {}, opts = {}) data, _status_code, _headers = status_with_http_info(batch_id, opts) data end # Get batch operation status # Get the status of a batch request. # @param batch_id The unique id for the batch operation. # @param [Hash] opts the optional parameters # @option opts [Array] :fields A comma-separated list of fields to return. Reference parameters of sub-objects with dot notation. # @option opts [Array] :exclude_fields A comma-separated list of fields to exclude. Reference parameters of sub-objects with dot notation. # @return [Array<(Batch, Fixnum, Hash)>] Batch data, response status code and response headers def status_with_http_info(batch_id, opts = {}) # resource path local_var_path = '/batches/{batch_id}'.sub('{' + 'batch_id' + '}', batch_id.to_s) # query parameters query_params = {} query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :csv) if !opts[:'fields'].nil? query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :csv) if !opts[:'exclude_fields'].nil? # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+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 = ['basicAuth'] 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 => 'Batch') return data, status_code, headers end # Start batch operation # Begin processing a batch operations request. # @param body # @param [Hash] opts the optional parameters # @return [Batch] def start(body = {}, opts = {}) data, _status_code, _headers = start_with_http_info(body, opts) data end # Start batch operation # Begin processing a batch operations request. # @param body # @param [Hash] opts the optional parameters # @return [Array<(Batch, Fixnum, Hash)>] Batch data, response status code and response headers def start_with_http_info(body, opts = {}) # resource path local_var_path = '/batches' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/problem+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 = ['basicAuth'] 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 => 'Batch') return data, status_code, headers end end end