Documentation
¶
Overview ¶
Package opengraph provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.0 DO NOT EDIT.
Index ¶
- type Audio
- type Description
- type Image
- type Locale
- type ObjectType
- type OpenGraph
- func (a OpenGraph) Get(fieldName string) (value string, found bool)
- func (a OpenGraph) MarshalJSON() ([]byte, error)
- func (a *OpenGraph) Set(fieldName string, value string)
- func (og *OpenGraph) String() string
- func (a *OpenGraph) UnmarshalJSON(b []byte) error
- func (og *OpenGraph) UnmarshalXML(d *xml.Decoder, se xml.StartElement) error
- func (og *OpenGraph) Valid() error
- type Option
- type ParseOption
- type SiteName
- type Title
- type URL
- type Video
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Description ¶
type Description = string
Description is a one to two sentence description of your object.
type Image ¶
type Image = string
Image is an image URL which should represent your object within the graph.
type Locale ¶
type Locale = string
Locale is the locale these tags are marked up in. Of the format language_TERRITORY. Default is en_US.
type ObjectType ¶
type ObjectType = string
ObjectType is the type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required.
type OpenGraph ¶
type OpenGraph struct {
// Audio is a URL to an audio file to accompany this object.
Audio *Audio `json:"audio,omitempty" validate:"omitempty,url"`
// Description is a one to two sentence description of your object.
Description *Description `json:"description,omitempty"`
// Image is an image URL which should represent your object within the graph.
Image Image `json:"image" validate:"required,url"`
// Locale is the locale these tags are marked up in. Of the format language_TERRITORY. Default is en_US.
Locale *Locale `json:"locale,omitempty"`
// ObjectType is the type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required.
ObjectType ObjectType `json:"object_type" validate:"required"`
// SiteName is a value that when your object is part of a larger web site, the name which should be displayed for the overall site.
SiteName *SiteName `json:"site_name,omitempty"`
// Title is title of your object as it should appear within the graph, e.g., "The Rock".
Title Title `json:"title" validate:"required"`
// URL is the canonical URL of your object that will be used as its permanent ID in the graph, e.g., "https://www.imdb.com/title/tt0117500/".
URL URL `json:"url" validate:"required,url"`
// Video is a URL to a video file to accompany this object.
Video *Video `json:"video,omitempty" validate:"omitempty,url"`
AdditionalProperties map[string]string `json:"-"`
}
OpenGraph is an object containing all opengraph metadata.
func New ¶
New creates a new open graph object with the given required values and any additional values as options.
func ParseBytes ¶
func ParseBytes(data []byte, options ...ParseOption) (*OpenGraph, error)
ParseBytes will parse the given byte array and return any Open Graph metadata found within. Use with existing HTML page data.
func (OpenGraph) Get ¶
Getter for additional properties for OpenGraph. Returns the specified element and whether it was found
func (OpenGraph) MarshalJSON ¶
Override default JSON handling for OpenGraph to handle AdditionalProperties
func (*OpenGraph) UnmarshalJSON ¶
Override default JSON handling for OpenGraph to handle AdditionalProperties
func (*OpenGraph) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler. It scans all <meta> elements anywhere in the document and populates OGMeta fields from those whose property/name attribute starts with "og:".
type Option ¶
type Option func(*OpenGraph)
func WithAdditionalProperty ¶
func WithDescription ¶
func WithDescription(desc Description) Option
func WithLocale ¶
func WithSiteName ¶
type ParseOption ¶
type ParseOption func(*parseOptions)
ParseOption is a functional option to apply to an Open Graph parsing method.
func WithClient ¶
func WithClient(c *resty.Client) ParseOption
WithClient option specifies an existing http client to use for parsing remote content.
type SiteName ¶
type SiteName = string
SiteName is a value that when your object is part of a larger web site, the name which should be displayed for the overall site.
type Title ¶
type Title = string
Title is title of your object as it should appear within the graph, e.g., "The Rock".
type URL ¶
type URL = string
URL is the canonical URL of your object that will be used as its permanent ID in the graph, e.g., "https://www.imdb.com/title/tt0117500/".