api

package
v0.0.0-...-1232e6b Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router *gin.Engine, si ServerInterface) *gin.Engine

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router *gin.Engine, si ServerInterface, options GinServerOptions) *gin.Engine

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type Api

type Api struct {
	// check intervals in seconds
	Interval       int    `json:"interval"`
	Name           string `json:"name"`
	RequestBody    string `json:"request_body"`
	RequestHeaders []struct {
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"request_headers"`
	RequestMethod ApiRequestMethod `json:"request_method"`
	RequestUrl    string           `json:"request_url"`
}

Api defines model for Api.

type ApiBrowse

type ApiBrowse struct {
	Items      *[]ApiDoc   `json:"items,omitempty"`
	Pagination *Pagination `json:"pagination,omitempty"`
}

ApiBrowse defines model for ApiBrowse.

type ApiDoc

type ApiDoc struct {
	DateRegistered  string `json:"date_registered"`
	DateUpdated     string `json:"date_updated"`
	HealthCondition string `json:"health_condition"`
	Heartbeat       bool   `json:"heartbeat"`
	Id              int64  `json:"id"`

	// check intervals in seconds
	Interval       int    `json:"interval"`
	IsEnabled      bool   `json:"is_enabled"`
	LastCheck      string `json:"last_check"`
	Name           string `json:"name"`
	RequestBody    string `json:"request_body"`
	RequestHeaders []struct {
		Name  string `json:"name"`
		Value string `json:"value"`
	} `json:"request_headers"`
	RequestMethod ApiDocRequestMethod `json:"request_method"`
	RequestUrl    string              `json:"request_url"`
}

ApiDoc defines model for ApiDoc.

type ApiDocRequestMethod

type ApiDocRequestMethod string

ApiDocRequestMethod defines model for ApiDoc.RequestMethod.

const (
	ApiDocRequestMethodGET     ApiDocRequestMethod = "GET"
	ApiDocRequestMethodHEAD    ApiDocRequestMethod = "HEAD"
	ApiDocRequestMethodOPTIONS ApiDocRequestMethod = "OPTIONS"
	ApiDocRequestMethodPOST    ApiDocRequestMethod = "POST"
)

Defines values for ApiDocRequestMethod.

type ApiRequestMethod

type ApiRequestMethod string

ApiRequestMethod defines model for Api.RequestMethod.

const (
	ApiRequestMethodGET  ApiRequestMethod = "GET"
	ApiRequestMethodPOST ApiRequestMethod = "POST"
)

Defines values for ApiRequestMethod.

type ApiStatus

type ApiStatus struct {
	Status ApiStatusStatus `json:"status"`
}

ApiStatus defines model for ApiStatus.

type ApiStatusStatus

type ApiStatusStatus string

ApiStatusStatus defines model for ApiStatus.Status.

const (
	Disable ApiStatusStatus = "disable"
	Enable  ApiStatusStatus = "enable"
)

Defines values for ApiStatusStatus.

type FetchApisParams

type FetchApisParams struct {
	// the current page of fetch
	Page int `form:"page" json:"page"`

	// the number of items per page
	ItemsPerPage int `form:"items_per_page" json:"items_per_page"`
}

FetchApisParams defines parameters for FetchApis.

type GinServerOptions

type GinServerOptions struct {
	BaseURL     string
	Middlewares []MiddlewareFunc
}

GinServerOptions provides options for the Gin server.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type Msg

type Msg struct {
	Msg *string `json:"msg,omitempty"`
}

Msg defines model for Msg.

type Pagination

type Pagination struct {
	ItemsPerPage   *int   `json:"items_per_page,omitempty"`
	Page           *int   `json:"page,omitempty"`
	TotalItemCount *int64 `json:"total_item_count,omitempty"`
}

Pagination defines model for Pagination.

type RegisterApiJSONBody

type RegisterApiJSONBody = Api

RegisterApiJSONBody defines parameters for RegisterApi.

type RegisterApiJSONRequestBody

type RegisterApiJSONRequestBody = RegisterApiJSONBody

RegisterApiJSONRequestBody defines body for RegisterApi for application/json ContentType.

type ServerInterface

type ServerInterface interface {

	// (GET /apis)
	FetchApis(c *gin.Context, params FetchApisParams)

	// (POST /apis)
	RegisterApi(c *gin.Context)

	// (DELETE /apis/{id})
	DeleteApi(c *gin.Context, id int64)

	// (PUT /apis/{id}/status)
	UpdateApiStatus(c *gin.Context, id int64)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) DeleteApi

func (siw *ServerInterfaceWrapper) DeleteApi(c *gin.Context)

DeleteApi operation middleware

func (*ServerInterfaceWrapper) FetchApis

func (siw *ServerInterfaceWrapper) FetchApis(c *gin.Context)

FetchApis operation middleware

func (*ServerInterfaceWrapper) RegisterApi

func (siw *ServerInterfaceWrapper) RegisterApi(c *gin.Context)

RegisterApi operation middleware

func (*ServerInterfaceWrapper) UpdateApiStatus

func (siw *ServerInterfaceWrapper) UpdateApiStatus(c *gin.Context)

UpdateApiStatus operation middleware

type UpdateApiStatusJSONBody

type UpdateApiStatusJSONBody = ApiStatus

UpdateApiStatusJSONBody defines parameters for UpdateApiStatus.

type UpdateApiStatusJSONRequestBody

type UpdateApiStatusJSONRequestBody = UpdateApiStatusJSONBody

UpdateApiStatusJSONRequestBody defines body for UpdateApiStatus for application/json ContentType.

Jump to

Keyboard shortcuts

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