Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
3.2 kB · 91 lines
Go
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
package org_tangled
// schema: org.tangled.ci.workflow
import ( "encoding/json" "fmt"
"github.com/bluesky-social/indigo/lex/util")
const ( CiWorkflowNSID = "org.tangled.ci.workflow")
// CiWorkflow is a "main" in the org.tangled.ci.workflow schema.//// A workflow definitiontype CiWorkflow 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 *CiWorkflow_Source `json:"source" cborgen:"source"` // triggers: Event types that triggers this workflow. Triggers []string `json:"triggers" cborgen:"triggers"`}
// CiWorkflow_ExternalSource is a "externalSource" in the org.tangled.ci.workflow schema.//// RECORDTYPE: CiWorkflow_ExternalSourcetype CiWorkflow_ExternalSource struct { LexiconTypeID string `json:"$type,const=org.tangled.ci.workflow#externalSource" cborgen:"$type,const=org.tangled.ci.workflow#externalSource"` Link string `json:"link" cborgen:"link"` // name: human-readable name of external source Name *string `json:"name,omitempty" cborgen:"name,omitempty"`}
// CiWorkflow_FileSource is a "fileSource" in the org.tangled.ci.workflow schema.//// RECORDTYPE: CiWorkflow_FileSourcetype CiWorkflow_FileSource struct { LexiconTypeID string `json:"$type,const=org.tangled.ci.workflow#fileSource" cborgen:"$type,const=org.tangled.ci.workflow#fileSource"` Commit string `json:"commit" cborgen:"commit"` Lines *CiWorkflow_FileSource_Lines `json:"lines,omitempty" cborgen:"lines,omitempty"` Path string `json:"path" cborgen:"path"` Repo string `json:"repo" cborgen:"repo"`}
type CiWorkflow_FileSource_Lines struct { End int64 `json:"end" cborgen:"end"` Start int64 `json:"start" cborgen:"start"`}
type CiWorkflow_Source struct { CiWorkflow_FileSource *CiWorkflow_FileSource CiWorkflow_ExternalSource *CiWorkflow_ExternalSource}
func (t *CiWorkflow_Source) MarshalJSON() ([]byte, error) { if t.CiWorkflow_FileSource != nil { t.CiWorkflow_FileSource.LexiconTypeID = "org.tangled.ci.workflow#fileSource" return json.Marshal(t.CiWorkflow_FileSource) } if t.CiWorkflow_ExternalSource != nil { t.CiWorkflow_ExternalSource.LexiconTypeID = "org.tangled.ci.workflow#externalSource" return json.Marshal(t.CiWorkflow_ExternalSource) } return nil, fmt.Errorf("cannot marshal empty enum")}func (t *CiWorkflow_Source) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err }
switch typ { case "org.tangled.ci.workflow#fileSource": t.CiWorkflow_FileSource = new(CiWorkflow_FileSource) return json.Unmarshal(b, t.CiWorkflow_FileSource) case "org.tangled.ci.workflow#externalSource": t.CiWorkflow_ExternalSource = new(CiWorkflow_ExternalSource) return json.Unmarshal(b, t.CiWorkflow_ExternalSource)
default: return nil }}