diff --git a/.gitignore b/.gitignore index d123994..077a442 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,4 @@ vmlinux api/api worker/worker api/graph/api/generated.go -api/loaders/*_gen.go +*_gen.go diff --git a/api/graph/model/models_gen.go b/api/graph/model/models_gen.go deleted file mode 100644 index 0d1a229..0000000 --- a/api/graph/model/models_gen.go +++ /dev/null @@ -1,345 +0,0 @@ -// Code generated by github.com/99designs/gqlgen, DO NOT EDIT. - -package model - -import ( - "fmt" - "io" - "strconv" - "time" - - "git.sr.ht/~sircmpwn/core-go/model" -) - -type Entity interface { - IsEntity() -} - -type EmailTriggerInput struct { - To string `json:"to"` - Cc *string `json:"cc"` - InReplyTo *string `json:"inReplyTo"` -} - -// A cursor for enumerating a list of jobs -// -// If there are additional results available, the cursor object may be passed -// back into the same endpoint to retrieve another page. If the cursor is null, -// there are no remaining results to return. -type JobCursor struct { - Results []*Job `json:"results"` - Cursor *model.Cursor `json:"cursor"` -} - -type Log struct { - // The most recently written 128 KiB of the build log. - Last128KiB string `json:"last128KiB"` - // The URL at which the full build log can be downloaded with a GET request - // (text/plain). - FullURL string `json:"fullURL"` -} - -// A cursor for enumerating a list of secrets -// -// If there are additional results available, the cursor object may be passed -// back into the same endpoint to retrieve another page. If the cursor is null, -// there are no remaining results to return. -type SecretCursor struct { - Results []Secret `json:"results"` - Cursor *model.Cursor `json:"cursor"` -} - -type Settings struct { - SSHUser string `json:"sshUser"` - BuildTimeout string `json:"buildTimeout"` -} - -type TriggerInput struct { - Type TriggerType `json:"type"` - Condition TriggerCondition `json:"condition"` - Email *EmailTriggerInput `json:"email"` - Webhook *WebhookTriggerInput `json:"webhook"` -} - -type Version struct { - Major int `json:"major"` - Minor int `json:"minor"` - Patch int `json:"patch"` - // If this API version is scheduled for deprecation, this is the date on which - // it will stop working; or null if this API version is not scheduled for - // deprecation. - DeprecationDate *time.Time `json:"deprecationDate"` - Settings *Settings `json:"settings"` -} - -type WebhookTriggerInput struct { - URL string `json:"url"` -} - -type AccessKind string - -const ( - AccessKindRo AccessKind = "RO" - AccessKindRw AccessKind = "RW" -) - -var AllAccessKind = []AccessKind{ - AccessKindRo, - AccessKindRw, -} - -func (e AccessKind) IsValid() bool { - switch e { - case AccessKindRo, AccessKindRw: - return true - } - return false -} - -func (e AccessKind) String() string { - return string(e) -} - -func (e *AccessKind) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = AccessKind(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid AccessKind", str) - } - return nil -} - -func (e AccessKind) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - -type AccessScope string - -const ( - AccessScopeProfile AccessScope = "PROFILE" - AccessScopeJobs AccessScope = "JOBS" - AccessScopeLogs AccessScope = "LOGS" - AccessScopeSecrets AccessScope = "SECRETS" -) - -var AllAccessScope = []AccessScope{ - AccessScopeProfile, - AccessScopeJobs, - AccessScopeLogs, - AccessScopeSecrets, -} - -func (e AccessScope) IsValid() bool { - switch e { - case AccessScopeProfile, AccessScopeJobs, AccessScopeLogs, AccessScopeSecrets: - return true - } - return false -} - -func (e AccessScope) String() string { - return string(e) -} - -func (e *AccessScope) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = AccessScope(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid AccessScope", str) - } - return nil -} - -func (e AccessScope) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - -type JobStatus string - -const ( - JobStatusPending JobStatus = "PENDING" - JobStatusQueued JobStatus = "QUEUED" - JobStatusRunning JobStatus = "RUNNING" - JobStatusSuccess JobStatus = "SUCCESS" - JobStatusFailed JobStatus = "FAILED" - JobStatusTimeout JobStatus = "TIMEOUT" - JobStatusCancelled JobStatus = "CANCELLED" -) - -var AllJobStatus = []JobStatus{ - JobStatusPending, - JobStatusQueued, - JobStatusRunning, - JobStatusSuccess, - JobStatusFailed, - JobStatusTimeout, - JobStatusCancelled, -} - -func (e JobStatus) IsValid() bool { - switch e { - case JobStatusPending, JobStatusQueued, JobStatusRunning, JobStatusSuccess, JobStatusFailed, JobStatusTimeout, JobStatusCancelled: - return true - } - return false -} - -func (e JobStatus) String() string { - return string(e) -} - -func (e *JobStatus) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = JobStatus(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid JobStatus", str) - } - return nil -} - -func (e JobStatus) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - -type TaskStatus string - -const ( - TaskStatusPending TaskStatus = "PENDING" - TaskStatusRunning TaskStatus = "RUNNING" - TaskStatusSuccess TaskStatus = "SUCCESS" - TaskStatusFailed TaskStatus = "FAILED" - TaskStatusSkipped TaskStatus = "SKIPPED" -) - -var AllTaskStatus = []TaskStatus{ - TaskStatusPending, - TaskStatusRunning, - TaskStatusSuccess, - TaskStatusFailed, - TaskStatusSkipped, -} - -func (e TaskStatus) IsValid() bool { - switch e { - case TaskStatusPending, TaskStatusRunning, TaskStatusSuccess, TaskStatusFailed, TaskStatusSkipped: - return true - } - return false -} - -func (e TaskStatus) String() string { - return string(e) -} - -func (e *TaskStatus) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = TaskStatus(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid TaskStatus", str) - } - return nil -} - -func (e TaskStatus) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - -type TriggerCondition string - -const ( - TriggerConditionSuccess TriggerCondition = "SUCCESS" - TriggerConditionFailure TriggerCondition = "FAILURE" - TriggerConditionAlways TriggerCondition = "ALWAYS" -) - -var AllTriggerCondition = []TriggerCondition{ - TriggerConditionSuccess, - TriggerConditionFailure, - TriggerConditionAlways, -} - -func (e TriggerCondition) IsValid() bool { - switch e { - case TriggerConditionSuccess, TriggerConditionFailure, TriggerConditionAlways: - return true - } - return false -} - -func (e TriggerCondition) String() string { - return string(e) -} - -func (e *TriggerCondition) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = TriggerCondition(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid TriggerCondition", str) - } - return nil -} - -func (e TriggerCondition) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -} - -type TriggerType string - -const ( - TriggerTypeEmail TriggerType = "EMAIL" - TriggerTypeWebhook TriggerType = "WEBHOOK" -) - -var AllTriggerType = []TriggerType{ - TriggerTypeEmail, - TriggerTypeWebhook, -} - -func (e TriggerType) IsValid() bool { - switch e { - case TriggerTypeEmail, TriggerTypeWebhook: - return true - } - return false -} - -func (e TriggerType) String() string { - return string(e) -} - -func (e *TriggerType) UnmarshalGQL(v interface{}) error { - str, ok := v.(string) - if !ok { - return fmt.Errorf("enums must be strings") - } - - *e = TriggerType(str) - if !e.IsValid() { - return fmt.Errorf("%s is not a valid TriggerType", str) - } - return nil -} - -func (e TriggerType) MarshalGQL(w io.Writer) { - fmt.Fprint(w, strconv.Quote(e.String())) -}