Current section

Files

Jump to
infusionsoft lib infusionsoft endpoints xml file.ex
Raw

lib/infusionsoft/endpoints/xml/file.ex

defmodule Infusionsoft.Endpoints.XML.File do
@moduledoc """
Provides the raw endpoints to Infusionsoft's XML API for File actions.
"""
alias Infusionsoft.Endpoints.XML.Helpers
@doc "https://developer.infusionsoft.com/docs/xml-rpc/#file-upload-a-file"
@spec upload_a_file(integer(), String.t(), String.t(), String.t()) ::
{:ok, integer()} | {:error, String.t()}
def upload_a_file(contact_id, file_name, base_64_encoded_data, token) do
params = [contact_id, file_name, base_64_encoded_data]
Helpers.process_endpoint("FileService.uploadFile", params, token)
end
@doc "https://developer.infusionsoft.com/docs/xml-rpc/#file-retrieve-a-file"
@spec retrieve_a_file(integer(), String.t()) ::
{:ok, String.t()} | {:error, String.t()}
def retrieve_a_file(file_id, token) do
params = [file_id]
Helpers.process_endpoint("FileService.getFile", params, token)
end
@doc "https://developer.infusionsoft.com/docs/xml-rpc/#file-retrieve-a-file-download-url"
@spec retrieve_download_url(integer(), String.t()) ::
{:ok, String.t()} | {:error, String.t()}
def retrieve_download_url(file_id, token) do
params = [file_id]
Helpers.process_endpoint("FileService.getDownloadUrl", params, token)
end
@doc "https://developer.infusionsoft.com/docs/xml-rpc/#file-replace-a-file"
@spec replace_a_file(integer(), String.t(), String.t()) ::
{:ok, integer()} | {:error, String.t()}
def replace_a_file(file_id, base_64_encoded_data, token) do
params = [file_id, base_64_encoded_data]
Helpers.process_endpoint("FileService.replaceFile", params, token)
end
@doc "https://developer.infusionsoft.com/docs/xml-rpc/#file-rename-a-file"
@spec rename_a_file(integer(), String.t(), String.t()) ::
{:ok, integer()} | {:error, String.t()}
def rename_a_file(file_id, file_name, token) do
params = [file_id, file_name]
Helpers.process_endpoint("FileService.renameFile", params, token)
end
end