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: 25 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 ActiveStatus

type ActiveStatus struct {
	// Active states.
	Status     ActiveStatusStatus `json:"status"`
	LastActive time.Time          `json:"lastActive"`
}

Ref: #/components/schemas/ActiveStatus

func (*ActiveStatus) Decode

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

Decode decodes ActiveStatus from json.

func (*ActiveStatus) Encode

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

Encode implements json.Marshaler.

func (*ActiveStatus) GetLastActive

func (s *ActiveStatus) GetLastActive() time.Time

GetLastActive returns the value of LastActive.

func (*ActiveStatus) GetStatus

func (s *ActiveStatus) GetStatus() ActiveStatusStatus

GetStatus returns the value of Status.

func (*ActiveStatus) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ActiveStatus) SetLastActive

func (s *ActiveStatus) SetLastActive(val time.Time)

SetLastActive sets the value of LastActive.

func (*ActiveStatus) SetStatus

func (s *ActiveStatus) SetStatus(val ActiveStatusStatus)

SetStatus sets the value of Status.

func (*ActiveStatus) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ActiveStatus) Validate

func (s *ActiveStatus) Validate() error

type ActiveStatusStatus

type ActiveStatusStatus string

Active states.

const (
	ActiveStatusStatusActive  ActiveStatusStatus = "active"
	ActiveStatusStatusPending ActiveStatusStatus = "pending"
)

func (ActiveStatusStatus) AllValues

func (ActiveStatusStatus) AllValues() []ActiveStatusStatus

AllValues returns all ActiveStatusStatus values.

func (*ActiveStatusStatus) Decode

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

Decode decodes ActiveStatusStatus from json.

func (ActiveStatusStatus) Encode

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

Encode encodes ActiveStatusStatus as json.

func (ActiveStatusStatus) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (ActiveStatusStatus) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*ActiveStatusStatus) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*ActiveStatusStatus) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (ActiveStatusStatus) Validate

func (s ActiveStatusStatus) Validate() error

type AdminResource

type AdminResource struct {
	// Resource type.
	Type AdminResourceType `json:"type"`
	// Admin roles.
	Role    AdminResourceRole `json:"role"`
	AdminId string            `json:"adminId"`
}

Ref: #/components/schemas/AdminResource

func (*AdminResource) Decode

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

Decode decodes AdminResource from json.

func (*AdminResource) Encode

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

Encode implements json.Marshaler.

func (*AdminResource) GetAdminId

func (s *AdminResource) GetAdminId() string

GetAdminId returns the value of AdminId.

func (*AdminResource) GetRole

func (s *AdminResource) GetRole() AdminResourceRole

GetRole returns the value of Role.

func (*AdminResource) GetType

func (s *AdminResource) GetType() AdminResourceType

GetType returns the value of Type.

func (*AdminResource) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*AdminResource) SetAdminId

func (s *AdminResource) SetAdminId(val string)

SetAdminId sets the value of AdminId.

func (*AdminResource) SetRole

func (s *AdminResource) SetRole(val AdminResourceRole)

SetRole sets the value of Role.

func (*AdminResource) SetType

func (s *AdminResource) SetType(val AdminResourceType)

SetType sets the value of Type.

func (*AdminResource) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AdminResource) Validate

func (s *AdminResource) Validate() error

type AdminResourceRole

type AdminResourceRole string

Admin roles.

const (
	AdminResourceRoleSuperadmin AdminResourceRole = "superadmin"
	AdminResourceRoleModerator  AdminResourceRole = "moderator"
)

func (AdminResourceRole) AllValues

func (AdminResourceRole) AllValues() []AdminResourceRole

AllValues returns all AdminResourceRole values.

func (*AdminResourceRole) Decode

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

Decode decodes AdminResourceRole from json.

func (AdminResourceRole) Encode

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

Encode encodes AdminResourceRole as json.

func (AdminResourceRole) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (AdminResourceRole) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*AdminResourceRole) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AdminResourceRole) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (AdminResourceRole) Validate

func (s AdminResourceRole) Validate() error

type AdminResourceType

type AdminResourceType string

Resource type.

const (
	AdminResourceTypeAdmin AdminResourceType = "admin"
)

func (AdminResourceType) AllValues

func (AdminResourceType) AllValues() []AdminResourceType

AllValues returns all AdminResourceType values.

func (*AdminResourceType) Decode

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

