handlers

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Commit = ""

Commit is the git commit hash, set via ldflags at build time

View Source
var LogoutURL = ""

LogoutURL is set by the router when the deployment requires an external logout redirect (e.g. Envoy Gateway's /logout path for OIDC session cleanup).

View Source
var Mode = "team"

Mode is set by the router based on config (e.g. "local" or "team")

View Source
var Version = "dev"

Version is set via ldflags at build time

Functions

func CLILogin

func CLILogin(basicAuth *auth.BasicAuthenticator, proxyAdminGroups string, store *auth.DeviceCodeStore) gin.HandlerFunc

CLILogin godoc @Summary Browser-based login for CLI clients @Description Handles browser-based CLI login using a device code flow. @Description If behind an OIDC proxy, auto-completes the code. Otherwise shows a login form. @Tags auth @Produce html @Param code query string true "Device code from CLI" @Success 200 {string} string "HTML page" @Failure 400 {object} map[string]string @Router /auth/cli-login [get]

func CLILoginCode

func CLILoginCode(store *auth.DeviceCodeStore) gin.HandlerFunc

CLILoginCode godoc @Summary Request a device code for CLI login @Description Generates a short-lived device code for browser-based CLI authentication. @Tags auth @Produce json @Success 200 {object} map[string]interface{} @Router /auth/cli-login/code [post]

func CLILoginPoll

func CLILoginPoll(store *auth.DeviceCodeStore) gin.HandlerFunc

CLILoginPoll godoc @Summary Poll for CLI login completion @Description Polls the status of a device code. Returns the token when authentication is complete. @Tags auth @Produce json @Param code query string true "Device code" @Success 200 {object} map[string]interface{} @Failure 404 {object} map[string]string @Router /auth/cli-login/poll [get]

func GetCurrentUser

func GetCurrentUser(authenticator auth.Authenticator) gin.HandlerFunc

GetCurrentUser godoc @Summary Get current user @Description Get the currently authenticated user's information @Tags auth @Produce json @Success 200 {object} models.User @Failure 401 {object} map[string]string @Router /auth/me [get]

func GetVersion

func GetVersion(c *gin.Context)

GetVersion godoc @Summary Get version information @Description Returns version information about the Nebi server @Tags system @Produce json @Success 200 {object} map[string]string @Router /version [get]

func HealthCheck

func HealthCheck(c *gin.Context)

HealthCheck godoc @Summary Health check endpoint @Description Returns the health status of the service @Tags health @Produce json @Success 200 {object} HealthResponse @Router /health [get]

func Login

func Login(authenticator auth.Authenticator) gin.HandlerFunc

Login godoc @Summary User login @Description Authenticate user and return JWT token @Tags auth @Accept json @Produce json @Param credentials body auth.LoginRequest true "Login credentials" @Success 200 {object} auth.LoginResponse @Failure 400 {object} map[string]string @Failure 401 {object} map[string]string @Router /auth/login [post]

func NotImplemented

func NotImplemented(c *gin.Context)

NotImplemented is a placeholder handler for unimplemented endpoints

func OIDCCallback

func OIDCCallback(oidcAuth *auth.OIDCAuthenticator) gin.HandlerFunc

OIDCCallback godoc @Summary Handle OIDC callback @Description Process OIDC callback and authenticate user @Tags auth @Accept json @Produce json @Param code query string true "Authorization code" @Param state query string true "State parameter" @Success 200 {object} auth.LoginResponse @Failure 400 {object} map[string]string @Failure 401 {object} map[string]string @Router /auth/oidc/callback [get]

func OIDCLogin

func OIDCLogin(oidcAuth *auth.OIDCAuthenticator) gin.HandlerFunc

OIDCLogin godoc @Summary Initiate OIDC login @Description Redirects user to OIDC provider for authentication @Tags auth @Produce json @Success 302 {string} string "Redirect to OIDC provider" @Router /auth/oidc/login [get]

func SessionCheck

func SessionCheck(basicAuth *auth.BasicAuthenticator, proxyAdminGroups string) gin.HandlerFunc

SessionCheck godoc @Summary Check proxy session @Description Check for an IdToken cookie (set by an authenticating proxy) and return a Nebi JWT @Tags auth @Produce json @Success 200 {object} auth.LoginResponse @Failure 401 {object} map[string]string @Router /auth/session [get]

Types

type AdminHandler

type AdminHandler struct {
	// contains filtered or unexported fields
}

func NewAdminHandler

func NewAdminHandler(db *gorm.DB) *AdminHandler

func (*AdminHandler) CreateUser

func (h *AdminHandler) CreateUser(c *gin.Context)

CreateUser godoc @Summary Create a new user (admin only) @Tags admin @Security BearerAuth @Accept json @Produce json @Param user body CreateUserRequest true "User details" @Success 201 {object} models.User @Router /admin/users [post]

func (*AdminHandler) DeleteUser

func (h *AdminHandler) DeleteUser(c *gin.Context)

DeleteUser godoc @Summary Delete a user (admin only) @Tags admin @Security BearerAuth @Param id path string true "User UUID" @Success 204 @Router /admin/users/{id} [delete]

func (*AdminHandler) GetDashboardStats

func (h *AdminHandler) GetDashboardStats(c *gin.Context)

GetDashboardStats godoc @Summary Get admin dashboard statistics @Tags admin @Security BearerAuth @Produce json @Success 200 {object} DashboardStatsResponse @Router /admin/dashboard/stats [get]

func (*AdminHandler) GetUser

func (h *AdminHandler) GetUser(c *gin.Context)

GetUser godoc @Summary Get user by ID (admin only) @Tags admin @Security BearerAuth @Param id path string true "User UUID" @Success 200 {object} UserWithAdminStatus @Router /admin/users/{id} [get]

func (*AdminHandler) GrantPermission

func (h *AdminHandler) GrantPermission(c *gin.Context)

GrantPermission godoc @Summary Grant workspace access to a user @Tags admin @Security BearerAuth @Accept json @Produce json @Param permission body GrantPermissionRequest true "Permission details" @Success 201 {object} models.Permission @Router /admin/permissions [post]

func (*AdminHandler) ListAuditLogs

func (h *AdminHandler) ListAuditLogs(c *gin.Context)

ListAuditLogs godoc @Summary List audit logs @Tags admin @Security BearerAuth @Produce json @Param user_id query string false "Filter by user ID" @Param action query string false "Filter by action" @Success 200 {array} models.AuditLog @Router /admin/audit-logs [get]

func (*AdminHandler) ListPermissions

func (h *AdminHandler) ListPermissions(c *gin.Context)

ListPermissions godoc @Summary List all permissions @Tags admin @Security BearerAuth @Produce json @Success 200 {array} models.Permission @Router /admin/permissions [get]

func (*AdminHandler) ListRoles

func (h *AdminHandler) ListRoles(c *gin.Context)

ListRoles godoc @Summary List all roles @Tags admin @Security BearerAuth @Produce json @Success 200 {array} models.Role @Router /admin/roles [get]

func (*AdminHandler) ListUsers

func (h *AdminHandler) ListUsers(c *gin.Context)

ListUsers godoc @Summary List all users (admin only) @Tags admin @Security BearerAuth @Produce json @Success 200 {array} UserWithAdminStatus @Router /admin/users [get]

func (*AdminHandler) RevokePermission

func (h *AdminHandler) RevokePermission(c *gin.Context)

RevokePermission godoc @Summary Revoke a permission @Tags admin @Security BearerAuth @Param id path string true "Permission ID" @Success 204 @Router /admin/permissions/{id} [delete]

func (*AdminHandler) ToggleAdmin

func (h *AdminHandler) ToggleAdmin(c *gin.Context)

ToggleAdmin godoc @Summary Toggle admin status for a user @Tags admin @Security BearerAuth @Param id path string true "User UUID" @Success 200 {object} UserWithAdminStatus @Router /admin/users/{id}/toggle-admin [post]

type CollaboratorResponse

type CollaboratorResponse struct {
	UserID   uuid.UUID `json:"user_id"`
	Username string    `json:"username"`
	Email    string    `json:"email,omitempty"`
	Role     string    `json:"role"` // "owner", "editor", "viewer"
	IsOwner  bool      `json:"is_owner"`
}

type CreateRegistryRequest

type CreateRegistryRequest struct {
	Name      string `json:"name" binding:"required"`
	URL       string `json:"url" binding:"required"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	APIToken  string `json:"api_token"`
	IsDefault bool   `json:"is_default"`
	Namespace string `json:"namespace"`
}

type CreateUserRequest

type CreateUserRequest struct {
	Username string `json:"username" binding:"required"`
	Email    string `json:"email" binding:"required,email"`
	Password string `json:"password" binding:"required"`
	IsAdmin  bool   `json:"is_admin"`
}

Request types

type CreateWorkspaceRequest

type CreateWorkspaceRequest struct {
	Name           string `json:"name" binding:"required"`
	PackageManager string `json:"package_manager"`
	PixiToml       string `json:"pixi_toml"`
	Source         string `json:"source"`
	Path           string `json:"path"`
}

type DashboardStatsResponse

type DashboardStatsResponse struct {
	TotalDiskUsageBytes     int64  `json:"total_disk_usage_bytes"`
	TotalDiskUsageFormatted string `json:"total_disk_usage_formatted"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse is a standard error response

type GrantPermissionRequest

type GrantPermissionRequest struct {
	UserID      uuid.UUID `json:"user_id" binding:"required"`
	WorkspaceID uuid.UUID `json:"workspace_id" binding:"required"`
	RoleID      uint      `json:"role_id" binding:"required"`
}

type HealthResponse

type HealthResponse struct {
	Status    string    `json:"status"`
	Timestamp time.Time `json:"timestamp"`
	Version   string    `json:"version"`
}

HealthResponse represents the health check response

type ImportRequest

type ImportRequest struct {
	Repository string `json:"repository" binding:"required"`
	Tag        string `json:"tag" binding:"required"`
	Name       string `json:"name" binding:"required"`
}

ImportRequest is the JSON body for the import endpoint

type InstallPackagesRequest

type InstallPackagesRequest struct {
	Packages []string `json:"packages" binding:"required"`
}

type JobHandler

type JobHandler struct {
	// contains filtered or unexported fields
}

func NewJobHandler

func NewJobHandler(db *gorm.DB, broker *logstream.LogBroker, valkeyClient interface{}) *JobHandler

func (*JobHandler) GetJob

func (h *JobHandler) GetJob(c *gin.Context)

GetJob godoc @Summary Get a job by ID @Tags jobs @Security BearerAuth @Produce json @Param id path string true "Job ID" @Success 200 {object} models.Job @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs/{id} [get]

func (*JobHandler) ListJobs

func (h *JobHandler) ListJobs(c *gin.Context)

ListJobs godoc @Summary List all jobs for user's workspaces @Tags jobs @Security BearerAuth @Produce json @Success 200 {array} models.Job @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs [get]

func (*JobHandler) StreamJobLogs

func (h *JobHandler) StreamJobLogs(c *gin.Context)

StreamJobLogs godoc @Summary Stream job logs in real-time via Server-Sent Events @Tags jobs @Security BearerAuth @Produce text/event-stream @Param id path string true "Job ID" @Param token query string false "Auth token (alternative to Bearer header for EventSource compatibility)" @Success 200 {string} string "event stream" @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /jobs/{id}/logs/stream [get]

type PixiTomlResponse

type PixiTomlResponse struct {
	Content string `json:"content"`
}

type PublicationResponse

type PublicationResponse struct {
	ID                uuid.UUID `json:"id"`
	VersionNumber     int       `json:"version_number"`
	RegistryName      string    `json:"registry_name"`
	RegistryURL       string    `json:"registry_url"`
	RegistryNamespace string    `json:"registry_namespace"`
	Repository        string    `json:"repository"`
	Tag               string    `json:"tag"`
	Digest            string    `json:"digest"`
	IsPublic          bool      `json:"is_public"`
	PublishedBy       string    `json:"published_by"`
	PublishedAt       string    `json:"published_at"`
}

type PublishDefaultsResponse

type PublishDefaultsResponse struct {
	RegistryID   uuid.UUID `json:"registry_id"`
	RegistryName string    `json:"registry_name"`
	Namespace    string    `json:"namespace"`
	Repository   string    `json:"repository"`
	Tag          string    `json:"tag"`
}

type PublishRequest

type PublishRequest struct {
	RegistryID uuid.UUID `json:"registry_id" binding:"required"`
	Repository string    `json:"repository" binding:"required"` // e.g., "myorg/myenv"
	Tag        string    `json:"tag" binding:"required"`        // e.g., "v1.0.0"
}

type PushVersionRequest

type PushVersionRequest struct {
	Tag      string `json:"tag"`
	PixiToml string `json:"pixi_toml" binding:"required"`
	PixiLock string `json:"pixi_lock"`
	Force    bool   `json:"force"`
}

type PushVersionResponse

type PushVersionResponse struct {
	VersionNumber int      `json:"version_number"`
	Tags          []string `json:"tags"`
	ContentHash   string   `json:"content_hash"`
	Deduplicated  bool     `json:"deduplicated"`
	Tag           string   `json:"tag"`
}

type RegistryBrowseHandler

type RegistryBrowseHandler struct {
	// contains filtered or unexported fields
}

RegistryBrowseHandler handles browsing and importing from OCI registries

func NewRegistryBrowseHandler

func NewRegistryBrowseHandler(db *gorm.DB, svc *service.WorkspaceService, encKey []byte) *RegistryBrowseHandler

NewRegistryBrowseHandler creates a new registry browse handler

func (*RegistryBrowseHandler) ImportEnvironment

func (h *RegistryBrowseHandler) ImportEnvironment(c *gin.Context)

ImportEnvironment pulls an environment from a registry and creates a workspace

func (*RegistryBrowseHandler) ListRepositories

func (h *RegistryBrowseHandler) ListRepositories(c *gin.Context)

ListRepositories lists repositories in a registry. Falls back to Quay.io API or known publications if /v2/_catalog is not supported.

func (*RegistryBrowseHandler) ListTags

func (h *RegistryBrowseHandler) ListTags(c *gin.Context)

ListTags lists tags for a repository in a registry

type RegistryHandler

type RegistryHandler struct {
	// contains filtered or unexported fields
}

RegistryHandler handles OCI registry operations

func NewRegistryHandler

func NewRegistryHandler(db *gorm.DB, encKey []byte) *RegistryHandler

NewRegistryHandler creates a new registry handler

func (*RegistryHandler) CreateRegistry

func (h *RegistryHandler) CreateRegistry(c *gin.Context)

CreateRegistry godoc @Summary Create a new OCI registry @Description Add a new OCI registry configuration (admin only) @Tags admin @Security BearerAuth @Accept json @Produce json @Param registry body CreateRegistryRequest true "Registry details" @Success 201 {object} RegistryResponse @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /admin/registries [post]

func (*RegistryHandler) DeleteRegistry

func (h *RegistryHandler) DeleteRegistry(c *gin.Context)

DeleteRegistry godoc @Summary Delete a registry @Description Delete an OCI registry configuration (admin only) @Tags admin @Security BearerAuth @Accept json @Produce json @Param id path string true "Registry ID" @Success 204 @Failure 404 {object} ErrorResponse @Router /admin/registries/{id} [delete]

func (*RegistryHandler) GetRegistry

func (h *RegistryHandler) GetRegistry(c *gin.Context)

GetRegistry godoc @Summary Get a registry by ID @Description Get details of a specific OCI registry (admin only) @Tags admin @Security BearerAuth @Accept json @Produce json @Param id path string true "Registry ID" @Success 200 {object} RegistryResponse @Failure 404 {object} ErrorResponse @Router /admin/registries/{id} [get]

func (*RegistryHandler) ListPublicRegistries

func (h *RegistryHandler) ListPublicRegistries(c *gin.Context)

ListPublicRegistries godoc @Summary List available registries (public info only) @Description Get list of registries for users to select from (no credentials exposed) @Tags registries @Security BearerAuth @Accept json @Produce json @Success 200 {array} RegistryResponse @Router /registries [get]

func (*RegistryHandler) ListRegistries

func (h *RegistryHandler) ListRegistries(c *gin.Context)

ListRegistries godoc @Summary List all OCI registries @Description Get list of all configured OCI registries (admin only) @Tags admin @Security BearerAuth @Accept json @Produce json @Success 200 {array} RegistryResponse @Failure 500 {object} ErrorResponse @Router /admin/registries [get]

func (*RegistryHandler) UpdateRegistry

func (h *RegistryHandler) UpdateRegistry(c *gin.Context)

UpdateRegistry godoc @Summary Update a registry @Description Update OCI registry details (admin only) @Tags admin @Security BearerAuth @Accept json @Produce json @Param id path string true "Registry ID" @Param registry body UpdateRegistryRequest true "Registry updates" @Success 200 {object} RegistryResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Router /admin/registries/{id} [put]

type RegistryResponse

type RegistryResponse struct {
	ID          uuid.UUID `json:"id"`
	Name        string    `json:"name"`
	URL         string    `json:"url"`
	Username    string    `json:"username"`
	HasAPIToken bool      `json:"has_api_token"`
	IsDefault   bool      `json:"is_default"`
	Namespace   string    `json:"namespace"`
	CreatedAt   string    `json:"created_at"`
}

type RemoteHandler

type RemoteHandler struct {
	// contains filtered or unexported fields
}

RemoteHandler proxies requests to a remote Nebi server. Used in local/desktop mode so the frontend can browse remote servers.

func NewRemoteHandler

func NewRemoteHandler(db *gorm.DB) *RemoteHandler

NewRemoteHandler creates a new remote handler.

func (*RemoteHandler) ConnectServer

func (h *RemoteHandler) ConnectServer(c *gin.Context)

ConnectServer authenticates with a remote server and stores credentials.

func (*RemoteHandler) CreateWorkspace

func (h *RemoteHandler) CreateWorkspace(c *gin.Context)

CreateWorkspace proxies workspace creation to the remote server.

func (*RemoteHandler) DeleteWorkspace

func (h *RemoteHandler) DeleteWorkspace(c *gin.Context)

DeleteWorkspace proxies workspace deletion to the remote server.

func (*RemoteHandler) DisconnectServer

func (h *RemoteHandler) DisconnectServer(c *gin.Context)

DisconnectServer clears stored credentials.

func (*RemoteHandler) GetAdminDashboardStats

func (h *RemoteHandler) GetAdminDashboardStats(c *gin.Context)

GetAdminDashboardStats proxies admin dashboard stats to the remote server.

func (*RemoteHandler) GetPixiToml

func (h *RemoteHandler) GetPixiToml(c *gin.Context)

GetPixiToml proxies pixi.toml fetch for a remote workspace. Returns JSON {"content": "..."} for uniform frontend consumption.

func (*RemoteHandler) GetServer

func (h *RemoteHandler) GetServer(c *gin.Context)

GetServer returns the current connection status.

func (*RemoteHandler) GetVersionPixiLock

func (h *RemoteHandler) GetVersionPixiLock(c *gin.Context)

GetVersionPixiLock proxies version-specific pixi.lock fetch. Returns JSON {"content": "..."} — see GetVersionPixiToml for rationale.

func (*RemoteHandler) GetVersionPixiToml

func (h *RemoteHandler) GetVersionPixiToml(c *gin.Context)

GetVersionPixiToml proxies version-specific pixi.toml fetch. Returns JSON {"content": "..."} — the upstream returns plain text but we wrap it in JSON for uniform frontend consumption.

func (*RemoteHandler) GetWorkspace

func (h *RemoteHandler) GetWorkspace(c *gin.Context)

GetWorkspace proxies a single workspace fetch to the remote server.

func (*RemoteHandler) ListAdminAuditLogs

func (h *RemoteHandler) ListAdminAuditLogs(c *gin.Context)

ListAdminAuditLogs proxies admin audit log listing to the remote server.

func (*RemoteHandler) ListAdminRegistries

func (h *RemoteHandler) ListAdminRegistries(c *gin.Context)

ListAdminRegistries proxies admin registry listing to the remote server.

func (*RemoteHandler) ListAdminUsers

func (h *RemoteHandler) ListAdminUsers(c *gin.Context)

ListAdminUsers proxies admin user listing to the remote server.

func (*RemoteHandler) ListJobs

func (h *RemoteHandler) ListJobs(c *gin.Context)

ListJobs proxies job listing to the remote server.

func (*RemoteHandler) ListRegistries

func (h *RemoteHandler) ListRegistries(c *gin.Context)

ListRegistries proxies registry listing to the remote server.

func (*RemoteHandler) ListTags

func (h *RemoteHandler) ListTags(c *gin.Context)

ListTags proxies tag listing for a remote workspace.

func (*RemoteHandler) ListVersions

func (h *RemoteHandler) ListVersions(c *gin.Context)

ListVersions proxies version listing for a remote workspace.

func (*RemoteHandler) ListWorkspaces

func (h *RemoteHandler) ListWorkspaces(c *gin.Context)

ListWorkspaces proxies workspace listing to the remote server.

func (*RemoteHandler) PushVersion

func (h *RemoteHandler) PushVersion(c *gin.Context)

PushVersion proxies version push to the remote server.

type RollbackRequest

type RollbackRequest struct {
	VersionNumber int `json:"version_number" binding:"required"`
}

type SavePixiTomlRequest

type SavePixiTomlRequest struct {
	Content string `json:"content" binding:"required"`
}

type ShareWorkspaceRequest

type ShareWorkspaceRequest struct {
	UserID uuid.UUID `json:"user_id" binding:"required"`
	Role   string    `json:"role" binding:"required"` // "viewer" or "editor"
}

type UpdatePublicationRequest

type UpdatePublicationRequest struct {
	IsPublic *bool `json:"is_public" binding:"required"`
}

type UpdateRegistryRequest

type UpdateRegistryRequest struct {
	Name      *string `json:"name"`
	URL       *string `json:"url"`
	Username  *string `json:"username"`
	Password  *string `json:"password"`
	APIToken  *string `json:"api_token"`
	IsDefault *bool   `json:"is_default"`
	Namespace *string `json:"namespace"`
}

type UserWithAdminStatus

type UserWithAdminStatus struct {
	models.User
	IsAdmin bool `json:"is_admin"`
}

type WorkspaceHandler

type WorkspaceHandler struct {
	// contains filtered or unexported fields
}

func NewWorkspaceHandler

func NewWorkspaceHandler(svc *service.WorkspaceService, db *gorm.DB, q queue.Queue, exec executor.Executor, isLocal bool, encKey []byte) *WorkspaceHandler

func (*WorkspaceHandler) CreateWorkspace

func (h *WorkspaceHandler) CreateWorkspace(c *gin.Context)

CreateWorkspace godoc @Summary Create a new workspace @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param workspace body CreateWorkspaceRequest true "Workspace details" @Success 201 {object} models.Workspace @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces [post]

func (*WorkspaceHandler) DeleteWorkspace

func (h *WorkspaceHandler) DeleteWorkspace(c *gin.Context)

DeleteWorkspace godoc @Summary Delete an workspace @Tags workspaces @Security BearerAuth @Param id path string true "Workspace ID" @Success 204 @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id} [delete]

func (*WorkspaceHandler) DownloadLockFile

func (h *WorkspaceHandler) DownloadLockFile(c *gin.Context)

DownloadLockFile godoc @Summary Download pixi.lock for a specific version @Tags workspaces @Security BearerAuth @Produce text/plain @Param id path string true "Workspace ID" @Param version path int true "Version number" @Success 200 {string} string "pixi.lock content" @Router /workspaces/{id}/versions/{version}/pixi-lock [get]

func (*WorkspaceHandler) DownloadManifestFile

func (h *WorkspaceHandler) DownloadManifestFile(c *gin.Context)

DownloadManifestFile godoc @Summary Download pixi.toml for a specific version @Tags workspaces @Security BearerAuth @Produce text/plain @Param id path string true "Workspace ID" @Param version path int true "Version number" @Success 200 {string} string "pixi.toml content" @Router /workspaces/{id}/versions/{version}/pixi-toml [get]

func (*WorkspaceHandler) GetPixiToml

func (h *WorkspaceHandler) GetPixiToml(c *gin.Context)

GetPixiToml godoc @Summary Get pixi.toml content for an workspace @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {object} PixiTomlResponse @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/pixi-toml [get]

func (*WorkspaceHandler) GetPublishDefaults

func (h *WorkspaceHandler) GetPublishDefaults(c *gin.Context)

GetPublishDefaults godoc @Summary Get default values for publishing a workspace @Description Returns suggested registry, repository name, and next tag for publishing @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {object} PublishDefaultsResponse @Failure 404 {object} ErrorResponse @Router /workspaces/{id}/publish-defaults [get]

func (*WorkspaceHandler) GetVersion

func (h *WorkspaceHandler) GetVersion(c *gin.Context)

GetVersion godoc @Summary Get a specific version with full details @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Param version path int true "Version number" @Success 200 {object} models.WorkspaceVersion @Router /workspaces/{id}/versions/{version} [get]

func (*WorkspaceHandler) GetWorkspace

func (h *WorkspaceHandler) GetWorkspace(c *gin.Context)

GetWorkspace godoc @Summary Get a workspace by ID @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {object} models.Workspace @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id} [get]

