openapi

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTypeAssertionError is thrown when type an interface does not match the asserted type
	ErrTypeAssertionError = errors.New("unable to assert type")
)

Functions

func AssertAuthLoginPostRequestRequired

func AssertAuthLoginPostRequestRequired(obj AuthLoginPostRequest) error

AssertAuthLoginPostRequestRequired checks if the required fields are not zero-ed

func AssertLyricsImportStatusRequired

func AssertLyricsImportStatusRequired(obj LyricsImportStatus) error

AssertLyricsImportStatusRequired checks if the required fields are not zero-ed

func AssertLyricsRequired

func AssertLyricsRequired(obj Lyrics) error

AssertLyricsRequired checks if the required fields are not zero-ed

func AssertMessageRequired

func AssertMessageRequired(obj Message) error

AssertMessageRequired checks if the required fields are not zero-ed

func AssertModel401UnauthorizedRequired

func AssertModel401UnauthorizedRequired(obj Model401Unauthorized) error

AssertModel401UnauthorizedRequired checks if the required fields are not zero-ed

func AssertModel404NotFoundRequired

func AssertModel404NotFoundRequired(obj Model404NotFound) error

AssertModel404NotFoundRequired checks if the required fields are not zero-ed

func AssertModel500InternalErrorRequired

func AssertModel500InternalErrorRequired(obj Model500InternalError) error

AssertModel500InternalErrorRequired checks if the required fields are not zero-ed

func AssertOAuthConfigurationRequired

func AssertOAuthConfigurationRequired(obj OAuthConfiguration) error

AssertOAuthConfigurationRequired checks if the required fields are not zero-ed

func AssertOAuthUserInfoRequired

func AssertOAuthUserInfoRequired(obj OAuthUserInfo) error

AssertOAuthUserInfoRequired checks if the required fields are not zero-ed

func AssertPaginationMetadataRequired

func AssertPaginationMetadataRequired(obj PaginationMetadata) error

AssertPaginationMetadataRequired checks if the required fields are not zero-ed

func AssertPlaylistInfoRequired

func AssertPlaylistInfoRequired(obj PlaylistInfo) error

AssertPlaylistInfoRequired checks if the required fields are not zero-ed

func AssertPlaylistsGet200ResponseRequired

func AssertPlaylistsGet200ResponseRequired(obj PlaylistsGet200Response) error

AssertPlaylistsGet200ResponseRequired checks if the required fields are not zero-ed

func AssertRecurseAuthLoginPostRequestRequired

func AssertRecurseAuthLoginPostRequestRequired(objSlice interface{}) error

AssertRecurseAuthLoginPostRequestRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of AuthLoginPostRequest (e.g. [][]AuthLoginPostRequest), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseInterfaceRequired

func AssertRecurseInterfaceRequired(obj interface{}, callback func(interface{}) error) error

AssertRecurseInterfaceRequired recursively checks each struct in a slice against the callback. This method traverse nested slices in a preorder fashion.

func AssertRecurseLyricsImportStatusRequired

func AssertRecurseLyricsImportStatusRequired(objSlice interface{}) error

AssertRecurseLyricsImportStatusRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of LyricsImportStatus (e.g. [][]LyricsImportStatus), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseLyricsRequired

func AssertRecurseLyricsRequired(objSlice interface{}) error

AssertRecurseLyricsRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Lyrics (e.g. [][]Lyrics), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseMessageRequired

func AssertRecurseMessageRequired(objSlice interface{}) error

AssertRecurseMessageRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Message (e.g. [][]Message), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseModel401UnauthorizedRequired

func AssertRecurseModel401UnauthorizedRequired(objSlice interface{}) error

AssertRecurseModel401UnauthorizedRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Model401Unauthorized (e.g. [][]Model401Unauthorized), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseModel404NotFoundRequired

func AssertRecurseModel404NotFoundRequired(objSlice interface{}) error

AssertRecurseModel404NotFoundRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Model404NotFound (e.g. [][]Model404NotFound), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseModel500InternalErrorRequired

