gateway

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: GPL-3.0 Imports: 7 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) (map[string]any, error)

func AddQueryParamsTenantIDAndUserID added in v0.4.0

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

func DestroyGateway

func DestroyGateway(gw *Gateway)

Types

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) Post

func (builder *Builder) Post(request *PostRequest, requestCallbackFunc RequestResponseCallback) *Builder

func (*Builder) Put

func (builder *Builder) Put(request *PutRequest, requestCallbackFunc RequestResponseCallback) *Builder

func (*Builder) Request added in v0.4.0

func (builder *Builder) Request(formBuilderRequestFunc FormBuilderRequestFunc, 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 {
	HttpMethod() string
	Request(request *http_client.Request) error
	Response() *http_client.Response
}

type DeleteRequest

type DeleteRequest struct {
	Url         string
	Headers     map[string]string
	PathParams  map[string]string
	QueryParams map[string]string
	// contains filtered or unexported fields
}

func (*DeleteRequest) HttpMethod

func (req *DeleteRequest) HttpMethod() string

func (*DeleteRequest) Request

func (req *DeleteRequest) Request(request *http_client.Request) error

func (*DeleteRequest) Response

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

type FormBuilderRequestFunc added in v0.4.0

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

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
	Headers     map[string]string
	PathParams  map[string]string
	QueryParams map[string]string
	// contains filtered or unexported fields
}

func (*GetRequest) HttpMethod

func (req *GetRequest) HttpMethod() string

func (*GetRequest) Request

func (req *GetRequest) Request(request *http_client.Request) error

func (*GetRequest) RequestUrl

func (req *GetRequest) RequestUrl() string

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 Option

type Option func(options *Options)

func WithHttpClientTimeoutSec

func WithHttpClientTimeoutSec(httpClientTimeoutSec int64) Option

type Options

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

type PostRequest

type PostRequest struct {
	Url     string
	Headers map[string]string
	Body    any
	// contains filtered or unexported fields
}

func (*PostRequest) HttpMethod

func (req *PostRequest) HttpMethod() string

func (*PostRequest) Request

func (req *PostRequest) Request(request *http_client.Request) error

func (*PostRequest) RequestUrl

func (req *PostRequest) RequestUrl() string

func (*PostRequest) Response

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

type PutRequest

type PutRequest struct {
	// 静态配置
	Url     string
	Headers map[string]string
	Body    any
	// contains filtered or unexported fields
}

func (*PutRequest) HttpMethod

func (req *PutRequest) HttpMethod() string

func (*PutRequest) Request

func (req *PutRequest) Request(request *http_client.Request) error

func (*PutRequest) RequestUrl

func (req *PutRequest) RequestUrl() string

func (*PutRequest) Response

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

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)

Jump to

Keyboard shortcuts

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