func (*WorkspaceHandler) InstallPackages

func (h *WorkspaceHandler) InstallPackages(c *gin.Context)

InstallPackages godoc @Summary Install packages in an workspace @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param packages body InstallPackagesRequest true "Packages to install" @Success 202 {object} models.Job @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/packages [post]

func (*WorkspaceHandler) ListCollaborators

func (h *WorkspaceHandler) ListCollaborators(c *gin.Context)

ListCollaborators godoc @Summary List all users with access to workspace @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {array} CollaboratorResponse @Router /workspaces/{id}/collaborators [get]

func (*WorkspaceHandler) ListPackages

func (h *WorkspaceHandler) ListPackages(c *gin.Context)

ListPackages godoc @Summary List packages in an workspace @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {array} models.Package @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/packages [get]

func (*WorkspaceHandler) ListPublications

func (h *WorkspaceHandler) ListPublications(c *gin.Context)

ListPublications godoc @Summary List publications for an workspace @Description Get all publications (registry pushes) for an workspace @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {array} PublicationResponse @Failure 404 {object} ErrorResponse @Router /workspaces/{id}/publications [get]

func (*WorkspaceHandler) ListTags

func (h *WorkspaceHandler) ListTags(c *gin.Context)

ListTags godoc @Summary List tags for an workspace @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {array} WorkspaceTagResponse @Router /workspaces/{id}/tags [get]

