sdk

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2023 License: MIT Imports: 13 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrUnrecognisedLanguage added in v0.10.0

func ErrUnrecognisedLanguage(lang Language) error

ErrUnrecognisedLanguage builds error message when the language is not recognisable

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(topicAPIURL string) *Client

New creates a new instance of Client with a given topic api url

func NewWithHealthClient

func NewWithHealthClient(hcCli *healthcheck.Client) *Client

NewWithHealthClient creates a new instance of topic API Client, reusing the URL and Clienter from the provided healthcheck client

func (*Client) Checker

func (cli *Client) Checker(ctx context.Context, check *health.CheckState) error

Checker calls topic api health endpoint and returns a check object to the caller

func (*Client) GetNavigationPublic added in v0.10.0

func (cli *Client) GetNavigationPublic(ctx context.Context, reqHeaders Headers, options Options) (*models.Navigation, apiError.Error)

GetNavigationPublic gets the public list of navigation items

func (*Client) GetRootTopicsPrivate

func (cli *Client) GetRootTopicsPrivate(ctx context.Context, reqHeaders Headers) (*models.PrivateSubtopics, apiError.Error)

GetRootTopicsPrivate gets the private list of top level root topics for Publishing which returns both Next and Current document(s) in the response

func (*Client) GetRootTopicsPublic

func (cli *Client) GetRootTopicsPublic(ctx context.Context, reqHeaders Headers) (*models.PublicSubtopics, apiError.Error)

GetRootTopicsPublic gets the public list of top level root topics for Web which returns the Current document(s) in the response

func (*Client) GetSubtopicsPrivate

func (cli *Client) GetSubtopicsPrivate(ctx context.Context, reqHeaders Headers, id string) (*models.PrivateSubtopics, apiError.Error)

GetSubtopicsPrivate gets the private list of subtopics of a topic for Publishing which returns both Next and Current document(s) in the response

func (*Client) GetSubtopicsPublic

func (cli *Client) GetSubtopicsPublic(ctx context.Context, reqHeaders Headers, id string) (*models.PublicSubtopics, apiError.Error)

GetSubtopicsPublic gets the public list of subtopics of a topic for Web which returns the Current document(s) in the response

func (*Client) GetTopicPrivate added in v0.13.4

func (cli *Client) GetTopicPrivate(ctx context.Context, reqHeaders Headers, id string) (*models.TopicResponse, apiError.Error)

GetTopicPrivate gets the full topic resource including the Next and Current nested objects

func (*Client) GetTopicPublic added in v0.13.4

func (cli *Client) GetTopicPublic(ctx context.Context, reqHeaders Headers, id string) (*models.Topic, apiError.Error)

GetTopicPublic gets the publicly available topics

func (*Client) Health

func (cli *Client) Health() *healthcheck.Client

Health returns the underlying Healthcheck Client for this topic API client

func (*Client) PutTopicPrivate added in v0.18.0

func (cli *Client) PutTopicPrivate(ctx context.Context, reqHeaders Headers, id string, payload []byte) (*ResponseInfo, apiError.Error)

PutTopicPrivate inserts update into the topic next object and publishes if it is published

func (*Client) PutTopicReleasePrivate added in v0.14.0

func (cli *Client) PutTopicReleasePrivate(ctx context.Context, reqHeaders Headers, id string, payload []byte) (*ResponseInfo, apiError.Error)

PutTopicReleasePrivate inserts the release date into the topic next object ready for publishing

func (*Client) PutTopicStatePrivate added in v0.18.0

func (cli *Client) PutTopicStatePrivate(ctx context.Context, reqHeaders Headers, id, state string) (*ResponseInfo, apiError.Error)

PutTopicStatePrivate inserts the state into the topic next object and publishes if it is published

func (*Client) URL

func (cli *Client) URL() string

URL returns the URL used by this client

type Clienter

type Clienter interface {
	Checker(ctx context.Context, check *health.CheckState) error
	GetNavigationPublic(ctx context.Context, reqHeaders Headers, options Options) (*models.Navigation, apiError.Error)
	GetRootTopicsPrivate(ctx context.Context, reqHeaders Headers) (*models.PrivateSubtopics, apiError.Error)
	GetRootTopicsPublic(ctx context.Context, reqHeaders Headers) (*models.PublicSubtopics, apiError.Error)
	GetSubtopicsPrivate(ctx context.Context, reqHeaders Headers, id string) (*models.PrivateSubtopics, apiError.Error)
	GetSubtopicsPublic(ctx context.Context, reqHeaders Headers, id string) (*models.PublicSubtopics, apiError.Error)
	GetTopicPrivate(ctx context.Context, reqHeaders Headers, id string) (*models.TopicResponse, apiError.Error)
	GetTopicPublic(ctx context.Context, reqHeaders Headers, id string) (*models.Topic, apiError.Error)
	PutTopicPrivate(ctx context.Context, reqHeaders Headers, id string, topicUpdate []byte) (*ResponseInfo, apiError.Error)
	PutTopicStatePrivate(ctx context.Context, reqHeaders Headers, id string, topicState string) (*ResponseInfo, apiError.Error)
	PutTopicReleasePrivate(ctx context.Context, reqHeaders Headers, id string, topicRelease []byte) (*ResponseInfo, apiError.Error)
	Health() *healthcheck.Client
	URL() string
}

type Headers

type Headers struct {
	ServiceAuthToken string `json:"-"`
	UserAuthToken    string `json:"-"`
}

func (*Headers) Add

func (h *Headers) Add(req *http.Request) error

type Language added in v0.10.0

type Language string
const (
	English Language = "en"
	Welsh   Language = "cy"
)

func (Language) String added in v0.10.0

func (lang Language) String() (string, error)

type Options added in v0.10.0

type Options struct {
	Offset int
	Limit  int
	Lang   Language
}

type ResponseInfo added in v0.14.0

type ResponseInfo struct {
	Body    []byte
	Headers http.Header
	Status  int
}

type Result added in v0.14.0

type Result struct {
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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