apis

package
v0.18.3 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTypeInvalidAuth      pyrin.ErrorType = "INVALID_AUTH"
	ErrTypeArtistNotFound   pyrin.ErrorType = "ARTIST_NOT_FOUND"
	ErrTypeAlbumNotFound    pyrin.ErrorType = "ALBUM_NOT_FOUND"
	ErrTypeTrackNotFound    pyrin.ErrorType = "TRACK_NOT_FOUND"
	ErrTypeTaglistNotFound  pyrin.ErrorType = "TAGLIST_NOT_FOUND"
	ErrTypeApiTokenNotFound pyrin.ErrorType = "API_TOKEN_NOT_FOUND"

	ErrTypeInvalidFilter     pyrin.ErrorType = "INVALID_FILTER"
	ErrTypeInvalidSort       pyrin.ErrorType = "INVALID_SORT"
	ErrTypeUserAlreadyExists pyrin.ErrorType = "USER_ALREADY_EXISTS"

	ErrTypePlaylistNotFound        pyrin.ErrorType = "PLAYLIST_NOT_FOUND"
	ErrTypePlaylistAlreadyHasTrack pyrin.ErrorType = "PLAYLIST_ALREADY_HAS_TRACK"
)

Variables

This section is empty.

Functions

func AlbumNotFound added in v0.15.0

func AlbumNotFound() *pyrin.Error

func ApiTokenNotFound added in v0.18.0

func ApiTokenNotFound() *pyrin.Error

func ArtistNotFound added in v0.15.0

func ArtistNotFound() *pyrin.Error

func ConvertSqlNullInt64 added in v0.18.0

func ConvertSqlNullInt64(value sql.NullInt64) *int64

func ConvertSqlNullString added in v0.18.0

func ConvertSqlNullString(value sql.NullString) *string

func DiscardEntriesStringArray added in v0.18.0

func DiscardEntriesStringArray(arr []string) []string

func DiscardEntriesStringArrayPtr added in v0.18.0

func DiscardEntriesStringArrayPtr(arr *[]string) *[]string

TODO(patrik): Should this be pyrins default

func InstallAlbumHandlers

func InstallAlbumHandlers(app core.App, group pyrin.Group)

func InstallArtistHandlers

func InstallArtistHandlers(app core.App, group pyrin.Group)

func InstallAuthHandlers

func InstallAuthHandlers(app core.App, group pyrin.Group)

func InstallHandlers

func InstallHandlers(app core.App, g pyrin.Group)

func InstallPlaylistHandlers

func InstallPlaylistHandlers(app core.App, group pyrin.Group)

func InstallQueueHandlers

func InstallQueueHandlers(app core.App, group pyrin.Group)

TODO(patrik): Add back

func InstallSystemHandlers

func InstallSystemHandlers(app core.App, group pyrin.Group)

func InstallTagHandlers

func InstallTagHandlers(app core.App, group pyrin.Group)

TODO(patrik): Add back

func InstallTaglistHandlers added in v0.18.0

func InstallTaglistHandlers(app core.App, group pyrin.Group)

func InstallTrackHandlers

func InstallTrackHandlers(app core.App, group pyrin.Group)

func InstallUserHandlers added in v0.18.0

func InstallUserHandlers(app core.App, group pyrin.Group)

func InvalidAuth added in v0.18.0

func InvalidAuth(message string) *pyrin.Error

func InvalidFilter added in v0.15.0

func InvalidFilter(err error) *pyrin.Error

func InvalidSort added in v0.15.2

func InvalidSort(err error) *pyrin.Error

func PlaylistAlreadyHasTrack added in v0.18.2

func PlaylistAlreadyHasTrack() *pyrin.Error

func PlaylistNotFound added in v0.18.0

func PlaylistNotFound() *pyrin.Error

func RegisterHandlers added in v0.16.2

func RegisterHandlers(app core.App, router pyrin.Router)

func Server

func Server(app core.App) (*pyrin.Server, error)

func StringArray added in v0.18.0

func StringArray(arr []string) []string

TODO(patrik): Move to pyrin

func TaglistNotFound added in v0.18.0

func TaglistNotFound() *pyrin.Error

func TestFilter added in v0.18.0

func TestFilter(filterStr string) error

func TrackNotFound added in v0.15.0

func TrackNotFound() *pyrin.Error

func User

func User(app core.App, c pyrin.Context) (*database.User, error)

func UserAlreadyExists added in v0.18.0

func UserAlreadyExists() *pyrin.Error

Types

type AddItemToPlaylistBody added in v0.18.0

type AddItemToPlaylistBody struct {
	TrackId string `json:"trackId"`
}