Decode decodes AdminResourceType from json.

func (AdminResourceType) Encode

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

Encode encodes AdminResourceType as json.

func (AdminResourceType) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (AdminResourceType) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*AdminResourceType) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*AdminResourceType) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (AdminResourceType) Validate

func (s AdminResourceType) Validate() error

type Client

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

Client implements OAS client.

func NewClient

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

NewClient initializes new Client defined by OAS.

func (*Client) GetResource

func (c *Client) GetResource(ctx context.Context) (Resource, error)

GetResource invokes getResource operation.

GET /resource

func (*Client) GetShippingOption

func (c *Client) GetShippingOption(ctx context.Context) (ShippingOption, error)

GetShippingOption invokes getShippingOption operation.

Test overlapping enum values with a discriminating field - should use carrier field to discriminate.

GET /shipping-option

func (*Client) GetStatus

func (c *Client) GetStatus(ctx context.Context) (StatusResponse, error)

GetStatus invokes getStatus operation.

GET /status

func (*Client) LogEvent

func (c *Client) LogEvent(ctx context.Context, request Event) error

LogEvent invokes logEvent operation.

POST /event

type ClientOption

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

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Event

type Event struct {
	Type        EventType // switch on this field
	UserEvent   UserEvent
	SystemEvent SystemEvent
	MetricEvent MetricEvent
}

Mixed discrimination - some fields by type, some by value. Ref: #/components/schemas/Event Event represents sum type.

func NewMetricEventEvent

func NewMetricEventEvent(v MetricEvent) Event

NewMetricEventEvent returns new Event from MetricEvent.

func NewSystemEventEvent

func NewSystemEventEvent(v SystemEvent) Event

NewSystemEventEvent returns new Event from SystemEvent.

func NewUserEventEvent

func NewUserEventEvent(v UserEvent) Event

NewUserEventEvent returns new Event from UserEvent.

func (*Event) Decode

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

Decode decodes Event from json.

func (Event) Encode

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

Encode encodes Event as json.

func (Event) GetMetricEvent

func (s Event) GetMetricEvent() (v MetricEvent, ok bool)

GetMetricEvent returns MetricEvent and true boolean if Event is MetricEvent.

func (Event) GetSystemEvent

func (s Event) GetSystemEvent() (v SystemEvent, ok bool)

GetSystemEvent returns SystemEvent and true boolean if Event is SystemEvent.

func (Event) GetUserEvent

func (s Event) GetUserEvent() (v UserEvent, ok bool)

GetUserEvent returns UserEvent and true boolean if Event is UserEvent.

func (Event) IsMetricEvent

func (s Event) IsMetricEvent() bool

IsMetricEvent reports whether Event is MetricEvent.

func (Event) IsSystemEvent

func (s Event) IsSystemEvent() bool

IsSystemEvent reports whether Event is SystemEvent.

func (Event) IsUserEvent

func (s Event) IsUserEvent() bool

IsUserEvent reports whether Event is UserEvent.

func (Event) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Event) SetMetricEvent

func (s *Event) SetMetricEvent(v MetricEvent)

SetMetricEvent sets Event to MetricEvent.

func (*Event) SetSystemEvent

func (s *Event) SetSystemEvent(v SystemEvent)

SetSystemEvent sets Event to SystemEvent.

func (*Event) SetUserEvent

func (s *Event) SetUserEvent(v UserEvent)

SetUserEvent sets Event to UserEvent.

func (*Event) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (Event) Validate

func (s Event) Validate() error

type EventType

type EventType string

EventType is oneOf type of Event.

const (
	UserEventEvent   EventType = "UserEvent"
	SystemEventEvent EventType = "SystemEvent"
	MetricEventEvent EventType = "MetricEvent"
)

Possible values for EventType.

type FedExShippingOption

type FedExShippingOption struct {
	// Carrier identifier - unique enum value for discrimination.
	Carrier FedExShippingOptionCarrier `json:"carrier"`
	// Signature type - has overlapping values with USPS.
	Signature FedExShippingOptionSignature `json:"signature"`
}

Ref: #/components/schemas/FedExShippingOption

func (*FedExShippingOption) Decode

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

Decode decodes FedExShippingOption from json.

func (*FedExShippingOption) Encode

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

Encode implements json.Marshaler.

func (*FedExShippingOption) GetCarrier

GetCarrier returns the value of Carrier.

