api

package
v0.0.0-...-a5060b6 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

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 AuthToken

type AuthToken struct {
	// Authentication token.
	Token OptString `json:"token"`
}

Ref: #/components/schemas/AuthToken

func (*AuthToken) Decode

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

Decode decodes AuthToken from json.

func (*AuthToken) Encode

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

Encode implements json.Marshaler.

func (*AuthToken) GetToken

func (s *AuthToken) GetToken() OptString

GetToken returns the value of Token.

func (*AuthToken) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*AuthToken) SetToken

func (s *AuthToken) SetToken(val OptString)

SetToken sets the value of Token.

func (*AuthToken) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type BearerAuth

type BearerAuth struct {
	Token string
}

func (*BearerAuth) GetToken

func (s *BearerAuth) GetToken() string

GetToken returns the value of Token.

func (*BearerAuth) SetToken

func (s *BearerAuth) SetToken(val string)

SetToken sets the value of Token.

type Booking

type Booking struct {
	// Unique identifier for the booking.
	ID OptInt64 `json:"id"`
	// Name of the event.
	Name OptString `json:"name"`
	// Start date-time of the event.
	Start OptDateTime `json:"start"`
	// End date-time of the event.
	End OptDateTime `json:"end"`
	// User who made the booking.
	User   OptInt64         `json:"user"`
	Status OptBookingStatus `json:"status"`
	// Date and time when the booking was created.
	CreatedAt OptDateTime `json:"created_at"`
	// Date and time when the booking was last updated.
	UpdatedAt OptDateTime `json:"updated_at"`
}

Ref: #/components/schemas/Booking

func (*Booking) Decode

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

Decode decodes Booking from json.

func (*Booking) Encode

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

Encode implements json.Marshaler.

func (*Booking) GetCreatedAt

func (s *Booking) GetCreatedAt() OptDateTime

GetCreatedAt returns the value of CreatedAt.

func (*Booking) GetEnd

func (s *Booking) GetEnd() OptDateTime

GetEnd returns the value of End.

func (*Booking) GetID

func (s *Booking) GetID() OptInt64

GetID returns the value of ID.

func (*Booking) GetName

func (s *Booking) GetName() OptString

GetName returns the value of Name.

func (*Booking) GetStart

func (s *Booking) GetStart() OptDateTime

GetStart returns the value of Start.

func (*Booking) GetStatus

func (s *Booking) GetStatus() OptBookingStatus

GetStatus returns the value of Status.

func (*Booking) GetUpdatedAt

func (s *Booking) GetUpdatedAt() OptDateTime

GetUpdatedAt returns the value of UpdatedAt.

func (*Booking) GetUser

func (s *Booking) GetUser() OptInt64

GetUser returns the value of User.

func (*Booking) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Booking) SetCreatedAt

func (s *Booking) SetCreatedAt(val OptDateTime)

SetCreatedAt sets the value of CreatedAt.

func (*Booking) SetEnd

func (s *Booking) SetEnd(val OptDateTime)

SetEnd sets the value of End.

func (*Booking) SetID

func (s *Booking) SetID(val OptInt64)

SetID sets the value of ID.

func (*Booking) SetName

func (s *Booking) SetName(val OptString)

SetName sets the value of Name.

func (*Booking) SetStart

func (s *Booking) SetStart(val OptDateTime)

SetStart sets the value of Start.

func (*Booking) SetStatus

func (s *Booking) SetStatus(val OptBookingStatus)

SetStatus sets the value of Status.

func (*Booking) SetUpdatedAt

func (s *Booking) SetUpdatedAt(val OptDateTime)

SetUpdatedAt sets the value of UpdatedAt.

func (*Booking) SetUser

func (s *Booking) SetUser(val OptInt64)

SetUser sets the value of User.

func (*Booking) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type BookingStatus

type BookingStatus struct {
	// New status for the booking.
	Status OptString `json:"status"`
}

Ref: #/components/schemas/BookingStatus

func (*BookingStatus) Decode

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

