newsdoc

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_newsdoc_newsdoc_proto protoreflect.FileDescriptor

Functions

func BlockFromRPC

func BlockFromRPC(r *Block) newsdoc.Block

BlockFromRPC converts Block protobuf messages to NewsDoc structures.

func DocumentFromRPC

func DocumentFromRPC(r *Document) newsdoc.Document

DocumentFromRPC converts Document protobuf messages to NewsDoc structures.

Types

type Block

type Block struct {

	// ID is the block ID,
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// UUID is used to reference another Document in a block.
	Uuid string `protobuf:"bytes,2,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// URI is used to reference another entity in a document.
	Uri string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"`
	// URL is a browseable URL for the the block.
	Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"`
	// Type is the type of the block
	Type string `protobuf:"bytes,5,opt,name=type,proto3" json:"type,omitempty"`
	// Title is the title/headline of the block, typically used in the
	// presentation of the block.
	Title string `protobuf:"bytes,6,opt,name=title,proto3" json:"title,omitempty"`
	// Data contains block data.
	Data map[string]string `` /* 149-byte string literal not displayed */
	// Rel describes the relationship to the document/parent entity.
	Rel string `protobuf:"bytes,8,opt,name=rel,proto3" json:"rel,omitempty"`
	// Role is used either as an alternative to rel, or for nuancing the
	// relationship.
	Role string `protobuf:"bytes,9,opt,name=role,proto3" json:"role,omitempty"`
	// Name is a name for the block. An alternative to "rel" when
	// relationship is a term that doesn't fit.
	Name string `protobuf:"bytes,10,opt,name=name,proto3" json:"name,omitempty"`
	// Value is a value for the block. Useful when we want to store a
	// primitive value.
	Value string `protobuf:"bytes,11,opt,name=value,proto3" json:"value,omitempty"`
	// ContentType is used to describe the content type of the block/linked
	// entity if it differs from the type of the block.
	Contenttype string `protobuf:"bytes,12,opt,name=contenttype,proto3" json:"contenttype,omitempty"`
	// Links are used to link to other resources and documents.
	Links []*Block `protobuf:"bytes,13,rep,name=links,proto3" json:"links,omitempty"`
	// Content is used to embed content blocks.
	Content []*Block `protobuf:"bytes,14,rep,name=content,proto3" json:"content,omitempty"`
	// Meta is used to embed metadata
	Meta []*Block `protobuf:"bytes,15,rep,name=meta,proto3" json:"meta,omitempty"`
	// Sensitivity can be use to communicate how the information in a block
	// can be handled. It could f.ex. be set to "internal", to show that it
	// contains information that must be removed or transformed before
	// publishing.
	Sensitivity string `protobuf:"bytes,16,opt,name=sensitivity,proto3" json:"sensitivity,omitempty"`
	// contains filtered or unexported fields
}

Block is the building block for data embedded in documents. It is used for both content, links and metadata. Blocks have can be nested, but that's nothing to strive for, keep it simple.

func BlockToRPC

func BlockToRPC(n newsdoc.Block) *Block

BlockToRPC converts Block protobuf messages to NewsDoc structures.

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetContent

func (x *Block) GetContent() []*Block

func (*Block) GetContenttype

func (x *Block) GetContenttype() string

func (*Block) GetData

func (x *Block) GetData() map[string]string

func (*Block) GetId

func (x *Block) GetId() string
func (x *Block) GetLinks() []*Block

func (*Block) GetMeta

func (x *Block) GetMeta() []*Block

func (*Block) GetName

func (x *Block) GetName() string

func (*Block) GetRel

func (x *Block) GetRel() string

func (*Block) GetRole

func (x *Block) GetRole() string

func (*Block) GetSensitivity added in v0.11.1

func (x *Block) GetSensitivity() string

func (*Block) GetTitle

func (x *Block) GetTitle() string

func (*Block) GetType

func (x *Block) GetType() string

func (*Block) GetUri

func (x *Block) GetUri() string

func (*Block) GetUrl

func (x *Block) GetUrl() string

func (*Block) GetUuid

func (x *Block) GetUuid() string

func (*Block) GetValue

func (x *Block) GetValue() string

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type Document

type Document struct {

	// UUID is a unique ID for the document, this can for example be a
	// random v4 UUID, or a URI-derived v5 UUID.
	Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"`
	// Type is the content type of the document.
	Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
	// URI identifies the document (in a more human-readable way than the
	// UUID).
	Uri string `protobuf:"bytes,3,opt,name=uri,proto3" json:"uri,omitempty"`
	// URL is the browseable location of the document (if any).
	Url string `protobuf:"bytes,4,opt,name=url,proto3" json:"url,omitempty"`
	// Title is the title of the document, can be used as the document name,
	// or the headline when the document is displayed.
	Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"`
	// Content is the content of the document, this is essentially what gets
	// rendered on the page when you view a document.
	Content []*Block `protobuf:"bytes,6,rep,name=content,proto3" json:"content,omitempty"`
	// Meta is the metadata for a document, this could be things like
	// teasers, open graph data, newsvalues.
	Meta []*Block `protobuf:"bytes,7,rep,name=meta,proto3" json:"meta,omitempty"`
	// Links are links to other resources and entities. This could be links
	// to topics, categories and subjects for the document, or credited
	// authors.
	Links []*Block `protobuf:"bytes,8,rep,name=links,proto3" json:"links,omitempty"`
	// Language is the language used in the document as an IETF language
	// tag. F.ex. "en", "en-UK", "es", or "sv-SE".
	Language string `protobuf:"bytes,9,opt,name=language,proto3" json:"language,omitempty"`
	// contains filtered or unexported fields
}

Document is a NewsDoc document.

func DocumentToRPC

func DocumentToRPC(n newsdoc.Document) *Document

DocumentToRPC converts Document protobuf messages to NewsDoc structures.

func (*Document) Descriptor deprecated

func (*Document) Descriptor() ([]byte, []int)

Deprecated: Use Document.ProtoReflect.Descriptor instead.

func (*Document) GetContent

func (x *Document) GetContent() []*Block

func (*Document) GetLanguage

func (x *Document) GetLanguage() string
func (x *Document) GetLinks() []*Block

func (*Document) GetMeta

func (x *Document) GetMeta() []*Block

func (*Document) GetTitle

func (x *Document) GetTitle() string

func (*Document) GetType

func (x *Document) GetType() string

func (*Document) GetUri

func (x *Document) GetUri() string

func (*Document) GetUrl

func (x *Document) GetUrl() string

func (*Document) GetUuid

func (x *Document) GetUuid() string

func (*Document) ProtoMessage

func (*Document) ProtoMessage()

func (*Document) ProtoReflect

func (x *Document) ProtoReflect() protoreflect.Message

func (*Document) Reset

func (x *Document) Reset()

func (*Document) String

func (x *Document) String() string

Jump to

Keyboard shortcuts

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