api

package
v0.0.0-...-73aa611 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const JsonContentType = "application/json"

Variables

This section is empty.

Functions

func DeleteFiles

func DeleteFiles(config config.Config, fileIds []int) error

func HasLyrics

func HasLyrics(config config.Config, songId int) (bool, bool, error)

func HealthCheck

func HealthCheck(config config.Config) error

func PostIllustration

func PostIllustration(config config.Config, trackId int, imageType IllustrationType, imageBytes []byte) error

func PostLyrics

func PostLyrics(config config.Config, songId int, plainLyrics internal.PlainLyrics, syncedLyrics *internal.SyncedLyrics) error

Types

type File

type File struct {
	Id        int    `json:"id" validate:"required"`
	Path      string `json:"path" validate:"required"`
	Checksum  string `json:"checksum" validate:"required"`
	LibraryId int    `json:"libraryId" validate:"required"`
}

func GetAllFiles

func GetAllFiles(selector FileSelectorDto, config config.Config) ([]File, error)

type FileDeletionDto

type FileDeletionDto struct {
	FileIds []int `json:"ids"`
}

type FileSelectorDto

type FileSelectorDto struct {
	Library string
	Album   string
	Release string
	Song    string
	Track   string
}

Do not change names of fields, they are mapped 1:1 with the query parameters of the requests

type IllustrationType

type IllustrationType string
const (
	Cover     IllustrationType = "Cover"
	Thumbnail IllustrationType = "Thumbnail"
)

type Library

type Library struct {
	Id   int    `json:"id" validate:"required"`
	Name string `json:"name" validate:"required"`
	Slug string `json:"slug" validate:"required"`
	Path string `json:"path" validate:"required"`
}

func GetAllLibraries

func GetAllLibraries(config config.Config) ([]Library, error)

func GetLibrary

func GetLibrary(config config.Config, librarySlug string) (Library, error)

type LyricsDto

type LyricsDto struct {
	Plain  string                   `json:"plain"`
	Synced *(internal.SyncedLyrics) `json:"synced"`
}

type MetadataCreated

type MetadataCreated struct {
	TrackId int `json:"trackId" validate:"required"`
	SongId  int `json:"songId"`
}

func SaveMetadata

func SaveMetadata(config config.Config, m internal.Metadata, saveMethod SaveMetadataMethod) (MetadataCreated, error)

type Page

type Page[T any] struct {
	Items    []T          `validate:"required,dive,required" json:"items"`
	Metadata PageMetadata `json:"metadata"`
}

type PageMetadata

type PageMetadata struct {
	Next  string `json:"next"`
	Count uint64 `json:"count"`
}

type SaveMetadataMethod

type SaveMetadataMethod string
const (
	Update SaveMetadataMethod = "Update"
	Create SaveMetadataMethod = "Create"
)

type User

type User struct {
	Admin bool `validate:"required" json:"admin"`
}

func GetUserFromAccessToken

func GetUserFromAccessToken(config config.Config, accessToken string) (User, error)

Jump to

Keyboard shortcuts

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