opml

package
v0.0.0-...-715d248 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package opml 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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body = []Outline

Body represents the OPML <body> element.

type BreakpointState

type BreakpointState string

BreakpointState is a string, either "true" or "false", indicating whether a breakpoint is set on this outline. This attribute is mainly necessary for outlines used to edit scripts. If it's not present, the value is false.

const (
	Breakpoint   BreakpointState = "true"
	NoBreakpoint BreakpointState = "false"
)

Defines values for BreakpointState.

type CommentState

type CommentState string

CommentState is a string, either "true" or "false", indicating whether the outline is commented or not. By convention if an outline is commented, all subordinate outlines are considered to also be commented. If it's not present, the value is false.

const (
	Commented    CommentState = "true"
	NotCommented CommentState = "false"
)

Defines values for CommentState.

type Date

type Date = types.DateTime

Date is a date-time.

type Head struct {
	// DateCreated is a date-time, indicating when the document was created.
	DateCreated Date `json:"dateCreated,omitempty,omitzero" validate:"omitempty" xml:"dateCreated,omitempty"`

	// DateModified is a date-time, indicating when the document was last modified.
	DateModified Date `json:"dateModified,omitempty,omitzero" validate:"omitempty" xml:"dateModified,omitempty"`

	// Docs is the http address of documentation for the format used in the OPML file. It's probably a pointer to this page for people who might stumble across the file on a web server 25 years from now and wonder what it is.
	Docs string `json:"docs,omitempty,omitzero" validate:"omitempty,url" xml:"docs,omitempty"`

	// ExpansionState is a comma-separated list of line numbers that are expanded. The line numbers in the list tell you which headlines to expand. The order is important. For each element in the list, X, starting at the first summit, navigate flatdown X times and expand. Repeat for each element in the list.
	ExpansionState string `json:"expansionState,omitempty,omitzero" xml:"expansionState,omitempty"`

	// OwnerEmail is the email address of the owner of the document.
	OwnerEmail string `json:"ownerEmail,omitempty,omitzero" validate:"omitempty,email" xml:"ownerEmail,omitempty"`

	// OwnerID is the http address of a web page that contains information that allows a human reader to communicate with the author of the document via email or other means. It also may be used to identify the author. No two authors have the same ownerId.
	OwnerID string `json:"ownerId,omitempty,omitzero" validate:"omitempty,url" xml:"ownerId,omitempty"`

	// OwnerName is the owner of the document.
	OwnerName string `json:"ownerName,omitempty,omitzero" xml:"ownerName,omitempty"`

	// Title is the title of the document.
	Title string `json:"title,omitempty,omitzero" xml:"title,omitempty"`

	// VertScrollState is a number, saying which line of the outline is displayed on the top line of the window. This number is calculated with the expansion state already applied.
	VertScrollState string `json:"vertScrollState,omitempty,omitzero" xml:"vertScrollState,omitempty"`

	// WindowBottom is a number, the pixel location of the bottom edge of the window.
	WindowBottom string `json:"windowBottom,omitempty,omitzero" xml:"windowBottom,omitempty"`

	// WindowLeft is a number, the pixel location of the left edge of the window.
	WindowLeft string `json:"windowLeft,omitempty,omitzero" xml:"windowLeft,omitempty"`

	// WindowRight is a number, the pixel location of the right edge of the window.
	WindowRight string `json:"windowRight,omitempty,omitzero" xml:"windowRight,omitempty"`

	// WindowTop is a number, the pixel location of the top edge of the window.
	WindowTop string `json:"windowTop,omitempty,omitzero" xml:"windowTop,omitempty"`
}

Head represents the OPML <head> element.

type OPML

type OPML struct {
	// XMLName represents the XML namespace of an element.
	XMLName xml.Name `json:"XMLName"`

	// Body represents the OPML <body> element.
	Body Body `json:"body" validate:"required,dive" xml:"body>outline"`

	// Head represents the OPML <head> element.
	Head    Head   `json:"head" validate:"required" xml:"head"`
	Version string `json:"version" xml:"version,attr"`
}

OPML represents an OPML document.

func NewOPML

func NewOPML(options ...Option) *OPML

NewOPML creates a new OPML object.

func NewOPMLFromBytes

func NewOPMLFromBytes(b []byte) (*OPML, error)

NewOPMLFromBytes generates an OPML object from the given byte array.

type Option

type Option func(*OPML)

Option is a functional option to apply to an OPML object.

func WithOutlines

func WithOutlines(outlines ...Outline) Option

WithOutlines option appends the given outlines to the OPML object.

func WithTitle

func WithTitle(title string) Option

WithTitle option sets a title for the OPML object.

type Outline