Decode decodes BookingStatus from json.

func (*BookingStatus) DecodeURI

func (s *BookingStatus) DecodeURI(d uri.Decoder) error

DecodeURI decodes BookingStatus from URI form.

func (*BookingStatus) Encode

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

Encode implements json.Marshaler.

func (*BookingStatus) EncodeURI

func (s *BookingStatus) EncodeURI(e uri.Encoder) error

EncodeURI encodes BookingStatus as URI form.

func (*BookingStatus) GetStatus

func (s *BookingStatus) GetStatus() OptString

GetStatus returns the value of Status.

func (*BookingStatus) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*BookingStatus) SetStatus

func (s *BookingStatus) SetStatus(val OptString)

SetStatus sets the value of Status.

func (*BookingStatus) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type BookingsBookingIDGetNotFound

type BookingsBookingIDGetNotFound struct{}

BookingsBookingIDGetNotFound is response for BookingsBookingIDGet operation.

type BookingsBookingIDGetParams

type BookingsBookingIDGetParams struct {
	// ID of the booking to retrieve.
	BookingID int64
}

BookingsBookingIDGetParams is parameters of GET /bookings/{bookingID} operation.

type BookingsBookingIDGetRes

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

type BookingsBookingIDPutNotFound

type BookingsBookingIDPutNotFound struct{}

BookingsBookingIDPutNotFound is response for BookingsBookingIDPut operation.

type BookingsBookingIDPutParams

type BookingsBookingIDPutParams struct {
	// ID of the booking to cancel.
	BookingID int64
}

BookingsBookingIDPutParams is parameters of PUT /bookings/{bookingID} operation.

type BookingsBookingIDPutRes

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

type BookingsGetParams

type BookingsGetParams struct {
	// Filter bookings by status.
	Status OptBookingStatus
	// Filter bookings by user ID.
	User OptInt64
	// Filter bookings by date.
	Start OptDateTime
	// Filter bookings by date.
	End OptDateTime
}

BookingsGetParams is parameters of GET /bookings operation.

type Client

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

Client implements OAS client.

func NewClient

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

NewClient initializes new Client defined by OAS.

func (*Client) BookingsBookingIDGet

func (c *Client) BookingsBookingIDGet(ctx context.Context, params BookingsBookingIDGetParams) (BookingsBookingIDGetRes, error)

BookingsBookingIDGet invokes GET /bookings/{bookingID} operation.

Retrieve details of a specific booking by ID.

GET /bookings/{bookingID}

func (*Client) BookingsBookingIDPut

func (c *Client) BookingsBookingIDPut(ctx context.Context, params BookingsBookingIDPutParams) (BookingsBookingIDPutRes, error)

BookingsBookingIDPut invokes PUT /bookings/{bookingID} operation.

Cancel an existing booking.

PUT /bookings/{bookingID}

func (*Client) BookingsGet

func (c *Client) BookingsGet(ctx context.Context, params BookingsGetParams) ([]Booking, error)

BookingsGet invokes GET /bookings operation.

Retrieve a list of all bookings that meets the conditions.

GET /bookings

func (*Client) BookingsPost

func (c *Client) BookingsPost(ctx context.Context, request *NewBooking) (*Booking, error)

BookingsPost invokes POST /bookings operation.

Create a new booking for a live event.

POST /bookings

func (*Client) PingGet

func (c *Client) PingGet(ctx context.Context) (*PingGetOK, error)

PingGet invokes GET /ping operation.

Check if the server is running.

GET /ping

func (*Client) UsersLoginPost

func (c *Client) UsersLoginPost(ctx context.Context, request *LoginUser) (UsersLoginPostRes, error)

UsersLoginPost invokes POST /users/login operation.

Authenticate a user and generate a token.

POST /users/login

func (*Client) UsersPost

func (c *Client) UsersPost(ctx context.Context, request *NewUser) (*User, error)

UsersPost invokes POST /users operation.

Register a new user with the system.

POST /users

func (*Client) UsersUserIDDelete

