Documentation ¶
Index ¶
Constants ¶
const SourceURL string = "https://oembed.com/providers.json"
SourceURL is a official url of supported providers list
Variables ¶
var Providers []Provider //nolint:gochecknoglobals
Providers contains all default (or new synced) providers
Functions ¶
func HasProvider ¶
HasProvider checks what input url has oEmbed provider
Types ¶
type Endpoint ¶
type Endpoint struct { Schemes []string `json:"schemes,omitempty"` URL string `json:"url"` Discovery bool `json:"discovery,omitempty"` Formats []string `json:"formats,omitempty"` }
Provider represent a single endpoint of Provider
func (*Endpoint) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Endpoint) MarshalJSONBuf ¶
func (j *Endpoint) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Endpoint) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Endpoint) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Error ¶
Error represent a complex error
type OEmbed ¶
type OEmbed struct { // The resource type. Type string `json:"type"` // required // The oEmbed version number. Version string `json:"version"` // required // A text title, describing the resource. Title string `json:"title,omitempty"` // The name of the author/owner of the resource. AuthorName string `json:"author_name,omitempty"` // A URL for the author/owner of the resource. AuthorURL string `json:"author_url,omitempty"` // The name of the resource provider. ProviderName string `json:"provider_name,omitempty"` // The url of the resource provider. ProviderURL string `json:"provider_url,omitempty"` // The suggested cache lifetime for this resource, in seconds. // Consumers may choose to use this value or not. CacheAge int `json:"cache_age,omitempty"` // A URL to a thumbnail image representing the resource. // The thumbnail must respect any maxwidth and maxheight parameters. // If this parameter is present, thumbnail_width and thumbnail_height must also be present. ThumbnailURL string `json:"thumbnail_url,omitempty"` // The width of the optional thumbnail. // If this parameter is present, thumbnail_url and thumbnail_height must also be present. ThumbnailWidth int `json:"thumbnail_width,omitempty"` // The height of the optional thumbnail. // If this parameter is present, thumbnail_url and thumbnail_width must also be present. ThumbnailHeight int `json:"thumbnail_height,omitempty"` URL string `json:"url,omitempty"` }
Response can specify a resource type, such as photo or video. Each type has specific parameters associated with it.
func Extract ¶
Extract try fetch oEmbed object for input url with params (if represent). Return OEmbed if success.
func (*OEmbed) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*OEmbed) MarshalJSONBuf ¶
func (j *OEmbed) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*OEmbed) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*OEmbed) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Photo ¶
type Photo struct { // The source URL of the image. Consumers should be able to insert this URL into an <img> element. // Only HTTP and HTTPS URLs are valid. URL string `json:"url"` // required // The width in pixels of the image specified in the url parameter. Width int `json:"width"` // required // The height in pixels of the image specified in the url parameter. Height int `json:"height"` // required }
Photo is used for representing static photos.
func (*Photo) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Photo) MarshalJSONBuf ¶
func (j *Photo) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Photo) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Photo) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Provider ¶
type Provider struct { Name string `json:"provider_name"` URL string `json:"provider_url"` Endpoints []Endpoint `json:"endpoints"` }
Provider represent a single provider info
func (*Provider) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Provider) MarshalJSONBuf ¶
func (j *Provider) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Provider) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Provider) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Rich ¶
type Rich struct { // The HTML required to display the resource. The HTML should have no padding or margins. // Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities. // The markup should be valid XHTML 1.0 Basic. HTML string `json:"html"` // required // The width in pixels required to display the HTML. Width int `json:"width"` // required // The height in pixels required to display the HTML. Height int `json:"height"` // required }
Rich is used for rich HTML content that does not fall under one of the other categories.
func (*Rich) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Rich) MarshalJSONBuf ¶
func (j *Rich) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Rich) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Rich) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson
type Video ¶
type Video struct { // The HTML required to embed a video player. The HTML should have no padding or margins. // Consumers may wish to load the HTML in an off-domain iframe to avoid XSS vulnerabilities. HTML string `json:"html"` // required // The width in pixels required to display the HTML. Width int `json:"width"` // required // The height in pixels required to display the HTML. Height int `json:"height"` // required }
Video is used for representing playable videos.
func (*Video) MarshalJSON ¶
MarshalJSON marshal bytes to json - template
func (*Video) MarshalJSONBuf ¶
func (j *Video) MarshalJSONBuf(buf fflib.EncodingBuffer) error
MarshalJSONBuf marshal buff to json - template
func (*Video) UnmarshalJSON ¶
UnmarshalJSON umarshall json - template of ffjson
func (*Video) UnmarshalJSONFFLexer ¶
UnmarshalJSONFFLexer fast json unmarshall - template ffjson