api

package
v0.0.0-...-4cc00cf Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrKeyNotFound = errors.New("key not found")

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

func New

func New(db db.BoilingDB) (*API, error)

func (*API) Run

func (a *API) Run(runner iris.Runner) error

func (*API) Stop

func (a *API) Stop() error

type Artist

type Artist struct {
	ID            int                 `json:"id"`
	Name          string              `json:"name"`
	Aliases       []ArtistAlias       `json:"aliases,omitempty"`
	ReleaseGroups []RoledReleaseGroup `json:"release_groups,omitempty"`
	Added         time.Time           `json:"added"`
	AddedBy       BaseUser            `json:"added_by"`
	Bio           *string             `json:"bio,omitempty"`
	Tags          []string            `json:"tags,omitempty"`
}

type ArtistAlias

type ArtistAlias struct {
	Alias   string    `json:"alias"`
	Added   time.Time `json:"added"`
	AddedBy BaseUser  `json:"added_by"`
}

type ArtistResponse

type ArtistResponse struct {
	Artist Artist `json:"artist"`
}

type ArtistsResponse

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

type BaseArtist

type BaseArtist struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type BaseReleaseGroup

type BaseReleaseGroup struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Type        string    `json:"type"`
	ReleaseDate time.Time `json:"release_date"`
}

type BaseUser

type BaseUser struct {
	ID       int    `json:"id"`
	Username string `json:"username"`
}

type BlogEntriesResponse

type BlogEntriesResponse struct {
	Entries []BlogEntry `json:"entries"`
}

type BlogEntry

type BlogEntry struct {
	ID       int       `json:"id"`
	Author   BaseUser  `json:"author"`
	Title    string    `json:"title"`
	PostedAt time.Time `json:"posted_at"`
	Content  string    `json:"content"`
	Tags     []string  `json:"tags,omitempty"`
}

type BlogEntryResponse

type BlogEntryResponse struct {
	Entry BlogEntry `json:"entry"`
}

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(db db.BoilingDB) (Cache, error)

func (Cache) RefreshFormats

func (c Cache) RefreshFormats(db db.BoilingDB) error

func (Cache) RefreshLeechTypes

func (c Cache) RefreshLeechTypes(db db.BoilingDB) error

func (Cache) RefreshMedia

func (c Cache) RefreshMedia(db db.BoilingDB) error

func (Cache) RefreshPrivileges

func (c Cache) RefreshPrivileges(db db.BoilingDB) error

func (Cache) RefreshReleaseGroupTypes

func (c Cache) RefreshReleaseGroupTypes(db db.BoilingDB) error

func (Cache) RefreshReleaseProperties

func (c Cache) RefreshReleaseProperties(db db.BoilingDB) error

func (Cache) RefreshReleaseRoles

func (c Cache) RefreshReleaseRoles(db db.BoilingDB) error

type FormatsResponse

type FormatsResponse struct {
	Formats []string `json:"formats"`
}

type LeechTypesResponse

type LeechTypesResponse struct {
	LeechTypes []string `json:"leech_types"`
}

type LoginResponse

type LoginResponse struct {
	User  User   `json:"user"`
	Token string `json:"token"`
}

type LookupTable

type LookupTable struct {
	// contains filtered or unexported fields
}

func BuildLookupTable

func BuildLookupTable(m map[int]string) LookupTable

func (LookupTable) Has

func (l LookupTable) Has(s string) bool

func (LookupTable) HasReverse

func (l LookupTable) HasReverse(i int) bool

func (LookupTable) Keys

func (l LookupTable) Keys() []string

func (LookupTable) LookUp

func (l LookupTable) LookUp(s string) (int, error)

func (LookupTable) ReverseLookUp

func (l LookupTable) ReverseLookUp(i int) (string, error)

type MediaResponse

type MediaResponse struct {
	Media []string `json:"media"`
}

type PrivilegesResponse

type PrivilegesResponse struct {
	Privileges []string `json:"privileges"`
}

type Release

