types

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AtlassianAuthorizeURL = "https://auth.atlassian.com/authorize"
	AtlassianTokenURL     = "https://auth.atlassian.com/oauth/token"

	SlackAuthorizeURL = "https://slack.com/oauth/v2/authorize"
	SlackTokenURL     = "https://slack.com/api/oauth.v2.access"

	NotionAuthorizeURL = "https://api.notion.com/v1/oauth/authorize"
	NotionTokenURL     = "https://api.notion.com/v1/oauth/token"

	HubSpotAuthorizeURL = "https://app.hubspot.com/oauth/authorize"
	HubSpotTokenURL     = "https://api.hubapi.com/oauth/v1/token"

	GoogleAuthorizeURL = "https://accounts.google.com/o/oauth2/v2/auth"
	GoogleTokenURL     = "https://oauth2.googleapis.com/token"

	GitHubAuthorizeURL = "https://github.com/login/oauth/authorize"
	GitHubTokenURL     = "https://github.com/login/oauth/access_token"

	ZoomAuthorizeURL = "https://zoom.us/oauth/authorize"
	ZoomTokenURL     = "https://zoom.us/oauth/token"

	LinkedInAuthorizeURL = "https://www.linkedin.com/oauth/v2/authorization"
	LinkedInTokenURL     = "https://www.linkedin.com/oauth/v2/accessToken"

	PagerDutyAuthorizeURL = "https://identity.pagerduty.com/oauth/authorize"
	PagerDutyTokenURL     = "https://identity.pagerduty.com/oauth/token"
)

Variables

This section is empty.

Functions

func ConvertUser

func ConvertUser(u *User, roleFixed bool, authProviderName string) *types2.User

func MergeOAuthAppManifests

func MergeOAuthAppManifests(r, other types.OAuthAppManifest) types.OAuthAppManifest

func ValidateAndSetDefaultsOAuthAppManifest

func ValidateAndSetDefaultsOAuthAppManifest(r *types.OAuthAppManifest, create bool) error

Types

type AuthToken

type AuthToken struct {
	ID                    string    `json:"id" gorm:"index:idx_id_hashed_token"`
	UserID                uint      `json:"-" gorm:"index"`
	AuthProviderNamespace string    `json:"-" gorm:"index"`
	AuthProviderName      string    `json:"-" gorm:"index"`
	HashedToken           string    `json:"-" gorm:"index:idx_id_hashed_token"`
	CreatedAt             time.Time `json:"createdAt"`
	ExpiresAt             time.Time `json:"expiresAt"`
}

type GoogleOAuthTokenResponse

type GoogleOAuthTokenResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	TokenType    string `json:"token_type"`
}

type Identity

type Identity struct {
	AuthProviderName      string    `json:"authProviderName" gorm:"primaryKey;index:idx_user_auth_id"`
	AuthProviderNamespace string    `json:"authProviderNamespace" gorm:"primaryKey;index:idx_user_auth_id"`
	ProviderUsername      string    `json:"providerUsername"`
	ProviderUserID        string    `json:"providerUserID" gorm:"primaryKey"`
	Email                 string    `json:"email"`
	UserID                uint      `json:"userID" gorm:"index:idx_user_auth_id"`
	IconURL               string    `json:"iconURL"`
	IconLastChecked       time.Time `json:"iconLastChecked"`
}

type Image added in v0.7.0

type Image struct {
	ID        string    `json:"id" gorm:"primaryKey;autoIncrement:false"`
	CreatedAt time.Time `json:"createdAt"`
	Data      []byte    `json:"-" gorm:"type:bytea;not null"`
	MIMEType  string    `json:"mimeType" gorm:"type:varchar(100);not null"`
}

func (*Image) BeforeCreate added in v0.7.0

func (i *Image) BeforeCreate(_ *gorm.DB) error

BeforeCreate will set the ID to a UUID v4.

type LLMProvider