func (*WorkspaceHandler) ListVersions

func (h *WorkspaceHandler) ListVersions(c *gin.Context)

ListVersions godoc @Summary List all versions for an workspace @Tags workspaces @Security BearerAuth @Produce json @Param id path string true "Workspace ID" @Success 200 {array} models.WorkspaceVersion @Router /workspaces/{id}/versions [get]

func (*WorkspaceHandler) ListWorkspaces

func (h *WorkspaceHandler) ListWorkspaces(c *gin.Context)

ListWorkspaces godoc @Summary List all workspaces for the current user @Tags workspaces @Security BearerAuth @Produce json @Success 200 {array} models.Workspace @Failure 401 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces [get]

func (*WorkspaceHandler) PublishWorkspace

func (h *WorkspaceHandler) PublishWorkspace(c *gin.Context)

PublishWorkspace godoc @Summary Publish workspace to OCI registry @Description Publish pixi.toml and pixi.lock to an OCI registry @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param request body PublishRequest true "Publish request" @Success 201 {object} PublicationResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/publish [post]

func (*WorkspaceHandler) PushVersion

func (h *WorkspaceHandler) PushVersion(c *gin.Context)

PushVersion godoc @Summary Push a new version to the server @Description Create a new workspace version and assign a tag @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param request body PushVersionRequest true "Push request" @Success 201 {object} PushVersionResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 409 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/push [post]

