Class OEmbedProvider

java.lang.Object
com.attribyte.parser.model.OEmbedProvider

public class OEmbedProvider extends Object
An immutable oEmbed provider.
  • Field Details

    • name

      public final String name
      The provider name.
    • url

      public final String url
      The provider URL.
    • endpoints

      public final com.google.common.collect.ImmutableList<OEmbedProvider.Endpoint> endpoints
      The immutable list of endpoints.
    • DEFAULT_PROVIDERS_URL

      public static final String DEFAULT_PROVIDERS_URL
      The standard oembed providers endpoint URL ("https://oembed.com/providers.json").
      See Also:
  • Constructor Details

    • OEmbedProvider

      public OEmbedProvider(String name, String url, Collection<OEmbedProvider.Endpoint> endpoints)
      Creates an oembed provider.
      Parameters:
      name - The provider name.
      url - The provider URL.
      endpoints - The collection of endpoints.
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • domainMap

      public static com.google.common.collect.ImmutableMap<String,com.google.common.collect.ImmutableList<OEmbedProvider.Endpoint>> domainMap(Collection<OEmbedProvider> providers)
      Builds a map of endpoints vs the domain they support.
      Parameters:
      providers - A collection of providers.
      Returns:
      The map of endpoints vs domain.
    • publishedProviders

      public static com.google.common.collect.ImmutableMap<String,OEmbedProvider> publishedProviders() throws IOException
      Creates a map containing the default published providers.
      Returns:
      The map of providers vs URL.
      Throws:
      IOException - on parse/load error.
    • publishedProviders

      public static com.google.common.collect.ImmutableMap<String,OEmbedProvider> publishedProviders(String url) throws IOException
      Creates a map containing published providers from a URL.
      Parameters:
      url - The URL.
      Returns:
      The map of providers vs URL.
      Throws:
      IOException - on parse/load error.
    • fromJSON

      public static com.google.common.collect.ImmutableMap<String,OEmbedProvider> fromJSON(com.fasterxml.jackson.databind.JsonNode node)
      Creates a map of provider vs URL from the format supported by https://oembed.com/providers.json.
      Parameters:
      node - The root node.
      Returns:
      The map of provider vs URL.