func (c *Client) UsersUserIDDelete(ctx context.Context, params UsersUserIDDeleteParams) (UsersUserIDDeleteRes, error)

UsersUserIDDelete invokes DELETE /users/{userID} operation.

Delete an existing user.

DELETE /users/{userID}

func (*Client) UsersUserIDGet

func (c *Client) UsersUserIDGet(ctx context.Context, params UsersUserIDGetParams) (UsersUserIDGetRes, error)

UsersUserIDGet invokes GET /users/{userID} operation.

Retrieve details of a specific user by ID.

GET /users/{userID}

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 Error

type Error struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

Represents error object. Ref: #/components/schemas/Error

func (*Error) Decode

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

Decode decodes Error from json.

func (*Error) Encode

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

Encode implements json.Marshaler.

func (*Error) GetCode

func (s *Error) GetCode() int64

GetCode returns the value of Code.

func (*Error) GetMessage

func (s *Error) GetMessage() string

GetMessage returns the value of Message.

func (*Error) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Error) SetCode

func (s *Error) SetCode(val int64)

SetCode sets the value of Code.

func (*Error) SetMessage

func (s *Error) SetMessage(val string)

SetMessage sets the value of Message.

func (*Error) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ErrorStatusCode

type ErrorStatusCode struct {
	StatusCode int
	Response   Error
}

ErrorStatusCode wraps Error with StatusCode.

func (*ErrorStatusCode) Error

func (s *ErrorStatusCode) Error() string

func (*ErrorStatusCode) GetResponse

func (s *ErrorStatusCode) GetResponse() Error

GetResponse returns the value of Response.

func (*ErrorStatusCode) GetStatusCode

func (s *ErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrorStatusCode) SetResponse

func (s *ErrorStatusCode) SetResponse(val Error)

SetResponse sets the value of Response.

func (*ErrorStatusCode) SetStatusCode

