Pexels (Pexels v0.1.0) View Source
Parses the given line
into a command.
Examples
iex> client = Pexels.client()
iex> {:ok, %{liked: _liked, photo: photo}} = Pexels.photo(client, %{id: 156934})
iex> photo.url
"https://www.pexels.com/photo/white-and-black-cat-156934/"
Link to this section Summary
Functions
Creates the tesla
client for pexels
This endpoint returns all of your collections.
This endpoint returns all of your collections.
This endpoint enables you to receive real-time photos curated by the Pexels team.
Retrieve a specific Photo from its id.
This endpoint enables you to receive the current popular Pexels videos.
This endpoint enables you to search Pexels for any topic that you would like.
This endpoint enables you to search Pexels for any topic that you would like.
Retrieve a specific Video from its id.
Link to this section Functions
client(token \\ Application.get_env(:pexels, :token), base \\ Application.get_env(:pexels, :base))
View SourceCreates the tesla
client for pexels
Examples
iex> _client = Pexels.client()
This endpoint returns all of your collections.
Examples
iex> client = Pexels.client()
iex> {:ok, %{media: media} = %Pexels.Client.Collection.CollectionMediaResponse{}} = Pexels.collection_media(client, %{id: "z40vgi2", per_page: 1})
iex> media |> Enum.count
1
This endpoint returns all of your collections.
Examples
iex> client = Pexels.client()
iex> {:ok, %{collections: collections} = %Pexels.Client.Collection.CollectionsResponse{}} = Pexels.collections(client, %{per_page: 1})
iex> collections |> Enum.count
1
This endpoint enables you to receive real-time photos curated by the Pexels team.
Examples
iex> client = Pexels.client()
iex> {:ok, response = %Pexels.Client.Photo.PhotosResponse{}} = Pexels.curated_photos(client, %{per_page: 2, page: 1})
iex> response.photos |> Enum.count
2
Retrieve a specific Photo from its id.
Examples
iex> client = Pexels.client()
iex> {:ok, %{liked: _liked, photo: photo} = %Pexels.Client.Photo.PhotoResponse{}} = Pexels.photo(client, %{id: 156934})
iex> photo.url
"https://www.pexels.com/photo/white-and-black-cat-156934/"
This endpoint enables you to receive the current popular Pexels videos.
Examples
iex> client = Pexels.client()
iex> {:ok, response = %Pexels.Client.Video.VideosResponse{}} = Pexels.popular_videos(client, %{per_page: 2, page: 1})
iex> response.videos |> Enum.count
2
This endpoint enables you to search Pexels for any topic that you would like.
For example your query could be something broad like Nature, Tigers, People.
Or it could be something specific like Group of people working.
Examples
iex> client = Pexels.client()
iex> {:ok, response = %Pexels.Client.Photo.PhotosResponse{}} = Pexels.search_photos(client, %{query: "cat", per_page: 10, page: 1})
iex> response.photos |> Enum.count
10
This endpoint enables you to search Pexels for any topic that you would like.
For example your query could be something broad like Nature, Tigers, People.
Or it could be something specific like Group of people working.
Examples
iex> client = Pexels.client()
iex> {:ok, response = %Pexels.Client.Video.VideosResponse{}} = Pexels.search_videos(client, %{query: "cat", per_page: 10, page: 1})
iex> response.videos |> Enum.count
10
Retrieve a specific Video from its id.
Examples
iex> client = Pexels.client()
iex> {:ok, video = %Pexels.Video{}} = Pexels.video(client, %{id: 6982949})
iex> video.url
"https://www.pexels.com/video/woman-dancing-in-the-spotlight-6982949/"