gateway

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddJsonBodyTenantIDAndUserID added in v0.4.0

func AddJsonBodyTenantIDAndUserID(c *api.Context, tenantIDField string, userIDField string) error

func AddQueryParamsTenantIDAndUserID added in v0.4.0

func AddQueryParamsTenantIDAndUserID(c *api.Context, tenantIDField string, userIDField string) error

func DestroyGateway

func DestroyGateway(gw *Gateway)

Types

type BodyFormFunc added in v0.6.0

type BodyFormFunc func(c *api.Context, staticBody any, historyRequests []BuilderRequest, resultMap map[string]any) (any, error)

func FormJsonBodyWithTenantIDAndUserIDFunc added in v0.6.0

func FormJsonBodyWithTenantIDAndUserIDFunc(tenantIDFieldName string, userIDFieldName string) BodyFormFunc

type Builder

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

func (*Builder) Build

func (builder *Builder) Build(middlewares ...api.Handler)

func (*Builder) Delete

func (builder *Builder) Delete(request *DeleteRequest, opts ...RequestOption) *Builder

func (*Builder) Get

func (builder *Builder) Get(request *GetRequest, opts ...RequestOption) *Builder

func (*Builder) GlobalRequestCallback added in v0.4.0

func (builder *Builder) GlobalRequestCallback(globalRequestResponseCallback GlobalRequestResponseCallback) *Builder

func (*Builder) Local added in v0.6.0

func (builder *Builder) Local(handler api.Handler, middlewares ...api.Handler)

func (*Builder) Post

func (builder *Builder) Post(request *PostRequest, opts ...RequestOption) *Builder

func (*Builder) Put

func (builder *Builder) Put(request *PutRequest, opts ...RequestOption) *Builder

func (*Builder) ResponseErrorCallback added in v0.4.0

func (builder *Builder) ResponseErrorCallback(responseErrorCallback ResponseErrorCallback) *Builder

func (*Builder) ResponseSuccessCallback added in v0.4.0

func (builder *Builder) ResponseSuccessCallback(responseSuccessCallback ResponseSuccessCallback) *Builder

func (*Builder) Url

func (builder *Builder) Url(httpMethod string, relativePath string) *Builder

type BuilderRequest

type BuilderRequest interface {
	Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error)
	Response() *http_client.Response
}

type DeleteRequest

type DeleteRequest struct {
	Url                 string
	QueryParams         map[string]string
	PathParams          map[string]string
	UrlFormFunc         UrlFormFunc
	HeadersFormFunc     HeadersFormFunc
	QueryParamsFormFunc QueryParamsFormFunc
	PathParamsFormFunc  PathParamsFormFunc
	// contains filtered or unexported fields
}

func (*DeleteRequest) Request

func (req *DeleteRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error)

func (*DeleteRequest) Response

func (req *DeleteRequest) Response() *http_client.Response

type Gateway

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

func NewGateway

func NewGateway(api *api.Api, opts ...Option) *Gateway

func (*Gateway) NewBuilder

func (gw *Gateway) NewBuilder(routerType string, version string) *Builder

type GetRequest

type GetRequest struct {
	Url                 string
	QueryParams         map[string]string
	PathParams          map[string]string
	UrlFormFunc         UrlFormFunc
	HeadersFormFunc     HeadersFormFunc
	QueryParamsFormFunc QueryParamsFormFunc
	PathParamsFormFunc  PathParamsFormFunc
	// contains filtered or unexported fields
}

func (*GetRequest) Request

func (req *GetRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error)

func (*GetRequest) Response

func (req *GetRequest) Response() *http_client.Response

type GlobalRequestResponseCallback added in v0.4.0

type GlobalRequestResponseCallback func(c *api.Context, request BuilderRequest, historyRequests []BuilderRequest, resultMap map[string]any) error

type HeadersFormFunc added in v0.6.0

type HeadersFormFunc func(c *api.Context, staticHeaders map[string]string, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)

type LocalServiceFunc added in v0.6.0

type LocalServiceFunc func(c *gin.Context)

type Option

type Option func(options *Options)

func WithHttpClientTimeoutSec

func WithHttpClientTimeoutSec(httpClientTimeoutSec int64) Option

type Options

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

type PathParamsFormFunc added in v0.6.0

type PathParamsFormFunc func(c *api.Context, staticPathParams map[string]string, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)

type PostRequest

type PostRequest struct {
	Url             string
	Body            any
	UrlFormFunc     UrlFormFunc
	BodyFormFunc    BodyFormFunc
	HeadersFormFunc HeadersFormFunc
	// contains filtered or unexported fields
}

func (*PostRequest) Request

func (req *PostRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error)

func (*PostRequest) Response

func (req *PostRequest) Response() *http_client.Response

type PutRequest

type PutRequest struct {
	Url             string
	Body            any
	UrlFormFunc     UrlFormFunc
	BodyFormFunc    BodyFormFunc
	HeadersFormFunc HeadersFormFunc
	// contains filtered or unexported fields
}

func (*PutRequest) Request

func (req *PutRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error)

func (*PutRequest) Response

func (req *PutRequest) Response() *http_client.Response

type QueryParamsFormFunc added in v0.6.0

type QueryParamsFormFunc func(c *api.Context, staticQueryParams map[string]string, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)

func FormQueryParamsWithTenantIDAndUserIDFunc added in v0.6.0

func FormQueryParamsWithTenantIDAndUserIDFunc(tenantIDFieldName string, userIDFieldName string) QueryParamsFormFunc

type RequestOption added in v0.10.1

type RequestOption func(options *RequestOptions)

func WithRequestResponseCallback added in v0.10.1

func WithRequestResponseCallback(callback RequestResponseCallback) RequestOption

type RequestOptions added in v0.10.1

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

type RequestResponseCallback added in v0.4.0

type RequestResponseCallback func(c *api.Context, response *http_client.Response, historyRequests []BuilderRequest, resultMap map[string]any) error

type ResponseErrorCallback added in v0.4.0

type ResponseErrorCallback func(c *api.Context, err error)

type ResponseSuccessCallback added in v0.4.0

type ResponseSuccessCallback func(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any)

type UrlFormFunc added in v0.10.1

type UrlFormFunc func(c *api.Context, staticUrl string, historyRequests []BuilderRequest, resultMap map[string]any) (string, error)

Jump to

Keyboard shortcuts

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