Пример #1
0
class SiteInfo:
    sitename: str
    username: str
    firstname: str
    lastname: str
    fullname: str
    lang: str
    userid: int
    siteurl: str
    userpictureurl: str
    downloadfiles: int
    uploadfiles: int
    release: str
    version: str
    mobilecssurl: str
    usercanmanageownfiles: bool
    userquota: int
    usermaxuploadfilesize: int
    userhomepage: int
    userprivateaccesskey: Optional[str]
    siteid: int
    sitecalendartype: str
    usercalendartype: str
    userissiteadmin: Optional[bool]
    theme: str
    functions: List[Function] = field(factory=list)
    advancedfeatures: List[AdvancedFeatures] = field(factory=list)
Пример #2
0
class Content:
    """A piece of content to be displayed in the Mobile app.
    Constructor arguments:
    params: templates (List[Template]): Templates required by the generated content.
    params: javascript (str): JavaScript code.
    params: otherdata (List[OtherData]): Other data that can be used or manipulated by the template via 2-way data-binding.
    params: files (List[File]): Files in the content.
    params: restrict (List[Restrict]): Restrict this content to certain users or courses.
    """

    javascript: str
    templates: List[Template] = field(factory=list)
    otherdata: List[OtherData] = field(factory=list)
    files: List[File] = field(factory=list)
    restrict: List[Restrict] = field(factory=list)

    @dataclass
    class Args(BaseNameValue):
        """Args for the method are optional.
        Constructor arguments:
        params: name (str): Param name.
        params: value (str): Param value.
        """

        pass
Пример #3
0
class SignupSetting:
    """SignupSetting
    Args:
        namefields (List[str]): The order of the name fields
        passwordpolicy (Optional[str]): Password policy
        sitepolicy (Optional[str]): Site policy
        sitepolicyhandler (Optional[str]): Site policy handler
        defaultcity (Optional[str]): Default city
        country (Optional[str]): Default country
        profilefields (List[ProfileField]): Required profile fields
        recaptchapublickey (Optional[str]): Recaptcha public key
        recaptchachallengehash (Optional[str]): Recaptcha challenge hash
        recaptchachallengeimage (Optional[str]): Recaptcha challenge noscript image
        recaptchachallengejs (Optional[str]): Recaptcha challenge js url
        warnings (List[Warning]): list of warnings
    """

    namefields: List[str] = field(factory=list)
    passwordpolicy: Optional[str] = None
    sitepolicy: Optional[str] = None
    sitepolicyhandler: Optional[str] = None
    defaultcity: Optional[str] = None
    country: Optional[str] = None
    profilefields: List[ProfileField] = field(factory=list)
    recaptchapublickey: Optional[str] = None
    recaptchachallengehash: Optional[str] = None
    recaptchachallengeimage: Optional[str] = None
    recaptchachallengejs: Optional[str] = None
    warnings: List[MoodleWarning] = field(factory=list)
Пример #4
0
class Posts(ResponsesFactory[Post]):
    """List of Post
    Args:
        posts (List[Post]): list of Post
        warnings (List[Warning]): list of Warning
    """

    posts: List[Post] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Post]:
        return self.posts

    @dataclass
    class Option:
        """Option for add_discussion_post
        Args:
            name (str): The allowed keys (value format) are:
                            discussionsubscribe (bool); subscribe to the discussion?, default to true
                            private             (bool); make this reply private to the author of the parent post, default to false.
                            inlineattachmentsid (int); the draft file area id for inline attachments
                            attachmentsid       (int); the draft file area id for attachments
                            topreferredformat   (bool); convert the message & messageformat to FORMAT_HTML, defaults to false
            value (str): the value of the option, this param is validated in the external function.
        """

        name: str
        value: Union[bool, int]
Пример #5
0
class Lessons(ResponsesFactory[Lesson]):
    lessons: List[Lesson] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Lesson]:
        return self.lessons
Пример #6
0
class Grades(ResponsesFactory[GradeAssignment]):
    """Grades
    Args:
        assignments (List[GradeAssignment]): list of assignment grade information
        warnings (List[Warning]): list of warnings
    """

    assignments: List[GradeAssignment] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[GradeAssignment]:
        return self.assignments

    @dataclass
    class Create:
        """Grades for create grades
        Args:
            userid (int): The student id to operate on
            grade (float): The new grade for this user. Ignored if advanced grading used
            attemptnumber (int): The attempt number (-1 means latest attempt)
            addattempt (int): Allow another attempt if manual attempt reopen method
            workflowstate (str): The next marking workflow state
            plugindata (Optional[PluginData]): default {}
            advancedgradingdata (Optional[AdvanceGradingData]): default {}
        """

        userid: int
        grade: float
        attemptnumber: int
        addattempt: int
        workflowstate: str
        plugindata: Optional[PluginData]
        advancedgradingdata: Optional[AdvanceGradingData]
