~emersion/yojo

9716514a92c4fded438e0c5355147b4204ccca95 — Simon Ser 5 months ago 27e374e
Update builds.sr.ht GraphQL schema
1 files changed, 205 insertions(+), 17 deletions(-)

M buildssrht/gql.go
M buildssrht/gql.go => buildssrht/gql.go +205 -17
@@ 1,9 1,11 @@
// Code generated by gqlclientgen - DO NOT EDIT
// Code generated by gqlclientgen - DO NOT EDIT.

package buildssrht

import (
	"context"
	"encoding/json"
	"fmt"
	gqlclient "git.sr.ht/~emersion/gqlclient"
)



@@ 45,6 47,8 @@ type EmailTrigger struct {
	InReplyTo *string          `json:"inReplyTo,omitempty"`
}

func (*EmailTrigger) isTrigger() {}

type EmailTriggerInput struct {
	To        string  `json:"to"`
	Cc        *string `json:"cc,omitempty"`


@@ 58,18 62,49 @@ type Entity struct {
	// The canonical name of this entity. For users, this is their username
	// prefixed with '~'. Additional entity types will be supported in the future.
	CanonicalName string `json:"canonicalName"`

	// Underlying value of the GraphQL interface
	Value EntityValue `json:"-"`
}

func (base *Entity) UnmarshalJSON(b []byte) error {
	type Raw Entity
	var data struct {
		*Raw
		TypeName string `json:"__typename"`
	}
	data.Raw = (*Raw)(base)
	err := json.Unmarshal(b, &data)
	if err != nil {
		return err
	}
	switch data.TypeName {
	case "User":
		base.Value = new(User)
	case "":
		return nil
	default:
		return fmt.Errorf("gqlclient: interface Entity: unknown __typename %q", data.TypeName)
	}
	return json.Unmarshal(b, base.Value)
}

// EntityValue is one of: User
type EntityValue interface {
	isEntity()
}

type File string

type Job struct {
	Id       int32          `json:"id"`
	Created  gqlclient.Time `json:"created"`
	Updated  gqlclient.Time `json:"updated"`
	Status   JobStatus      `json:"status"`
	Manifest string         `json:"manifest"`
	Note     *string        `json:"note,omitempty"`
	Tags     []string       `json:"tags"`
	Id         int32          `json:"id"`
	Created    gqlclient.Time `json:"created"`
	Updated    gqlclient.Time `json:"updated"`
	Status     JobStatus      `json:"status"`
	Manifest   string         `json:"manifest"`
	Note       *string        `json:"note,omitempty"`
	Tags       []string       `json:"tags"`
	Visibility Visibility     `json:"visibility"`
	// Name of the build image
	Image string `json:"image"`
	// Name of the build runner which picked up this job, or null if the job is


@@ 102,6 137,8 @@ type JobEvent struct {
	Job   *Job           `json:"job"`
}

func (*JobEvent) isWebhookPayload() {}

type JobGroup struct {
	Id       int32          `json:"id"`
	Created  gqlclient.Time `json:"created"`


@@ 126,8 163,8 @@ const (
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).
	// The URL at which the full build log can be downloaded with an authenticated
	// GET request (text/plain).
	FullURL string `json:"fullURL"`
}



@@ 140,22 177,64 @@ type PGPKey struct {
	Created    gqlclient.Time `json:"created"`
	Uuid       string         `json:"uuid"`
	Name       *string        `json:"name,omitempty"`
	FromUser   *Entity        `json:"fromUser,omitempty"`
	PrivateKey Binary         `json:"privateKey"`
}

func (*PGPKey) isSecret() {}

type SSHKey struct {
	Id         int32          `json:"id"`
	Created    gqlclient.Time `json:"created"`
	Uuid       string         `json:"uuid"`
	Name       *string        `json:"name,omitempty"`
	FromUser   *Entity        `json:"fromUser,omitempty"`
	PrivateKey Binary         `json:"privateKey"`
}

func (*SSHKey) isSecret() {}

type Secret struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	Uuid    string         `json:"uuid"`
	Name    *string        `json:"name,omitempty"`
	// Set when this secret was copied from another user account
	FromUser *Entity `json:"fromUser,omitempty"`

	// Underlying value of the GraphQL interface
	Value SecretValue `json:"-"`
}

func (base *Secret) UnmarshalJSON(b []byte) error {
	type Raw Secret
	var data struct {
		*Raw
		TypeName string `json:"__typename"`
	}
	data.Raw = (*Raw)(base)
	err := json.Unmarshal(b, &data)
	if err != nil {
		return err
	}
	switch data.TypeName {
	case "SSHKey":
		base.Value = new(SSHKey)
	case "PGPKey":
		base.Value = new(PGPKey)
	case "SecretFile":
		base.Value = new(SecretFile)
	case "":
		return nil
	default:
		return fmt.Errorf("gqlclient: interface Secret: unknown __typename %q", data.TypeName)
	}
	return json.Unmarshal(b, base.Value)
}

// SecretValue is one of: SSHKey | PGPKey | SecretFile
type SecretValue interface {
	isSecret()
}

// A cursor for enumerating a list of secrets


@@ 169,15 248,18 @@ type SecretCursor struct {
}

type SecretFile struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	Uuid    string         `json:"uuid"`
	Name    *string        `json:"name,omitempty"`
	Path    string         `json:"path"`
	Mode    int32          `json:"mode"`
	Data    Binary         `json:"data"`
	Id       int32          `json:"id"`
	Created  gqlclient.Time `json:"created"`
	Uuid     string         `json:"uuid"`
	Name     *string        `json:"name,omitempty"`
	FromUser *Entity        `json:"fromUser,omitempty"`
	Path     string         `json:"path"`
	Mode     int32          `json:"mode"`
	Data     Binary         `json:"data"`
}

