httpapi

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var OpenAPIDoc []byte

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type AttributeOption

type AttributeOption struct {
	// Display name of the option.
	Name string `json:"name"`
	// URL-friendly identifier.
	Slug string `json:"slug"`
	// Color hex code (for color attributes).
	ColorCode OptString `json:"colorCode"`
	// Sort order for display.
	SortOrder int `json:"sortOrder"`
}

Attribute option for single/multiple type attributes. Ref: #/components/schemas/AttributeOption

func (*AttributeOption) Decode

func (s *AttributeOption) Decode(d *jx.Decoder) error

Decode decodes AttributeOption from json.

func (*AttributeOption) Encode

func (s *AttributeOption) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*AttributeOption) GetColorCode

func (s *AttributeOption) GetColorCode() OptString

GetColorCode returns the value of ColorCode.

func (*AttributeOption) GetName

func (s *AttributeOption) GetName() string

GetName returns the value of Name.

func (*AttributeOption) GetSlug

func (s *AttributeOption) GetSlug() string

GetSlug returns the value of Slug.

func (*AttributeOption) GetSortOrder

func (s *AttributeOption) GetSortOrder() int

GetSortOrder returns the value of SortOrder.

func (*AttributeOption) MarshalJSON

func (s *AttributeOption) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*AttributeOption) SetColorCode

func (s *AttributeOption) SetColorCode(val OptString)

SetColorCode sets the value of ColorCode.

func (*AttributeOption) SetName

func (s *AttributeOption) SetName(val string)

SetName sets the value of Name.

func (*AttributeOption) SetSlug

func (s *AttributeOption) SetSlug(val string)

SetSlug sets the value of Slug.

func (*AttributeOption) SetSortOrder

func (s *AttributeOption) SetSortOrder(val int)

SetSortOrder sets the value of SortOrder.

func (*AttributeOption) UnmarshalJSON

func (s *AttributeOption) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type AttributeRole

type AttributeRole string

How an attribute is used in a category. Ref: #/components/schemas/AttributeRole

const (
	AttributeRoleVariant       AttributeRole = "variant"
	AttributeRoleSpecification AttributeRole = "specification"
)

func (AttributeRole) AllValues

func (AttributeRole) AllValues() []AttributeRole

AllValues returns all AttributeRole values.

func (*AttributeRole) Decode

func (s *AttributeRole) Decode(d *jx.Decoder) error

Decode decodes AttributeRole from json.

func (AttributeRole) Encode

func (s AttributeRole) Encode(e *jx.Encoder)

Encode encodes AttributeRole as json.

func (AttributeRole) MarshalJSON

func (s AttributeRole) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (AttributeRole) MarshalText

func (s AttributeRole) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*AttributeRole) UnmarshalJSON

func (s *AttributeRole) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AttributeRole) UnmarshalText

func (s *AttributeRole) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (AttributeRole) Validate

func (s AttributeRole) Validate() error

type AttributeType

type AttributeType string

Type of the attribute. Ref: #/components/schemas/AttributeType

const (
	AttributeTypeSingle   AttributeType = "single"
	AttributeTypeMultiple AttributeType = "multiple"
	AttributeTypeRange    AttributeType = "range"
	AttributeTypeBoolean  AttributeType = "boolean"
	AttributeTypeText     AttributeType = "text"
)

func (AttributeType) AllValues

func (AttributeType) AllValues() []AttributeType

AllValues returns all AttributeType values.

func (*AttributeType) Decode

func (s *AttributeType) Decode(d *jx.Decoder) error

Decode decodes AttributeType from json.

func (AttributeType) Encode

func (s AttributeType) Encode(e *jx.Encoder)

Encode encodes AttributeType as json.

func (AttributeType) MarshalJSON

func (s AttributeType) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (AttributeType) MarshalText

func (s AttributeType) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*AttributeType) UnmarshalJSON

func (s *AttributeType) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AttributeType) UnmarshalText

func (s *AttributeType) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (AttributeType) Validate

func (s AttributeType) Validate() error

type CategoryAttribute