Пример #7
0
class MobileConfig(ResponsesFactory[Setting]):
    settings: List[Setting] = field(factory=list)
    warning: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Setting]:
        return self.settings
Пример #8
0
class Pages(ResponsesFactory[LessonPage]):
    """Pages
    Args:
        pages (List[LessonPage]): LessonPage fields
        warnings (List[Warning]): list of warnings
    """

    pages: List[LessonPage] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)
Пример #9
0
class Discussions(ResponsesFactory[Discussion]):
    """Discussions
    Args:
        discussions (List[Discussion]): list of Discussion
        warnings (List[Warning]): list of Warning

    Returns:
        Discussions: List of Discussion
    """

    discussions: List[Discussion] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Discussion]:
        return self.discussions

    @dataclass
    class Option:
        """Discussion Option
        Args:
            name (str): The allowed keys (value format) are:
                            discussionsubscribe (bool); subscribe to the discussion?, default to true
                            discussionpinned    (bool); is the discussion pinned, default to false
                            inlineattachmentsid (int); the draft file area id for inline attachments
                            attachmentsid       (int); the draft file area id for attachments
            value (str): The value of the option, This param is validated in the external function.
        """

        name: str
        value: Union[bool, int]

    @dataclass
    class New:
        """Response of add_discussion
        Args:
            discussionid (int): New Discussion ID
            warnings (List[Warning]): list of warnings
        """

        discussionid: int
        warnings: List[MoodleWarning] = field(factory=list)

    @dataclass
    class CanAdd:
        """Response of can_add_discussion
        Args:
            status (int): True if the user can add discussions, false otherwise.
            canpindiscussions (Optional[int]): True if the user can pin discussions, false otherwise.
            cancreateattachment (Optional[int]): True if the user can add attachments, false otherwise.
            warnings (List[Warning]): list of warnings
        """

        status: int
        canpindiscussions: Optional[int]
        cancreateattachment: Optional[int]
        warnings: List[MoodleWarning] = field(factory=list)
Пример #10
0
class Grades:
    """Grades

    Args:
        items (List[GradeItem]): An array of items associated with the grade items
        outcomes (List[OutCome]): An array of outcomes associated with the grade items
    """

    items: List[GradeItem] = field(factory=list)
    outcomes: List[OutCome] = field(factory=list)
Пример #11
0
class Week:
    """Week
    prepadding (List[int]): prepadding
    postpadding (List[int]): postpadding
    days (List[Day]): days
    """

    prepadding: List[int] = field(factory=list)
    postpadding: List[int] = field(factory=list)
    days: List[Day] = field(factory=list)
Пример #12
0
class AllowedEventTypes(ResponsesFactory[str]):
    """The type of events a user can create in the given course.

    Args:
        allowedeventtypes (List[str]): list of allowed event type
        warnings (List[Warning]): list of MoodleWarning
    """

    allowedeventtypes: List[str] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)
Пример #13
0
class Blocks(ResponsesFactory[Block]):
    """Blocks information for a course.
    params: blocks (List[Block]): List of blocks in the course.
    params: warnings (List[Warning]): warning
    """

    blocks: List[Block] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Block]:
        return self.blocks
Пример #14
0
    class Details:
        """Event details
        Constructor arguments:
        params: eventids (List[int]): List of event ids
        params: courseids (List[int]): List of course ids for which events will be returned
        params: groupids (List[int]): List of group ids for which events should be returned
        params: categoryids (List[int]): List of category ids for which events will be returned
        """

        eventids: List[int] = field(factory=list)
        courseids: List[int] = field(factory=list)
        groupids: List[int] = field(factory=list)
        categoryids: List[int] = field(factory=list)
class ActivityCompletionStatus(ResponsesFactory[ActivityCompletion]):
    """Activity Completion Statuses (List of activities completion status)
    Args:
        statuses (List[Activity]): List of activities completion status
        warnings (List[Warning]): list of warnings
    """

    statuses: List[ActivityCompletion] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[ActivityCompletion]:
        return self.statuses
Пример #16
0
class CourseByField(ResponsesFactory):
    """Get Course By Field
    Args:
        courses (List[Course]): Course
        warnings (List[Warning]): list of warnings
    """

    courses: List[Course] = field(factory=list)
    warnings: List[Warning] = field(factory=list)

    @property
    def items(self) -> List[Course]:
        return self.courses