func (*WorkspaceHandler) RemovePackages

func (h *WorkspaceHandler) RemovePackages(c *gin.Context)

RemovePackages godoc @Summary Remove packages from an workspace @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param package path string true "Package name" @Success 202 {object} models.Job @Failure 400 {object} ErrorResponse @Failure 401 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/packages/{package} [delete]

func (*WorkspaceHandler) RollbackToVersion

func (h *WorkspaceHandler) RollbackToVersion(c *gin.Context)

RollbackToVersion godoc @Summary Rollback workspace to a previous version @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param request body RollbackRequest true "Rollback request" @Success 202 {object} models.Job @Router /workspaces/{id}/rollback [post]

func (*WorkspaceHandler) SavePixiToml

func (h *WorkspaceHandler) SavePixiToml(c *gin.Context)

SavePixiToml godoc @Summary Save pixi.toml content for a workspace @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param request body SavePixiTomlRequest true "pixi.toml content" @Success 200 {object} PixiTomlResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/pixi-toml [put]

func (*WorkspaceHandler) ShareWorkspace

func (h *WorkspaceHandler) ShareWorkspace(c *gin.Context)

ShareWorkspace godoc @Summary Share workspace with another user (owner only) @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param share body ShareWorkspaceRequest true "Share details" @Success 201 {object} models.Permission @Router /workspaces/{id}/share [post]

