api

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DRLogErrorMessage added in v1.1.8

func DRLogErrorMessage(e []error) *returnMessage

func DetailedErrorMessage

func DetailedErrorMessage(e validator.ValidationErrors) *returnMessage

func GenericErrorMessage

func GenericErrorMessage(e error) *returnMessage

func InformationMessage

func InformationMessage(message ...string) *returnMessage

Types

type Album

type Album struct {
	ID            string `json:"id,omitempty"`
	Barcode       string `json:"barcode" binding:"required,min=11,max=13,numeric"`
	Artist        string `json:"artist" binding:"required,min=1,max=90"`
	Album         string `json:"album" binding:"required,min=1,max=128"`
	Label         string `json:"label,omitempty" binding:"omitempty,min=1,max=64"`
	Country       string `json:"country,omitempty" binding:"omitempty,len=2"`
	Source        string `json:"source" binding:"required,oneof=CDROM SHMCD SACD DVDA BLURAY DOWNLOAD"`
	CatalogNumber string `json:"catalogNumber" binding:"omitempty,min=1,max=128"`
	Comment       string `json:"comment,omitempty" binding:"omitempty,min=1,max=1024"`

	DRLog string `json:"drLog,omitempty" binding:"required"`
	Art   string `json:"art,omitempty" binding:"required,encodedimage"`

	LabelCode    string `json:"labelCode" binding:"omitempty,min=4,max=5"`
	ReleaseYear  int    `json:"releaseYear" binding:"required,numeric,min=1000,max=3000"`
	AverageDR    int8   `json:"averageDR"`
	MinimumDR    int8   `json:"minimumDR"`
	MaximumDR    int8   `json:"maximumDR"`
	InCollection bool   `json:"in_collection,omitempty"`

	Tracks []*Track `json:"tracks,omitempty"`
}

Album Describes an album.

func (*Album) SourceFriendly

func (a *Album) SourceFriendly() string

type AlbumList

type AlbumList struct {
	TotalAlbums int         `json:"total_albums"`
	PageCount   int         `json:"page_count,omitempty"`
	ExportMeta  *ExportMeta `json:"export_meta,omitempty"`

	Albums []*Album `json:"albums"`
}

AlbumList Describes a list of albums, together with pagination information.

type Art

type Art struct {
	Front string
}

Art Contains the base64 encoded art image.

type Empty

type Empty struct {
}

Empty An empty struct, needed for doing POST calls where no body is needed. Again, this is a workaround for the current HTTP client.

type ExportMeta

type ExportMeta struct {
	ExportDate int64  `json:"export_date"`
	Version    string `json:"version"`
	Username   string `json:"username"`
}

ExportMeta Contains information about the exported albums.

type Response

type Response struct {
	Headers     *http.Header    `json:"-"` // This field should not appear
	Information []string        `json:"information,omitempty"`
	Errors      []*errorMessage `json:"errors,omitempty"`
}

Response API responses fit in this struct.

func (*Response) IsNotValid

func (r *Response) IsNotValid() bool

IsNotValid Checks whether the response is valid. Workaround, because the current HTTP client doesn't handle errors very well.

func (*Response) XLogIDHeader added in v1.2.6

func (r *Response) XLogIDHeader() string

type Track

type Track struct {
	ID           string  `json:"id,omitempty"`
	Name         string  `json:"name" binding:"required,min=1,max=128"`
	Peak         float32 `json:"peakDB" binding:"required,numeric,min=-100,max=0"`
	Average      float32 `json:"averageDB" binding:"required,numeric,min=-100,max=0"`
	Position     int8    `json:"position" binding:"required,numeric,min=1,max=99"`
	DynamicRange int8    `json:"dr" binding:"required,numeric,min=1,max=32"`
}

Track Describes one track. A track is a part of an album.

type User

type User struct {
	ID       string `json:"id,omitempty"`
	Name     string `json:"name" binding:"required,min=1,max=64"`
	IsPublic bool   `json:"is_public" binding:"omitempty,boolean"`
}

User Contains information about a user in our system. Please note that the ID is the 'secret key'.

Jump to

Keyboard shortcuts

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