* 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
113 lines
2.1 KiB
Go
113 lines
2.1 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"
|
|
"fmt"
|
|
)
|
|
|
|
// Budget Budget levels for recall/reflect operations.
|
|
type Budget string
|
|
|
|
// List of Budget
|
|
const (
|
|
LOW Budget = "low"
|
|
MID Budget = "mid"
|
|
HIGH Budget = "high"
|
|
)
|
|
|
|
// All allowed values of Budget enum
|
|
var AllowedBudgetEnumValues = []Budget{
|
|
"low",
|
|
"mid",
|
|
"high",
|
|
}
|
|
|
|
func (v *Budget) UnmarshalJSON(src []byte) error {
|
|
var value string
|
|
err := json.Unmarshal(src, &value)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
enumTypeValue := Budget(value)
|
|
for _, existing := range AllowedBudgetEnumValues {
|
|
if existing == enumTypeValue {
|
|
*v = enumTypeValue
|
|
return nil
|
|
}
|
|
}
|
|
|
|
return fmt.Errorf("%+v is not a valid Budget", value)
|
|
}
|
|
|
|
// NewBudgetFromValue returns a pointer to a valid Budget
|
|
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
|
func NewBudgetFromValue(v string) (*Budget, error) {
|
|
ev := Budget(v)
|
|
if ev.IsValid() {
|
|
return &ev, nil
|
|
} else {
|
|
return nil, fmt.Errorf("invalid value '%v' for Budget: valid values are %v", v, AllowedBudgetEnumValues)
|
|
}
|
|
}
|
|
|
|
// IsValid return true if the value is valid for the enum, false otherwise
|
|
func (v Budget) IsValid() bool {
|
|
for _, existing := range AllowedBudgetEnumValues {
|
|
if existing == v {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
// Ptr returns reference to Budget value
|
|
func (v Budget) Ptr() *Budget {
|
|
return &v
|
|
}
|
|
|
|
type NullableBudget struct {
|
|
value *Budget
|
|
isSet bool
|
|
}
|
|
|
|
func (v NullableBudget) Get() *Budget {
|
|
return v.value
|
|
}
|
|
|
|
func (v *NullableBudget) Set(val *Budget) {
|
|
v.value = val
|
|
v.isSet = true
|
|
}
|
|
|
|
func (v NullableBudget) IsSet() bool {
|
|
return v.isSet
|
|
}
|
|
|
|
func (v *NullableBudget) Unset() {
|
|
v.value = nil
|
|
v.isSet = false
|
|
}
|
|
|
|
func NewNullableBudget(val *Budget) *NullableBudget {
|
|
return &NullableBudget{value: val, isSet: true}
|
|
}
|
|
|
|
func (v NullableBudget) MarshalJSON() ([]byte, error) {
|
|
return json.Marshal(v.value)
|
|
}
|
|
|
|
func (v *NullableBudget) UnmarshalJSON(src []byte) error {
|
|
v.isSet = true
|
|
return json.Unmarshal(src, &v.value)
|
|
}
|
|
|