type Release struct {
	ID              int          `json:"id"`
	ReleaseGroup    ReleaseGroup `json:"release_group"`
	Edition         *string      `json:"edition,omitempty"`
	Medium          string       `json:"medium"`
	ReleaseDate     time.Time    `json:"release_date"`
	CatalogueNumber *string      `json:"catalogue_number,omitempty"`
	//RecordLabel     RecordLabel
	//Torrents        []Torrent
	Added    time.Time `json:"added"`
	AddedBy  BaseUser  `json:"added_by"`
	Original bool      `json:"original"`
	Tags     []string  `json:"tags,omitempty"`

	// Properties lists "official" properties of releases, for example
	// "LossyMasterApproved", to be set by trusted users or staff.
	Properties map[string]string `json:"properties"`
}

type ReleaseGroup

type ReleaseGroup struct {
	ID          int           `json:"id"`
	Name        string        `json:"name"` // Album title
	Artists     []RoledArtist `json:"artists"`
	ReleaseDate time.Time     `json:"release_date"`
	Added       time.Time     `json:"added"`
	AddedBy     BaseUser      `json:"added_by"`
	Type        string        `json:"type"`               // Album/EP
	Releases    []Release     `json:"releases,omitempty"` // individual releases
	Tags        []string      `json:"tags,omitempty"`
}

type ReleaseGroupResponse

type ReleaseGroupResponse struct {
	ReleaseGroup ReleaseGroup `json:"release_group"`
}

type ReleaseGroupTypesResponse

type ReleaseGroupTypesResponse struct {
	ReleaseGroupTypes []string `json:"release_group_types"`
}

type ReleasePropertiesResponse

type ReleasePropertiesResponse struct {
	ReleaseProperties []string `json:"release_properties"`
}

type ReleaseResponse

type ReleaseResponse struct {
	Release Release `json:"release"`
}

type ReleaseRolesResponse

type ReleaseRolesResponse struct {
	ReleaseRoles []string `json:"release_roles"`
}

type Response

type Response struct {
	Status  string      `json:"status"`
	Data    interface{} `json:"data,omitempty"`
	Message string      `json:"message,omitempty"`
}

type RoledArtist

type RoledArtist struct {
	Role   string     `json:"role"`
	Artist BaseArtist `json:"artist"`
}

type RoledReleaseGroup

type RoledReleaseGroup struct {
	Role         string           `json:"role"`
	ReleaseGroup BaseReleaseGroup `json:"release_group"`
}

type SyncedLookupTable

type SyncedLookupTable struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*SyncedLookupTable) Has

func (s *SyncedLookupTable) Has(ss string) bool

func (*SyncedLookupTable) HasReverse

func (s *SyncedLookupTable) HasReverse(i int) bool

func (*SyncedLookupTable) Keys

func (s *SyncedLookupTable) Keys() []string

func (*SyncedLookupTable) LookUp

func (s *SyncedLookupTable) LookUp(ss string) (int, error)

func (*SyncedLookupTable) MustLookUp

func (s *SyncedLookupTable) MustLookUp(ss string) int

func (*SyncedLookupTable) MustReverseLookUp

func (s *SyncedLookupTable) MustReverseLookUp(i int) string

func (*SyncedLookupTable) ReverseLookUp

func (s *SyncedLookupTable) ReverseLookUp(i int) (string, error)

type TagsResponse

type TagsResponse struct {
	Tags []string `json:"tags"`
}

type User

type User struct {
	ID           int        `json:"id"`
	Username     string     `json:"username"`
	Email        string     `json:"email,omitempty"`
	PasswordHash string     `json:"password_hash,omitempty"`
	Bio          *string    `json:"bio,omitempty"`
	Enabled      bool       `json:"enabled"`
	CanLogin     bool       `json:"can_login,omitempty"`
	JoinedAt     time.Time  `json:"joined_at"`
	LastLogin    *time.Time `json:"last_login,omitempty"`
	LastAccess   *time.Time `json:"last_access,omitempty"`
	Uploaded     int64      `json:"uploaded"`
	Downloaded   int64      `json:"downloaded"`
}

type UserResponse

type UserResponse struct {
	User User `json:"user"`
}

Jump to

Keyboard shortcuts

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