// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
package model
import (
"fmt"
"io"
"strconv"
"time"
"sourcecraft.dev/bigbes/sr-ht-core/model"
)
// The payload delivered to a webhook: the event being dispatched, over which the
// subscription's `query` is evaluated.
type WebhookPayload interface {
IsWebhookPayload()
}
// A webhook subscription: a URL and a GraphQL query evaluated in the webhook
// context when one of `events` fires.
type WebhookSubscription interface {
IsWebhookSubscription()
}
type ProposalEvent struct {
UUID string `json:"uuid"`
Event WebhookEvent `json:"event"`
Date time.Time `json:"date"`
Proposal *Proposal `json:"proposal"`
}
func (ProposalEvent) IsWebhookPayload() {}
type UserWebhookInput struct {
URL string `json:"url"`
Events []WebhookEvent `json:"events"`
Query string `json:"query"`
}
// A cursor for enumerating a list of webhook deliveries.
//
// 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 WebhookDeliveryCursor struct {
Results []*WebhookDelivery `json:"results"`
Cursor *model.Cursor `json:"cursor,omitempty"`
}
// A cursor for enumerating a list of webhook subscriptions.
//
// 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 WebhookSubscriptionCursor struct {
Results []WebhookSubscription `json:"results"`
Cursor *model.Cursor `json:"cursor,omitempty"`
}
// How a merge was authorized. Auto-merged is not human-approved, and readers must
// be able to tell: a bot asking for the approved text of a spec should be able to
// require human approval and get a different answer than for a firehose note.
type Approval string
const (
ApprovalHuman Approval = "HUMAN"
ApprovalPolicy Approval = "POLICY"
)
var AllApproval = []Approval{
ApprovalHuman,
ApprovalPolicy,
}
func (e Approval) IsValid() bool {
switch e {
case ApprovalHuman, ApprovalPolicy:
return true
}
return false
}
func (e Approval) String() string {
return string(e)
}
func (e *Approval) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = Approval(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid Approval", str)
}
return nil
}
func (e Approval) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// The lifecycle of a proposal. Collapsed from the usual five states because there
// is exactly one reviewer: "approve" is "merge now", and a proposal you dislike is
// rejected rather than sent back for changes.
type ProposalState string
const (
ProposalStateOpen ProposalState = "OPEN"
ProposalStateMerged ProposalState = "MERGED"
ProposalStateRejected ProposalState = "REJECTED"
)
var AllProposalState = []ProposalState{
ProposalStateOpen,
ProposalStateMerged,
ProposalStateRejected,
}
func (e ProposalState) IsValid() bool {
switch e {
case ProposalStateOpen, ProposalStateMerged, ProposalStateRejected:
return true
}
return false
}
func (e ProposalState) String() string {
return string(e)
}
func (e *ProposalState) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = ProposalState(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid ProposalState", str)
}
return nil
}
func (e ProposalState) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}
// A proposal lifecycle event a webhook may subscribe to.
type WebhookEvent string
const (
WebhookEventProposalOpened WebhookEvent = "PROPOSAL_OPENED"
WebhookEventProposalMerged WebhookEvent = "PROPOSAL_MERGED"
WebhookEventProposalRejected WebhookEvent = "PROPOSAL_REJECTED"
)
var AllWebhookEvent = []WebhookEvent{
WebhookEventProposalOpened,
WebhookEventProposalMerged,
WebhookEventProposalRejected,
}
func (e WebhookEvent) IsValid() bool {
switch e {
case WebhookEventProposalOpened, WebhookEventProposalMerged, WebhookEventProposalRejected:
return true
}
return false
}
func (e WebhookEvent) String() string {
return string(e)
}
func (e *WebhookEvent) UnmarshalGQL(v interface{}) error {
str, ok := v.(string)
if !ok {
return fmt.Errorf("enums must be strings")
}
*e = WebhookEvent(str)
if !e.IsValid() {
return fmt.Errorf("%s is not a valid WebhookEvent", str)
}
return nil
}
func (e WebhookEvent) MarshalGQL(w io.Writer) {
fmt.Fprint(w, strconv.Quote(e.String()))
}