type CategoryAttribute struct {
	// Unique attribute identifier (UUID).
	AttributeId string `json:"attributeId"`
	// Display name of the attribute (denormalized from catalog-service).
	Name string `json:"name"`
	// URL-friendly identifier (denormalized from catalog-service).
	Slug string        `json:"slug"`
	Type AttributeType `json:"type"`
	// Unit of measurement for range attributes (denormalized from catalog-service).
	Unit OptString `json:"unit"`
	// Available options for single/multiple type attributes (denormalized from catalog-service).
	Options []AttributeOption `json:"options"`
	Role    AttributeRole     `json:"role"`
	// Sort order for display.
	SortOrder int `json:"sortOrder"`
	// Whether the attribute is filterable for this category.
	Filterable bool `json:"filterable"`
	// Whether the attribute is searchable for this category.
	Searchable bool `json:"searchable"`
}

Ref: #/components/schemas/CategoryAttribute

func (*CategoryAttribute) Decode

func (s *CategoryAttribute) Decode(d *jx.Decoder) error

Decode decodes CategoryAttribute from json.

func (*CategoryAttribute) Encode

func (s *CategoryAttribute) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CategoryAttribute) GetAttributeId

func (s *CategoryAttribute) GetAttributeId() string

GetAttributeId returns the value of AttributeId.

func (*CategoryAttribute) GetFilterable

func (s *CategoryAttribute) GetFilterable() bool

GetFilterable returns the value of Filterable.

func (*CategoryAttribute) GetName

func (s *CategoryAttribute) GetName() string

GetName returns the value of Name.

func (*CategoryAttribute) GetOptions

func (s *CategoryAttribute) GetOptions() []AttributeOption

GetOptions returns the value of Options.

func (*CategoryAttribute) GetRole

func (s *CategoryAttribute) GetRole() AttributeRole

GetRole returns the value of Role.

func (*CategoryAttribute) GetSearchable

func (s *CategoryAttribute) GetSearchable() bool

GetSearchable returns the value of Searchable.

func (*CategoryAttribute) GetSlug

func (s *CategoryAttribute) GetSlug() string

GetSlug returns the value of Slug.

func (*CategoryAttribute) GetSortOrder

func (s *CategoryAttribute) GetSortOrder() int

GetSortOrder returns the value of SortOrder.

func (*CategoryAttribute) GetType

func (s *CategoryAttribute) GetType() AttributeType

GetType returns the value of Type.

func (*CategoryAttribute) GetUnit

func (s *CategoryAttribute) GetUnit() OptString

GetUnit returns the value of Unit.

func (*CategoryAttribute) MarshalJSON

func (s *CategoryAttribute) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CategoryAttribute) SetAttributeId

func (s *CategoryAttribute) SetAttributeId(val string)

SetAttributeId sets the value of AttributeId.

func (*CategoryAttribute) SetFilterable

func (s *CategoryAttribute) SetFilterable(val bool)

SetFilterable sets the value of Filterable.

func (*CategoryAttribute) SetName

func (s *CategoryAttribute) SetName(val string)

SetName sets the value of Name.

func (*CategoryAttribute) SetOptions

func (s *CategoryAttribute) SetOptions(val []AttributeOption)

SetOptions sets the value of Options.

func (*CategoryAttribute) SetRole

func (s *CategoryAttribute) SetRole(val AttributeRole)

SetRole sets the value of Role.

func (*CategoryAttribute) SetSearchable

func (s *CategoryAttribute) SetSearchable(val bool)

SetSearchable sets the value of Searchable.

func (*CategoryAttribute) SetSlug

func (s *CategoryAttribute) SetSlug(val string)

SetSlug sets the value of Slug.

func (*CategoryAttribute) SetSortOrder

func (s *CategoryAttribute) SetSortOrder(val int)

SetSortOrder sets the value of SortOrder.

func (*CategoryAttribute) SetType

func (s *CategoryAttribute) SetType(val AttributeType)

SetType sets the value of Type.

func (*CategoryAttribute) SetUnit

func (s *CategoryAttribute) SetUnit(val OptString)

SetUnit sets the value of Unit.

func (*CategoryAttribute) UnmarshalJSON

