class Pipedrive::FilesApi
Attributes
Public Class Methods
# File lib/pipedrive-openapi-client/api/files_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Get all files Returns data about all files. @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start (default to 0) @option opts [Integer] :limit Items shown per page @option opts [NumberBoolean] :include_deleted_files When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work. @option opts [String] :sort Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment. @return [GetAllFiles]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 30 def files_get(opts = {}) data, _status_code, _headers = files_get_with_http_info(opts) data end
Get all files Returns data about all files. @param [Hash] opts the optional parameters @option opts [Integer] :start Pagination start @option opts [Integer] :limit Items shown per page @option opts [NumberBoolean] :include_deleted_files When enabled, the list of files will also include deleted files. Please note that trying to download these files will not work. @option opts [String] :sort Field names and sorting mode separated by a comma (field_name_1 ASC, field_name_2 DESC). Only first-level field keys are supported (no nested keys). Supported fields: id, user_id, deal_id, person_id, org_id, product_id, add_time, update_time, file_name, file_type, file_size, comment. @return [Array<(GetAllFiles
, Integer, Hash)>] GetAllFiles
data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 43 def files_get_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_get ...' end # resource path local_var_path = '/files' # query parameters query_params = opts[:query_params] || {} query_params[:'start'] = opts[:'start'] if !opts[:'start'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'include_deleted_files'] = opts[:'include_deleted_files'] if !opts[:'include_deleted_files'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].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[:body] # return_type return_type = opts[:return_type] || 'GetAllFiles' # auth_names auth_names = opts[:auth_names] || ['api_key', 'oauth2'] new_options = opts.merge( :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: FilesApi#files_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete a file Marks a file as deleted. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @return [DeleteFile]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 95 def files_id_delete(id, opts = {}) data, _status_code, _headers = files_id_delete_with_http_info(id, opts) data end
Delete a file Marks a file as deleted. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @return [Array<(DeleteFile
, Integer, Hash)>] DeleteFile
data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 105 def files_id_delete_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_id_delete ...' 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 FilesApi.files_id_delete" end # resource path local_var_path = '/files/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # 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[:body] # return_type return_type = opts[:return_type] || 'DeleteFile' # auth_names auth_names = opts[:auth_names] || ['api_key'] new_options = opts.merge( :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: FilesApi#files_id_delete\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Download one file Initializes a file download. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @return [File]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 157 def files_id_download_get(id, opts = {}) data, _status_code, _headers = files_id_download_get_with_http_info(id, opts) data end
Download one file Initializes a file download. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 167 def files_id_download_get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_id_download_get ...' 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 FilesApi.files_id_download_get" end # resource path local_var_path = '/files/{id}/download'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'File' # auth_names auth_names = opts[:auth_names] || ['api_key', 'oauth2'] new_options = opts.merge( :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: FilesApi#files_id_download_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get one file Returns data about a specific file. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @return [GetOneFile]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 219 def files_id_get(id, opts = {}) data, _status_code, _headers = files_id_get_with_http_info(id, opts) data end
Get one file Returns data about a specific file. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @return [Array<(GetOneFile
, Integer, Hash)>] GetOneFile
data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 229 def files_id_get_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_id_get ...' 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 FilesApi.files_id_get" end # resource path local_var_path = '/files/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # 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[:body] # return_type return_type = opts[:return_type] || 'GetOneFile' # auth_names auth_names = opts[:auth_names] || ['api_key', 'oauth2'] new_options = opts.merge( :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: FilesApi#files_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update file details Updates the properties of a file. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @option opts [String] :name Visible name of the file @option opts [String] :description Description of the file @return [UpdateFile]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 283 def files_id_put(id, opts = {}) data, _status_code, _headers = files_id_put_with_http_info(id, opts) data end
Update file details Updates the properties of a file. @param id [Integer] ID of the file @param [Hash] opts the optional parameters @option opts [String] :name Visible name of the file @option opts [String] :description Description of the file @return [Array<(UpdateFile
, Integer, Hash)>] UpdateFile
data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 295 def files_id_put_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_id_put ...' 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 FilesApi.files_id_put" end # resource path local_var_path = '/files/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} form_params['name'] = opts[:'name'] if !opts[:'name'].nil? form_params['description'] = opts[:'description'] if !opts[:'description'].nil? # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'UpdateFile' # auth_names auth_names = opts[:auth_names] || ['api_key', 'oauth2'] new_options = opts.merge( :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(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#files_id_put\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Add file Lets you upload a file and associate it with Deal, Person, Organization, Activity
or Product
. For more information on how to add a file, see <a href="pipedrive.readme.io/docs/adding-a-file" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param file [File] A single file, supplied in the multipart/form-data encoding and contained within the given boundaries. @param [Hash] opts the optional parameters @option opts [Integer] :deal_id ID of the deal to associate file(s) with @option opts [Integer] :person_id ID of the person to associate file(s) with @option opts [Integer] :org_id ID of the organization to associate file(s) with @option opts [Integer] :product_id ID of the product to associate file(s) with @option opts [Integer] :activity_id ID of the activity to associate file(s) with @return [AddFile]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 356 def files_post(file, opts = {}) data, _status_code, _headers = files_post_with_http_info(file, opts) data end
Add file Lets you upload a file and associate it with Deal, Person, Organization, Activity
or Product
. For more information on how to add a file, see <a href="pipedrive.readme.io/docs/adding-a-file" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param file [File] A single file, supplied in the multipart/form-data encoding and contained within the given boundaries. @param [Hash] opts the optional parameters @option opts [Integer] :deal_id ID of the deal to associate file(s) with @option opts [Integer] :person_id ID of the person to associate file(s) with @option opts [Integer] :org_id ID of the organization to associate file(s) with @option opts [Integer] :product_id ID of the product to associate file(s) with @option opts [Integer] :activity_id ID of the activity to associate file(s) with @return [Array<(AddFile
, Integer, Hash)>] AddFile
data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 371 def files_post_with_http_info(file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_post ...' end # verify the required parameter 'file' is set if @api_client.config.client_side_validation && file.nil? fail ArgumentError, "Missing the required parameter 'file' when calling FilesApi.files_post" end # resource path local_var_path = '/files' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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(['multipart/form-data']) # form parameters form_params = opts[:form_params] || {} form_params['file'] = file form_params['deal_id'] = opts[:'deal_id'] if !opts[:'deal_id'].nil? form_params['person_id'] = opts[:'person_id'] if !opts[:'person_id'].nil? form_params['org_id'] = opts[:'org_id'] if !opts[:'org_id'].nil? form_params['product_id'] = opts[:'product_id'] if !opts[:'product_id'].nil? form_params['activity_id'] = opts[:'activity_id'] if !opts[:'activity_id'].nil? # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'AddFile' # auth_names auth_names = opts[:auth_names] || ['api_key', 'oauth2'] new_options = opts.merge( :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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#files_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Link a remote file to an item Links an existing remote file (googledrive) to the item you supply. For more information on how to link a remote file, see <a href="pipedrive.readme.io/docs/adding-a-remote-file" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param item_type [String] The item type @param item_id [Integer] ID of the item to associate the file with @param remote_id [String] The remote item id @param remote_location [String] The location type to send the file to. Only googledrive is supported at the moment. @param [Hash] opts the optional parameters @return [LinkRemoteFileToItem]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 434 def files_remote_link_post(item_type, item_id, remote_id, remote_location, opts = {}) data, _status_code, _headers = files_remote_link_post_with_http_info(item_type, item_id, remote_id, remote_location, opts) data end
Link a remote file to an item Links an existing remote file (googledrive) to the item you supply. For more information on how to link a remote file, see <a href="pipedrive.readme.io/docs/adding-a-remote-file" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param item_type [String] The item type @param item_id [Integer] ID of the item to associate the file with @param remote_id [String] The remote item id @param remote_location [String] The location type to send the file to. Only googledrive is supported at the moment. @param [Hash] opts the optional parameters @return [Array<(LinkRemoteFileToItem
, Integer, Hash)>] LinkRemoteFileToItem
data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 447 def files_remote_link_post_with_http_info(item_type, item_id, remote_id, remote_location, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_remote_link_post ...' end # verify the required parameter 'item_type' is set if @api_client.config.client_side_validation && item_type.nil? fail ArgumentError, "Missing the required parameter 'item_type' when calling FilesApi.files_remote_link_post" end # verify enum value allowable_values = ["deal", "organization", "person"] if @api_client.config.client_side_validation && !allowable_values.include?(item_type) fail ArgumentError, "invalid value for \"item_type\", must be one of #{allowable_values}" end # verify the required parameter 'item_id' is set if @api_client.config.client_side_validation && item_id.nil? fail ArgumentError, "Missing the required parameter 'item_id' when calling FilesApi.files_remote_link_post" end # verify the required parameter 'remote_id' is set if @api_client.config.client_side_validation && remote_id.nil? fail ArgumentError, "Missing the required parameter 'remote_id' when calling FilesApi.files_remote_link_post" end # verify the required parameter 'remote_location' is set if @api_client.config.client_side_validation && remote_location.nil? fail ArgumentError, "Missing the required parameter 'remote_location' when calling FilesApi.files_remote_link_post" end # verify enum value allowable_values = ["googledrive"] if @api_client.config.client_side_validation && !allowable_values.include?(remote_location) fail ArgumentError, "invalid value for \"remote_location\", must be one of #{allowable_values}" end # resource path local_var_path = '/files/remoteLink' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} form_params['item_type'] = item_type form_params['item_id'] = item_id form_params['remote_id'] = remote_id form_params['remote_location'] = remote_location # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'LinkRemoteFileToItem' # auth_names auth_names = opts[:auth_names] || ['api_key', 'oauth2'] new_options = opts.merge( :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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#files_remote_link_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create a remote file and link it to an item Creates a new empty file in the remote location (googledrive) that will be linked to the item you supply. For more information on how to add a remote file, see <a href="pipedrive.readme.io/docs/adding-a-remote-file" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param file_type [String] The file type @param title [String] The title of the file @param item_type [String] The item type @param item_id [Integer] ID of the item to associate the file with @param remote_location [String] The location type to send the file to. Only googledrive is supported at the moment. @param [Hash] opts the optional parameters @return [CreateRemoteFileAndLinkItToItem]
# File lib/pipedrive-openapi-client/api/files_api.rb, line 531 def files_remote_post(file_type, title, item_type, item_id, remote_location, opts = {}) data, _status_code, _headers = files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts) data end
Create a remote file and link it to an item Creates a new empty file in the remote location (googledrive) that will be linked to the item you supply. For more information on how to add a remote file, see <a href="pipedrive.readme.io/docs/adding-a-remote-file" target="_blank" rel="noopener noreferrer">this tutorial</a>. @param file_type [String] The file type @param title [String] The title of the file @param item_type [String] The item type @param item_id [Integer] ID of the item to associate the file with @param remote_location [String] The location type to send the file to. Only googledrive is supported at the moment. @param [Hash] opts the optional parameters @return [Array<(CreateRemoteFileAndLinkItToItem
, Integer, Hash)>] CreateRemoteFileAndLinkItToItem
data, response status code and response headers
# File lib/pipedrive-openapi-client/api/files_api.rb, line 545 def files_remote_post_with_http_info(file_type, title, item_type, item_id, remote_location, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: FilesApi.files_remote_post ...' end # verify the required parameter 'file_type' is set if @api_client.config.client_side_validation && file_type.nil? fail ArgumentError, "Missing the required parameter 'file_type' when calling FilesApi.files_remote_post" end # verify enum value allowable_values = ["gdoc", "gslides", "gsheet", "gform", "gdraw"] if @api_client.config.client_side_validation && !allowable_values.include?(file_type) fail ArgumentError, "invalid value for \"file_type\", must be one of #{allowable_values}" end # verify the required parameter 'title' is set if @api_client.config.client_side_validation && title.nil? fail ArgumentError, "Missing the required parameter 'title' when calling FilesApi.files_remote_post" end # verify the required parameter 'item_type' is set if @api_client.config.client_side_validation && item_type.nil? fail ArgumentError, "Missing the required parameter 'item_type' when calling FilesApi.files_remote_post" end # verify enum value allowable_values = ["deal", "organization", "person"] if @api_client.config.client_side_validation && !allowable_values.include?(item_type) fail ArgumentError, "invalid value for \"item_type\", must be one of #{allowable_values}" end # verify the required parameter 'item_id' is set if @api_client.config.client_side_validation && item_id.nil? fail ArgumentError, "Missing the required parameter 'item_id' when calling FilesApi.files_remote_post" end # verify the required parameter 'remote_location' is set if @api_client.config.client_side_validation && remote_location.nil? fail ArgumentError, "Missing the required parameter 'remote_location' when calling FilesApi.files_remote_post" end # verify enum value allowable_values = ["googledrive"] if @api_client.config.client_side_validation && !allowable_values.include?(remote_location) fail ArgumentError, "invalid value for \"remote_location\", must be one of #{allowable_values}" end # resource path local_var_path = '/files/remote' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[: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/x-www-form-urlencoded']) # form parameters form_params = opts[:form_params] || {} form_params['file_type'] = file_type form_params['title'] = title form_params['item_type'] = item_type form_params['item_id'] = item_id form_params['remote_location'] = remote_location # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'CreateRemoteFileAndLinkItToItem' # auth_names auth_names = opts[:auth_names] || ['api_key', 'oauth2'] new_options = opts.merge( :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(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: FilesApi#files_remote_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end