* 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
472 lines
12 KiB
Go
472 lines
12 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 RecallRequest type satisfies the MappedNullable interface at compile time
|
|
var _ MappedNullable = &RecallRequest{}
|
|
|
|
// RecallRequest Request model for recall endpoint.
|
|
type RecallRequest struct {
|
|
Query string `json:"query"`
|
|
Types []string `json:"types,omitempty"`
|
|
Budget *Budget `json:"budget,omitempty"`
|
|
MaxTokens *int32 `json:"max_tokens,omitempty"`
|
|
Trace *bool `json:"trace,omitempty"`
|
|
QueryTimestamp NullableString `json:"query_timestamp,omitempty"`
|
|
// Options for including additional data (entities are included by default)
|
|
Include *IncludeOptions `json:"include,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 _RecallRequest RecallRequest
|
|
|
|
// NewRecallRequest instantiates a new RecallRequest 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 NewRecallRequest(query string) *RecallRequest {
|
|
this := RecallRequest{}
|
|
this.Query = query
|
|
var maxTokens int32 = 4096
|
|
this.MaxTokens = &maxTokens
|
|
var trace bool = false
|
|
this.Trace = &trace
|
|
var tagsMatch string = "any"
|
|
this.TagsMatch = &tagsMatch
|
|
return &this
|
|
}
|
|
|
|
// NewRecallRequestWithDefaults instantiates a new RecallRequest 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 NewRecallRequestWithDefaults() *RecallRequest {
|
|
this := RecallRequest{}
|
|
var maxTokens int32 = 4096
|
|
this.MaxTokens = &maxTokens
|
|
var trace bool = false
|
|
this.Trace = &trace
|
|
var tagsMatch string = "any"
|
|
this.TagsMatch = &tagsMatch
|
|
return &this
|
|
}
|
|
|
|
// GetQuery returns the Query field value
|
|
func (o *RecallRequest) 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 *RecallRequest) GetQueryOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return &o.Query, true
|
|
}
|
|
|
|
// SetQuery sets field value
|
|
func (o *RecallRequest) SetQuery(v string) {
|
|
o.Query = v
|
|
}
|
|
|
|
// GetTypes returns the Types field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *RecallRequest) GetTypes() []string {
|
|
if o == nil {
|
|
var ret []string
|
|
return ret
|
|
}
|
|
return o.Types
|
|
}
|
|
|
|
// GetTypesOk returns a tuple with the Types 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 *RecallRequest) GetTypesOk() ([]string, bool) {
|
|
if o == nil || IsNil(o.Types) {
|
|
return nil, false
|
|
}
|
|
return o.Types, true
|
|
}
|
|
|
|
// HasTypes returns a boolean if a field has been set.
|
|
func (o *RecallRequest) HasTypes() bool {
|
|
if o != nil && !IsNil(o.Types) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetTypes gets a reference to the given []string and assigns it to the Types field.
|
|
func (o *RecallRequest) SetTypes(v []string) {
|
|
o.Types = v
|
|
}
|
|
|
|
// GetBudget returns the Budget field value if set, zero value otherwise.
|
|
func (o *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) SetBudget(v Budget) {
|
|
o.Budget = &v
|
|
}
|
|
|
|
// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise.
|
|
func (o *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) SetMaxTokens(v int32) {
|
|
o.MaxTokens = &v
|
|
}
|
|
|
|
// GetTrace returns the Trace field value if set, zero value otherwise.
|
|
func (o *RecallRequest) GetTrace() bool {
|
|
if o == nil || IsNil(o.Trace) {
|
|
var ret bool
|
|
return ret
|
|
}
|
|
return *o.Trace
|
|
}
|
|
|
|
// GetTraceOk returns a tuple with the Trace field value if set, nil otherwise
|
|
// and a boolean to check if the value has been set.
|
|
func (o *RecallRequest) GetTraceOk() (*bool, bool) {
|
|
if o == nil || IsNil(o.Trace) {
|
|
return nil, false
|
|
}
|
|
return o.Trace, true
|
|
}
|
|
|
|
// HasTrace returns a boolean if a field has been set.
|
|
func (o *RecallRequest) HasTrace() bool {
|
|
if o != nil && !IsNil(o.Trace) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetTrace gets a reference to the given bool and assigns it to the Trace field.
|
|
func (o *RecallRequest) SetTrace(v bool) {
|
|
o.Trace = &v
|
|
}
|
|
|
|
// GetQueryTimestamp returns the QueryTimestamp field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *RecallRequest) GetQueryTimestamp() string {
|
|
if o == nil || IsNil(o.QueryTimestamp.Get()) {
|
|
var ret string
|
|
return ret
|
|
}
|
|
return *o.QueryTimestamp.Get()
|
|
}
|
|
|
|
// GetQueryTimestampOk returns a tuple with the QueryTimestamp 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 *RecallRequest) GetQueryTimestampOk() (*string, bool) {
|
|
if o == nil {
|
|
return nil, false
|
|
}
|
|
return o.QueryTimestamp.Get(), o.QueryTimestamp.IsSet()
|
|
}
|
|
|
|
// HasQueryTimestamp returns a boolean if a field has been set.
|
|
func (o *RecallRequest) HasQueryTimestamp() bool {
|
|
if o != nil && o.QueryTimestamp.IsSet() {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetQueryTimestamp gets a reference to the given NullableString and assigns it to the QueryTimestamp field.
|
|
func (o *RecallRequest) SetQueryTimestamp(v string) {
|
|
o.QueryTimestamp.Set(&v)
|
|
}
|
|
// SetQueryTimestampNil sets the value for QueryTimestamp to be an explicit nil
|
|
func (o *RecallRequest) SetQueryTimestampNil() {
|
|
o.QueryTimestamp.Set(nil)
|
|
}
|
|
|
|
// UnsetQueryTimestamp ensures that no value is present for QueryTimestamp, not even an explicit nil
|
|
func (o *RecallRequest) UnsetQueryTimestamp() {
|
|
o.QueryTimestamp.Unset()
|
|
}
|
|
|
|
// GetInclude returns the Include field value if set, zero value otherwise.
|
|
func (o *RecallRequest) GetInclude() IncludeOptions {
|
|
if o == nil || IsNil(o.Include) {
|
|
var ret IncludeOptions
|
|
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 *RecallRequest) GetIncludeOk() (*IncludeOptions, 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 *RecallRequest) HasInclude() bool {
|
|
if o != nil && !IsNil(o.Include) {
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|
|
|
|
// SetInclude gets a reference to the given IncludeOptions and assigns it to the Include field.
|
|
func (o *RecallRequest) SetInclude(v IncludeOptions) {
|
|
o.Include = &v
|
|
}
|
|
|
|
// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null).
|
|
func (o *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) SetTags(v []string) {
|
|
o.Tags = v
|
|
}
|
|
|
|
// GetTagsMatch returns the TagsMatch field value if set, zero value otherwise.
|
|
func (o *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) 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 *RecallRequest) SetTagsMatch(v string) {
|
|
o.TagsMatch = &v
|
|
}
|
|
|
|
func (o RecallRequest) MarshalJSON() ([]byte, error) {
|
|
toSerialize,err := o.ToMap()
|
|
if err != nil {
|
|
return []byte{}, err
|
|
}
|
|
return json.Marshal(toSerialize)
|
|
}
|
|
|
|
func (o RecallRequest) ToMap() (map[string]interface{}, error) {
|
|
toSerialize := map[string]interface{}{}
|
|
toSerialize["query"] = o.Query
|
|
if o.Types != nil {
|
|
toSerialize["types"] = o.Types
|
|
}
|
|
if !IsNil(o.Budget) {
|
|
toSerialize["budget"] = o.Budget
|
|
}
|
|
if !IsNil(o.MaxTokens) {
|
|
toSerialize["max_tokens"] = o.MaxTokens
|
|
}
|
|
if !IsNil(o.Trace) {
|
|
toSerialize["trace"] = o.Trace
|
|
}
|
|
if o.QueryTimestamp.IsSet() {
|
|
toSerialize["query_timestamp"] = o.QueryTimestamp.Get()
|
|
}
|
|
if !IsNil(o.Include) {
|
|
toSerialize["include"] = o.Include
|
|
}
|
|
if o.Tags != nil {
|
|
toSerialize["tags"] = o.Tags
|
|
}
|
|
if !IsNil(o.TagsMatch) {
|
|
toSerialize["tags_match"] = o.TagsMatch
|
|
}
|
|
return toSerialize, nil
|
|
}
|
|
|
|
func (o *RecallRequest) 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)
|
|
}
|
|
}
|
|
|
|
varRecallRequest := _RecallRequest{}
|
|
|
|
decoder := json.NewDecoder(bytes.NewReader(data))
|
|
decoder.DisallowUnknownFields()
|
|
err = decoder.Decode(&varRecallRequest)
|
|
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
*o = RecallRequest(varRecallRequest)
|
|
|
|
return err
|
|
}
|
|
|
|
type NullableRecallRequest struct {
|
|
value *RecallRequest
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableRecallRequest) Get() *RecallRequest {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableRecallRequest) Set(val *RecallRequest) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableRecallRequest) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableRecallRequest) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableRecallRequest(val *RecallRequest) *NullableRecallRequest {
|
|
return &NullableRecallRequest{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableRecallRequest) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableRecallRequest) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|
|
|