fleet-memory/hindsight-clients/go/model_operation_status_response.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

490 lines
15 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 OperationStatusResponse type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &OperationStatusResponse{}
// OperationStatusResponse Response model for getting a single operation status.
type OperationStatusResponse struct {
OperationId string `json:"operation_id"`
Status string `json:"status"`
OperationType NullableString `json:"operation_type,omitempty"`
CreatedAt NullableString `json:"created_at,omitempty"`
UpdatedAt NullableString `json:"updated_at,omitempty"`
CompletedAt NullableString `json:"completed_at,omitempty"`
ErrorMessage NullableString `json:"error_message,omitempty"`
ResultMetadata map[string]interface{} `json:"result_metadata,omitempty"`
ChildOperations []ChildOperationStatus `json:"child_operations,omitempty"`
}
type _OperationStatusResponse OperationStatusResponse
// NewOperationStatusResponse instantiates a new OperationStatusResponse 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 NewOperationStatusResponse(operationId string, status string) *OperationStatusResponse {
this := OperationStatusResponse{}
this.OperationId = operationId
this.Status = status
return &this
}
// NewOperationStatusResponseWithDefaults instantiates a new OperationStatusResponse 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 NewOperationStatusResponseWithDefaults() *OperationStatusResponse {
this := OperationStatusResponse{}
return &this
}
// GetOperationId returns the OperationId field value
func (o *OperationStatusResponse) GetOperationId() string {
if o == nil {
var ret string
return ret
}
return o.OperationId
}
// GetOperationIdOk returns a tuple with the OperationId field value
// and a boolean to check if the value has been set.
func (o *OperationStatusResponse) GetOperationIdOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.OperationId, true
}
// SetOperationId sets field value
func (o *OperationStatusResponse) SetOperationId(v string) {
o.OperationId = v
}
// GetStatus returns the Status field value
func (o *OperationStatusResponse) GetStatus() string {
if o == nil {
var ret string
return ret
}
return o.Status
}
// GetStatusOk returns a tuple with the Status field value
// and a boolean to check if the value has been set.
func (o *OperationStatusResponse) GetStatusOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Status, true
}
// SetStatus sets field value
func (o *OperationStatusResponse) SetStatus(v string) {
o.Status = v
}
// GetOperationType returns the OperationType field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OperationStatusResponse) GetOperationType() string {
if o == nil || IsNil(o.OperationType.Get()) {
var ret string
return ret
}
return *o.OperationType.Get()
}
// GetOperationTypeOk returns a tuple with the OperationType 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 *OperationStatusResponse) GetOperationTypeOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.OperationType.Get(), o.OperationType.IsSet()
}
// HasOperationType returns a boolean if a field has been set.
func (o *OperationStatusResponse) HasOperationType() bool {
if o != nil && o.OperationType.IsSet() {
return true
}
return false
}
// SetOperationType gets a reference to the given NullableString and assigns it to the OperationType field.
func (o *OperationStatusResponse) SetOperationType(v string) {
o.OperationType.Set(&v)
}
// SetOperationTypeNil sets the value for OperationType to be an explicit nil
func (o *OperationStatusResponse) SetOperationTypeNil() {
o.OperationType.Set(nil)
}
// UnsetOperationType ensures that no value is present for OperationType, not even an explicit nil
func (o *OperationStatusResponse) UnsetOperationType() {
o.OperationType.Unset()
}
// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OperationStatusResponse) GetCreatedAt() string {
if o == nil || IsNil(o.CreatedAt.Get()) {
var ret string
return ret
}
return *o.CreatedAt.Get()
}
// GetCreatedAtOk returns a tuple with the CreatedAt 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 *OperationStatusResponse) GetCreatedAtOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.CreatedAt.Get(), o.CreatedAt.IsSet()
}
// HasCreatedAt returns a boolean if a field has been set.
func (o *OperationStatusResponse) HasCreatedAt() bool {
if o != nil && o.CreatedAt.IsSet() {
return true
}
return false
}
// SetCreatedAt gets a reference to the given NullableString and assigns it to the CreatedAt field.
func (o *OperationStatusResponse) SetCreatedAt(v string) {
o.CreatedAt.Set(&v)
}
// SetCreatedAtNil sets the value for CreatedAt to be an explicit nil
func (o *OperationStatusResponse) SetCreatedAtNil() {
o.CreatedAt.Set(nil)
}
// UnsetCreatedAt ensures that no value is present for CreatedAt, not even an explicit nil
func (o *OperationStatusResponse) UnsetCreatedAt() {
o.CreatedAt.Unset()
}
// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OperationStatusResponse) GetUpdatedAt() string {
if o == nil || IsNil(o.UpdatedAt.Get()) {
var ret string
return ret
}
return *o.UpdatedAt.Get()
}
// GetUpdatedAtOk returns a tuple with the UpdatedAt 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 *OperationStatusResponse) GetUpdatedAtOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.UpdatedAt.Get(), o.UpdatedAt.IsSet()
}
// HasUpdatedAt returns a boolean if a field has been set.
func (o *OperationStatusResponse) HasUpdatedAt() bool {
if o != nil && o.UpdatedAt.IsSet() {
return true
}
return false
}
// SetUpdatedAt gets a reference to the given NullableString and assigns it to the UpdatedAt field.
func (o *OperationStatusResponse) SetUpdatedAt(v string) {
o.UpdatedAt.Set(&v)
}
// SetUpdatedAtNil sets the value for UpdatedAt to be an explicit nil
func (o *OperationStatusResponse) SetUpdatedAtNil() {
o.UpdatedAt.Set(nil)
}
// UnsetUpdatedAt ensures that no value is present for UpdatedAt, not even an explicit nil
func (o *OperationStatusResponse) UnsetUpdatedAt() {
o.UpdatedAt.Unset()
}
// GetCompletedAt returns the CompletedAt field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OperationStatusResponse) GetCompletedAt() string {
if o == nil || IsNil(o.CompletedAt.Get()) {
var ret string
return ret
}
return *o.CompletedAt.Get()
}
// GetCompletedAtOk returns a tuple with the CompletedAt 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 *OperationStatusResponse) GetCompletedAtOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.CompletedAt.Get(), o.CompletedAt.IsSet()
}
// HasCompletedAt returns a boolean if a field has been set.
func (o *OperationStatusResponse) HasCompletedAt() bool {
if o != nil && o.CompletedAt.IsSet() {
return true
}
return false
}
// SetCompletedAt gets a reference to the given NullableString and assigns it to the CompletedAt field.
func (o *OperationStatusResponse) SetCompletedAt(v string) {
o.CompletedAt.Set(&v)
}
// SetCompletedAtNil sets the value for CompletedAt to be an explicit nil
func (o *OperationStatusResponse) SetCompletedAtNil() {
o.CompletedAt.Set(nil)
}
// UnsetCompletedAt ensures that no value is present for CompletedAt, not even an explicit nil
func (o *OperationStatusResponse) UnsetCompletedAt() {
o.CompletedAt.Unset()
}
// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OperationStatusResponse) GetErrorMessage() string {
if o == nil || IsNil(o.ErrorMessage.Get()) {
var ret string
return ret
}
return *o.ErrorMessage.Get()
}
// GetErrorMessageOk returns a tuple with the ErrorMessage 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 *OperationStatusResponse) GetErrorMessageOk() (*string, bool) {
if o == nil {
return nil, false
}
return o.ErrorMessage.Get(), o.ErrorMessage.IsSet()
}
// HasErrorMessage returns a boolean if a field has been set.
func (o *OperationStatusResponse) HasErrorMessage() bool {
if o != nil && o.ErrorMessage.IsSet() {
return true
}
return false
}
// SetErrorMessage gets a reference to the given NullableString and assigns it to the ErrorMessage field.
func (o *OperationStatusResponse) SetErrorMessage(v string) {
o.ErrorMessage.Set(&v)
}
// SetErrorMessageNil sets the value for ErrorMessage to be an explicit nil
func (o *OperationStatusResponse) SetErrorMessageNil() {
o.ErrorMessage.Set(nil)
}
// UnsetErrorMessage ensures that no value is present for ErrorMessage, not even an explicit nil
func (o *OperationStatusResponse) UnsetErrorMessage() {
o.ErrorMessage.Unset()
}
// GetResultMetadata returns the ResultMetadata field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OperationStatusResponse) GetResultMetadata() map[string]interface{} {
if o == nil {
var ret map[string]interface{}
return ret
}
return o.ResultMetadata
}
// GetResultMetadataOk returns a tuple with the ResultMetadata 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 *OperationStatusResponse) GetResultMetadataOk() (map[string]interface{}, bool) {
if o == nil || IsNil(o.ResultMetadata) {
return map[string]interface{}{}, false
}
return o.ResultMetadata, true
}
// HasResultMetadata returns a boolean if a field has been set.
func (o *OperationStatusResponse) HasResultMetadata() bool {
if o != nil && !IsNil(o.ResultMetadata) {
return true
}
return false
}
// SetResultMetadata gets a reference to the given map[string]interface{} and assigns it to the ResultMetadata field.
func (o *OperationStatusResponse) SetResultMetadata(v map[string]interface{}) {
o.ResultMetadata = v
}
// GetChildOperations returns the ChildOperations field value if set, zero value otherwise (both if not set or set to explicit null).
func (o *OperationStatusResponse) GetChildOperations() []ChildOperationStatus {
if o == nil {
var ret []ChildOperationStatus
return ret
}
return o.ChildOperations
}
// GetChildOperationsOk returns a tuple with the ChildOperations 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 *OperationStatusResponse) GetChildOperationsOk() ([]ChildOperationStatus, bool) {
if o == nil || IsNil(o.ChildOperations) {
return nil, false
}
return o.ChildOperations, true
}
// HasChildOperations returns a boolean if a field has been set.
func (o *OperationStatusResponse) HasChildOperations() bool {
if o != nil && !IsNil(o.ChildOperations) {
return true
}
return false
}
// SetChildOperations gets a reference to the given []ChildOperationStatus and assigns it to the ChildOperations field.
func (o *OperationStatusResponse) SetChildOperations(v []ChildOperationStatus) {
o.ChildOperations = v
}
func (o OperationStatusResponse) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o OperationStatusResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["operation_id"] = o.OperationId
toSerialize["status"] = o.Status
if o.OperationType.IsSet() {
toSerialize["operation_type"] = o.OperationType.Get()
}
if o.CreatedAt.IsSet() {
toSerialize["created_at"] = o.CreatedAt.Get()
}
if o.UpdatedAt.IsSet() {
toSerialize["updated_at"] = o.UpdatedAt.Get()
}
if o.CompletedAt.IsSet() {
toSerialize["completed_at"] = o.CompletedAt.Get()
}
if o.ErrorMessage.IsSet() {
toSerialize["error_message"] = o.ErrorMessage.Get()
}
if o.ResultMetadata != nil {
toSerialize["result_metadata"] = o.ResultMetadata
}
if o.ChildOperations != nil {
toSerialize["child_operations"] = o.ChildOperations
}
return toSerialize, nil
}
func (o *OperationStatusResponse) 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{
"operation_id",
"status",
}
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)
}
}
varOperationStatusResponse := _OperationStatusResponse{}
decoder := json.NewDecoder(bytes.NewReader(data))
decoder.DisallowUnknownFields()
err = decoder.Decode(&varOperationStatusResponse)
if err != nil {
return err
}
*o = OperationStatusResponse(varOperationStatusResponse)
return err
}
type NullableOperationStatusResponse struct {
value *OperationStatusResponse
isSet bool
}
func (v NullableOperationStatusResponse) Get() *OperationStatusResponse {
return v.value
}
func (v *NullableOperationStatusResponse) Set(val *OperationStatusResponse) {
v.value = val
v.isSet = true
}
func (v NullableOperationStatusResponse) IsSet() bool {
return v.isSet
}
func (v *NullableOperationStatusResponse) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableOperationStatusResponse(val *OperationStatusResponse) *NullableOperationStatusResponse {
return &NullableOperationStatusResponse{value: val, isSet: true}
}
func (v NullableOperationStatusResponse) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableOperationStatusResponse) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}