func (*WorkspaceHandler) UnshareWorkspace

func (h *WorkspaceHandler) UnshareWorkspace(c *gin.Context)

UnshareWorkspace godoc @Summary Revoke user access to workspace (owner only) @Tags workspaces @Security BearerAuth @Param id path string true "Workspace ID" @Param user_id path string true "User ID to revoke" @Success 204 @Router /workspaces/{id}/share/{user_id} [delete]

func (*WorkspaceHandler) UpdatePublication

func (h *WorkspaceHandler) UpdatePublication(c *gin.Context)

UpdatePublication godoc @Summary Update a publication's visibility @Description Toggle the public/private visibility of a publication @Tags workspaces @Security BearerAuth @Accept json @Produce json @Param id path string true "Workspace ID" @Param pubId path string true "Publication ID" @Param request body UpdatePublicationRequest true "Update request" @Success 200 {object} PublicationResponse @Failure 400 {object} ErrorResponse @Failure 404 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /workspaces/{id}/publications/{pubId} [patch]

type WorkspaceResponse

type WorkspaceResponse struct {
	models.Workspace
	SizeFormatted string `json:"size_formatted"`
}

WorkspaceResponse includes workspace data with formatted size

type WorkspaceTagResponse

type WorkspaceTagResponse struct {
	Tag           string `json:"tag"`
	VersionNumber int    `json:"version_number"`
	CreatedAt     string `json:"created_at"`
	UpdatedAt     string `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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