api

package
v0.0.0-...-acc438d Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2025 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCurrentUserHandler

func AuthCurrentUserHandler(w http.ResponseWriter, r *http.Request)

AuthCurrentUserHandler GET /api/currentUser

func AuthGoogleCallbackHandler

func AuthGoogleCallbackHandler(w http.ResponseWriter, r *http.Request)

AuthGoogleCallbackHandler POST /api/login/google/callback

func AuthLoginHandler

func AuthLoginHandler(w http.ResponseWriter, r *http.Request)

AuthLoginHandler POST /api/login

func AuthLogoutHandler

func AuthLogoutHandler(w http.ResponseWriter, r *http.Request)

AuthLogoutHandler POST /api/logout

func BackupCreateHandler

func BackupCreateHandler(w http.ResponseWriter, r *http.Request)

func BackupDeleteHandler

func BackupDeleteHandler(w http.ResponseWriter, r *http.Request)

func BackupExecuteHandler

func BackupExecuteHandler(w http.ResponseWriter, r *http.Request)

BackupExecuteHandler Execute the backup task with the specified ID (async) POST /api/backup/execute/{id}

func BackupListHandler

func BackupListHandler(w http.ResponseWriter, r *http.Request)

func BackupPauseHandler

func BackupPauseHandler(w http.ResponseWriter, r *http.Request)

func BackupResumeHandler

func BackupResumeHandler(w http.ResponseWriter, r *http.Request)

func BackupRunHandler

func BackupRunHandler(w http.ResponseWriter, r *http.Request)

func BackupStatusHandler

func BackupStatusHandler(w http.ResponseWriter, r *http.Request)

BackupStatusHandler Get the status of a background backup task GET /api/backup/status/{taskId}

func BackupUpdateHandler

func BackupUpdateHandler(w http.ResponseWriter, r *http.Request)

func ChangeStreamsStatusHandler

func ChangeStreamsStatusHandler(w http.ResponseWriter, r *http.Request)

GET /api/changestreams/status

func DeleteUserHandler

func DeleteUserHandler(w http.ResponseWriter, r *http.Request)

DeleteUserHandler DELETE /api/users

func ExecuteSQLHandler

func ExecuteSQLHandler(w http.ResponseWriter, r *http.Request)

ExecuteSQLHandler POST /api/sql/execute

func ExtractTokenFromHeader

func ExtractTokenFromHeader(authHeader string) string

ExtractTokenFromHeader extracts token from HTTP request header

func GenerateAdminToken

func GenerateAdminToken() string

GenerateAdminToken generates admin verification token Based on current date and secret key, changes daily

func GenerateUserToken

func GenerateUserToken(username, accessLevel string) string

GenerateUserToken generates a token for a specific user Based on username, access level, current date and secret key

func GetAdminTokenHandler

func GetAdminTokenHandler(w http.ResponseWriter, r *http.Request)

GetAdminTokenHandler GET /api/getAdminToken

func GetAllUsers

func GetAllUsers() ([]map[string]interface{}, error)

GetAllUsers gets all user information

func GetAuthConfig

func GetAuthConfig(provider string) (map[string]interface{}, error)

func GetOAuthConfigHandler

func GetOAuthConfigHandler(w http.ResponseWriter, r *http.Request)

GetOAuthConfigHandler handles GET /api/oauth/{provider}/config

func GetTableSchemaHandler

func GetTableSchemaHandler(w http.ResponseWriter, r *http.Request)

TableSchemaHandler processes POST requests to get table/collection structure

func GetUserByUsername

func GetUserByUsername(username string) (map[string]interface{}, error)

GetUserByUsername gets user information by username

func GetUserData

func GetUserData(username string) (map[string]interface{}, error)

GetUserData gets user data for frontend display

func GetUsersHandler

func GetUsersHandler(w http.ResponseWriter, r *http.Request)

GetUsersHandler GET /api/users

func NewRouter

func NewRouter() http.Handler

NewRouter creates and returns the routing configuration for the entire /api

func SaveGoogleUser

func SaveGoogleUser(email, name string) (string, string, error)

SaveGoogleUser saves or updates Google user information

func SyncCreateHandler

func SyncCreateHandler(w http.ResponseWriter, r *http.Request)

