Help us shape the future of Go! Take the 2026 Go Developer Survey

api

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package api names the wire types handlers still import. The definitions live with the noun they describe.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flag added in v0.3.0

func Flag(value *bool) bool

Flag reads an optional request flag, treating an absent one as false.

Parameters:

  • value: Submitted flag, nil when the request omitted the field.

Returns:

  • flag: The value the flag carries, false when it was absent.

func FlagOrDefault added in v0.3.0

func FlagOrDefault(value *bool, fallback bool) bool

FlagOrDefault reads an optional request flag against a configured default.

Parameters:

  • value: Submitted flag, nil when the request omitted the field.
  • fallback: Configured value to use when the field was absent.

Returns:

  • flag: The value the flag carries, otherwise fallback.

Types

type ClipRequest

type ClipRequest = clip.Request

ClipRequest is the export request. The value is a clip.Request.

type ClipResponse

type ClipResponse = clip.Response

ClipResponse is the clip payload. The value is a clip.Response.

type ErrorCode added in v0.3.0

type ErrorCode string

ErrorCode is the machine-readable code an ErrorResponse carries.

const (
	// InvalidRequest reports a request that could not be read or bound.
	InvalidRequest ErrorCode = "invalid_request"

	// NotFound reports a resource nothing is registered under.
	NotFound ErrorCode = "not_found"

	// PersistFailed reports something that could not be saved.
	PersistFailed ErrorCode = "persist_failed"

	// JobActive reports a clip already queued or rendering.
	JobActive ErrorCode = "job_active"

	// MediaPathUnresolved reports a source that could not be resolved.
	MediaPathUnresolved ErrorCode = "media_path"

	// InvalidQuality reports a profile id that names no profile.
	InvalidQuality ErrorCode = "invalid_quality"

	// InvalidClipType reports a clip type the job cannot become.
	InvalidClipType ErrorCode = "invalid_clip_type"

	// NotCancellable reports a clip that is not queued or rendering.
	NotCancellable ErrorCode = "not_cancellable"

	// DeleteFailed reports a clip that could not be removed.
	DeleteFailed ErrorCode = "delete_failed"

	// NotReady reports a clip that has not finished rendering.
	NotReady ErrorCode = "not_ready"

	// FileMissing reports a finished clip whose output is gone.
	FileMissing ErrorCode = "file_missing"

	// PreviewBusy reports a preview refused because every slot is taken.
	PreviewBusy ErrorCode = "preview_busy"

	// PreviewNotRunning reports a preview that was not rendering.
	PreviewNotRunning ErrorCode = "preview_not_running"

	// MissingQuery reports a Plex search carried no query.
	MissingQuery ErrorCode = "missing_query"

	// SearchFailed reports a Plex search that could not be completed.
	SearchFailed ErrorCode = "search_failed"

	// HTTPError reports a request that failed outside a handler's own codes.
	HTTPError ErrorCode = "http_error"

	// PINFailed reports a Plex PIN that could not be created.
	PINFailed ErrorCode = "pin_failed"

	// LogoutFailed reports credentials that could not be cleared.
	LogoutFailed ErrorCode = "logout_failed"
)

The codes an ErrorResponse may carry.

type ErrorResponse

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

ErrorResponse represents an error response.

type MediaItemResponse

type MediaItemResponse struct {
	ID           string  `json:"id"`
	Title        string  `json:"title"`
	Type         string  `json:"type"`
	Duration     float64 `json:"duration,omitempty"`
	ThumbPath    string  `json:"thumbPath,omitempty"`
	LibraryTitle string  `json:"libraryTitle,omitempty"`
	Year         int     `json:"year,omitempty"`
	Season       int     `json:"season,omitempty"`
	Episode      int     `json:"episode,omitempty"`
	ShowTitle    string  `json:"showTitle,omitempty"`
}

MediaItemResponse represents a media item in API responses.

type MediaListResponse

type MediaListResponse struct {
	Items []MediaItemResponse `json:"items"`
	Total int                 `json:"total"`
}

MediaListResponse represents a paginated list of media items.

type SessionResponse

type SessionResponse struct {
	ID         string  `json:"id"`
	MediaID    string  `json:"mediaId,omitempty"`
	Title      string  `json:"title"`
	Duration   float64 `json:"duration"`
	ViewOffset float64 `json:"viewOffset,omitempty"`
}

SessionResponse represents a session in API responses.

Jump to

Keyboard shortcuts

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