jsonld

package
v0.0.0-...-2795187 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrJsonLdNotFound = fmt.Errorf("json+ld event description not found")

Functions

This section is empty.

Types

type Address

type Address struct {
	Street   string `json:"streetAddress"`
	PostCode string `json:"postalCode"`
	City     string `json:"addressLocality"`
	Country  string `json:"addressCountry"`
}

type ContentProcessor

type ContentProcessor func([]byte) []byte

type Event

type Event struct {
	Name                string              `json:"name"`
	Description         string              `json:"description"`
	StartDate           LdTime              `json:"startDate"`
	EndDate             LdTime              `json:"endDate"`
	EventAttendanceMode EventAttendanceMode `json:"eventAttendanceMode"`
	URL                 string              `json:"url"`
	ImageURL            string              `json:"image"`
	Location            Place               `json:"location"`
}

func FindLdJsonInHtml

func FindLdJsonInHtml(htmlContent io.Reader, contentCallback ContentProcessor) (*Event, error)

func (Event) ToMobilizonEvent

func (event Event) ToMobilizonEvent() *mobilizon.Event

type EventAttendanceMode

type EventAttendanceMode string
const (
	OfflineEventAttendanceMode EventAttendanceMode = "https://schema.org/OfflineEventAttendanceMode"
	OnlineEventAttendanceMode  EventAttendanceMode = "https://schema.org/OnlineEventAttendanceMode"
	MixedEventAttendanceMode   EventAttendanceMode = "https://schema.org/MixedEventAttendanceMode"
)

type LdTime

type LdTime struct{ time.Time }

LdTime is a helper for unmarshalling json. This is needed, as the time format returned by facebook is not compatible with go's RFC3339: - 2022-04-04T22:00:00+0200 + 2022-04-04T22:00:00+02:00

func (*LdTime) UnmarshalJSON

func (t *LdTime) UnmarshalJSON(b []byte) (err error)

type Place

type Place struct {
	Name    string  `json:"name"`
	Address Address `json:"address"`
	URL     string  `json:"url"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL