138 lines
3.4 KiB
Go
138 lines
3.4 KiB
Go
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
|
|
|
package model
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"strconv"
|
|
)
|
|
|
|
type Actor interface {
|
|
IsActor()
|
|
}
|
|
|
|
type Node interface {
|
|
IsNode()
|
|
GetID() string
|
|
}
|
|
|
|
type FeSession struct {
|
|
ID string `json:"id"`
|
|
State SessionState `json:"state"`
|
|
}
|
|
|
|
func (FeSession) IsNode() {}
|
|
func (this FeSession) GetID() string { return this.ID }
|
|
|
|
type SecondFactor struct {
|
|
Enabled bool `json:"enabled"`
|
|
Name string `json:"name"`
|
|
Type SecondFactorType `json:"type"`
|
|
}
|
|
|
|
type User struct {
|
|
ID string `json:"id"`
|
|
Username string `json:"username"`
|
|
Email string `json:"email"`
|
|
SecondFactors []*SecondFactor `json:"secondFactors"`
|
|
}
|
|
|
|
func (User) IsNode() {}
|
|
func (this User) GetID() string { return this.ID }
|
|
|
|
func (User) IsActor() {}
|
|
|
|
type SecondFactorType string
|
|
|
|
const (
|
|
SecondFactorTypeTotp SecondFactorType = "TOTP"
|
|
)
|
|
|
|
var AllSecondFactorType = []SecondFactorType{
|
|
SecondFactorTypeTotp,
|
|
}
|
|
|
|
func (e SecondFactorType) IsValid() bool {
|
|
switch e {
|
|
case SecondFactorTypeTotp:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (e SecondFactorType) String() string {
|
|
return string(e)
|
|
}
|
|
|
|
func (e *SecondFactorType) UnmarshalGQL(v interface{}) error {
|
|
str, ok := v.(string)
|
|
if !ok {
|
|
return fmt.Errorf("enums must be strings")
|
|
}
|
|
|
|
*e = SecondFactorType(str)
|
|
if !e.IsValid() {
|
|
return fmt.Errorf("%s is not a valid SecondFactorType", str)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (e SecondFactorType) MarshalGQL(w io.Writer) {
|
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
}
|
|
|
|
type SessionState string
|
|
|
|
const (
|
|
SessionStateEmpty SessionState = "EMPTY"
|
|
SessionStateUnauthenticated SessionState = "UNAUTHENTICATED"
|
|
SessionStateAwaitingFactor SessionState = "AWAITING_FACTOR"
|
|
SessionStateAuthenticatedPending SessionState = "AUTHENTICATED_PENDING"
|
|
SessionStateAuthenticatedFully SessionState = "AUTHENTICATED_FULLY"
|
|
SessionStateAuthenticatedPasswordChange SessionState = "AUTHENTICATED_PASSWORD_CHANGE"
|
|
SessionStateAuthenticated2faEnroll SessionState = "AUTHENTICATED_2FA_ENROLL"
|
|
SessionStateAuthenticatedReviewTos SessionState = "AUTHENTICATED_REVIEW_TOS"
|
|
SessionStateAuthenticatedReviewRecovery SessionState = "AUTHENTICATED_REVIEW_RECOVERY"
|
|
)
|
|
|
|
var AllSessionState = []SessionState{
|
|
SessionStateEmpty,
|
|
SessionStateUnauthenticated,
|
|
SessionStateAwaitingFactor,
|
|
SessionStateAuthenticatedPending,
|
|
SessionStateAuthenticatedFully,
|
|
SessionStateAuthenticatedPasswordChange,
|
|
SessionStateAuthenticated2faEnroll,
|
|
SessionStateAuthenticatedReviewTos,
|
|
SessionStateAuthenticatedReviewRecovery,
|
|
}
|
|
|
|
func (e SessionState) IsValid() bool {
|
|
switch e {
|
|
case SessionStateEmpty, SessionStateUnauthenticated, SessionStateAwaitingFactor, SessionStateAuthenticatedPending, SessionStateAuthenticatedFully, SessionStateAuthenticatedPasswordChange, SessionStateAuthenticated2faEnroll, SessionStateAuthenticatedReviewTos, SessionStateAuthenticatedReviewRecovery:
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (e SessionState) String() string {
|
|
return string(e)
|
|
}
|
|
|
|
func (e *SessionState) UnmarshalGQL(v interface{}) error {
|
|
str, ok := v.(string)
|
|
if !ok {
|
|
return fmt.Errorf("enums must be strings")
|
|
}
|
|
|
|
*e = SessionState(str)
|
|
if !e.IsValid() {
|
|
return fmt.Errorf("%s is not a valid SessionState", str)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (e SessionState) MarshalGQL(w io.Writer) {
|
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
|
}
|