func AssertRecurseModel500InternalErrorRequired(objSlice interface{}) error

AssertRecurseModel500InternalErrorRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Model500InternalError (e.g. [][]Model500InternalError), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseOAuthConfigurationRequired

func AssertRecurseOAuthConfigurationRequired(objSlice interface{}) error

AssertRecurseOAuthConfigurationRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of OAuthConfiguration (e.g. [][]OAuthConfiguration), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseOAuthUserInfoRequired

func AssertRecurseOAuthUserInfoRequired(objSlice interface{}) error

AssertRecurseOAuthUserInfoRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of OAuthUserInfo (e.g. [][]OAuthUserInfo), otherwise ErrTypeAssertionError is thrown.

func AssertRecursePaginationMetadataRequired

func AssertRecursePaginationMetadataRequired(objSlice interface{}) error

AssertRecursePaginationMetadataRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of PaginationMetadata (e.g. [][]PaginationMetadata), otherwise ErrTypeAssertionError is thrown.

func AssertRecursePlaylistInfoRequired

func AssertRecursePlaylistInfoRequired(objSlice interface{}) error

AssertRecursePlaylistInfoRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of PlaylistInfo (e.g. [][]PlaylistInfo), otherwise ErrTypeAssertionError is thrown.

func AssertRecursePlaylistsGet200ResponseRequired

func AssertRecursePlaylistsGet200ResponseRequired(objSlice interface{}) error

AssertRecursePlaylistsGet200ResponseRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of PlaylistsGet200Response (e.g. [][]PlaylistsGet200Response), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseTrackDetailAllOfRequired

func AssertRecurseTrackDetailAllOfRequired(objSlice interface{}) error

AssertRecurseTrackDetailAllOfRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TrackDetailAllOf (e.g. [][]TrackDetailAllOf), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseTrackDetailRequired

func AssertRecurseTrackDetailRequired(objSlice interface{}) error

AssertRecurseTrackDetailRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TrackDetail (e.g. [][]TrackDetail), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseTrackInfoRequired

func AssertRecurseTrackInfoRequired(objSlice interface{}) error

AssertRecurseTrackInfoRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TrackInfo (e.g. [][]TrackInfo), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseTracksGet200ResponseRequired

func AssertRecurseTracksGet200ResponseRequired(objSlice interface{}) error

AssertRecurseTracksGet200ResponseRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TracksGet200Response (e.g. [][]TracksGet200Response), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseTracksStatsRequired

func AssertRecurseTracksStatsRequired(objSlice interface{}) error

AssertRecurseTracksStatsRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of TracksStats (e.g. [][]TracksStats), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseUserResponseRequired

func AssertRecurseUserResponseRequired(objSlice interface{}) error

AssertRecurseUserResponseRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of UserResponse (e.g. [][]UserResponse), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseValueRequired

func AssertRecurseValueRequired(value reflect.Value, callback func(interface{}) error) error

AssertRecurseValueRequired checks each struct in the nested slice against the callback. This method traverse nested slices in a preorder fashion.

func AssertTrackDetailAllOfRequired

func AssertTrackDetailAllOfRequired(obj TrackDetailAllOf) error

AssertTrackDetailAllOfRequired checks if the required fields are not zero-ed

func AssertTrackDetailRequired

func AssertTrackDetailRequired(obj TrackDetail) error

AssertTrackDetailRequired checks if the required fields are not zero-ed

func AssertTrackInfoRequired

func AssertTrackInfoRequired(obj TrackInfo) error

AssertTrackInfoRequired checks if the required fields are not zero-ed

func AssertTracksGet200ResponseRequired

func AssertTracksGet200ResponseRequired(obj TracksGet200Response) error

AssertTracksGet200ResponseRequired checks if the required fields are not zero-ed

func AssertTracksStatsRequired

func AssertTracksStatsRequired(obj TracksStats) error

AssertTracksStatsRequired checks if the required fields are not zero-ed

