// Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. package operations import ( "errors" "fmt" "github.com/log10-io/log10go/internal/utils" "github.com/log10-io/log10go/models/components" ) type UploadGlobals struct { XLog10Organization string `header:"style=simple,explode=false,name=X-Log10-Organization"` } func (o *UploadGlobals) GetXLog10Organization() string { if o == nil { return "" } return o.XLog10Organization } // RequestBodyJSONValues - The values of the feedback. Must be valid JSON according to the task schema. type RequestBodyJSONValues struct { } type Two struct { // The unique identifier for this feedback. ID *string `json:"id,omitempty"` // The epoch this schema was created. CreatedAtMs *float64 `json:"created_at_ms,omitempty"` // The unique identifier for the task associated with this feedback. TaskID string `json:"task_id"` // The values of the feedback. Must be valid JSON according to the task schema. JSONValues RequestBodyJSONValues `json:"json_values"` // The matched completion ids associated with this feedback. MatchedCompletionIds []string `json:"matched_completion_ids"` // The comment associated with this feedback. Comment string `json:"comment"` CompletionsSummary *string `json:"completions_summary,omitempty"` // The completion ids to associate with this feedback. CompletionIds []string `json:"completion_ids"` } func (o *Two) GetID() *string { if o == nil { return nil } return o.ID } func (o *Two) GetCreatedAtMs() *float64 { if o == nil { return nil } return o.CreatedAtMs } func (o *Two) GetTaskID() string { if o == nil { return "" } return o.TaskID } func (o *Two) GetJSONValues() RequestBodyJSONValues { if o == nil { return RequestBodyJSONValues{} } return o.JSONValues } func (o *Two) GetMatchedCompletionIds() []string { if o == nil { return []string{} } return o.MatchedCompletionIds } func (o *Two) GetComment() string { if o == nil { return "" } return o.Comment } func (o *Two) GetCompletionsSummary() *string { if o == nil { return nil } return o.CompletionsSummary } func (o *Two) GetCompletionIds() []string { if o == nil { return []string{} } return o.CompletionIds } // JSONValues - The values of the feedback. Must be valid JSON according to the task schema. type JSONValues struct { } type One struct { // The unique identifier for this feedback. ID *string `json:"id,omitempty"` // The epoch this schema was created. CreatedAtMs *float64 `json:"created_at_ms,omitempty"` // The unique identifier for the task associated with this feedback. TaskID string `json:"task_id"` // The values of the feedback. Must be valid JSON according to the task schema. JSONValues JSONValues `json:"json_values"` // The matched completion ids associated with this feedback. MatchedCompletionIds []string `json:"matched_completion_ids"` // The comment associated with this feedback. Comment string `json:"comment"` CompletionsSummary *string `json:"completions_summary,omitempty"` // Whether to allow unmatched feedback. Defaults to false. AllowUnmatchedFeedback *bool `default:"false" json:"allow_unmatched_feedback"` // The maximum number of matched completions. Returns error if exceeded. Defaults to 100. MaxMatchedCompletions *int64 `default:"100" json:"max_matched_completions"` // The completion tags associated with this feedback. CompletionTagsSelector []string `json:"completion_tags_selector"` } func (o One) MarshalJSON() ([]byte, error) { return utils.MarshalJSON(o, "", false) } func (o *One) UnmarshalJSON(data []byte) error { if err := utils.UnmarshalJSON(data, &o, "", false, true); err != nil { return err } return nil } func (o *One) GetID() *string { if o == nil { return nil } return o.ID } func (o *One) GetCreatedAtMs() *float64 { if o == nil { return nil } return o.CreatedAtMs } func (o *One) GetTaskID() string { if o == nil { return "" } return o.TaskID } func (o *One) GetJSONValues() JSONValues { if o == nil { return JSONValues{} } return o.JSONValues } func (o *One) GetMatchedCompletionIds() []string { if o == nil { return []string{} } return o.MatchedCompletionIds } func (o *One) GetComment() string { if o == nil { return "" } return o.Comment } func (o *One) GetCompletionsSummary() *string { if o == nil { return nil } return o.CompletionsSummary } func (o *One) GetAllowUnmatchedFeedback() *bool { if o == nil { return nil } return o.AllowUnmatchedFeedback } func (o *One) GetMaxMatchedCompletions() *int64 { if o == nil { return nil } return o.MaxMatchedCompletions } func (o *One) GetCompletionTagsSelector() []string { if o == nil { return []string{} } return o.CompletionTagsSelector } type UploadRequestBodyType string const ( UploadRequestBodyTypeOne UploadRequestBodyType = "1" UploadRequestBodyTypeTwo UploadRequestBodyType = "2" ) type UploadRequestBody struct { One *One Two *Two Type UploadRequestBodyType } func CreateUploadRequestBodyOne(one One) UploadRequestBody { typ := UploadRequestBodyTypeOne return UploadRequestBody{ One: &one, Type: typ, } } func CreateUploadRequestBodyTwo(two Two) UploadRequestBody { typ := UploadRequestBodyTypeTwo return UploadRequestBody{ Two: &two, Type: typ, } } func (u *UploadRequestBody) UnmarshalJSON(data []byte) error { var two Two = Two{} if err := utils.UnmarshalJSON(data, &two, "", true, true); err == nil { u.Two = &two u.Type = UploadRequestBodyTypeTwo return nil } var one One = One{} if err := utils.UnmarshalJSON(data, &one, "", true, true); err == nil { u.One = &one u.Type = UploadRequestBodyTypeOne return nil } return fmt.Errorf("could not unmarshal `%s` into any supported union types for UploadRequestBody", string(data)) } func (u UploadRequestBody) MarshalJSON() ([]byte, error) { if u.One != nil { return utils.MarshalJSON(u.One, "", true) } if u.Two != nil { return utils.MarshalJSON(u.Two, "", true) } return nil, errors.New("could not marshal union type UploadRequestBody: all fields are null") } type UploadRequest struct { XLog10Organization *string `header:"style=simple,explode=false,name=X-Log10-Organization"` RequestBody UploadRequestBody `request:"mediaType=application/json"` } func (o *UploadRequest) GetXLog10Organization() *string { if o == nil { return nil } return o.XLog10Organization } func (o *UploadRequest) GetRequestBody() UploadRequestBody { if o == nil { return UploadRequestBody{} } return o.RequestBody } type UploadResponse struct { HTTPMeta components.HTTPMetadata `json:"-"` // OK Feedback *components.Feedback } func (o *UploadResponse) GetHTTPMeta() components.HTTPMetadata { if o == nil { return components.HTTPMetadata{} } return o.HTTPMeta } func (o *UploadResponse) GetFeedback() *components.Feedback { if o == nil { return nil } return o.Feedback }