course

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: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LanguageIDPathParam = "languageID"
	CourseIDPathParam   = "courseID"

	CollectionQueryParam = "collection"

	PostCoursesEndpoint = "/{" + LanguageIDPathParam + "}/collections/"
	GetCoursesEndpoint  = "/{" + LanguageIDPathParam + "}/collections/{" + CourseIDPathParam + "}/"
)
View Source
const ImageFileParamName string = "image"

Variables

This section is empty.

Functions

func Execute

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

Types

type AddCourse

type AddCourse struct {
	Title       string `json:"title"       example:"eventyr for barn"`
	Language    string `json:"language"    example:"no"`
	Description string `json:"description" example:"Du vil lære å lese eventyr for barn"`
	Level       uint   `json:"level"       example:"2"`
	SourceURL   string `json:"sourceUrl"   example:"https://www.barneforlaget.no/hør-så-mye-du-vil"`
	Tags        Tags   `json:"tags"`
}

type CounterCourse

type CounterCourse struct {
	CardsCount        uint    `json:"cardsCount"`
	HasFlags          bool    `json:"hasFlags"`
	KnownWordsCount   uint    `json:"knownWordsCount"`
	TotalWordsCount   uint    `json:"totalWordsCount"`
	RoseGiven         bool    `json:"roseGiven"`
	RosesCount        uint    `json:"rosesCount"`
	LessonsCount      uint    `json:"lessonsCount"`
	Difficulty        float32 `json:"difficulty"`
	IsTaken           bool    `json:"isTaken"`
	NewWordsCount     uint    `json:"newWordsCount"`
	CourseID          int     `json:"pk"`
	Progress          any     `json:"progress"`
	IsCompletelyTaken bool    `json:"isCompletelyTaken"`
	UniqueWordsCount  uint    `json:"uniqueWordsCount"`
}

type CounterCourses

type CounterCourses map[CourseID]CounterCourse

type Course

type Course struct {
	ID               uint    `json:"id"`
	URL              string  `json:"url"`
	Title            string  `json:"title"`
	Description      string  `json:"description"`
	ImageURL         string  `json:"imageUrl"`
	OriginalImageURL string  `json:"originalImageUrl"`
	LessonsCount     uint    `json:"lessonsCount"`
	Difficulty       float32 `json:"difficulty"`
	SharedByID       string  `json:"sharedById"`
	SharedByName     string  `json:"sharedByName"`
	SharedByImageURL string  `json:"sharedByImageUrl"`
	Tags             Tags    `json:"tags"`
	Type             string  `json:"type"`
}

type CourseCommand

type CourseCommand struct {
	rest.PostDummyRequester
	Image       string
	Title       string `example:"eventyr for barn"`
	Language    string `example:"no"`
	Description string `example:"Du vil lære å lese eventyr for barn"`
	Level       uint   `example:"2"`
	SourceURL   string `example:"https://www.barneforlaget.no/hør-så-mye-du-vil"`
	Tags        Tags
}

func (CourseCommand) After

func (c CourseCommand) After(req *resty.Request) (*resty.Request, error)

func (CourseCommand) Files

func (c CourseCommand) Files() map[string]string

func (CourseCommand) FormData

func (c CourseCommand) FormData() url.Values

func (CourseCommand) ToBody

func (c CourseCommand) ToBody() (any, error)

CourseCommand

func (CourseCommand) ToPathParameter

func (c CourseCommand) ToPathParameter() (map[string]string, error)

type CourseID

type CourseID string

type CourseQuery

type CourseQuery struct {
	rest.GetDummyRequester
	IDs      []uint
	Title    string
	Language string
}

func (CourseQuery) Filter

func (c CourseQuery) Filter()

func (CourseQuery) ToPathParameter

func (c CourseQuery) ToPathParameter() (map[string]string, error)

func (CourseQuery) ToQuery

func (c CourseQuery) ToQuery() (url.Values, error)

CourseQuery

type Courses

type Courses []Course

type GetCourseByIDRepoAction

type GetCourseByIDRepoAction interface {
	GetCourseByID(context.Context, CourseQuery) (Course, error)
}

type GetCourseByIDService

type GetCourseByIDService interface {
	GetCourse(context.Context, CourseQuery) (Course, error)
}

type GetCoursesByIDRepoAction

type GetCoursesByIDRepoAction interface {
	GetCoursesByID(context.Context, CourseQuery) (CounterCourses, error)
}

type GetCoursesByIDService

type GetCoursesByIDService interface {
	GetCoursesByID(context.Context, CourseQuery) (CounterCourses, error)
}

type GetCoursesRepoAction

type GetCoursesRepoAction interface {
	GetCourses(context.Context, CourseQuery) (entities.Resource[Course], error)
}

type GetCoursesService

type GetCoursesService interface {
	GetCourses(context.Context, CourseQuery) (entities.Resource[Course], error)
}

type PostCourseRepoAction

type PostCourseRepoAction interface {
	PostCourse(context.Context, CourseCommand) (Course, error)
}

type PostCourseService

type PostCourseService interface {
	PostCourse(context.Context, CourseCommand) (Course, error)
}

type Repo

func NewRepo

func NewRepo(cl *resty.Client) Repo

type Tag

type Tag string

type Tags

type Tags []Tag

Jump to

Keyboard shortcuts

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