OEmbedProviders.Provider (OEmbed Providers v0.1.0) View Source

Represents an OEmbed provider.

Link to this section Summary

Functions

Convert a map into a OEmbedProviders.Provider struct.

Check if the given URL matches this Provider.

Construct the OEmbed endpoint URL for the given Provider and URL.

Link to this section Types

Specs

t() :: %OEmbedProviders.Provider{
  endpoints: [OEmbedProviders.Provider.Endpoint.t()],
  provider_name: String.t() | nil,
  provider_url: String.t() | nil
}

Link to this section Functions

Link to this function

find_endpoint(provider, url)

View Source

Specs

find_endpoint(provider :: t(), url :: String.t()) ::
  OEmbedProviders.Provider.Endpoint.t() | nil

Get the OEmbedProviders.Provider.Endpoint for a Provider.

Specs

from_map(data :: map()) :: t()

Convert a map into a OEmbedProviders.Provider struct.

Specs

matches?(provider :: t(), url :: String.t()) :: boolean()

Check if the given URL matches this Provider.

Link to this function

oembed_url(provider, url)

View Source

Specs

oembed_url(provider :: t(), url :: String.t()) ::
  {:ok, String.t()} | {:error, any()}

Construct the OEmbed endpoint URL for the given Provider and URL.