Пример #17
0
class Assignments(ResponsesFactory[AssignmentCourse]):
    """Assigments from get assignments
    Args:
        courses (List[AssignmentCourse]): List of course with assigments
        warnings (List[Warning]): List of warnings
    """

    courses: List[AssignmentCourse] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[AssignmentCourse]:
        return self.courses
Пример #18
0
class BadgeResponse(ResponsesFactory[Badge]):
    """BadgeResponse
    Constructor arguments:
        badges (List[Badge]): list of Badge
        warnings (List[Warning]): list of warnings
    """

    badges: List[Badge] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Badge]:
        return self.badges
Пример #19
0
class Resources(ResponsesFactory[Resource]):
    """List of Resource
    Args:
        resources (List[Resource]): List of Resource
        warnings (List[Warning]): List of Warning
    """

    resources: List[Resource] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Resource]:
        return self.resources
Пример #20
0
class NewPost:
    """Response
    Args:
        postid (int): new post id
        warnings (List[Warning]): list of warnings
        post (Post): post object
        messages (List[Message]): list of warning messages
    """

    postid: int
    post: Post
    warnings: List[MoodleWarning] = field(factory=list)
    messages: List[Message] = field(factory=list)
Пример #21
0
class Folders(ResponsesFactory[Folder]):
    """Folders (list of Folder)
    Args:
        folders (List[Folder]): list of folders
        warnings (List[Warning]): list of warnings
    """

    folders: List[Folder] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Folder]:
        return self.folders
Пример #22
0
class PagesResponse(ResponsesFactory[Page]):
    """

    Args:
        pages (List[Page]): list of Page
        warnings (List[MoodleWarning]): list of MoodleWarning
    """

    pages: List[Page] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[Page]:
        return self.pages
Пример #23
0
class ParentPaths(ResponsesFactory[str]):
    """Parent Paths

    Args
        parentpaths (List[str]): Path to parent directory of the deleted files.
        warnings (List[Warning]): list of warnings
    """

    parentpaths: List[str] = field(factory=list)
    warnings: List[MoodleWarning] = field(factory=list)

    @property
    def items(self) -> List[str]:
        return self.parentpaths
Пример #24
0
class BlogEntry:
    """Blog Entry
    Constructor arguments:
    params: id: (int): Post/entry id.
    params: module: (str): Where it was published the post (blog, blog_external...).
    params: userid: (int): Post author.
    params: courseid: (int): Course where the post was created.
    params: groupid: (int): Group post was created for.
    params: moduleid: (int): Module id where the post was created (not used anymore).
    params: coursemoduleid: (int): Course module id where the post was created.
    params: subject: (str): Post subject.
    params: summary: (str): Post summary.
    params: summaryformat: (int): Default for "1" # summary format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
    params: content: (str): Post content.
    params: uniquehash: (str): Post unique hash.
    params: rating: (int): Post rating.
    params: format: (int): Post content format.
    params: attachment: (str): Post atachment.
    params: publishstate: (str): Post publish state.
    params: lastmodified: (int): When it was last modified.
    params: created: (int): When it was created.
    params: usermodified: (int): User that updated the post.
    params: summaryfiles: (List[BlogSummaryFiles]): summaryfiles
    params: attachmentfiles: (List[BlogAttachmentFile]): attachmentfiles
    params: tags: (List[BlogTag]): Tags.
    """

    id: int
    module: str
    userid: int
    courseid: int
    groupid: int
    moduleid: int
    coursemoduleid: int
    subject: str
    summary: str
    summaryformat: int
    content: Optional[str]
    uniquehash: str
    rating: int
    format: int
    attachment: str
    publishstate: str
    lastmodified: int
    created: int
    usermodified: Optional[int]
    summaryfiles: List[BlogSummaryFiles] = field(factory=list)
    attachmentfiles: List[BlogAttachmentFile] = field(factory=list)
    tags: List[BlogTag] = field(factory=list)
