internal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExportPath   = "/admin/cli/export_webservices.php"
	ExportScript = `` /* 1784-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func InstallCatalystRestApiPlugin

func InstallCatalystRestApiPlugin(path string) error

InstallCatalystRestApiPlugin installs the Catalyst RESTful API plugin into the Moodle installation at the given path.

func InstallCliScript

func InstallCliScript(path string) error

InstallCliScript installs the webservices export CLI script into the moodle installation at the given path.

func OptionalBool

func OptionalBool(b bool) *bool

OptionalBool returns a pointer to a bool if the input bool is false

func OptionalString

func OptionalString(s string) *string

OptionalString returns a pointer to a string if the input string is not empty

func PrettyPrintMoodleInstallation

func PrettyPrintMoodleInstallation(installation *MoodleInstallation)

PrettyPrintMoodleInstallation prints the details of the given Moodle installation

func RunBootstrap

func RunBootstrap(path string, skipCliScript bool, skipCatalystPlugin bool) error

RunBootstrap runs the bootstrap process for the Moodle installation.

func RunGenerate

func RunGenerate(opts OpenApiGeneratorOptions) error

Run generates an OpenAPI spec from the given options.

func UninstallCatalystRestApiPlugin

func UninstallCatalystRestApiPlugin(path string) error

UninstallCatalystRestApiPlugin removes the Catalyst RESTful API plugin from the Moodle installation at the given path.

func UninstallCliScript

func UninstallCliScript(path string) error

UninstallCliScript removes the webservices export CLI script from the moodle installation at the given path.

Types

type BoolOrString

type BoolOrString bool

custom type for handling properties like allowed_from_ajax that can be either a boolean or a stringified boolean value

func (*BoolOrString) UnmarshalJSON

func (bos *BoolOrString) UnmarshalJSON(data []byte) error

type Description

type Description struct {
	Default   interface{} `json:"default"`
	Desc      string      `json:"desc"`
	Required  int         `json:"required"`
	AllowNull bool        `json:"allownull"`
}

type DynamicContent

type DynamicContent struct {
	Keys KeysList `json:"keys,omitempty"`
	Description
}

type Key

type Key struct {
	Content *DynamicContent `json:"content,omitempty"`
	Keys    KeysList        `json:"keys,omitempty"`
	Type    string          `json:"type,omitempty"`
	Description
}

type KeysList

type KeysList map[string]*Key

Moodle is unfortunately inconsistent here, so making a custom type for handling keys that can be either an object or an array

func (*KeysList) UnmarshalJSON

func (kl *KeysList) UnmarshalJSON(data []byte) error

type MethodDetails

type MethodDetails struct {
	ClassPath        *string        `json:"classpath"`
	Services         *string        `json:"services"`
	AjaxMethod       string         `json:"ajax_method"`
	DeprecatedMethod string         `json:"deprecated_method"`
	ClassName        string         `json:"classname"`
	Component        string         `json:"component"`
	Capabilities     string         `json:"capabilities"`
	Name             string         `json:"name"`
	ID               string         `json:"id"`
	ParametersMethod string         `json:"parameters_method"`
	ReturnsMethod    string         `json:"returns_method"`
	MethodName       string         `json:"methodname"`
	Type             string         `json:"type"`
	Description      string         `json:"description"`
	ReturnsDesc      DynamicContent `json:"returns_desc"`
	ParametersDesc   DynamicContent `json:"parameters_desc"`
	AllowedFromAjax  BoolOrString   `json:"allowed_from_ajax"`
	LoginRequired    BoolOrString   `json:"loginrequired"`
	ReadOnlySession  BoolOrString   `json:"readonlysession"`
}

type Methods

type Methods map[string]MethodDetails

func LoadMethods

func LoadMethods(filePath string) (Methods, error)

LoadMethods loads methods from a JSON file

func LoadMethodsFromBytes

func LoadMethodsFromBytes(data []byte) (Methods, error)

LoadMethodsFromBytes loads methods from a byte slice containing JSON data

func LoadMethodsFromExec

func LoadMethodsFromExec(scriptPath string) (Methods, error)

LoadMethodsFromExec runs the generator script and loads the methods from the output.

type MoodleInstallation

type MoodleInstallation struct {
	Path     string
	Release  string
	Branch   string
	Maturity string
	Version  float64
}

func GetMoodleInstallation

func GetMoodleInstallation(path string) (*MoodleInstallation, error)

GetMoodleInstallation returns details about the Moodle installation at the given path.

type OpenApiGeneratorOptions

type OpenApiGeneratorOptions struct {
	MoodleInstallation *MoodleInstallation
	WebservicesPath    string
	OutputPath         string
}

Jump to

Keyboard shortcuts

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