func (s *ErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

type Handler

type Handler interface {
	// BookingsBookingIDGet implements GET /bookings/{bookingID} operation.
	//
	// Retrieve details of a specific booking by ID.
	//
	// GET /bookings/{bookingID}
	BookingsBookingIDGet(ctx context.Context, params BookingsBookingIDGetParams) (BookingsBookingIDGetRes, error)
	// BookingsBookingIDPut implements PUT /bookings/{bookingID} operation.
	//
	// Cancel an existing booking.
	//
	// PUT /bookings/{bookingID}
	BookingsBookingIDPut(ctx context.Context, params BookingsBookingIDPutParams) (BookingsBookingIDPutRes, error)
	// BookingsGet implements GET /bookings operation.
	//
	// Retrieve a list of all bookings that meets the conditions.
	//
	// GET /bookings
	BookingsGet(ctx context.Context, params BookingsGetParams) ([]Booking, error)
	// BookingsPost implements POST /bookings operation.
	//
	// Create a new booking for a live event.
	//
	// POST /bookings
	BookingsPost(ctx context.Context, req *NewBooking) (*Booking, error)
	// PingGet implements GET /ping operation.
	//
	// Check if the server is running.
	//
	// GET /ping
	PingGet(ctx context.Context) (*PingGetOK, error)
	// UsersLoginPost implements POST /users/login operation.
	//
	// Authenticate a user and generate a token.
	//
	// POST /users/login
	UsersLoginPost(ctx context.Context, req *LoginUser) (UsersLoginPostRes, error)
	// UsersPost implements POST /users operation.
	//
	// Register a new user with the system.
	//
	// POST /users
	UsersPost(ctx context.Context, req *NewUser) (*User, error)
	// UsersUserIDDelete implements DELETE /users/{userID} operation.
	//
	// Delete an existing user.
	//
	// DELETE /users/{userID}
	UsersUserIDDelete(ctx context.Context, params UsersUserIDDeleteParams) (UsersUserIDDeleteRes, error)
	// UsersUserIDGet implements GET /users/{userID} operation.
	//
	// Retrieve details of a specific user by ID.
	//
	// GET /users/{userID}
	UsersUserIDGet(ctx context.Context, params UsersUserIDGetParams) (UsersUserIDGetRes, error)
	// NewError creates *ErrorStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *ErrorStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// BookingsBookingIDGet invokes GET /bookings/{bookingID} operation.
	//
	// Retrieve details of a specific booking by ID.
	//
	// GET /bookings/{bookingID}
	BookingsBookingIDGet(ctx context.Context, params BookingsBookingIDGetParams) (BookingsBookingIDGetRes, error)
	// BookingsBookingIDPut invokes PUT /bookings/{bookingID} operation.
	//
	// Cancel an existing booking.
	//
	// PUT /bookings/{bookingID}
	BookingsBookingIDPut(ctx context.Context, params BookingsBookingIDPutParams) (BookingsBookingIDPutRes, error)
	// BookingsGet invokes GET /bookings operation.
	//
	// Retrieve a list of all bookings that meets the conditions.
	//
	// GET /bookings
	BookingsGet(ctx context.Context, params BookingsGetParams) ([]Booking, error)
	// BookingsPost invokes POST /bookings operation.
	//
	// Create a new booking for a live event.
	//
	// POST /bookings
	BookingsPost(ctx context.Context, request *NewBooking) (*Booking, error)
	// PingGet invokes GET /ping operation.
	//
	// Check if the server is running.
	//
	// GET /ping
	PingGet(ctx context.Context) (*PingGetOK, error)
	// UsersLoginPost invokes POST /users/login operation.
	//
	// Authenticate a user and generate a token.
	//
	// POST /users/login
	UsersLoginPost(ctx context.Context, request *LoginUser) (UsersLoginPostRes, error)
	// UsersPost invokes POST /users operation.
	//
	// Register a new user with the system.
	//
	// POST /users
	UsersPost(ctx context.Context, request *NewUser) (*User, error)
	// UsersUserIDDelete invokes DELETE /users/{userID} operation.
	//
	// Delete an existing user.
	//
	// DELETE /users/{userID}
	UsersUserIDDelete(ctx context.Context, params UsersUserIDDeleteParams) (UsersUserIDDeleteRes, error)
	// UsersUserIDGet invokes GET /users/{userID} operation.
	//
	// Retrieve details of a specific user by ID.
	//
	// GET /users/{userID}
	UsersUserIDGet(ctx context.Context, params UsersUserIDGetParams) (UsersUserIDGetRes, 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 LoginUser

type LoginUser struct {
	// Email address of the user.
	Email OptString `json:"email"`
	// Password of the user.
	Password OptString `json:"password"`
}

Ref: #/components/schemas/LoginUser

func (*LoginUser) Decode

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

Decode decodes LoginUser from json.

func (*LoginUser) Encode

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

Encode implements json.Marshaler.

func (*LoginUser) GetEmail

func (s *LoginUser) GetEmail() OptString

GetEmail returns the value of Email.

func (*LoginUser) GetPassword

func (s *LoginUser) GetPassword() OptString

GetPassword returns the value of Password.

func (*LoginUser) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*LoginUser) SetEmail

func (s *LoginUser) SetEmail(val OptString)

SetEmail sets the value of Email.

func (*LoginUser) SetPassword

func (s *LoginUser) SetPassword(val OptString)

SetPassword sets the value of Password.

func (*LoginUser) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type NewBooking

type NewBooking struct {
	// Name of the event.
	Name OptString `json:"name"`
	// Start date-time of the event.
	Start OptDateTime `json:"start"`
	// End date-time of the event.
	End OptDateTime `json:"end"`
	// User making the booking.
	User OptInt64 `json:"user"`
}

Ref: #/components/schemas/NewBooking

func (*NewBooking) Decode

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

Decode decodes NewBooking from json.

func (*NewBooking) Encode

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

Encode implements json.Marshaler.

func (*NewBooking) GetEnd

func (s *NewBooking) GetEnd() OptDateTime

GetEnd returns the value of End.

func (*NewBooking) GetName

func (s *NewBooking) GetName() OptString

GetName returns the value of Name.

func (*NewBooking) GetStart

func (s *NewBooking) GetStart() OptDateTime

GetStart returns the value of Start.

func (*NewBooking) GetUser

func (s *NewBooking) GetUser() OptInt64

GetUser returns the value of User.

func (*NewBooking) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*NewBooking) SetEnd

func (s *NewBooking) SetEnd(val OptDateTime)

SetEnd sets the value of End.

func (*NewBooking) SetName

func (s *NewBooking) SetName(val OptString)

SetName sets the value of Name.

func (*NewBooking) SetStart

func (s *NewBooking) SetStart(val OptDateTime)

SetStart sets the value of Start.

func (*NewBooking) SetUser

func (s *NewBooking) SetUser(val OptInt64)

SetUser sets the value of User.

func (*NewBooking) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type NewUser

type NewUser struct {
	// Full name of the user.
	Name OptString `json:"name"`
	// Email address of the user.
	Email OptString `json:"email"`
	// Password of the user.
	Password OptString `json:"password"`
}

Ref: #/components/schemas/NewUser

func (*NewUser) Decode

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

Decode decodes NewUser from json.

func (*NewUser) Encode

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

Encode implements json.Marshaler.

func (*NewUser) GetEmail

func (s *NewUser) GetEmail() OptString

GetEmail returns the value of Email.

func (*NewUser) GetName

func (s *NewUser) GetName() OptString

GetName returns the value of Name.

func (*NewUser) GetPassword

func (s *NewUser) GetPassword() OptString

GetPassword returns the value of Password.

func (*NewUser) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*NewUser) SetEmail

