Documentation ¶
Index ¶
- Constants
- func InstallCatalystRestApiPlugin(path string) error
- func InstallCliScript(path string) error
- func OptionalBool(b bool) *bool
- func OptionalString(s string) *string
- func PrettyPrintMoodleInstallation(installation *MoodleInstallation)
- func RunBootstrap(path string, skipCliScript bool, skipCatalystPlugin bool) error
- func RunGenerate(opts OpenApiGeneratorOptions) error
- func UninstallCatalystRestApiPlugin(path string) error
- func UninstallCliScript(path string) error
- type BoolOrString
- type Description
- type DynamicContent
- type Key
- type KeysList
- type MethodDetails
- type Methods
- type MoodleInstallation
- type OpenApiGeneratorOptions
Constants ¶
const ( ExportPath = "/admin/cli/export_webservices.php" ExportScript = `` /* 1784-byte string literal not displayed */ )
Variables ¶
This section is empty.
Functions ¶
func InstallCatalystRestApiPlugin ¶
InstallCatalystRestApiPlugin installs the Catalyst RESTful API plugin into the Moodle installation at the given path.
func InstallCliScript ¶
InstallCliScript installs the webservices export CLI script into the moodle installation at the given path.
func OptionalBool ¶
OptionalBool returns a pointer to a bool if the input bool is false
func OptionalString ¶
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 ¶
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 ¶
UninstallCatalystRestApiPlugin removes the Catalyst RESTful API plugin from the Moodle installation at the given path.
func UninstallCliScript ¶
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 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 ¶
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 ¶
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 ¶
LoadMethods loads methods from a JSON file
func LoadMethodsFromBytes ¶
LoadMethodsFromBytes loads methods from a byte slice containing JSON data
func LoadMethodsFromExec ¶
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 }