type LLMProvider struct {
	ID        uint      `json:"id" gorm:"primaryKey"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	Name      string    `json:"name"`
	Slug      string    `json:"slug" gorm:"unique;index"`
	BaseURL   string    `json:"baseURL"`
	Token     string    `json:"token"`
	Disabled  bool      `json:"disabled"`
}

func (*LLMProvider) RequestBaseURL

func (lp *LLMProvider) RequestBaseURL(serverBase string) string

func (*LLMProvider) URL

func (lp *LLMProvider) URL() string

func (*LLMProvider) Validate

func (lp *LLMProvider) Validate() error

type LLMProxyActivity

type LLMProxyActivity struct {
	ID             uint
	CreatedAt      time.Time
	WorkflowID     string
	WorkflowStepID string
	AgentID        string
	ThreadID       string
	RunID          string
	Username       string
	Path           string
}

type Model

type Model struct {
	ID                string    `json:"id" gorm:"unique"`
	CreatedAt         time.Time `json:"createdAt"`
	UpdatedAt         time.Time `json:"updatedAt"`
	LLMProviderID     uint      `json:"llmProviderID" gorm:"foreignKey:id;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
	ProviderModelName string    `json:"providerModelName"`
	Disabled          bool      `json:"disabled"`
}

func (*Model) Validate

func (m *Model) Validate() error

type OAuthAppTypeConfig

type OAuthAppTypeConfig struct {
	DisplayName string            `json:"displayName"`
	Parameters  map[string]string `json:"parameters"`
}

type OAuthTokenRequestChallenge

type OAuthTokenRequestChallenge struct {
	State     string    `json:"state" gorm:"primaryKey"`
	Challenge string    `json:"challenge"`
	CreatedAt time.Time `json:"createdAt"`
}

type OAuthTokenResponse

type OAuthTokenResponse struct {
	State        string `json:"state"`
	TokenType    string `json:"token_type"`
	Scope        string `json:"scope"`
	ExpiresIn    int    `json:"expires_in"`
	ExtExpiresIn int    `json:"ext_expires_in"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	Ok           bool   `json:"ok"`
	Error        string `json:"error"`
	CreatedAt    time.Time
	Extras       map[string]string `json:"extras" gorm:"serializer:json"`
}

OAuthTokenResponse represents a response from the /token endpoint on an OAuth server. These do not get stored in the database.

type RunState added in v0.7.0

type RunState struct {
	Name       string    `json:"name" gorm:"primaryKey"`
	Namespace  string    `json:"namespace" gorm:"primaryKey"`
	CreatedAt  time.Time `json:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt"`
	ThreadName string    `json:"threadName,omitempty"`
	Program    []byte    `json:"program,omitempty"`
	ChatState  []byte    `json:"chatState,omitempty"`
	CallFrame  []byte    `json:"callFrame,omitempty"`
	Output     []byte    `json:"output,omitempty"`
	Done       bool      `json:"done,omitempty"`
	Error      string    `json:"error,omitempty"`
}

type SalesforceOAuthTokenResponse added in v0.5.0

type SalesforceOAuthTokenResponse struct {
	AccessToken  string `json:"access_token"`
	Signature    string `json:"signature"`
	Scope        string `json:"scope"`
	IDToken      string `json:"id_token"`
	InstanceURL  string `json:"instance_url"`
	ID           string `json:"id"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	IssuedAt     string `json:"issued_at"`
}

type SlackOAuthTokenResponse

type SlackOAuthTokenResponse struct {
	Ok         bool   `json:"ok"`
	Error      string `json:"error"`
	AuthedUser struct {
		ID          string `json:"id"`
		Scope       string `json:"scope"`
		AccessToken string `json:"access_token"`
	} `json:"authed_user"`
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
}

type TokenRequest

type TokenRequest struct {
	ID                    string `gorm:"primaryKey"`
	CreatedAt             time.Time
	UpdatedAt             time.Time
	State                 string `gorm:"index"`
	Nonce                 string
	Token                 string
	ExpiresAt             time.Time
	CompletionRedirectURL string
	Error                 string
	TokenRetrieved        bool
}

type User

type User struct {
	ID            uint        `json:"id" gorm:"primaryKey"`
	CreatedAt     time.Time   `json:"createdAt"`
	Username      string      `json:"username" gorm:"unique"`
	Email         string      `json:"email"`
	VerifiedEmail *bool       `json:"verifiedEmail,omitempty"`
	Role          types2.Role `json:"role"`
	IconURL       string      `json:"iconURL"`
	Timezone      string      `json:"timezone"`
}

type UserQuery

type UserQuery struct {
	Username string
	Email    string
	Role     types2.Role
}

func NewUserQuery

func NewUserQuery(u url.Values) UserQuery

func (UserQuery) Scope

func (q UserQuery) Scope(db *gorm.DB) *gorm.DB

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL