gateway

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 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(requestBuilder *RequestBuilder, tenantIDField string, userIDField string) error

func AddQueryParamsTenantIDAndUserID added in v0.4.0

func AddQueryParamsTenantIDAndUserID(requestBuilder *RequestBuilder, tenantIDField string, userIDField string) error

func DestroyGateway

func DestroyGateway(gw *Gateway)

Types

type BeforeRequestCallback added in v0.10.5

type BeforeRequestCallback func(requestBuilder *RequestBuilder) error

type Builder

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

func (*Builder) AddRoute added in v0.10.5

func (builder *Builder) AddRoute(httpMethod string, relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) AddRouteWithTenantIDAndUserID added in v0.10.5

func (builder *Builder) AddRouteWithTenantIDAndUserID(httpMethod string, relativePath string, tenantIDField string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) DeleteRoute added in v0.10.5

func (builder *Builder) DeleteRoute(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) DeleteRouteWithTenantID added in v0.10.5

func (builder *Builder) DeleteRouteWithTenantID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) DeleteRouteWithTenantIDAndUserID added in v0.10.5

func (builder *Builder) DeleteRouteWithTenantIDAndUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) DeleteRouteWithTenantIDAndUserIDCommon added in v0.10.5

func (builder *Builder) DeleteRouteWithTenantIDAndUserIDCommon(relativePath string, tenantIDField string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) DeleteRouteWithTenantIDCommon added in v0.10.5

func (builder *Builder) DeleteRouteWithTenantIDCommon(relativePath string, tenantIDField string, handler Handler, middlewares ...Handler)

func (*Builder) DeleteRouteWithUserID added in v0.10.5

func (builder *Builder) DeleteRouteWithUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) DeleteRouteWithUserIDCommon added in v0.10.5

func (builder *Builder) DeleteRouteWithUserIDCommon(relativePath string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) GetRoute added in v0.10.5

func (builder *Builder) GetRoute(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) GetRouteWithTenantID added in v0.10.5

func (builder *Builder) GetRouteWithTenantID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) GetRouteWithTenantIDAndUserID added in v0.10.5

func (builder *Builder) GetRouteWithTenantIDAndUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) GetRouteWithTenantIDAndUserIDCommon added in v0.10.5

func (builder *Builder) GetRouteWithTenantIDAndUserIDCommon(relativePath string, tenantIDField string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) GetRouteWithTenantIDCommon added in v0.10.5

func (builder *Builder) GetRouteWithTenantIDCommon(relativePath string, tenantIDField string, handler Handler, middlewares ...Handler)

func (*Builder) GetRouteWithUserID added in v0.10.5

func (builder *Builder) GetRouteWithUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) GetRouteWithUserIDCommon added in v0.10.5

func (builder *Builder) GetRouteWithUserIDCommon(relativePath string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) PostRoute added in v0.10.5

