api

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

api provides an API router and controller Registry to route controller api's.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APICallback

func APICallback(c *gin.Context)

APICallback provides the routing to controller methods. Implementation example----------- ginServer.Router.GET("/apiGET", appAPI.APICallback) ginServer.Router.POST("/api", appAPI.APICallback) ---------------------------------

func GetControllerInterface

func GetControllerInterface(key string) interface{}

GetControllerInterface will return the interface of the controller.

func ProcessRequest

func ProcessRequest(controller string, action string, data []byte, results func(y interface{}, e ErrorResponse, httpStatus int))

ProcessRequest will process a controller requeest.

func RegisterController

func RegisterController(controller interface{})

RegisterController registers a controller object to be registered by the name of the object.

func RegisterControllerByKey

func RegisterControllerByKey(key string, controller interface{})

RegisterControllerByKey registers a controller object to be registered by a custom key.

func SocketAPICallback

func SocketAPICallback(conn *app.WebSocketConnection, c *gin.Context, messageType int, id string, data []byte)

SocketAPICallback provides the routing to controller methods for web socket calls. Implementation example----------- app.RegisterWebSocketDataCallback(api.SocketAPICallback) ---------------------------------

Types

type ErrorResponse

type ErrorResponse struct {
	Error *errorObj `json:"error,omitEmpty"`
}

Jump to

Keyboard shortcuts

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