func (s *CategoryAttribute) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CategoryAttribute) Validate

func (s *CategoryAttribute) Validate() error

type CategoryResponse

type CategoryResponse struct {
	ID         string              `json:"id"`
	Name       string              `json:"name"`
	Attributes []CategoryAttribute `json:"attributes"`
}

Ref: #/components/schemas/CategoryResponse

func (*CategoryResponse) Decode

func (s *CategoryResponse) Decode(d *jx.Decoder) error

Decode decodes CategoryResponse from json.

func (*CategoryResponse) Encode

func (s *CategoryResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CategoryResponse) GetAttributes

func (s *CategoryResponse) GetAttributes() []CategoryAttribute

GetAttributes returns the value of Attributes.

func (*CategoryResponse) GetID

func (s *CategoryResponse) GetID() string

GetID returns the value of ID.

func (*CategoryResponse) GetName

func (s *CategoryResponse) GetName() string

GetName returns the value of Name.

func (*CategoryResponse) MarshalJSON

func (s *CategoryResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CategoryResponse) SetAttributes

func (s *CategoryResponse) SetAttributes(val []CategoryAttribute)

SetAttributes sets the value of Attributes.

func (*CategoryResponse) SetID

func (s *CategoryResponse) SetID(val string)

SetID sets the value of ID.

func (*CategoryResponse) SetName

func (s *CategoryResponse) SetName(val string)

SetName sets the value of Name.

func (*CategoryResponse) UnmarshalJSON

func (s *CategoryResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CategoryResponse) Validate

func (s *CategoryResponse) Validate() error

type Client

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

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) GetAllActiveCategories

func (c *Client) GetAllActiveCategories(ctx context.Context) (GetAllActiveCategoriesRes, error)

GetAllActiveCategories invokes getAllActiveCategories operation.

Get a list of all active categories.

GET /v1/category/list-active-categories

func (*Client) GetCategoryById

func (c *Client) GetCategoryById(ctx context.Context, params GetCategoryByIdParams) (GetCategoryByIdRes, error)

GetCategoryById invokes getCategoryById operation.

Get a category by ID.

GET /v1/category/get/{id}

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type GetAllActiveCategoriesOKApplicationJSON

type GetAllActiveCategoriesOKApplicationJSON []CategoryResponse

func (*GetAllActiveCategoriesOKApplicationJSON) Decode

Decode decodes GetAllActiveCategoriesOKApplicationJSON from json.

func (GetAllActiveCategoriesOKApplicationJSON) Encode

Encode encodes GetAllActiveCategoriesOKApplicationJSON as json.

func (GetAllActiveCategoriesOKApplicationJSON) MarshalJSON

func (s GetAllActiveCategoriesOKApplicationJSON) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*GetAllActiveCategoriesOKApplicationJSON) UnmarshalJSON

func (s *GetAllActiveCategoriesOKApplicationJSON) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (GetAllActiveCategoriesOKApplicationJSON) Validate

type GetAllActiveCategoriesRes

type GetAllActiveCategoriesRes interface {
	// contains filtered or unexported methods
}

type GetCategoryByIdInternalServerError

type GetCategoryByIdInternalServerError Problem

func (*GetCategoryByIdInternalServerError) Decode

Decode decodes GetCategoryByIdInternalServerError from json.

func (*GetCategoryByIdInternalServerError) Encode

Encode encodes GetCategoryByIdInternalServerError as json.

func (*GetCategoryByIdInternalServerError) MarshalJSON

func (s *GetCategoryByIdInternalServerError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*GetCategoryByIdInternalServerError) UnmarshalJSON

func (s *GetCategoryByIdInternalServerError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type GetCategoryByIdNotFound

type GetCategoryByIdNotFound Problem

func (*GetCategoryByIdNotFound) Decode

func (s *GetCategoryByIdNotFound) Decode(d *jx.Decoder) error

Decode decodes GetCategoryByIdNotFound from json.

func (*GetCategoryByIdNotFound) Encode

func (s *GetCategoryByIdNotFound) Encode(e *jx.Encoder)

Encode encodes GetCategoryByIdNotFound as json.

func (*GetCategoryByIdNotFound) MarshalJSON

func (s *GetCategoryByIdNotFound) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*GetCategoryByIdNotFound) UnmarshalJSON