func (*FedExShippingOption) GetSignature

GetSignature returns the value of Signature.

func (*FedExShippingOption) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*FedExShippingOption) SetCarrier

SetCarrier sets the value of Carrier.

func (*FedExShippingOption) SetSignature

SetSignature sets the value of Signature.

func (*FedExShippingOption) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*FedExShippingOption) Validate

func (s *FedExShippingOption) Validate() error

type FedExShippingOptionCarrier

type FedExShippingOptionCarrier string

Carrier identifier - unique enum value for discrimination.

const (
	FedExShippingOptionCarrierFedex FedExShippingOptionCarrier = "fedex"
)

func (FedExShippingOptionCarrier) AllValues

AllValues returns all FedExShippingOptionCarrier values.

func (*FedExShippingOptionCarrier) Decode

Decode decodes FedExShippingOptionCarrier from json.

func (FedExShippingOptionCarrier) Encode

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

Encode encodes FedExShippingOptionCarrier as json.

func (FedExShippingOptionCarrier) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (FedExShippingOptionCarrier) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*FedExShippingOptionCarrier) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*FedExShippingOptionCarrier) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (FedExShippingOptionCarrier) Validate

func (s FedExShippingOptionCarrier) Validate() error

type FedExShippingOptionSignature

type FedExShippingOptionSignature string

Signature type - has overlapping values with USPS.

const (
	FedExShippingOptionSignatureGift    FedExShippingOptionSignature = "gift"
	FedExShippingOptionSignatureSample  FedExShippingOptionSignature = "sample"
	FedExShippingOptionSignatureExpress FedExShippingOptionSignature = "express"
)

func (FedExShippingOptionSignature) AllValues

AllValues returns all FedExShippingOptionSignature values.

func (*FedExShippingOptionSignature) Decode

Decode decodes FedExShippingOptionSignature from json.

func (FedExShippingOptionSignature) Encode

Encode encodes FedExShippingOptionSignature as json.

func (FedExShippingOptionSignature) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (FedExShippingOptionSignature) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*FedExShippingOptionSignature) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*FedExShippingOptionSignature) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (FedExShippingOptionSignature) Validate

func (s FedExShippingOptionSignature) Validate() error

type Handler

type Handler interface {
	// GetResource implements getResource operation.
	//
	// GET /resource
	GetResource(ctx context.Context) (Resource, error)
	// GetShippingOption implements getShippingOption operation.
	//
	// Test overlapping enum values with a discriminating field - should use carrier field to discriminate.
	//
	// GET /shipping-option
	GetShippingOption(ctx context.Context) (ShippingOption, error)
	// GetStatus implements getStatus operation.
	//
	// GET /status
	GetStatus(ctx context.Context) (StatusResponse, error)
	// LogEvent implements logEvent operation.
	//
	// POST /event
	LogEvent(ctx context.Context, req Event) error
}

Handler handles operations described by OpenAPI v3 specification.

type InactiveStatus

type InactiveStatus struct {
	// Inactive states.
	Status    InactiveStatusStatus `json:"status"`
	DeletedAt time.Time            `json:"deletedAt"`
}

Ref: #/components/schemas/InactiveStatus

func (*InactiveStatus) Decode

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

Decode decodes InactiveStatus from json.

func (*InactiveStatus) Encode

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

Encode implements json.Marshaler.

func (*InactiveStatus) GetDeletedAt

func (s *InactiveStatus) GetDeletedAt() time.Time

GetDeletedAt returns the value of DeletedAt.

func (*InactiveStatus) GetStatus

func (s *InactiveStatus) GetStatus() InactiveStatusStatus

GetStatus returns the value of Status.

func (*InactiveStatus) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*InactiveStatus) SetDeletedAt

func (s *InactiveStatus) SetDeletedAt(val time.Time)

SetDeletedAt sets the value of DeletedAt.

func (*InactiveStatus) SetStatus

func (s *InactiveStatus) SetStatus(val InactiveStatusStatus)

SetStatus sets the value of Status.

func (*InactiveStatus) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*InactiveStatus) Validate

func (s *InactiveStatus) Validate() error

type InactiveStatusStatus

type InactiveStatusStatus string

Inactive states.

const (
	InactiveStatusStatusInactive InactiveStatusStatus = "inactive"
	InactiveStatusStatusDeleted  InactiveStatusStatus = "deleted"
)

