...

Package openapi

import "go.formulabun.club/replays/ingest/server/go"
Overview
Index

Overview ▾

Index ▾

Variables
func AssertCVarEntryRequired(obj CVarEntry) error
func AssertFileInfoRequired(obj FileInfo) error
func AssertGraphqlRequired(obj Graphql) error
func AssertMetaInfoRequired(obj MetaInfo) error
func AssertPlayerEntryRequired(obj PlayerEntry) error
func AssertRecurseCVarEntryRequired(objSlice interface{}) error
func AssertRecurseFileInfoRequired(objSlice interface{}) error
func AssertRecurseGraphqlRequired(objSlice interface{}) error
func AssertRecurseInterfaceRequired(obj interface{}, callback func(interface{}) error) error
func AssertRecurseMetaInfoRequired(objSlice interface{}) error
func AssertRecursePlayerEntryRequired(objSlice interface{}) error
func AssertRecurseReplayInfoRequired(objSlice interface{}) error
func AssertRecurseReplayRequired(objSlice interface{}) error
func AssertRecurseValueRequired(value reflect.Value, callback func(interface{}) error) error
func AssertRecurseWadEntryRequired(objSlice interface{}) error
func AssertReplayInfoRequired(obj ReplayInfo) error
func AssertReplayRequired(obj Replay) error
func AssertWadEntryRequired(obj WadEntry) error
func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)
func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error
func IsZeroValue(val interface{}) bool
func Logger(inner http.Handler, name string) http.Handler
func NewRouter(routers ...Router) *mux.Router
func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)
func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error)
type CVarEntry
type DefaultApiController
    func (c *DefaultApiController) ListGet(w http.ResponseWriter, r *http.Request)
    func (c *DefaultApiController) RootPost(w http.ResponseWriter, r *http.Request)
    func (c *DefaultApiController) Routes() Routes
type DefaultApiOption
    func WithDefaultApiErrorHandler(h ErrorHandler) DefaultApiOption
type DefaultApiRouter
type DefaultApiService
    func (s *DefaultApiService) ListGet(ctx context.Context) (ImplResponse, error)
    func (s *DefaultApiService) RootPost(ctx context.Context, data io.ReadCloser) (ImplResponse, error)
type DefaultApiServicer
    func NewDefaultApiService() DefaultApiServicer
type ErrorHandler
type FileInfo
type Graphql
type ImplResponse
    func Response(code int, body interface{}) ImplResponse
type MetaInfo
type ParsingError
    func (e *ParsingError) Error() string
    func (e *ParsingError) Unwrap() error
type PlayerEntry
type Replay
type ReplayInfo
type RequiredError
    func (e *RequiredError) Error() string
type Route
type Router
    func NewDefaultApiController(s DefaultApiServicer, opts ...DefaultApiOption) Router
type Routes
type WadEntry

Package files

api.go api_default.go api_default_service.go error.go helpers.go impl.go logger.go model_c_var_entry.go model_file_info.go model_graphql.go model_meta_info.go model_player_entry.go model_replay.go model_replay_info.go model_wad_entry.go routers.go

Variables

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

func AssertCVarEntryRequired

func AssertCVarEntryRequired(obj CVarEntry) error

AssertCVarEntryRequired checks if the required fields are not zero-ed

func AssertFileInfoRequired

func AssertFileInfoRequired(obj FileInfo) error

AssertFileInfoRequired checks if the required fields are not zero-ed

func AssertGraphqlRequired

func AssertGraphqlRequired(obj Graphql) error

AssertGraphqlRequired checks if the required fields are not zero-ed

func AssertMetaInfoRequired

func AssertMetaInfoRequired(obj MetaInfo) error

AssertMetaInfoRequired checks if the required fields are not zero-ed

func AssertPlayerEntryRequired

func AssertPlayerEntryRequired(obj PlayerEntry) error

AssertPlayerEntryRequired checks if the required fields are not zero-ed

func AssertRecurseCVarEntryRequired

func AssertRecurseCVarEntryRequired(objSlice interface{}) error

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

func AssertRecurseFileInfoRequired

func AssertRecurseFileInfoRequired(objSlice interface{}) error

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

func AssertRecurseGraphqlRequired

func AssertRecurseGraphqlRequired(objSlice interface{}) error

AssertRecurseGraphqlRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Graphql (e.g. [][]Graphql), 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 AssertRecurseMetaInfoRequired

func AssertRecurseMetaInfoRequired(objSlice interface{}) error

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

func AssertRecursePlayerEntryRequired

func AssertRecursePlayerEntryRequired(objSlice interface{}) error

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

func AssertRecurseReplayInfoRequired

func AssertRecurseReplayInfoRequired(objSlice interface{}) error

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

func AssertRecurseReplayRequired

func AssertRecurseReplayRequired(objSlice interface{}) error

AssertRecurseReplayRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of Replay (e.g. [][]Replay), 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 AssertRecurseWadEntryRequired

func AssertRecurseWadEntryRequired(objSlice interface{}) error

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

func AssertReplayInfoRequired

func AssertReplayInfoRequired(obj ReplayInfo) error

AssertReplayInfoRequired checks if the required fields are not zero-ed

func AssertReplayRequired

func AssertReplayRequired(obj Replay) error

AssertReplayRequired checks if the required fields are not zero-ed

func AssertWadEntryRequired

func AssertWadEntryRequired(obj WadEntry) error

AssertWadEntryRequired 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, 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

type CVarEntry

type CVarEntry struct {
    CVarId int32 `json:"CVarId,omitempty"`

    Value string `json:"Value,omitempty"`
}

type DefaultApiController

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

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

func (*DefaultApiController) ListGet

