feat: generated pkg/rest

This commit is contained in:
Anatoly Antonov 2025-06-21 21:34:22 +03:00
parent 419c07886c
commit 5158c5d7c9
20 changed files with 4199 additions and 1 deletions

767
pkg/rest/oas_schemas_gen.go Normal file
View file

@ -0,0 +1,767 @@
// Code generated by ogen, DO NOT EDIT.
package gsn
import (
"fmt"
"time"
"github.com/go-faster/errors"
)
func (s *ErrorStatusCode) Error() string {
return fmt.Sprintf("code %d: %+v", s.StatusCode, s.Response)
}
// Ref: #/components/schemas/Error
type Error struct {
Message string `json:"message"`
Details OptString `json:"details"`
}
// GetMessage returns the value of Message.
func (s *Error) GetMessage() string {
return s.Message
}
// GetDetails returns the value of Details.
func (s *Error) GetDetails() OptString {
return s.Details
}
// SetMessage sets the value of Message.
func (s *Error) SetMessage(val string) {
s.Message = val
}
// SetDetails sets the value of Details.
func (s *Error) SetDetails(val OptString) {
s.Details = val
}
// ErrorStatusCode wraps Error with StatusCode.
type ErrorStatusCode struct {
StatusCode int
Response Error
}
// GetStatusCode returns the value of StatusCode.
func (s *ErrorStatusCode) GetStatusCode() int {
return s.StatusCode
}
// GetResponse returns the value of Response.
func (s *ErrorStatusCode) GetResponse() Error {
return s.Response
}
// SetStatusCode sets the value of StatusCode.
func (s *ErrorStatusCode) SetStatusCode(val int) {
s.StatusCode = val
}
// SetResponse sets the value of Response.
func (s *ErrorStatusCode) SetResponse(val Error) {
s.Response = val
}
// NewOptBool returns new OptBool with value set to v.
func NewOptBool(v bool) OptBool {
return OptBool{
Value: v,
Set: true,
}
}
// OptBool is optional bool.
type OptBool struct {
Value bool
Set bool
}
// IsSet returns true if OptBool was set.
func (o OptBool) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptBool) Reset() {
var v bool
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptBool) SetTo(v bool) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptBool) Get() (v bool, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptBool) Or(d bool) bool {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptDateTime returns new OptDateTime with value set to v.
func NewOptDateTime(v time.Time) OptDateTime {
return OptDateTime{
Value: v,
Set: true,
}
}
// OptDateTime is optional time.Time.
type OptDateTime struct {
Value time.Time
Set bool
}
// IsSet returns true if OptDateTime was set.
func (o OptDateTime) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptDateTime) Reset() {
var v time.Time
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptDateTime) SetTo(v time.Time) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptDateTime) Get() (v time.Time, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptDateTime) Or(d time.Time) time.Time {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptFloat64 returns new OptFloat64 with value set to v.
func NewOptFloat64(v float64) OptFloat64 {
return OptFloat64{
Value: v,
Set: true,
}
}
// OptFloat64 is optional float64.
type OptFloat64 struct {
Value float64
Set bool
}
// IsSet returns true if OptFloat64 was set.
func (o OptFloat64) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptFloat64) Reset() {
var v float64
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptFloat64) SetTo(v float64) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptFloat64) Get() (v float64, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptFloat64) Or(d float64) float64 {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptParameters returns new OptParameters with value set to v.
func NewOptParameters(v Parameters) OptParameters {
return OptParameters{
Value: v,
Set: true,
}
}
// OptParameters is optional Parameters.
type OptParameters struct {
Value Parameters
Set bool
}
// IsSet returns true if OptParameters was set.
func (o OptParameters) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptParameters) Reset() {
var v Parameters
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptParameters) SetTo(v Parameters) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptParameters) Get() (v Parameters, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptParameters) Or(d Parameters) Parameters {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptParametersFormat returns new OptParametersFormat with value set to v.
func NewOptParametersFormat(v ParametersFormat) OptParametersFormat {
return OptParametersFormat{
Value: v,
Set: true,
}
}
// OptParametersFormat is optional ParametersFormat.
type OptParametersFormat struct {
Value ParametersFormat
Set bool
}
// IsSet returns true if OptParametersFormat was set.
func (o OptParametersFormat) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptParametersFormat) Reset() {
var v ParametersFormat
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptParametersFormat) SetTo(v ParametersFormat) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptParametersFormat) Get() (v ParametersFormat, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptParametersFormat) Or(d ParametersFormat) ParametersFormat {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptParametersProfile returns new OptParametersProfile with value set to v.
func NewOptParametersProfile(v ParametersProfile) OptParametersProfile {
return OptParametersProfile{
Value: v,
Set: true,
}
}
// OptParametersProfile is optional ParametersProfile.
type OptParametersProfile struct {
Value ParametersProfile
Set bool
}
// IsSet returns true if OptParametersProfile was set.
func (o OptParametersProfile) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptParametersProfile) Reset() {
var v ParametersProfile
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptParametersProfile) SetTo(v ParametersProfile) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptParametersProfile) Get() (v ParametersProfile, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptParametersProfile) Or(d ParametersProfile) ParametersProfile {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptString returns new OptString with value set to v.
func NewOptString(v string) OptString {
return OptString{
Value: v,
Set: true,
}
}
// OptString is optional string.
type OptString struct {
Value string
Set bool
}
// IsSet returns true if OptString was set.
func (o OptString) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptString) Reset() {
var v string
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptString) SetTo(v string) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptString) Get() (v string, ok bool) {
if !o.Set {
return v, false
}
return o.Value, true
}
// Or returns value if set, or given parameter if does not.
func (o OptString) Or(d string) string {
if v, ok := o.Get(); ok {
return v
}
return d
}
// Ref: #/components/schemas/Prediction/Parameters
type Parameters struct {
LaunchLatitude OptFloat64 `json:"launch_latitude"`
LaunchLongitude OptFloat64 `json:"launch_longitude"`
LaunchDatetime OptDateTime `json:"launch_datetime"`
LaunchAltitude OptFloat64 `json:"launch_altitude"`
Profile OptParametersProfile `json:"profile"`
AscentRate OptFloat64 `json:"ascent_rate"`
BurstAltitude OptFloat64 `json:"burst_altitude"`
DescentRate OptFloat64 `json:"descent_rate"`
FloatAltitude OptFloat64 `json:"float_altitude"`
StopDatetime OptDateTime `json:"stop_datetime"`
// Base64 encoded ascent curve.
AscentCurve OptString `json:"ascent_curve"`
// Base64 encoded descent curve.
DescentCurve OptString `json:"descent_curve"`
Interpolate OptBool `json:"interpolate"`
Format OptParametersFormat `json:"format"`
Dataset OptDateTime `json:"dataset"`
}
// GetLaunchLatitude returns the value of LaunchLatitude.
func (s *Parameters) GetLaunchLatitude() OptFloat64 {
return s.LaunchLatitude
}
// GetLaunchLongitude returns the value of LaunchLongitude.
func (s *Parameters) GetLaunchLongitude() OptFloat64 {
return s.LaunchLongitude
}
// GetLaunchDatetime returns the value of LaunchDatetime.
func (s *Parameters) GetLaunchDatetime() OptDateTime {
return s.LaunchDatetime
}
// GetLaunchAltitude returns the value of LaunchAltitude.
func (s *Parameters) GetLaunchAltitude() OptFloat64 {
return s.LaunchAltitude
}
// GetProfile returns the value of Profile.
func (s *Parameters) GetProfile() OptParametersProfile {
return s.Profile
}
// GetAscentRate returns the value of AscentRate.
func (s *Parameters) GetAscentRate() OptFloat64 {
return s.AscentRate
}
// GetBurstAltitude returns the value of BurstAltitude.
func (s *Parameters) GetBurstAltitude() OptFloat64 {
return s.BurstAltitude
}
// GetDescentRate returns the value of DescentRate.
func (s *Parameters) GetDescentRate() OptFloat64 {
return s.DescentRate
}
// GetFloatAltitude returns the value of FloatAltitude.
func (s *Parameters) GetFloatAltitude() OptFloat64 {
return s.FloatAltitude
}
// GetStopDatetime returns the value of StopDatetime.
func (s *Parameters) GetStopDatetime() OptDateTime {
return s.StopDatetime
}
// GetAscentCurve returns the value of AscentCurve.
func (s *Parameters) GetAscentCurve() OptString {
return s.AscentCurve
}
// GetDescentCurve returns the value of DescentCurve.
func (s *Parameters) GetDescentCurve() OptString {
return s.DescentCurve
}
// GetInterpolate returns the value of Interpolate.
func (s *Parameters) GetInterpolate() OptBool {
return s.Interpolate
}
// GetFormat returns the value of Format.
func (s *Parameters) GetFormat() OptParametersFormat {
return s.Format
}
// GetDataset returns the value of Dataset.
func (s *Parameters) GetDataset() OptDateTime {
return s.Dataset
}
// SetLaunchLatitude sets the value of LaunchLatitude.
func (s *Parameters) SetLaunchLatitude(val OptFloat64) {
s.LaunchLatitude = val
}
// SetLaunchLongitude sets the value of LaunchLongitude.
func (s *Parameters) SetLaunchLongitude(val OptFloat64) {
s.LaunchLongitude = val
}
// SetLaunchDatetime sets the value of LaunchDatetime.
func (s *Parameters) SetLaunchDatetime(val OptDateTime) {
s.LaunchDatetime = val
}
// SetLaunchAltitude sets the value of LaunchAltitude.
func (s *Parameters) SetLaunchAltitude(val OptFloat64) {
s.LaunchAltitude = val
}
// SetProfile sets the value of Profile.
func (s *Parameters) SetProfile(val OptParametersProfile) {
s.Profile = val
}
// SetAscentRate sets the value of AscentRate.
func (s *Parameters) SetAscentRate(val OptFloat64) {
s.AscentRate = val
}
// SetBurstAltitude sets the value of BurstAltitude.
func (s *Parameters) SetBurstAltitude(val OptFloat64) {
s.BurstAltitude = val
}
// SetDescentRate sets the value of DescentRate.
func (s *Parameters) SetDescentRate(val OptFloat64) {
s.DescentRate = val
}
// SetFloatAltitude sets the value of FloatAltitude.
func (s *Parameters) SetFloatAltitude(val OptFloat64) {
s.FloatAltitude = val
}
// SetStopDatetime sets the value of StopDatetime.
func (s *Parameters) SetStopDatetime(val OptDateTime) {
s.StopDatetime = val
}
// SetAscentCurve sets the value of AscentCurve.
func (s *Parameters) SetAscentCurve(val OptString) {
s.AscentCurve = val
}
// SetDescentCurve sets the value of DescentCurve.
func (s *Parameters) SetDescentCurve(val OptString) {
s.DescentCurve = val
}
// SetInterpolate sets the value of Interpolate.
func (s *Parameters) SetInterpolate(val OptBool) {
s.Interpolate = val
}
// SetFormat sets the value of Format.
func (s *Parameters) SetFormat(val OptParametersFormat) {
s.Format = val
}
// SetDataset sets the value of Dataset.
func (s *Parameters) SetDataset(val OptDateTime) {
s.Dataset = val
}
type ParametersFormat string
const (
ParametersFormatJSON ParametersFormat = "json"
)
// AllValues returns all ParametersFormat values.
func (ParametersFormat) AllValues() []ParametersFormat {
return []ParametersFormat{
ParametersFormatJSON,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ParametersFormat) MarshalText() ([]byte, error) {
switch s {
case ParametersFormatJSON:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ParametersFormat) UnmarshalText(data []byte) error {
switch ParametersFormat(data) {
case ParametersFormatJSON:
*s = ParametersFormatJSON
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
type ParametersProfile string
const (
ParametersProfileStandardProfile ParametersProfile = "standard_profile"
ParametersProfileFloatProfile ParametersProfile = "float_profile"
ParametersProfileReverseProfile ParametersProfile = "reverse_profile"
ParametersProfileCustomProfile ParametersProfile = "custom_profile"
)
// AllValues returns all ParametersProfile values.
func (ParametersProfile) AllValues() []ParametersProfile {
return []ParametersProfile{
ParametersProfileStandardProfile,
ParametersProfileFloatProfile,
ParametersProfileReverseProfile,
ParametersProfileCustomProfile,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ParametersProfile) MarshalText() ([]byte, error) {
switch s {
case ParametersProfileStandardProfile:
return []byte(s), nil
case ParametersProfileFloatProfile:
return []byte(s), nil
case ParametersProfileReverseProfile:
return []byte(s), nil
case ParametersProfileCustomProfile:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ParametersProfile) UnmarshalText(data []byte) error {
switch ParametersProfile(data) {
case ParametersProfileStandardProfile:
*s = ParametersProfileStandardProfile
return nil
case ParametersProfileFloatProfile:
*s = ParametersProfileFloatProfile
return nil
case ParametersProfileReverseProfile:
*s = ParametersProfileReverseProfile
return nil
case ParametersProfileCustomProfile:
*s = ParametersProfileCustomProfile
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
// Ref: #/components/schemas/Prediction/Result
type Result struct {
Metadata ResultMetadata `json:"metadata"`
Prediction []ResultPredictionItem `json:"prediction"`
}
// GetMetadata returns the value of Metadata.
func (s *Result) GetMetadata() ResultMetadata {
return s.Metadata
}
// GetPrediction returns the value of Prediction.
func (s *Result) GetPrediction() []ResultPredictionItem {
return s.Prediction
}
// SetMetadata sets the value of Metadata.
func (s *Result) SetMetadata(val ResultMetadata) {
s.Metadata = val
}
// SetPrediction sets the value of Prediction.
func (s *Result) SetPrediction(val []ResultPredictionItem) {
s.Prediction = val
}
type ResultMetadata struct {
CompleteDatetime time.Time `json:"complete_datetime"`
StartDatetime time.Time `json:"start_datetime"`
}
// GetCompleteDatetime returns the value of CompleteDatetime.
func (s *ResultMetadata) GetCompleteDatetime() time.Time {
return s.CompleteDatetime
}
// GetStartDatetime returns the value of StartDatetime.
func (s *ResultMetadata) GetStartDatetime() time.Time {
return s.StartDatetime
}
// SetCompleteDatetime sets the value of CompleteDatetime.
func (s *ResultMetadata) SetCompleteDatetime(val time.Time) {
s.CompleteDatetime = val
}
// SetStartDatetime sets the value of StartDatetime.
func (s *ResultMetadata) SetStartDatetime(val time.Time) {
s.StartDatetime = val
}
type ResultPredictionItem struct {
Stage ResultPredictionItemStage `json:"stage"`
Trajectory []ResultPredictionItemTrajectoryItem `json:"trajectory"`
}
// GetStage returns the value of Stage.
func (s *ResultPredictionItem) GetStage() ResultPredictionItemStage {
return s.Stage
}
// GetTrajectory returns the value of Trajectory.
func (s *ResultPredictionItem) GetTrajectory() []ResultPredictionItemTrajectoryItem {
return s.Trajectory
}
// SetStage sets the value of Stage.
func (s *ResultPredictionItem) SetStage(val ResultPredictionItemStage) {
s.Stage = val
}
// SetTrajectory sets the value of Trajectory.
func (s *ResultPredictionItem) SetTrajectory(val []ResultPredictionItemTrajectoryItem) {
s.Trajectory = val
}
type ResultPredictionItemStage string
const (
ResultPredictionItemStageAscent ResultPredictionItemStage = "ascent"
ResultPredictionItemStageDescent ResultPredictionItemStage = "descent"
)
// AllValues returns all ResultPredictionItemStage values.
func (ResultPredictionItemStage) AllValues() []ResultPredictionItemStage {
return []ResultPredictionItemStage{
ResultPredictionItemStageAscent,
ResultPredictionItemStageDescent,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s ResultPredictionItemStage) MarshalText() ([]byte, error) {
switch s {
case ResultPredictionItemStageAscent:
return []byte(s), nil
case ResultPredictionItemStageDescent:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
}
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *ResultPredictionItemStage) UnmarshalText(data []byte) error {
switch ResultPredictionItemStage(data) {
case ResultPredictionItemStageAscent:
*s = ResultPredictionItemStageAscent
return nil
case ResultPredictionItemStageDescent:
*s = ResultPredictionItemStageDescent
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
type ResultPredictionItemTrajectoryItem struct{}