api

package
v1.18.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

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

WithServerURL sets context key to override server URL.

Types

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) CreateWorkflowStatuses

func (c *Client) CreateWorkflowStatuses(ctx context.Context, request *CreateWorkflowStatusesReq) (*CreateWorkflowStatusesOK, error)

CreateWorkflowStatuses invokes createWorkflowStatuses operation.

Create workflow statuses.

POST /workflow/statuses

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 CreateWorkflowStatusesOK

type CreateWorkflowStatusesOK struct {
	Created OptInt `json:"created"`
}

func (*CreateWorkflowStatusesOK) Decode

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

Decode decodes CreateWorkflowStatusesOK from json.

func (*CreateWorkflowStatusesOK) Encode

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

Encode implements json.Marshaler.

func (*CreateWorkflowStatusesOK) GetCreated

func (s *CreateWorkflowStatusesOK) GetCreated() OptInt

GetCreated returns the value of Created.

func (*CreateWorkflowStatusesOK) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*CreateWorkflowStatusesOK) SetCreated

func (s *CreateWorkflowStatusesOK) SetCreated(val OptInt)

SetCreated sets the value of Created.

func (*CreateWorkflowStatusesOK) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateWorkflowStatusesReq

type CreateWorkflowStatusesReq struct {
	Statuses []WorkflowStatus `json:"statuses"`
}

func (*CreateWorkflowStatusesReq) Decode

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

Decode decodes CreateWorkflowStatusesReq from json.

func (*CreateWorkflowStatusesReq) Encode

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

Encode implements json.Marshaler.

func (*CreateWorkflowStatusesReq) GetStatuses

func (s *CreateWorkflowStatusesReq) GetStatuses() []WorkflowStatus

GetStatuses returns the value of Statuses.

func (*CreateWorkflowStatusesReq) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*CreateWorkflowStatusesReq) SetStatuses

func (s *CreateWorkflowStatusesReq) SetStatuses(val []WorkflowStatus)

SetStatuses sets the value of Statuses.

func (*CreateWorkflowStatusesReq) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateWorkflowStatusesReq) Validate

func (s *CreateWorkflowStatusesReq) Validate() error

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Handler

type Handler interface {
	// CreateWorkflowStatuses implements createWorkflowStatuses operation.
	//
	// Create workflow statuses.
	//
	// POST /workflow/statuses
	CreateWorkflowStatuses(ctx context.Context, req *CreateWorkflowStatusesReq) (*CreateWorkflowStatusesOK, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// CreateWorkflowStatuses invokes createWorkflowStatuses operation.
	//
	// Create workflow statuses.
	//
	// POST /workflow/statuses
	CreateWorkflowStatuses(ctx context.Context, request *CreateWorkflowStatusesReq) (*CreateWorkflowStatusesOK, 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 (
	CreateWorkflowStatusesOperation OperationName = "CreateWorkflowStatuses"
)

type OptBool

type OptBool struct {
	Value bool
	Set   bool
}

OptBool is optional bool.

func NewOptBool

func NewOptBool(v bool) OptBool

NewOptBool returns new OptBool with value set to v.

func (*OptBool) Decode

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

Decode decodes bool from json.

func (OptBool) Encode

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

Encode encodes bool as json.

func (OptBool) Get

func (o OptBool) Get() (v bool, ok bool)

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

func (OptBool) IsSet

func (o OptBool) IsSet() bool

IsSet returns true if OptBool was set.

func (OptBool) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptBool) Or

func (o OptBool) Or(d bool) bool

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

func (*OptBool) Reset

func (o *OptBool) Reset()

Reset unsets value.

func (*OptBool) SetTo

func (o *OptBool) SetTo(v bool)

SetTo sets value to v.

func (*OptBool) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptInt

type OptInt struct {
	Value int
	Set   bool
}

OptInt is optional int.

func NewOptInt

func NewOptInt(v int) OptInt

NewOptInt returns new OptInt with value set to v.

func (*OptInt) Decode

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

Decode decodes int from json.

func (OptInt) Encode

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

Encode encodes int as json.

func (OptInt) Get

func (o OptInt) Get() (v int, ok bool)

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

func (OptInt) IsSet

func (o OptInt) IsSet() bool

IsSet returns true if OptInt was set.

func (OptInt) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptInt) Or

func (o OptInt) Or(d int) int

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

func (*OptInt) Reset

func (o *OptInt) Reset()

Reset unsets value.

func (*OptInt) SetTo

func (o *OptInt) SetTo(v int)

SetTo sets value to v.

func (*OptInt) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptStatusProperties

type OptStatusProperties struct {
	Value StatusProperties
	Set   bool
}

OptStatusProperties is optional StatusProperties.

func NewOptStatusProperties

func NewOptStatusProperties(v StatusProperties) OptStatusProperties

NewOptStatusProperties returns new OptStatusProperties with value set to v.

func (*OptStatusProperties) Decode

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

Decode decodes StatusProperties from json.

func (OptStatusProperties) Encode

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

Encode encodes StatusProperties as json.

func (OptStatusProperties) Get

func (o OptStatusProperties) Get() (v StatusProperties, ok bool)

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

func (OptStatusProperties) IsSet

func (o OptStatusProperties) IsSet() bool

IsSet returns true if OptStatusProperties was set.

func (OptStatusProperties) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptStatusProperties) Or

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

