class MailchimpMarketing::FileManagerApi

Attributes

api_client[RW]

Public Class Methods

new(api_client) click to toggle source
# File lib/MailchimpMarketing/api/file_manager_api.rb, line 19
def initialize(api_client)
  @api_client = api_client
end

Public Instance Methods

create_folder(body, opts = {}) click to toggle source

Add folder

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 175
def create_folder(body, opts = {})
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/file-manager/folders'
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
delete_file(file_id, opts = {}) click to toggle source

Delete file

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 24
def delete_file(file_id, opts = {})
  fail ArgumentError, "Missing required param: 'file_id'" if file_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/file-manager/files/{file_id}'.sub('{' + 'file_id' + '}', file_id.to_s)
  data = @api_client.call_api(:DELETE, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
delete_folder(folder_id, opts = {}) click to toggle source

Delete folder

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 38
def delete_folder(folder_id, opts = {})
  fail ArgumentError, "Missing required param: 'folder_id'" if folder_id.nil?

  query_params = {}
  post_body = nil

  local_var_path = '/file-manager/folders/{folder_id}'.sub('{' + 'folder_id' + '}', folder_id.to_s)
  data = @api_client.call_api(:DELETE, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
files(opts = {}) click to toggle source

List stored files

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 52
def files(opts = {})
  fail ArgumentError, 'invalid value for "opts[:"count"]", must be smaller than or equal to 1000.' if !opts[:'count'].nil? && opts[:'count'] > 1000
  fail ArgumentError, 'invalid value for "sort_field", must be one of added_date' if opts[:'sort_field'] && !['added_date'].include?(opts[:'sort_field'])
  fail ArgumentError, 'invalid value for "sort_dir", must be one of ASC, DESC' if opts[:'sort_dir'] && !['ASC', 'DESC'].include?(opts[:'sort_dir'])

  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?
  query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?
  query_params[:'created_by'] = opts[:'created_by'] if !opts[:'created_by'].nil?
  query_params[:'before_created_at'] = opts[:'before_created_at'] if !opts[:'before_created_at'].nil?
  query_params[:'since_created_at'] = opts[:'since_created_at'] if !opts[:'since_created_at'].nil?
  query_params[:'sort_field'] = opts[:'sort_field'] if !opts[:'sort_field'].nil?
  query_params[:'sort_dir'] = opts[:'sort_dir'] if !opts[:'sort_dir'].nil?
  post_body = nil

  local_var_path = '/file-manager/files'
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
get_file(file_id, opts = {}) click to toggle source

Get file

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 78
def get_file(file_id, opts = {})
  fail ArgumentError, "Missing required param: 'file_id'" if file_id.nil?

  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?
  post_body = nil

  local_var_path = '/file-manager/files/{file_id}'.sub('{' + 'file_id' + '}', file_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
get_folder(folder_id, opts = {}) click to toggle source

Get folder

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 115
def get_folder(folder_id, opts = {})
  fail ArgumentError, "Missing required param: 'folder_id'" if folder_id.nil?

  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?
  post_body = nil

  local_var_path = '/file-manager/folders/{folder_id}'.sub('{' + 'folder_id' + '}', folder_id.to_s)
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
list_folders(opts = {}) click to toggle source

List folders

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 94
def list_folders(opts = {})
  fail ArgumentError, 'invalid value for "opts[:"count"]", must be smaller than or equal to 1000.' if !opts[:'count'].nil? && opts[:'count'] > 1000

  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?
  query_params[:'created_by'] = opts[:'created_by'] if !opts[:'created_by'].nil?
  query_params[:'before_created_at'] = opts[:'before_created_at'] if !opts[:'before_created_at'].nil?
  query_params[:'since_created_at'] = opts[:'since_created_at'] if !opts[:'since_created_at'].nil?
  post_body = nil

  local_var_path = '/file-manager/folders'
  data = @api_client.call_api(:GET, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
update_file(file_id, body, opts = {}) click to toggle source

Update file

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 131
def update_file(file_id, body, opts = {})
  fail ArgumentError, "Missing required param: 'file_id'" if file_id.nil?
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/file-manager/files/{file_id}'.sub('{' + 'file_id' + '}', file_id.to_s)
  data = @api_client.call_api(:PATCH, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
update_folder(folder_id, body, opts = {}) click to toggle source

Update folder

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 146
def update_folder(folder_id, body, opts = {})
  fail ArgumentError, "Missing required param: 'folder_id'" if folder_id.nil?
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/file-manager/folders/{folder_id}'.sub('{' + 'folder_id' + '}', folder_id.to_s)
  data = @api_client.call_api(:PATCH, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end
upload(body, opts = {}) click to toggle source

Add file

# File lib/MailchimpMarketing/api/file_manager_api.rb, line 161
def upload(body, opts = {})
  fail ArgumentError, "Missing required param: 'body'" if body.nil?

  query_params = {}
  post_body = @api_client.object_to_http_body(body)

  local_var_path = '/file-manager/files'
  data = @api_client.call_api(:POST, local_var_path,
    :query_params => query_params,
    :body => post_body)
  return data
end