func (InactiveStatusStatus) AllValues

AllValues returns all InactiveStatusStatus values.

func (*InactiveStatusStatus) Decode

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

Decode decodes InactiveStatusStatus from json.

func (InactiveStatusStatus) Encode

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

Encode encodes InactiveStatusStatus as json.

func (InactiveStatusStatus) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (InactiveStatusStatus) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*InactiveStatusStatus) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*InactiveStatusStatus) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (InactiveStatusStatus) Validate

func (s InactiveStatusStatus) Validate() error

type Invoker

type Invoker interface {
	// GetResource invokes getResource operation.
	//
	// GET /resource
	GetResource(ctx context.Context) (Resource, error)
	// GetShippingOption invokes getShippingOption operation.
	//
	// Test overlapping enum values with a discriminating field - should use carrier field to discriminate.
	//
	// GET /shipping-option
	GetShippingOption(ctx context.Context) (ShippingOption, error)
	// GetStatus invokes getStatus operation.
	//
	// GET /status
	GetStatus(ctx context.Context) (StatusResponse, error)
	// LogEvent invokes logEvent operation.
	//
	// POST /event
	LogEvent(ctx context.Context, request Event) 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 LogEventOK

type LogEventOK struct{}

LogEventOK is response for LogEvent operation.

type MetricEvent

type MetricEvent struct {
	// Metric event types - discriminated by value.
	EventType MetricEventEventType `json:"eventType"`
	// Numeric priority - discriminated by type.
	Priority float64 `json:"priority"`
	// Unique field - discriminated by name.
	MetricId string `json:"metricId"`
}

Ref: #/components/schemas/MetricEvent

func (*MetricEvent) Decode

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

Decode decodes MetricEvent from json.

func (*MetricEvent) Encode

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

Encode implements json.Marshaler.

func (*MetricEvent) GetEventType

func (s *MetricEvent) GetEventType() MetricEventEventType

GetEventType returns the value of EventType.

func (*MetricEvent) GetMetricId

func (s *MetricEvent) GetMetricId() string

GetMetricId returns the value of MetricId.

func (*MetricEvent) GetPriority

func (s *MetricEvent) GetPriority() float64

GetPriority returns the value of Priority.

func (*MetricEvent) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*MetricEvent) SetEventType

func (s *MetricEvent) SetEventType(val MetricEventEventType)

SetEventType sets the value of EventType.

func (*MetricEvent) SetMetricId

func (s *MetricEvent) SetMetricId(val string)

SetMetricId sets the value of MetricId.

func (*MetricEvent) SetPriority

func (s *MetricEvent) SetPriority(val float64)

SetPriority sets the value of Priority.

func (*MetricEvent) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*MetricEvent) Validate

func (s *MetricEvent) Validate() error

type MetricEventEventType

type MetricEventEventType string

Metric event types - discriminated by value.

const (
	MetricEventEventTypeMetricUpdate MetricEventEventType = "metric_update"
	MetricEventEventTypeMetricAlert  MetricEventEventType = "metric_alert"
)

func (MetricEventEventType) AllValues

AllValues returns all MetricEventEventType values.

func (*MetricEventEventType) Decode

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

Decode decodes MetricEventEventType from json.

func (MetricEventEventType) Encode

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

Encode encodes MetricEventEventType as json.

func (MetricEventEventType) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (MetricEventEventType) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*MetricEventEventType) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*MetricEventEventType) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (MetricEventEventType) Validate

func (s MetricEventEventType) Validate() error

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	GetResourceOperation       OperationName = "GetResource"
	GetShippingOptionOperation OperationName = "GetShippingOption"
	GetStatusOperation         OperationName = "GetStatus"
	LogEventOperation          OperationName = "LogEvent"
)

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 Resource

type Resource struct {
	Type          ResourceType // switch on this field
	UserResource  UserResource
	AdminResource AdminResource
}

Multiple fields with value-based discrimination. Ref: #/components/schemas/Resource Resource represents sum type.

func NewAdminResourceResource

func NewAdminResourceResource(v AdminResource) Resource

NewAdminResourceResource returns new Resource from AdminResource.

func NewUserResourceResource

func NewUserResourceResource(v UserResource) Resource

NewUserResourceResource returns new Resource from UserResource.

func (*Resource) Decode

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

Decode decodes Resource from json.

func (Resource) Encode

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