func (*OptStatusProperties) Reset

func (o *OptStatusProperties) Reset()

Reset unsets value.

func (*OptStatusProperties) SetTo

SetTo sets value to v.

func (*OptStatusProperties) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptStatusPropertiesCategory

type OptStatusPropertiesCategory struct {
	Value StatusPropertiesCategory
	Set   bool
}

OptStatusPropertiesCategory is optional StatusPropertiesCategory.

func NewOptStatusPropertiesCategory

func NewOptStatusPropertiesCategory(v StatusPropertiesCategory) OptStatusPropertiesCategory

NewOptStatusPropertiesCategory returns new OptStatusPropertiesCategory with value set to v.

func (*OptStatusPropertiesCategory) Decode

Decode decodes StatusPropertiesCategory from json.

func (OptStatusPropertiesCategory) Encode

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

Encode encodes StatusPropertiesCategory as json.

func (OptStatusPropertiesCategory) Get

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

func (OptStatusPropertiesCategory) IsSet

IsSet returns true if OptStatusPropertiesCategory was set.

func (OptStatusPropertiesCategory) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptStatusPropertiesCategory) Or

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

func (*OptStatusPropertiesCategory) Reset

func (o *OptStatusPropertiesCategory) Reset()

Reset unsets value.

func (*OptStatusPropertiesCategory) SetTo

SetTo sets value to v.

func (*OptStatusPropertiesCategory) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

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 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 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) 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 (*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 StatusProperties

type StatusProperties struct {
	Category  OptStatusPropertiesCategory `json:"category"`
	Color     OptString                   `json:"color"`
	IsDefault OptBool                     `json:"isDefault"`
}

Nested properties object (level 2). Ref: #/components/schemas/StatusProperties

func (*StatusProperties) Decode

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

Decode decodes StatusProperties from json.

func (*StatusProperties) Encode

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

Encode implements json.Marshaler.

func (StatusProperties) Equal

func (a StatusProperties) Equal(b StatusProperties, depth int) bool

Equal compares two StatusProperties instances for equality. The depth parameter prevents infinite recursion on nested objects.

func (*StatusProperties) GetCategory

GetCategory returns the value of Category.

func (*StatusProperties) GetColor

func (s *StatusProperties) GetColor() OptString

GetColor returns the value of Color.

func (*StatusProperties) GetIsDefault

func (s *StatusProperties) GetIsDefault() OptBool

GetIsDefault returns the value of IsDefault.

func (StatusProperties) Hash

func (a StatusProperties) Hash() uint64

Hash computes a hash value for StatusProperties using FNV-1a. Equal objects must produce equal hashes.

func (*StatusProperties) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*StatusProperties) SetCategory

