v1

package
v0.0.0-...-e4c28f5 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package v1 provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RegisterHandlers

func RegisterHandlers(router gin.IRouter, si ServerInterface)

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options GinServerOptions)

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type Error

type Error struct {
	Code      int        `json:"code"`
	Domain    *string    `json:"domain,omitempty"`
	Message   string     `json:"message"`
	Reason    *string    `json:"reason,omitempty"`
	Timestamp *time.Time `json:"timestamp,omitempty"`
}

Error General API Error Response

type GetLivenessParams

type GetLivenessParams struct {
	// XRequestID X-Request-ID
	XRequestID *XRequestID `json:"X-Request-ID,omitempty"`
}

GetLivenessParams defines parameters for GetLiveness.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type Liveness

type Liveness struct {
	Message *string         `json:"message,omitempty" validate:"required"`
	Status  *LivenessStatus `json:"status,omitempty" validate:"required,oneof=UP DOWN"`
}

Liveness defines model for Liveness.

type LivenessStatus

type LivenessStatus string

LivenessStatus defines model for Liveness.Status.

const (
	DOWN LivenessStatus = "DOWN"
	UP   LivenessStatus = "UP"
)

Defines values for LivenessStatus.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type MpesaCallbackMessage

type MpesaCallbackMessage struct {
	BillRefNumber     *string `json:"billRefNumber,omitempty"`
	BusinessShortCode *string `json:"businessShortCode,omitempty"`
	FirstName         *string `json:"firstName,omitempty"`
	InvoiceNumber     *string `json:"invoiceNumber,omitempty"`
	LastName          *string `json:"lastName,omitempty"`
	MiddleName        *string `json:"middleName,omitempty"`
	Msisdn            *string `json:"msisdn,omitempty"`
	OrgAccountBalance *string `json:"orgAccountBalance,omitempty"`
	ResultCode        *string `json:"resultCode,omitempty"`
	ResultDesc        *string `json:"resultDesc,omitempty"`
	ThirdPartyTransID *string `json:"thirdPartyTransID,omitempty"`
	TransAmount       *string `json:"transAmount,omitempty"`
	TransID           *string `json:"transID,omitempty"`
	TransactionStatus *string `json:"transactionStatus,omitempty"`
	TransactionType   *string `json:"transactionType,omitempty"`
}

MpesaCallbackMessage defines model for MpesaCallbackMessage.

type N400

type N400 = interface{}

N400 Bad Request

type N401

type N401 = interface{}

N401 Unauthorized

type N403

type N403 = interface{}

N403 Forbidden

type N404

type N404 = interface{}

N404 Not Found

type N500

type N500 = interface{}

N500 Internal Server Error

type PaymentsServer

type PaymentsServer struct {
	Log *zerolog.Logger
	// contains filtered or unexported fields
}

func NewPaymentsServer

func NewPaymentsServer(log *zerolog.Logger, build string) *PaymentsServer

NewPaymentsServer constructs a new PaymentsServer.

func (*PaymentsServer) GetLiveness

func (p *PaymentsServer) GetLiveness(c *gin.Context, params GetLivenessParams)

GetLiveness returns a simple UP message to indicate the service is running.

func (*PaymentsServer) PostPaymentCallback

func (p *PaymentsServer) PostPaymentCallback(c *gin.Context)

PostPaymentCallback handles the callback from the payment provider.

type PostPaymentCallbackJSONRequestBody

type PostPaymentCallbackJSONRequestBody = MpesaCallbackMessage

PostPaymentCallbackJSONRequestBody defines body for PostPaymentCallback for application/json ContentType.

type ServerInterface

type ServerInterface interface {
	// Get liveness status
	// (GET /liveness)
	GetLiveness(c *gin.Context, params GetLivenessParams)
	// Callback endpoint for M-Pesa payment updates
	// (POST /payments/callback)
	PostPaymentCallback(c *gin.Context)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) GetLiveness

func (siw *ServerInterfaceWrapper) GetLiveness(c *gin.Context)

GetLiveness operation middleware

func (*ServerInterfaceWrapper) PostPaymentCallback

func (siw *ServerInterfaceWrapper) PostPaymentCallback(c *gin.Context)

PostPaymentCallback operation middleware

type XRequestID

type XRequestID = XRequestIdType

XRequestID X-RequestID

type XRequestIdType

type XRequestIdType = uuid.UUID

XRequestIdType X-RequestID

Jump to

Keyboard shortcuts

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