Пример #25
0
class UserProfile(User):
    """User Profile

    Args:
        id (int): ID of the user
        username (Optional[str]): The username
        firstname (Optional[str]): The first name(s) of the user
        lastname (Optional[str]): The family name of the user
        fullname (str): The fullname of the user
        email (Optional[str]): An email address - allow email as root@localhost
        address (Optional[str]): Postal address
        phone1 (Optional[str]): Phone 1
        phone2 (Optional[str]): Phone 2
        icq (Optional[str]): icq number
        skype (Optional[str]): skype id
        yahoo (Optional[str]): yahoo id
        aim (Optional[str]): aim id
        msn (Optional[str]): msn number
        department (Optional[str]): department
        institution (Optional[str]): institution
        idnumber (Optional[str]): An arbitrary ID code number perhaps from the institution
        interests (Optional[str]): user interests (separated by commas)
        firstaccess (Optional[int]): first access to the site (0 if never)
        lastaccess (Optional[int]): last access to the site (0 if never)
        auth (Optional[str]): Auth plugins include manual, ldap, etc
        suspended (Optional[int]): Suspend user account, either false to enable user login or true to disable it
        confirmed (Optional[int]): Active user: 1 if confirmed, 0 otherwise
        lang (Optional[str]): Language code such as "en", must exist on server
        calendartype (Optional[str]): Calendar type such as "gregorian", must exist on server
        theme (Optional[str]): Theme name such as "standard", must exist on server
        timezone (Optional[str]): Timezone code such as Australia/Perth, or 99 for default
        mailformat (Optional[int]): Mail format code is 0 for plain text, 1 for HTML etc
        description (Optional[str]): User profile description
        descriptionformat (Optional[int]): int format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
        city (Optional[str]): Home city of the user
        url (Optional[str]): URL of the user
        country (Optional[str]): Home country code of the user, such as AU or CZ
        profileimageurlsmall (str): User image profile URL - small version
        profileimageurl (str): User image profile URL - big version
        customfields (List[UserCustomField]): User custom fields (also known as user profile fields)
        preferences (List[UserPreference]): Users preferences
        groups (List[Group]): user groups
        roles (List[Role]): user roles
        enrolledcourses (List[EnrolledCourse]): Courses where the user is enrolled - limited by which courses the user is able to see
    """

    groups: List[UserGroup] = field(factory=list)
    roles: List[UserRole] = field(factory=list)
    enrolledcourses: List[EnrolledCourse] = field(factory=list)
Пример #26
0
class SearchResult(ResponsesFactory[Course]):
    """Search Result
    Args:
        total (int): total course count
        courses (List[Course]): course
        warnings (List[Warning]): list of warning
    """

    total: int
    courses: List[Course] = field(factory=list)
    warnings: List[Warning] = field(factory=list)

    @property
    def items(self) -> List[Course]:
        return self.courses
Пример #27
0
class Rubric:
    """Rubric
    Args:
        criteria (List[Criterion]): list of criterion
    """

    criteria: List[Criterion] = field(factory=list)
Пример #28
0
class GradeItem:
    """Item of Grades

    Args:
        activityid (str): The ID of the activity or "course" for the course grade item
        itemnumber (int): Will be 0 unless the module has multiple grades
        scaleid (int): The ID of the custom scale or 0
        name (str): The module name
        grademin (float): Minimum grade
        grademax (float): Maximum grade
        gradepass (float): The passing grade threshold
        locked (int): 0 means not locked, > 1 is a date to lock until
        hidden (int): 0 means not hidden, > 1 is a date to hide until
        grades (List[Grade]): list of Grade
    """

    activityid: str
    itemnumber: int
    scaleid: int
    name: str
    grademin: float
    grademax: float
    gradepass: float
    locked: int
    hidden: int
    grades: List[Grade] = field(factory=list)
Пример #29
0
class FunctionsResponses(ResponsesFactory[Response]):
    responses: List[Response] = field(factory=list)

    @property
    def items(self) -> List[Response]:
        return self.responses

    @dataclass
    class Request:
        """For requesting external function
        Constructor arguments:
        params: function (str): Function name
        params: arguments (str): Default for "{}" //JSON-encoded object with named arguments
        params: settingraw (int): Default for "" //Return raw text
        params: settingfilter (int): Default for "" //Filter text
        params: settingfileurl (int): Default for "1" //Rewrite plugin file URLs
        params: settinglang (str): Default for "" //Session language
        """

        function: str
        arguments: str = "{}"
        settingraw: Optional[int] = None
        settingfilter: Optional[int] = None
        settingfileurl: int = 1
        settinglang: str = ""
Пример #30
0
class Section:
    """Section
    Args:
        id: (int): Section ID
        name: (str): Section name
        visible: (Optional[int]): is the section visible
        summary: (str): Section description
        summaryformat: (int): summary format (1 = HTML, 0 = MOODLE, 2 = PLAIN or 4 = MARKDOWN)
        section: (Optional[int]): Section number inside the course
        hiddenbynumsections: (Optional[int]): Whether is a section hidden in the course format
        uservisible: (Optional[int]): Is the section visible for the user?
        availabilityinfo: (Optional[str]): Availability information.
        modules: (List[Module]): list of module
    """

    id: int
    name: str
    visible: Optional[int]
    summary: str
    summaryformat: int
    section: Optional[int]
    hiddenbynumsections: Optional[int]
    uservisible: Optional[int]
    availabilityinfo: Optional[str] = None
    modules: List[Module] = field(factory=list)