func (*SecretFile) isSecret() {}

type Settings struct {
	SshUser      string `json:"sshUser"`
	BuildTimeout string `json:"buildTimeout"`


@@ 208,6 290,38 @@ const (
// build manifest, but are similar in functionality.
type Trigger struct {
	Condition TriggerCondition `json:"condition"`

	// Underlying value of the GraphQL interface
	Value TriggerValue `json:"-"`
}

func (base *Trigger) UnmarshalJSON(b []byte) error {
	type Raw Trigger
	var data struct {
		*Raw
		TypeName string `json:"__typename"`
	}
	data.Raw = (*Raw)(base)
	err := json.Unmarshal(b, &data)
	if err != nil {
		return err
	}
	switch data.TypeName {
	case "EmailTrigger":
		base.Value = new(EmailTrigger)
	case "WebhookTrigger":
		base.Value = new(WebhookTrigger)
	case "":
		return nil
	default:
		return fmt.Errorf("gqlclient: interface Trigger: unknown __typename %q", data.TypeName)
	}
	return json.Unmarshal(b, base.Value)
}

// TriggerValue is one of: EmailTrigger | WebhookTrigger
type TriggerValue interface {
	isTrigger()
}

type TriggerCondition string


@@ 246,6 360,8 @@ type User struct {
	Jobs *JobCursor `json:"jobs"`
}

func (*User) isEntity() {}

type UserWebhookInput struct {
	Url    string         `json:"url"`
	Events []WebhookEvent `json:"events"`


@@ 262,6 378,8 @@ type UserWebhookSubscription struct {
	Sample     string                 `json:"sample"`
}

func (*UserWebhookSubscription) isWebhookSubscription() {}

type Version struct {
	Major int32 `json:"major"`
	Minor int32 `json:"minor"`


@@ 273,6 391,14 @@ type Version struct {
	Settings        *Settings      `json:"settings"`
}

type Visibility string

const (
	VisibilityPublic   Visibility = "PUBLIC"
	VisibilityUnlisted Visibility = "UNLISTED"
	VisibilityPrivate  Visibility = "PRIVATE"
)

type WebhookDelivery struct {
	Uuid         string               `json:"uuid"`
	Date         gqlclient.Time       `json:"date"`


@@ 308,6 434,36 @@ type WebhookPayload struct {
	Uuid  string         `json:"uuid"`
	Event WebhookEvent   `json:"event"`
	Date  gqlclient.Time `json:"date"`

	// Underlying value of the GraphQL interface
	Value WebhookPayloadValue `json:"-"`
}

func (base *WebhookPayload) UnmarshalJSON(b []byte) error {
	type Raw WebhookPayload
	var data struct {
		*Raw
		TypeName string `json:"__typename"`
	}
	data.Raw = (*Raw)(base)
	err := json.Unmarshal(b, &data)
	if err != nil {
		return err
	}
	switch data.TypeName {
	case "JobEvent":
		base.Value = new(JobEvent)
	case "":
		return nil
	default:
		return fmt.Errorf("gqlclient: interface WebhookPayload: unknown __typename %q", data.TypeName)
	}
	return json.Unmarshal(b, base.Value)
}

// WebhookPayloadValue is one of: JobEvent
type WebhookPayloadValue interface {
	isWebhookPayload()
}

type WebhookSubscription struct {


@@ 322,6 478,36 @@ type WebhookSubscription struct {
	Deliveries *WebhookDeliveryCursor `json:"deliveries"`
	// Returns a sample payload for this subscription, for testing purposes
	Sample string `json:"sample"`

	// Underlying value of the GraphQL interface
	Value WebhookSubscriptionValue `json:"-"`
}

func (base *WebhookSubscription) UnmarshalJSON(b []byte) error {
	type Raw WebhookSubscription
	var data struct {
		*Raw
		TypeName string `json:"__typename"`
	}
	data.Raw = (*Raw)(base)
	err := json.Unmarshal(b, &data)
	if err != nil {
		return err
	}
	switch data.TypeName {
	case "UserWebhookSubscription":
		base.Value = new(UserWebhookSubscription)
	case "":
		return nil
	default:
		return fmt.Errorf("gqlclient: interface WebhookSubscription: unknown __typename %q", data.TypeName)
	}
	return json.Unmarshal(b, base.Value)
}

// WebhookSubscriptionValue is one of: UserWebhookSubscription
type WebhookSubscriptionValue interface {
	isWebhookSubscription()
}

// A cursor for enumerating a list of webhook subscriptions


@@ 339,6 525,8 @@ type WebhookTrigger struct {
	Url       string           `json:"url"`
}

func (*WebhookTrigger) isTrigger() {}

type WebhookTriggerInput struct {
	Url string `json:"url"`
}