type Outline struct {
	// Category is a string of comma-separated slash-delimited category strings, in the format defined by the RSS 2.0 category element. To represent a "tag," the category string should contain no slashes.
	Category string `json:"category,omitempty,omitzero" xml:"category,omitempty,attr"`

	// Created is the date-time that the outline node was created.
	Created string `json:"created,omitempty,omitzero" xml:"created,omitempty,attr"`

	// Description is the top-level description element from the feed.
	Description string `json:"description,omitempty,omitzero" xml:"description,omitempty,attr"`

	// HTMLURL is the top-level link element.
	HTMLURL string `json:"htmlUrl,omitempty,omitzero" validate:"omitempty,url" xml:"htmlUrl,omitempty,attr"`

	// IsBreakpoint is a string, either "true" or "false", indicating whether a breakpoint is set on this outline. This attribute is mainly necessary for outlines used to edit scripts. If it's not present, the value is false.
	IsBreakpoint BreakpointState `json:"isBreakpoint,omitempty,omitzero" xml:"isBreakpoint,omitempty,attr"`

	// IsComment is a string, either "true" or "false", indicating whether the outline is commented or not. By convention if an outline is commented, all subordinate outlines are considered to also be commented. If it's not present, the value is false.
	IsComment CommentState `json:"isComment,omitempty,omitzero" xml:"isComment,omitempty,attr"`

	// Language is the value of the top-level language element.
	Language string `json:"language,omitempty,omitzero" xml:"language,omitempty,attr"`

	// Outlines contains any nested outlines of this outline.
	Outlines []Outline `json:"outlines,omitempty,omitzero" xml:"outline"`

	// Text is a textual description of the element.
	Text string `json:"text" validate:"required" xml:"text,attr"`

	// Title contains the top-level title element from the feed.
	Title string `json:"title,omitempty,omitzero" xml:"title,omitempty,attr"`

	// Type defines how the other attributes of the element are interpreted.
	Type string `json:"type,omitempty,omitzero" xml:"type,omitempty,attr"`

	// Version is the top-level description element from the feed.
	Version OutlineVersion `json:"version,omitempty,omitzero" validate:"omitempty,oneof=RSS2 RSS1 RSS scriptingNews" xml:"version,omitempty,attr"`

	// XMLURL is the http address of the feed.
	XMLURL string `json:"xmlUrl" validate:"required,url" xml:"xmlUrl,attr"`
}

Outline defines model for Outline.

func NewSubscriptionOutline

func NewSubscriptionOutline(text, url string, options ...OutlineOption) *Outline

NewSubscriptionOutline creates a new OPML feed outline object from the given options.

type OutlineOption

type OutlineOption func(*Outline)

OutlineOption is a functional option to apply to an outline.

func WithDescription

func WithDescription(desc string) OutlineOption

WithDescription option sets description of the subscription.

func WithHTMLURL

func WithHTMLURL(url string) OutlineOption

WithHTMLURL option sets a URL for the canonical HTML location (usually the source website) of the subscription.

func WithLanguage

func WithLanguage(lang string) OutlineOption

WithLanguage option sets the language the subscription contains.

func WithOutlineTitle

func WithOutlineTitle(title string) OutlineOption

WithOutlineTitle option sets the title of the subscription.

func WithVersion

func WithVersion(version OutlineVersion) OutlineOption

WithVersion sets the subscription version.

type OutlineVersion

type OutlineVersion string

OutlineVersion is the top-level description element from the feed.

const (
	OutlineVersionRSS           OutlineVersion = "RSS"
	OutlineVersionRSS1          OutlineVersion = "RSS1"
	OutlineVersionRSS2          OutlineVersion = "RSS2"
	OutlineVersionScriptingNews OutlineVersion = "scriptingNews"
)

Defines values for OutlineVersion.

type RSSOutline

type RSSOutline struct {
	// Description is the top-level description element from the feed.
	Description string `json:"description,omitempty,omitzero" xml:"description,omitempty,attr"`

	// HTMLURL is the top-level link element.
	HTMLURL string `json:"htmlUrl,omitempty,omitzero" validate:"omitempty,url" xml:"htmlUrl,omitempty,attr"`

	// Language is the value of the top-level language element.
	Language string `json:"language,omitempty,omitzero" xml:"language,omitempty,attr"`

	// Title contains the top-level title element from the feed.
	Title string `json:"title,omitempty,omitzero" xml:"title,omitempty,attr"`

	// Version is the top-level description element from the feed.
	Version RSSOutlineVersion `json:"version,omitempty,omitzero" validate:"omitempty,oneof=RSS2 RSS1 RSS scriptingNews" xml:"version,omitempty,attr"`

	// XMLURL is the http address of the feed.
	XMLURL string `json:"xmlUrl" validate:"required,url" xml:"xmlUrl,attr"`
}

RSSOutline is a possibly multiple-level list of subscriptions to feeds. Each sub-element of the body of the OPML document is a node of type rss or an outline element that contains nodes of type rss.

type RSSOutlineVersion

type RSSOutlineVersion string

RSSOutlineVersion is the top-level description element from the feed.

const (
	RSSOutlineVersionRSS           RSSOutlineVersion = "RSS"
	RSSOutlineVersionRSS1          RSSOutlineVersion = "RSS1"
	RSSOutlineVersionRSS2          RSSOutlineVersion = "RSS2"
	RSSOutlineVersionScriptingNews RSSOutlineVersion = "scriptingNews"
)

Defines values for RSSOutlineVersion.

Jump to

Keyboard shortcuts

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