unsplash v0.2.0 Unsplash

The Unslpash API in Elixir

Pagination

Those API results that are paginated will return a Stream in which you can resolve by using any Enum function. You can also pass in per_page and page keywords if you would like to do pagination manually. Max per_page is 30.

Summary

Functions

GET /categories

GET /categories/:id

GET /categories/:id/photos

GET /curated_batches

GET /curated_batches/:id

GET /curated_batch/:id/photos

GET /me

DELETE /photos/:id/like

GET /stats/total

POST /photos

GET /users/:username

GET /users/:username/likes

Functions

categories()

GET /categories

categories(id)

GET /categories/:id

Args:

  • id - The category ID
categories(id, atom, opts \\ [])

GET /categories/:id/photos

Args:

  • id - The category ID
curated_batches()

GET /curated_batches

curated_batches(id)

GET /curated_batches/:id

Args:

  • id - The curated batch ID
curated_batches(id, atom, opts \\ [])

GET /curated_batch/:id/photos

Args:

  • id - The curated batch ID
me()

GET /me

Requires read_user scope

photos(id, opts \\ [])

DELETE /photos/:id/like

Args:

  • id - the photo id
start(type, args)
stats()

GET /stats/total

update_me(opts \\ [])

PUT /me

Args:

  • opts - Keyword list of options

Options:

  • username - Username.
  • first_name - First name.
  • last_name -Last name.
  • email -Email.
  • url -Portfolio/personal URL.
  • location - Location.
  • bio -About/bio.
  • instagram_username - Instagram username.

Requires write_user scope

upload_photo(photo)

POST /photos

Args:

  • photo - the path of the photo to be uploaded.

Requires the write_photos scope

Thanks to https://stackoverflow.com/q/33557133/ for the solution on how to upload named files.

users(username)

GET /users/:username

Args:

  • username - the username string
users(username, arg2, opts \\ [])

GET /users/:username/likes

Args:

  • username - the username string