func (s *NewUser) SetEmail(val OptString)

SetEmail sets the value of Email.

func (*NewUser) SetName

func (s *NewUser) SetName(val OptString)

SetName sets the value of Name.

func (*NewUser) SetPassword

func (s *NewUser) SetPassword(val OptString)

SetPassword sets the value of Password.

func (*NewUser) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptBookingStatus

type OptBookingStatus struct {
	Value BookingStatus
	Set   bool
}

OptBookingStatus is optional BookingStatus.

func NewOptBookingStatus

func NewOptBookingStatus(v BookingStatus) OptBookingStatus

NewOptBookingStatus returns new OptBookingStatus with value set to v.

func (*OptBookingStatus) Decode

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

Decode decodes BookingStatus from json.

func (OptBookingStatus) Encode

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

Encode encodes BookingStatus as json.

func (OptBookingStatus) Get

func (o OptBookingStatus) Get() (v BookingStatus, ok bool)

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

func (OptBookingStatus) IsSet

func (o OptBookingStatus) IsSet() bool

IsSet returns true if OptBookingStatus was set.

func (OptBookingStatus) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptBookingStatus) Or

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

func (*OptBookingStatus) Reset

func (o *OptBookingStatus) Reset()

Reset unsets value.

func (*OptBookingStatus) SetTo

func (o *OptBookingStatus) SetTo(v BookingStatus)

SetTo sets value to v.

func (*OptBookingStatus) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptDateTime

type OptDateTime struct {
	Value time.Time
	Set   bool
}

OptDateTime is optional time.Time.

func NewOptDateTime

func NewOptDateTime(v time.Time) OptDateTime

NewOptDateTime returns new OptDateTime with value set to v.

func (*OptDateTime) Decode

func (o *OptDateTime) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error

Decode decodes time.Time from json.

func (OptDateTime) Encode

func (o OptDateTime) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time))

Encode encodes time.Time as json.

func (OptDateTime) Get

func (o OptDateTime) Get() (v time.Time, ok bool)

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

func (OptDateTime) IsSet

func (o OptDateTime) IsSet() bool

IsSet returns true if OptDateTime was set.

func (OptDateTime) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptDateTime) Or

func (o OptDateTime) Or(d time.Time) time.Time

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

func (*OptDateTime) Reset