Encode encodes Resource as json.

func (Resource) GetAdminResource

func (s Resource) GetAdminResource() (v AdminResource, ok bool)

GetAdminResource returns AdminResource and true boolean if Resource is AdminResource.

func (Resource) GetUserResource

func (s Resource) GetUserResource() (v UserResource, ok bool)

GetUserResource returns UserResource and true boolean if Resource is UserResource.

func (Resource) IsAdminResource

func (s Resource) IsAdminResource() bool

IsAdminResource reports whether Resource is AdminResource.

func (Resource) IsUserResource

func (s Resource) IsUserResource() bool

IsUserResource reports whether Resource is UserResource.

func (Resource) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Resource) SetAdminResource

func (s *Resource) SetAdminResource(v AdminResource)

SetAdminResource sets Resource to AdminResource.

func (*Resource) SetUserResource

func (s *Resource) SetUserResource(v UserResource)

SetUserResource sets Resource to UserResource.

func (*Resource) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (Resource) Validate

func (s Resource) Validate() error

type ResourceType

type ResourceType string

ResourceType is oneOf type of Resource.

const (
	UserResourceResource  ResourceType = "UserResource"
	AdminResourceResource ResourceType = "AdminResource"
)

Possible values for ResourceType.

type Route

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

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationGroup

func (r Route) OperationGroup() string

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

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type Server

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

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

func NewServer

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

NewServer creates new Server.

func (*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 ShippingOption

type ShippingOption struct {
	Type                ShippingOptionType // switch on this field
	USPSShippingOption  USPSShippingOption
	FedExShippingOption FedExShippingOption
}

Overlapping enum values with a discriminating field - carrier field discriminates, signature has overlapping values. Ref: #/components/schemas/ShippingOption ShippingOption represents sum type.

func NewFedExShippingOptionShippingOption

func NewFedExShippingOptionShippingOption(v FedExShippingOption) ShippingOption

NewFedExShippingOptionShippingOption returns new ShippingOption from FedExShippingOption.

func NewUSPSShippingOptionShippingOption

func NewUSPSShippingOptionShippingOption(v USPSShippingOption) ShippingOption

NewUSPSShippingOptionShippingOption returns new ShippingOption from USPSShippingOption.

func (*ShippingOption) Decode

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

Decode decodes ShippingOption from json.

func (ShippingOption) Encode

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

Encode encodes ShippingOption as json.

func (ShippingOption) GetFedExShippingOption

func (s ShippingOption) GetFedExShippingOption() (v FedExShippingOption, ok bool)

GetFedExShippingOption returns FedExShippingOption and true boolean if ShippingOption is FedExShippingOption.

func (ShippingOption) GetUSPSShippingOption

func (s ShippingOption) GetUSPSShippingOption() (v USPSShippingOption, ok bool)

GetUSPSShippingOption returns USPSShippingOption and true boolean if ShippingOption is USPSShippingOption.

func (ShippingOption) IsFedExShippingOption

func (s ShippingOption) IsFedExShippingOption() bool

IsFedExShippingOption reports whether ShippingOption is FedExShippingOption.

func (ShippingOption) IsUSPSShippingOption

func (s ShippingOption) IsUSPSShippingOption() bool

IsUSPSShippingOption reports whether ShippingOption is USPSShippingOption.

func (ShippingOption) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ShippingOption) SetFedExShippingOption

func (s *ShippingOption) SetFedExShippingOption(v FedExShippingOption)

SetFedExShippingOption sets ShippingOption to FedExShippingOption.

func (*ShippingOption) SetUSPSShippingOption

func (s *ShippingOption) SetUSPSShippingOption(v USPSShippingOption)

SetUSPSShippingOption sets ShippingOption to USPSShippingOption.

func (*ShippingOption) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (ShippingOption) Validate

func (s ShippingOption) Validate() error

type ShippingOptionType

type ShippingOptionType string

ShippingOptionType is oneOf type of ShippingOption.

const (
	USPSShippingOptionShippingOption  ShippingOptionType = "USPSShippingOption"
	FedExShippingOptionShippingOption ShippingOptionType = "FedExShippingOption"
)

Possible values for ShippingOptionType.

type StatusResponse

type StatusResponse struct {
	Type           StatusResponseType // switch on this field
	ActiveStatus   ActiveStatus
	InactiveStatus InactiveStatus
}

