types

package
v0.0.0-...-5d88ada Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package types has structs for the sports news api and for its poller of news

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ArticleKey  `json:",inline"`
	Content     string    `json:"content,omitempty"`
	GalleryUrls string    `json:"galleryUrls,omitempty"`
	Id          ArticleId `json:"id"` // id should be generated from ArticleKey fields
	ImageURL    string    `json:"imageUrl,omitempty"`
	OptaMatchId string    `json:"optaMatchId,omitempty"`
	Teaser      string    `json:"teaser,omitempty"`
	Title       string    `json:"title,omitempty"`
	Type        []string  `json:"type,omitempty"`
	URL         string    `json:"url,omitempty"`
	VideoURL    string    `json:"videoUrl,omitempty"`
	HasDetails  bool      `json:"hasDetails"`
}

Article is representing a single article served by API

Use SetGeneratedId after creating the object with empty Id to set it based on ArticleKey.

func (*Article) SetGeneratedId

func (a *Article) SetGeneratedId() error

SetGeneratedId is used for setting the ID in article after creation

type ArticleDetailed

type ArticleDetailed struct {
	Status   string                  `json:"status"`
	Data     *Article                `json:"data,omitempty"`
	Message  string                  `json:"message,omitempty"`
	Metadata ArticleDetailedMetadata `json:"metadata"`
}

ArticleDetailed is struct that will be returned by sports news api.

It was generated with the help of:

go install github.com/twpayne/go-jsonstruct/v2/cmd/gojsonstruct@latest
cat examples/hullcityArticleDetailed.json | gojsonstruct

func (ArticleDetailed) GetMessage

func (d ArticleDetailed) GetMessage() string

type ArticleDetailedMetadata

type ArticleDetailedMetadata struct {
	CreatedAt time.Time `json:"createdAt"`
}

type ArticleId

type ArticleId string

type ArticleKey

type ArticleKey struct {
	TeamId    string    `json:"teamId"`
	NewsId    string    `json:"-"`
	Published time.Time `json:"published"`
}

ArticleKey represents fields that are used to generate hash from article.

type ArticleList

type ArticleList struct {
	Status   string              `json:"status"`
	Data     []Article           `json:"data,omitempty"`
	Message  string              `json:"message,omitempty"`
	Metadata ArticleListMetadata `json:"metadata"`
}

ArticleList is struct that will be returned by sports news api.

It was generated with the help of:

go install github.com/twpayne/go-jsonstruct/v2/cmd/gojsonstruct@latest
cat examples/hullcityArticleList.json | gojsonstruct

func (ArticleList) GetMessage

func (d ArticleList) GetMessage() string

type ArticleListMetadata

type ArticleListMetadata struct {
	CreatedAt  time.Time `json:"createdAt"`
	TotalItems int       `json:"totalItems,omitempty"`
	Sort       string    `json:"sort,omitempty"`
}

Jump to

Keyboard shortcuts

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