type Album added in v0.18.0

type Album struct {
	Id   string `json:"id"`
	Name Name   `json:"name"`

	Year *int64 `json:"year"`

	CoverArt types.Images `json:"coverArt"`

	ArtistId   string `json:"artistId"`
	ArtistName Name   `json:"artistName"`

	Tags             []string     `json:"tags"`
	FeaturingArtists []ArtistInfo `json:"featuringArtists"`
	AllArtists       []ArtistInfo `json:"allArtists"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

func ConvertDBAlbum added in v0.16.2

func ConvertDBAlbum(c pyrin.Context, album database.Album) Album

type ApiToken added in v0.18.0

type ApiToken struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type Artist added in v0.18.0

type Artist struct {
	Id   string `json:"id"`
	Name Name   `json:"name"`

	Picture types.Images `json:"picture"`

	Tags []string `json:"tags"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

func ConvertDBArtist added in v0.18.0

func ConvertDBArtist(c pyrin.Context, artist database.Artist) Artist

type ArtistInfo added in v0.18.0

type ArtistInfo struct {
	Id   string `json:"id"`
	Name Name   `json:"name"`
}

func ConvertDBFeaturingArtists added in v0.18.0

func ConvertDBFeaturingArtists(extras database.FeaturingArtists) []ArtistInfo

type ChangePasswordBody added in v0.17.0

type ChangePasswordBody struct {
	CurrentPassword    string `json:"currentPassword"`
	NewPassword        string `json:"newPassword"`
	NewPasswordConfirm string `json:"newPasswordConfirm"`
}

TODO(patrik): Test if this works with validation

func (ChangePasswordBody) Validate added in v0.17.0

func (b ChangePasswordBody) Validate() error

type CreateAlbum added in v0.17.0

type CreateAlbum struct {
	AlbumId string `json:"albumId"`
}

type CreateAlbumBody added in v0.17.0

type CreateAlbumBody struct {
	Name      string `json:"name"`
	OtherName string `json:"otherName"`

	ArtistId string `json:"artistId"`

	Year int64 `json:"year"`

	Tags             []string `json:"tags"`
	FeaturingArtists []string `json:"featuringArtists"`
}

func (*CreateAlbumBody) Transform added in v0.18.0

func (b *CreateAlbumBody) Transform()

func (CreateAlbumBody) Validate added in v0.17.0

func (b CreateAlbumBody) Validate() error

type CreateApiToken added in v0.18.0

type CreateApiToken struct {
	Token string `json:"token"`
}

type CreateApiTokenBody added in v0.18.0

type CreateApiTokenBody struct {
	Name string `json:"name"`
}

func (*CreateApiTokenBody) Transform added in v0.18.0

func (b *CreateApiTokenBody) Transform()

func (CreateApiTokenBody) Validate added in v0.18.0

func (b CreateApiTokenBody) Validate() error

type CreateArtist added in v0.18.0

type CreateArtist struct {
	Id string `json:"id"`
}

type CreateArtistBody added in v0.18.0

type CreateArtistBody struct {
	Name      string `json:"name"`
	OtherName string `json:"otherName"`
}

func (*CreateArtistBody) Transform added in v0.18.0

func (b *CreateArtistBody) Transform()

func (CreateArtistBody) Validate added in v0.18.0

func (b CreateArtistBody) Validate() error

type CreatePlaylist added in v0.18.0

type CreatePlaylist struct {
	Playlist
}

type CreatePlaylistBody added in v0.18.0

type CreatePlaylistBody struct {
	Name string `json:"name"`
}

func (*CreatePlaylistBody) Transform added in v0.18.0

func (b *CreatePlaylistBody) Transform()

func (CreatePlaylistBody) Validate added in v0.18.0

func (b CreatePlaylistBody) Validate() error

type CreateTaglist added in v0.18.0

type CreateTaglist struct {
	Id string `json:"id"`
}

type CreateTaglistBody added in v0.18.0

type CreateTaglistBody struct {
	Name   string `json:"name"`
	Filter string `json:"filter"`
}

func (*CreateTaglistBody) Transform added in v0.18.0

func (b *CreateTaglistBody) Transform()

func (CreateTaglistBody) Validate added in v0.18.0

func (b CreateTaglistBody) Validate() error

type EditAlbumBody added in v0.18.0

type EditAlbumBody struct {
	Name             *string   `json:"name,omitempty"`
	OtherName        *string   `json:"otherName,omitempty"`
	ArtistId         *string   `json:"artistId,omitempty"`
	Year             *int64    `json:"year,omitempty"`
	Tags             *[]string `json:"tags,omitempty"`
	FeaturingArtists *[]string `json:"featuringArtists,omitempty"`
}

func (*EditAlbumBody) Transform added in v0.18.0

func (b *EditAlbumBody) Transform()

func (EditAlbumBody) Validate added in v0.18.0

func (b EditAlbumBody) Validate() error

type EditArtistBody added in v0.17.0

type EditArtistBody struct {
	Name *string   `json:"name"`
	Tags *[]string `json:"tags,omitempty"`
}

func (*EditArtistBody) Transform added in v0.18.0

func (b *EditArtistBody) Transform()

func (EditArtistBody) Validate added in v0.17.0

func (b EditArtistBody) Validate() error

type EditTrackBody added in v0.18.0

type EditTrackBody struct {
	Name      *string `json:"name,omitempty"`
	OtherName *string `json:"otherName,omitempty"`
	ArtistId  *string `json:"artistId,omitempty"`
	// TODO(patrik): Remove artistName
	ArtistName       *string   `json:"artistName,omitempty"`
	Year             *int64    `json:"year,omitempty"`
	Number           *int64    `json:"number,omitempty"`
	Tags             *[]string `json:"tags,omitempty"`
	FeaturingArtists *[]string `json:"featuringArtists,omitempty"`
}

func (*EditTrackBody) Transform added in v0.18.0

func (b *EditTrackBody) Transform()

func (EditTrackBody) Validate added in v0.18.0

func (b EditTrackBody) Validate() error

type Export added in v0.16.2

type Export struct {
	Artists []ExportArtist `json:"artists"`
	Albums  []ExportAlbum  `json:"albums"`
	Tracks  []ExportTrack  `json:"tracks"`
}

type ExportAlbum added in v0.16.2

type ExportAlbum struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	ArtistId string `json:"artistId"`

	CoverArt string `json:"coverArt"`
	Year     int64  `json:"year"`
}

