search

package
v0.0.0-...-ff01a36 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LanguageIDPathParam = "languageID"
	SearchEndpoint      = "/{" + LanguageIDPathParam + "}/search/"
)

Variables

This section is empty.

Functions

func Execute

func Execute[T interface{ ToCommand() (any, error) }](
	ctx context.Context,
	svc Service,
	commander T,
) (any, error)

Types

type GetResourcesRepoAction

type GetResourcesRepoAction interface {
	GetResources(context.Context, ResourcesQuery) (entities.Resource[SearchResource], error)
}

type GetResourcesService

type GetResourcesService interface {
	Execute(context.Context, ResourcesQuery) (entities.Resource[SearchResource], error)
}

type Repo

type Repo interface {
	GetResourcesRepoAction
}

func NewRepo

func NewRepo(cl *resty.Client) Repo

type ResourceSource

type ResourceSource struct {
	// youtube, direct, netflix
	Type string `json:"type"`
	Name string `json:"name"`
	URL  string `json:"url"`
}

type ResourcesQuery

type ResourcesQuery struct {
	rest.GetDummyRequester `url:"-"`
	entities.Pagination
	SortBy     entities.SortBy        `url:"sortBy"`
	Type       entities.ResourceType  `url:"type"`
	Level      entities.ResourceLevel `url:"level"`
	Language   string                 `url:"-"`
	IsExternal bool                   `url:"isExternal,omitempty"`
	IsPersonal bool                   `url:"isPersonal,omitempty"`
	Tags       []string               `url:"tags"`
	Shelf      string                 `url:"shelf"`
	TitleName  string                 `url:"q"`
}

func (ResourcesQuery) ToPathParameter

func (r ResourcesQuery) ToPathParameter() (map[string]string, error)

func (ResourcesQuery) ToQuery

func (r ResourcesQuery) ToQuery() (url.Values, error)

type SearchResource

type SearchResource struct {
	ID           uint                    `json:"id"`
	Title        string                  `json:"title"`
	Type         entities.ResourceType   `json:"type"`
	Status       entities.ResourceStatus `json:"status"`
	Source       ResourceSource          `json:"source"`
	ImageURL     string                  `json:"imageUrl"`
	VideoURL     string                  `json:"videoUrl"`
	AudioURL     string                  `json:"audioUrl"`
	AudioPending bool                    `json:"audioPending"`
	SharedBy
	Description     string                 `json:"description"`
	CollectionID    uint                   `json:"collectionId"`
	CollectionTitle string                 `json:"collectionTitle"`
	NewWordsCount   uint                   `json:"newWordsCount"`
	Difficulty      float32                `json:"difficulty"`
	Level           entities.ResourceLevel `json:"level"`
	Date            entities.DateOnly      `json:"date"`
	Tags            []string               `json:"tags"`
	URL             string                 `json:"url"`
}

type Service

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

func NewService

func NewService(r Repo) Service

type SharedBy

type SharedBy struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Role string `json:"role"`
}

Jump to

Keyboard shortcuts

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