mirror of
https://github.com/navidrome/navidrome.git
synced 2026-08-31 07:30:32 +00:00
Add Album and relationships
This commit is contained in:
parent
d4c458d193
commit
20a1e3160b
194
api/spec.yml
194
api/spec.yml
@ -172,6 +172,75 @@ paths:
|
||||
$ref: '#/components/responses/NotFound'
|
||||
'500':
|
||||
$ref: '#/components/responses/InternalServerError'
|
||||
/albums:
|
||||
get:
|
||||
summary: Retrieve a list of albums
|
||||
operationId: getAlbums
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/pageLimit'
|
||||
- $ref: '#/components/parameters/pageOffset'
|
||||
- $ref: '#/components/parameters/filterEquals'
|
||||
- $ref: '#/components/parameters/filterContains'
|
||||
- $ref: '#/components/parameters/filterLessThan'
|
||||
- $ref: '#/components/parameters/filterLessOrEqual'
|
||||
- $ref: '#/components/parameters/filterGreaterThan'
|
||||
- $ref: '#/components/parameters/filterGreaterOrEqual'
|
||||
- $ref: '#/components/parameters/filterStartsWith'
|
||||
- $ref: '#/components/parameters/filterEndsWith'
|
||||
- $ref: '#/components/parameters/sort'
|
||||
- $ref: '#/components/parameters/include'
|
||||
responses:
|
||||
'200':
|
||||
description: A list of albums
|
||||
content:
|
||||
application/vnd.api+json:
|
||||
schema:
|
||||
type: object
|
||||
required: [data, links]
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Album'
|
||||
links:
|
||||
$ref: '#/components/schemas/PaginationLinks'
|
||||
meta:
|
||||
$ref: '#/components/schemas/PaginationMeta'
|
||||
'400':
|
||||
$ref: '#/components/responses/BadRequest'
|
||||
'403':
|
||||
$ref: '#/components/responses/NotAuthorized'
|
||||
'500':
|
||||
$ref: '#/components/responses/InternalServerError'
|
||||
/albums/{albumId}:
|
||||
get:
|
||||
summary: Retrieve an individual album
|
||||
operationId: getAlbum
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/include'
|
||||
- name: albumId
|
||||
in: path
|
||||
description: The unique identifier of the album
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
'200':
|
||||
description: An album object
|
||||
content:
|
||||
application/vnd.api+json:
|
||||
schema:
|
||||
type: object
|
||||
required: [data]
|
||||
properties:
|
||||
data:
|
||||
$ref: '#/components/schemas/Album'
|
||||
'403':
|
||||
$ref: '#/components/responses/NotAuthorized'
|
||||
'404':
|
||||
$ref: '#/components/responses/NotFound'
|
||||
'500':
|
||||
$ref: '#/components/responses/InternalServerError'
|
||||
|
||||
components:
|
||||
parameters:
|
||||
@ -323,14 +392,21 @@ components:
|
||||
type: string
|
||||
description: The unique identifier for the resource
|
||||
type:
|
||||
type: string
|
||||
description: The type of the resource
|
||||
$ref: '#/components/schemas/ResourceType'
|
||||
ResourceType:
|
||||
type: string
|
||||
description: The type of the resource
|
||||
enum:
|
||||
- album
|
||||
- artist
|
||||
- track
|
||||
ResourceList:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
oneOf:
|
||||
- $ref: '#/components/schemas/Track'
|
||||
- $ref: '#/components/schemas/Album'
|
||||
- $ref: '#/components/schemas/Artist'
|
||||
- type: array
|
||||
items:
|
||||
@ -351,6 +427,7 @@ components:
|
||||
propertyName: type
|
||||
mapping:
|
||||
track: '#/components/schemas/Track'
|
||||
album: '#/components/schemas/Album'
|
||||
artist: '#/components/schemas/Artist'
|
||||
Track:
|
||||
allOf:
|
||||
@ -360,14 +437,7 @@ components:
|
||||
attributes:
|
||||
$ref: '#/components/schemas/TrackAttributes'
|
||||
relationships:
|
||||
type: object
|
||||
properties:
|
||||
artists:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/TrackArtistRelationship'
|
||||
required:
|
||||
- artist
|
||||
$ref: '#/components/schemas/TrackRelationships'
|
||||
TrackAttributes:
|
||||
type: object
|
||||
properties:
|
||||
@ -392,16 +462,24 @@ components:
|
||||
- artist
|
||||
- album
|
||||
- duration
|
||||
TrackRelationships:
|
||||
type: object
|
||||
properties:
|
||||
artists:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/TrackArtistRelationship'
|
||||
albums:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/AlbumTrackRelationship'
|
||||
required:
|
||||
- artists
|
||||
TrackArtistRelationship:
|
||||
type: object
|
||||
properties:
|
||||
meta:
|
||||
type: object
|
||||
properties:
|
||||
role:
|
||||
$ref: '#/components/schemas/ArtistRole'
|
||||
required:
|
||||
- role
|
||||
$ref: #/components/schemas/ArtistMetaObject
|
||||
data:
|
||||
$ref: '#/components/schemas/ResourceObject'
|
||||
required:
|
||||
@ -410,6 +488,7 @@ components:
|
||||
ArtistRole:
|
||||
type: string
|
||||
enum:
|
||||
- artist
|
||||
- albumArtist
|
||||
- composer
|
||||
- vocalist
|
||||
@ -433,8 +512,15 @@ components:
|
||||
$ref: '#/components/schemas/ArtistTrackRelationship'
|
||||
required:
|
||||
- data
|
||||
required:
|
||||
- tracks
|
||||
albums:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/ArtistAlbumRelationship'
|
||||
required:
|
||||
- data
|
||||
ArtistAttributes:
|
||||
type: object
|
||||
properties:
|
||||
@ -444,6 +530,16 @@ components:
|
||||
bio:
|
||||
type: string
|
||||
description: A short biography of the artist
|
||||
ArtistAlbumRelationship:
|
||||
type: object
|
||||
properties:
|
||||
meta:
|
||||
$ref: '#/components/schemas/ArtistMetaObject'
|
||||
data:
|
||||
$ref: '#/components/schemas/ResourceObject'
|
||||
required:
|
||||
- meta
|
||||
- data
|
||||
ArtistTrackRelationship:
|
||||
type: object
|
||||
properties:
|
||||
@ -459,6 +555,68 @@ components:
|
||||
required:
|
||||
- meta
|
||||
- data
|
||||
ArtistMetaObject:
|
||||
type: object
|
||||
properties:
|
||||
role:
|
||||
$ref: '#/components/schemas/ArtistRole'
|
||||
required:
|
||||
- role
|
||||
Album:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/ResourceObject'
|
||||
- type: object
|
||||
properties:
|
||||
attributes:
|
||||
$ref: '#/components/schemas/AlbumAttributes'
|
||||
relationships:
|
||||
type: object
|
||||
properties:
|
||||
artists:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/AlbumArtistRelationship'
|
||||
tracks:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/AlbumTrackRelationship'
|
||||
required:
|
||||
- artists
|
||||
- tracks
|
||||
AlbumAttributes:
|
||||
type: object
|
||||
properties:
|
||||
title:
|
||||
type: string
|
||||
description: The title of the album
|
||||
releaseDate:
|
||||
type: string
|
||||
format: date
|
||||
description: The release date of the album
|
||||
genre:
|
||||
type: string
|
||||
description: The genre of the album
|
||||
required:
|
||||
- title
|
||||
- releaseDate
|
||||
- genre
|
||||
AlbumArtistRelationship:
|
||||
type: object
|
||||
properties:
|
||||
meta:
|
||||
$ref: #/components/schemas/ArtistMetaObject
|
||||
data:
|
||||
$ref: '#/components/schemas/ResourceObject'
|
||||
required:
|
||||
- meta
|
||||
- data
|
||||
AlbumTrackRelationship:
|
||||
type: object
|
||||
properties:
|
||||
data:
|
||||
$ref: '#/components/schemas/ResourceObject'
|
||||
required:
|
||||
- data
|
||||
PaginationLinks:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@ -47,6 +47,16 @@ type Router struct {
|
||||
ds model.DataStore
|
||||
}
|
||||
|
||||
func (a *Router) GetAlbums(ctx context.Context, request GetAlbumsRequestObject) (GetAlbumsResponseObject, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (a *Router) GetAlbum(ctx context.Context, request GetAlbumRequestObject) (GetAlbumResponseObject, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (a *Router) GetArtists(ctx context.Context, request GetArtistsRequestObject) (GetArtistsResponseObject, error) {
|
||||
//TODO implement me
|
||||
panic("implement me")
|
||||
|
||||
@ -28,7 +28,7 @@ func storeRequestInContext(next http.Handler) http.Handler {
|
||||
|
||||
func toAPITrack(mf model.MediaFile) Track {
|
||||
return Track{
|
||||
Type: "track",
|
||||
Type: ResourceTypeTrack,
|
||||
Id: mf.ID,
|
||||
Attributes: &TrackAttributes{
|
||||
Album: mf.Album,
|
||||
@ -49,6 +49,40 @@ func toAPITrack(mf model.MediaFile) Track {
|
||||
//TrackMbid: p(mf.MbzReleaseTrackID),
|
||||
//Year: p(mf.Year),
|
||||
},
|
||||
Relationships: &TrackRelationships{
|
||||
Albums: &[]AlbumTrackRelationship{toAlbumRelationship(mf)},
|
||||
Artists: trackArtistRelationships(mf),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func trackArtistRelationships(mf model.MediaFile) []TrackArtistRelationship {
|
||||
var r []TrackArtistRelationship
|
||||
if mf.AlbumArtistID != "" {
|
||||
r = append(r, toArtistRelationship(mf.AlbumArtistID, ArtistRoleAlbumArtist))
|
||||
}
|
||||
if mf.ArtistID != "" {
|
||||
r = append(r, toArtistRelationship(mf.ArtistID, ArtistRoleArtist))
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func toArtistRelationship(id string, artist ArtistRole) TrackArtistRelationship {
|
||||
return TrackArtistRelationship{
|
||||
Data: ResourceObject{
|
||||
Type: ResourceTypeArtist,
|
||||
Id: id,
|
||||
},
|
||||
Meta: struct{ Role ArtistRole }{Role: artist},
|
||||
}
|
||||
}
|
||||
|
||||
func toAlbumRelationship(mf model.MediaFile) AlbumTrackRelationship {
|
||||
return AlbumTrackRelationship{
|
||||
Data: ResourceObject{
|
||||
Type: ResourceTypeAlbum,
|
||||
Id: mf.AlbumID,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -22,6 +22,12 @@ import (
|
||||
|
||||
// ServerInterface represents all server handlers.
|
||||
type ServerInterface interface {
|
||||
// Retrieve a list of albums
|
||||
// (GET /albums)
|
||||
GetAlbums(w http.ResponseWriter, r *http.Request, params GetAlbumsParams)
|
||||
// Retrieve an individual album
|
||||
// (GET /albums/{albumId})
|
||||
GetAlbum(w http.ResponseWriter, r *http.Request, albumId string, params GetAlbumParams)
|
||||
// Retrieve a list of artists
|
||||
// (GET /artists)
|
||||
GetArtists(w http.ResponseWriter, r *http.Request, params GetArtistsParams)
|
||||
@ -48,6 +54,159 @@ type ServerInterfaceWrapper struct {
|
||||
|
||||
type MiddlewareFunc func(http.Handler) http.Handler
|
||||
|
||||
// GetAlbums operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetAlbums(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
// Parameter object where we will unmarshal all parameters from the context
|
||||
var params GetAlbumsParams
|
||||
|
||||
// ------------- Optional query parameter "page[limit]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "page[limit]", r.URL.Query(), ¶ms.PageLimit)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "page[limit]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "page[offset]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "page[offset]", r.URL.Query(), ¶ms.PageOffset)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "page[offset]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[equals]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[equals]", r.URL.Query(), ¶ms.FilterEquals)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[equals]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[contains]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[contains]", r.URL.Query(), ¶ms.FilterContains)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[contains]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[lessThan]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[lessThan]", r.URL.Query(), ¶ms.FilterLessThan)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[lessThan]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[lessOrEqual]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[lessOrEqual]", r.URL.Query(), ¶ms.FilterLessOrEqual)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[lessOrEqual]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[greaterThan]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[greaterThan]", r.URL.Query(), ¶ms.FilterGreaterThan)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[greaterThan]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[greaterOrEqual]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[greaterOrEqual]", r.URL.Query(), ¶ms.FilterGreaterOrEqual)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[greaterOrEqual]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[startsWith]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[startsWith]", r.URL.Query(), ¶ms.FilterStartsWith)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[startsWith]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "filter[endsWith]" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "filter[endsWith]", r.URL.Query(), ¶ms.FilterEndsWith)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "filter[endsWith]", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "sort" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "sort", r.URL.Query(), ¶ms.Sort)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "sort", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Optional query parameter "include" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "include", r.URL.Query(), ¶ms.Include)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "include", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
var handler http.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
siw.Handler.GetAlbums(w, r, params)
|
||||
})
|
||||
|
||||
for _, middleware := range siw.HandlerMiddlewares {
|
||||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetAlbum operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetAlbum(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
var err error
|
||||
|
||||
// ------------- Path parameter "albumId" -------------
|
||||
var albumId string
|
||||
|
||||
err = runtime.BindStyledParameterWithLocation("simple", false, "albumId", runtime.ParamLocationPath, chi.URLParam(r, "albumId"), &albumId)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "albumId", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
// Parameter object where we will unmarshal all parameters from the context
|
||||
var params GetAlbumParams
|
||||
|
||||
// ------------- Optional query parameter "include" -------------
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, false, "include", r.URL.Query(), ¶ms.Include)
|
||||
if err != nil {
|
||||
siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "include", Err: err})
|
||||
return
|
||||
}
|
||||
|
||||
var handler http.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
siw.Handler.GetAlbum(w, r, albumId, params)
|
||||
})
|
||||
|
||||
for _, middleware := range siw.HandlerMiddlewares {
|
||||
handler = middleware(handler)
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r.WithContext(ctx))
|
||||
}
|
||||
|
||||
// GetArtists operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetArtists(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
@ -482,6 +641,12 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl
|
||||
ErrorHandlerFunc: options.ErrorHandlerFunc,
|
||||
}
|
||||
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Get(options.BaseURL+"/albums", wrapper.GetAlbums)
|
||||
})
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Get(options.BaseURL+"/albums/{albumId}", wrapper.GetAlbum)
|
||||
})
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Get(options.BaseURL+"/artists", wrapper.GetArtists)
|
||||
})
|
||||
@ -509,6 +674,105 @@ type NotAuthorizedJSONResponse ErrorList
|
||||
|
||||
type NotFoundJSONResponse ErrorList
|
||||
|
||||
type GetAlbumsRequestObject struct {
|
||||
Params GetAlbumsParams
|
||||
}
|
||||
|
||||
type GetAlbumsResponseObject interface {
|
||||
VisitGetAlbumsResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type GetAlbums200JSONResponse struct {
|
||||
Data []Album `json:"data"`
|
||||
Links PaginationLinks `json:"links"`
|
||||
Meta *PaginationMeta `json:"meta,omitempty"`
|
||||
}
|
||||
|
||||
func (response GetAlbums200JSONResponse) VisitGetAlbumsResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(200)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetAlbums400JSONResponse struct{ BadRequestJSONResponse }
|
||||
|
||||
func (response GetAlbums400JSONResponse) VisitGetAlbumsResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(400)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetAlbums403JSONResponse struct{ NotAuthorizedJSONResponse }
|
||||
|
||||
func (response GetAlbums403JSONResponse) VisitGetAlbumsResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetAlbums500JSONResponse struct {
|
||||
InternalServerErrorJSONResponse
|
||||
}
|
||||
|
||||
func (response GetAlbums500JSONResponse) VisitGetAlbumsResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(500)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetAlbumRequestObject struct {
|
||||
AlbumId string `json:"albumId"`
|
||||
Params GetAlbumParams
|
||||
}
|
||||
|
||||
type GetAlbumResponseObject interface {
|
||||
VisitGetAlbumResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type GetAlbum200JSONResponse struct {
|
||||
Data Album `json:"data"`
|
||||
}
|
||||
|
||||
func (response GetAlbum200JSONResponse) VisitGetAlbumResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(200)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetAlbum403JSONResponse struct{ NotAuthorizedJSONResponse }
|
||||
|
||||
func (response GetAlbum403JSONResponse) VisitGetAlbumResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(403)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetAlbum404JSONResponse struct{ NotFoundJSONResponse }
|
||||
|
||||
func (response GetAlbum404JSONResponse) VisitGetAlbumResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(404)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetAlbum500JSONResponse struct {
|
||||
InternalServerErrorJSONResponse
|
||||
}
|
||||
|
||||
func (response GetAlbum500JSONResponse) VisitGetAlbumResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/vnd.api+json")
|
||||
w.WriteHeader(500)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetArtistsRequestObject struct {
|
||||
Params GetArtistsParams
|
||||
}
|
||||
@ -747,6 +1011,12 @@ func (response GetTrack500JSONResponse) VisitGetTrackResponse(w http.ResponseWri
|
||||
|
||||
// StrictServerInterface represents all server handlers.
|
||||
type StrictServerInterface interface {
|
||||
// Retrieve a list of albums
|
||||
// (GET /albums)
|
||||
GetAlbums(ctx context.Context, request GetAlbumsRequestObject) (GetAlbumsResponseObject, error)
|
||||
// Retrieve an individual album
|
||||
// (GET /albums/{albumId})
|
||||
GetAlbum(ctx context.Context, request GetAlbumRequestObject) (GetAlbumResponseObject, error)
|
||||
// Retrieve a list of artists
|
||||
// (GET /artists)
|
||||
GetArtists(ctx context.Context, request GetArtistsRequestObject) (GetArtistsResponseObject, error)
|
||||
@ -794,6 +1064,59 @@ type strictHandler struct {
|
||||
options StrictHTTPServerOptions
|
||||
}
|
||||
|
||||
// GetAlbums operation middleware
|
||||
func (sh *strictHandler) GetAlbums(w http.ResponseWriter, r *http.Request, params GetAlbumsParams) {
|
||||
var request GetAlbumsRequestObject
|
||||
|
||||
request.Params = params
|
||||
|
||||
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.GetAlbums(ctx, request.(GetAlbumsRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "GetAlbums")
|
||||
}
|
||||
|
||||
response, err := handler(r.Context(), w, r, request)
|
||||
|
||||
if err != nil {
|
||||
sh.options.ResponseErrorHandlerFunc(w, r, err)
|
||||
} else if validResponse, ok := response.(GetAlbumsResponseObject); ok {
|
||||
if err := validResponse.VisitGetAlbumsResponse(w); err != nil {
|
||||
sh.options.ResponseErrorHandlerFunc(w, r, err)
|
||||
}
|
||||
} else if response != nil {
|
||||
sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("Unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
||||
// GetAlbum operation middleware
|
||||
func (sh *strictHandler) GetAlbum(w http.ResponseWriter, r *http.Request, albumId string, params GetAlbumParams) {
|
||||
var request GetAlbumRequestObject
|
||||
|
||||
request.AlbumId = albumId
|
||||
request.Params = params
|
||||
|
||||
handler := func(ctx context.Context, w http.ResponseWriter, r *http.Request, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.GetAlbum(ctx, request.(GetAlbumRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "GetAlbum")
|
||||
}
|
||||
|
||||
response, err := handler(r.Context(), w, r, request)
|
||||
|
||||
if err != nil {
|
||||
sh.options.ResponseErrorHandlerFunc(w, r, err)
|
||||
} else if validResponse, ok := response.(GetAlbumResponseObject); ok {
|
||||
if err := validResponse.VisitGetAlbumResponse(w); err != nil {
|
||||
sh.options.ResponseErrorHandlerFunc(w, r, err)
|
||||
}
|
||||
} else if response != nil {
|
||||
sh.options.ResponseErrorHandlerFunc(w, r, fmt.Errorf("Unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
||||
// GetArtists operation middleware
|
||||
func (sh *strictHandler) GetArtists(w http.ResponseWriter, r *http.Request, params GetArtistsParams) {
|
||||
var request GetArtistsRequestObject
|
||||
@ -927,44 +1250,48 @@ func (sh *strictHandler) GetTrack(w http.ResponseWriter, r *http.Request, trackI
|
||||
// Base64 encoded, gzipped, json marshaled Swagger object
|
||||
var swaggerSpec = []string{
|
||||
|
||||
"H4sIAAAAAAAC/+xZX4/buBH/KgRbIA+n2m6S9sFAH/YOd8EWaRJsts1DsgXG0tjiHUVqScq77sJAv0a/",
|
||||
"Xj9JwSEly5a0lp1uggvuJVmLnP/DmR+HDzzVRakVKmf5/IGXYKBAh4Z+LYV0aH7QyoFQ9CVDmxpROqEV",
|
||||
"n/OfaJ0tNgzUhpVGl2jchqWBQKgVc3jvJuzvFlY4Z4Hdx7hsb/5SU8zXICvkCRee622FZsMTrqBAPueH",
|
||||
"VDzhNs2xAK+PcFhExZ1D48n/+enT3Xdz/w9PuNuUnod1RqgV3zYfwBjY8O02iex/VJn9IFw+2kaXg2Oo",
|
||||
"MsvuhMt77cTI8zQ7G6qnsfO2Ajk+kmQbKIb3kDpWgEvzjpXE8UQbA82TWPjKIDg0b4OpxyxVVYFGpDuL",
|
||||
"V4Hcx1cxbRipypxmwMiwQ/NXe+JOc8MB7Vh3ZGe44zoH9Xm+eNx+z/8s44nwSSx/jdaemwUSrR2dAnIn",
|
||||
"6DQXtAmfzAVnRX5n/yM2nx7zhupJrH3vwLgzqrgluuE6bhu+p1nbovs/VzqhUlll2DXzCiU4zJhBqyuT",
|
||||
"ovVpG3czoZjL0a+VWllMmEXf7v3+hW/aRQF2wKJaYNuMAzW3CS9hha9FIVxXsescfZYt0DC9ZOQBVqJh",
|
||||
"nmRApl/6KD27ffdluIRKOj7/4yzhS20KcKShe/GcJ7wQShRVweezxm9COVyhaVR8u1xaHNBR0xpbalJN",
|
||||
"KKC1RxQMBAManqGg1aZHtffauDp4lXTWB0wr9NWp0AbrhBZoe6M6Ye8MLsU9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4cwzXQ5aI2q+YBmp1u2Taji19pR6xOA4QR6ze+uhm9Prmg6vRFM2g",
|
||||
"/ySK+uuI0UTdj0lOJTpZWGecP97S9WdcIyhokjliXT373lzvTDafnJ3da0z2MbevVBV7ipGsbxUOUe9e",
|
||||
"Qoy8+Nw55/fe7NYI+ovU0FEnhvQm4c+CLftgNDafdkbJRPL0OMn2cHWT8D+NEdQ3LKbJZFUUYNb0oUUs",
|
||||
"ErCnzCapc9X0jv6/yDZHs9bJSavxymTcgX9nQkSjfZ9b28l+xMq7uxvOscPD/ocNiRGRMHLKsO+DKp4D",
|
||||
"2mbyfv707OzZKKo43n4AB1RMqEysRFaBjPsbfLDtTwddr7kn+FYxv1XMx1kxw4Hy8ZTMGLKPpGbW2nQS",
|
||||
"1vQu/HGsbNY3BZ+nbtbS+gpnhPu1VM4YER9TOsNl12Orna1hpu1l+JD/dUYKX2wrOxjuvZ1XnU+C//vv",
|
||||
"/1jmKdlvuGYFlOG43wxf4o6zTNDxHsyaGSwNWh8uarl1V/+ls81zdBHLd5YtpZ6DpBudsL/ttzBD+3sV",
|
||||
"Vnxrjb61Ro+0NQpTrUfTGcWQ/gobI5+qYE+PNk1N7+j/Iw3RVRy0fJZ+qJ7q9LRDEetX0g3FILh3M1R/",
|
||||
"aPa4WiEXrdIM7YMvhTHSFEoxXT3hm+vN/wIAAP//yCBJpT88AAA=",
|
||||
}
|
||||
|
||||
// GetSwagger returns the content of the embedded swagger specification file
|
||||
|
||||
@ -3,11 +3,23 @@
|
||||
// Code generated by github.com/deepmap/oapi-codegen version v1.12.5-0.20230314231417-0cfaaa77a7d2 DO NOT EDIT.
|
||||
package api
|
||||
|
||||
import (
|
||||
openapi_types "github.com/deepmap/oapi-codegen/pkg/types"
|
||||
)
|
||||
|
||||
// Defines values for ArtistRole.
|
||||
const (
|
||||
AlbumArtist ArtistRole = "albumArtist"
|
||||
Composer ArtistRole = "composer"
|
||||
Vocalist ArtistRole = "vocalist"
|
||||
ArtistRoleAlbumArtist ArtistRole = "albumArtist"
|
||||
ArtistRoleArtist ArtistRole = "artist"
|
||||
ArtistRoleComposer ArtistRole = "composer"
|
||||
ArtistRoleVocalist ArtistRole = "vocalist"
|
||||
)
|
||||
|
||||
// Defines values for ResourceType.
|
||||
const (
|
||||
ResourceTypeAlbum ResourceType = "album"
|
||||
ResourceTypeArtist ResourceType = "artist"
|
||||
ResourceTypeTrack ResourceType = "track"
|
||||
)
|
||||
|
||||
// Defines values for ServerInfoFeatures.
|
||||
@ -17,6 +29,44 @@ const (
|
||||
Images ServerInfoFeatures = "images"
|
||||
)
|
||||
|
||||
// Album defines model for Album.
|
||||
type Album struct {
|
||||
Attributes *AlbumAttributes `json:"attributes,omitempty"`
|
||||
|
||||
// Id The unique identifier for the resource
|
||||
Id string `json:"id"`
|
||||
Relationships *struct {
|
||||
Artists []AlbumArtistRelationship `json:"artists"`
|
||||
Tracks []AlbumTrackRelationship `json:"tracks"`
|
||||
} `json:"relationships,omitempty"`
|
||||
|
||||
// Type The type of the resource
|
||||
Type ResourceType `json:"type"`
|
||||
}
|
||||
|
||||
// AlbumArtistRelationship defines model for AlbumArtistRelationship.
|
||||
type AlbumArtistRelationship struct {
|
||||
Data ResourceObject `json:"data"`
|
||||
Meta interface{} `json:"meta"`
|
||||
}
|
||||
|
||||
// AlbumAttributes defines model for AlbumAttributes.
|
||||
type AlbumAttributes struct {
|
||||
// Genre The genre of the album
|
||||
Genre string `json:"genre"`
|
||||
|
||||
// ReleaseDate The release date of the album
|
||||
ReleaseDate openapi_types.Date `json:"releaseDate"`
|
||||
|
||||
// Title The title of the album
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
// AlbumTrackRelationship defines model for AlbumTrackRelationship.
|
||||
type AlbumTrackRelationship struct {
|
||||
Data ResourceObject `json:"data"`
|
||||
}
|
||||
|
||||
// Artist defines model for Artist.
|
||||
type Artist struct {
|
||||
Attributes *ArtistAttributes `json:"attributes,omitempty"`
|
||||
@ -24,13 +74,22 @@ type Artist struct {
|
||||
// Id The unique identifier for the resource
|
||||
Id string `json:"id"`
|
||||
Relationships *struct {
|
||||
Tracks struct {
|
||||
Albums *struct {
|
||||
Data []ArtistAlbumRelationship `json:"data"`
|
||||
} `json:"albums,omitempty"`
|
||||
Tracks *struct {
|
||||
Data []ArtistTrackRelationship `json:"data"`
|
||||
} `json:"tracks"`
|
||||
} `json:"tracks,omitempty"`
|
||||
} `json:"relationships,omitempty"`
|
||||
|
||||
// Type The type of the resource
|
||||
Type string `json:"type"`
|
||||
Type ResourceType `json:"type"`
|
||||
}
|
||||
|
||||
// ArtistAlbumRelationship defines model for ArtistAlbumRelationship.
|
||||
type ArtistAlbumRelationship struct {
|
||||
Data ResourceObject `json:"data"`
|
||||
Meta ArtistMetaObject `json:"meta"`
|
||||
}
|
||||
|
||||
// ArtistAttributes defines model for ArtistAttributes.
|
||||
@ -42,6 +101,12 @@ type ArtistAttributes struct {
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// ArtistMetaObject defines model for ArtistMetaObject.
|
||||
type ArtistMetaObject struct {
|
||||
// Role The role of an artist in a track or album
|
||||
Role ArtistRole `json:"role"`
|
||||
}
|
||||
|
||||
// ArtistRole The role of an artist in a track or album
|
||||
type ArtistRole string
|
||||
|
||||
@ -93,9 +158,12 @@ type ResourceObject struct {
|
||||
Id string `json:"id"`
|
||||
|
||||
// Type The type of the resource
|
||||
Type string `json:"type"`
|
||||
Type ResourceType `json:"type"`
|
||||
}
|
||||
|
||||
// ResourceType The type of the resource
|
||||
type ResourceType string
|
||||
|
||||
// ServerInfo defines model for ServerInfo.
|
||||
type ServerInfo struct {
|
||||
// AuthRequired Whether the user has access to the server.
|
||||
@ -119,22 +187,17 @@ type Track struct {
|
||||
Attributes *TrackAttributes `json:"attributes,omitempty"`
|
||||
|
||||
// Id The unique identifier for the resource
|
||||
Id string `json:"id"`
|
||||
Relationships *struct {
|
||||
Artists *[]TrackArtistRelationship `json:"artists,omitempty"`
|
||||
} `json:"relationships,omitempty"`
|
||||
Id string `json:"id"`
|
||||
Relationships *TrackRelationships `json:"relationships,omitempty"`
|
||||
|
||||
// Type The type of the resource
|
||||
Type string `json:"type"`
|
||||
Type ResourceType `json:"type"`
|
||||
}
|
||||
|
||||
// TrackArtistRelationship defines model for TrackArtistRelationship.
|
||||
type TrackArtistRelationship struct {
|
||||
Data ResourceObject `json:"data"`
|
||||
Meta struct {
|
||||
// Role The role of an artist in a track or album
|
||||
Role ArtistRole `json:"role"`
|
||||
} `json:"meta"`
|
||||
Meta interface{} `json:"meta"`
|
||||
}
|
||||
|
||||
// TrackAttributes defines model for TrackAttributes.
|
||||
@ -155,6 +218,12 @@ type TrackAttributes struct {
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
// TrackRelationships defines model for TrackRelationships.
|
||||
type TrackRelationships struct {
|
||||
Albums *[]AlbumTrackRelationship `json:"albums,omitempty"`
|
||||
Artists []TrackArtistRelationship `json:"artists"`
|
||||
}
|
||||
|
||||
// FilterContains defines model for filterContains.
|
||||
type FilterContains = []string
|
||||
|
||||
@ -191,6 +260,51 @@ type PageOffset = int32
|
||||
// Sort defines model for sort.
|
||||
type Sort = string
|
||||
|
||||
// GetAlbumsParams defines parameters for GetAlbums.
|
||||
type GetAlbumsParams struct {
|
||||
// PageLimit The number of items per page
|
||||
PageLimit *PageLimit `form:"page[limit],omitempty" json:"page[limit],omitempty"`
|
||||
|
||||
// PageOffset The offset for pagination
|
||||
PageOffset *PageOffset `form:"page[offset],omitempty" json:"page[offset],omitempty"`
|
||||
|
||||
// FilterEquals Filter by any property with an exact match. Usage: filter[equals]=property:value
|
||||
FilterEquals *FilterEquals `form:"filter[equals],omitempty" json:"filter[equals],omitempty"`
|
||||
|
||||
// FilterContains Filter by any property containing text. Usage: filter[contains]=property:value
|
||||
FilterContains *FilterContains `form:"filter[contains],omitempty" json:"filter[contains],omitempty"`
|
||||
|
||||
// FilterLessThan Filter by any numeric property less than a value. Usage: filter[lessThan]=property:value
|
||||
FilterLessThan *FilterLessThan `form:"filter[lessThan],omitempty" json:"filter[lessThan],omitempty"`
|
||||
|
||||
// FilterLessOrEqual Filter by any numeric property less than or equal to a value. Usage: filter[lessOrEqual]=property:value
|
||||
FilterLessOrEqual *FilterLessOrEqual `form:"filter[lessOrEqual],omitempty" json:"filter[lessOrEqual],omitempty"`
|
||||
|
||||
// FilterGreaterThan Filter by any numeric property greater than a value. Usage: filter[greaterThan]=property:value
|
||||
FilterGreaterThan *FilterGreaterThan `form:"filter[greaterThan],omitempty" json:"filter[greaterThan],omitempty"`
|
||||
|
||||
// FilterGreaterOrEqual Filter by any numeric property greater than or equal to a value. Usage: filter[greaterOrEqual]=property:value
|
||||
FilterGreaterOrEqual *FilterGreaterOrEqual `form:"filter[greaterOrEqual],omitempty" json:"filter[greaterOrEqual],omitempty"`
|
||||
|
||||
// FilterStartsWith Filter by any property that starts with text. Usage: filter[startsWith]=property:value
|
||||
FilterStartsWith *FilterStartsWith `form:"filter[startsWith],omitempty" json:"filter[startsWith],omitempty"`
|
||||
|
||||
// FilterEndsWith Filter by any property that ends with text. Usage: filter[endsWith]=property:value
|
||||
FilterEndsWith *FilterEndsWith `form:"filter[endsWith],omitempty" json:"filter[endsWith],omitempty"`
|
||||
|
||||
// Sort Sort the results by one or more properties, separated by commas. Prefix the property with '-' for descending order.
|
||||
Sort *Sort `form:"sort,omitempty" json:"sort,omitempty"`
|
||||
|
||||
// Include Related resources to include in the response, separated by commas
|
||||
Include *Include `form:"include,omitempty" json:"include,omitempty"`
|
||||
}
|
||||
|
||||
// GetAlbumParams defines parameters for GetAlbum.
|
||||
type GetAlbumParams struct {
|
||||
// Include Related resources to include in the response, separated by commas
|
||||
Include *Include `form:"include,omitempty" json:"include,omitempty"`
|
||||
}
|
||||
|
||||
// GetArtistsParams defines parameters for GetArtists.
|
||||
type GetArtistsParams struct {
|
||||
// PageLimit The number of items per page
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user