func (s *StatusProperties) SetCategory(val OptStatusPropertiesCategory)

SetCategory sets the value of Category.

func (*StatusProperties) SetColor

func (s *StatusProperties) SetColor(val OptString)

SetColor sets the value of Color.

func (*StatusProperties) SetIsDefault

func (s *StatusProperties) SetIsDefault(val OptBool)

SetIsDefault sets the value of IsDefault.

func (*StatusProperties) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*StatusProperties) Validate

func (s *StatusProperties) Validate() error

type StatusPropertiesCategory

type StatusPropertiesCategory string
const (
	StatusPropertiesCategoryTODO       StatusPropertiesCategory = "TODO"
	StatusPropertiesCategoryINPROGRESS StatusPropertiesCategory = "IN_PROGRESS"
	StatusPropertiesCategoryDONE       StatusPropertiesCategory = "DONE"
)

func (StatusPropertiesCategory) AllValues

AllValues returns all StatusPropertiesCategory values.

func (*StatusPropertiesCategory) Decode

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

Decode decodes StatusPropertiesCategory from json.

func (StatusPropertiesCategory) Encode

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

Encode encodes StatusPropertiesCategory as json.

func (StatusPropertiesCategory) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (StatusPropertiesCategory) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*StatusPropertiesCategory) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*StatusPropertiesCategory) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (StatusPropertiesCategory) Validate

func (s StatusPropertiesCategory) Validate() error

type UnimplementedHandler

type UnimplementedHandler struct{}

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

func (UnimplementedHandler) CreateWorkflowStatuses

CreateWorkflowStatuses implements createWorkflowStatuses operation.

Create workflow statuses.

POST /workflow/statuses

type WorkflowStatus

type WorkflowStatus struct {
	// Unique identifier for the status.
	ID string `json:"id"`
	// Display name of the status.
	Name string `json:"name"`
	// Optional description.
	Description OptString           `json:"description"`
	Properties  OptStatusProperties `json:"properties"`
}

Ref: #/components/schemas/WorkflowStatus

func (*WorkflowStatus) Decode

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

Decode decodes WorkflowStatus from json.

func (*WorkflowStatus) Encode

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

Encode implements json.Marshaler.

func (WorkflowStatus) Equal

func (a WorkflowStatus) Equal(b WorkflowStatus, depth int) bool

Equal compares two WorkflowStatus instances for equality. The depth parameter prevents infinite recursion on nested objects.

func (*WorkflowStatus) GetDescription

func (s *WorkflowStatus) GetDescription() OptString

GetDescription returns the value of Description.

func (*WorkflowStatus) GetID

func (s *WorkflowStatus) GetID() string

GetID returns the value of ID.

func (*WorkflowStatus) GetName

func (s *WorkflowStatus) GetName() string

GetName returns the value of Name.

func (*WorkflowStatus) GetProperties

func (s *WorkflowStatus) GetProperties() OptStatusProperties

GetProperties returns the value of Properties.

func (WorkflowStatus) Hash

func (a WorkflowStatus) Hash() uint64

Hash computes a hash value for WorkflowStatus using FNV-1a. Equal objects must produce equal hashes.

func (*WorkflowStatus) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*WorkflowStatus) SetDescription

func (s *WorkflowStatus) SetDescription(val OptString)

SetDescription sets the value of Description.

func (*WorkflowStatus) SetID

func (s *WorkflowStatus) SetID(val string)

SetID sets the value of ID.

func (*WorkflowStatus) SetName

func (s *WorkflowStatus) SetName(val string)

SetName sets the value of Name.

func (*WorkflowStatus) SetProperties

func (s *WorkflowStatus) SetProperties(val OptStatusProperties)

SetProperties sets the value of Properties.

func (*WorkflowStatus) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*WorkflowStatus) Validate

func (s *WorkflowStatus) Validate() error

Jump to

Keyboard shortcuts

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