Basic enum value discrimination - different enum values for same field. Ref: #/components/schemas/StatusResponse StatusResponse represents sum type.

func NewActiveStatusStatusResponse

func NewActiveStatusStatusResponse(v ActiveStatus) StatusResponse

NewActiveStatusStatusResponse returns new StatusResponse from ActiveStatus.

func NewInactiveStatusStatusResponse

func NewInactiveStatusStatusResponse(v InactiveStatus) StatusResponse

NewInactiveStatusStatusResponse returns new StatusResponse from InactiveStatus.

func (*StatusResponse) Decode

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

Decode decodes StatusResponse from json.

func (StatusResponse) Encode

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

Encode encodes StatusResponse as json.

func (StatusResponse) GetActiveStatus

func (s StatusResponse) GetActiveStatus() (v ActiveStatus, ok bool)

GetActiveStatus returns ActiveStatus and true boolean if StatusResponse is ActiveStatus.

func (StatusResponse) GetInactiveStatus

func (s StatusResponse) GetInactiveStatus() (v InactiveStatus, ok bool)

GetInactiveStatus returns InactiveStatus and true boolean if StatusResponse is InactiveStatus.

func (StatusResponse) IsActiveStatus

func (s StatusResponse) IsActiveStatus() bool

IsActiveStatus reports whether StatusResponse is ActiveStatus.

func (StatusResponse) IsInactiveStatus

func (s StatusResponse) IsInactiveStatus() bool

IsInactiveStatus reports whether StatusResponse is InactiveStatus.

func (StatusResponse) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*StatusResponse) SetActiveStatus

func (s *StatusResponse) SetActiveStatus(v ActiveStatus)

SetActiveStatus sets StatusResponse to ActiveStatus.

func (*StatusResponse) SetInactiveStatus

func (s *StatusResponse) SetInactiveStatus(v InactiveStatus)

SetInactiveStatus sets StatusResponse to InactiveStatus.

func (*StatusResponse) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (StatusResponse) Validate

func (s StatusResponse) Validate() error

type StatusResponseType

type StatusResponseType string

StatusResponseType is oneOf type of StatusResponse.

const (
	ActiveStatusStatusResponse   StatusResponseType = "ActiveStatus"
	InactiveStatusStatusResponse StatusResponseType = "InactiveStatus"
)

Possible values for StatusResponseType.

type SystemEvent

type SystemEvent struct {
	// System event types - discriminated by value.
	EventType SystemEventEventType `json:"eventType"`
	// Integer priority - discriminated by type.
	Priority int `json:"priority"`
	// Unique field - discriminated by name.
	SystemId string `json:"systemId"`
}

Ref: #/components/schemas/SystemEvent

func (*SystemEvent) Decode

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

Decode decodes SystemEvent from json.

func (*SystemEvent) Encode

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

Encode implements json.Marshaler.

func (*SystemEvent) GetEventType

func (s *SystemEvent) GetEventType() SystemEventEventType

GetEventType returns the value of EventType.

func (*SystemEvent) GetPriority

func (s *SystemEvent) GetPriority() int

GetPriority returns the value of Priority.

func (*SystemEvent) GetSystemId

func (s *SystemEvent) GetSystemId() string

GetSystemId returns the value of SystemId.

func (*SystemEvent) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*SystemEvent) SetEventType

func (s *SystemEvent) SetEventType(val SystemEventEventType)

SetEventType sets the value of EventType.

func (*SystemEvent) SetPriority

func (s *SystemEvent) SetPriority(val int)

SetPriority sets the value of Priority.

func (*SystemEvent) SetSystemId

func (s *SystemEvent) SetSystemId(val string)

SetSystemId sets the value of SystemId.

func (*SystemEvent) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*SystemEvent) Validate

func (s *SystemEvent) Validate() error

type SystemEventEventType

type SystemEventEventType string

System event types - discriminated by value.

const (
	SystemEventEventTypeSystemStart SystemEventEventType = "system_start"
	SystemEventEventTypeSystemStop  SystemEventEventType = "system_stop"
)

func (SystemEventEventType) AllValues

AllValues returns all SystemEventEventType values.

func (*SystemEventEventType) Decode

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

Decode decodes SystemEventEventType from json.

func (SystemEventEventType) Encode

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

Encode encodes SystemEventEventType as json.