type ExportArtist added in v0.16.2

type ExportArtist struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	Picture string `json:"picture"`
}

type ExportTrack added in v0.16.2

type ExportTrack struct {
	Id   string `json:"id"`
	Name string `json:"name"`

	AlbumId  string `json:"albumId"`
	ArtistId string `json:"artistId"`

	Duration int64 `json:"duration"`
	Number   int64 `json:"number"`
	Year     int64 `json:"year"`

	OriginalFilename string `json:"originalFilename"`
	MobileFilename   string `json:"mobileFilename"`

	Created int64 `json:"created"`

	Tags []string `json:"tags"`
}

type GetAlbumById added in v0.18.0

type GetAlbumById struct {
	Album
}

type GetAlbumTracks added in v0.18.0

type GetAlbumTracks struct {
	Tracks []Track `json:"tracks"`
}

type GetAlbums added in v0.18.0

type GetAlbums struct {
	Albums []Album `json:"albums"`
}

type GetAllApiTokens added in v0.18.0

type GetAllApiTokens struct {
	Tokens []ApiToken `json:"tokens"`
}

type GetArtistAlbumsById added in v0.18.0

type GetArtistAlbumsById struct {
	Albums []Album `json:"albums"`
}

type GetArtistById added in v0.18.0

type GetArtistById struct {
	Artist
}

type GetArtists added in v0.18.0

type GetArtists struct {
	Artists []Artist `json:"artists"`
}

type GetMe added in v0.18.0

type GetMe struct {
	Id       string `json:"id"`
	Username string `json:"username"`
	Role     string `json:"role"`

	DisplayName   string  `json:"displayName"`
	QuickPlaylist *string `json:"quickPlaylist"`
}

type GetPlaylistById added in v0.18.0

type GetPlaylistById struct {
	Playlist

	Items []Track `json:"items"`
}

type GetPlaylists added in v0.18.0

type GetPlaylists struct {
	Playlists []Playlist `json:"playlists"`
}

type GetSystemInfo added in v0.18.0

type GetSystemInfo struct {
	Version string `json:"version"`
}

type GetTaglistById added in v0.18.0

type GetTaglistById struct {
	Taglist
}

type GetTaglistTracks added in v0.18.0

type GetTaglistTracks struct {
	Page   types.Page `json:"page"`
	Tracks []Track    `json:"tracks"`
}

type GetTaglists added in v0.18.0

type GetTaglists struct {
	Taglists []Taglist `json:"taglists"`
}

type GetTrackById added in v0.18.0

type GetTrackById struct {
	Track
}

type GetTracks added in v0.18.0

type GetTracks struct {
	Page   types.Page `json:"page"`
	Tracks []Track    `json:"tracks"`
}

type GetUserQuickPlaylistItemIds added in v0.18.0

type GetUserQuickPlaylistItemIds struct {
	TrackIds []string `json:"trackIds"`
}

