restApiV1

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SongMimeTypeFlac = "audio/flac"
	SongMimeTypeOgg  = "audio/ogg"
	SongMimeTypeMp3  = "audio/mpeg"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	Id         AlbumId    `json:"id"`
	CreationTs int64      `json:"creationTs"`
	UpdateTs   int64      `json:"updateTs"`
	ArtistIds  []ArtistId `json:"artistIds"`
	AlbumMeta
}

type AlbumFilter

type AlbumFilter struct {
	FromTs  *int64
	Name    *string
	OrderBy *AlbumFilterOrderBy
}

type AlbumFilterOrderBy added in v0.4.0

type AlbumFilterOrderBy string
const AlbumFilterOrderByName AlbumFilterOrderBy = "name"

type AlbumId added in v0.2.0

type AlbumId string
var UnknownAlbumId AlbumId = "00000000000000000000000000"

Album

type AlbumMeta

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

func (*AlbumMeta) Copy added in v0.4.0

func (a *AlbumMeta) Copy() *AlbumMeta

type ApiError

type ApiError struct {
	ErrorCode        ErrorCode `json:"error"`
	ErrorDescription string    `json:"error_description,omitempty"`
}

func (*ApiError) Code

func (a *ApiError) Code() ErrorCode

func (*ApiError) Description

func (a *ApiError) Description() string

func (*ApiError) Error

func (a *ApiError) Error() string

type Artist

type Artist struct {
	Id         ArtistId `json:"id"`
	CreationTs int64    `json:"creationTs"`
	UpdateTs   int64    `json:"updateTs"`
	ArtistMeta
}

type ArtistFilter

type ArtistFilter struct {
	FromTs  *int64
	Name    *string
	SongId  *SongId
	OrderBy *ArtistFilterOrderBy
}

type ArtistFilterOrderBy added in v0.4.0

type ArtistFilterOrderBy string
const ArtistFilterOrderByName ArtistFilterOrderBy = "name"

type ArtistId added in v0.2.0

type ArtistId string
var UnknownArtistId ArtistId = "00000000000000000000000000"

type ArtistMeta

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

func (*ArtistMeta) Copy added in v0.4.0

func (a *ArtistMeta) Copy() *ArtistMeta

type ErrorCode

type ErrorCode string
const (
	NotFoundErrorCode         ErrorCode = "not_found"
	NotImplementedErrorCode   ErrorCode = "not_implemented"
	InternalErrorCode         ErrorCode = "internal_error"
	MethodNotAllowedErrorCode ErrorCode = "method_not_allowed"
	InvalidTokenErrorCode     ErrorCode = "invalid_token"

	InvalideRequestErrorCode      ErrorCode = "invalid_request"
	UnsupportedGrantTypeErrorCode ErrorCode = "unsupported_grant_type"
	InvalideGrantErrorCode        ErrorCode = "invalid_grant"

	DeleteArtistWithSongsErrorCode  ErrorCode = "delete_artist_with_songs"
	DeleteAlbumWithSongsErrorCode   ErrorCode = "delete_album_with_songs"
	DeleteUserYourselfErrorCode     ErrorCode = "delete_user_yourself"
	CreateNotOwnedPlaylistErrorCode ErrorCode = "create_not_owned_playlist"

	ForbiddenErrorCode ErrorCode = "forbidden"

	ObsoleteClientErrorCode ErrorCode = "obsolete_client"

	// Client Error
	UnknownErrorCode ErrorCode = "unknown_error"
	ClientErrorCode  ErrorCode = "client_error"
)

func (ErrorCode) StatusCode

func (e ErrorCode) StatusCode() int

func (ErrorCode) String

func (e ErrorCode) String() string

type FavoritePlaylist

type FavoritePlaylist struct {
	FavoritePlaylistMeta
	UpdateTs int64 `json:"updateTs"`
}

type FavoritePlaylistFilter

type FavoritePlaylistFilter struct {
	FromTs     *int64
	UserId     *UserId
	PlaylistId *PlaylistId
}

type FavoritePlaylistId

type FavoritePlaylistId struct {
	UserId     UserId     `json:"userId"`
	PlaylistId PlaylistId `json:"playlistId"`
}

type FavoritePlaylistMeta

type FavoritePlaylistMeta struct {
	Id FavoritePlaylistId `json:"id"`
}

type FavoriteSong added in v0.2.0

type FavoriteSong struct {
	FavoriteSongMeta
	UpdateTs int64 `json:"updateTs"`
}

type FavoriteSongFilter added in v0.2.0

type FavoriteSongFilter struct {
	FromTs *int64
}

type FavoriteSongId added in v0.2.0

type FavoriteSongId struct {
	UserId UserId `json:"userId"`
	SongId SongId `json:"songId"`
}

type FavoriteSongMeta added in v0.2.0

type FavoriteSongMeta struct {
	Id FavoriteSongId `json:"id"`
}

type FileSyncReport

type FileSyncReport struct {
	FileSyncSongs      []FileSyncSong `json:"fileSyncSongs"`
	DeletedSongIds     []SongId       `json:"deletedSongIds"`
	Playlists          []Playlist     `json:"playlists"`
	DeletedPlaylistIds []PlaylistId   `json:"deletedPlaylistIds"`
	SyncTs             int64          `json:"syncTs"`
}

type FileSyncSong

type FileSyncSong struct {
	Id       SongId `json:"id"`
	UpdateTs int64  `json:"updateTs"`
	Filepath string `json:"filepath"`
}

type Playlist

type Playlist struct {
	Id              PlaylistId `json:"id"`
	CreationTs      int64      `json:"creationTs"`
	UpdateTs        int64      `json:"updateTs"`
	ContentUpdateTs int64      `json:"contentUpdateTs"`
	PlaylistMeta
}

