Documentation
¶
Index ¶
- type CheckResult
- type Client
- func (c *Client) AddGroupGuests(courseName string) error
- func (c *Client) Archive(assignmentCfg *config.AssignmentConfig, unarchive bool) error
- func (c *Client) CheckCourse(cfg *config.CourseConfig) bool
- func (c *Client) CheckCourseData(cfg *config.CourseConfig) *CheckResult
- func (c *Client) Delete(assignmentCfg *config.AssignmentConfig) error
- func (c *Client) ExistingRepoNames(assignmentCfg *config.AssignmentConfig) (map[string]bool, error)
- func (c *Client) Generate(assignmentCfg *config.AssignmentConfig, skipInvite bool) error
- func (c *Client) ProtectToBranch(assignmentCfg *config.AssignmentConfig) error
- func (c *Client) Push(assignmentCfg *config.AssignmentConfig, branchname string) error
- func (c *Client) Report(assignmentCfg *config.AssignmentConfig, templateFile *string, output *string) error
- func (c *Client) ReportData(assignmentCfg *config.AssignmentConfig) (*r.Reports, error)
- func (c *Client) ReportHTML(assignmentCfg *config.AssignmentConfig, templateFile *string, output *string) error
- func (c *Client) ReportJSON(assignmentCfg *config.AssignmentConfig, output *string) error
- func (c *Client) Setaccess(assignmentCfg *config.AssignmentConfig) error
- func (c *Client) Update(assignmentCfg *config.AssignmentConfig) error
- type DuplicateCheck
- type GroupCheck
- type Option
- type StudentCheck
- type StudentCheckStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶ added in v3.19.0
type CheckResult struct {
Course string
Students []*StudentCheck
Groups []*GroupCheck
Duplicates []*DuplicateCheck
Errors int
OK bool
}
CheckResult is the data behind CheckCourse: per-student classification for the course's students and groups, the students that appear in more than one group, and whether the whole course checks out.
type Client ¶
func NewClient ¶
NewClient builds a GitLab client from the given options. host and token are required; a bad configuration is an error rather than a panic, so a server can report it instead of dying.
func NewClientFromViper ¶ added in v3.0.1
NewClientFromViper builds a client from the global config. It is the CLI's entry point, keeping the single-token model; the web server uses NewClient with a per-user token instead.
func (*Client) AddGroupGuests ¶
AddGroupGuests adds all students from an assignment config as guests to the course subgroup (coursepath/semesterpath). This enables students to use the Dependency-Proxy.
func (*Client) Archive ¶
func (c *Client) Archive(assignmentCfg *config.AssignmentConfig, unarchive bool) error
func (*Client) CheckCourse ¶
func (c *Client) CheckCourse(cfg *config.CourseConfig) bool
func (*Client) CheckCourseData ¶ added in v3.19.0
func (c *Client) CheckCourseData(cfg *config.CourseConfig) *CheckResult
CheckCourseData resolves every roster entry of the course against GitLab and returns the classification, reporting progress per student through c.rep (so a streaming reporter can forward it live). It never prints; the CLI's CheckCourse keeps its own colored rendering.
func (*Client) ExistingRepoNames ¶ added in v3.35.0
ExistingRepoNames lists the names of the projects that actually exist in an assignment's GitLab group — one paginated group listing rather than a GetProject per student, so a whole-course overview stays cheap (one call per assignment, not per repository). The caller matches these against RepoTargets to see which repos have been generated. A missing group (assignment never generated) surfaces as an error the caller can treat as "nothing generated".
func (*Client) Generate ¶
func (c *Client) Generate(assignmentCfg *config.AssignmentConfig, skipInvite bool) error
Generate creates the repositories for an assignment. When skipInvite is true, the repos are created and seeded with starter code but students/groups are NOT added or invited — a debugging aid to exercise generation without notifying anyone.
func (*Client) ProtectToBranch ¶
func (c *Client) ProtectToBranch(assignmentCfg *config.AssignmentConfig) error
func (*Client) Push ¶
func (c *Client) Push(assignmentCfg *config.AssignmentConfig, branchname string) error
func (*Client) ReportData ¶ added in v3.16.0
ReportData returns the structured report for an assignment without rendering it to text/HTML. It is the data-returning entry point the web server uses; the CLI's Report/ReportHTML render this same data.
func (*Client) ReportHTML ¶
func (*Client) ReportJSON ¶
func (c *Client) ReportJSON(assignmentCfg *config.AssignmentConfig, output *string) error
type DuplicateCheck ¶ added in v3.19.0
DuplicateCheck is one student that appears in more than one group.
type GroupCheck ¶ added in v3.19.0
type GroupCheck struct {
Name string
Members []*StudentCheck
}
GroupCheck is the classification of one group's members.
type Option ¶ added in v3.0.1
type Option func(*clientOptions)
func WithCommitter ¶ added in v3.30.0
WithCommitter sets the identity that authors starter-code commits. Empty values fall back to the glabs bot identity. The web server passes the acting user so a generated commit is attributed to them.
func WithHTTPClient ¶ added in v3.0.1
WithHTTPClient injects the underlying HTTP client.
func WithReporter ¶ added in v3.0.1
WithReporter sets where the client's progress goes. Defaults to a ConsoleReporter (spinners on stdout); the web server passes a streaming one.
func WithoutRetries ¶ added in v3.0.1
func WithoutRetries() Option
WithoutRetries disables the client's retry-on-5xx wrapper. The contract tests use it so a mocked 5xx returns immediately instead of retrying with backoff.
type StudentCheck ¶ added in v3.19.0
type StudentCheck struct {
Input string // the raw roster entry, as written
Status StudentCheckStatus
Message string
}
StudentCheck is the classification of one roster entry.
type StudentCheckStatus ¶ added in v3.19.0
type StudentCheckStatus string
StudentCheckStatus classifies how a roster entry resolved against GitLab.
const ( // CheckOK: the user resolved (pinned by ID, or matched uniquely by email). CheckOK StudentCheckStatus = "ok" // CheckInvite: no GitLab user found, but there is an email → invite by email. CheckInvite StudentCheckStatus = "invite" // CheckDeprecated: resolved by username — works, but pinning by ID is safer. CheckDeprecated StudentCheckStatus = "deprecated" // CheckError: cannot resolve and there is no email to fall back to. CheckError StudentCheckStatus = "error" )