Merge branch 'beckn-onix-v1.0-develop' of https://github.com/beckn/beckn-onix into feature/core

This commit is contained in:
MohitKatare-protean
2025-03-28 22:18:39 +05:30
29 changed files with 3473 additions and 323 deletions

View File

@@ -3,14 +3,22 @@ package definition
import (
"context"
"net/url"
"github.com/beckn/beckn-onix/pkg/model"
)
type Router interface {
Route(ctx context.Context, url *url.URL, body []byte) (*model.Route, error)
// Route defines the structure for the Route returned.
type Route struct {
TargetType string // "url" or "msgq" or "bap" or "bpp"
PublisherID string // For message queues
URL *url.URL // For API calls
}
// RouterProvider initializes the a new Router instance with the given config.
type RouterProvider interface {
New(ctx context.Context, cfg map[string]string) (Router, error)
New(ctx context.Context, config map[string]string) (Router, func() error, error)
}
// Router defines the interface for routing requests.
type Router interface {
// Route determines the routing destination based on the request context.
Route(ctx context.Context, url *url.URL, body []byte) (*Route, error)
}

View File

@@ -7,7 +7,7 @@ import (
// SchemaValidator interface for schema validation.
type SchemaValidator interface {
Validate(ctx context.Context, url *url.URL, reqBody []byte) error
Validate(ctx context.Context, url *url.URL, payload []byte) error
}
// SchemaValidatorProvider interface for creating validators.