View Source Mobilizon.Service.Pictures.Provider behaviour (Mobilizon v5.0.0-beta.1)

Provider Behaviour for pictures stuff.

Supported backends

Shared options

  • :lang Lang in which to prefer results. Used as a request parameter or through an Accept-Language HTTP header. Defaults to "en".
  • :country_code An ISO 3166 country code. String or nil
  • :limit Maximum limit for the number of results returned by the backend. Defaults to 10
  • :api_key Allows to override the API key (if the backend requires one) set inside the configuration.
  • :endpoint Allows to override the endpoint set inside the configuration.

Summary

Callbacks

The CSP configuration to add for the service to work

Get a picture for a location

Callbacks

@callback csp() :: keyword()

The CSP configuration to add for the service to work

Link to this callback

search(location, options)

View Source
@callback search(location :: String.t(), options :: keyword()) ::
  Mobilizon.Service.Pictures.Information.t()

Get a picture for a location

Examples

iex> search("London")
%Information{url: "https://some_url_to.a/picture.jpeg", author: %{name: "An author", url: "https://url.to/profile"}, source: %{name: "The source name", url: "The source URL" }}

Functions

@spec endpoint(atom()) :: String.t()