func (o *OptDateTime) Reset()

Reset unsets value.

func (*OptDateTime) SetTo

func (o *OptDateTime) SetTo(v time.Time)

SetTo sets value to v.

func (*OptDateTime) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptInt64

type OptInt64 struct {
	Value int64
	Set   bool
}

OptInt64 is optional int64.

func NewOptInt64

func NewOptInt64(v int64) OptInt64

NewOptInt64 returns new OptInt64 with value set to v.

func (*OptInt64) Decode

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

Decode decodes int64 from json.

func (OptInt64) Encode

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

Encode encodes int64 as json.

func (OptInt64) Get

func (o OptInt64) Get() (v int64, ok bool)

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

func (OptInt64) IsSet

func (o OptInt64) IsSet() bool

IsSet returns true if OptInt64 was set.

func (OptInt64) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptInt64) Or

func (o OptInt64) Or(d int64) int64

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

func (*OptInt64) Reset

func (o *OptInt64) Reset()

Reset unsets value.

func (*OptInt64) SetTo

func (o *OptInt64) SetTo(v int64)

SetTo sets value to v.

func (*OptInt64) UnmarshalJSON

func (s *OptInt64) 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 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 PingGetOK

type PingGetOK struct {
	// Response message.
	Message OptString `json:"message"`
}

func (*PingGetOK) Decode

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

Decode decodes PingGetOK from json.

func (*PingGetOK) Encode

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

Encode implements json.Marshaler.

func (*PingGetOK) GetMessage

func (s *PingGetOK) GetMessage() OptString

GetMessage returns the value of Message.

func (*PingGetOK) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*PingGetOK) SetMessage

func (s *PingGetOK) SetMessage(val OptString)

SetMessage sets the value of Message.

func (*PingGetOK) UnmarshalJSON

func (s *PingGetOK) 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) 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 SecurityHandler

type SecurityHandler interface {
	// HandleBearerAuth handles BearerAuth security.
	HandleBearerAuth(ctx context.Context, operationName string, t BearerAuth) (context.Context, error)
}

SecurityHandler is handler for security parameters.

type SecuritySource

type SecuritySource interface {
	// BearerAuth provides BearerAuth security value.
	BearerAuth(ctx context.Context, operationName string) (BearerAuth, error)
}

SecuritySource is provider of security values (tokens, passwords, etc.).

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, sec SecurityHandler, 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 UnimplementedHandler

type UnimplementedHandler struct{}

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

func (UnimplementedHandler) BookingsBookingIDGet

BookingsBookingIDGet implements GET /bookings/{bookingID} operation.

Retrieve details of a specific booking by ID.

GET /bookings/{bookingID}

func (UnimplementedHandler) BookingsBookingIDPut

BookingsBookingIDPut implements PUT /bookings/{bookingID} operation.

Cancel an existing booking.

PUT /bookings/{bookingID}

func (UnimplementedHandler) BookingsGet

func (UnimplementedHandler) BookingsGet(ctx context.Context, params BookingsGetParams) (r []Booking, _ error)

BookingsGet implements GET /bookings operation.

Retrieve a list of all bookings that meets the conditions.

GET /bookings

func (UnimplementedHandler) BookingsPost

func (UnimplementedHandler) BookingsPost(ctx context.Context, req *NewBooking) (r *Booking, _ error)

BookingsPost implements POST /bookings operation.

Create a new booking for a live event.

POST /bookings

func (UnimplementedHandler) NewError

func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)

NewError creates *ErrorStatusCode from error returned by handler.

Used for common default response.

func (UnimplementedHandler) PingGet

func (UnimplementedHandler) PingGet(ctx context.Context) (r *PingGetOK, _ error)

PingGet implements GET /ping operation.

Check if the server is running.

GET /ping

func (UnimplementedHandler) UsersLoginPost

func (UnimplementedHandler) UsersLoginPost(ctx context.Context, req *LoginUser) (r UsersLoginPostRes, _ error)