func (builder *Builder) PostRoute(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PostRouteWithTenantID added in v0.10.5

func (builder *Builder) PostRouteWithTenantID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PostRouteWithTenantIDAndUserID added in v0.10.5

func (builder *Builder) PostRouteWithTenantIDAndUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PostRouteWithTenantIDAndUserIDCommon added in v0.10.5

func (builder *Builder) PostRouteWithTenantIDAndUserIDCommon(relativePath string, tenantIDField string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) PostRouteWithTenantIDCommon added in v0.10.5

func (builder *Builder) PostRouteWithTenantIDCommon(relativePath string, tenantIDField string, handler Handler, middlewares ...Handler)

func (*Builder) PostRouteWithUserID added in v0.10.5

func (builder *Builder) PostRouteWithUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PostRouteWithUserIDCommon added in v0.10.5

func (builder *Builder) PostRouteWithUserIDCommon(relativePath string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) PutRoute added in v0.10.5

func (builder *Builder) PutRoute(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PutRouteWithTenantID added in v0.10.5

func (builder *Builder) PutRouteWithTenantID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PutRouteWithTenantIDAndUserID added in v0.10.5

func (builder *Builder) PutRouteWithTenantIDAndUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PutRouteWithTenantIDAndUserIDCommon added in v0.10.5

func (builder *Builder) PutRouteWithTenantIDAndUserIDCommon(relativePath string, tenantIDField string, userIDField string, handler Handler, middlewares ...Handler)

func (*Builder) PutRouteWithTenantIDCommon added in v0.10.5

func (builder *Builder) PutRouteWithTenantIDCommon(relativePath string, tenantIDField string, handler Handler, middlewares ...Handler)

func (*Builder) PutRouteWithUserID added in v0.10.5

func (builder *Builder) PutRouteWithUserID(relativePath string, handler Handler, middlewares ...Handler)

func (*Builder) PutRouteWithUserIDCommon added in v0.10.5

func (builder *Builder) PutRouteWithUserIDCommon(relativePath string, userIDField string, handler Handler, middlewares ...Handler)

type DeleteRequest

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

func (*DeleteRequest) Request

func (req *DeleteRequest) Request(c *api.Context, request *http_client.Request) (Request, 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, middlewares ...Handler) *Builder

type GetRequest

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

func (*GetRequest) Request

func (req *GetRequest) Request(c *api.Context, request *http_client.Request) (Request, error)

func (*GetRequest) Response

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

type Handler added in v0.10.5

type Handler func(requestBuilder *RequestBuilder)

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

func (*PostRequest) Request

func (req *PostRequest) Request(c *api.Context, request *http_client.Request) (Request, error)

func (*PostRequest) Response

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

type PutRequest

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

func (*PutRequest) Request

func (req *PutRequest) Request(c *api.Context, request *http_client.Request) (Request, error)

func (*PutRequest) Response

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

type Request added in v0.10.5

type Request interface {
	Request(c *api.Context, request *http_client.Request) (Request, error)
	Response() *http_client.Response
}

type RequestBuilder added in v0.10.5

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

func (*RequestBuilder) Context added in v0.10.5

func (builder *RequestBuilder) Context() *api.Context

func (*RequestBuilder) Delete added in v0.10.5

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

func (*RequestBuilder) Get added in v0.10.5

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

func (*RequestBuilder) GetResultMapValue added in v0.10.5

func (builder *RequestBuilder) GetResultMapValue(key string) any

func (*RequestBuilder) HistoryRequests added in v0.10.5

func (builder *RequestBuilder) HistoryRequests() []Request

func (*RequestBuilder) Post added in v0.10.5

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

func (*RequestBuilder) Put added in v0.10.5

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

func (*RequestBuilder) Request added in v0.10.5

func (builder *RequestBuilder) Request()

func (*RequestBuilder) ResponseError added in v0.10.5

func (builder *RequestBuilder) ResponseError(err error)

func (*RequestBuilder) ResponseErrorCallback added in v0.10.5

func (builder *RequestBuilder) ResponseErrorCallback(responseErrorCallback ResponseErrorCallback) *RequestBuilder

func (*RequestBuilder) ResponseSuccessCallback added in v0.10.5

func (builder *RequestBuilder) ResponseSuccessCallback(responseSuccessCallback ResponseSuccessCallback) *RequestBuilder

func (*RequestBuilder) SetResultMapValue added in v0.10.5

func (builder *RequestBuilder) SetResultMapValue(key string, value any)

type RequestOption added in v0.10.1

type RequestOption func(options *RequestOptions)

func WithBeforeRequestCallback added in v0.10.5

func WithBeforeRequestCallback(callback BeforeRequestCallback) RequestOption

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(requestBuilder *RequestBuilder, response *http_client.Response) error

type ResponseErrorCallback added in v0.4.0

type ResponseErrorCallback func(requestBuilder *RequestBuilder, err error)

type ResponseSuccessCallback added in v0.4.0

type ResponseSuccessCallback func(requestBuilder *RequestBuilder)

Jump to

Keyboard shortcuts

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