Documentation
¶
Overview ¶
Code generated by ogen, DO NOT EDIT.
Index ¶
- Constants
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- func (c *Client) DataOnly(ctx context.Context) (*DataOnlyOK, error)
- func (c *Client) DataOnlyString(ctx context.Context) (*DataOnlyStringOK, error)
- func (c *Client) DataOnlyTime(ctx context.Context) (*DataOnlyTimeOK, error)
- func (c *Client) FullEvents(ctx context.Context) (*FullEventsOK, error)
- func (c *Client) OptionalStream(ctx context.Context, params OptionalStreamParams) (OptionalStreamRes, error)
- func (c *Client) WithHeaders(ctx context.Context) (*WithHeadersOKHeaders, error)
- type ClientOption
- type DataOnlyOK
- type DataOnlyOKClient
- type DataOnlyOKEvent
- func (s *DataOnlyOKEvent) GetData() Message
- func (s *DataOnlyOKEvent) GetID() string
- func (s *DataOnlyOKEvent) GetRetry() OptInt
- func (s *DataOnlyOKEvent) GetType() string
- func (s *DataOnlyOKEvent) SetData(val Message)
- func (s *DataOnlyOKEvent) SetID(val string)
- func (s *DataOnlyOKEvent) SetRetry(val OptInt)
- func (s *DataOnlyOKEvent) SetType(val string)
- func (s *DataOnlyOKEvent) Validate() error
- type DataOnlyOKSender
- type DataOnlyStringOK
- type DataOnlyStringOKClient
- type DataOnlyStringOKEvent
- func (s *DataOnlyStringOKEvent) GetData() string
- func (s *DataOnlyStringOKEvent) GetID() string
- func (s *DataOnlyStringOKEvent) GetRetry() OptInt
- func (s *DataOnlyStringOKEvent) GetType() string
- func (s *DataOnlyStringOKEvent) SetData(val string)
- func (s *DataOnlyStringOKEvent) SetID(val string)
- func (s *DataOnlyStringOKEvent) SetRetry(val OptInt)
- func (s *DataOnlyStringOKEvent) SetType(val string)
- type DataOnlyStringOKSender
- type DataOnlyTimeOK
- type DataOnlyTimeOKClient
- type DataOnlyTimeOKEvent
- func (s *DataOnlyTimeOKEvent) GetData() time.Time
- func (s *DataOnlyTimeOKEvent) GetID() string
- func (s *DataOnlyTimeOKEvent) GetRetry() OptInt
- func (s *DataOnlyTimeOKEvent) GetType() string
- func (s *DataOnlyTimeOKEvent) SetData(val time.Time)
- func (s *DataOnlyTimeOKEvent) SetID(val string)
- func (s *DataOnlyTimeOKEvent) SetRetry(val OptInt)
- func (s *DataOnlyTimeOKEvent) SetType(val string)
- type DataOnlyTimeOKSender
- type Error
- type ErrorHandler
- type EventA
- func (s *EventA) Decode(d *jx.Decoder) error
- func (s *EventA) Encode(e *jx.Encoder)
- func (s *EventA) GetData() Message
- func (s *EventA) GetEvent() EventAEvent
- func (s *EventA) GetID() string
- func (s *EventA) GetRetry() OptInt
- func (s *EventA) MarshalJSON() ([]byte, error)
- func (s *EventA) SetData(val Message)
- func (s *EventA) SetEvent(val EventAEvent)
- func (s *EventA) SetID(val string)
- func (s *EventA) SetRetry(val OptInt)
- func (s *EventA) UnmarshalJSON(data []byte) error
- func (s *EventA) Validate() error
- type EventAEvent
- func (EventAEvent) AllValues() []EventAEvent
- func (s *EventAEvent) Decode(d *jx.Decoder) error
- func (s EventAEvent) Encode(e *jx.Encoder)
- func (s EventAEvent) MarshalJSON() ([]byte, error)
- func (s EventAEvent) MarshalText() ([]byte, error)
- func (s *EventAEvent) UnmarshalJSON(data []byte) error
- func (s *EventAEvent) UnmarshalText(data []byte) error
- func (s EventAEvent) Validate() error
- type EventB
- func (s *EventB) Decode(d *jx.Decoder) error
- func (s *EventB) Encode(e *jx.Encoder)
- func (s *EventB) GetData() string
- func (s *EventB) GetEvent() EventBEvent
- func (s *EventB) GetID() string
- func (s *EventB) GetRetry() OptInt
- func (s *EventB) MarshalJSON() ([]byte, error)
- func (s *EventB) SetData(val string)
- func (s *EventB) SetEvent(val EventBEvent)
- func (s *EventB) SetID(val string)
- func (s *EventB) SetRetry(val OptInt)
- func (s *EventB) UnmarshalJSON(data []byte) error
- func (s *EventB) Validate() error
- type EventBEvent
- func (EventBEvent) AllValues() []EventBEvent
- func (s *EventBEvent) Decode(d *jx.Decoder) error
- func (s EventBEvent) Encode(e *jx.Encoder)
- func (s EventBEvent) MarshalJSON() ([]byte, error)
- func (s EventBEvent) MarshalText() ([]byte, error)
- func (s *EventBEvent) UnmarshalJSON(data []byte) error
- func (s *EventBEvent) UnmarshalText(data []byte) error
- func (s EventBEvent) Validate() error
- type FullEventsOK
- type FullEventsOKClient
- type FullEventsOKEvent
- func (s *FullEventsOKEvent) Decode(d *jx.Decoder) error
- func (s FullEventsOKEvent) Encode(e *jx.Encoder)
- func (s FullEventsOKEvent) GetEventA() (v EventA, ok bool)
- func (s FullEventsOKEvent) GetEventB() (v EventB, ok bool)
- func (s FullEventsOKEvent) IsEventA() bool
- func (s FullEventsOKEvent) IsEventB() bool
- func (s FullEventsOKEvent) MarshalJSON() ([]byte, error)
- func (s *FullEventsOKEvent) SetEventA(v EventA)
- func (s *FullEventsOKEvent) SetEventB(v EventB)
- func (s *FullEventsOKEvent) UnmarshalJSON(data []byte) error
- func (s FullEventsOKEvent) Validate() error
- type FullEventsOKEventType
- type FullEventsOKSender
- type Handler
- type Invoker
- type Labeler
- type Message
- func (s *Message) Decode(d *jx.Decoder) error
- func (s *Message) Encode(e *jx.Encoder)
- func (s *Message) GetCount() OptInt
- func (s *Message) GetText() string
- func (s *Message) MarshalJSON() ([]byte, error)
- func (s *Message) SetCount(val OptInt)
- func (s *Message) SetText(val string)
- func (s *Message) UnmarshalJSON(data []byte) error
- func (s *Message) Validate() error
- type Middleware
- type OperationName
- type OptBool
- type OptInt
- func (o *OptInt) Decode(d *jx.Decoder) error
- func (o OptInt) Encode(e *jx.Encoder)
- func (o OptInt) Get() (v int, ok bool)
- func (o OptInt) IsSet() bool
- func (s OptInt) MarshalJSON() ([]byte, error)
- func (o OptInt) Or(d int) int
- func (o *OptInt) Reset()
- func (o *OptInt) SetTo(v int)
- func (s *OptInt) UnmarshalJSON(data []byte) error
- type Option
- type OptionalStreamOK
- type OptionalStreamOKClient
- type OptionalStreamOKEvent
- func (s *OptionalStreamOKEvent) GetData() Message
- func (s *OptionalStreamOKEvent) GetID() string
- func (s *OptionalStreamOKEvent) GetRetry() OptInt
- func (s *OptionalStreamOKEvent) GetType() string
- func (s *OptionalStreamOKEvent) SetData(val Message)
- func (s *OptionalStreamOKEvent) SetID(val string)
- func (s *OptionalStreamOKEvent) SetRetry(val OptInt)
- func (s *OptionalStreamOKEvent) SetType(val string)
- func (s *OptionalStreamOKEvent) Validate() error
- type OptionalStreamOKSender
- type OptionalStreamParams
- type OptionalStreamRes
- type Route
- type SSEClientOption
- func WithSSEInitialBufferCap(n int) SSEClientOption
- func WithSSELastEventID(lastEventID string) SSEClientOption
- func WithSSEMaxEventSize(n int) SSEClientOption
- func WithSSEMaxRetries(n int) SSEClientOption
- func WithSSERetry(delay time.Duration) SSEClientOption
- func WithSSERetryErrorHandler(h sse.RetryErrorHandler) SSEClientOption
- type Server
- type ServerOption
- func WithErrorHandler(h ErrorHandler) ServerOption
- func WithMaxMultipartMemory(max int64) ServerOption
- func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
- func WithMiddleware(m ...Middleware) ServerOption
- func WithNotFound(notFound http.HandlerFunc) ServerOption
- func WithPathPrefix(prefix string) ServerOption
- type UnimplementedHandler
- func (UnimplementedHandler) DataOnly(ctx context.Context) (r *DataOnlyOK, _ error)
- func (UnimplementedHandler) DataOnlyString(ctx context.Context) (r *DataOnlyStringOK, _ error)
- func (UnimplementedHandler) DataOnlyTime(ctx context.Context) (r *DataOnlyTimeOK, _ error)
- func (UnimplementedHandler) FullEvents(ctx context.Context) (r *FullEventsOK, _ error)
- func (UnimplementedHandler) OptionalStream(ctx context.Context, params OptionalStreamParams) (r OptionalStreamRes, _ error)
- func (UnimplementedHandler) WithHeaders(ctx context.Context) (r *WithHeadersOKHeaders, _ error)
- type WithHeadersOK
- type WithHeadersOKClient
- type WithHeadersOKEvent
- func (s *WithHeadersOKEvent) GetData() Message
- func (s *WithHeadersOKEvent) GetID() string
- func (s *WithHeadersOKEvent) GetRetry() OptInt
- func (s *WithHeadersOKEvent) GetType() string
- func (s *WithHeadersOKEvent) SetData(val Message)
- func (s *WithHeadersOKEvent) SetID(val string)
- func (s *WithHeadersOKEvent) SetRetry(val OptInt)
- func (s *WithHeadersOKEvent) SetType(val string)
- func (s *WithHeadersOKEvent) Validate() error
- type WithHeadersOKHeaders
- type WithHeadersOKSender
Constants ¶
const ( MediaTypeApplicationJSON string = "application/json" MediaTypeTextEventStream string = "text/event-stream" )
Variables ¶
This section is empty.
Functions ¶
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) DataOnly ¶
func (c *Client) DataOnly(ctx context.Context) (*DataOnlyOK, error)
DataOnly invokes dataOnly operation.
GET /data-only
func (*Client) DataOnlyString ¶
func (c *Client) DataOnlyString(ctx context.Context) (*DataOnlyStringOK, error)
DataOnlyString invokes dataOnlyString operation.
GET /data-only-string
func (*Client) DataOnlyTime ¶
func (c *Client) DataOnlyTime(ctx context.Context) (*DataOnlyTimeOK, error)
DataOnlyTime invokes dataOnlyTime operation.
GET /data-only-time
func (*Client) FullEvents ¶
func (c *Client) FullEvents(ctx context.Context) (*FullEventsOK, error)
FullEvents invokes fullEvents operation.
GET /full
func (*Client) OptionalStream ¶
func (c *Client) OptionalStream(ctx context.Context, params OptionalStreamParams) (OptionalStreamRes, error)
OptionalStream invokes optionalStream operation.
GET /optional-stream
func (*Client) WithHeaders ¶
func (c *Client) WithHeaders(ctx context.Context) (*WithHeadersOKHeaders, error)
WithHeaders invokes withHeaders operation.
GET /with-headers
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.
func WithSSEClientOptions ¶
func WithSSEClientOptions(opts ...SSEClientOption) ClientOption
WithSSEClientOptions configures default SSE client behavior.
type DataOnlyOK ¶
type DataOnlyOK struct {
// Events writes the stream events.
//
// It is called by the generated server after the response headers are
// sent, until it returns. A nil Events sends an empty stream.
//
// Events is not used by the generated client.
Events func(ctx context.Context, s DataOnlyOKSender) error
// KeepAlive keeps an idle connection open while Events runs. It is called
// concurrently with Events and shares the same sender, which is safe for
// concurrent use. It should return when its context is canceled, which
// happens once Events returns.
//
// If nil, a "keep-alive" comment is sent every [sse.DefaultKeepAliveInterval].
// Set it to a function that returns immediately to disable keep-alive.
//
// KeepAlive is not used by the generated client.
KeepAlive func(ctx context.Context, s DataOnlyOKSender) error
// contains filtered or unexported fields
}
DataOnlyOK is a Server-Sent Events response stream.
func (*DataOnlyOK) All ¶
func (s *DataOnlyOK) All(ctx context.Context, ) iter.Seq2[DataOnlyOKEvent, error]
All iterates over stream events until the stream is closed, reconnecting when needed.
func (*DataOnlyOK) Close ¶
func (s *DataOnlyOK) Close() error
Close closes the current stream and stops further reconnect attempts.
func (*DataOnlyOK) Next ¶
func (s *DataOnlyOK) Next(ctx context.Context, ) (DataOnlyOKEvent, error)
Next returns the next event from the stream, reconnecting when needed.
type DataOnlyOKClient ¶
type DataOnlyOKClient interface {
sse.Client[DataOnlyOKEvent]
}
DataOnlyOKClient reads events from the DataOnlyOK SSE stream.
type DataOnlyOKEvent ¶
type DataOnlyOKEvent struct {
ID string `json:"id"`
Type string `json:"event"`
Data Message `json:"data"`
Retry OptInt `json:"retry"`
}
DataOnlyOKEvent is a parsed Server-Sent Event.
func (*DataOnlyOKEvent) GetData ¶
func (s *DataOnlyOKEvent) GetData() Message
GetData returns the value of Data.
func (*DataOnlyOKEvent) GetID ¶
func (s *DataOnlyOKEvent) GetID() string
GetID returns the value of ID.
func (*DataOnlyOKEvent) GetRetry ¶
func (s *DataOnlyOKEvent) GetRetry() OptInt
GetRetry returns the value of Retry.
func (*DataOnlyOKEvent) GetType ¶
func (s *DataOnlyOKEvent) GetType() string
GetType returns the value of Type.
func (*DataOnlyOKEvent) SetData ¶
func (s *DataOnlyOKEvent) SetData(val Message)
SetData sets the value of Data.
func (*DataOnlyOKEvent) SetID ¶
func (s *DataOnlyOKEvent) SetID(val string)
SetID sets the value of ID.
func (*DataOnlyOKEvent) SetRetry ¶
func (s *DataOnlyOKEvent) SetRetry(val OptInt)
SetRetry sets the value of Retry.
func (*DataOnlyOKEvent) SetType ¶
func (s *DataOnlyOKEvent) SetType(val string)
SetType sets the value of Type.
func (*DataOnlyOKEvent) Validate ¶
func (s *DataOnlyOKEvent) Validate() error
type DataOnlyOKSender ¶
type DataOnlyOKSender interface {
sse.Sender[DataOnlyOKEvent]
}
DataOnlyOKSender sends events to the DataOnlyOK SSE stream.
type DataOnlyStringOK ¶
type DataOnlyStringOK struct {
// Events writes the stream events.
//
// It is called by the generated server after the response headers are
// sent, until it returns. A nil Events sends an empty stream.
//
// Events is not used by the generated client.
Events func(ctx context.Context, s DataOnlyStringOKSender) error
// KeepAlive keeps an idle connection open while Events runs. It is called
// concurrently with Events and shares the same sender, which is safe for
// concurrent use. It should return when its context is canceled, which
// happens once Events returns.
//
// If nil, a "keep-alive" comment is sent every [sse.DefaultKeepAliveInterval].
// Set it to a function that returns immediately to disable keep-alive.
//
// KeepAlive is not used by the generated client.
KeepAlive func(ctx context.Context, s DataOnlyStringOKSender) error
// contains filtered or unexported fields
}
DataOnlyStringOK is a Server-Sent Events response stream.
func (*DataOnlyStringOK) All ¶
func (s *DataOnlyStringOK) All(ctx context.Context, ) iter.Seq2[DataOnlyStringOKEvent, error]
All iterates over stream events until the stream is closed, reconnecting when needed.
func (*DataOnlyStringOK) Close ¶
func (s *DataOnlyStringOK) Close() error
Close closes the current stream and stops further reconnect attempts.
func (*DataOnlyStringOK) Next ¶
func (s *DataOnlyStringOK) Next(ctx context.Context, ) (DataOnlyStringOKEvent, error)
Next returns the next event from the stream, reconnecting when needed.
type DataOnlyStringOKClient ¶
type DataOnlyStringOKClient interface {
sse.Client[DataOnlyStringOKEvent]
}
DataOnlyStringOKClient reads events from the DataOnlyStringOK SSE stream.
type DataOnlyStringOKEvent ¶
type DataOnlyStringOKEvent struct {
ID string `json:"id"`
Type string `json:"event"`
Data string `json:"data"`
Retry OptInt `json:"retry"`
}
DataOnlyStringOKEvent is a parsed Server-Sent Event.
func (*DataOnlyStringOKEvent) GetData ¶
func (s *DataOnlyStringOKEvent) GetData() string
GetData returns the value of Data.
func (*DataOnlyStringOKEvent) GetID ¶
func (s *DataOnlyStringOKEvent) GetID() string
GetID returns the value of ID.
func (*DataOnlyStringOKEvent) GetRetry ¶
func (s *DataOnlyStringOKEvent) GetRetry() OptInt
GetRetry returns the value of Retry.
func (*DataOnlyStringOKEvent) GetType ¶
func (s *DataOnlyStringOKEvent) GetType() string
GetType returns the value of Type.
func (*DataOnlyStringOKEvent) SetData ¶
func (s *DataOnlyStringOKEvent) SetData(val string)
SetData sets the value of Data.
func (*DataOnlyStringOKEvent) SetID ¶
func (s *DataOnlyStringOKEvent) SetID(val string)
SetID sets the value of ID.
func (*DataOnlyStringOKEvent) SetRetry ¶
func (s *DataOnlyStringOKEvent) SetRetry(val OptInt)
SetRetry sets the value of Retry.
func (*DataOnlyStringOKEvent) SetType ¶
func (s *DataOnlyStringOKEvent) SetType(val string)
SetType sets the value of Type.
type DataOnlyStringOKSender ¶
type DataOnlyStringOKSender interface {
sse.Sender[DataOnlyStringOKEvent]
}
DataOnlyStringOKSender sends events to the DataOnlyStringOK SSE stream.
type DataOnlyTimeOK ¶
type DataOnlyTimeOK struct {
// Events writes the stream events.
//
// It is called by the generated server after the response headers are
// sent, until it returns. A nil Events sends an empty stream.
//
// Events is not used by the generated client.
Events func(ctx context.Context, s DataOnlyTimeOKSender) error
// KeepAlive keeps an idle connection open while Events runs. It is called
// concurrently with Events and shares the same sender, which is safe for
// concurrent use. It should return when its context is canceled, which
// happens once Events returns.
//
// If nil, a "keep-alive" comment is sent every [sse.DefaultKeepAliveInterval].
// Set it to a function that returns immediately to disable keep-alive.
//
// KeepAlive is not used by the generated client.
KeepAlive func(ctx context.Context, s DataOnlyTimeOKSender) error
// contains filtered or unexported fields
}
DataOnlyTimeOK is a Server-Sent Events response stream.
func (*DataOnlyTimeOK) All ¶
func (s *DataOnlyTimeOK) All(ctx context.Context, ) iter.Seq2[DataOnlyTimeOKEvent, error]
All iterates over stream events until the stream is closed, reconnecting when needed.
func (*DataOnlyTimeOK) Close ¶
func (s *DataOnlyTimeOK) Close() error
Close closes the current stream and stops further reconnect attempts.
func (*DataOnlyTimeOK) Next ¶
func (s *DataOnlyTimeOK) Next(ctx context.Context, ) (DataOnlyTimeOKEvent, error)
Next returns the next event from the stream, reconnecting when needed.
type DataOnlyTimeOKClient ¶
type DataOnlyTimeOKClient interface {
sse.Client[DataOnlyTimeOKEvent]
}
DataOnlyTimeOKClient reads events from the DataOnlyTimeOK SSE stream.
type DataOnlyTimeOKEvent ¶
type DataOnlyTimeOKEvent struct {
ID string `json:"id"`
Type string `json:"event"`
Data time.Time `json:"data"`
Retry OptInt `json:"retry"`
}
DataOnlyTimeOKEvent is a parsed Server-Sent Event.
func (*DataOnlyTimeOKEvent) GetData ¶
func (s *DataOnlyTimeOKEvent) GetData() time.Time
GetData returns the value of Data.
func (*DataOnlyTimeOKEvent) GetID ¶
func (s *DataOnlyTimeOKEvent) GetID() string
GetID returns the value of ID.
func (*DataOnlyTimeOKEvent) GetRetry ¶
func (s *DataOnlyTimeOKEvent) GetRetry() OptInt
GetRetry returns the value of Retry.
func (*DataOnlyTimeOKEvent) GetType ¶
func (s *DataOnlyTimeOKEvent) GetType() string
GetType returns the value of Type.
func (*DataOnlyTimeOKEvent) SetData ¶
func (s *DataOnlyTimeOKEvent) SetData(val time.Time)
SetData sets the value of Data.
func (*DataOnlyTimeOKEvent) SetID ¶
func (s *DataOnlyTimeOKEvent) SetID(val string)
SetID sets the value of ID.
func (*DataOnlyTimeOKEvent) SetRetry ¶
func (s *DataOnlyTimeOKEvent) SetRetry(val OptInt)
SetRetry sets the value of Retry.
func (*DataOnlyTimeOKEvent) SetType ¶
func (s *DataOnlyTimeOKEvent) SetType(val string)
SetType sets the value of Type.
type DataOnlyTimeOKSender ¶
type DataOnlyTimeOKSender interface {
sse.Sender[DataOnlyTimeOKEvent]
}
DataOnlyTimeOKSender sends events to the DataOnlyTimeOK SSE stream.
type Error ¶
type Error struct {
Message string `json:"message"`
}
Ref: #/components/schemas/Error
func (*Error) GetMessage ¶
GetMessage returns the value of Message.
func (*Error) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Error) SetMessage ¶
SetMessage sets the value of Message.
func (*Error) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type EventA ¶
type EventA struct {
Event EventAEvent `json:"event"`
Data Message `json:"data"`
ID string `json:"id"`
Retry OptInt `json:"retry"`
}
Ref: #/components/schemas/EventA
func (*EventA) GetEvent ¶
func (s *EventA) GetEvent() EventAEvent
GetEvent returns the value of Event.
func (*EventA) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*EventA) SetEvent ¶
func (s *EventA) SetEvent(val EventAEvent)
SetEvent sets the value of Event.
func (*EventA) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type EventAEvent ¶
type EventAEvent string
const (
EventAEventEventA EventAEvent = "event_a"
)
func (EventAEvent) AllValues ¶
func (EventAEvent) AllValues() []EventAEvent
AllValues returns all EventAEvent values.
func (*EventAEvent) Decode ¶
func (s *EventAEvent) Decode(d *jx.Decoder) error
Decode decodes EventAEvent from json.
func (EventAEvent) Encode ¶
func (s EventAEvent) Encode(e *jx.Encoder)
Encode encodes EventAEvent as json.
func (EventAEvent) MarshalJSON ¶
func (s EventAEvent) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (EventAEvent) MarshalText ¶
func (s EventAEvent) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*EventAEvent) UnmarshalJSON ¶
func (s *EventAEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*EventAEvent) UnmarshalText ¶
func (s *EventAEvent) UnmarshalText(data []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (EventAEvent) Validate ¶
func (s EventAEvent) Validate() error
type EventB ¶
type EventB struct {
Event EventBEvent `json:"event"`
ID string `json:"id"`
Data string `json:"data"`
Retry OptInt `json:"retry"`
}
Ref: #/components/schemas/EventB
func (*EventB) GetEvent ¶
func (s *EventB) GetEvent() EventBEvent
GetEvent returns the value of Event.
func (*EventB) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*EventB) SetEvent ¶
func (s *EventB) SetEvent(val EventBEvent)
SetEvent sets the value of Event.
func (*EventB) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type EventBEvent ¶
type EventBEvent string
const (
EventBEventEventB EventBEvent = "event_b"
)
func (EventBEvent) AllValues ¶
func (EventBEvent) AllValues() []EventBEvent
AllValues returns all EventBEvent values.
func (*EventBEvent) Decode ¶
func (s *EventBEvent) Decode(d *jx.Decoder) error
Decode decodes EventBEvent from json.
func (EventBEvent) Encode ¶
func (s EventBEvent) Encode(e *jx.Encoder)
Encode encodes EventBEvent as json.
func (EventBEvent) MarshalJSON ¶
func (s EventBEvent) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (EventBEvent) MarshalText ¶
func (s EventBEvent) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*EventBEvent) UnmarshalJSON ¶
func (s *EventBEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*EventBEvent) UnmarshalText ¶
func (s *EventBEvent) UnmarshalText(data []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (EventBEvent) Validate ¶
func (s EventBEvent) Validate() error
type FullEventsOK ¶
type FullEventsOK struct {
// Events writes the stream events.
//
// It is called by the generated server after the response headers are
// sent, until it returns. A nil Events sends an empty stream.
//
// Events is not used by the generated client.
Events func(ctx context.Context, s FullEventsOKSender) error
// KeepAlive keeps an idle connection open while Events runs. It is called
// concurrently with Events and shares the same sender, which is safe for
// concurrent use. It should return when its context is canceled, which
// happens once Events returns.
//
// If nil, a "keep-alive" comment is sent every [sse.DefaultKeepAliveInterval].
// Set it to a function that returns immediately to disable keep-alive.
//
// KeepAlive is not used by the generated client.
KeepAlive func(ctx context.Context, s FullEventsOKSender) error
// contains filtered or unexported fields
}
FullEventsOK is a Server-Sent Events response stream.
func (*FullEventsOK) All ¶
func (s *FullEventsOK) All(ctx context.Context, ) iter.Seq2[FullEventsOKEvent, error]
All iterates over stream events until the stream is closed, reconnecting when needed.
func (*FullEventsOK) Close ¶
func (s *FullEventsOK) Close() error
Close closes the current stream and stops further reconnect attempts.
func (*FullEventsOK) Next ¶
func (s *FullEventsOK) Next(ctx context.Context, ) (FullEventsOKEvent, error)
Next returns the next event from the stream, reconnecting when needed.
type FullEventsOKClient ¶
type FullEventsOKClient interface {
sse.Client[FullEventsOKEvent]
}
FullEventsOKClient reads events from the FullEventsOK SSE stream.
type FullEventsOKEvent ¶
type FullEventsOKEvent struct {
// Type selects the active sum variant, switch on this field.
Type FullEventsOKEventType
EventA EventA
EventB EventB
}
FullEventsOKEvent represents sum type.
func NewEventAFullEventsOKEvent ¶
func NewEventAFullEventsOKEvent(v EventA) FullEventsOKEvent
NewEventAFullEventsOKEvent returns new FullEventsOKEvent from EventA.
func NewEventBFullEventsOKEvent ¶
func NewEventBFullEventsOKEvent(v EventB) FullEventsOKEvent
NewEventBFullEventsOKEvent returns new FullEventsOKEvent from EventB.
func (*FullEventsOKEvent) Decode ¶
func (s *FullEventsOKEvent) Decode(d *jx.Decoder) error
Decode decodes FullEventsOKEvent from json.
func (FullEventsOKEvent) Encode ¶
func (s FullEventsOKEvent) Encode(e *jx.Encoder)
Encode encodes FullEventsOKEvent as json.
func (FullEventsOKEvent) GetEventA ¶
func (s FullEventsOKEvent) GetEventA() (v EventA, ok bool)
GetEventA returns EventA and true boolean if FullEventsOKEvent is EventA.
func (FullEventsOKEvent) GetEventB ¶
func (s FullEventsOKEvent) GetEventB() (v EventB, ok bool)
GetEventB returns EventB and true boolean if FullEventsOKEvent is EventB.
func (FullEventsOKEvent) IsEventA ¶
func (s FullEventsOKEvent) IsEventA() bool
IsEventA reports whether FullEventsOKEvent is EventA.
func (FullEventsOKEvent) IsEventB ¶
func (s FullEventsOKEvent) IsEventB() bool
IsEventB reports whether FullEventsOKEvent is EventB.
func (FullEventsOKEvent) MarshalJSON ¶
func (s FullEventsOKEvent) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*FullEventsOKEvent) SetEventA ¶
func (s *FullEventsOKEvent) SetEventA(v EventA)
SetEventA sets FullEventsOKEvent to EventA.
func (*FullEventsOKEvent) SetEventB ¶
func (s *FullEventsOKEvent) SetEventB(v EventB)
SetEventB sets FullEventsOKEvent to EventB.
func (*FullEventsOKEvent) UnmarshalJSON ¶
func (s *FullEventsOKEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (FullEventsOKEvent) Validate ¶
func (s FullEventsOKEvent) Validate() error
type FullEventsOKEventType ¶
type FullEventsOKEventType string
FullEventsOKEventType is oneOf type of FullEventsOKEvent.
const ( EventAFullEventsOKEvent FullEventsOKEventType = "event_a" EventBFullEventsOKEvent FullEventsOKEventType = "event_b" )
Possible values for FullEventsOKEventType.
type FullEventsOKSender ¶
type FullEventsOKSender interface {
sse.Sender[FullEventsOKEvent]
}
FullEventsOKSender sends events to the FullEventsOK SSE stream.
type Handler ¶
type Handler interface {
// DataOnly implements dataOnly operation.
//
// GET /data-only
DataOnly(ctx context.Context) (*DataOnlyOK, error)
// DataOnlyString implements dataOnlyString operation.
//
// GET /data-only-string
DataOnlyString(ctx context.Context) (*DataOnlyStringOK, error)
// DataOnlyTime implements dataOnlyTime operation.
//
// GET /data-only-time
DataOnlyTime(ctx context.Context) (*DataOnlyTimeOK, error)
// FullEvents implements fullEvents operation.
//
// GET /full
FullEvents(ctx context.Context) (*FullEventsOK, error)
// OptionalStream implements optionalStream operation.
//
// GET /optional-stream
OptionalStream(ctx context.Context, params OptionalStreamParams) (OptionalStreamRes, error)
// WithHeaders implements withHeaders operation.
//
// GET /with-headers
WithHeaders(ctx context.Context) (*WithHeadersOKHeaders, error)
}
Handler handles operations described by OpenAPI v3 specification.
type Invoker ¶
type Invoker interface {
// DataOnly invokes dataOnly operation.
//
// GET /data-only
DataOnly(ctx context.Context) (*DataOnlyOK, error)
// DataOnlyString invokes dataOnlyString operation.
//
// GET /data-only-string
DataOnlyString(ctx context.Context) (*DataOnlyStringOK, error)
// DataOnlyTime invokes dataOnlyTime operation.
//
// GET /data-only-time
DataOnlyTime(ctx context.Context) (*DataOnlyTimeOK, error)
// FullEvents invokes fullEvents operation.
//
// GET /full
FullEvents(ctx context.Context) (*FullEventsOK, error)
// OptionalStream invokes optionalStream operation.
//
// GET /optional-stream
OptionalStream(ctx context.Context, params OptionalStreamParams) (OptionalStreamRes, error)
// WithHeaders invokes withHeaders operation.
//
// GET /with-headers
WithHeaders(ctx context.Context) (*WithHeadersOKHeaders, 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 ¶
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) AttributeSet ¶
AttributeSet returns the attributes added to the Labeler as an attribute.Set.
type Message ¶
Ref: #/components/schemas/Message
func (*Message) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Message) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type OperationName ¶
type OperationName = string
OperationName is the ogen operation name
const ( DataOnlyOperation OperationName = "DataOnly" DataOnlyStringOperation OperationName = "DataOnlyString" DataOnlyTimeOperation OperationName = "DataOnlyTime" FullEventsOperation OperationName = "FullEvents" OptionalStreamOperation OperationName = "OptionalStream" WithHeadersOperation OperationName = "WithHeaders" )
type OptBool ¶
OptBool is optional bool.
func NewOptBool ¶
NewOptBool returns new OptBool with value set to v.
type OptInt ¶
OptInt is optional int.
func (OptInt) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptInt) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type Option ¶
type Option interface {
ServerOption
ClientOption
}
Option is config option.
func WithAttributes ¶
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 OptionalStreamOK ¶
type OptionalStreamOK struct {
// Events writes the stream events.
//
// It is called by the generated server after the response headers are
// sent, until it returns. A nil Events sends an empty stream.
//
// Events is not used by the generated client.
Events func(ctx context.Context, s OptionalStreamOKSender) error
// KeepAlive keeps an idle connection open while Events runs. It is called
// concurrently with Events and shares the same sender, which is safe for
// concurrent use. It should return when its context is canceled, which
// happens once Events returns.
//
// If nil, a "keep-alive" comment is sent every [sse.DefaultKeepAliveInterval].
// Set it to a function that returns immediately to disable keep-alive.
//
// KeepAlive is not used by the generated client.
KeepAlive func(ctx context.Context, s OptionalStreamOKSender) error
// contains filtered or unexported fields
}
OptionalStreamOK is a Server-Sent Events response stream.
func (*OptionalStreamOK) All ¶
func (s *OptionalStreamOK) All(ctx context.Context, ) iter.Seq2[OptionalStreamOKEvent, error]
All iterates over stream events until the stream is closed, reconnecting when needed.
func (*OptionalStreamOK) Close ¶
func (s *OptionalStreamOK) Close() error
Close closes the current stream and stops further reconnect attempts.
func (*OptionalStreamOK) Next ¶
func (s *OptionalStreamOK) Next(ctx context.Context, ) (OptionalStreamOKEvent, error)
Next returns the next event from the stream, reconnecting when needed.
type OptionalStreamOKClient ¶
type OptionalStreamOKClient interface {
sse.Client[OptionalStreamOKEvent]
}
OptionalStreamOKClient reads events from the OptionalStreamOK SSE stream.
type OptionalStreamOKEvent ¶
type OptionalStreamOKEvent struct {
ID string `json:"id"`
Type string `json:"event"`
Data Message `json:"data"`
Retry OptInt `json:"retry"`
}
OptionalStreamOKEvent is a parsed Server-Sent Event.
func (*OptionalStreamOKEvent) GetData ¶
func (s *OptionalStreamOKEvent) GetData() Message
GetData returns the value of Data.
func (*OptionalStreamOKEvent) GetID ¶
func (s *OptionalStreamOKEvent) GetID() string
GetID returns the value of ID.
func (*OptionalStreamOKEvent) GetRetry ¶
func (s *OptionalStreamOKEvent) GetRetry() OptInt
GetRetry returns the value of Retry.
func (*OptionalStreamOKEvent) GetType ¶
func (s *OptionalStreamOKEvent) GetType() string
GetType returns the value of Type.
func (*OptionalStreamOKEvent) SetData ¶
func (s *OptionalStreamOKEvent) SetData(val Message)
SetData sets the value of Data.
func (*OptionalStreamOKEvent) SetID ¶
func (s *OptionalStreamOKEvent) SetID(val string)
SetID sets the value of ID.
func (*OptionalStreamOKEvent) SetRetry ¶
func (s *OptionalStreamOKEvent) SetRetry(val OptInt)
SetRetry sets the value of Retry.
func (*OptionalStreamOKEvent) SetType ¶
func (s *OptionalStreamOKEvent) SetType(val string)
SetType sets the value of Type.
func (*OptionalStreamOKEvent) Validate ¶
func (s *OptionalStreamOKEvent) Validate() error
type OptionalStreamOKSender ¶
type OptionalStreamOKSender interface {
sse.Sender[OptionalStreamOKEvent]
}
OptionalStreamOKSender sends events to the OptionalStreamOK SSE stream.
type OptionalStreamParams ¶
type OptionalStreamParams struct {
Fail OptBool `json:",omitempty,omitzero"`
}
OptionalStreamParams is parameters of optionalStream operation.
type OptionalStreamRes ¶
type OptionalStreamRes interface {
// contains filtered or unexported methods
}
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) OperationGroup ¶
OperationGroup returns the x-ogen-operation-group value.
func (Route) OperationID ¶
OperationID returns OpenAPI operationId.
type SSEClientOption ¶
type SSEClientOption func(*sseClientConfig)
func WithSSEInitialBufferCap ¶
func WithSSEInitialBufferCap(n int) SSEClientOption
WithSSEInitialBufferCap sets the initial decoder line buffer capacity.
func WithSSELastEventID ¶
func WithSSELastEventID(lastEventID string) SSEClientOption
WithSSELastEventID sets the initial lastEventID value for the stream.
func WithSSEMaxEventSize ¶
func WithSSEMaxEventSize(n int) SSEClientOption
WithSSEMaxEventSize sets the maximum parsable SSE event size in bytes.
Zero disables the limit.
func WithSSEMaxRetries ¶
func WithSSEMaxRetries(n int) SSEClientOption
WithSSEMaxRetries sets the maximum number of reconnect attempts.
Zero sets unlimited reconnect attempts.
func WithSSERetry ¶
func WithSSERetry(delay time.Duration) SSEClientOption
WithSSERetry sets the initial SSE reconnect delay.
func WithSSERetryErrorHandler ¶
func WithSSERetryErrorHandler(h sse.RetryErrorHandler) SSEClientOption
WithSSERetryErrorHandler sets the callback invoked after a reconnect attempt fails.
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.
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) DataOnly ¶
func (UnimplementedHandler) DataOnly(ctx context.Context) (r *DataOnlyOK, _ error)
DataOnly implements dataOnly operation.
GET /data-only
func (UnimplementedHandler) DataOnlyString ¶
func (UnimplementedHandler) DataOnlyString(ctx context.Context) (r *DataOnlyStringOK, _ error)
DataOnlyString implements dataOnlyString operation.
GET /data-only-string
func (UnimplementedHandler) DataOnlyTime ¶
func (UnimplementedHandler) DataOnlyTime(ctx context.Context) (r *DataOnlyTimeOK, _ error)
DataOnlyTime implements dataOnlyTime operation.
GET /data-only-time
func (UnimplementedHandler) FullEvents ¶
func (UnimplementedHandler) FullEvents(ctx context.Context) (r *FullEventsOK, _ error)
FullEvents implements fullEvents operation.
GET /full
func (UnimplementedHandler) OptionalStream ¶
func (UnimplementedHandler) OptionalStream(ctx context.Context, params OptionalStreamParams) (r OptionalStreamRes, _ error)
OptionalStream implements optionalStream operation.
GET /optional-stream
func (UnimplementedHandler) WithHeaders ¶
func (UnimplementedHandler) WithHeaders(ctx context.Context) (r *WithHeadersOKHeaders, _ error)
WithHeaders implements withHeaders operation.
GET /with-headers
type WithHeadersOK ¶
type WithHeadersOK struct {
// Events writes the stream events.
//
// It is called by the generated server after the response headers are
// sent, until it returns. A nil Events sends an empty stream.
//
// Events is not used by the generated client.
Events func(ctx context.Context, s WithHeadersOKSender) error
// KeepAlive keeps an idle connection open while Events runs. It is called
// concurrently with Events and shares the same sender, which is safe for
// concurrent use. It should return when its context is canceled, which
// happens once Events returns.
//
// If nil, a "keep-alive" comment is sent every [sse.DefaultKeepAliveInterval].
// Set it to a function that returns immediately to disable keep-alive.
//
// KeepAlive is not used by the generated client.
KeepAlive func(ctx context.Context, s WithHeadersOKSender) error
// contains filtered or unexported fields
}
WithHeadersOK is a Server-Sent Events response stream.
func (*WithHeadersOK) All ¶
func (s *WithHeadersOK) All(ctx context.Context, ) iter.Seq2[WithHeadersOKEvent, error]
All iterates over stream events until the stream is closed, reconnecting when needed.
func (*WithHeadersOK) Close ¶
func (s *WithHeadersOK) Close() error
Close closes the current stream and stops further reconnect attempts.
func (*WithHeadersOK) Next ¶
func (s *WithHeadersOK) Next(ctx context.Context, ) (WithHeadersOKEvent, error)
Next returns the next event from the stream, reconnecting when needed.
type WithHeadersOKClient ¶
type WithHeadersOKClient interface {
sse.Client[WithHeadersOKEvent]
}
WithHeadersOKClient reads events from the WithHeadersOK SSE stream.
type WithHeadersOKEvent ¶
type WithHeadersOKEvent struct {
ID string `json:"id"`
Type string `json:"event"`
Data Message `json:"data"`
Retry OptInt `json:"retry"`
}
WithHeadersOKEvent is a parsed Server-Sent Event.
func (*WithHeadersOKEvent) GetData ¶
func (s *WithHeadersOKEvent) GetData() Message
GetData returns the value of Data.
func (*WithHeadersOKEvent) GetID ¶
func (s *WithHeadersOKEvent) GetID() string
GetID returns the value of ID.
func (*WithHeadersOKEvent) GetRetry ¶
func (s *WithHeadersOKEvent) GetRetry() OptInt
GetRetry returns the value of Retry.
func (*WithHeadersOKEvent) GetType ¶
func (s *WithHeadersOKEvent) GetType() string
GetType returns the value of Type.
func (*WithHeadersOKEvent) SetData ¶
func (s *WithHeadersOKEvent) SetData(val Message)
SetData sets the value of Data.
func (*WithHeadersOKEvent) SetID ¶
func (s *WithHeadersOKEvent) SetID(val string)
SetID sets the value of ID.
func (*WithHeadersOKEvent) SetRetry ¶
func (s *WithHeadersOKEvent) SetRetry(val OptInt)
SetRetry sets the value of Retry.
func (*WithHeadersOKEvent) SetType ¶
func (s *WithHeadersOKEvent) SetType(val string)
SetType sets the value of Type.
func (*WithHeadersOKEvent) Validate ¶
func (s *WithHeadersOKEvent) Validate() error
type WithHeadersOKHeaders ¶
type WithHeadersOKHeaders struct {
XStreamID string
Response *WithHeadersOK
}
WithHeadersOKHeaders wraps WithHeadersOK with response headers.
func (*WithHeadersOKHeaders) GetResponse ¶
func (s *WithHeadersOKHeaders) GetResponse() *WithHeadersOK
GetResponse returns the value of Response.
func (*WithHeadersOKHeaders) GetXStreamID ¶
func (s *WithHeadersOKHeaders) GetXStreamID() string
GetXStreamID returns the value of XStreamID.
func (*WithHeadersOKHeaders) SetResponse ¶
func (s *WithHeadersOKHeaders) SetResponse(val *WithHeadersOK)
SetResponse sets the value of Response.
func (*WithHeadersOKHeaders) SetXStreamID ¶
func (s *WithHeadersOKHeaders) SetXStreamID(val string)
SetXStreamID sets the value of XStreamID.
type WithHeadersOKSender ¶
type WithHeadersOKSender interface {
sse.Sender[WithHeadersOKEvent]
}
WithHeadersOKSender sends events to the WithHeadersOK SSE stream.
Source Files
¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_handlers_gen.go
- oas_interfaces_gen.go
- oas_json_gen.go
- oas_labeler_gen.go
- oas_mediatypes_gen.go
- oas_middleware_gen.go
- oas_operations_gen.go
- oas_parameters_gen.go
- oas_request_decoders_gen.go
- oas_request_encoders_gen.go
- oas_response_decoders_gen.go
- oas_response_encoders_gen.go
- oas_router_gen.go
- oas_schemas_gen.go
- oas_server_gen.go
- oas_unimplemented_gen.go
- oas_validators_gen.go