UsersLoginPost implements POST /users/login operation.

Authenticate a user and generate a token.

POST /users/login

func (UnimplementedHandler) UsersPost

func (UnimplementedHandler) UsersPost(ctx context.Context, req *NewUser) (r *User, _ error)

UsersPost implements POST /users operation.

Register a new user with the system.

POST /users

func (UnimplementedHandler) UsersUserIDDelete

UsersUserIDDelete implements DELETE /users/{userID} operation.

Delete an existing user.

DELETE /users/{userID}

func (UnimplementedHandler) UsersUserIDGet

UsersUserIDGet implements GET /users/{userID} operation.

Retrieve details of a specific user by ID.

GET /users/{userID}

type User

type User struct {
	// Unique identifier for the user.
	ID OptInt64 `json:"id"`
	// Full name of the user.
	Name OptString `json:"name"`
	// Email address of the user.
	Email OptString `json:"email"`
	// Password of the user (hashed).
	Password OptString `json:"password"`
	// Date and time when the user was created.
	CreatedAt OptDateTime `json:"created_at"`
	// Date and time when the user was last updated.
	UpdatedAt OptDateTime `json:"updated_at"`
}

Ref: #/components/schemas/User

func (*User) Decode

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

Decode decodes User from json.

func (*User) Encode

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

Encode implements json.Marshaler.

func (*User) GetCreatedAt

func (s *User) GetCreatedAt() OptDateTime

GetCreatedAt returns the value of CreatedAt.

func (*User) GetEmail

func (s *User) GetEmail() OptString

GetEmail returns the value of Email.

func (*User) GetID

func (s *User) GetID() OptInt64

GetID returns the value of ID.

func (*User) GetName

func (s *User) GetName() OptString

GetName returns the value of Name.

func (*User) GetPassword

func (s *User) GetPassword() OptString

GetPassword returns the value of Password.

func (*User) GetUpdatedAt

func (s *User) GetUpdatedAt() OptDateTime

GetUpdatedAt returns the value of UpdatedAt.

func (*User) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*User) SetCreatedAt

func (s *User) SetCreatedAt(val OptDateTime)

SetCreatedAt sets the value of CreatedAt.

func (*User) SetEmail

func (s *User) SetEmail(val OptString)

SetEmail sets the value of Email.

func (*User) SetID

func (s *User) SetID(val OptInt64)

SetID sets the value of ID.

func (*User) SetName

func (s *User) SetName(val OptString)

SetName sets the value of Name.

func (*User) SetPassword

func (s *User) SetPassword(val OptString)

SetPassword sets the value of Password.

func (*User) SetUpdatedAt

func (s *User) SetUpdatedAt(val OptDateTime)

SetUpdatedAt sets the value of UpdatedAt.

func (*User) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type UsersLoginPostRes

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

type UsersLoginPostUnauthorized

type UsersLoginPostUnauthorized struct{}

UsersLoginPostUnauthorized is response for UsersLoginPost operation.

type UsersUserIDDeleteNoContent

type UsersUserIDDeleteNoContent struct{}

UsersUserIDDeleteNoContent is response for UsersUserIDDelete operation.

type UsersUserIDDeleteNotFound

type UsersUserIDDeleteNotFound struct{}

UsersUserIDDeleteNotFound is response for UsersUserIDDelete operation.

type UsersUserIDDeleteParams

type UsersUserIDDeleteParams struct {
	// ID of the user to delete.
	UserID int64
}

UsersUserIDDeleteParams is parameters of DELETE /users/{userID} operation.

type UsersUserIDDeleteRes

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

type UsersUserIDGetNotFound

type UsersUserIDGetNotFound struct{}

UsersUserIDGetNotFound is response for UsersUserIDGet operation.

type UsersUserIDGetParams

type UsersUserIDGetParams struct {
	// ID of the user to retrieve.
	UserID int64
}

UsersUserIDGetParams is parameters of GET /users/{userID} operation.

type UsersUserIDGetRes

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

Jump to

Keyboard shortcuts

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