FilePreviews

Provides an interface to the FilePreviews API.

For the API's documentation please check http://filepreviews.io/docs/.

Usage

{:ok, filepreviews} = FilePreviews.new("API_KEY", "API_SECRET")

Generate

{status, response} = FilePreviews.generate("http://example.com/file.pdf")

Note: - status is either :ok or :error. - response is a Map converted from the JSON response from FilePreviews.

Options

params = %{metadata: ["exif"], pages: "1"}
{status, response} = FilePreviews.generate("http://example.com/file.pdf", params)

Retrieve

{status, response} = FilePreviews.generate("42764e04-9094-467c-96b3-49d31ff4423d")

Summary

api_key()

Returns the API Key

api_secret()

Returns the API Secret

generate(url, params \\ %{})

Generates a preview for a given URL and params

new(config)

Starts FilePreviews process with the config

new(api_key, api_secret)

Starts FilePreviews process with the given api_key and api_secret

retrieve(id)

Retrieves a preview with a given ID

version()

Types

status :: :ok | :error

response :: {status, map}

Functions

api_key()

Specs:

  • api_key :: binary

Returns the API Key.

api_secret()

Specs:

  • api_secret :: binary

Returns the API Secret.

generate(url, params \\ %{})

Specs:

Generates a preview for a given URL and params.

new(config)

Specs:

Starts FilePreviews process with the config.

new(api_key, api_secret)

Specs:

Starts FilePreviews process with the given api_key and api_secret.

retrieve(id)

Specs:

Retrieves a preview with a given ID.

version()