canvas

package
v0.0.0-...-da3e9ca Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020, 2021, 2022 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

canvasctl: Use Canvas LMS from command line

Copyright (C) 2020 Marcus Gelderie

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const UnknownCourse = "UNKNOWN"

Variables

This section is empty.

Functions

This section is empty.

Types

type CanvasCourse

type CanvasCourse interface {
	AsName() string
	AsId() (rest.CanvasId, error)
}

func CourseFromId

func CourseFromId(api rest.API, id rest.CanvasId) CanvasCourse

func CourseFromName

func CourseFromName(api rest.API, name string) CanvasCourse

type Context

type Context struct {
	API        rest.API
	CliContext *cli.Context
}

func NewContext

func NewContext(cliContext *cli.Context) (*Context, error)

func (*Context) ListAccounts

func (ctx *Context) ListAccounts() error

func (*Context) ListCourses

func (ctx *Context) ListCourses() error

func (*Context) MoveFile

func (ctx *Context) MoveFile(fileId, newFolderId rest.CanvasId) error

func (*Context) PublishFile

func (ctx *Context) PublishFile(id rest.CanvasId, publish bool) error

type CourseContext

type CourseContext struct {
	Context
	// contains filtered or unexported fields
}

func NewCourseContext

func NewCourseContext(cliContext *cli.Context) (*CourseContext, error)

func (*CourseContext) AddModule

func (ctx *CourseContext) AddModule(name string) (rest.CanvasId, error)

func (*CourseContext) AddModuleItem

func (ctx *CourseContext) AddModuleItem(moduleId, contentId rest.CanvasId, title string, t ModuleItemType) (rest.CanvasId, error)

func (*CourseContext) BuildCourseDirTree

func (ctx *CourseContext) BuildCourseDirTree() (DirectoryTree, []DirectoryTree, error)

func (*CourseContext) Course

func (ctx *CourseContext) Course() CanvasCourse

func (*CourseContext) CreateQuizFromReader

func (ctx *CourseContext) CreateQuizFromReader(reader io.Reader) error

func (*CourseContext) DeleteQuiz

func (ctx *CourseContext) DeleteQuiz(quizId rest.CanvasId) error

func (*CourseContext) FindModuleItem

func (c *CourseContext) FindModuleItem(moduleId rest.CanvasId, matcher ModuleItemMatcher) (rest.ModuleItem, bool)

func (*CourseContext) GetQuizObject

func (ctx *CourseContext) GetQuizObject(quizId rest.CanvasId) (rest.Quiz, error)

func (*CourseContext) ListFiles

func (ctx *CourseContext) ListFiles() error

func (*CourseContext) ListModules

func (ctx *CourseContext) ListModules() error

func (*CourseContext) ListQuizzes

func (ctx *CourseContext) ListQuizzes() ([]rest.Quiz, error)

func (*CourseContext) ModuleIdFromName

func (ctx *CourseContext) ModuleIdFromName(name string, create bool) (rest.CanvasId, error)

func (*CourseContext) PushFile

func (ctx *CourseContext) PushFile(localname, remotename, remotepath string) (rest.CanvasId, string, error)

func (*CourseContext) ResolvePath

func (ctx *CourseContext) ResolvePath(path string) (ResolvedPath, error)

func (*CourseContext) ShowCourse

func (ctx *CourseContext) ShowCourse() error

func (*CourseContext) UpdateQuiz

func (ctx *CourseContext) UpdateQuiz(quizId rest.CanvasId, quiz rest.QuizCreationSpec) error

type DirectoryTree

type DirectoryTree interface {
	Name() string
	Parent() DirectoryTree
	Children() []DirectoryTree
	FolderInfo() rest.FolderInfo
	Files() []rest.FileInfo
}

type ModuleItemMatcher

type ModuleItemMatcher func(rest.ModuleItem) bool

type ModuleItemType

type ModuleItemType int
const (
	MODITEM_FILE       ModuleItemType = iota
	MODITEM_PAGE       ModuleItemType = iota
	MODITEM_DISCUSSION ModuleItemType = iota
	MODITEM_ASSIGNMENT ModuleItemType = iota
	MODITEM_QUIZ       ModuleItemType = iota
	MODITEM_SUBHEADER  ModuleItemType = iota
	MODITEM_EXTURL     ModuleItemType = iota
	MODITEM_EXTTOOL    ModuleItemType = iota
)

func (ModuleItemType) ToCanvasName

func (t ModuleItemType) ToCanvasName() string

type ResolvedPath

type ResolvedPath struct {
	Filename string
	Path     string
	Files    []rest.FileInfo
	Folders  []rest.FolderInfo
}

Directories

Path Synopsis
canvasctl: Use Canvas LMS from command line
canvasctl: Use Canvas LMS from command line

Jump to

Keyboard shortcuts

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