func AssertUserResponseRequired

func AssertUserResponseRequired(obj UserResponse) error

AssertUserResponseRequired checks if the required fields are not zero-ed

func DefaultErrorHandler

func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)

DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used.

func EncodeJSONResponse

func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string, w http.ResponseWriter) error

EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code

func IsZeroValue

func IsZeroValue(val interface{}) bool

IsZeroValue checks if the val is the zero-ed value.

func Logger

func Logger(inner http.Handler, name string) http.Handler

func NewRouter

func NewRouter(routers ...Router) *mux.Router

NewRouter creates a new router for any number of api routers

func ReadFormFileToTempFile

func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)

ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file

func ReadFormFilesToTempFiles

func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error)

ReadFormFilesToTempFiles reads files array data from a request form and writes it to a temporary files

Types

type AuthApiController

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

AuthApiController binds http requests to an api service and writes the service results to the http response

func (*AuthApiController) AuthConfigurationGet

func (c *AuthApiController) AuthConfigurationGet(w http.ResponseWriter, r *http.Request)

AuthConfigurationGet - Get configuration for oAuth2 workflow

func (*AuthApiController) AuthLoginPost

func (c *AuthApiController) AuthLoginPost(w http.ResponseWriter, r *http.Request)

AuthLoginPost - Authenticate

func (*AuthApiController) AuthLogoutGet

func (c *AuthApiController) AuthLogoutGet(w http.ResponseWriter, r *http.Request)

AuthLogoutGet - Invalidates the jwt token

func (*AuthApiController) AuthRefreshGet

func (c *AuthApiController) AuthRefreshGet(w http.ResponseWriter, r *http.Request)

AuthRefreshGet - Refresh JWT access token

func (*AuthApiController) Routes

func (c *AuthApiController) Routes() Routes

Routes returns all the api routes for the AuthApiController

type AuthApiOption

type AuthApiOption func(*AuthApiController)

AuthApiOption for how the controller is set up.

func WithAuthApiErrorHandler

func WithAuthApiErrorHandler(h ErrorHandler) AuthApiOption

WithAuthApiErrorHandler inject ErrorHandler into controller

type AuthApiRouter

type AuthApiRouter interface {
	AuthConfigurationGet(http.ResponseWriter, *http.Request)
	AuthLoginPost(http.ResponseWriter, *http.Request)
	AuthLogoutGet(http.ResponseWriter, *http.Request)
	AuthRefreshGet(http.ResponseWriter, *http.Request)
}

AuthApiRouter defines the required methods for binding the api requests to a responses for the AuthApi The AuthApiRouter implementation should parse necessary information from the http request, pass the data to a AuthApiServicer to perform the required actions, then write the service results to the http response.

type AuthApiServicer

type AuthApiServicer interface {
	AuthConfigurationGet(context.Context) (ImplResponse, error)
	AuthLoginPost(context.Context, AuthLoginPostRequest) (ImplResponse, error)
	AuthLogoutGet(context.Context) (ImplResponse, error)
	AuthRefreshGet(context.Context) (ImplResponse, error)
}

AuthApiServicer defines the api actions for the AuthApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

type AuthLoginPostRequest

type AuthLoginPostRequest struct {
	Code string `json:"code,omitempty"`
}

type ErrorHandler

type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)

ErrorHandler defines the required method for handling error. You may implement it and inject this into a controller if you would like errors to be handled differently from the DefaultErrorHandler

type ImplResponse

type ImplResponse struct {
	Code    int
	Headers map[string][]string
	Body    interface{}
}

ImplResponse response defines an error code with the associated body

func Response

func Response(code int, body interface{}) ImplResponse

Response return a ImplResponse struct filled

func ResponseWithHeaders

func ResponseWithHeaders(code int, headers map[string][]string, body interface{}) ImplResponse

ResponseWithHeaders return a ImplResponse struct filled, including headers

type ImportApiController

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