type Name added in v0.18.0

type Name struct {
	Default string  `json:"default"`
	Other   *string `json:"other"`
}

type Playlist added in v0.18.0

type Playlist struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type PostPlaylistFilterBody added in v0.18.0

type PostPlaylistFilterBody struct {
	Name   string `json:"name"`
	Filter string `json:"filter"`
}

func (*PostPlaylistFilterBody) Transform added in v0.18.0

func (b *PostPlaylistFilterBody) Transform()

func (PostPlaylistFilterBody) Validate added in v0.18.0

func (b PostPlaylistFilterBody) Validate() error

type RemovePlaylistItemBody added in v0.18.0

type RemovePlaylistItemBody struct {
	TrackId string `json:"trackId"`
}

type Signin added in v0.18.0

type Signin struct {
	Token string `json:"token"`
}

type SigninBody added in v0.18.0

type SigninBody struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (SigninBody) Validate added in v0.18.0

func (b SigninBody) Validate() error

type Signup added in v0.18.0

type Signup struct {
	Id       string `json:"id"`
	Username string `json:"username"`
}

type SignupBody added in v0.18.0

type SignupBody struct {
	Username        string `json:"username"`
	Password        string `json:"password"`
	PasswordConfirm string `json:"passwordConfirm"`
}

TODO(patrik): Test if this works with validation

func (*SignupBody) Transform added in v0.18.0

func (b *SignupBody) Transform()

TODO(patrik): Remove? and let the usernameRegex handle error

func (SignupBody) Validate added in v0.18.0

func (b SignupBody) Validate() error

type Taglist added in v0.18.0

type Taglist struct {
	Id     string `json:"id"`
	Name   string `json:"name"`
	Filter string `json:"filter"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

type Track added in v0.18.0

type Track struct {
	Id   string `json:"id"`
	Name Name   `json:"name"`

	Duration int64  `json:"duration"`
	Number   *int64 `json:"number"`
	Year     *int64 `json:"year"`

	OriginalMediaUrl string       `json:"originalMediaUrl"`
	MobileMediaUrl   string       `json:"mobileMediaUrl"`
	CoverArt         types.Images `json:"coverArt"`

	AlbumId  string `json:"albumId"`
	ArtistId string `json:"artistId"`

	AlbumName  Name `json:"albumName"`
	ArtistName Name `json:"artistName"`

	Tags             []string     `json:"tags"`
	FeaturingArtists []ArtistInfo `json:"featuringArtists"`
	AllArtists       []ArtistInfo `json:"allArtists"`

	Created int64 `json:"created"`
	Updated int64 `json:"updated"`
}

func ConvertDBTrack added in v0.15.4

func ConvertDBTrack(c pyrin.Context, track database.Track) Track

type TrackId added in v0.18.0

type TrackId struct {
	TrackId string `json:"trackId"`
}

func (*TrackId) Transform added in v0.18.0

func (b *TrackId) Transform()

type UpdateTaglistBody added in v0.18.0

type UpdateTaglistBody struct {
	Name   *string `json:"name,omitempty"`
	Filter *string `json:"filter,omitempty"`
}

func (*UpdateTaglistBody) Transform added in v0.18.0

func (b *UpdateTaglistBody) Transform()

func (UpdateTaglistBody) Validate added in v0.18.0

func (b UpdateTaglistBody) Validate() error

type UpdateUserSettingsBody added in v0.18.0

type UpdateUserSettingsBody struct {
	DisplayName   *string `json:"displayName,omitempty"`
	QuickPlaylist *string `json:"quickPlaylist,omitempty"`
}

func (*UpdateUserSettingsBody) Transform added in v0.18.0

func (b *UpdateUserSettingsBody) Transform()

func (UpdateUserSettingsBody) Validate added in v0.18.0

func (b UpdateUserSettingsBody) Validate() error

type UploadTrack added in v0.18.0

type UploadTrack struct {
	Id string `json:"id"`
}

type UploadTrackBody added in v0.18.0

type UploadTrackBody struct {
	Name      string `json:"name"`
	OtherName string `json:"otherName"`

	Number int64 `json:"number"`
	Year   int64 `json:"year"`

	AlbumId  string `json:"albumId"`
	ArtistId string `json:"artistId"`

	Tags             []string `json:"tags"`
	FeaturingArtists []string `json:"featuringArtists"`
}

func (*UploadTrackBody) Transform added in v0.18.0

func (b *UploadTrackBody) Transform()

func (UploadTrackBody) Validate added in v0.18.0

func (b UploadTrackBody) Validate() error

Jump to

Keyboard shortcuts

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