client

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clienter

type Clienter interface {
	AddNavigationCache(ctx context.Context, updateInterval *time.Duration) error
	GetNavigationData(ctx context.Context, lang string) (*topicModel.Navigation, error)
	Close()
	StartBackgroundUpdate(ctx context.Context, errorChannel chan error)
}

Clienter is an interface with methods required for navigation cache

func NewPublishingClient

func NewPublishingClient(ctx context.Context, clients *Clients, languages []string) Clienter

func NewWebClient

func NewWebClient(ctx context.Context, clients *Clients, languages []string) (Clienter, error)

type ClienterMock

type ClienterMock struct {
	// AddNavigationCacheFunc mocks the AddNavigationCache method.
	AddNavigationCacheFunc func(ctx context.Context, updateInterval *time.Duration) error

	// CloseFunc mocks the Close method.
	CloseFunc func()

	// GetNavigationDataFunc mocks the GetNavigationData method.
	GetNavigationDataFunc func(ctx context.Context, lang string) (*topicModel.Navigation, error)

	// StartBackgroundUpdateFunc mocks the StartBackgroundUpdate method.
	StartBackgroundUpdateFunc func(ctx context.Context, errorChannel chan error)
	// contains filtered or unexported fields
}

ClienterMock is a mock implementation of Clienter.

func TestSomethingThatUsesClienter(t *testing.T) {

	// make and configure a mocked Clienter
	mockedClienter := &ClienterMock{
		AddNavigationCacheFunc: func(ctx context.Context, updateInterval time.Duration) error {
			panic("mock out the AddNavigationCache method")
		},
		CloseFunc: func()  {
			panic("mock out the Close method")
		},
		GetNavigationDataFunc: func(ctx context.Context, lang string) (*topicModel.Navigation, error) {
			panic("mock out the GetNavigationData method")
		},
		StartBackgroundUpdateFunc: func(ctx context.Context, errorChannel chan error)  {
			panic("mock out the StartBackgroundUpdate method")
		},
	}

	// use mockedClienter in code that requires Clienter
	// and then make assertions.

}

func (*ClienterMock) AddNavigationCache

func (mock *ClienterMock) AddNavigationCache(ctx context.Context, updateInterval *time.Duration) error

AddNavigationCache calls AddNavigationCacheFunc.

func (*ClienterMock) AddNavigationCacheCalls

func (mock *ClienterMock) AddNavigationCacheCalls() []struct {
	Ctx            context.Context
	UpdateInterval time.Duration
}

AddNavigationCacheCalls gets all the calls that were made to AddNavigationCache. Check the length with:

len(mockedClienter.AddNavigationCacheCalls())

func (*ClienterMock) Close

func (mock *ClienterMock) Close()

Close calls CloseFunc.

func (*ClienterMock) CloseCalls

func (mock *ClienterMock) CloseCalls() []struct {
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedClienter.CloseCalls())

func (*ClienterMock) GetNavigationData

func (mock *ClienterMock) GetNavigationData(ctx context.Context, lang string) (*topicModel.Navigation, error)

GetNavigationData calls GetNavigationDataFunc.

func (*ClienterMock) GetNavigationDataCalls

func (mock *ClienterMock) GetNavigationDataCalls() []struct {
	Ctx  context.Context
	Lang string
}

GetNavigationDataCalls gets all the calls that were made to GetNavigationData. Check the length with:

len(mockedClienter.GetNavigationDataCalls())

func (*ClienterMock) StartBackgroundUpdate

func (mock *ClienterMock) StartBackgroundUpdate(ctx context.Context, errorChannel chan error)

StartBackgroundUpdate calls StartBackgroundUpdateFunc.

func (*ClienterMock) StartBackgroundUpdateCalls

func (mock *ClienterMock) StartBackgroundUpdateCalls() []struct {
	Ctx          context.Context
	ErrorChannel chan error
}

StartBackgroundUpdateCalls gets all the calls that were made to StartBackgroundUpdate. Check the length with:

len(mockedClienter.StartBackgroundUpdateCalls())

type Clients

type Clients struct {
	Topic topicCli.Clienter
}

Clients contains all the required Clients for navigation cache

type PublishingClient

type PublishingClient struct {
	Updater
	// contains filtered or unexported fields
}

func (*PublishingClient) AddNavigationCache

func (hpc *PublishingClient) AddNavigationCache(ctx context.Context, updateInterval *time.Duration) error

func (*PublishingClient) Close

func (hpc *PublishingClient) Close()

func (*PublishingClient) GetNavigationData

func (hpc *PublishingClient) GetNavigationData(ctx context.Context, lang string) (*topicModel.Navigation, error)

func (*PublishingClient) StartBackgroundUpdate

func (hpc *PublishingClient) StartBackgroundUpdate(ctx context.Context, errorChannel chan error)

type Updater

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

func (*Updater) UpdateNavigationData

func (hu *Updater) UpdateNavigationData(ctx context.Context, lang string) func() *topicModel.Navigation

type WebClient

type WebClient struct {
	Updater
	// contains filtered or unexported fields
}

func (*WebClient) AddNavigationCache

func (hwc *WebClient) AddNavigationCache(ctx context.Context, updateInterval *time.Duration) error

func (*WebClient) Close

func (hwc *WebClient) Close()

func (*WebClient) GetNavigationData

func (hwc *WebClient) GetNavigationData(ctx context.Context, lang string) (*topicModel.Navigation, error)

func (*WebClient) StartBackgroundUpdate

func (hwc *WebClient) StartBackgroundUpdate(ctx context.Context, errorChannel chan error)

Jump to

Keyboard shortcuts

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