ImportApiController binds http requests to an api service and writes the service results to the http response

func (*ImportApiController) ImportLibraryPost

func (c *ImportApiController) ImportLibraryPost(w http.ResponseWriter, r *http.Request)

ImportLibraryPost - Start import of tracks from spotify library

func (*ImportApiController) ImportLyricsGet

func (c *ImportApiController) ImportLyricsGet(w http.ResponseWriter, r *http.Request)

ImportLyricsGet - Get status of import process

func (*ImportApiController) ImportLyricsPost

func (c *ImportApiController) ImportLyricsPost(w http.ResponseWriter, r *http.Request)

ImportLyricsPost - Start import of lyrics

func (*ImportApiController) ImportLyricsTrackIdPost

func (c *ImportApiController) ImportLyricsTrackIdPost(w http.ResponseWriter, r *http.Request)

ImportLyricsTrackIdPost - Try to import lyrics of a specific track

func (*ImportApiController) ImportPlaylistIdPost

func (c *ImportApiController) ImportPlaylistIdPost(w http.ResponseWriter, r *http.Request)

ImportPlaylistIdPost - Start import of tracks from playlist

func (*ImportApiController) Routes

func (c *ImportApiController) Routes() Routes

Routes returns all the api routes for the ImportApiController

type ImportApiOption

type ImportApiOption func(*ImportApiController)

ImportApiOption for how the controller is set up.

func WithImportApiErrorHandler

func WithImportApiErrorHandler(h ErrorHandler) ImportApiOption

WithImportApiErrorHandler inject ErrorHandler into controller

type ImportApiRouter

type ImportApiRouter interface {
	ImportLibraryPost(http.ResponseWriter, *http.Request)
	ImportLyricsGet(http.ResponseWriter, *http.Request)
	ImportLyricsPost(http.ResponseWriter, *http.Request)
	ImportLyricsTrackIdPost(http.ResponseWriter, *http.Request)
	ImportPlaylistIdPost(http.ResponseWriter, *http.Request)
}

ImportApiRouter defines the required methods for binding the api requests to a responses for the ImportApi The ImportApiRouter implementation should parse necessary information from the http request, pass the data to a ImportApiServicer to perform the required actions, then write the service results to the http response.

type ImportApiServicer

type ImportApiServicer interface {
	ImportLibraryPost(context.Context) (ImplResponse, error)
	ImportLyricsGet(context.Context) (ImplResponse, error)
	ImportLyricsPost(context.Context) (ImplResponse, error)
	ImportLyricsTrackIdPost(context.Context, string) (ImplResponse, error)
	ImportPlaylistIdPost(context.Context, string) (ImplResponse, error)
}

ImportApiServicer defines the api actions for the ImportApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

type Lyrics

type Lyrics struct {
	Lyrics string `json:"lyrics,omitempty"`
}

type LyricsImportStatus

type LyricsImportStatus struct {
	Running bool `json:"running"`

	TracksCompleted int32 `json:"tracksCompleted,omitempty"`

	TracksSuccessful int32 `json:"tracksSuccessful,omitempty"`

	TracksError int32 `json:"tracksError,omitempty"`

	TracksTotal int32 `json:"tracksTotal,omitempty"`

	Log string `json:"log,omitempty"`
}

type Message

type Message struct {
	Code int32 `json:"code"`

	Message string `json:"message"`
}

type Model401Unauthorized

type Model401Unauthorized struct {
	Code int32 `json:"code"`

	Message string `json:"message"`
}

type Model404NotFound

type Model404NotFound struct {
	Code int32 `json:"code"`

	Message string `json:"message"`
}

type Model500InternalError

type Model500InternalError struct {
	Code int32 `json:"code"`

	Message string `json:"message"`
}

type OAuthConfiguration

type OAuthConfiguration struct {
	RedirectUrl string `json:"redirectUrl,omitempty"`

	ClientId string `json:"clientId,omitempty"`

	Scope string `json:"scope,omitempty"`
}

type OAuthUserInfo

