feat: predictor works

This commit is contained in:
Anatoly Antonov 2025-06-26 01:15:37 +03:00
parent 11be8f351f
commit 7a9f81e527
20 changed files with 1357 additions and 1794 deletions

View file

@ -203,38 +203,38 @@ func (o OptFloat64) Or(d float64) float64 {
return d
}
// NewOptPredictionParameters returns new OptPredictionParameters with value set to v.
func NewOptPredictionParameters(v PredictionParameters) OptPredictionParameters {
return OptPredictionParameters{
// NewOptPerformPredictionFormat returns new OptPerformPredictionFormat with value set to v.
func NewOptPerformPredictionFormat(v PerformPredictionFormat) OptPerformPredictionFormat {
return OptPerformPredictionFormat{
Value: v,
Set: true,
}
}
// OptPredictionParameters is optional PredictionParameters.
type OptPredictionParameters struct {
Value PredictionParameters
// OptPerformPredictionFormat is optional PerformPredictionFormat.
type OptPerformPredictionFormat struct {
Value PerformPredictionFormat
Set bool
}
// IsSet returns true if OptPredictionParameters was set.
func (o OptPredictionParameters) IsSet() bool { return o.Set }
// IsSet returns true if OptPerformPredictionFormat was set.
func (o OptPerformPredictionFormat) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptPredictionParameters) Reset() {
var v PredictionParameters
func (o *OptPerformPredictionFormat) Reset() {
var v PerformPredictionFormat
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptPredictionParameters) SetTo(v PredictionParameters) {
func (o *OptPerformPredictionFormat) SetTo(v PerformPredictionFormat) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptPredictionParameters) Get() (v PredictionParameters, ok bool) {
func (o OptPerformPredictionFormat) Get() (v PerformPredictionFormat, ok bool) {
if !o.Set {
return v, false
}
@ -242,45 +242,45 @@ func (o OptPredictionParameters) Get() (v PredictionParameters, ok bool) {
}
// Or returns value if set, or given parameter if does not.
func (o OptPredictionParameters) Or(d PredictionParameters) PredictionParameters {
func (o OptPerformPredictionFormat) Or(d PerformPredictionFormat) PerformPredictionFormat {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptPredictionParametersFormat returns new OptPredictionParametersFormat with value set to v.
func NewOptPredictionParametersFormat(v PredictionParametersFormat) OptPredictionParametersFormat {
return OptPredictionParametersFormat{
// NewOptPerformPredictionProfile returns new OptPerformPredictionProfile with value set to v.
func NewOptPerformPredictionProfile(v PerformPredictionProfile) OptPerformPredictionProfile {
return OptPerformPredictionProfile{
Value: v,
Set: true,
}
}
// OptPredictionParametersFormat is optional PredictionParametersFormat.
type OptPredictionParametersFormat struct {
Value PredictionParametersFormat
// OptPerformPredictionProfile is optional PerformPredictionProfile.
type OptPerformPredictionProfile struct {
Value PerformPredictionProfile
Set bool
}
// IsSet returns true if OptPredictionParametersFormat was set.
func (o OptPredictionParametersFormat) IsSet() bool { return o.Set }
// IsSet returns true if OptPerformPredictionProfile was set.
func (o OptPerformPredictionProfile) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptPredictionParametersFormat) Reset() {
var v PredictionParametersFormat
func (o *OptPerformPredictionProfile) Reset() {
var v PerformPredictionProfile
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptPredictionParametersFormat) SetTo(v PredictionParametersFormat) {
func (o *OptPerformPredictionProfile) SetTo(v PerformPredictionProfile) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptPredictionParametersFormat) Get() (v PredictionParametersFormat, ok bool) {
func (o OptPerformPredictionProfile) Get() (v PerformPredictionProfile, ok bool) {
if !o.Set {
return v, false
}
@ -288,53 +288,7 @@ func (o OptPredictionParametersFormat) Get() (v PredictionParametersFormat, ok b
}
// Or returns value if set, or given parameter if does not.
func (o OptPredictionParametersFormat) Or(d PredictionParametersFormat) PredictionParametersFormat {
if v, ok := o.Get(); ok {
return v
}
return d
}
// NewOptPredictionParametersProfile returns new OptPredictionParametersProfile with value set to v.
func NewOptPredictionParametersProfile(v PredictionParametersProfile) OptPredictionParametersProfile {
return OptPredictionParametersProfile{
Value: v,
Set: true,
}
}
// OptPredictionParametersProfile is optional PredictionParametersProfile.
type OptPredictionParametersProfile struct {
Value PredictionParametersProfile
Set bool
}
// IsSet returns true if OptPredictionParametersProfile was set.
func (o OptPredictionParametersProfile) IsSet() bool { return o.Set }
// Reset unsets value.
func (o *OptPredictionParametersProfile) Reset() {
var v PredictionParametersProfile
o.Value = v
o.Set = false
}
// SetTo sets value to v.
func (o *OptPredictionParametersProfile) SetTo(v PredictionParametersProfile) {
o.Set = true
o.Value = v
}
// Get returns value and boolean that denotes whether value was set.
func (o OptPredictionParametersProfile) Get() (v PredictionParametersProfile, 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 OptPredictionParametersProfile) Or(d PredictionParametersProfile) PredictionParametersProfile {
func (o OptPerformPredictionProfile) Or(d PerformPredictionProfile) PerformPredictionProfile {
if v, ok := o.Get(); ok {
return v
}
@ -387,194 +341,23 @@ func (o OptString) Or(d string) string {
return d
}
// Ref: #/components/schemas/PredictionParameters
type PredictionParameters struct {
LaunchLatitude OptFloat64 `json:"launch_latitude"`
LaunchLongitude OptFloat64 `json:"launch_longitude"`
LaunchDatetime OptDateTime `json:"launch_datetime"`
LaunchAltitude OptFloat64 `json:"launch_altitude"`
Profile OptPredictionParametersProfile `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 OptPredictionParametersFormat `json:"format"`
Dataset OptDateTime `json:"dataset"`
}
// GetLaunchLatitude returns the value of LaunchLatitude.
func (s *PredictionParameters) GetLaunchLatitude() OptFloat64 {
return s.LaunchLatitude
}
// GetLaunchLongitude returns the value of LaunchLongitude.
func (s *PredictionParameters) GetLaunchLongitude() OptFloat64 {
return s.LaunchLongitude
}
// GetLaunchDatetime returns the value of LaunchDatetime.
func (s *PredictionParameters) GetLaunchDatetime() OptDateTime {
return s.LaunchDatetime
}
// GetLaunchAltitude returns the value of LaunchAltitude.
func (s *PredictionParameters) GetLaunchAltitude() OptFloat64 {
return s.LaunchAltitude
}
// GetProfile returns the value of Profile.
func (s *PredictionParameters) GetProfile() OptPredictionParametersProfile {
return s.Profile
}
// GetAscentRate returns the value of AscentRate.
func (s *PredictionParameters) GetAscentRate() OptFloat64 {
return s.AscentRate
}
// GetBurstAltitude returns the value of BurstAltitude.
func (s *PredictionParameters) GetBurstAltitude() OptFloat64 {
return s.BurstAltitude
}
// GetDescentRate returns the value of DescentRate.
func (s *PredictionParameters) GetDescentRate() OptFloat64 {
return s.DescentRate
}
// GetFloatAltitude returns the value of FloatAltitude.
func (s *PredictionParameters) GetFloatAltitude() OptFloat64 {
return s.FloatAltitude
}
// GetStopDatetime returns the value of StopDatetime.
func (s *PredictionParameters) GetStopDatetime() OptDateTime {
return s.StopDatetime
}
// GetAscentCurve returns the value of AscentCurve.
func (s *PredictionParameters) GetAscentCurve() OptString {
return s.AscentCurve
}
// GetDescentCurve returns the value of DescentCurve.
func (s *PredictionParameters) GetDescentCurve() OptString {
return s.DescentCurve
}
// GetInterpolate returns the value of Interpolate.
func (s *PredictionParameters) GetInterpolate() OptBool {
return s.Interpolate
}
// GetFormat returns the value of Format.
func (s *PredictionParameters) GetFormat() OptPredictionParametersFormat {
return s.Format
}
// GetDataset returns the value of Dataset.
func (s *PredictionParameters) GetDataset() OptDateTime {
return s.Dataset
}
// SetLaunchLatitude sets the value of LaunchLatitude.
func (s *PredictionParameters) SetLaunchLatitude(val OptFloat64) {
s.LaunchLatitude = val
}
// SetLaunchLongitude sets the value of LaunchLongitude.
func (s *PredictionParameters) SetLaunchLongitude(val OptFloat64) {
s.LaunchLongitude = val
}
// SetLaunchDatetime sets the value of LaunchDatetime.
func (s *PredictionParameters) SetLaunchDatetime(val OptDateTime) {
s.LaunchDatetime = val
}
// SetLaunchAltitude sets the value of LaunchAltitude.
func (s *PredictionParameters) SetLaunchAltitude(val OptFloat64) {
s.LaunchAltitude = val
}
// SetProfile sets the value of Profile.
func (s *PredictionParameters) SetProfile(val OptPredictionParametersProfile) {
s.Profile = val
}
// SetAscentRate sets the value of AscentRate.
func (s *PredictionParameters) SetAscentRate(val OptFloat64) {
s.AscentRate = val
}
// SetBurstAltitude sets the value of BurstAltitude.
func (s *PredictionParameters) SetBurstAltitude(val OptFloat64) {
s.BurstAltitude = val
}
// SetDescentRate sets the value of DescentRate.
func (s *PredictionParameters) SetDescentRate(val OptFloat64) {
s.DescentRate = val
}
// SetFloatAltitude sets the value of FloatAltitude.
func (s *PredictionParameters) SetFloatAltitude(val OptFloat64) {
s.FloatAltitude = val
}
// SetStopDatetime sets the value of StopDatetime.
func (s *PredictionParameters) SetStopDatetime(val OptDateTime) {
s.StopDatetime = val
}
// SetAscentCurve sets the value of AscentCurve.
func (s *PredictionParameters) SetAscentCurve(val OptString) {
s.AscentCurve = val
}
// SetDescentCurve sets the value of DescentCurve.
func (s *PredictionParameters) SetDescentCurve(val OptString) {
s.DescentCurve = val
}
// SetInterpolate sets the value of Interpolate.
func (s *PredictionParameters) SetInterpolate(val OptBool) {
s.Interpolate = val
}
// SetFormat sets the value of Format.
func (s *PredictionParameters) SetFormat(val OptPredictionParametersFormat) {
s.Format = val
}
// SetDataset sets the value of Dataset.
func (s *PredictionParameters) SetDataset(val OptDateTime) {
s.Dataset = val
}
type PredictionParametersFormat string
type PerformPredictionFormat string
const (
PredictionParametersFormatJSON PredictionParametersFormat = "json"
PerformPredictionFormatJSON PerformPredictionFormat = "json"
)
// AllValues returns all PredictionParametersFormat values.
func (PredictionParametersFormat) AllValues() []PredictionParametersFormat {
return []PredictionParametersFormat{
PredictionParametersFormatJSON,
// AllValues returns all PerformPredictionFormat values.
func (PerformPredictionFormat) AllValues() []PerformPredictionFormat {
return []PerformPredictionFormat{
PerformPredictionFormatJSON,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s PredictionParametersFormat) MarshalText() ([]byte, error) {
func (s PerformPredictionFormat) MarshalText() ([]byte, error) {
switch s {
case PredictionParametersFormatJSON:
case PerformPredictionFormatJSON:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
@ -582,45 +365,45 @@ func (s PredictionParametersFormat) MarshalText() ([]byte, error) {
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *PredictionParametersFormat) UnmarshalText(data []byte) error {
switch PredictionParametersFormat(data) {
case PredictionParametersFormatJSON:
*s = PredictionParametersFormatJSON
func (s *PerformPredictionFormat) UnmarshalText(data []byte) error {
switch PerformPredictionFormat(data) {
case PerformPredictionFormatJSON:
*s = PerformPredictionFormatJSON
return nil
default:
return errors.Errorf("invalid value: %q", data)
}
}
type PredictionParametersProfile string
type PerformPredictionProfile string
const (
PredictionParametersProfileStandardProfile PredictionParametersProfile = "standard_profile"
PredictionParametersProfileFloatProfile PredictionParametersProfile = "float_profile"
PredictionParametersProfileReverseProfile PredictionParametersProfile = "reverse_profile"
PredictionParametersProfileCustomProfile PredictionParametersProfile = "custom_profile"
PerformPredictionProfileStandardProfile PerformPredictionProfile = "standard_profile"
PerformPredictionProfileFloatProfile PerformPredictionProfile = "float_profile"
PerformPredictionProfileReverseProfile PerformPredictionProfile = "reverse_profile"
PerformPredictionProfileCustomProfile PerformPredictionProfile = "custom_profile"
)
// AllValues returns all PredictionParametersProfile values.
func (PredictionParametersProfile) AllValues() []PredictionParametersProfile {
return []PredictionParametersProfile{
PredictionParametersProfileStandardProfile,
PredictionParametersProfileFloatProfile,
PredictionParametersProfileReverseProfile,
PredictionParametersProfileCustomProfile,
// AllValues returns all PerformPredictionProfile values.
func (PerformPredictionProfile) AllValues() []PerformPredictionProfile {
return []PerformPredictionProfile{
PerformPredictionProfileStandardProfile,
PerformPredictionProfileFloatProfile,
PerformPredictionProfileReverseProfile,
PerformPredictionProfileCustomProfile,
}
}
// MarshalText implements encoding.TextMarshaler.
func (s PredictionParametersProfile) MarshalText() ([]byte, error) {
func (s PerformPredictionProfile) MarshalText() ([]byte, error) {
switch s {
case PredictionParametersProfileStandardProfile:
case PerformPredictionProfileStandardProfile:
return []byte(s), nil
case PredictionParametersProfileFloatProfile:
case PerformPredictionProfileFloatProfile:
return []byte(s), nil
case PredictionParametersProfileReverseProfile:
case PerformPredictionProfileReverseProfile:
return []byte(s), nil
case PredictionParametersProfileCustomProfile:
case PerformPredictionProfileCustomProfile:
return []byte(s), nil
default:
return nil, errors.Errorf("invalid value: %q", s)
@ -628,19 +411,19 @@ func (s PredictionParametersProfile) MarshalText() ([]byte, error) {
}
// UnmarshalText implements encoding.TextUnmarshaler.
func (s *PredictionParametersProfile) UnmarshalText(data []byte) error {
switch PredictionParametersProfile(data) {
case PredictionParametersProfileStandardProfile:
*s = PredictionParametersProfileStandardProfile
func (s *PerformPredictionProfile) UnmarshalText(data []byte) error {
switch PerformPredictionProfile(data) {
case PerformPredictionProfileStandardProfile:
*s = PerformPredictionProfileStandardProfile
return nil
case PredictionParametersProfileFloatProfile:
*s = PredictionParametersProfileFloatProfile
case PerformPredictionProfileFloatProfile:
*s = PerformPredictionProfileFloatProfile
return nil
case PredictionParametersProfileReverseProfile:
*s = PredictionParametersProfileReverseProfile
case PerformPredictionProfileReverseProfile:
*s = PerformPredictionProfileReverseProfile
return nil
case PredictionParametersProfileCustomProfile:
*s = PredictionParametersProfileCustomProfile
case PerformPredictionProfileCustomProfile:
*s = PerformPredictionProfileCustomProfile
return nil
default:
return errors.Errorf("invalid value: %q", data)