mapper

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2017 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlternativeImages

type AlternativeImages struct {
	PromotionalImage string `json:"promotionalImage"`
}

AlternativeImages represents the alternative images for content according to UP data model

type AlternativeStandfirsts added in v0.0.2

type AlternativeStandfirsts struct {
	PromotionalStandfirst string `json:"promotionalStandfirst"`
}

AlternativeStandfirsts represents the alternative standfirsts for content according to UP data model

type AlternativeTitles

type AlternativeTitles struct {
	PromotionalTitle string `json:"promotionalTitle"`
}

AlternativeTitles represents the alternative titles for content according to UP data model

type Attributes

type Attributes struct {
	XMLName             xml.Name `xml:"ObjectMetadata"`
	SourceCode          string   `xml:"EditorialNotes>Sources>Source>SourceCode"`
	LastPublicationDate string   `xml:"OutputChannels>DIFTcom>DIFTcomLastPublication"`
	IsDeleted           bool     `xml:"OutputChannels>DIFTcom>DIFTcomMarkDeleted"`
}

Attributes is the data structure that models methode content placeholders attributes

type Brand

type Brand struct {
	ID string `json:"id"`
}

Brand represents a content brand according to UP data model

type Identifier

type Identifier struct {
	Authority       string `json:"authority"`
	IdentifierValue string `json:"identifierValue"`
}

Identifier represents content identifiers according to UP data model

type LeadHeadline

type LeadHeadline struct {
	Text string `xml:",chardata"`
	URL  string `xml:"href,attr"`
}

LeadHeadline reppresents the LeadHeadline of a content placeholder

type LeadImage

type LeadImage struct {
	FileRef string `xml:"fileref,attr"`
}

LeadImage represents the image attribute of a methode content placeholder

type Mapper

type Mapper interface {
	HandlePlaceholderMessages(msg consumer.Message)
	StartMappingMessages(c consumer.MessageConsumer, p producer.MessageProducer)
	NewMethodeContentPlaceholderFromHTTPRequest(r *http.Request) (MethodeContentPlaceholder, *MappingError)
	MapContentPlaceholder(mpc MethodeContentPlaceholder) (UpContentPlaceholder, *MappingError)
}

Mapper is a generic interface for content paceholder mapper

func New

func New() Mapper

New returns a new Mapper instance

type MappingError

type MappingError struct {
	ContentUUID  string
	ErrorMessage string
}

MappingError is an error that can be returned by the content placeholder mapper

func NewMappingError

func NewMappingError() *MappingError

NewMappingError returs a new instance of a MappingError

func (MappingError) Error

func (e MappingError) Error() string

func (*MappingError) ForContent

func (e *MappingError) ForContent(uuid string) *MappingError

ForContent associate the mapping error to a specific piece of content

func (*MappingError) WithMessage

func (e *MappingError) WithMessage(errorMsg string) *MappingError

WithMessage adds a message to a mapping error

type MethodeBody

type MethodeBody struct {
	XMLName        xml.Name     `xml:"doc"`
	LeadHeadline   LeadHeadline `xml:"lead>lead-headline>headline>ln>a"`
	LeadImage      LeadImage    `xml:"lead>lead-images>web-master"`
	LongStandfirst string       `xml:"lead>web-stand-first>p"`
}

MethodeBody represents the body of a methode content placeholder

type MethodeContentPlaceholder

type MethodeContentPlaceholder struct {
	AttributesXML    string `json:"attributes"`
	SystemAttributes string `json:"systemAttributes"`
	Type             string `json:"type"`
	UsageTickets     string `json:"usageTickets"`
	UUID             string `json:"uuid"`
	Value            string `json:"value"`
	WorkflowStatus   string `json:"workflowStatus"`
	// contains filtered or unexported fields
}

MethodeContentPlaceholder is a data structure that models native methode content placeholders

type UpContentPlaceholder

type UpContentPlaceholder struct {
	UUID                   string                  `json:"uuid"`
	Title                  string                  `json:"title"`
	Identifiers            []Identifier            `json:"identifiers"`
	Brands                 []Brand                 `json:"brands"`
	AlternativeTitles      *AlternativeTitles      `json:"alternativeTitles"`
	AlternativeImages      *AlternativeImages      `json:"alternativeImages"`
	AlternativeStandfirsts *AlternativeStandfirsts `json:"alternativeStandfirsts"`
	PublishedDate          string                  `json:"publishedDate"`
	PublishReference       string                  `json:"publishReference"`
	LastModified           string                  `json:"lastModified"`
	WebURL                 string                  `json:"webUrl"`
	Type                   string                  `json:"type"`
	CanBeSyndicated        string                  `json:"canBeSyndicated"`
	CanBeDistributed       string                  `json:"canBeDistributed"`
}

UpContentPlaceholder reppresents the content placeholder representation according to UP model note Title holds the text of alternativeTitle as a cph does not have a title and some clients expect one.

Jump to

Keyboard shortcuts

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