func (s *GetCategoryByIdNotFound) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type GetCategoryByIdParams

type GetCategoryByIdParams struct {
	ID string
}

GetCategoryByIdParams is parameters of getCategoryById operation.

type GetCategoryByIdRes

type GetCategoryByIdRes interface {
	// contains filtered or unexported methods
}

type Handler

type Handler interface {
	// GetAllActiveCategories implements getAllActiveCategories operation.
	//
	// Get a list of all active categories.
	//
	// GET /v1/category/list-active-categories
	GetAllActiveCategories(ctx context.Context) (GetAllActiveCategoriesRes, error)
	// GetCategoryById implements getCategoryById operation.
	//
	// Get a category by ID.
	//
	// GET /v1/category/get/{id}
	GetCategoryById(ctx context.Context, params GetCategoryByIdParams) (GetCategoryByIdRes, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// GetAllActiveCategories invokes getAllActiveCategories operation.
	//
	// Get a list of all active categories.
	//
	// GET /v1/category/list-active-categories
	GetAllActiveCategories(ctx context.Context) (GetAllActiveCategoriesRes, error)
	// GetCategoryById invokes getCategoryById operation.
	//
	// Get a category by ID.
	//
	// GET /v1/category/get/{id}
	GetCategoryById(ctx context.Context, params GetCategoryByIdParams) (GetCategoryByIdRes, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Labeler

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

Labeler is used to allow adding custom attributes to the server request metrics.

func LabelerFromContext

func LabelerFromContext(ctx context.Context) (*Labeler, bool)

LabelerFromContext retrieves the Labeler from the provided context, if present.

If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.

func (*Labeler) Add

func (l *Labeler) Add(attrs ...attribute.KeyValue)

Add attributes to the Labeler.

func (*Labeler) AttributeSet

func (l *Labeler) AttributeSet() attribute.Set

AttributeSet returns the attributes added to the Labeler as an attribute.Set.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	GetAllActiveCategoriesOperation OperationName = "GetAllActiveCategories"
	GetCategoryByIdOperation        OperationName = "GetCategoryById"
)

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

func (o *OptString) Decode(d *jx.Decoder) error

Decode decodes string from json.

func (OptString) Encode

func (o OptString) Encode(e *jx.Encoder)

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

func (s OptString) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

Or returns value if set, or given parameter if does not.

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

func (s *OptString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptURI

type OptURI struct {
	Value url.URL
	Set   bool
}

OptURI is optional url.URL.

func NewOptURI

func NewOptURI(v url.URL) OptURI

NewOptURI returns new OptURI with value set to v.

func (*OptURI) Decode

func (o *OptURI) Decode(d *jx.Decoder) error

Decode decodes url.URL from json.

func (OptURI) Encode

func (o OptURI) Encode(e *jx.Encoder)

Encode encodes url.URL as json.

func (OptURI) Get

func (o OptURI) Get() (v url.URL, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptURI) IsSet

func (o OptURI) IsSet() bool

IsSet returns true if OptURI was set.

func (OptURI) MarshalJSON

func (s OptURI) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptURI) Or

func (o OptURI) Or(d url.URL) url.URL

Or returns value if set, or given parameter if does not.

func (*OptURI) Reset

func (o *OptURI) Reset()

Reset unsets value.

func (*OptURI) SetTo

func (o *OptURI) SetTo(v url.URL)

SetTo sets value to v.

func (*OptURI) UnmarshalJSON

func (s *OptURI) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithAttributes

func WithAttributes(attributes ...attribute.KeyValue) Option

WithAttributes specifies default otel attributes.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type Problem

type Problem struct {
	Type     url.URL             `json:"type"`
	Title    string              `json:"title"`
	Status   int                 `json:"status"`
	Detail   OptString           `json:"detail"`
	Instance OptURI              `json:"instance"`
	TraceId  OptString           `json:"traceId"`
	Errors   []ProblemErrorsItem `json:"errors"`
}

RFC7807 Problem Details. Ref: #/components/schemas/Problem

func (*Problem) Decode

func (s *Problem) Decode(d *jx.Decoder) error

Decode decodes Problem from json.

func (*Problem) Encode

func (s *Problem) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*Problem) GetDetail

func (s *Problem) GetDetail() OptString

GetDetail returns the value of Detail.

func (*Problem) GetErrors

func (s *Problem) GetErrors() []ProblemErrorsItem

GetErrors returns the value of Errors.

func (*Problem) GetInstance

func (s *Problem) GetInstance() OptURI

GetInstance returns the value of Instance.

func (*Problem) GetStatus

func (s *Problem) GetStatus() int

GetStatus returns the value of Status.

func (*Problem) GetTitle

func (s *Problem) GetTitle() string

GetTitle returns the value of Title.

func (*Problem) GetTraceId

func (s *Problem) GetTraceId() OptString

GetTraceId returns the value of TraceId.

func (*Problem) GetType

func (s *Problem) GetType() url.URL

GetType returns the value of Type.

func (*Problem) MarshalJSON

func (s *Problem) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*Problem) SetDetail

