restapi

package
v0.0.0-...-33e56a9 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package restapi Customer Database Management API

An API which supports creation, deletion, listing etc of customers and products
Schemes:
  http
  https
Host: localhost:8000
BasePath: /api/v1.0
Version: 1.0.0
License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html
Contact: <diego@cyclops-labs.io>

Consumes:
  - application/json

Produces:
  - application/json

swagger:meta

Index

Constants

View Source
const AuthKey contextKey = "Auth"

Variables

View Source
var (
	// SwaggerJSON embedded version of the swagger document used at generation time
	SwaggerJSON json.RawMessage
	// FlatSwaggerJSON embedded flattened version of the swagger document used at generation time
	FlatSwaggerJSON json.RawMessage
)

Functions

func Handler

func Handler(c Config) (http.Handler, error)

Handler returns an http.Handler given the handler configuration It mounts all the business logic implementers in the right routing.

func HandlerAPI

HandlerAPI returns an http.Handler given the handler configuration and the corresponding *CustomerDatabaseManagement instance. It mounts all the business logic implementers in the right routing.

Types

type Config

type Config struct {
	CustomerManagementAPI
	ProductManagementAPI
	ResellerManagementAPI
	StatusManagementAPI
	TriggerManagementAPI
	Logger func(string, ...interface{})
	// InnerMiddleware is for the handler executors. These do not apply to the swagger.json document.
	// The middleware executes after routing but before authentication, binding and validation
	InnerMiddleware func(http.Handler) http.Handler

	// Authorizer is used to authorize a request after the Auth function was called using the "Auth*" functions
	// and the principal was stored in the context in the "AuthKey" context value.
	Authorizer func(*http.Request) error

	// AuthAPIKeyHeader Applies when the "X-API-KEY" header is set
	AuthAPIKeyHeader func(token string) (interface{}, error)

	// AuthAPIKeyParam Applies when the "api_key" query is set
	AuthAPIKeyParam func(token string) (interface{}, error)

	// AuthKeycloak For OAuth2 authentication
	AuthKeycloak func(token string, scopes []string) (interface{}, error)
}

Config is configuration for Handler

type CustomerManagementAPI

type CustomerManagementAPI interface {
	/* AddCustomer Insert a new customer in the system. */
	AddCustomer(ctx context.Context, params customer_management.AddCustomerParams) middleware.Responder

	/* GetCustomer Return the information about the customer with the given id */
	GetCustomer(ctx context.Context, params customer_management.GetCustomerParams) middleware.Responder

	/* ListCustomers List all the customers in the system */
	ListCustomers(ctx context.Context, params customer_management.ListCustomersParams) middleware.Responder

	/* UpdateCustomer Updates the information of the customer with the given id */
	UpdateCustomer(ctx context.Context, params customer_management.UpdateCustomerParams) middleware.Responder
}

CustomerManagementAPI

type ProductManagementAPI

type ProductManagementAPI interface {
	/* AddProduct Insert a new product in the system. */
	AddProduct(ctx context.Context, params product_management.AddProductParams) middleware.Responder

	/* GetProduct Return the information about the product with the given id */
	GetProduct(ctx context.Context, params product_management.GetProductParams) middleware.Responder

	/* ListProducts List all the products in the system */
	ListProducts(ctx context.Context, params product_management.ListProductsParams) middleware.Responder

	/* UpdateProduct Updates the information of the product with the given id */
	UpdateProduct(ctx context.Context, params product_management.UpdateProductParams) middleware.Responder
}

ProductManagementAPI

type ResellerManagementAPI

type ResellerManagementAPI interface {
	/* AddReseller Insert a new reseller in the system. */
	AddReseller(ctx context.Context, params reseller_management.AddResellerParams) middleware.Responder

	/* GetReseller Return the information about the reseller with the given id */
	GetReseller(ctx context.Context, params reseller_management.GetResellerParams) middleware.Responder

	/* ListResellers List all the resellers in the system */
	ListResellers(ctx context.Context, params reseller_management.ListResellersParams) middleware.Responder

	/* UpdateReseller Updates the information of the reseller with the given id */
	UpdateReseller(ctx context.Context, params reseller_management.UpdateResellerParams) middleware.Responder
}

ResellerManagementAPI

type StatusManagementAPI

type StatusManagementAPI interface {
	/* GetStatus Basic status of the system */
	GetStatus(ctx context.Context, params status_management.GetStatusParams) middleware.Responder

	/* ShowStatus Basic status of the system */
	ShowStatus(ctx context.Context, params status_management.ShowStatusParams) middleware.Responder
}

StatusManagementAPI

type TriggerManagementAPI

type TriggerManagementAPI interface {
	/* ExecSample Sample task trigger */
	ExecSample(ctx context.Context, params trigger_management.ExecSampleParams) middleware.Responder
}

TriggerManagementAPI

Jump to

Keyboard shortcuts

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