fleet-memory/hindsight-clients/go/model_reflect_request.go
Nicolò Boschi 6e30980add
feat: use official go generator for Go client (#377)
* ci: add Go client integration tests

Add test-go-client job to CI workflow following the same pattern as
Python, TypeScript, and Rust client tests. The job:
- Sets up Go 1.23 with dependency caching
- Starts the Hindsight API server
- Runs integration tests using the 'integration' build tag
- Displays server logs on failure

The integration tests (hindsight-clients/go/integration_test.go) cover
all core operations: retain, recall, reflect, bank management, and
end-to-end workflows.

* Move Go cookbook content to hindsight-cookbook repo

Removes Go-specific cookbook content that was added in PR #375:
- applications/go-memory-service.md
- recipes/go-quickstart.md
- recipes/go-concurrent-pipeline.md

These have been moved to the hindsight-cookbook repository where
cookbook content should live per project conventions.

* feat(go): add CI test for Go client and patch for ogen null handling

- Add test-go-client job to GitHub Actions CI workflow
- Create post-generation patch script (patch-ogen.sh) to fix ogen's
  handling of null values in optional string fields
- Patch OptString.Decode() to check jx.Next() type before decoding,
  properly handling explicit null in JSON responses

The patch ensures generated code persists across regenerations and
handles the Hindsight API's nullable optional fields correctly.

Fixes: Go client integration tests for retain and bank operations
Note: Some tests still fail for nullable arrays/objects - those
require additional patches for other Opt* types.

* feat: use official go generator for Go client

* feat: use official go generator for Go client

* ci fixes

* chore: sync Go client with latest OpenAPI spec

- Add model_child_operation_status.go (new model)
- Update model_operation_status_response.go with child operations
- Update go.mod/go.sum dependencies
- Update api/openapi.yaml
2026-02-16 14:04:12 +01:00

433 lines
11 KiB
Go

/*
Hindsight HTTP API
HTTP API for Hindsight
API version: 0.4.11
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hindsight
import (
"encoding/json"
"bytes"
"fmt"
)
// checks if the ReflectRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &ReflectRequest{}
// ReflectRequest Request model for reflect endpoint.
type ReflectRequest struct {
Query string `json:"query"`
Budget *Budget `json:"budget,omitempty"`
Context NullableString `json:"context,omitempty"`
// Maximum tokens for the response
MaxTokens *int32 `json:"max_tokens,omitempty"`
// Options for including additional data (disabled by default)
Include *ReflectIncludeOptions `json:"include,omitempty"`
ResponseSchema map[string]interface{} `json:"response_schema,omitempty"`
Tags []string `json:"tags,omitempty"`
// How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict' (AND, excludes untagged).
TagsMatch *string `json:"tags_match,omitempty"`
}
type _ReflectRequest ReflectRequest
// NewReflectRequest instantiates a new ReflectRequest object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewReflectRequest(query string) *ReflectRequest {
this := ReflectRequest{}
this.Query = query
var maxTokens int32 = 4096
this.MaxTokens = &maxTokens
var tagsMatch string = "any"
this.TagsMatch = &tagsMatch
return &this
}
// NewReflectRequestWithDefaults instantiates a new ReflectRequest object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewReflectRequestWithDefaults() *ReflectRequest {
this := ReflectRequest{}
var maxTokens int32 = 4096
this.MaxTokens = &maxTokens
var tagsMatch string = "any"
this.TagsMatch = &tagsMatch
return &this
}
// GetQuery returns the Query field value
func (o *ReflectRequest) GetQuery() string {
if o == nil {
var ret string
return ret
}
return o.Query
}
// GetQueryOk returns a tuple with the Query field value
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetQueryOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Query, true
}
// SetQuery sets field value
func (o *ReflectRequest) SetQuery(v string) {
o.Query = v
}
// GetBudget returns the Budget field value if set, zero value otherwise.
func (o *ReflectRequest) GetBudget() Budget {
if o == nil || IsNil(o.Budget) {
var ret Budget
return ret
}
return *o.Budget
}
// GetBudgetOk returns a tuple with the Budget field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetBudgetOk() (*Budget, bool) {
if o == nil || IsNil(o.Budget) {
return nil, false
}
return o.Budget, true
}
// HasBudget returns a boolean if a field has been set.
func (o *ReflectRequest) HasBudget() bool {
if o != nil && !IsNil(o.Budget) {
return true
}
return false
}
// SetBudget gets a reference to the given Budget and assigns it to the Budget field.
func (o *ReflectRequest) SetBudget(v Budget) {
o.Budget = &v
}
// GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectRequest) GetContext() string {
if o == nil || IsNil(o.Context.Get()) {
var ret string
return ret
}
return *o.Context.Get()
}
// GetContextOk returns a tuple with the Context field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *ReflectRequest) GetContextOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.Context.Get(), o.Context.IsSet()
}
// HasContext returns a boolean if a field has been set.
func (o *ReflectRequest) HasContext() bool {
if o != nil && o.Context.IsSet() {
return true
}
return false
}
// SetContext gets a reference to the given NullableString and assigns it to the Context field.
func (o *ReflectRequest) SetContext(v string) {
o.Context.Set(&v)
}
// SetContextNil sets the value for Context to be an explicit nil
func (o *ReflectRequest) SetContextNil() {
o.Context.Set(nil)
}
// UnsetContext ensures that no value is present for Context, not even an explicit nil
func (o *ReflectRequest) UnsetContext() {
o.Context.Unset()
}
// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise.
func (o *ReflectRequest) GetMaxTokens() int32 {
if o == nil || IsNil(o.MaxTokens) {
var ret int32
return ret
}
return *o.MaxTokens
}
// GetMaxTokensOk returns a tuple with the MaxTokens field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetMaxTokensOk() (*int32, bool) {
if o == nil || IsNil(o.MaxTokens) {
return nil, false
}
return o.MaxTokens, true
}
// HasMaxTokens returns a boolean if a field has been set.
func (o *ReflectRequest) HasMaxTokens() bool {
if o != nil && !IsNil(o.MaxTokens) {
return true
}
return false
}
// SetMaxTokens gets a reference to the given int32 and assigns it to the MaxTokens field.
func (o *ReflectRequest) SetMaxTokens(v int32) {
o.MaxTokens = &v
}
// GetInclude returns the Include field value if set, zero value otherwise.
func (o *ReflectRequest) GetInclude() ReflectIncludeOptions {
if o == nil || IsNil(o.Include) {
var ret ReflectIncludeOptions
return ret
}
return *o.Include
}
// GetIncludeOk returns a tuple with the Include field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetIncludeOk() (*ReflectIncludeOptions, bool) {
if o == nil || IsNil(o.Include) {
return nil, false
}
return o.Include, true
}
// HasInclude returns a boolean if a field has been set.
func (o *ReflectRequest) HasInclude() bool {
if o != nil && !IsNil(o.Include) {
return true
}
return false
}
// SetInclude gets a reference to the given ReflectIncludeOptions and assigns it to the Include field.
func (o *ReflectRequest) SetInclude(v ReflectIncludeOptions) {
o.Include = &v
}
// GetResponseSchema returns the ResponseSchema field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectRequest) GetResponseSchema() map[string]interface{} {
if o == nil {
var ret map[string]interface{}
return ret
}
return o.ResponseSchema
}
// GetResponseSchemaOk returns a tuple with the ResponseSchema field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *ReflectRequest) GetResponseSchemaOk() (map[string]interface{}, bool) {
if o == nil || IsNil(o.ResponseSchema) {
return map[string]interface{}{}, false
}
return o.ResponseSchema, true
}
// HasResponseSchema returns a boolean if a field has been set.
func (o *ReflectRequest) HasResponseSchema() bool {
if o != nil && !IsNil(o.ResponseSchema) {
return true
}
return false
}
// SetResponseSchema gets a reference to the given map[string]interface{} and assigns it to the ResponseSchema field.
func (o *ReflectRequest) SetResponseSchema(v map[string]interface{}) {
o.ResponseSchema = v
}
// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *ReflectRequest) GetTags() []string {
if o == nil {
var ret []string
return ret
}
return o.Tags
}
// GetTagsOk returns a tuple with the Tags field value if set, nil otherwise
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *ReflectRequest) GetTagsOk() ([]string, bool) {
if o == nil || IsNil(o.Tags) {
return nil, false
}
return o.Tags, true
}
// HasTags returns a boolean if a field has been set.
func (o *ReflectRequest) HasTags() bool {
if o != nil && !IsNil(o.Tags) {
return true
}
return false
}
// SetTags gets a reference to the given []string and assigns it to the Tags field.
func (o *ReflectRequest) SetTags(v []string) {
o.Tags = v
}
// GetTagsMatch returns the TagsMatch field value if set, zero value otherwise.
func (o *ReflectRequest) GetTagsMatch() string {
if o == nil || IsNil(o.TagsMatch) {
var ret string
return ret
}
return *o.TagsMatch
}
// GetTagsMatchOk returns a tuple with the TagsMatch field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ReflectRequest) GetTagsMatchOk() (*string, bool) {
if o == nil || IsNil(o.TagsMatch) {
return nil, false
}
return o.TagsMatch, true
}
// HasTagsMatch returns a boolean if a field has been set.
func (o *ReflectRequest) HasTagsMatch() bool {
if o != nil && !IsNil(o.TagsMatch) {
return true
}
return false
}
// SetTagsMatch gets a reference to the given string and assigns it to the TagsMatch field.
func (o *ReflectRequest) SetTagsMatch(v string) {
o.TagsMatch = &v
}
func (o ReflectRequest) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o ReflectRequest) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["query"] = o.Query
if !IsNil(o.Budget) {
toSerialize["budget"] = o.Budget
}
if o.Context.IsSet() {
toSerialize["context"] = o.Context.Get()
}
if !IsNil(o.MaxTokens) {
toSerialize["max_tokens"] = o.MaxTokens
}
if !IsNil(o.Include) {
toSerialize["include"] = o.Include
}
if o.ResponseSchema != nil {
toSerialize["response_schema"] = o.ResponseSchema
}
if o.Tags != nil {
toSerialize["tags"] = o.Tags
}
if !IsNil(o.TagsMatch) {
toSerialize["tags_match"] = o.TagsMatch
}
return toSerialize, nil
}
func (o *ReflectRequest) UnmarshalJSON(data []byte) (err error) {
// This validates that all required properties are included in the JSON object
// by unmarshalling the object into a generic map with string keys and checking
// that every required field exists as a key in the generic map.
requiredProperties := []string{
"query",
}
allProperties := make(map[string]interface{})
err = json.Unmarshal(data, &allProperties)
if err != nil {
return err;
}
for _, requiredProperty := range(requiredProperties) {
if _, exists := allProperties[requiredProperty]; !exists {
return fmt.Errorf("no value given for required property %v", requiredProperty)
}
}
varReflectRequest := _ReflectRequest{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varReflectRequest)
if err != nil {
return err
}
*o = ReflectRequest(varReflectRequest)
return err
}
type NullableReflectRequest struct {
value *ReflectRequest
isSet bool
}
func (v NullableReflectRequest) Get() *ReflectRequest {
return v.value
}
func (v *NullableReflectRequest) Set(val *ReflectRequest) {
v.value = val
v.isSet = true
}
func (v NullableReflectRequest) IsSet() bool {
return v.isSet
}
func (v *NullableReflectRequest) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableReflectRequest(val *ReflectRequest) *NullableReflectRequest {
return &NullableReflectRequest{value: val, isSet: true}
}
func (v NullableReflectRequest) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableReflectRequest) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}