POST /api/sync => create

func SyncDeleteHandler

func SyncDeleteHandler(w http.ResponseWriter, r *http.Request)

DELETE /api/sync/{id}

func SyncListHandler

func SyncListHandler(w http.ResponseWriter, r *http.Request)

GET /api/sync => query sync_tasks

func SyncLogsHandler

func SyncLogsHandler(w http.ResponseWriter, r *http.Request)

GET /api/sync/{id}/logs

func SyncMetricsHandler

func SyncMetricsHandler(w http.ResponseWriter, r *http.Request)

GET /api/sync/{id}/metrics

func SyncMonitorHandler

func SyncMonitorHandler(w http.ResponseWriter, r *http.Request)

GET /api/sync/{id}/monitor => {status, progress, tps, ...}

func SyncStartHandler

func SyncStartHandler(w http.ResponseWriter, r *http.Request)

PUT /api/sync/{id}/start => enable=1, update config_json.status='Running'

func SyncStopHandler

func SyncStopHandler(w http.ResponseWriter, r *http.Request)

PUT /api/sync/{id}/stop => enable=0, Update config_json.status='Stopped'

func SyncTablesHandler

func SyncTablesHandler(w http.ResponseWriter, r *http.Request)

GET /api/sync/{id}/tables => returns tables info and sync stats for today

func SyncUpdateHandler

func SyncUpdateHandler(w http.ResponseWriter, r *http.Request)

PUT /api/sync/{id} => Update sync_tasks.config_json + enable + last_update_time

func TestConnectionHandler

func TestConnectionHandler(w http.ResponseWriter, r *http.Request)

TestConnectionHandler POST /api/test-connection

func UpdateAdminPasswordHandler

func UpdateAdminPasswordHandler(w http.ResponseWriter, r *http.Request)

UpdateAdminPasswordHandler PUT /api/updateAdminPassword

func UpdateAuthConfig

func UpdateAuthConfig(provider string, config map[string]interface{}) error

func UpdateOAuthConfigHandler

func UpdateOAuthConfigHandler(w http.ResponseWriter, r *http.Request)

UpdateOAuthConfigHandler handles PUT /api/oauth/{provider}/config

func UpdatePasswordHandler

func UpdatePasswordHandler(w http.ResponseWriter, r *http.Request)

UpdatePasswordHandler PUT /api/updatePassword

func UpdateUserAccessHandler

func UpdateUserAccessHandler(w http.ResponseWriter, r *http.Request)

UpdateUserAccessHandler PUT /api/users/access

func UpdateUserPassword

func UpdateUserPassword(username, newPassword string) error

UpdateUserPassword updates user password

func ValidateAdminToken

func ValidateAdminToken(token string) bool

ValidateAdminToken validates if admin token is valid

func ValidateUser

func ValidateUser(username, password string) (bool, string, error)

ValidateUser validates username and password

func ValidateUserToken

func ValidateUserToken(token string) (bool, string, string)

ValidateUserToken validates if user token is valid and returns username and access level

Types

type BackupTaskStatus

type BackupTaskStatus struct {
	TaskID      string     `json:"taskId"`
	BackupID    int        `json:"backupId"`
	Status      string     `json:"status"` // pending, running, completed, failed
	Message     string     `json:"message"`
	CreatedAt   time.Time  `json:"createdAt"`
	CompletedAt *time.Time `json:"completedAt,omitempty"`
	Error       string     `json:"error,omitempty"`
}

BackupTaskStatus represents the status of a background backup task

type Field

type Field struct {
	Name      string `json:"name"`
	Type      string `json:"type"`
	IsPrimary bool   `json:"isPrimary"`
}

Field represents table field information

type SchemaRequest

type SchemaRequest struct {
	SourceType string `json:"sourceType"`
	Connection struct {
		Host     string `json:"host"`
		Port     string `json:"port"`
		User     string `json:"user"`
		Password string `json:"password"`
		Database string `json:"database"`
	} `json:"connection"`
	TableName string `json:"tableName"`
}

SchemaRequest represents a request to get table structure

type SchemaResponse

type SchemaResponse struct {
	Fields []Field `json:"fields"`
}

SchemaResponse represents a table structure response

Jump to

Keyboard shortcuts

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