func (SystemEventEventType) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (SystemEventEventType) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*SystemEventEventType) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*SystemEventEventType) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (SystemEventEventType) Validate

func (s SystemEventEventType) Validate() error

type USPSShippingOption

type USPSShippingOption struct {
	// Carrier identifier - unique enum value for discrimination.
	Carrier USPSShippingOptionCarrier `json:"carrier"`
	// Signature type - has overlapping values with FedEx.
	Signature USPSShippingOptionSignature `json:"signature"`
}

Ref: #/components/schemas/USPSShippingOption

func (*USPSShippingOption) Decode

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

Decode decodes USPSShippingOption from json.

func (*USPSShippingOption) Encode

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

Encode implements json.Marshaler.

func (*USPSShippingOption) GetCarrier

GetCarrier returns the value of Carrier.

func (*USPSShippingOption) GetSignature

GetSignature returns the value of Signature.

func (*USPSShippingOption) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*USPSShippingOption) SetCarrier

func (s *USPSShippingOption) SetCarrier(val USPSShippingOptionCarrier)

SetCarrier sets the value of Carrier.

func (*USPSShippingOption) SetSignature

func (s *USPSShippingOption) SetSignature(val USPSShippingOptionSignature)

SetSignature sets the value of Signature.

func (*USPSShippingOption) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*USPSShippingOption) Validate

func (s *USPSShippingOption) Validate() error

type USPSShippingOptionCarrier

type USPSShippingOptionCarrier string

Carrier identifier - unique enum value for discrimination.

const (
	USPSShippingOptionCarrierUsps USPSShippingOptionCarrier = "usps"
)

func (USPSShippingOptionCarrier) AllValues

AllValues returns all USPSShippingOptionCarrier values.

func (*USPSShippingOptionCarrier) Decode

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

Decode decodes USPSShippingOptionCarrier from json.

func (USPSShippingOptionCarrier) Encode

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

Encode encodes USPSShippingOptionCarrier as json.

func (USPSShippingOptionCarrier) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (USPSShippingOptionCarrier) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*USPSShippingOptionCarrier) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*USPSShippingOptionCarrier) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (USPSShippingOptionCarrier) Validate

func (s USPSShippingOptionCarrier) Validate() error

type USPSShippingOptionSignature

type USPSShippingOptionSignature string

Signature type - has overlapping values with FedEx.

const (
	USPSShippingOptionSignatureGift     USPSShippingOptionSignature = "gift"
	USPSShippingOptionSignatureSample   USPSShippingOptionSignature = "sample"
	USPSShippingOptionSignatureStandard USPSShippingOptionSignature = "standard"
)

func (USPSShippingOptionSignature) AllValues

AllValues returns all USPSShippingOptionSignature values.

func (*USPSShippingOptionSignature) Decode

Decode decodes USPSShippingOptionSignature from json.

func (USPSShippingOptionSignature) Encode

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

Encode encodes USPSShippingOptionSignature as json.

func (USPSShippingOptionSignature) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (USPSShippingOptionSignature) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*USPSShippingOptionSignature) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*USPSShippingOptionSignature) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (USPSShippingOptionSignature) Validate

func (s USPSShippingOptionSignature) Validate() error

type UnimplementedHandler

type UnimplementedHandler struct{}

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

func (UnimplementedHandler) GetResource

func (UnimplementedHandler) GetResource(ctx context.Context) (r Resource, _ error)

GetResource implements getResource operation.

GET /resource

func (UnimplementedHandler) GetShippingOption

func (UnimplementedHandler) GetShippingOption(ctx context.Context) (r ShippingOption, _ error)

GetShippingOption implements getShippingOption operation.

Test overlapping enum values with a discriminating field - should use carrier field to discriminate.

GET /shipping-option

func (UnimplementedHandler) GetStatus

GetStatus implements getStatus operation.

GET /status

func (UnimplementedHandler) LogEvent

func (UnimplementedHandler) LogEvent(ctx context.Context, req Event) error

LogEvent implements logEvent operation.

POST /event

type UserEvent

type UserEvent struct {
	// User event types - discriminated by value.
	EventType UserEventEventType `json:"eventType"`
	// String priority - discriminated by type.
	Priority string `json:"priority"`
	// Unique field - discriminated by name.
	UserId string `json:"userId"`
}

Ref: #/components/schemas/UserEvent

func (*UserEvent) Decode

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

Decode decodes UserEvent from json.