type PlaylistFilter

type PlaylistFilter struct {
	FromTs         *int64
	FavoriteUserId *UserId
	FavoriteFromTs *int64
	OrderBy        *PlaylistFilterOrderBy
}

type PlaylistFilterOrderBy added in v0.4.0

type PlaylistFilterOrderBy string
const PlaylistFilterOrderByName PlaylistFilterOrderBy = "name"

type PlaylistId added in v0.2.0

type PlaylistId string
const IncomingPlaylistId PlaylistId = "00000000000000000000000000"

type PlaylistMeta

type PlaylistMeta struct {
	Name         string   `json:"name"`
	SongIds      []SongId `json:"songIds"`
	OwnerUserIds []UserId `json:"ownerUserIds"`
}

func (*PlaylistMeta) Copy added in v0.4.0

func (p *PlaylistMeta) Copy() *PlaylistMeta

type Song

type Song struct {
	Id         SongId `json:"id"`
	CreationTs int64  `json:"creationTs"`
	UpdateTs   int64  `json:"updateTs"`
	SongMeta
}

type SongBitDepth

type SongBitDepth int64
const (
	SongBitDepthUnknown SongBitDepth = iota
	SongBitDepth16
	SongBitDepth24
)

func (SongBitDepth) String added in v0.3.0

func (s SongBitDepth) String() string

type SongFilter

type SongFilter struct {
	FromTs   *int64
	AlbumId  *AlbumId
	ArtistId *ArtistId
	Favorite *SongFilterFavorite
	OrderBy  *SongFilterOrderBy
}

type SongFilterFavorite added in v0.3.0

type SongFilterFavorite struct {
	UserId UserId
	FromTs int64
}

type SongFilterOrderBy added in v0.4.0

type SongFilterOrderBy string
const SongFilterOrderByName SongFilterOrderBy = "name"

type SongFormat

type SongFormat int64
const (
	SongFormatUnknown SongFormat = iota
	SongFormatFlac
	SongFormatMp3
	SongFormatOgg
)

func (SongFormat) Extension

func (s SongFormat) Extension() string

func (SongFormat) MimeType

func (s SongFormat) MimeType() string

func (SongFormat) String added in v0.3.0

func (s SongFormat) String() string

type SongId added in v0.2.0

type SongId string

type SongMeta

type SongMeta struct {
	Name            string       `json:"name"`
	Format          SongFormat   `json:"format"`
	Size            int64        `json:"size"`
	BitDepth        SongBitDepth `json:"bitDepth"`
	PublicationYear *int64       `json:"publicationYear"`
	AlbumId         AlbumId      `json:"albumId"`
	TrackNumber     *int64       `json:"trackNumber"`
	ArtistIds       []ArtistId   `json:"artistIds"`
	ExplicitFg      bool         `json:"explicitFg"`
}

func (*SongMeta) Copy added in v0.4.0

func (s *SongMeta) Copy() *SongMeta

type SongNew

type SongNew struct {
	SongMeta
	Content []byte `json:"content"`
}

type SyncReport

type SyncReport struct {
	Songs                      []Song               `json:"songs"`
	DeletedSongIds             []SongId             `json:"deletedSongIds"`
	Artists                    []Artist             `json:"artists"`
	DeletedArtistIds           []ArtistId           `json:"deletedArtistIds"`
	Albums                     []Album              `json:"albums"`
	DeletedAlbumIds            []AlbumId            `json:"deletedAlbumIds"`
	Playlists                  []Playlist           `json:"playlists"`
	DeletedPlaylistIds         []PlaylistId         `json:"deletedPlaylistIds"`
	Users                      []User               `json:"users"`
	DeletedUserIds             []UserId             `json:"deletedUserIds"`
	FavoritePlaylists          []FavoritePlaylist   `json:"favoritePlaylists"`
	DeletedFavoritePlaylistIds []FavoritePlaylistId `json:"deletedFavoritePlaylistIds"`
	FavoriteSongs              []FavoriteSong       `json:"favoriteSongs"`
	DeletedFavoriteSongIds     []FavoriteSongId     `json:"deletedFavoriteSongIds"`
	SyncTs                     int64                `json:"syncTs"`
}

type Token

type Token struct {
	// AccessToken is the token that authorizes and authenticates
	// the requests.
	AccessToken string `json:"access_token"`

	// TokenType is the type of token.
	// The Type method returns either this or "Bearer", the default.
	TokenType string `json:"token_type,omitempty"`

	UserId UserId `json:"userId"`
}

type User

type User struct {
	Id         UserId `json:"id"`
	CreationTs int64  `json:"creationTs"`
	UpdateTs   int64  `json:"updateTs"`
	Password   string
	UserMeta
}

type UserFilter

type UserFilter struct {
	FromTs  *int64
	AdminFg *bool
}

type UserId added in v0.2.0

type UserId string
var UndefinedUserId UserId = "xxx"

type UserMeta

type UserMeta struct {
	Name           string `json:"name"`
	AdminFg        bool   `json:"adminFg"`
	HideExplicitFg bool   `json:"hideExplicitFg"`
}

func (*UserMeta) Copy added in v0.4.0

func (u *UserMeta) Copy() *UserMeta

type UserMetaComplete

type UserMetaComplete struct {
	UserMeta
	Password string `json:"password"`
}

type Version added in v0.2.0

type Version struct {
	MajorNumber int64
	MinorNumber int64
	PatchNumber int64
}

func (*Version) LowerThan added in v0.2.0

func (m *Version) LowerThan(s Version) bool

func (*Version) String added in v0.2.0

func (m *Version) String() string

Jump to

Keyboard shortcuts

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