gateway

package
v0.7.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 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, historyRequest []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, requestCallbackFunc RequestResponseCallback) *Builder

func (*Builder) Get

func (builder *Builder) Get(request *GetRequest, requestCallbackFunc RequestResponseCallback) *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, requestCallbackFunc RequestResponseCallback) *Builder

func (*Builder) Put

func (builder *Builder) Put(request *PutRequest, requestCallbackFunc RequestResponseCallback) *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, historyRequest []BuilderRequest, resultMap map[string]any) (BuilderRequest, error)
	Response() *http_client.Response
}

type DeleteRequest

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

func NewDeleteRequest added in v0.6.0

func NewDeleteRequest(url string, opts ...DeleteRequestOption) *DeleteRequest

func (*DeleteRequest) Request

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

func (*DeleteRequest) Response

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

type DeleteRequestOption added in v0.6.0

type DeleteRequestOption func(options *DeleteRequestOptions)

func DeleteRequestWithHeadersForm added in v0.6.0

func DeleteRequestWithHeadersForm(headersFormFunc HeadersFormFunc) DeleteRequestOption

func DeleteRequestWithPathParamsForm added in v0.6.0

func DeleteRequestWithPathParamsForm(pathParamsFormFunc PathParamsFormFunc) DeleteRequestOption

func DeleteRequestWithQueryParamsForm added in v0.6.0

func DeleteRequestWithQueryParamsForm(queryParamsFormFunc QueryParamsFormFunc) DeleteRequestOption

func DeleteRequestWithUrlTransferFunc added in v0.6.0

func DeleteRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) DeleteRequestOption

type DeleteRequestOptions added in v0.6.0

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

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 {
	// contains filtered or unexported fields
}

func NewGetRequest added in v0.6.0

func NewGetRequest(url string, opts ...GetRequestOption) *GetRequest

func (*GetRequest) Request

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

func (*GetRequest) Response

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

type GetRequestOption added in v0.6.0

type GetRequestOption func(options *GetRequestOptions)

func GetRequestWithHeadersForm added in v0.6.0

func GetRequestWithHeadersForm(headersFormFunc HeadersFormFunc) GetRequestOption

func GetRequestWithPathParamsForm added in v0.6.0

func GetRequestWithPathParamsForm(pathParamsFormFunc PathParamsFormFunc) GetRequestOption

func GetRequestWithQueryParamsForm added in v0.6.0

func GetRequestWithQueryParamsForm(queryParamsFormFunc QueryParamsFormFunc) GetRequestOption

func GetRequestWithUrlTransferFunc added in v0.6.0

func GetRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) GetRequestOption

type GetRequestOptions added in v0.6.0

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

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, historyRequest []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, historyRequest []BuilderRequest, resultMap map[string]any) (map[string]string, error)

type PostRequest

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

func NewPostRequest added in v0.6.0

func NewPostRequest(url string, opts ...PostRequestOption) *PostRequest

func (*PostRequest) Request

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

func (*PostRequest) Response

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

type PostRequestOption added in v0.6.0

type PostRequestOption func(options *PostRequestOptions)

func PostRequestWithBodyForm added in v0.6.0

func PostRequestWithBodyForm(bodyFormFunc BodyFormFunc) PostRequestOption

func PostRequestWithHeadersForm added in v0.6.0

func PostRequestWithHeadersForm(headersFormFunc HeadersFormFunc) PostRequestOption

func PostRequestWithUrlTransferFunc added in v0.6.0

func PostRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) PostRequestOption

type PostRequestOptions added in v0.6.0

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

type PutRequest

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

func NewPutRequest added in v0.6.0

func NewPutRequest(url string, opts ...PutRequestOption) *PutRequest

func (*PutRequest) Request

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

func (*PutRequest) Response

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

type PutRequestOption added in v0.6.0

type PutRequestOption func(options *PutRequestOptions)

func PutRequestWithBodyForm added in v0.6.0

func PutRequestWithBodyForm(bodyFormFunc BodyFormFunc) PutRequestOption

func PutRequestWithHeadersForm added in v0.6.0

func PutRequestWithHeadersForm(headersFormFunc HeadersFormFunc) PutRequestOption

func PutRequestWithUrlTransferFunc added in v0.6.0

func PutRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) PutRequestOption

type PutRequestOptions added in v0.6.0

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

type QueryParamsFormFunc added in v0.6.0

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

func FormQueryParamsWithTenantIDAndUserIDFunc added in v0.6.0

func FormQueryParamsWithTenantIDAndUserIDFunc(tenantIDFieldName string, userIDFieldName string) QueryParamsFormFunc

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 UrlTransferFunc added in v0.6.0

type UrlTransferFunc func(c *api.Context, url string, historyRequest []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