type OAuthUserInfo struct {
	DisplayName string `json:"displayName,omitempty"`

	AvatarUrl string `json:"avatarUrl,omitempty"`
}

type PaginationMetadata

type PaginationMetadata struct {
	Page int32 `json:"page,omitempty"`

	Limit int32 `json:"limit,omitempty"`

	Total int32 `json:"total,omitempty"`
}

type ParsingError

type ParsingError struct {
	Err error
}

ParsingError indicates that an error has occurred when parsing request parameters

func (*ParsingError) Error

func (e *ParsingError) Error() string

func (*ParsingError) Unwrap

func (e *ParsingError) Unwrap() error

type PlaylistInfo

type PlaylistInfo struct {
	SpotifyId string `json:"spotifyId,omitempty"`

	Name string `json:"name,omitempty"`

	CoverImage string `json:"coverImage,omitempty"`

	TrackCount int32 `json:"trackCount,omitempty"`

	Owner string `json:"owner,omitempty"`

	IsPublic bool `json:"isPublic,omitempty"`

	IsCollaborative bool `json:"isCollaborative,omitempty"`
}

type PlaylistsApiController

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

PlaylistsApiController binds http requests to an api service and writes the service results to the http response

func (*PlaylistsApiController) PlaylistsGet

func (c *PlaylistsApiController) PlaylistsGet(w http.ResponseWriter, r *http.Request)

PlaylistsGet - Returns a list of your saved playlists

func (*PlaylistsApiController) Routes

func (c *PlaylistsApiController) Routes() Routes

Routes returns all the api routes for the PlaylistsApiController

type PlaylistsApiOption

type PlaylistsApiOption func(*PlaylistsApiController)

PlaylistsApiOption for how the controller is set up.

func WithPlaylistsApiErrorHandler

func WithPlaylistsApiErrorHandler(h ErrorHandler) PlaylistsApiOption

WithPlaylistsApiErrorHandler inject ErrorHandler into controller

type PlaylistsApiRouter

type PlaylistsApiRouter interface {
	PlaylistsGet(http.ResponseWriter, *http.Request)
}

PlaylistsApiRouter defines the required methods for binding the api requests to a responses for the PlaylistsApi The PlaylistsApiRouter implementation should parse necessary information from the http request, pass the data to a PlaylistsApiServicer to perform the required actions, then write the service results to the http response.

type PlaylistsApiServicer

type PlaylistsApiServicer interface {
	PlaylistsGet(context.Context, int32, int32) (ImplResponse, error)
}

PlaylistsApiServicer defines the api actions for the PlaylistsApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

type PlaylistsGet200Response

type PlaylistsGet200Response struct {
	Meta PaginationMetadata `json:"meta,omitempty"`

	Data []PlaylistInfo `json:"data,omitempty"`
}

type RequiredError

type RequiredError struct {
	Field string
}

RequiredError indicates that an error has occurred when parsing request parameters

func (*RequiredError) Error

func (e *RequiredError) Error() string

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

A Route defines the parameters for an api endpoint

type Router

type Router interface {
	Routes() Routes
}

Router defines the required methods for retrieving api routes

func NewAuthApiController

func NewAuthApiController(s AuthApiServicer, opts ...AuthApiOption) Router

NewAuthApiController creates a default api controller

func NewImportApiController

func NewImportApiController(s ImportApiServicer, opts ...ImportApiOption) Router

NewImportApiController creates a default api controller

func NewPlaylistsApiController

func NewPlaylistsApiController(s PlaylistsApiServicer, opts ...PlaylistsApiOption) Router

NewPlaylistsApiController creates a default api controller

func NewTracksApiController

func NewTracksApiController(s TracksApiServicer, opts ...TracksApiOption) Router

NewTracksApiController creates a default api controller

type Routes

type Routes []Route

Routes are a collection of defined api endpoints

type TrackDetail

