// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT. package tangled // schema: sh.tangled.ci.triggerPipeline import ( "context" "encoding/json" "fmt" "github.com/bluesky-social/indigo/lex/util" ) const ( CiTriggerPipelineNSID = "sh.tangled.ci.triggerPipeline" ) // CiTriggerPipeline_Input is the input argument to a sh.tangled.ci.triggerPipeline call. type CiTriggerPipeline_Input struct { // repo: Target repository DID. Auth is checked against this repo. Repo string `json:"repo" cborgen:"repo"` // trigger: Trigger metadata for this dispatch. Trigger *CiTriggerPipeline_Input_Trigger `json:"trigger" cborgen:"trigger"` // workflows: Workflow names to run. When not provided, every dispatchable workflow is run. Workflows []string `json:"workflows,omitempty" cborgen:"workflows,omitempty"` } // Trigger metadata for this dispatch. type CiTriggerPipeline_Input_Trigger struct { CiTrigger_Manual *CiTrigger_Manual CiTrigger_PullRequest *CiTrigger_PullRequest } func (t *CiTriggerPipeline_Input_Trigger) MarshalJSON() ([]byte, error) { if t.CiTrigger_Manual != nil { t.CiTrigger_Manual.LexiconTypeID = "sh.tangled.ci.trigger#manual" return json.Marshal(t.CiTrigger_Manual) } if t.CiTrigger_PullRequest != nil { t.CiTrigger_PullRequest.LexiconTypeID = "sh.tangled.ci.trigger#pullRequest" return json.Marshal(t.CiTrigger_PullRequest) } return nil, fmt.Errorf("cannot marshal empty enum") } func (t *CiTriggerPipeline_Input_Trigger) UnmarshalJSON(b []byte) error { typ, err := util.TypeExtract(b) if err != nil { return err } switch typ { case "sh.tangled.ci.trigger#manual": t.CiTrigger_Manual = new(CiTrigger_Manual) return json.Unmarshal(b, t.CiTrigger_Manual) case "sh.tangled.ci.trigger#pullRequest": t.CiTrigger_PullRequest = new(CiTrigger_PullRequest) return json.Unmarshal(b, t.CiTrigger_PullRequest) default: return nil } } // CiTriggerPipeline_Output is the output of a sh.tangled.ci.triggerPipeline call. type CiTriggerPipeline_Output struct { // pipeline: AT-URI of the created pipeline Pipeline string `json:"pipeline" cborgen:"pipeline"` } // CiTriggerPipeline calls the XRPC method "sh.tangled.ci.triggerPipeline". func CiTriggerPipeline(ctx context.Context, c util.LexClient, input *CiTriggerPipeline_Input) (*CiTriggerPipeline_Output, error) { var out CiTriggerPipeline_Output if err := c.LexDo(ctx, util.Procedure, "application/json", "sh.tangled.ci.triggerPipeline", nil, input, &out); err != nil { return nil, err } return &out, nil }