forlabs

package module
v0.0.0-...-d6327e4 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 7 Imported by: 0

README

forlabs

Go library for Forlabs educational service

Documentation

Index

Constants

View Source
const Endpoint = "https://bki.forlabs.ru"

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	ID     int `json:"id"`
	TaskID int `json:"task_id"`
	Status int `json:"status"`
	//Choice
	//Variant
	//Options
	LastRepliedAt        string `json:"last_replied_at"`
	AssignmentCredits    int    `json:"assignment_credits"`
	AssignmentDate       string `json:"assignment_date"`
	AssessmentLecturerID int    `json:"assessment_lecturer_id"`
	ResponsesCount       int    `json:"responses_count"`
}

type AuthenticateObject

type AuthenticateObject struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type Client

type Client struct {
	// Credentials are stored for re-authentication in case token expires
	Username string
	Password string

	// Tokens are changing after each request, so they are stored with a mutex
	TokenMutex   sync.Mutex
	CurrentToken string
	XSRFToken    string

	HTTPClient *resty.Client
}

func Authenticate

func Authenticate(username, password string) (c *Client, err error)

Authenticate method performs a request to https://bki.forlabs.ru/app/login and if successful, returns Client instance https://bki.forlabs.ru/app/login JSON username,password

func (*Client) GetGrid

func (c *Client) GetGrid() (g *Grid, err error)

/lm-vendor/repositories/sched/get_grid

func (*Client) GetPosts

func (c *Client) GetPosts()

/lm-vendor/repositories/learning/get_posts

func (*Client) GetSchedule

func (c *Client) GetSchedule(stream uint) (s *Schedule, err error)

/lm-vendor/repositories/sched/get_schedule

func (*Client) GetStudies

func (c *Client) GetStudies(stream uint) (st []Study, err error)

func (*Client) GetTasks

func (c *Client) GetTasks()

/lm-vendor/repositories/learning/get_tasks

func (*Client) Post

func (c *Client) Post(path string, data interface{}) (resp *resty.Response, err error)

type Day

type Day struct {
	Name   string `json:"name"`
	Active bool   `json:"active"`
}

type File

type File struct {
	ID          int     `json:"id"`
	Type        string  `json:"type"`
	Status      int     `json:"status"`
	Disk        string  `json:"disk"`
	Directory   *string `json:"directory"`
	UUID        string  `json:"uuid"`
	Filename    string  `json:"filename"`
	Description *string `json:"description"`
	MimeType    string  `json:"mime_type"`
	Size        int     `json:"size"`
	Width       int     `json:"width"`
	Height      int     `json:"height"`
	Sort        int     `json:"sort"`
	CreatedAt   string  `json:"created_at"`
	URL         string  `json:"url"`
	//Preview
	//Thumbnail
	HumanSize string `json:"human_size"`
}

type Grid

type Grid struct {
	Days struct {
		Mon Day `json:"mon"`
		Tue Day `json:"tue"`
		Wed Day `json:"wed"`
		Thu Day `json:"thu"`
		Fri Day `json:"fri"`
		Sat Day `json:"sat"`
		Sun Day `json:"sun"`
	} `json:"days"`
	Positions  []Position `json:"positions"`
	LessonName string     `json:"lesson_name"`
	Type       int        `json:"type"`
	Week       int        `json:"upperweek"`
}

encapsulated into grid

type Position

type Position struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type Post

type Post struct {
	ID      int    `json:"id"`
	StudyID int    `json:"study_id"`
	Title   string `json:"title"`
	Content string `json:"content"`
	// 2020-10-26T00:48:32.000000Z
	UpdatedAt   string `json:"updated_at"`
	CreatedAt   string `json:"created_at"`
	Attachments string `json:"attachments"`
	User        struct {
		Name string `json:"name"`
	} `json:"user"`
}

encapsulated into posts

type Schedule

type Schedule struct {
	Meta    ScheduleMeta    `json:"meta"`
	Streams []Stream        `json:"streams"`
	Entries []ScheduleEntry `json:"entries"`
}

type ScheduleEntry

type ScheduleEntry struct {
	Day          int      `json:"day"`
	Position     int      `json:"position"`
	Type         int      `json:"type"` // 1 - practice, 2 - lecture
	RoomName     string   `json:"room_name"`
	LecturerName string   `json:"lecturer_name"`
	StudyID      int      `json:"study_id"`
	StudyName    string   `json:"study_name"`
	Subgroup     string   `json:"subgroup"`
	Streams      []Stream `json:"streams"`
}

type ScheduleMeta

type ScheduleMeta struct {
	Type      string `json:"type"`
	IsOwn     bool   `json:"is_own"`
	StreamIDs []int  `json:"stream_ids"`
}

type Stream

type Stream struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Study

type Study struct {
	ID          uint   `json:"id"`
	VerboseName string `json:"verbose_name"`
}

type Task

type Task struct {
	ID                int     `json:"id"`
	Name              string  `json:"name"`
	Content           string  `json:"content"`
	Type              int     `json:"type"`
	CourseID          *int    `json:"course_id"`
	ChapterID         *int    `json:"chapter_id"`
	ChapterTitle      *int    `json:"chapter_title"`
	ChapterHasContent bool    `json:"chapter_has_content"`
	Level             int     `json:"level"`
	Files             []File  `json:"files"`
	PivotStatus       int     `json:"pivot_status"`
	PivotCost         int     `json:"pivot_cost"`
	PivotSort         int     `json:"pivot_sort"`
	PivotType         int     `json:"pivot_type"`
	PivotStartAt      *string `json:"pivot_start_at"`
	PivotEndAt        *string `json:"pivot_end_at"`
	PivotDescription  *string `json:"pivot_description"`
}

type Tasks

type Tasks struct {
	Assignments []Assignment `json:"assignments"`
	Tasks       []Task       `json:"tasks"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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