Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AstralProvider ¶
type AstralProvider struct {
// contains filtered or unexported fields
}
func NewAstralProvider ¶
func NewAstralProvider(storage Storage, httpClient HTTPClient, cacheExpire int, randomInt func(int) int) *AstralProvider
func (*AstralProvider) GetCacheKey ¶
func (p *AstralProvider) GetCacheKey() string
func (*AstralProvider) GetName ¶
func (p *AstralProvider) GetName() string
func (*AstralProvider) GetRandomPost ¶
func (*AstralProvider) GetTopPosts ¶
func (p *AstralProvider) GetTopPosts(ctx context.Context) (string, error)
type HTTPClient ¶
type HTTPClient interface {
Get(ctx context.Context, url string) (*HTTPResponse, error)
Post(ctx context.Context, url, contentType string, body interface{}) (*HTTPResponse, error)
}
Internal interfaces for providers that may need different signatures
type HTTPClientAdapter ¶
type HTTPClientAdapter struct {
// contains filtered or unexported fields
}
func NewHTTPClientAdapter ¶
func NewHTTPClientAdapter(client interfaces.HTTPClient) *HTTPClientAdapter
func (*HTTPClientAdapter) Get ¶
func (a *HTTPClientAdapter) Get(ctx context.Context, url string) (*HTTPResponse, error)
func (*HTTPClientAdapter) Post ¶
func (a *HTTPClientAdapter) Post(ctx context.Context, url, contentType string, body interface{}) (*HTTPResponse, error)
type HTTPResponse ¶
type LessWrongProvider ¶
type LessWrongProvider struct {
// contains filtered or unexported fields
}
func NewLessWrongProvider ¶
func NewLessWrongProvider(httpClient HTTPClient, randomInt func(int) int) *LessWrongProvider
func (*LessWrongProvider) GetCacheKey ¶
func (p *LessWrongProvider) GetCacheKey() string
func (*LessWrongProvider) GetName ¶
func (p *LessWrongProvider) GetName() string
func (*LessWrongProvider) GetRandomPost ¶
func (*LessWrongProvider) GetTopPosts ¶
func (p *LessWrongProvider) GetTopPosts(ctx context.Context) (string, error)
type LessWrongRuProvider ¶
type LessWrongRuProvider struct {
// contains filtered or unexported fields
}
func NewLessWrongRuProvider ¶
func NewLessWrongRuProvider(storage Storage, cacheExpire int, randomInt func(int) int) *LessWrongRuProvider
func (*LessWrongRuProvider) GetCacheKey ¶
func (p *LessWrongRuProvider) GetCacheKey() string
func (*LessWrongRuProvider) GetName ¶
func (p *LessWrongRuProvider) GetName() string
func (*LessWrongRuProvider) GetRandomPost ¶
func (*LessWrongRuProvider) GetTopPosts ¶
func (p *LessWrongRuProvider) GetTopPosts(ctx context.Context) (string, error)
type PostProvider ¶
type ProviderFactory ¶
type ProviderFactory struct {
// contains filtered or unexported fields
}
func NewProviderFactory ¶
func NewProviderFactory( storage interfaces.Storage, httpClient interfaces.HTTPClient, cacheExpire int, randomInt func(int) int, ) *ProviderFactory
func (*ProviderFactory) CreateProvider ¶
func (f *ProviderFactory) CreateProvider(source models.Source) PostProvider
func (*ProviderFactory) GetMarkdownConverter ¶
func (f *ProviderFactory) GetMarkdownConverter(source models.Source) *md.Converter
func (*ProviderFactory) ShouldUseURLWithText ¶
func (f *ProviderFactory) ShouldUseURLWithText(source models.Source) bool
type SlateProvider ¶
type SlateProvider struct {
// contains filtered or unexported fields
}
func NewSlateProvider ¶
func NewSlateProvider(storage Storage, cacheExpire int, randomInt func(int) int) *SlateProvider
func (*SlateProvider) GetCacheKey ¶
func (p *SlateProvider) GetCacheKey() string
func (*SlateProvider) GetName ¶
func (p *SlateProvider) GetName() string
func (*SlateProvider) GetRandomPost ¶
func (*SlateProvider) GetTopPosts ¶
func (p *SlateProvider) GetTopPosts(ctx context.Context) (string, error)
type StorageAdapter ¶
type StorageAdapter struct {
// contains filtered or unexported fields
}
func NewStorageAdapter ¶
func NewStorageAdapter(storage interfaces.Storage) *StorageAdapter
Click to show internal directories.
Click to hide internal directories.