panda

package module
v0.0.0-...-609e6b3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2022 License: MIT Imports: 11 Imported by: 0

README

This repository is forked from panda

PandA API for Golang

概要

PandAのGo言語向けAPI。今のところAssignmentsとContentしか実装してない。

2021/04/21追記: お気に入りサイトの取得機能追加

目次

使い方

go get -u github.com/TKMAX777/panda
import "github.com/TKMAX777/panda"

func main() {
    Panda := panda.NewClient()
    err := Panda.Login(ECS_ID, PASSWORD)
    if err != nil {
        panic(err)
    }
    ...
}

Documentation

Index

Constants

View Source
const BaseURI = "https://panda.ecs.kyoto-u.ac.jp"

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	Access              string `json:"access"`
	AllPurposeItemText  string `json:"allPurposeItemText"`
	AllowPeerAssessment bool   `json:"allowPeerAssessment"`
	Author              string `json:"author"`
	AuthorLastModified  string `json:"authorLastModified"`
	CloseTimeString     string `json:"closeTimeString"`
	Content             string `json:"content"`
	Context             string `json:"context"`
	Creator             string `json:"creator"`
	CloseTime           time.Time
	DropDeadTime        time.Time
	TimeLastModified    time.Time
	OpenTime            time.Time
	TimeCreated         time.Time
	DueTime             time.Time
	DropDeadTimeString  string `json:"dropDeadTimeString"`
	DueTimeString       string `json:"dueTimeString"`
	GradeScale          string `json:"gradeScale"`
	GradeScaleMaxPoints string `json:"gradeScaleMaxPoints"`
	GradebookItemId     int    `json:"gradebookItemId"`
	GradebookItemName   string `json:"gradebookItemName"`
	ID                  string `json:"id"`
	Instructions        string `json:"instructions"`
	MaxGradePoint       string `json:"maxGradePoint"`
	ModelAnswerText     string `json:"modelAnswerText"`
	OpenTimeString      string `json:"openTimeString"`
	Position            int    `json:"position"`
	PrivateNoteText     string `json:"privateNoteText"`
	Section             string `json:"section"`
	Status              string `json:"status"`
	SubmissionType      string `json:"submissionType"`
	Title               string `json:"title"`
	AllowResubmission   bool   `json:"allowResubmission"`
	AnonymousGrading    bool   `json:"anonymousGrading"`
	Draft               bool   `json:"draft"`
	EntityReference     string `json:"entityReference"`
	EntityURL           string `json:"entityURL"`
	EntityId            string `json:"entityId"`
	EntityTitle         string `json:"entityTitle"`
}

func (*Assignment) UnmarshalJSON

func (a *Assignment) UnmarshalJSON(b []byte) error

type Content

type Content struct {
	Author          string `json:"author"`
	AuthorID        string `json:"authorId"`
	Container       string `json:"container"`
	CopyRightAlert  string `json:"copyrightAlert"`
	Description     string `json:"description"`
	EndDate         string `json:"endDate"`
	FromDate        string `json:"fromDate"`
	ModifiedDate    string `json:"modifiedDate"`
	NumChildren     int    `json:"numChildren"`
	Quota           string `json:"quota"`
	Size            int    `json:"size"`
	Title           string `json:"title"`
	Type            string `json:"type"`
	URL             string `json:"url"`
	Usage           string `json:"usage"`
	Hidden          bool   `json:"hidden"`
	Visible         bool   `json:"visible"`
	EntityReference string `json:"entityReference"`
	EntityURL       string `json:"entityURL"`
	EntityTitle     string `json:"entityTitle"`
}

type Data

type Data struct {
	EntityPrefix string `json:"entityPrefix"`

	AssignmentCollection []Assignment `json:"assignment_collection"`
	ContentCollection    []Content    `json:"content_collection"`
}

type DirectSiteJsonResult

type DirectSiteJsonResult struct {
	EntityPrefix   string `json:"entityPrefix"`
	SiteCollection []Site `json:"site_collection"`
}

type FavoriteSiteList

type FavoriteSiteList struct {
	FavoriteSitesIDs     []string `json:"favoriteSiteIds"`
	AutoFavoritesEnabled bool     `json:"autoFavoritesEnabled"`
}

type Handler

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

func NewClient

func NewClient() *Handler

NewClient make new PandA Handler

func (Handler) Download

func (p Handler) Download(path string, url string) error

func (Handler) GetAllSites

func (p Handler) GetAllSites() (list DirectSiteJsonResult)

GetAllSites get all the sites which the authenticated user can see.

func (*Handler) GetAssignment

func (p *Handler) GetAssignment() (assignments []Assignment, err error)

func (*Handler) GetAssignmentDetail

func (p *Handler) GetAssignmentDetail(assignmentID string) (assignment Assignment, err error)

func (*Handler) GetContent

func (p *Handler) GetContent(siteID string) (content []Content)

func (Handler) GetFavoriteSites

func (p Handler) GetFavoriteSites() (list FavoriteSiteList)

GetFavoriteSites get sites with star

func (*Handler) GetMyInfo

func (p *Handler) GetMyInfo() (content Content)

func (*Handler) GetSiteAssignment

func (p *Handler) GetSiteAssignment(siteID string) (assignments []Assignment, err error)

func (*Handler) Login

func (p *Handler) Login(id, pass string) error

Login logins panda with put ID / PASSWORD

type Site

type Site struct {
	Id string `json:"id"`
}

Jump to

Keyboard shortcuts

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