Package com.attribyte.parser.model
Class OEmbedProvider
java.lang.Object
com.attribyte.parser.model.OEmbedProvider
An immutable oEmbed provider.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe standard oembed providers endpoint URL ("https://oembed.com/providers.json").final com.google.common.collect.ImmutableList<OEmbedProvider.Endpoint> The immutable list of endpoints.final StringThe provider name.final StringThe provider URL. -
Constructor Summary
ConstructorsConstructorDescriptionOEmbedProvider(String name, String url, Collection<OEmbedProvider.Endpoint> endpoints) Creates an oembed provider. -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.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 byhttps://oembed.com/providers.json.static com.google.common.collect.ImmutableMap<String, OEmbedProvider> Creates a map containing the default published providers.static com.google.common.collect.ImmutableMap<String, OEmbedProvider> publishedProviders(String url) Creates a map containing published providers from a URL.toString()
-
Field Details
-
name
The provider name. -
url
The provider URL. -
endpoints
The immutable list of endpoints. -
DEFAULT_PROVIDERS_URL
The standard oembed providers endpoint URL ("https://oembed.com/providers.json").- See Also:
-
-
Constructor Details
-
OEmbedProvider
Creates an oembed provider.- Parameters:
name- The provider name.url- The provider URL.endpoints- The collection of endpoints.
-
-
Method Details
-
toString
-
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 IOExceptionCreates 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 byhttps://oembed.com/providers.json.- Parameters:
node- The root node.- Returns:
- The map of provider vs URL.
-