Skip to main content
Glama

Storyden

by Southclaws
Mozilla Public License 2.0
227
authentication.go9.44 kB
// Code generated by ent, DO NOT EDIT. package ent import ( "encoding/json" "fmt" "strings" "time" "entgo.io/ent" "entgo.io/ent/dialect/sql" "github.com/Southclaws/storyden/internal/ent/account" "github.com/Southclaws/storyden/internal/ent/authentication" "github.com/rs/xid" ) // Authentication is the model entity for the Authentication schema. type Authentication struct { config `json:"-"` // ID of the ent. ID xid.ID `json:"id,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // ExpiresAt holds the value of the "expires_at" field. ExpiresAt *time.Time `json:"expires_at,omitempty"` // The authentication service name, such as GitHub, Twitter, Discord, etc. Or, 'password' for password auth and 'api_token' for token auth Service string `json:"service,omitempty"` // The type of secret/token used by the service to secure the authentication record. TokenType string `json:"token_type,omitempty"` // The identifier, usually a user/account ID on some OAuth service or API token name. Identifier string `json:"identifier,omitempty"` // The actual authentication token/password/key/etc. If OAuth, it'll be the access_token value, if it's a password or API key, a hash. Token string `json:"-"` // A human-readable name for the authentication method. For WebAuthn, this may be the device OS or nickname. Name *string `json:"name,omitempty"` // Whether the authentication method is disabled. This is useful for revoking access without deleting the record. Disabled bool `json:"disabled,omitempty"` // Any necessary metadata specific to the authentication method. Metadata map[string]interface{} `json:"metadata,omitempty"` // AccountAuthentication holds the value of the "account_authentication" field. AccountAuthentication xid.ID `json:"account_authentication,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the AuthenticationQuery when eager-loading is set. Edges AuthenticationEdges `json:"edges"` selectValues sql.SelectValues } // AuthenticationEdges holds the relations/edges for other nodes in the graph. type AuthenticationEdges struct { // Account holds the value of the account edge. Account *Account `json:"account,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [1]bool } // AccountOrErr returns the Account value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. func (e AuthenticationEdges) AccountOrErr() (*Account, error) { if e.Account != nil { return e.Account, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: account.Label} } return nil, &NotLoadedError{edge: "account"} } // scanValues returns the types for scanning values from sql.Rows. func (*Authentication) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { case authentication.FieldMetadata: values[i] = new([]byte) case authentication.FieldDisabled: values[i] = new(sql.NullBool) case authentication.FieldService, authentication.FieldTokenType, authentication.FieldIdentifier, authentication.FieldToken, authentication.FieldName: values[i] = new(sql.NullString) case authentication.FieldCreatedAt, authentication.FieldExpiresAt: values[i] = new(sql.NullTime) case authentication.FieldID, authentication.FieldAccountAuthentication: values[i] = new(xid.ID) default: values[i] = new(sql.UnknownType) } } return values, nil } // assignValues assigns the values that were returned from sql.Rows (after scanning) // to the Authentication fields. func (_m *Authentication) assignValues(columns []string, values []any) error { if m, n := len(values), len(columns); m < n { return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) } for i := range columns { switch columns[i] { case authentication.FieldID: if value, ok := values[i].(*xid.ID); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value != nil { _m.ID = *value } case authentication.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { _m.CreatedAt = value.Time } case authentication.FieldExpiresAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field expires_at", values[i]) } else if value.Valid { _m.ExpiresAt = new(time.Time) *_m.ExpiresAt = value.Time } case authentication.FieldService: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field service", values[i]) } else if value.Valid { _m.Service = value.String } case authentication.FieldTokenType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field token_type", values[i]) } else if value.Valid { _m.TokenType = value.String } case authentication.FieldIdentifier: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field identifier", values[i]) } else if value.Valid { _m.Identifier = value.String } case authentication.FieldToken: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field token", values[i]) } else if value.Valid { _m.Token = value.String } case authentication.FieldName: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field name", values[i]) } else if value.Valid { _m.Name = new(string) *_m.Name = value.String } case authentication.FieldDisabled: if value, ok := values[i].(*sql.NullBool); !ok { return fmt.Errorf("unexpected type %T for field disabled", values[i]) } else if value.Valid { _m.Disabled = value.Bool } case authentication.FieldMetadata: if value, ok := values[i].(*[]byte); !ok { return fmt.Errorf("unexpected type %T for field metadata", values[i]) } else if value != nil && len(*value) > 0 { if err := json.Unmarshal(*value, &_m.Metadata); err != nil { return fmt.Errorf("unmarshal field metadata: %w", err) } } case authentication.FieldAccountAuthentication: if value, ok := values[i].(*xid.ID); !ok { return fmt.Errorf("unexpected type %T for field account_authentication", values[i]) } else if value != nil { _m.AccountAuthentication = *value } default: _m.selectValues.Set(columns[i], values[i]) } } return nil } // Value returns the ent.Value that was dynamically selected and assigned to the Authentication. // This includes values selected through modifiers, order, etc. func (_m *Authentication) Value(name string) (ent.Value, error) { return _m.selectValues.Get(name) } // QueryAccount queries the "account" edge of the Authentication entity. func (_m *Authentication) QueryAccount() *AccountQuery { return NewAuthenticationClient(_m.config).QueryAccount(_m) } // Update returns a builder for updating this Authentication. // Note that you need to call Authentication.Unwrap() before calling this method if this Authentication // was returned from a transaction, and the transaction was committed or rolled back. func (_m *Authentication) Update() *AuthenticationUpdateOne { return NewAuthenticationClient(_m.config).UpdateOne(_m) } // Unwrap unwraps the Authentication entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. func (_m *Authentication) Unwrap() *Authentication { _tx, ok := _m.config.driver.(*txDriver) if !ok { panic("ent: Authentication is not a transactional entity") } _m.config.driver = _tx.drv return _m } // String implements the fmt.Stringer. func (_m *Authentication) String() string { var builder strings.Builder builder.WriteString("Authentication(") builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID)) builder.WriteString("created_at=") builder.WriteString(_m.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") if v := _m.ExpiresAt; v != nil { builder.WriteString("expires_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") builder.WriteString("service=") builder.WriteString(_m.Service) builder.WriteString(", ") builder.WriteString("token_type=") builder.WriteString(_m.TokenType) builder.WriteString(", ") builder.WriteString("identifier=") builder.WriteString(_m.Identifier) builder.WriteString(", ") builder.WriteString("token=<sensitive>") builder.WriteString(", ") if v := _m.Name; v != nil { builder.WriteString("name=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("disabled=") builder.WriteString(fmt.Sprintf("%v", _m.Disabled)) builder.WriteString(", ") builder.WriteString("metadata=") builder.WriteString(fmt.Sprintf("%v", _m.Metadata)) builder.WriteString(", ") builder.WriteString("account_authentication=") builder.WriteString(fmt.Sprintf("%v", _m.AccountAuthentication)) builder.WriteByte(')') return builder.String() } // Authentications is a parsable slice of Authentication. type Authentications []*Authentication

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Southclaws/storyden'

If you have feedback or need assistance with the MCP directory API, please join our Discord server