type TrackDetail struct {
	SpotifyId string `json:"spotifyId"`

	Title string `json:"title"`

	Album string `json:"album,omitempty"`

	CoverImage string `json:"coverImage,omitempty"`

	PreviewURL string `json:"previewURL,omitempty"`

	Artists []string `json:"artists,omitempty"`

	HasLyrics bool `json:"hasLyrics"`

	Language string `json:"language,omitempty"`

	Lyrics string `json:"lyrics"`

	LyricsImportErrorCount int32 `json:"lyricsImportErrorCount"`
}

type TrackDetailAllOf

type TrackDetailAllOf struct {
	Lyrics string `json:"lyrics"`

	LyricsImportErrorCount int32 `json:"lyricsImportErrorCount"`

	HasLyrics bool `json:"hasLyrics"`
}

type TrackInfo

type TrackInfo struct {
	SpotifyId string `json:"spotifyId"`

	Title string `json:"title"`

	Album string `json:"album,omitempty"`

	CoverImage string `json:"coverImage,omitempty"`

	PreviewURL string `json:"previewURL,omitempty"`

	Artists []string `json:"artists,omitempty"`

	HasLyrics bool `json:"hasLyrics"`

	Language string `json:"language,omitempty"`
}

type TracksApiController

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

TracksApiController binds http requests to an api service and writes the service results to the http response

func (*TracksApiController) Routes

func (c *TracksApiController) Routes() Routes

Routes returns all the api routes for the TracksApiController

func (*TracksApiController) TracksGet

func (c *TracksApiController) TracksGet(w http.ResponseWriter, r *http.Request)

TracksGet - Returns a list of tracks

func (*TracksApiController) TracksIdGet

func (c *TracksApiController) TracksIdGet(w http.ResponseWriter, r *http.Request)

TracksIdGet - Returns a track

func (*TracksApiController) TracksIdPatch

func (c *TracksApiController) TracksIdPatch(w http.ResponseWriter, r *http.Request)

TracksIdPatch - Updates lyrics of a track

func (*TracksApiController) TracksStatsGet

func (c *TracksApiController) TracksStatsGet(w http.ResponseWriter, r *http.Request)

TracksStatsGet - Returns stats about your index

type TracksApiOption

type TracksApiOption func(*TracksApiController)

TracksApiOption for how the controller is set up.

func WithTracksApiErrorHandler

func WithTracksApiErrorHandler(h ErrorHandler) TracksApiOption

WithTracksApiErrorHandler inject ErrorHandler into controller

type TracksApiRouter

type TracksApiRouter interface {
	TracksGet(http.ResponseWriter, *http.Request)
	TracksIdGet(http.ResponseWriter, *http.Request)
	TracksIdPatch(http.ResponseWriter, *http.Request)
	TracksStatsGet(http.ResponseWriter, *http.Request)
}

TracksApiRouter defines the required methods for binding the api requests to a responses for the TracksApi The TracksApiRouter implementation should parse necessary information from the http request, pass the data to a TracksApiServicer to perform the required actions, then write the service results to the http response.

type TracksApiServicer

type TracksApiServicer interface {
	TracksGet(context.Context, int32, int32, string) (ImplResponse, error)
	TracksIdGet(context.Context, string) (ImplResponse, error)
	TracksIdPatch(context.Context, string, Lyrics) (ImplResponse, error)
	TracksStatsGet(context.Context) (ImplResponse, error)
}

TracksApiServicer defines the api actions for the TracksApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can be ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

type TracksGet200Response

type TracksGet200Response struct {
	Meta PaginationMetadata `json:"meta"`

	Data []TrackInfo `json:"data"`
}

type TracksStats

type TracksStats struct {
	NumberOfTracks int32 `json:"numberOfTracks"`

	NumberOfTracksWithLyrics int32 `json:"numberOfTracksWithLyrics"`
}

type UserResponse

type UserResponse struct {
	Username string `json:"username,omitempty"`

	Avatar string `json:"avatar,omitempty"`
}

Jump to

Keyboard shortcuts

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