func (*UserEvent) Encode

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

Encode implements json.Marshaler.

func (*UserEvent) GetEventType

func (s *UserEvent) GetEventType() UserEventEventType

GetEventType returns the value of EventType.

func (*UserEvent) GetPriority

func (s *UserEvent) GetPriority() string

GetPriority returns the value of Priority.

func (*UserEvent) GetUserId

func (s *UserEvent) GetUserId() string

GetUserId returns the value of UserId.

func (*UserEvent) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*UserEvent) SetEventType

func (s *UserEvent) SetEventType(val UserEventEventType)

SetEventType sets the value of EventType.

func (*UserEvent) SetPriority

func (s *UserEvent) SetPriority(val string)

SetPriority sets the value of Priority.

func (*UserEvent) SetUserId

func (s *UserEvent) SetUserId(val string)

SetUserId sets the value of UserId.

func (*UserEvent) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UserEvent) Validate

func (s *UserEvent) Validate() error

type UserEventEventType

type UserEventEventType string

User event types - discriminated by value.

const (
	UserEventEventTypeUserLogin  UserEventEventType = "user_login"
	UserEventEventTypeUserLogout UserEventEventType = "user_logout"
)

func (UserEventEventType) AllValues

func (UserEventEventType) AllValues() []UserEventEventType

AllValues returns all UserEventEventType values.

func (*UserEventEventType) Decode

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

Decode decodes UserEventEventType from json.

func (UserEventEventType) Encode

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

Encode encodes UserEventEventType as json.

func (UserEventEventType) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (UserEventEventType) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*UserEventEventType) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UserEventEventType) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (UserEventEventType) Validate

func (s UserEventEventType) Validate() error

type UserResource

type UserResource struct {
	// Resource type.
	Type UserResourceType `json:"type"`
	// User roles.
	Role   UserResourceRole `json:"role"`
	UserId string           `json:"userId"`
}

Ref: #/components/schemas/UserResource

func (*UserResource) Decode

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

Decode decodes UserResource from json.

func (*UserResource) Encode

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

Encode implements json.Marshaler.

func (*UserResource) GetRole

func (s *UserResource) GetRole() UserResourceRole

GetRole returns the value of Role.

func (*UserResource) GetType

func (s *UserResource) GetType() UserResourceType

GetType returns the value of Type.

func (*UserResource) GetUserId

func (s *UserResource) GetUserId() string

GetUserId returns the value of UserId.

func (*UserResource) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*UserResource) SetRole

func (s *UserResource) SetRole(val UserResourceRole)

SetRole sets the value of Role.

func (*UserResource) SetType

func (s *UserResource) SetType(val UserResourceType)

SetType sets the value of Type.

func (*UserResource) SetUserId

func (s *UserResource) SetUserId(val string)

SetUserId sets the value of UserId.

func (*UserResource) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UserResource) Validate

func (s *UserResource) Validate() error

type UserResourceRole

type UserResourceRole string

User roles.

const (
	UserResourceRoleViewer UserResourceRole = "viewer"
	UserResourceRoleEditor UserResourceRole = "editor"
)

func (UserResourceRole) AllValues

func (UserResourceRole) AllValues() []UserResourceRole

AllValues returns all UserResourceRole values.

func (*UserResourceRole) Decode

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

Decode decodes UserResourceRole from json.

func (UserResourceRole) Encode

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

Encode encodes UserResourceRole as json.

func (UserResourceRole) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (UserResourceRole) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*UserResourceRole) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UserResourceRole) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (UserResourceRole) Validate

func (s UserResourceRole) Validate() error

type UserResourceType

type UserResourceType string

Resource type.

const (
	UserResourceTypeUser UserResourceType = "user"
)

func (UserResourceType) AllValues

func (UserResourceType) AllValues() []UserResourceType

AllValues returns all UserResourceType values.

func (*UserResourceType) Decode

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

Decode decodes UserResourceType from json.

func (UserResourceType) Encode

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

Encode encodes UserResourceType as json.

func (UserResourceType) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (UserResourceType) MarshalText

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

MarshalText implements encoding.TextMarshaler.

func (*UserResourceType) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UserResourceType) UnmarshalText

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

UnmarshalText implements encoding.TextUnmarshaler.

func (UserResourceType) Validate

func (s UserResourceType) Validate() error

Jump to

Keyboard shortcuts

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