func (c *DefaultApiController) ListGet(w http.ResponseWriter, r *http.Request)

ListGet - Get the list of replay files

func (*DefaultApiController) RootPost

func (c *DefaultApiController) RootPost(w http.ResponseWriter, r *http.Request)

RootPost - Upload a new replay file

func (*DefaultApiController) Routes

func (c *DefaultApiController) Routes() Routes

Routes returns all the api routes for the DefaultApiController

type DefaultApiOption

DefaultApiOption for how the controller is set up.

type DefaultApiOption func(*DefaultApiController)

func WithDefaultApiErrorHandler

func WithDefaultApiErrorHandler(h ErrorHandler) DefaultApiOption

WithDefaultApiErrorHandler inject ErrorHandler into controller

type DefaultApiRouter

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

type DefaultApiRouter interface {
    ListGet(http.ResponseWriter, *http.Request)
    RootPost(http.ResponseWriter, *http.Request)
}

type DefaultApiService

DefaultApiService is a service that implements the logic for the DefaultApiServicer This service should implement the business logic for every endpoint for the DefaultApi API. Include any external packages or services that will be required by this service.

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

func (*DefaultApiService) ListGet

func (s *DefaultApiService) ListGet(ctx context.Context) (ImplResponse, error)

ListGet - Get the list of replay files

func (*DefaultApiService) RootPost

func (s *DefaultApiService) RootPost(ctx context.Context, data io.ReadCloser) (ImplResponse, error)

RootPost - Upload a new replay file

type DefaultApiServicer

DefaultApiServicer defines the api actions for the DefaultApi 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 DefaultApiServicer interface {
    ListGet(context.Context) (ImplResponse, error)
    RootPost(context.Context, io.ReadCloser) (ImplResponse, error)
}

func NewDefaultApiService

func NewDefaultApiService() DefaultApiServicer

NewDefaultApiService creates a default api service

type ErrorHandler

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 ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)

type FileInfo

type FileInfo struct {
    DemoHeader string `json:"DemoHeader,omitempty"`

    Version int32 `json:"Version,omitempty"`

    SubVersion int32 `json:"SubVersion,omitempty"`

    DemoVersion int32 `json:"DemoVersion,omitempty"`

    Title string `json:"Title,omitempty"`

    Checksum []int32 `json:"Checksum,omitempty"`

    Play string `json:"Play,omitempty"`

    GameMap int32 `json:"GameMap,omitempty"`

    MapMd5 []int32 `json:"MapMd5,omitempty"`

    DemoFlags int32 `json:"DemoFlags,omitempty"`

    GameType int32 `json:"GameType,omitempty"`

    FileCount int32 `json:"FileCount,omitempty"`

    Wads []WadEntry `json:"Wads,omitempty"`

    // Total time in nanoseconds
    Time int32 `json:"Time,omitempty"`

    // Best lap time in nanoseconds
    BestLapTime int32 `json:"BestLapTime,omitempty"`

    Seed int32 `json:"Seed,omitempty"`

    CVarCount int32 `json:"CVarCount,omitempty"`

    Cvars []CVarEntry `json:"Cvars,omitempty"`

    Players []PlayerEntry `json:"Players,omitempty"`
}

type Graphql

type Graphql struct {
    Data map[string]interface{} `json:"data,omitempty"`

    Errors []map[string]interface{} `json:"errors,omitempty"`
}

type ImplResponse

ImplResponse response defines an error code with the associated body

type ImplResponse struct {
    Code int
    Body interface{}
}

func Response

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

Response return a ImplResponse struct filled

type MetaInfo

type MetaInfo struct {

    // discord id
    Creator int32 `json:"Creator,omitempty"`

    // unix time stamp
    Date int32 `json:"Date,omitempty"`
}

type ParsingError

ParsingError indicates that an error has occurred when parsing request parameters

type ParsingError struct {
    Err error
}

func (*ParsingError) Error

func (e *ParsingError) Error() string

func (*ParsingError) Unwrap

func (e *ParsingError) Unwrap() error

type PlayerEntry

type PlayerEntry struct {
    Name string `json:"Name,omitempty"`

    Skin string `json:"Skin,omitempty"`

    Color string `json:"Color,omitempty"`

    Score float32 `json:"Score,omitempty"`

    Speed float32 `json:"Speed,omitempty"`

    Weight float32 `json:"Weight,omitempty"`
}

type Replay

type Replay struct {
    Title string `json:"Title,omitempty"`

    GameMap float32 `json:"GameMap,omitempty"`

    Time float32 `json:"Time,omitempty"`

    Lap float32 `json:"Lap,omitempty"`

    PlayerEntries []PlayerEntry `json:"PlayerEntries,omitempty"`
}

type ReplayInfo

type ReplayInfo struct {
    MetaInfo MetaInfo `json:"MetaInfo,omitempty"`

    FileInfo FileInfo `json:"FileInfo,omitempty"`
}

type RequiredError

RequiredError indicates that an error has occurred when parsing request parameters

type RequiredError struct {
    Field string
}

func (*RequiredError) Error

func (e *RequiredError) Error() string

type Route

A Route defines the parameters for an api endpoint

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

type Router

Router defines the required methods for retrieving api routes

type Router interface {
    Routes() Routes
}

func NewDefaultApiController

func NewDefaultApiController(s DefaultApiServicer, opts ...DefaultApiOption) Router

NewDefaultApiController creates a default api controller

type Routes

Routes are a collection of defined api endpoints

type Routes []Route

type WadEntry

type WadEntry struct {
    FileName string `json:"FileName,omitempty"`

    WadMd5 []int32 `json:"WadMd5,omitempty"`
}