// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. package org_tangled // schema: org.tangled.ci.defs import ( "encoding/json" "fmt" "github.com/bluesky-social/indigo/lex/util" ) const () // CiDefs_ExternalSource is a "externalSource" in the org.tangled.ci.defs schema. // // RECORDTYPE: CiDefs_ExternalSource type CiDefs_ExternalSource struct { LexiconTypeID string `json:"$type,const=org.tangled.ci.defs#externalSource" cborgen:"$type,const=org.tangled.ci.defs#externalSource"` Link string `json:"link" cborgen:"link"` // name: human-readable name of external source Name *string `json:"name,omitempty" cborgen:"name,omitempty"` } // CiDefs_FileSource is a "fileSource" in the org.tangled.ci.defs schema. // // RECORDTYPE: CiDefs_FileSource type CiDefs_FileSource struct { LexiconTypeID string `json:"$type,const=org.tangled.ci.defs#fileSource" cborgen:"$type,const=org.tangled.ci.defs#fileSource"` Commit string `json:"commit" cborgen:"commit"` Lines *CiDefs_LineRange `json:"lines,omitempty" cborgen:"lines,omitempty"` Path string `json:"path" cborgen:"path"` Repo string `json:"repo" cborgen:"repo"` } // CiDefs_LineRange is a "lineRange" in the org.tangled.ci.defs schema. type CiDefs_LineRange struct { End int64 `json:"end" cborgen:"end"` Start int64 `json:"start" cborgen:"start"` } // CiDefs_Pipeline is a "pipeline" in the org.tangled.ci.defs schema. // // A CI pipeline. Record-like, but owned by the spindle rather than a PDS. type CiDefs_Pipeline struct { // commit: Commit Id this pipeline is running on Commit string `json:"commit" cborgen:"commit"` CreatedAt *string `json:"createdAt,omitempty" cborgen:"createdAt,omitempty"` // id: Spindle-local pipeline id Id string `json:"id" cborgen:"id"` // repo: Repository DID Repo string `json:"repo" cborgen:"repo"` // sourceRepo: Repository DID that the commit was checked out from, if different from repo (e.g. a fork for a fork-based pull request) SourceRepo *string `json:"sourceRepo,omitempty" cborgen:"sourceRepo,omitempty"` // trigger: Trigger event that triggered this pipeline. Trigger *CiDefs_Pipeline_Trigger `json:"trigger" cborgen:"trigger"` // workflows: Triggered workflows Workflows []*CiDefs_WorkflowRun `json:"workflows" cborgen:"workflows"` } // Trigger event that triggered this pipeline. type CiDefs_Pipeline_Trigger struct { EventPush *EventPush EventPullRequest *EventPullRequest CiTriggerManual *CiTriggerManual CiTriggerSchedule *CiTriggerSchedule Unknown json.RawMessage } func (t *CiDefs_Pipeline_Trigger) MarshalJSON() ([]byte, error) { if t.EventPush != nil { t.EventPush.LexiconTypeID = "org.tangled.event.push" return json.Marshal(t.EventPush) } if t.EventPullRequest != nil { t.EventPullRequest.LexiconTypeID = "org.tangled.event.pullRequest" return json.Marshal(t.EventPullRequest) } if t.CiTriggerManual != nil { t.CiTriggerManual.LexiconTypeID = "org.tangled.ci.trigger.manual" return json.Marshal(t.CiTriggerManual) } if t.CiTriggerSchedule != nil { t.CiTriggerSchedule.LexiconTypeID = "org.tangled.ci.trigger.schedule" return json.Marshal(t.CiTriggerSchedule) } if t.Unknown != nil { return t.Unknown, nil } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *CiDefs_Pipeline_Trigger) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } *t = CiDefs_Pipeline_Trigger{} switch typ { case "org.tangled.event.push": t.EventPush = new(EventPush) return json.Unmarshal(b, t.EventPush) case "org.tangled.event.pullRequest": t.EventPullRequest = new(EventPullRequest) return json.Unmarshal(b, t.EventPullRequest) case "org.tangled.ci.trigger.manual": t.CiTriggerManual = new(CiTriggerManual) return json.Unmarshal(b, t.CiTriggerManual) case "org.tangled.ci.trigger.schedule": t.CiTriggerSchedule = new(CiTriggerSchedule) return json.Unmarshal(b, t.CiTriggerSchedule) default: t.Unknown = append(t.Unknown[:0], b...) return nil } } // CiDefs_Workflow is a "workflow" in the org.tangled.ci.defs schema. // // A workflow definition type CiDefs_Workflow struct { // hash: Fingerprint of the workflow definition as resolved by the spindle. Hash *string `json:"hash,omitempty" cborgen:"hash,omitempty"` Id string `json:"id" cborgen:"id"` // name: Human-readable name of the workflow Name *string `json:"name,omitempty" cborgen:"name,omitempty"` Source *CiDefs_Workflow_Source `json:"source" cborgen:"source"` // triggers: Event types that triggers this workflow. Triggers []string `json:"triggers" cborgen:"triggers"` } // CiDefs_WorkflowRun is a "workflowRun" in the org.tangled.ci.defs schema. type CiDefs_WorkflowRun struct { // definition: Workflow definition where this workflow run is originated from. Definition *CiDefs_Workflow `json:"definition" cborgen:"definition"` Error *string `json:"error,omitempty" cborgen:"error,omitempty"` FinishedAt *string `json:"finishedAt,omitempty" cborgen:"finishedAt,omitempty"` // id: Pipeline-local workflow id, usually same as name. Id string `json:"id" cborgen:"id"` // name: Human-readable name of the workflow Name *string `json:"name,omitempty" cborgen:"name,omitempty"` StartedAt *string `json:"startedAt,omitempty" cborgen:"startedAt,omitempty"` // status: Workflow status Status string `json:"status" cborgen:"status"` } type CiDefs_Workflow_Source struct { CiDefs_FileSource *CiDefs_FileSource CiDefs_ExternalSource *CiDefs_ExternalSource } func (t *CiDefs_Workflow_Source) MarshalJSON() ([]byte, error) { if t.CiDefs_FileSource != nil { t.CiDefs_FileSource.LexiconTypeID = "org.tangled.ci.defs#fileSource" return json.Marshal(t.CiDefs_FileSource) } if t.CiDefs_ExternalSource != nil { t.CiDefs_ExternalSource.LexiconTypeID = "org.tangled.ci.defs#externalSource" return json.Marshal(t.CiDefs_ExternalSource) } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *CiDefs_Workflow_Source) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } switch typ { case "org.tangled.ci.defs#fileSource": t.CiDefs_FileSource = new(CiDefs_FileSource) return json.Unmarshal(b, t.CiDefs_FileSource) case "org.tangled.ci.defs#externalSource": t.CiDefs_ExternalSource = new(CiDefs_ExternalSource) return json.Unmarshal(b, t.CiDefs_ExternalSource) default: return nil } }