func (s *Problem) SetDetail(val OptString)

SetDetail sets the value of Detail.

func (*Problem) SetErrors

func (s *Problem) SetErrors(val []ProblemErrorsItem)

SetErrors sets the value of Errors.

func (*Problem) SetInstance

func (s *Problem) SetInstance(val OptURI)

SetInstance sets the value of Instance.

func (*Problem) SetStatus

func (s *Problem) SetStatus(val int)

SetStatus sets the value of Status.

func (*Problem) SetTitle

func (s *Problem) SetTitle(val string)

SetTitle sets the value of Title.

func (*Problem) SetTraceId

func (s *Problem) SetTraceId(val OptString)

SetTraceId sets the value of TraceId.

func (*Problem) SetType

func (s *Problem) SetType(val url.URL)

SetType sets the value of Type.

func (*Problem) UnmarshalJSON

func (s *Problem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type ProblemErrorsItem

type ProblemErrorsItem struct {
	Field   OptString `json:"field"`
	Message OptString `json:"message"`
}

func (*ProblemErrorsItem) Decode

func (s *ProblemErrorsItem) Decode(d *jx.Decoder) error

Decode decodes ProblemErrorsItem from json.

func (*ProblemErrorsItem) Encode

func (s *ProblemErrorsItem) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ProblemErrorsItem) GetField

func (s *ProblemErrorsItem) GetField() OptString

GetField returns the value of Field.

func (*ProblemErrorsItem) GetMessage

func (s *ProblemErrorsItem) GetMessage() OptString

GetMessage returns the value of Message.

func (*ProblemErrorsItem) MarshalJSON

func (s *ProblemErrorsItem) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ProblemErrorsItem) SetField

func (s *ProblemErrorsItem) SetField(val OptString)

SetField sets the value of Field.

func (*ProblemErrorsItem) SetMessage

func (s *ProblemErrorsItem) SetMessage(val OptString)

SetMessage sets the value of Message.

func (*ProblemErrorsItem) UnmarshalJSON

func (s *ProblemErrorsItem) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Route

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

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationGroup

func (r Route) OperationGroup() string

OperationGroup returns the x-ogen-operation-group value.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type Server

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

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func ProvideServer added in v1.0.14

func ProvideServer(
	handler Handler,
	tracerProvider trace.TracerProvider,
	meterProvider metric.MeterProvider,
	middlewares []middleware.Middleware,
	errorHandler ogenerrors.ErrorHandler,
) (*Server, error)

ProvideServer creates an ogen server for fx DI.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) GetAllActiveCategories

func (UnimplementedHandler) GetAllActiveCategories(ctx context.Context) (r GetAllActiveCategoriesRes, _ error)

GetAllActiveCategories implements getAllActiveCategories operation.

Get a list of all active categories.

GET /v1/category/list-active-categories

func (UnimplementedHandler) GetCategoryById

GetCategoryById implements getCategoryById operation.

Get a category by ID.

GET /v1/category/get/{id}

Jump to

Keyboard shortcuts

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