feat: implemented service/transport/main layers
This commit is contained in:
parent
5158c5d7c9
commit
bcb9ace54c
29 changed files with 804 additions and 393 deletions
|
|
@ -32,7 +32,7 @@ type Invoker interface {
|
|||
// Perform preidction.
|
||||
//
|
||||
// POST /api/v1/prediction
|
||||
PerformPrediction(ctx context.Context, request OptParameters, params PerformPredictionParams) (*Result, error)
|
||||
PerformPrediction(ctx context.Context, request OptPredictionParameters, params PerformPredictionParams) (*PredictionResult, error)
|
||||
}
|
||||
|
||||
// Client implements OAS client.
|
||||
|
|
@ -87,12 +87,12 @@ func (c *Client) requestURL(ctx context.Context) *url.URL {
|
|||
// Perform preidction.
|
||||
//
|
||||
// POST /api/v1/prediction
|
||||
func (c *Client) PerformPrediction(ctx context.Context, request OptParameters, params PerformPredictionParams) (*Result, error) {
|
||||
func (c *Client) PerformPrediction(ctx context.Context, request OptPredictionParameters, params PerformPredictionParams) (*PredictionResult, error) {
|
||||
res, err := c.sendPerformPrediction(ctx, request, params)
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (c *Client) sendPerformPrediction(ctx context.Context, request OptParameters, params PerformPredictionParams) (res *Result, err error) {
|
||||
func (c *Client) sendPerformPrediction(ctx context.Context, request OptPredictionParameters, params PerformPredictionParams) (res *PredictionResult, err error) {
|
||||
otelAttrs := []attribute.KeyValue{
|
||||
otelogen.OperationID("performPrediction"),
|
||||
semconv.HTTPRequestMethodKey.String("POST"),
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
package gsn
|
||||
|
||||
// setDefaults set default value of fields.
|
||||
func (s *Parameters) setDefaults() {
|
||||
func (s *PredictionParameters) setDefaults() {
|
||||
{
|
||||
val := bool(false)
|
||||
s.Interpolate.SetTo(val)
|
||||
}
|
||||
{
|
||||
val := ParametersFormat("json")
|
||||
val := PredictionParametersFormat("json")
|
||||
s.Format.SetTo(val)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
|
|||
}
|
||||
}()
|
||||
|
||||
var response *Result
|
||||
var response *PredictionResult
|
||||
if m := s.cfg.Middleware; m != nil {
|
||||
mreq := middleware.Request{
|
||||
Context: ctx,
|
||||
|
|
@ -148,9 +148,9 @@ func (s *Server) handlePerformPredictionRequest(args [0]string, argsEscaped bool
|
|||
}
|
||||
|
||||
type (
|
||||
Request = OptParameters
|
||||
Request = OptPredictionParameters
|
||||
Params = PerformPredictionParams
|
||||
Response = *Result
|
||||
Response = *PredictionResult
|
||||
)
|
||||
response, err = middleware.HookMiddleware[
|
||||
Request,
|
||||
|
|
|
|||
|
|
@ -232,18 +232,18 @@ func (s *OptFloat64) UnmarshalJSON(data []byte) error {
|
|||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes Parameters as json.
|
||||
func (o OptParameters) Encode(e *jx.Encoder) {
|
||||
// Encode encodes PredictionParameters as json.
|
||||
func (o OptPredictionParameters) Encode(e *jx.Encoder) {
|
||||
if !o.Set {
|
||||
return
|
||||
}
|
||||
o.Value.Encode(e)
|
||||
}
|
||||
|
||||
// Decode decodes Parameters from json.
|
||||
func (o *OptParameters) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionParameters from json.
|
||||
func (o *OptPredictionParameters) Decode(d *jx.Decoder) error {
|
||||
if o == nil {
|
||||
return errors.New("invalid: unable to decode OptParameters to nil")
|
||||
return errors.New("invalid: unable to decode OptPredictionParameters to nil")
|
||||
}
|
||||
o.Set = true
|
||||
if err := o.Value.Decode(d); err != nil {
|
||||
|
|
@ -253,30 +253,30 @@ func (o *OptParameters) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s OptParameters) MarshalJSON() ([]byte, error) {
|
||||
func (s OptPredictionParameters) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *OptParameters) UnmarshalJSON(data []byte) error {
|
||||
func (s *OptPredictionParameters) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes ParametersFormat as json.
|
||||
func (o OptParametersFormat) Encode(e *jx.Encoder) {
|
||||
// Encode encodes PredictionParametersFormat as json.
|
||||
func (o OptPredictionParametersFormat) Encode(e *jx.Encoder) {
|
||||
if !o.Set {
|
||||
return
|
||||
}
|
||||
e.Str(string(o.Value))
|
||||
}
|
||||
|
||||
// Decode decodes ParametersFormat from json.
|
||||
func (o *OptParametersFormat) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionParametersFormat from json.
|
||||
func (o *OptPredictionParametersFormat) Decode(d *jx.Decoder) error {
|
||||
if o == nil {
|
||||
return errors.New("invalid: unable to decode OptParametersFormat to nil")
|
||||
return errors.New("invalid: unable to decode OptPredictionParametersFormat to nil")
|
||||
}
|
||||
o.Set = true
|
||||
if err := o.Value.Decode(d); err != nil {
|
||||
|
|
@ -286,30 +286,30 @@ func (o *OptParametersFormat) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s OptParametersFormat) MarshalJSON() ([]byte, error) {
|
||||
func (s OptPredictionParametersFormat) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *OptParametersFormat) UnmarshalJSON(data []byte) error {
|
||||
func (s *OptPredictionParametersFormat) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes ParametersProfile as json.
|
||||
func (o OptParametersProfile) Encode(e *jx.Encoder) {
|
||||
// Encode encodes PredictionParametersProfile as json.
|
||||
func (o OptPredictionParametersProfile) Encode(e *jx.Encoder) {
|
||||
if !o.Set {
|
||||
return
|
||||
}
|
||||
e.Str(string(o.Value))
|
||||
}
|
||||
|
||||
// Decode decodes ParametersProfile from json.
|
||||
func (o *OptParametersProfile) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionParametersProfile from json.
|
||||
func (o *OptPredictionParametersProfile) Decode(d *jx.Decoder) error {
|
||||
if o == nil {
|
||||
return errors.New("invalid: unable to decode OptParametersProfile to nil")
|
||||
return errors.New("invalid: unable to decode OptPredictionParametersProfile to nil")
|
||||
}
|
||||
o.Set = true
|
||||
if err := o.Value.Decode(d); err != nil {
|
||||
|
|
@ -319,14 +319,14 @@ func (o *OptParametersProfile) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s OptParametersProfile) MarshalJSON() ([]byte, error) {
|
||||
func (s OptPredictionParametersProfile) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *OptParametersProfile) UnmarshalJSON(data []byte) error {
|
||||
func (s *OptPredictionParametersProfile) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
|
@ -367,14 +367,14 @@ func (s *OptString) UnmarshalJSON(data []byte) error {
|
|||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *Parameters) Encode(e *jx.Encoder) {
|
||||
func (s *PredictionParameters) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *Parameters) encodeFields(e *jx.Encoder) {
|
||||
func (s *PredictionParameters) encodeFields(e *jx.Encoder) {
|
||||
{
|
||||
if s.LaunchLatitude.Set {
|
||||
e.FieldStart("launch_latitude")
|
||||
|
|
@ -467,7 +467,7 @@ func (s *Parameters) encodeFields(e *jx.Encoder) {
|
|||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfParameters = [15]string{
|
||||
var jsonFieldsNameOfPredictionParameters = [15]string{
|
||||
0: "launch_latitude",
|
||||
1: "launch_longitude",
|
||||
2: "launch_datetime",
|
||||
|
|
@ -485,10 +485,10 @@ var jsonFieldsNameOfParameters = [15]string{
|
|||
14: "dataset",
|
||||
}
|
||||
|
||||
// Decode decodes Parameters from json.
|
||||
func (s *Parameters) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionParameters from json.
|
||||
func (s *PredictionParameters) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode Parameters to nil")
|
||||
return errors.New("invalid: unable to decode PredictionParameters to nil")
|
||||
}
|
||||
s.setDefaults()
|
||||
|
||||
|
|
@ -649,116 +649,116 @@ func (s *Parameters) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode Parameters")
|
||||
return errors.Wrap(err, "decode PredictionParameters")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *Parameters) MarshalJSON() ([]byte, error) {
|
||||
func (s *PredictionParameters) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *Parameters) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionParameters) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes ParametersFormat as json.
|
||||
func (s ParametersFormat) Encode(e *jx.Encoder) {
|
||||
// Encode encodes PredictionParametersFormat as json.
|
||||
func (s PredictionParametersFormat) Encode(e *jx.Encoder) {
|
||||
e.Str(string(s))
|
||||
}
|
||||
|
||||
// Decode decodes ParametersFormat from json.
|
||||
func (s *ParametersFormat) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionParametersFormat from json.
|
||||
func (s *PredictionParametersFormat) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ParametersFormat to nil")
|
||||
return errors.New("invalid: unable to decode PredictionParametersFormat to nil")
|
||||
}
|
||||
v, err := d.StrBytes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Try to use constant string.
|
||||
switch ParametersFormat(v) {
|
||||
case ParametersFormatJSON:
|
||||
*s = ParametersFormatJSON
|
||||
switch PredictionParametersFormat(v) {
|
||||
case PredictionParametersFormatJSON:
|
||||
*s = PredictionParametersFormatJSON
|
||||
default:
|
||||
*s = ParametersFormat(v)
|
||||
*s = PredictionParametersFormat(v)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s ParametersFormat) MarshalJSON() ([]byte, error) {
|
||||
func (s PredictionParametersFormat) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ParametersFormat) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionParametersFormat) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes ParametersProfile as json.
|
||||
func (s ParametersProfile) Encode(e *jx.Encoder) {
|
||||
// Encode encodes PredictionParametersProfile as json.
|
||||
func (s PredictionParametersProfile) Encode(e *jx.Encoder) {
|
||||
e.Str(string(s))
|
||||
}
|
||||
|
||||
// Decode decodes ParametersProfile from json.
|
||||
func (s *ParametersProfile) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionParametersProfile from json.
|
||||
func (s *PredictionParametersProfile) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ParametersProfile to nil")
|
||||
return errors.New("invalid: unable to decode PredictionParametersProfile to nil")
|
||||
}
|
||||
v, err := d.StrBytes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Try to use constant string.
|
||||
switch ParametersProfile(v) {
|
||||
case ParametersProfileStandardProfile:
|
||||
*s = ParametersProfileStandardProfile
|
||||
case ParametersProfileFloatProfile:
|
||||
*s = ParametersProfileFloatProfile
|
||||
case ParametersProfileReverseProfile:
|
||||
*s = ParametersProfileReverseProfile
|
||||
case ParametersProfileCustomProfile:
|
||||
*s = ParametersProfileCustomProfile
|
||||
switch PredictionParametersProfile(v) {
|
||||
case PredictionParametersProfileStandardProfile:
|
||||
*s = PredictionParametersProfileStandardProfile
|
||||
case PredictionParametersProfileFloatProfile:
|
||||
*s = PredictionParametersProfileFloatProfile
|
||||
case PredictionParametersProfileReverseProfile:
|
||||
*s = PredictionParametersProfileReverseProfile
|
||||
case PredictionParametersProfileCustomProfile:
|
||||
*s = PredictionParametersProfileCustomProfile
|
||||
default:
|
||||
*s = ParametersProfile(v)
|
||||
*s = PredictionParametersProfile(v)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s ParametersProfile) MarshalJSON() ([]byte, error) {
|
||||
func (s PredictionParametersProfile) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ParametersProfile) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionParametersProfile) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *Result) Encode(e *jx.Encoder) {
|
||||
func (s *PredictionResult) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *Result) encodeFields(e *jx.Encoder) {
|
||||
func (s *PredictionResult) encodeFields(e *jx.Encoder) {
|
||||
{
|
||||
e.FieldStart("metadata")
|
||||
s.Metadata.Encode(e)
|
||||
|
|
@ -773,15 +773,15 @@ func (s *Result) encodeFields(e *jx.Encoder) {
|
|||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfResult = [2]string{
|
||||
var jsonFieldsNameOfPredictionResult = [2]string{
|
||||
0: "metadata",
|
||||
1: "prediction",
|
||||
}
|
||||
|
||||
// Decode decodes Result from json.
|
||||
func (s *Result) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionResult from json.
|
||||
func (s *PredictionResult) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode Result to nil")
|
||||
return errors.New("invalid: unable to decode PredictionResult to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
|
||||
|
|
@ -800,9 +800,9 @@ func (s *Result) Decode(d *jx.Decoder) error {
|
|||
case "prediction":
|
||||
requiredBitSet[0] |= 1 << 1
|
||||
if err := func() error {
|
||||
s.Prediction = make([]ResultPredictionItem, 0)
|
||||
s.Prediction = make([]PredictionResultPredictionItem, 0)
|
||||
if err := d.Arr(func(d *jx.Decoder) error {
|
||||
var elem ResultPredictionItem
|
||||
var elem PredictionResultPredictionItem
|
||||
if err := elem.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -820,7 +820,7 @@ func (s *Result) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode Result")
|
||||
return errors.Wrap(err, "decode PredictionResult")
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
|
|
@ -837,8 +837,8 @@ func (s *Result) Decode(d *jx.Decoder) error {
|
|||
bitIdx := bits.TrailingZeros8(result)
|
||||
fieldIdx := i*8 + bitIdx
|
||||
var name string
|
||||
if fieldIdx < len(jsonFieldsNameOfResult) {
|
||||
name = jsonFieldsNameOfResult[fieldIdx]
|
||||
if fieldIdx < len(jsonFieldsNameOfPredictionResult) {
|
||||
name = jsonFieldsNameOfPredictionResult[fieldIdx]
|
||||
} else {
|
||||
name = strconv.Itoa(fieldIdx)
|
||||
}
|
||||
|
|
@ -859,27 +859,27 @@ func (s *Result) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *Result) MarshalJSON() ([]byte, error) {
|
||||
func (s *PredictionResult) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *Result) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionResult) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *ResultMetadata) Encode(e *jx.Encoder) {
|
||||
func (s *PredictionResultMetadata) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *ResultMetadata) encodeFields(e *jx.Encoder) {
|
||||
func (s *PredictionResultMetadata) encodeFields(e *jx.Encoder) {
|
||||
{
|
||||
e.FieldStart("complete_datetime")
|
||||
json.EncodeDateTime(e, s.CompleteDatetime)
|
||||
|
|
@ -890,15 +890,15 @@ func (s *ResultMetadata) encodeFields(e *jx.Encoder) {
|
|||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfResultMetadata = [2]string{
|
||||
var jsonFieldsNameOfPredictionResultMetadata = [2]string{
|
||||
0: "complete_datetime",
|
||||
1: "start_datetime",
|
||||
}
|
||||
|
||||
// Decode decodes ResultMetadata from json.
|
||||
func (s *ResultMetadata) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionResultMetadata from json.
|
||||
func (s *PredictionResultMetadata) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ResultMetadata to nil")
|
||||
return errors.New("invalid: unable to decode PredictionResultMetadata to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
|
||||
|
|
@ -933,7 +933,7 @@ func (s *ResultMetadata) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode ResultMetadata")
|
||||
return errors.Wrap(err, "decode PredictionResultMetadata")
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
|
|
@ -950,8 +950,8 @@ func (s *ResultMetadata) Decode(d *jx.Decoder) error {
|
|||
bitIdx := bits.TrailingZeros8(result)
|
||||
fieldIdx := i*8 + bitIdx
|
||||
var name string
|
||||
if fieldIdx < len(jsonFieldsNameOfResultMetadata) {
|
||||
name = jsonFieldsNameOfResultMetadata[fieldIdx]
|
||||
if fieldIdx < len(jsonFieldsNameOfPredictionResultMetadata) {
|
||||
name = jsonFieldsNameOfPredictionResultMetadata[fieldIdx]
|
||||
} else {
|
||||
name = strconv.Itoa(fieldIdx)
|
||||
}
|
||||
|
|
@ -972,27 +972,27 @@ func (s *ResultMetadata) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *ResultMetadata) MarshalJSON() ([]byte, error) {
|
||||
func (s *PredictionResultMetadata) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ResultMetadata) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionResultMetadata) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *ResultPredictionItem) Encode(e *jx.Encoder) {
|
||||
func (s *PredictionResultPredictionItem) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *ResultPredictionItem) encodeFields(e *jx.Encoder) {
|
||||
func (s *PredictionResultPredictionItem) encodeFields(e *jx.Encoder) {
|
||||
{
|
||||
e.FieldStart("stage")
|
||||
s.Stage.Encode(e)
|
||||
|
|
@ -1007,15 +1007,15 @@ func (s *ResultPredictionItem) encodeFields(e *jx.Encoder) {
|
|||
}
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfResultPredictionItem = [2]string{
|
||||
var jsonFieldsNameOfPredictionResultPredictionItem = [2]string{
|
||||
0: "stage",
|
||||
1: "trajectory",
|
||||
}
|
||||
|
||||
// Decode decodes ResultPredictionItem from json.
|
||||
func (s *ResultPredictionItem) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionResultPredictionItem from json.
|
||||
func (s *PredictionResultPredictionItem) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ResultPredictionItem to nil")
|
||||
return errors.New("invalid: unable to decode PredictionResultPredictionItem to nil")
|
||||
}
|
||||
var requiredBitSet [1]uint8
|
||||
|
||||
|
|
@ -1034,9 +1034,9 @@ func (s *ResultPredictionItem) Decode(d *jx.Decoder) error {
|
|||
case "trajectory":
|
||||
requiredBitSet[0] |= 1 << 1
|
||||
if err := func() error {
|
||||
s.Trajectory = make([]ResultPredictionItemTrajectoryItem, 0)
|
||||
s.Trajectory = make([]PredictionResultPredictionItemTrajectoryItem, 0)
|
||||
if err := d.Arr(func(d *jx.Decoder) error {
|
||||
var elem ResultPredictionItemTrajectoryItem
|
||||
var elem PredictionResultPredictionItemTrajectoryItem
|
||||
if err := elem.Decode(d); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -1054,7 +1054,7 @@ func (s *ResultPredictionItem) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode ResultPredictionItem")
|
||||
return errors.Wrap(err, "decode PredictionResultPredictionItem")
|
||||
}
|
||||
// Validate required fields.
|
||||
var failures []validate.FieldError
|
||||
|
|
@ -1071,8 +1071,8 @@ func (s *ResultPredictionItem) Decode(d *jx.Decoder) error {
|
|||
bitIdx := bits.TrailingZeros8(result)
|
||||
fieldIdx := i*8 + bitIdx
|
||||
var name string
|
||||
if fieldIdx < len(jsonFieldsNameOfResultPredictionItem) {
|
||||
name = jsonFieldsNameOfResultPredictionItem[fieldIdx]
|
||||
if fieldIdx < len(jsonFieldsNameOfPredictionResultPredictionItem) {
|
||||
name = jsonFieldsNameOfPredictionResultPredictionItem[fieldIdx]
|
||||
} else {
|
||||
name = strconv.Itoa(fieldIdx)
|
||||
}
|
||||
|
|
@ -1093,75 +1093,75 @@ func (s *ResultPredictionItem) Decode(d *jx.Decoder) error {
|
|||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *ResultPredictionItem) MarshalJSON() ([]byte, error) {
|
||||
func (s *PredictionResultPredictionItem) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ResultPredictionItem) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionResultPredictionItem) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode encodes ResultPredictionItemStage as json.
|
||||
func (s ResultPredictionItemStage) Encode(e *jx.Encoder) {
|
||||
// Encode encodes PredictionResultPredictionItemStage as json.
|
||||
func (s PredictionResultPredictionItemStage) Encode(e *jx.Encoder) {
|
||||
e.Str(string(s))
|
||||
}
|
||||
|
||||
// Decode decodes ResultPredictionItemStage from json.
|
||||
func (s *ResultPredictionItemStage) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionResultPredictionItemStage from json.
|
||||
func (s *PredictionResultPredictionItemStage) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ResultPredictionItemStage to nil")
|
||||
return errors.New("invalid: unable to decode PredictionResultPredictionItemStage to nil")
|
||||
}
|
||||
v, err := d.StrBytes()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Try to use constant string.
|
||||
switch ResultPredictionItemStage(v) {
|
||||
case ResultPredictionItemStageAscent:
|
||||
*s = ResultPredictionItemStageAscent
|
||||
case ResultPredictionItemStageDescent:
|
||||
*s = ResultPredictionItemStageDescent
|
||||
switch PredictionResultPredictionItemStage(v) {
|
||||
case PredictionResultPredictionItemStageAscent:
|
||||
*s = PredictionResultPredictionItemStageAscent
|
||||
case PredictionResultPredictionItemStageDescent:
|
||||
*s = PredictionResultPredictionItemStageDescent
|
||||
default:
|
||||
*s = ResultPredictionItemStage(v)
|
||||
*s = PredictionResultPredictionItemStage(v)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s ResultPredictionItemStage) MarshalJSON() ([]byte, error) {
|
||||
func (s PredictionResultPredictionItemStage) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ResultPredictionItemStage) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionResultPredictionItemStage) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
||||
// Encode implements json.Marshaler.
|
||||
func (s *ResultPredictionItemTrajectoryItem) Encode(e *jx.Encoder) {
|
||||
func (s *PredictionResultPredictionItemTrajectoryItem) Encode(e *jx.Encoder) {
|
||||
e.ObjStart()
|
||||
s.encodeFields(e)
|
||||
e.ObjEnd()
|
||||
}
|
||||
|
||||
// encodeFields encodes fields.
|
||||
func (s *ResultPredictionItemTrajectoryItem) encodeFields(e *jx.Encoder) {
|
||||
func (s *PredictionResultPredictionItemTrajectoryItem) encodeFields(e *jx.Encoder) {
|
||||
}
|
||||
|
||||
var jsonFieldsNameOfResultPredictionItemTrajectoryItem = [0]string{}
|
||||
var jsonFieldsNameOfPredictionResultPredictionItemTrajectoryItem = [0]string{}
|
||||
|
||||
// Decode decodes ResultPredictionItemTrajectoryItem from json.
|
||||
func (s *ResultPredictionItemTrajectoryItem) Decode(d *jx.Decoder) error {
|
||||
// Decode decodes PredictionResultPredictionItemTrajectoryItem from json.
|
||||
func (s *PredictionResultPredictionItemTrajectoryItem) Decode(d *jx.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode ResultPredictionItemTrajectoryItem to nil")
|
||||
return errors.New("invalid: unable to decode PredictionResultPredictionItemTrajectoryItem to nil")
|
||||
}
|
||||
|
||||
if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
|
||||
|
|
@ -1170,21 +1170,21 @@ func (s *ResultPredictionItemTrajectoryItem) Decode(d *jx.Decoder) error {
|
|||
return d.Skip()
|
||||
}
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode ResultPredictionItemTrajectoryItem")
|
||||
return errors.Wrap(err, "decode PredictionResultPredictionItemTrajectoryItem")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalJSON implements stdjson.Marshaler.
|
||||
func (s *ResultPredictionItemTrajectoryItem) MarshalJSON() ([]byte, error) {
|
||||
func (s *PredictionResultPredictionItemTrajectoryItem) MarshalJSON() ([]byte, error) {
|
||||
e := jx.Encoder{}
|
||||
s.Encode(&e)
|
||||
return e.Bytes(), nil
|
||||
}
|
||||
|
||||
// UnmarshalJSON implements stdjson.Unmarshaler.
|
||||
func (s *ResultPredictionItemTrajectoryItem) UnmarshalJSON(data []byte) error {
|
||||
func (s *PredictionResultPredictionItemTrajectoryItem) UnmarshalJSON(data []byte) error {
|
||||
d := jx.DecodeBytes(data)
|
||||
return s.Decode(d)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
// PerformPredictionParams is parameters of performPrediction operation.
|
||||
type PerformPredictionParams struct {
|
||||
Parameters OptParameters
|
||||
Parameters OptPredictionParameters
|
||||
}
|
||||
|
||||
func unpackPerformPredictionParams(packed middleware.Parameters) (params PerformPredictionParams) {
|
||||
|
|
@ -22,7 +22,7 @@ func unpackPerformPredictionParams(packed middleware.Parameters) (params Perform
|
|||
In: "query",
|
||||
}
|
||||
if v, ok := packed[key]; ok {
|
||||
params.Parameters = v.(OptParameters)
|
||||
params.Parameters = v.(OptPredictionParameters)
|
||||
}
|
||||
}
|
||||
return params
|
||||
|
|
@ -41,7 +41,7 @@ func decodePerformPredictionParams(args [0]string, argsEscaped bool, r *http.Req
|
|||
|
||||
if err := q.HasParam(cfg); err == nil {
|
||||
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
||||
var paramsDotParametersVal Parameters
|
||||
var paramsDotParametersVal PredictionParameters
|
||||
if err := func() error {
|
||||
return paramsDotParametersVal.DecodeURI(d)
|
||||
}(); err != nil {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
func (s *Server) decodePerformPredictionRequest(r *http.Request) (
|
||||
req OptParameters,
|
||||
req OptPredictionParameters,
|
||||
close func() error,
|
||||
rerr error,
|
||||
) {
|
||||
|
|
@ -57,7 +57,7 @@ func (s *Server) decodePerformPredictionRequest(r *http.Request) (
|
|||
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var request OptParameters
|
||||
var request OptPredictionParameters
|
||||
if err := func() error {
|
||||
request.Reset()
|
||||
if err := request.Decode(d); err != nil {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
func encodePerformPredictionRequest(
|
||||
req OptParameters,
|
||||
req OptPredictionParameters,
|
||||
r *http.Request,
|
||||
) error {
|
||||
const contentType = "application/json"
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import (
|
|||
"github.com/ogen-go/ogen/validate"
|
||||
)
|
||||
|
||||
func decodePerformPredictionResponse(resp *http.Response) (res *Result, _ error) {
|
||||
func decodePerformPredictionResponse(resp *http.Response) (res *PredictionResult, _ error) {
|
||||
switch resp.StatusCode {
|
||||
case 200:
|
||||
// Code 200.
|
||||
|
|
@ -30,7 +30,7 @@ func decodePerformPredictionResponse(resp *http.Response) (res *Result, _ error)
|
|||
}
|
||||
d := jx.DecodeBytes(buf)
|
||||
|
||||
var response Result
|
||||
var response PredictionResult
|
||||
if err := func() error {
|
||||
if err := response.Decode(d); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
ht "github.com/ogen-go/ogen/http"
|
||||
)
|
||||
|
||||
func encodePerformPredictionResponse(response *Result, w http.ResponseWriter, span trace.Span) error {
|
||||
func encodePerformPredictionResponse(response *PredictionResult, w http.ResponseWriter, span trace.Span) error {
|
||||
w.Header().Set("Content-Type", "application/json; charset=utf-8")
|
||||
w.WriteHeader(200)
|
||||
span.SetStatus(codes.Ok, http.StatusText(200))
|
||||
|
|
|
|||
|
|
@ -203,38 +203,38 @@ func (o OptFloat64) Or(d float64) float64 {
|
|||
return d
|
||||
}
|
||||
|
||||
// NewOptParameters returns new OptParameters with value set to v.
|
||||
func NewOptParameters(v Parameters) OptParameters {
|
||||
return OptParameters{
|
||||
// NewOptPredictionParameters returns new OptPredictionParameters with value set to v.
|
||||
func NewOptPredictionParameters(v PredictionParameters) OptPredictionParameters {
|
||||
return OptPredictionParameters{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptParameters is optional Parameters.
|
||||
type OptParameters struct {
|
||||
Value Parameters
|
||||
// OptPredictionParameters is optional PredictionParameters.
|
||||
type OptPredictionParameters struct {
|
||||
Value PredictionParameters
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptParameters was set.
|
||||
func (o OptParameters) IsSet() bool { return o.Set }
|
||||
// IsSet returns true if OptPredictionParameters was set.
|
||||
func (o OptPredictionParameters) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptParameters) Reset() {
|
||||
var v Parameters
|
||||
func (o *OptPredictionParameters) Reset() {
|
||||
var v PredictionParameters
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptParameters) SetTo(v Parameters) {
|
||||
func (o *OptPredictionParameters) SetTo(v PredictionParameters) {
|
||||
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) {
|
||||
func (o OptPredictionParameters) Get() (v PredictionParameters, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
|
|
@ -242,45 +242,45 @@ func (o OptParameters) Get() (v Parameters, ok bool) {
|
|||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptParameters) Or(d Parameters) Parameters {
|
||||
func (o OptPredictionParameters) Or(d PredictionParameters) PredictionParameters {
|
||||
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{
|
||||
// NewOptPredictionParametersFormat returns new OptPredictionParametersFormat with value set to v.
|
||||
func NewOptPredictionParametersFormat(v PredictionParametersFormat) OptPredictionParametersFormat {
|
||||
return OptPredictionParametersFormat{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptParametersFormat is optional ParametersFormat.
|
||||
type OptParametersFormat struct {
|
||||
Value ParametersFormat
|
||||
// OptPredictionParametersFormat is optional PredictionParametersFormat.
|
||||
type OptPredictionParametersFormat struct {
|
||||
Value PredictionParametersFormat
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptParametersFormat was set.
|
||||
func (o OptParametersFormat) IsSet() bool { return o.Set }
|
||||
// IsSet returns true if OptPredictionParametersFormat was set.
|
||||
func (o OptPredictionParametersFormat) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptParametersFormat) Reset() {
|
||||
var v ParametersFormat
|
||||
func (o *OptPredictionParametersFormat) Reset() {
|
||||
var v PredictionParametersFormat
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptParametersFormat) SetTo(v ParametersFormat) {
|
||||
func (o *OptPredictionParametersFormat) SetTo(v PredictionParametersFormat) {
|
||||
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) {
|
||||
func (o OptPredictionParametersFormat) Get() (v PredictionParametersFormat, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
|
|
@ -288,45 +288,45 @@ func (o OptParametersFormat) Get() (v ParametersFormat, ok bool) {
|
|||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptParametersFormat) Or(d ParametersFormat) ParametersFormat {
|
||||
func (o OptPredictionParametersFormat) Or(d PredictionParametersFormat) PredictionParametersFormat {
|
||||
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{
|
||||
// NewOptPredictionParametersProfile returns new OptPredictionParametersProfile with value set to v.
|
||||
func NewOptPredictionParametersProfile(v PredictionParametersProfile) OptPredictionParametersProfile {
|
||||
return OptPredictionParametersProfile{
|
||||
Value: v,
|
||||
Set: true,
|
||||
}
|
||||
}
|
||||
|
||||
// OptParametersProfile is optional ParametersProfile.
|
||||
type OptParametersProfile struct {
|
||||
Value ParametersProfile
|
||||
// OptPredictionParametersProfile is optional PredictionParametersProfile.
|
||||
type OptPredictionParametersProfile struct {
|
||||
Value PredictionParametersProfile
|
||||
Set bool
|
||||
}
|
||||
|
||||
// IsSet returns true if OptParametersProfile was set.
|
||||
func (o OptParametersProfile) IsSet() bool { return o.Set }
|
||||
// IsSet returns true if OptPredictionParametersProfile was set.
|
||||
func (o OptPredictionParametersProfile) IsSet() bool { return o.Set }
|
||||
|
||||
// Reset unsets value.
|
||||
func (o *OptParametersProfile) Reset() {
|
||||
var v ParametersProfile
|
||||
func (o *OptPredictionParametersProfile) Reset() {
|
||||
var v PredictionParametersProfile
|
||||
o.Value = v
|
||||
o.Set = false
|
||||
}
|
||||
|
||||
// SetTo sets value to v.
|
||||
func (o *OptParametersProfile) SetTo(v ParametersProfile) {
|
||||
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 OptParametersProfile) Get() (v ParametersProfile, ok bool) {
|
||||
func (o OptPredictionParametersProfile) Get() (v PredictionParametersProfile, ok bool) {
|
||||
if !o.Set {
|
||||
return v, false
|
||||
}
|
||||
|
|
@ -334,7 +334,7 @@ func (o OptParametersProfile) Get() (v ParametersProfile, ok bool) {
|
|||
}
|
||||
|
||||
// Or returns value if set, or given parameter if does not.
|
||||
func (o OptParametersProfile) Or(d ParametersProfile) ParametersProfile {
|
||||
func (o OptPredictionParametersProfile) Or(d PredictionParametersProfile) PredictionParametersProfile {
|
||||
if v, ok := o.Get(); ok {
|
||||
return v
|
||||
}
|
||||
|
|
@ -387,194 +387,194 @@ func (o OptString) Or(d string) string {
|
|||
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"`
|
||||
// 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 OptParametersFormat `json:"format"`
|
||||
Dataset OptDateTime `json:"dataset"`
|
||||
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 *Parameters) GetLaunchLatitude() OptFloat64 {
|
||||
func (s *PredictionParameters) GetLaunchLatitude() OptFloat64 {
|
||||
return s.LaunchLatitude
|
||||
}
|
||||
|
||||
// GetLaunchLongitude returns the value of LaunchLongitude.
|
||||
func (s *Parameters) GetLaunchLongitude() OptFloat64 {
|
||||
func (s *PredictionParameters) GetLaunchLongitude() OptFloat64 {
|
||||
return s.LaunchLongitude
|
||||
}
|
||||
|
||||
// GetLaunchDatetime returns the value of LaunchDatetime.
|
||||
func (s *Parameters) GetLaunchDatetime() OptDateTime {
|
||||
func (s *PredictionParameters) GetLaunchDatetime() OptDateTime {
|
||||
return s.LaunchDatetime
|
||||
}
|
||||
|
||||
// GetLaunchAltitude returns the value of LaunchAltitude.
|
||||
func (s *Parameters) GetLaunchAltitude() OptFloat64 {
|
||||
func (s *PredictionParameters) GetLaunchAltitude() OptFloat64 {
|
||||
return s.LaunchAltitude
|
||||
}
|
||||
|
||||
// GetProfile returns the value of Profile.
|
||||
func (s *Parameters) GetProfile() OptParametersProfile {
|
||||
func (s *PredictionParameters) GetProfile() OptPredictionParametersProfile {
|
||||
return s.Profile
|
||||
}
|
||||
|
||||
// GetAscentRate returns the value of AscentRate.
|
||||
func (s *Parameters) GetAscentRate() OptFloat64 {
|
||||
func (s *PredictionParameters) GetAscentRate() OptFloat64 {
|
||||
return s.AscentRate
|
||||
}
|
||||
|
||||
// GetBurstAltitude returns the value of BurstAltitude.
|
||||
func (s *Parameters) GetBurstAltitude() OptFloat64 {
|
||||
func (s *PredictionParameters) GetBurstAltitude() OptFloat64 {
|
||||
return s.BurstAltitude
|
||||
}
|
||||
|
||||
// GetDescentRate returns the value of DescentRate.
|
||||
func (s *Parameters) GetDescentRate() OptFloat64 {
|
||||
func (s *PredictionParameters) GetDescentRate() OptFloat64 {
|
||||
return s.DescentRate
|
||||
}
|
||||
|
||||
// GetFloatAltitude returns the value of FloatAltitude.
|
||||
func (s *Parameters) GetFloatAltitude() OptFloat64 {
|
||||
func (s *PredictionParameters) GetFloatAltitude() OptFloat64 {
|
||||
return s.FloatAltitude
|
||||
}
|
||||
|
||||
// GetStopDatetime returns the value of StopDatetime.
|
||||
func (s *Parameters) GetStopDatetime() OptDateTime {
|
||||
func (s *PredictionParameters) GetStopDatetime() OptDateTime {
|
||||
return s.StopDatetime
|
||||
}
|
||||
|
||||
// GetAscentCurve returns the value of AscentCurve.
|
||||
func (s *Parameters) GetAscentCurve() OptString {
|
||||
func (s *PredictionParameters) GetAscentCurve() OptString {
|
||||
return s.AscentCurve
|
||||
}
|
||||
|
||||
// GetDescentCurve returns the value of DescentCurve.
|
||||
func (s *Parameters) GetDescentCurve() OptString {
|
||||
func (s *PredictionParameters) GetDescentCurve() OptString {
|
||||
return s.DescentCurve
|
||||
}
|
||||
|
||||
// GetInterpolate returns the value of Interpolate.
|
||||
func (s *Parameters) GetInterpolate() OptBool {
|
||||
func (s *PredictionParameters) GetInterpolate() OptBool {
|
||||
return s.Interpolate
|
||||
}
|
||||
|
||||
// GetFormat returns the value of Format.
|
||||
func (s *Parameters) GetFormat() OptParametersFormat {
|
||||
func (s *PredictionParameters) GetFormat() OptPredictionParametersFormat {
|
||||
return s.Format
|
||||
}
|
||||
|
||||
// GetDataset returns the value of Dataset.
|
||||
func (s *Parameters) GetDataset() OptDateTime {
|
||||
func (s *PredictionParameters) GetDataset() OptDateTime {
|
||||
return s.Dataset
|
||||
}
|
||||
|
||||
// SetLaunchLatitude sets the value of LaunchLatitude.
|
||||
func (s *Parameters) SetLaunchLatitude(val OptFloat64) {
|
||||
func (s *PredictionParameters) SetLaunchLatitude(val OptFloat64) {
|
||||
s.LaunchLatitude = val
|
||||
}
|
||||
|
||||
// SetLaunchLongitude sets the value of LaunchLongitude.
|
||||
func (s *Parameters) SetLaunchLongitude(val OptFloat64) {
|
||||
func (s *PredictionParameters) SetLaunchLongitude(val OptFloat64) {
|
||||
s.LaunchLongitude = val
|
||||
}
|
||||
|
||||
// SetLaunchDatetime sets the value of LaunchDatetime.
|
||||
func (s *Parameters) SetLaunchDatetime(val OptDateTime) {
|
||||
func (s *PredictionParameters) SetLaunchDatetime(val OptDateTime) {
|
||||
s.LaunchDatetime = val
|
||||
}
|
||||
|
||||
// SetLaunchAltitude sets the value of LaunchAltitude.
|
||||
func (s *Parameters) SetLaunchAltitude(val OptFloat64) {
|
||||
func (s *PredictionParameters) SetLaunchAltitude(val OptFloat64) {
|
||||
s.LaunchAltitude = val
|
||||
}
|
||||
|
||||
// SetProfile sets the value of Profile.
|
||||
func (s *Parameters) SetProfile(val OptParametersProfile) {
|
||||
func (s *PredictionParameters) SetProfile(val OptPredictionParametersProfile) {
|
||||
s.Profile = val
|
||||
}
|
||||
|
||||
// SetAscentRate sets the value of AscentRate.
|
||||
func (s *Parameters) SetAscentRate(val OptFloat64) {
|
||||
func (s *PredictionParameters) SetAscentRate(val OptFloat64) {
|
||||
s.AscentRate = val
|
||||
}
|
||||
|
||||
// SetBurstAltitude sets the value of BurstAltitude.
|
||||
func (s *Parameters) SetBurstAltitude(val OptFloat64) {
|
||||
func (s *PredictionParameters) SetBurstAltitude(val OptFloat64) {
|
||||
s.BurstAltitude = val
|
||||
}
|
||||
|
||||
// SetDescentRate sets the value of DescentRate.
|
||||
func (s *Parameters) SetDescentRate(val OptFloat64) {
|
||||
func (s *PredictionParameters) SetDescentRate(val OptFloat64) {
|
||||
s.DescentRate = val
|
||||
}
|
||||
|
||||
// SetFloatAltitude sets the value of FloatAltitude.
|
||||
func (s *Parameters) SetFloatAltitude(val OptFloat64) {
|
||||
func (s *PredictionParameters) SetFloatAltitude(val OptFloat64) {
|
||||
s.FloatAltitude = val
|
||||
}
|
||||
|
||||
// SetStopDatetime sets the value of StopDatetime.
|
||||
func (s *Parameters) SetStopDatetime(val OptDateTime) {
|
||||
func (s *PredictionParameters) SetStopDatetime(val OptDateTime) {
|
||||
s.StopDatetime = val
|
||||
}
|
||||
|
||||
// SetAscentCurve sets the value of AscentCurve.
|
||||
func (s *Parameters) SetAscentCurve(val OptString) {
|
||||
func (s *PredictionParameters) SetAscentCurve(val OptString) {
|
||||
s.AscentCurve = val
|
||||
}
|
||||
|
||||
// SetDescentCurve sets the value of DescentCurve.
|
||||
func (s *Parameters) SetDescentCurve(val OptString) {
|
||||
func (s *PredictionParameters) SetDescentCurve(val OptString) {
|
||||
s.DescentCurve = val
|
||||
}
|
||||
|
||||
// SetInterpolate sets the value of Interpolate.
|
||||
func (s *Parameters) SetInterpolate(val OptBool) {
|
||||
func (s *PredictionParameters) SetInterpolate(val OptBool) {
|
||||
s.Interpolate = val
|
||||
}
|
||||
|
||||
// SetFormat sets the value of Format.
|
||||
func (s *Parameters) SetFormat(val OptParametersFormat) {
|
||||
func (s *PredictionParameters) SetFormat(val OptPredictionParametersFormat) {
|
||||
s.Format = val
|
||||
}
|
||||
|
||||
// SetDataset sets the value of Dataset.
|
||||
func (s *Parameters) SetDataset(val OptDateTime) {
|
||||
func (s *PredictionParameters) SetDataset(val OptDateTime) {
|
||||
s.Dataset = val
|
||||
}
|
||||
|
||||
type ParametersFormat string
|
||||
type PredictionParametersFormat string
|
||||
|
||||
const (
|
||||
ParametersFormatJSON ParametersFormat = "json"
|
||||
PredictionParametersFormatJSON PredictionParametersFormat = "json"
|
||||
)
|
||||
|
||||
// AllValues returns all ParametersFormat values.
|
||||
func (ParametersFormat) AllValues() []ParametersFormat {
|
||||
return []ParametersFormat{
|
||||
ParametersFormatJSON,
|
||||
// AllValues returns all PredictionParametersFormat values.
|
||||
func (PredictionParametersFormat) AllValues() []PredictionParametersFormat {
|
||||
return []PredictionParametersFormat{
|
||||
PredictionParametersFormatJSON,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s ParametersFormat) MarshalText() ([]byte, error) {
|
||||
func (s PredictionParametersFormat) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case ParametersFormatJSON:
|
||||
case PredictionParametersFormatJSON:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
|
|
@ -582,45 +582,45 @@ func (s ParametersFormat) MarshalText() ([]byte, error) {
|
|||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *ParametersFormat) UnmarshalText(data []byte) error {
|
||||
switch ParametersFormat(data) {
|
||||
case ParametersFormatJSON:
|
||||
*s = ParametersFormatJSON
|
||||
func (s *PredictionParametersFormat) UnmarshalText(data []byte) error {
|
||||
switch PredictionParametersFormat(data) {
|
||||
case PredictionParametersFormatJSON:
|
||||
*s = PredictionParametersFormatJSON
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
type ParametersProfile string
|
||||
type PredictionParametersProfile string
|
||||
|
||||
const (
|
||||
ParametersProfileStandardProfile ParametersProfile = "standard_profile"
|
||||
ParametersProfileFloatProfile ParametersProfile = "float_profile"
|
||||
ParametersProfileReverseProfile ParametersProfile = "reverse_profile"
|
||||
ParametersProfileCustomProfile ParametersProfile = "custom_profile"
|
||||
PredictionParametersProfileStandardProfile PredictionParametersProfile = "standard_profile"
|
||||
PredictionParametersProfileFloatProfile PredictionParametersProfile = "float_profile"
|
||||
PredictionParametersProfileReverseProfile PredictionParametersProfile = "reverse_profile"
|
||||
PredictionParametersProfileCustomProfile PredictionParametersProfile = "custom_profile"
|
||||
)
|
||||
|
||||
// AllValues returns all ParametersProfile values.
|
||||
func (ParametersProfile) AllValues() []ParametersProfile {
|
||||
return []ParametersProfile{
|
||||
ParametersProfileStandardProfile,
|
||||
ParametersProfileFloatProfile,
|
||||
ParametersProfileReverseProfile,
|
||||
ParametersProfileCustomProfile,
|
||||
// AllValues returns all PredictionParametersProfile values.
|
||||
func (PredictionParametersProfile) AllValues() []PredictionParametersProfile {
|
||||
return []PredictionParametersProfile{
|
||||
PredictionParametersProfileStandardProfile,
|
||||
PredictionParametersProfileFloatProfile,
|
||||
PredictionParametersProfileReverseProfile,
|
||||
PredictionParametersProfileCustomProfile,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s ParametersProfile) MarshalText() ([]byte, error) {
|
||||
func (s PredictionParametersProfile) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case ParametersProfileStandardProfile:
|
||||
case PredictionParametersProfileStandardProfile:
|
||||
return []byte(s), nil
|
||||
case ParametersProfileFloatProfile:
|
||||
case PredictionParametersProfileFloatProfile:
|
||||
return []byte(s), nil
|
||||
case ParametersProfileReverseProfile:
|
||||
case PredictionParametersProfileReverseProfile:
|
||||
return []byte(s), nil
|
||||
case ParametersProfileCustomProfile:
|
||||
case PredictionParametersProfileCustomProfile:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
|
|
@ -628,122 +628,122 @@ func (s ParametersProfile) MarshalText() ([]byte, error) {
|
|||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *ParametersProfile) UnmarshalText(data []byte) error {
|
||||
switch ParametersProfile(data) {
|
||||
case ParametersProfileStandardProfile:
|
||||
*s = ParametersProfileStandardProfile
|
||||
func (s *PredictionParametersProfile) UnmarshalText(data []byte) error {
|
||||
switch PredictionParametersProfile(data) {
|
||||
case PredictionParametersProfileStandardProfile:
|
||||
*s = PredictionParametersProfileStandardProfile
|
||||
return nil
|
||||
case ParametersProfileFloatProfile:
|
||||
*s = ParametersProfileFloatProfile
|
||||
case PredictionParametersProfileFloatProfile:
|
||||
*s = PredictionParametersProfileFloatProfile
|
||||
return nil
|
||||
case ParametersProfileReverseProfile:
|
||||
*s = ParametersProfileReverseProfile
|
||||
case PredictionParametersProfileReverseProfile:
|
||||
*s = PredictionParametersProfileReverseProfile
|
||||
return nil
|
||||
case ParametersProfileCustomProfile:
|
||||
*s = ParametersProfileCustomProfile
|
||||
case PredictionParametersProfileCustomProfile:
|
||||
*s = PredictionParametersProfileCustomProfile
|
||||
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"`
|
||||
// Ref: #/components/schemas/PredictionResult
|
||||
type PredictionResult struct {
|
||||
Metadata PredictionResultMetadata `json:"metadata"`
|
||||
Prediction []PredictionResultPredictionItem `json:"prediction"`
|
||||
}
|
||||
|
||||
// GetMetadata returns the value of Metadata.
|
||||
func (s *Result) GetMetadata() ResultMetadata {
|
||||
func (s *PredictionResult) GetMetadata() PredictionResultMetadata {
|
||||
return s.Metadata
|
||||
}
|
||||
|
||||
// GetPrediction returns the value of Prediction.
|
||||
func (s *Result) GetPrediction() []ResultPredictionItem {
|
||||
func (s *PredictionResult) GetPrediction() []PredictionResultPredictionItem {
|
||||
return s.Prediction
|
||||
}
|
||||
|
||||
// SetMetadata sets the value of Metadata.
|
||||
func (s *Result) SetMetadata(val ResultMetadata) {
|
||||
func (s *PredictionResult) SetMetadata(val PredictionResultMetadata) {
|
||||
s.Metadata = val
|
||||
}
|
||||
|
||||
// SetPrediction sets the value of Prediction.
|
||||
func (s *Result) SetPrediction(val []ResultPredictionItem) {
|
||||
func (s *PredictionResult) SetPrediction(val []PredictionResultPredictionItem) {
|
||||
s.Prediction = val
|
||||
}
|
||||
|
||||
type ResultMetadata struct {
|
||||
type PredictionResultMetadata 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 {
|
||||
func (s *PredictionResultMetadata) GetCompleteDatetime() time.Time {
|
||||
return s.CompleteDatetime
|
||||
}
|
||||
|
||||
// GetStartDatetime returns the value of StartDatetime.
|
||||
func (s *ResultMetadata) GetStartDatetime() time.Time {
|
||||
func (s *PredictionResultMetadata) GetStartDatetime() time.Time {
|
||||
return s.StartDatetime
|
||||
}
|
||||
|
||||
// SetCompleteDatetime sets the value of CompleteDatetime.
|
||||
func (s *ResultMetadata) SetCompleteDatetime(val time.Time) {
|
||||
func (s *PredictionResultMetadata) SetCompleteDatetime(val time.Time) {
|
||||
s.CompleteDatetime = val
|
||||
}
|
||||
|
||||
// SetStartDatetime sets the value of StartDatetime.
|
||||
func (s *ResultMetadata) SetStartDatetime(val time.Time) {
|
||||
func (s *PredictionResultMetadata) SetStartDatetime(val time.Time) {
|
||||
s.StartDatetime = val
|
||||
}
|
||||
|
||||
type ResultPredictionItem struct {
|
||||
Stage ResultPredictionItemStage `json:"stage"`
|
||||
Trajectory []ResultPredictionItemTrajectoryItem `json:"trajectory"`
|
||||
type PredictionResultPredictionItem struct {
|
||||
Stage PredictionResultPredictionItemStage `json:"stage"`
|
||||
Trajectory []PredictionResultPredictionItemTrajectoryItem `json:"trajectory"`
|
||||
}
|
||||
|
||||
// GetStage returns the value of Stage.
|
||||
func (s *ResultPredictionItem) GetStage() ResultPredictionItemStage {
|
||||
func (s *PredictionResultPredictionItem) GetStage() PredictionResultPredictionItemStage {
|
||||
return s.Stage
|
||||
}
|
||||
|
||||
// GetTrajectory returns the value of Trajectory.
|
||||
func (s *ResultPredictionItem) GetTrajectory() []ResultPredictionItemTrajectoryItem {
|
||||
func (s *PredictionResultPredictionItem) GetTrajectory() []PredictionResultPredictionItemTrajectoryItem {
|
||||
return s.Trajectory
|
||||
}
|
||||
|
||||
// SetStage sets the value of Stage.
|
||||
func (s *ResultPredictionItem) SetStage(val ResultPredictionItemStage) {
|
||||
func (s *PredictionResultPredictionItem) SetStage(val PredictionResultPredictionItemStage) {
|
||||
s.Stage = val
|
||||
}
|
||||
|
||||
// SetTrajectory sets the value of Trajectory.
|
||||
func (s *ResultPredictionItem) SetTrajectory(val []ResultPredictionItemTrajectoryItem) {
|
||||
func (s *PredictionResultPredictionItem) SetTrajectory(val []PredictionResultPredictionItemTrajectoryItem) {
|
||||
s.Trajectory = val
|
||||
}
|
||||
|
||||
type ResultPredictionItemStage string
|
||||
type PredictionResultPredictionItemStage string
|
||||
|
||||
const (
|
||||
ResultPredictionItemStageAscent ResultPredictionItemStage = "ascent"
|
||||
ResultPredictionItemStageDescent ResultPredictionItemStage = "descent"
|
||||
PredictionResultPredictionItemStageAscent PredictionResultPredictionItemStage = "ascent"
|
||||
PredictionResultPredictionItemStageDescent PredictionResultPredictionItemStage = "descent"
|
||||
)
|
||||
|
||||
// AllValues returns all ResultPredictionItemStage values.
|
||||
func (ResultPredictionItemStage) AllValues() []ResultPredictionItemStage {
|
||||
return []ResultPredictionItemStage{
|
||||
ResultPredictionItemStageAscent,
|
||||
ResultPredictionItemStageDescent,
|
||||
// AllValues returns all PredictionResultPredictionItemStage values.
|
||||
func (PredictionResultPredictionItemStage) AllValues() []PredictionResultPredictionItemStage {
|
||||
return []PredictionResultPredictionItemStage{
|
||||
PredictionResultPredictionItemStageAscent,
|
||||
PredictionResultPredictionItemStageDescent,
|
||||
}
|
||||
}
|
||||
|
||||
// MarshalText implements encoding.TextMarshaler.
|
||||
func (s ResultPredictionItemStage) MarshalText() ([]byte, error) {
|
||||
func (s PredictionResultPredictionItemStage) MarshalText() ([]byte, error) {
|
||||
switch s {
|
||||
case ResultPredictionItemStageAscent:
|
||||
case PredictionResultPredictionItemStageAscent:
|
||||
return []byte(s), nil
|
||||
case ResultPredictionItemStageDescent:
|
||||
case PredictionResultPredictionItemStageDescent:
|
||||
return []byte(s), nil
|
||||
default:
|
||||
return nil, errors.Errorf("invalid value: %q", s)
|
||||
|
|
@ -751,17 +751,17 @@ func (s ResultPredictionItemStage) MarshalText() ([]byte, error) {
|
|||
}
|
||||
|
||||
// UnmarshalText implements encoding.TextUnmarshaler.
|
||||
func (s *ResultPredictionItemStage) UnmarshalText(data []byte) error {
|
||||
switch ResultPredictionItemStage(data) {
|
||||
case ResultPredictionItemStageAscent:
|
||||
*s = ResultPredictionItemStageAscent
|
||||
func (s *PredictionResultPredictionItemStage) UnmarshalText(data []byte) error {
|
||||
switch PredictionResultPredictionItemStage(data) {
|
||||
case PredictionResultPredictionItemStageAscent:
|
||||
*s = PredictionResultPredictionItemStageAscent
|
||||
return nil
|
||||
case ResultPredictionItemStageDescent:
|
||||
*s = ResultPredictionItemStageDescent
|
||||
case PredictionResultPredictionItemStageDescent:
|
||||
*s = PredictionResultPredictionItemStageDescent
|
||||
return nil
|
||||
default:
|
||||
return errors.Errorf("invalid value: %q", data)
|
||||
}
|
||||
}
|
||||
|
||||
type ResultPredictionItemTrajectoryItem struct{}
|
||||
type PredictionResultPredictionItemTrajectoryItem struct{}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ type Handler interface {
|
|||
// Perform preidction.
|
||||
//
|
||||
// POST /api/v1/prediction
|
||||
PerformPrediction(ctx context.Context, req OptParameters, params PerformPredictionParams) (*Result, error)
|
||||
PerformPrediction(ctx context.Context, req OptPredictionParameters, params PerformPredictionParams) (*PredictionResult, error)
|
||||
// NewError creates *ErrorStatusCode from error returned by handler.
|
||||
//
|
||||
// Used for common default response.
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ var _ Handler = UnimplementedHandler{}
|
|||
// Perform preidction.
|
||||
//
|
||||
// POST /api/v1/prediction
|
||||
func (UnimplementedHandler) PerformPrediction(ctx context.Context, req OptParameters, params PerformPredictionParams) (r *Result, _ error) {
|
||||
func (UnimplementedHandler) PerformPrediction(ctx context.Context, req OptPredictionParameters, params PerformPredictionParams) (r *PredictionResult, _ error) {
|
||||
return r, ht.ErrNotImplemented
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import (
|
|||
"github.com/ogen-go/ogen/uri"
|
||||
)
|
||||
|
||||
// EncodeURI encodes Parameters as URI form.
|
||||
func (s *Parameters) EncodeURI(e uri.Encoder) error {
|
||||
// EncodeURI encodes PredictionParameters as URI form.
|
||||
func (s *PredictionParameters) EncodeURI(e uri.Encoder) error {
|
||||
if err := e.EncodeField("launch_latitude", func(e uri.Encoder) error {
|
||||
if val, ok := s.LaunchLatitude.Get(); ok {
|
||||
return e.EncodeValue(conv.Float64ToString(val))
|
||||
|
|
@ -136,7 +136,7 @@ func (s *Parameters) EncodeURI(e uri.Encoder) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var uriFieldsNameOfParameters = [15]string{
|
||||
var uriFieldsNameOfPredictionParameters = [15]string{
|
||||
0: "launch_latitude",
|
||||
1: "launch_longitude",
|
||||
2: "launch_datetime",
|
||||
|
|
@ -154,10 +154,10 @@ var uriFieldsNameOfParameters = [15]string{
|
|||
14: "dataset",
|
||||
}
|
||||
|
||||
// DecodeURI decodes Parameters from URI form.
|
||||
func (s *Parameters) DecodeURI(d uri.Decoder) error {
|
||||
// DecodeURI decodes PredictionParameters from URI form.
|
||||
func (s *PredictionParameters) DecodeURI(d uri.Decoder) error {
|
||||
if s == nil {
|
||||
return errors.New("invalid: unable to decode Parameters to nil")
|
||||
return errors.New("invalid: unable to decode PredictionParameters to nil")
|
||||
}
|
||||
s.setDefaults()
|
||||
|
||||
|
|
@ -261,7 +261,7 @@ func (s *Parameters) DecodeURI(d uri.Decoder) error {
|
|||
}
|
||||
case "profile":
|
||||
if err := func() error {
|
||||
var sDotProfileVal ParametersProfile
|
||||
var sDotProfileVal PredictionParametersProfile
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
|
|
@ -273,7 +273,7 @@ func (s *Parameters) DecodeURI(d uri.Decoder) error {
|
|||
return err
|
||||
}
|
||||
|
||||
sDotProfileVal = ParametersProfile(c)
|
||||
sDotProfileVal = PredictionParametersProfile(c)
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
|
|
@ -477,7 +477,7 @@ func (s *Parameters) DecodeURI(d uri.Decoder) error {
|
|||
}
|
||||
case "format":
|
||||
if err := func() error {
|
||||
var sDotFormatVal ParametersFormat
|
||||
var sDotFormatVal PredictionParametersFormat
|
||||
if err := func() error {
|
||||
val, err := d.DecodeValue()
|
||||
if err != nil {
|
||||
|
|
@ -489,7 +489,7 @@ func (s *Parameters) DecodeURI(d uri.Decoder) error {
|
|||
return err
|
||||
}
|
||||
|
||||
sDotFormatVal = ParametersFormat(c)
|
||||
sDotFormatVal = PredictionParametersFormat(c)
|
||||
return nil
|
||||
}(); err != nil {
|
||||
return err
|
||||
|
|
@ -528,7 +528,7 @@ func (s *Parameters) DecodeURI(d uri.Decoder) error {
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "decode Parameters")
|
||||
return errors.Wrap(err, "decode PredictionParameters")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/ogen-go/ogen/validate"
|
||||
)
|
||||
|
||||
func (s *Parameters) Validate() error {
|
||||
func (s *PredictionParameters) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ func (s *Parameters) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s ParametersFormat) Validate() error {
|
||||
func (s PredictionParametersFormat) Validate() error {
|
||||
switch s {
|
||||
case "json":
|
||||
return nil
|
||||
|
|
@ -193,7 +193,7 @@ func (s ParametersFormat) Validate() error {
|
|||
}
|
||||
}
|
||||
|
||||
func (s ParametersProfile) Validate() error {
|
||||
func (s PredictionParametersProfile) Validate() error {
|
||||
switch s {
|
||||
case "standard_profile":
|
||||
return nil
|
||||
|
|
@ -208,7 +208,7 @@ func (s ParametersProfile) Validate() error {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Result) Validate() error {
|
||||
func (s *PredictionResult) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
|
@ -248,7 +248,7 @@ func (s *Result) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *ResultPredictionItem) Validate() error {
|
||||
func (s *PredictionResultPredictionItem) Validate() error {
|
||||
if s == nil {
|
||||
return validate.ErrNilPointer
|
||||
}
|
||||
|
|
@ -282,7 +282,7 @@ func (s *ResultPredictionItem) Validate() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s ResultPredictionItemStage) Validate() error {
|
||||
func (s PredictionResultPredictionItemStage) Validate() error {
|
||||
switch s {
|
||||
case "ascent":
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue