diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf42d6cf..c4bc2421 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -648,6 +648,80 @@ jobs: echo "=== API Server Logs ===" cat /tmp/api-server.log || echo "No API server log found" + test-go-client: + runs-on: ubuntu-latest + env: + HINDSIGHT_API_LLM_PROVIDER: groq + HINDSIGHT_API_LLM_API_KEY: ${{ secrets.GROQ_API_KEY }} + HINDSIGHT_API_LLM_MODEL: openai/gpt-oss-20b + HINDSIGHT_API_URL: http://localhost:8888 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Prefer CPU-only PyTorch in CI (but keep PyPI for everything else) + UV_INDEX: pytorch=https://download.pytorch.org/whl/cpu + + steps: + - uses: actions/checkout@v4 + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + prune-cache: false + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: ".python-version" + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + cache-dependency-path: hindsight-clients/go/go.sum + + - name: Build API + working-directory: ./hindsight-api + run: uv build + + - name: Install API dependencies + working-directory: ./hindsight-api + run: uv sync --frozen --no-install-project --index-strategy unsafe-best-match + + - name: Create .env file + run: | + cat > .env << EOF + HINDSIGHT_API_LLM_PROVIDER=${{ env.HINDSIGHT_API_LLM_PROVIDER }} + HINDSIGHT_API_LLM_API_KEY=${{ env.HINDSIGHT_API_LLM_API_KEY }} + HINDSIGHT_API_LLM_MODEL=${{ env.HINDSIGHT_API_LLM_MODEL }} + EOF + + - name: Start API server + run: | + ./scripts/dev/start-api.sh > /tmp/api-server.log 2>&1 & + echo "Waiting for API server to be ready..." + for i in {1..60}; do + if curl -sf http://localhost:8888/health > /dev/null 2>&1; then + echo "API server is ready after ${i}s" + break + fi + if [ $i -eq 60 ]; then + echo "API server failed to start after 60s" + cat /tmp/api-server.log + exit 1 + fi + sleep 1 + done + + - name: Run Go client tests + working-directory: ./hindsight-clients/go + run: go test -v -tags=integration + + - name: Show API server logs + if: always() + run: | + echo "=== API Server Logs ===" + cat /tmp/api-server.log || echo "No API server log found" + test-integration: runs-on: ubuntu-latest env: diff --git a/hindsight-clients/go/.gitignore b/hindsight-clients/go/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/hindsight-clients/go/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/hindsight-clients/go/README.md b/hindsight-clients/go/README.md index e67ee892..41b9ce7a 100644 --- a/hindsight-clients/go/README.md +++ b/hindsight-clients/go/README.md @@ -1,178 +1,226 @@ -# Hindsight Go Client +# Go API client for hindsight -Go client for the [Hindsight](https://github.com/vectorize-io/hindsight) agent memory API. +HTTP API for Hindsight + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: 0.4.11 +- Package version: 1.0.0 +- Generator version: 7.10.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation -```bash -go get github.com/vectorize-io/hindsight-client-go +Install the following dependencies: + +```sh +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context ``` -Requires Go 1.25+. - -## Quick Start +Put the package under your project folder and add the following in import: ```go -package main - -import ( - "context" - "fmt" - "log" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - - // Store a memory - _, err = client.Retain(ctx, "my-bank", "The user prefers dark mode") - if err != nil { - log.Fatal(err) - } - - // Recall memories - resp, err := client.Recall(ctx, "my-bank", "What are the user's preferences?") - if err != nil { - log.Fatal(err) - } - for _, r := range resp.Results { - fmt.Println(r.Text) - } - - // Reflect with reasoning - ref, err := client.Reflect(ctx, "my-bank", "Summarize what you know about the user") - if err != nil { - log.Fatal(err) - } - fmt.Println(ref.Text) -} +import hindsight "github.com/vectorize-io/hindsight-client-go" ``` -## Authentication +To use a proxy, set the environment variable `HTTP_PROXY`: ```go -client, err := hindsight.New("http://localhost:8888", hindsight.WithAPIKey("your-key")) +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") ``` -## Core Operations +## Configuration of Server URL -### Retain (Store Memories) +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `hindsight.ContextServerIndex` of type `int`. ```go -// Single memory -_, err := client.Retain(ctx, "bank-id", "Alice loves Python", - hindsight.WithContext("programming discussion"), - hindsight.WithTags([]string{"tech"}), - hindsight.WithDocumentID("conv-123"), -) - -// Batch -items := []hindsight.MemoryItem{ - {Content: "First memory"}, - {Content: "Second memory"}, -} -_, err := client.RetainBatch(ctx, "bank-id", items, - hindsight.WithDocumentTags([]string{"import"}), - hindsight.WithAsync(true), -) +ctx := context.WithValue(context.Background(), hindsight.ContextServerIndex, 1) ``` -### Recall (Retrieve Memories) +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `hindsight.ContextServerVariables` of type `map[string]string`. ```go -resp, err := client.Recall(ctx, "bank-id", "What does Alice like?", - hindsight.WithBudget(hindsight.BudgetHigh), - hindsight.WithMaxTokens(4096), - hindsight.WithTypes([]string{"world", "experience"}), - hindsight.WithTrace(true), - hindsight.WithRecallTags([]string{"tech"}), -) - -for _, r := range resp.Results { - fmt.Printf("[%s] %s\n", r.Type.Or("unknown"), r.Text) -} -``` - -### Reflect (Reason with Memories) - -```go -resp, err := client.Reflect(ctx, "bank-id", "What are the user's interests?", - hindsight.WithReflectBudget(hindsight.BudgetMid), - hindsight.WithReflectMaxTokens(2048), - hindsight.WithResponseSchema(map[string]any{ - "type": "object", - "properties": map[string]any{ - "interests": map[string]any{"type": "array", "items": map[string]any{"type": "string"}}, - }, - }), -) - -fmt.Println(resp.Text) -``` - -### Bank Management - -```go -// Create bank with personality -_, err := client.CreateBank(ctx, "my-bank", - hindsight.WithBankName("My Agent"), - hindsight.WithMission("Help users with coding tasks"), - hindsight.WithDisposition(hindsight.DispositionTraits{ - Skepticism: 3, - Literalism: 2, - Empathy: 4, - }), -) - -// Update mission -_, err = client.SetMission(ctx, "my-bank", "New mission statement") - -// List all banks -banks, err := client.ListBanks(ctx) - -// Delete bank -err = client.DeleteBank(ctx, "my-bank") -``` - -## Advanced Usage - -For operations not covered by the high-level wrapper (documents, entities, operations, mental models, directives), access the ogen-generated client directly: - -```go -ogen := client.OgenClient() - -// List entities -resp, err := ogen.ListEntities(ctx, ogenapi.ListEntitiesParams{ - BankID: "my-bank", +ctx := context.WithValue(context.Background(), hindsight.ContextServerVariables, map[string]string{ + "basePath": "v2", }) - -// Create mental model -resp, err := ogen.CreateMentalModel(ctx, &ogenapi.CreateMentalModelRequest{ - Name: "user-preferences", - SourceQuery: "What are the user's preferences?", -}, ogenapi.CreateMentalModelParams{BankID: "my-bank"}) ``` -## Code Generation +Note, enum values are always validated and all unused variables are silently ignored. -The client is built on [ogen](https://github.com/ogen-go/ogen), generating strongly-typed Go code from the OpenAPI 3.1 spec. To regenerate after API changes: +### URLs Configuration per Operation -```bash -cd hindsight-clients/go -go generate ./... +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `hindsight.ContextOperationServerIndices` and `hindsight.ContextOperationServerVariables` context maps. + +```go +ctx := context.WithValue(context.Background(), hindsight.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), hindsight.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) ``` -## Running Tests +## Documentation for API Endpoints + +All URIs are relative to *http://localhost* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*BanksAPI* | [**AddBankBackground**](docs/BanksAPI.md#addbankbackground) | **Post** /v1/default/banks/{bank_id}/background | Add/merge memory bank background (deprecated) +*BanksAPI* | [**ClearObservations**](docs/BanksAPI.md#clearobservations) | **Delete** /v1/default/banks/{bank_id}/observations | Clear all observations +*BanksAPI* | [**CreateOrUpdateBank**](docs/BanksAPI.md#createorupdatebank) | **Put** /v1/default/banks/{bank_id} | Create or update memory bank +*BanksAPI* | [**DeleteBank**](docs/BanksAPI.md#deletebank) | **Delete** /v1/default/banks/{bank_id} | Delete memory bank +*BanksAPI* | [**GetAgentStats**](docs/BanksAPI.md#getagentstats) | **Get** /v1/default/banks/{bank_id}/stats | Get statistics for memory bank +*BanksAPI* | [**GetBankConfig**](docs/BanksAPI.md#getbankconfig) | **Get** /v1/default/banks/{bank_id}/config | Get bank configuration +*BanksAPI* | [**GetBankProfile**](docs/BanksAPI.md#getbankprofile) | **Get** /v1/default/banks/{bank_id}/profile | Get memory bank profile +*BanksAPI* | [**ListBanks**](docs/BanksAPI.md#listbanks) | **Get** /v1/default/banks | List all memory banks +*BanksAPI* | [**ResetBankConfig**](docs/BanksAPI.md#resetbankconfig) | **Delete** /v1/default/banks/{bank_id}/config | Reset bank configuration +*BanksAPI* | [**TriggerConsolidation**](docs/BanksAPI.md#triggerconsolidation) | **Post** /v1/default/banks/{bank_id}/consolidate | Trigger consolidation +*BanksAPI* | [**UpdateBank**](docs/BanksAPI.md#updatebank) | **Patch** /v1/default/banks/{bank_id} | Partial update memory bank +*BanksAPI* | [**UpdateBankConfig**](docs/BanksAPI.md#updatebankconfig) | **Patch** /v1/default/banks/{bank_id}/config | Update bank configuration +*BanksAPI* | [**UpdateBankDisposition**](docs/BanksAPI.md#updatebankdisposition) | **Put** /v1/default/banks/{bank_id}/profile | Update memory bank disposition +*DirectivesAPI* | [**CreateDirective**](docs/DirectivesAPI.md#createdirective) | **Post** /v1/default/banks/{bank_id}/directives | Create directive +*DirectivesAPI* | [**DeleteDirective**](docs/DirectivesAPI.md#deletedirective) | **Delete** /v1/default/banks/{bank_id}/directives/{directive_id} | Delete directive +*DirectivesAPI* | [**GetDirective**](docs/DirectivesAPI.md#getdirective) | **Get** /v1/default/banks/{bank_id}/directives/{directive_id} | Get directive +*DirectivesAPI* | [**ListDirectives**](docs/DirectivesAPI.md#listdirectives) | **Get** /v1/default/banks/{bank_id}/directives | List directives +*DirectivesAPI* | [**UpdateDirective**](docs/DirectivesAPI.md#updatedirective) | **Patch** /v1/default/banks/{bank_id}/directives/{directive_id} | Update directive +*DocumentsAPI* | [**DeleteDocument**](docs/DocumentsAPI.md#deletedocument) | **Delete** /v1/default/banks/{bank_id}/documents/{document_id} | Delete a document +*DocumentsAPI* | [**GetChunk**](docs/DocumentsAPI.md#getchunk) | **Get** /v1/default/chunks/{chunk_id} | Get chunk details +*DocumentsAPI* | [**GetDocument**](docs/DocumentsAPI.md#getdocument) | **Get** /v1/default/banks/{bank_id}/documents/{document_id} | Get document details +*DocumentsAPI* | [**ListDocuments**](docs/DocumentsAPI.md#listdocuments) | **Get** /v1/default/banks/{bank_id}/documents | List documents +*EntitiesAPI* | [**GetEntity**](docs/EntitiesAPI.md#getentity) | **Get** /v1/default/banks/{bank_id}/entities/{entity_id} | Get entity details +*EntitiesAPI* | [**ListEntities**](docs/EntitiesAPI.md#listentities) | **Get** /v1/default/banks/{bank_id}/entities | List entities +*EntitiesAPI* | [**RegenerateEntityObservations**](docs/EntitiesAPI.md#regenerateentityobservations) | **Post** /v1/default/banks/{bank_id}/entities/{entity_id}/regenerate | Regenerate entity observations (deprecated) +*MemoryAPI* | [**ClearBankMemories**](docs/MemoryAPI.md#clearbankmemories) | **Delete** /v1/default/banks/{bank_id}/memories | Clear memory bank memories +*MemoryAPI* | [**GetGraph**](docs/MemoryAPI.md#getgraph) | **Get** /v1/default/banks/{bank_id}/graph | Get memory graph data +*MemoryAPI* | [**GetMemory**](docs/MemoryAPI.md#getmemory) | **Get** /v1/default/banks/{bank_id}/memories/{memory_id} | Get memory unit +*MemoryAPI* | [**ListMemories**](docs/MemoryAPI.md#listmemories) | **Get** /v1/default/banks/{bank_id}/memories/list | List memory units +*MemoryAPI* | [**ListTags**](docs/MemoryAPI.md#listtags) | **Get** /v1/default/banks/{bank_id}/tags | List tags +*MemoryAPI* | [**RecallMemories**](docs/MemoryAPI.md#recallmemories) | **Post** /v1/default/banks/{bank_id}/memories/recall | Recall memory +*MemoryAPI* | [**Reflect**](docs/MemoryAPI.md#reflect) | **Post** /v1/default/banks/{bank_id}/reflect | Reflect and generate answer +*MemoryAPI* | [**RetainMemories**](docs/MemoryAPI.md#retainmemories) | **Post** /v1/default/banks/{bank_id}/memories | Retain memories +*MentalModelsAPI* | [**CreateMentalModel**](docs/MentalModelsAPI.md#creatementalmodel) | **Post** /v1/default/banks/{bank_id}/mental-models | Create mental model +*MentalModelsAPI* | [**DeleteMentalModel**](docs/MentalModelsAPI.md#deletementalmodel) | **Delete** /v1/default/banks/{bank_id}/mental-models/{mental_model_id} | Delete mental model +*MentalModelsAPI* | [**GetMentalModel**](docs/MentalModelsAPI.md#getmentalmodel) | **Get** /v1/default/banks/{bank_id}/mental-models/{mental_model_id} | Get mental model +*MentalModelsAPI* | [**ListMentalModels**](docs/MentalModelsAPI.md#listmentalmodels) | **Get** /v1/default/banks/{bank_id}/mental-models | List mental models +*MentalModelsAPI* | [**RefreshMentalModel**](docs/MentalModelsAPI.md#refreshmentalmodel) | **Post** /v1/default/banks/{bank_id}/mental-models/{mental_model_id}/refresh | Refresh mental model +*MentalModelsAPI* | [**UpdateMentalModel**](docs/MentalModelsAPI.md#updatementalmodel) | **Patch** /v1/default/banks/{bank_id}/mental-models/{mental_model_id} | Update mental model +*MonitoringAPI* | [**GetVersion**](docs/MonitoringAPI.md#getversion) | **Get** /version | Get API version and feature flags +*MonitoringAPI* | [**HealthEndpointHealthGet**](docs/MonitoringAPI.md#healthendpointhealthget) | **Get** /health | Health check endpoint +*MonitoringAPI* | [**MetricsEndpointMetricsGet**](docs/MonitoringAPI.md#metricsendpointmetricsget) | **Get** /metrics | Prometheus metrics endpoint +*OperationsAPI* | [**CancelOperation**](docs/OperationsAPI.md#canceloperation) | **Delete** /v1/default/banks/{bank_id}/operations/{operation_id} | Cancel a pending async operation +*OperationsAPI* | [**GetOperationStatus**](docs/OperationsAPI.md#getoperationstatus) | **Get** /v1/default/banks/{bank_id}/operations/{operation_id} | Get operation status +*OperationsAPI* | [**ListOperations**](docs/OperationsAPI.md#listoperations) | **Get** /v1/default/banks/{bank_id}/operations | List async operations + + +## Documentation For Models + + - [AddBackgroundRequest](docs/AddBackgroundRequest.md) + - [AsyncOperationSubmitResponse](docs/AsyncOperationSubmitResponse.md) + - [BackgroundResponse](docs/BackgroundResponse.md) + - [BankConfigResponse](docs/BankConfigResponse.md) + - [BankConfigUpdate](docs/BankConfigUpdate.md) + - [BankListItem](docs/BankListItem.md) + - [BankListResponse](docs/BankListResponse.md) + - [BankProfileResponse](docs/BankProfileResponse.md) + - [BankStatsResponse](docs/BankStatsResponse.md) + - [Budget](docs/Budget.md) + - [CancelOperationResponse](docs/CancelOperationResponse.md) + - [ChunkData](docs/ChunkData.md) + - [ChunkIncludeOptions](docs/ChunkIncludeOptions.md) + - [ChunkResponse](docs/ChunkResponse.md) + - [ConsolidationResponse](docs/ConsolidationResponse.md) + - [CreateBankRequest](docs/CreateBankRequest.md) + - [CreateDirectiveRequest](docs/CreateDirectiveRequest.md) + - [CreateMentalModelRequest](docs/CreateMentalModelRequest.md) + - [CreateMentalModelResponse](docs/CreateMentalModelResponse.md) + - [DeleteDocumentResponse](docs/DeleteDocumentResponse.md) + - [DeleteResponse](docs/DeleteResponse.md) + - [DirectiveListResponse](docs/DirectiveListResponse.md) + - [DirectiveResponse](docs/DirectiveResponse.md) + - [DispositionTraits](docs/DispositionTraits.md) + - [DocumentResponse](docs/DocumentResponse.md) + - [EntityDetailResponse](docs/EntityDetailResponse.md) + - [EntityIncludeOptions](docs/EntityIncludeOptions.md) + - [EntityInput](docs/EntityInput.md) + - [EntityListItem](docs/EntityListItem.md) + - [EntityListResponse](docs/EntityListResponse.md) + - [EntityObservationResponse](docs/EntityObservationResponse.md) + - [EntityStateResponse](docs/EntityStateResponse.md) + - [FeaturesInfo](docs/FeaturesInfo.md) + - [GraphDataResponse](docs/GraphDataResponse.md) + - [HTTPValidationError](docs/HTTPValidationError.md) + - [IncludeOptions](docs/IncludeOptions.md) + - [ListDocumentsResponse](docs/ListDocumentsResponse.md) + - [ListMemoryUnitsResponse](docs/ListMemoryUnitsResponse.md) + - [ListTagsResponse](docs/ListTagsResponse.md) + - [MemoryItem](docs/MemoryItem.md) + - [MentalModelListResponse](docs/MentalModelListResponse.md) + - [MentalModelResponse](docs/MentalModelResponse.md) + - [MentalModelTrigger](docs/MentalModelTrigger.md) + - [OperationResponse](docs/OperationResponse.md) + - [OperationStatusResponse](docs/OperationStatusResponse.md) + - [OperationsListResponse](docs/OperationsListResponse.md) + - [RecallRequest](docs/RecallRequest.md) + - [RecallResponse](docs/RecallResponse.md) + - [RecallResult](docs/RecallResult.md) + - [ReflectBasedOn](docs/ReflectBasedOn.md) + - [ReflectDirective](docs/ReflectDirective.md) + - [ReflectFact](docs/ReflectFact.md) + - [ReflectIncludeOptions](docs/ReflectIncludeOptions.md) + - [ReflectLLMCall](docs/ReflectLLMCall.md) + - [ReflectMentalModel](docs/ReflectMentalModel.md) + - [ReflectRequest](docs/ReflectRequest.md) + - [ReflectResponse](docs/ReflectResponse.md) + - [ReflectToolCall](docs/ReflectToolCall.md) + - [ReflectTrace](docs/ReflectTrace.md) + - [RetainRequest](docs/RetainRequest.md) + - [RetainResponse](docs/RetainResponse.md) + - [TagItem](docs/TagItem.md) + - [TokenUsage](docs/TokenUsage.md) + - [ToolCallsIncludeOptions](docs/ToolCallsIncludeOptions.md) + - [UpdateDirectiveRequest](docs/UpdateDirectiveRequest.md) + - [UpdateDispositionRequest](docs/UpdateDispositionRequest.md) + - [UpdateMentalModelRequest](docs/UpdateMentalModelRequest.md) + - [ValidationError](docs/ValidationError.md) + - [ValidationErrorLocInner](docs/ValidationErrorLocInner.md) + - [VersionResponse](docs/VersionResponse.md) + + +## Documentation For Authorization + +Endpoints do not require authorization. + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + -Integration tests require a running Hindsight API server: -```bash -HINDSIGHT_API_URL=http://localhost:8888 go test -v -tags=integration ./... -``` diff --git a/hindsight-clients/go/api/openapi.yaml b/hindsight-clients/go/api/openapi.yaml new file mode 100644 index 00000000..4837072c --- /dev/null +++ b/hindsight-clients/go/api/openapi.yaml @@ -0,0 +1,4217 @@ +openapi: 3.1.0 +info: + contact: + name: Memory System + description: HTTP API for Hindsight + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Hindsight HTTP API + version: 0.4.11 +servers: +- url: / +paths: + /health: + get: + description: Checks the health of the API and database connection + operationId: health_endpoint_health_get + responses: + "200": + content: + application/json: + schema: {} + description: Successful Response + summary: Health check endpoint + tags: + - Monitoring + /version: + get: + description: Returns API version information and enabled feature flags. Use + this to check which capabilities are available in this deployment. + operationId: get_version + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/VersionResponse' + description: Successful Response + summary: Get API version and feature flags + tags: + - Monitoring + /metrics: + get: + description: Exports metrics in Prometheus format for scraping + operationId: metrics_endpoint_metrics_get + responses: + "200": + content: + application/json: + schema: {} + description: Successful Response + summary: Prometheus metrics endpoint + tags: + - Monitoring + /v1/default/banks/{bank_id}/graph: + get: + description: "Retrieve graph data for visualization, optionally filtered by\ + \ type (world/experience/opinion)." + operationId: get_graph + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: true + in: query + name: type + required: false + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + default: 1000 + title: Limit + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/GraphDataResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get memory graph data + tags: + - Memory + /v1/default/banks/{bank_id}/memories/list: + get: + description: "List memory units with pagination and optional full-text search.\ + \ Supports filtering by type. Results are sorted by most recent first (mentioned_at\ + \ DESC, then created_at DESC)." + operationId: list_memories + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: true + in: query + name: type + required: false + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: q + required: false + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + default: 100 + title: Limit + type: integer + style: form + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + title: Offset + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListMemoryUnitsResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List memory units + tags: + - Memory + /v1/default/banks/{bank_id}/memories/{memory_id}: + get: + description: Get a single memory unit by ID with all its metadata including + entities and tags. + operationId: get_memory + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: memory_id + required: true + schema: + title: Memory Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: {} + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get memory unit + tags: + - Memory + /v1/default/banks/{bank_id}/memories/recall: + post: + description: |- + Recall memory using semantic similarity and spreading activation. + + The type parameter is optional and must be one of: + - `world`: General knowledge about people, places, events, and things that happen + - `experience`: Memories about experience, conversations, actions taken, and tasks performed + operationId: recall_memories + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RecallRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RecallResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Recall memory + tags: + - Memory + /v1/default/banks/{bank_id}/reflect: + post: + description: |- + Reflect and formulate an answer using bank identity, world facts, and opinions. + + This endpoint: + 1. Retrieves experience (conversations and events) + 2. Retrieves world facts relevant to the query + 3. Retrieves existing opinions (bank's perspectives) + 4. Uses LLM to formulate a contextual answer + 5. Returns plain text answer and the facts used + operationId: reflect + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ReflectRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ReflectResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Reflect and generate answer + tags: + - Memory + /v1/default/banks: + get: + description: Get a list of all agents with their profiles + operationId: list_banks + parameters: + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankListResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List all memory banks + tags: + - Banks + /v1/default/banks/{bank_id}/stats: + get: + description: Get statistics about nodes and links for a specific agent + operationId: get_agent_stats + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankStatsResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get statistics for memory bank + tags: + - Banks + /v1/default/banks/{bank_id}/entities: + get: + description: "List all entities (people, organizations, etc.) known by the bank,\ + \ ordered by mention count. Supports pagination." + operationId: list_entities + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - description: Maximum number of entities to return + explode: true + in: query + name: limit + required: false + schema: + default: 100 + description: Maximum number of entities to return + title: Limit + type: integer + style: form + - description: Offset for pagination + explode: true + in: query + name: offset + required: false + schema: + default: 0 + description: Offset for pagination + title: Offset + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EntityListResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List entities + tags: + - Entities + /v1/default/banks/{bank_id}/entities/{entity_id}: + get: + description: Get detailed information about an entity including observations + (mental model). + operationId: get_entity + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: entity_id + required: true + schema: + title: Entity Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EntityDetailResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get entity details + tags: + - Entities + /v1/default/banks/{bank_id}/entities/{entity_id}/regenerate: + post: + deprecated: true + description: This endpoint is deprecated. Entity observations have been replaced + by mental models. + operationId: regenerate_entity_observations + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: entity_id + required: true + schema: + title: Entity Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/EntityDetailResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Regenerate entity observations (deprecated) + tags: + - Entities + /v1/default/banks/{bank_id}/mental-models: + get: + description: List user-curated living documents that stay current. + operationId: list_mental_models + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - description: Filter by tags + explode: true + in: query + name: tags + required: false + schema: + items: + type: string + nullable: true + type: array + style: form + - description: How to match tags + explode: true + in: query + name: tags_match + required: false + schema: + default: any + description: How to match tags + enum: + - any + - all + - exact + title: Tags Match + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 1000 + minimum: 1 + title: Limit + type: integer + style: form + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + title: Offset + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MentalModelListResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List mental models + tags: + - Mental Models + post: + description: Create a mental model by running reflect with the source query + in the background. Returns an operation ID to track progress. The content + is auto-generated by the reflect endpoint. Use the operations endpoint to + check completion status. + operationId: create_mental_model + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMentalModelRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CreateMentalModelResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Create mental model + tags: + - Mental Models + /v1/default/banks/{bank_id}/mental-models/{mental_model_id}: + delete: + description: Delete a mental model. + operationId: delete_mental_model + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: mental_model_id + required: true + schema: + title: Mental Model Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: {} + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Delete mental model + tags: + - Mental Models + get: + description: Get a specific mental model by ID. + operationId: get_mental_model + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: mental_model_id + required: true + schema: + title: Mental Model Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MentalModelResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get mental model + tags: + - Mental Models + patch: + description: Update a mental model's name and/or source query. + operationId: update_mental_model + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: mental_model_id + required: true + schema: + title: Mental Model Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateMentalModelRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/MentalModelResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Update mental model + tags: + - Mental Models + /v1/default/banks/{bank_id}/mental-models/{mental_model_id}/refresh: + post: + description: Submit an async task to re-run the source query through reflect + and update the content. + operationId: refresh_mental_model + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: mental_model_id + required: true + schema: + title: Mental Model Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/AsyncOperationSubmitResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Refresh mental model + tags: + - Mental Models + /v1/default/banks/{bank_id}/directives: + get: + description: List hard rules that are injected into prompts. + operationId: list_directives + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - description: Filter by tags + explode: true + in: query + name: tags + required: false + schema: + items: + type: string + nullable: true + type: array + style: form + - description: How to match tags + explode: true + in: query + name: tags_match + required: false + schema: + default: any + description: How to match tags + enum: + - any + - all + - exact + title: Tags Match + type: string + style: form + - description: Only return active directives + explode: true + in: query + name: active_only + required: false + schema: + default: true + description: Only return active directives + title: Active Only + type: boolean + style: form + - explode: true + in: query + name: limit + required: false + schema: + default: 100 + maximum: 1000 + minimum: 1 + title: Limit + type: integer + style: form + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + minimum: 0 + title: Offset + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DirectiveListResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List directives + tags: + - Directives + post: + description: Create a hard rule that will be injected into prompts. + operationId: create_directive + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateDirectiveRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DirectiveResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Create directive + tags: + - Directives + /v1/default/banks/{bank_id}/directives/{directive_id}: + delete: + description: Delete a directive. + operationId: delete_directive + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: directive_id + required: true + schema: + title: Directive Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: {} + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Delete directive + tags: + - Directives + get: + description: Get a specific directive by ID. + operationId: get_directive + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: directive_id + required: true + schema: + title: Directive Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DirectiveResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get directive + tags: + - Directives + patch: + description: Update a directive's properties. + operationId: update_directive + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: directive_id + required: true + schema: + title: Directive Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateDirectiveRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DirectiveResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Update directive + tags: + - Directives + /v1/default/banks/{bank_id}/documents: + get: + description: List documents with pagination and optional search. Documents are + the source content from which memory units are extracted. + operationId: list_documents + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: true + in: query + name: q + required: false + schema: + nullable: true + type: string + style: form + - explode: true + in: query + name: limit + required: false + schema: + default: 100 + title: Limit + type: integer + style: form + - explode: true + in: query + name: offset + required: false + schema: + default: 0 + title: Offset + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListDocumentsResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List documents + tags: + - Documents + /v1/default/banks/{bank_id}/documents/{document_id}: + delete: + description: |- + Delete a document and all its associated memory units and links. + + This will cascade delete: + - The document itself + - All memory units extracted from this document + - All links (temporal, semantic, entity) associated with those memory units + + This operation cannot be undone. + operationId: delete_document + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: document_id + required: true + schema: + title: Document Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteDocumentResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Delete a document + tags: + - Documents + get: + description: Get a specific document including its original text + operationId: get_document + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: document_id + required: true + schema: + title: Document Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DocumentResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get document details + tags: + - Documents + /v1/default/banks/{bank_id}/tags: + get: + description: "List all unique tags in a memory bank with usage counts. Supports\ + \ wildcard search using '*' (e.g., 'user:*', '*-fred', 'tag*-2'). Case-insensitive." + operationId: list_tags + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - description: "Wildcard pattern to filter tags (e.g., 'user:*' for user:alice,\ + \ '*-admin' for role-admin). Use '*' as wildcard. Case-insensitive." + explode: true + in: query + name: q + required: false + schema: + nullable: true + type: string + style: form + - description: Maximum number of tags to return + explode: true + in: query + name: limit + required: false + schema: + default: 100 + description: Maximum number of tags to return + title: Limit + type: integer + style: form + - description: Offset for pagination + explode: true + in: query + name: offset + required: false + schema: + default: 0 + description: Offset for pagination + title: Offset + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListTagsResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List tags + tags: + - Memory + /v1/default/chunks/{chunk_id}: + get: + description: Get a specific chunk by its ID + operationId: get_chunk + parameters: + - explode: false + in: path + name: chunk_id + required: true + schema: + title: Chunk Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ChunkResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get chunk details + tags: + - Documents + /v1/default/banks/{bank_id}/operations: + get: + description: "Get a list of async operations for a specific agent, with optional\ + \ filtering by status. Results are sorted by most recent first." + operationId: list_operations + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - description: "Filter by status: pending, completed, or failed" + explode: true + in: query + name: status + required: false + schema: + nullable: true + type: string + style: form + - description: Maximum number of operations to return + explode: true + in: query + name: limit + required: false + schema: + default: 20 + description: Maximum number of operations to return + maximum: 100 + minimum: 1 + title: Limit + type: integer + style: form + - description: Number of operations to skip + explode: true + in: query + name: offset + required: false + schema: + default: 0 + description: Number of operations to skip + minimum: 0 + title: Offset + type: integer + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/OperationsListResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: List async operations + tags: + - Operations + /v1/default/banks/{bank_id}/operations/{operation_id}: + delete: + description: Cancel a pending async operation by removing it from the queue + operationId: cancel_operation + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: operation_id + required: true + schema: + title: Operation Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/CancelOperationResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Cancel a pending async operation + tags: + - Operations + get: + description: "Get the status of a specific async operation. Returns 'pending',\ + \ 'completed', or 'failed'. Completed operations are removed from storage,\ + \ so 'completed' means the operation finished successfully." + operationId: get_operation_status + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: path + name: operation_id + required: true + schema: + title: Operation Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/OperationStatusResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get operation status + tags: + - Operations + /v1/default/banks/{bank_id}/profile: + get: + description: Get disposition traits and mission for a memory bank. Auto-creates + agent with defaults if not exists. + operationId: get_bank_profile + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankProfileResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get memory bank profile + tags: + - Banks + put: + description: "Update bank's disposition traits (skepticism, literalism, empathy)" + operationId: update_bank_disposition + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateDispositionRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankProfileResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Update memory bank disposition + tags: + - Banks + /v1/default/banks/{bank_id}/background: + post: + deprecated: true + description: "Deprecated: Use PUT /mission instead. This endpoint now updates\ + \ the mission field." + operationId: add_bank_background + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/AddBackgroundRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BackgroundResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Add/merge memory bank background (deprecated) + tags: + - Banks + /v1/default/banks/{bank_id}: + delete: + description: "Delete an entire memory bank including all memories, entities,\ + \ documents, and the bank profile itself. This is a destructive operation\ + \ that cannot be undone." + operationId: delete_bank + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Delete memory bank + tags: + - Banks + patch: + description: Partially update an agent's profile. Only provided fields will + be updated. + operationId: update_bank + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateBankRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankProfileResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Partial update memory bank + tags: + - Banks + put: + description: Create a new agent or update existing agent with disposition and + mission. Auto-fills missing fields with defaults. + operationId: create_or_update_bank + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateBankRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankProfileResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Create or update memory bank + tags: + - Banks + /v1/default/banks/{bank_id}/observations: + delete: + description: Delete all observations for a memory bank. This is useful for resetting + the consolidated knowledge. + operationId: clear_observations + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Clear all observations + tags: + - Banks + /v1/default/banks/{bank_id}/config: + delete: + description: Reset bank configuration to defaults by removing all bank-specific + overrides. The bank will then use global and tenant-level configuration only. + operationId: reset_bank_config + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankConfigResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Reset bank configuration + tags: + - Banks + get: + description: Get fully resolved configuration for a bank including all hierarchical + overrides (global → tenant → bank). The 'config' field contains all resolved + config values. The 'overrides' field shows only bank-specific overrides. + operationId: get_bank_config + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankConfigResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Get bank configuration + tags: + - Banks + patch: + description: "Update configuration overrides for a bank. Only hierarchical fields\ + \ can be overridden (LLM settings, retention parameters, etc.). Keys can be\ + \ provided in Python field format (llm_provider) or environment variable format\ + \ (HINDSIGHT_API_LLM_PROVIDER)." + operationId: update_bank_config + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BankConfigUpdate' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/BankConfigResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Update bank configuration + tags: + - Banks + /v1/default/banks/{bank_id}/consolidate: + post: + description: Run memory consolidation to create/update observations from recent + memories. + operationId: trigger_consolidation + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ConsolidationResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Trigger consolidation + tags: + - Banks + /v1/default/banks/{bank_id}/memories: + delete: + description: "Delete memory units for a memory bank. Optionally filter by type\ + \ (world, experience, opinion) to delete only specific types. This is a destructive\ + \ operation that cannot be undone. The bank profile (disposition and background)\ + \ will be preserved." + operationId: clear_bank_memories + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - description: "Optional fact type filter (world, experience, opinion)" + explode: true + in: query + name: type + required: false + schema: + nullable: true + type: string + style: form + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Clear memory bank memories + tags: + - Memory + post: + description: |- + Retain memory items with automatic fact extraction. + + This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. + + **Features:** + - Efficient batch processing + - Automatic fact extraction from natural language + - Entity recognition and linking + - Document tracking with automatic upsert (when document_id is provided) + - Temporal and semantic linking + - Optional asynchronous processing + + **The system automatically:** + 1. Extracts semantic facts from the content + 2. Generates embeddings + 3. Deduplicates similar facts + 4. Creates temporal, semantic, and entity links + 5. Tracks document metadata + + **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. + + **When `async=false` (default):** Waits for processing to complete. + + **Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). + operationId: retain_memories + parameters: + - explode: false + in: path + name: bank_id + required: true + schema: + title: Bank Id + type: string + style: simple + - explode: false + in: header + name: authorization + required: false + schema: + nullable: true + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RetainRequest' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/RetainResponse' + description: Successful Response + "422": + content: + application/json: + schema: + $ref: '#/components/schemas/HTTPValidationError' + description: Validation Error + summary: Retain memories + tags: + - Memory +components: + schemas: + AddBackgroundRequest: + description: "Request model for adding/merging background information. Deprecated:\ + \ use SetMissionRequest instead." + example: + content: I was born in Texas + update_disposition: true + properties: + content: + description: New background information to add or merge + title: Content + type: string + update_disposition: + default: true + description: Deprecated - disposition is no longer auto-inferred from mission + title: Update Disposition + type: boolean + required: + - content + title: AddBackgroundRequest + AsyncOperationSubmitResponse: + description: Response model for submitting an async operation. + example: + operation_id: 550e8400-e29b-41d4-a716-446655440000 + status: queued + properties: + operation_id: + title: Operation Id + type: string + status: + title: Status + type: string + required: + - operation_id + - status + title: AsyncOperationSubmitResponse + BackgroundResponse: + description: "Response model for background update. Deprecated: use MissionResponse\ + \ instead." + example: + mission: I was born in Texas. I am a software engineer with 10 years of experience. + properties: + mission: + title: Mission + type: string + background: + nullable: true + type: string + disposition: + $ref: '#/components/schemas/DispositionTraits' + required: + - mission + title: BackgroundResponse + BankConfigResponse: + description: Response model for bank configuration. + example: + bank_id: my-bank + config: + llm_model: gpt-4 + llm_provider: openai + retain_extraction_mode: verbose + overrides: + llm_model: gpt-4 + retain_extraction_mode: verbose + properties: + bank_id: + description: Bank identifier + title: Bank Id + type: string + config: + additionalProperties: {} + description: Fully resolved configuration with all hierarchical overrides + applied (Python field names) + title: Config + overrides: + additionalProperties: {} + description: Bank-specific configuration overrides only (Python field names) + title: Overrides + required: + - bank_id + - config + - overrides + title: BankConfigResponse + BankConfigUpdate: + description: Request model for updating bank configuration. + example: + updates: + llm_model: claude-sonnet-4-5 + retain_custom_instructions: Extract technical details carefully + retain_extraction_mode: verbose + properties: + updates: + additionalProperties: {} + description: Configuration overrides. Keys can be in Python field format + (llm_provider) or environment variable format (HINDSIGHT_API_LLM_PROVIDER). + Only hierarchical fields can be overridden per-bank. + title: Updates + required: + - updates + title: BankConfigUpdate + BankListItem: + description: Bank list item with profile summary. + properties: + bank_id: + title: Bank Id + type: string + name: + nullable: true + type: string + disposition: + $ref: '#/components/schemas/DispositionTraits' + mission: + nullable: true + type: string + created_at: + nullable: true + type: string + updated_at: + nullable: true + type: string + required: + - bank_id + - disposition + title: BankListItem + BankListResponse: + description: Response model for listing all banks. + example: + banks: + - bank_id: user123 + created_at: 2024-01-15T10:30:00Z + disposition: + empathy: 3 + literalism: 3 + skepticism: 3 + mission: I am a software engineer helping my team ship quality code + name: Alice + updated_at: 2024-01-16T14:20:00Z + properties: + banks: + items: + $ref: '#/components/schemas/BankListItem' + type: array + required: + - banks + title: BankListResponse + BankProfileResponse: + description: Response model for bank profile. + example: + bank_id: user123 + disposition: + empathy: 3 + literalism: 3 + skepticism: 3 + mission: I am a software engineer helping my team stay organized and ship + quality code + name: Alice + properties: + bank_id: + title: Bank Id + type: string + name: + title: Name + type: string + disposition: + $ref: '#/components/schemas/DispositionTraits' + mission: + description: The agent's mission - who they are and what they're trying + to accomplish + title: Mission + type: string + background: + nullable: true + type: string + required: + - bank_id + - disposition + - mission + - name + title: BankProfileResponse + BankStatsResponse: + description: Response model for bank statistics endpoint. + example: + bank_id: user123 + failed_operations: 0 + last_consolidated_at: 2024-01-15T10:30:00Z + links_breakdown: + fact: + entity: 40 + semantic: 60 + temporal: 100 + links_by_fact_type: + fact: 200 + observation: 40 + preference: 60 + links_by_link_type: + entity: 50 + semantic: 100 + temporal: 150 + nodes_by_fact_type: + fact: 100 + observation: 20 + preference: 30 + pending_consolidation: 0 + pending_operations: 2 + total_documents: 10 + total_links: 300 + total_nodes: 150 + total_observations: 45 + properties: + bank_id: + title: Bank Id + type: string + total_nodes: + title: Total Nodes + type: integer + total_links: + title: Total Links + type: integer + total_documents: + title: Total Documents + type: integer + nodes_by_fact_type: + additionalProperties: + type: integer + title: Nodes By Fact Type + links_by_link_type: + additionalProperties: + type: integer + title: Links By Link Type + links_by_fact_type: + additionalProperties: + type: integer + title: Links By Fact Type + links_breakdown: + additionalProperties: + additionalProperties: + type: integer + title: Links Breakdown + pending_operations: + title: Pending Operations + type: integer + failed_operations: + title: Failed Operations + type: integer + last_consolidated_at: + nullable: true + type: string + pending_consolidation: + default: 0 + description: Number of memories not yet processed into observations + title: Pending Consolidation + type: integer + total_observations: + default: 0 + description: Total number of observations + title: Total Observations + type: integer + required: + - bank_id + - failed_operations + - links_breakdown + - links_by_fact_type + - links_by_link_type + - nodes_by_fact_type + - pending_operations + - total_documents + - total_links + - total_nodes + title: BankStatsResponse + Budget: + description: Budget levels for recall/reflect operations. + enum: + - low + - mid + - high + title: Budget + type: string + CancelOperationResponse: + description: Response model for cancel operation endpoint. + example: + message: Operation 550e8400-e29b-41d4-a716-446655440000 cancelled + operation_id: 550e8400-e29b-41d4-a716-446655440000 + success: true + properties: + success: + title: Success + type: boolean + message: + title: Message + type: string + operation_id: + title: Operation Id + type: string + required: + - message + - operation_id + - success + title: CancelOperationResponse + ChildOperationStatus: + description: Status of a child operation (for batch operations). + properties: + operation_id: + title: Operation Id + type: string + status: + title: Status + type: string + sub_batch_index: + nullable: true + type: integer + items_count: + nullable: true + type: integer + error_message: + nullable: true + type: string + required: + - operation_id + - status + title: ChildOperationStatus + ChunkData: + description: Chunk data for a single chunk. + properties: + id: + title: Id + type: string + text: + title: Text + type: string + chunk_index: + title: Chunk Index + type: integer + truncated: + default: false + description: Whether the chunk text was truncated due to token limits + title: Truncated + type: boolean + required: + - chunk_index + - id + - text + title: ChunkData + ChunkIncludeOptions: + description: Options for including chunks in recall results. + properties: + max_tokens: + default: 8192 + description: Maximum tokens for chunks (chunks may be truncated) + title: Max Tokens + type: integer + title: ChunkIncludeOptions + ChunkResponse: + description: Response model for get chunk endpoint. + example: + bank_id: user123 + chunk_id: user123_session_1_0 + chunk_index: 0 + chunk_text: This is the first chunk of the document... + created_at: 2024-01-15T10:30:00Z + document_id: session_1 + properties: + chunk_id: + title: Chunk Id + type: string + document_id: + title: Document Id + type: string + bank_id: + title: Bank Id + type: string + chunk_index: + title: Chunk Index + type: integer + chunk_text: + title: Chunk Text + type: string + created_at: + title: Created At + type: string + required: + - bank_id + - chunk_id + - chunk_index + - chunk_text + - created_at + - document_id + title: ChunkResponse + ConsolidationResponse: + description: Response model for consolidation trigger endpoint. + example: + deduplicated: false + operation_id: operation_id + properties: + operation_id: + description: ID of the async consolidation operation + title: Operation Id + type: string + deduplicated: + default: false + description: True if an existing pending task was reused + title: Deduplicated + type: boolean + required: + - operation_id + title: ConsolidationResponse + CreateBankRequest: + description: Request model for creating/updating a bank. + example: + disposition: + empathy: 3 + literalism: 3 + skepticism: 3 + mission: I am a PM helping my engineering team stay organized + name: Alice + properties: + name: + nullable: true + type: string + disposition: + $ref: '#/components/schemas/DispositionTraits' + mission: + nullable: true + type: string + background: + nullable: true + type: string + title: CreateBankRequest + CreateDirectiveRequest: + description: Request model for creating a directive. + example: + is_active: true + name: name + priority: 0 + content: content + tags: + - tags + - tags + properties: + name: + description: Human-readable name for the directive + title: Name + type: string + content: + description: The directive text to inject into prompts + title: Content + type: string + priority: + default: 0 + description: Higher priority directives are injected first + title: Priority + type: integer + is_active: + default: true + description: Whether this directive is active + title: Is Active + type: boolean + tags: + default: [] + description: Tags for filtering + items: + type: string + type: array + required: + - content + - name + title: CreateDirectiveRequest + CreateMentalModelRequest: + description: Request model for creating a mental model. + example: + id: team-communication + max_tokens: 2048 + name: Team Communication Preferences + source_query: How does the team prefer to communicate? + tags: + - team + trigger: + refresh_after_consolidation: false + properties: + id: + nullable: true + type: string + name: + description: Human-readable name for the mental model + title: Name + type: string + source_query: + description: The query to run to generate content + title: Source Query + type: string + tags: + default: [] + description: Tags for scoped visibility + items: + type: string + type: array + max_tokens: + default: 2048 + description: Maximum tokens for generated content + maximum: 8192.0 + minimum: 256.0 + title: Max Tokens + type: integer + trigger: + $ref: '#/components/schemas/MentalModelTrigger' + required: + - name + - source_query + title: CreateMentalModelRequest + CreateMentalModelResponse: + description: Response model for mental model creation. + example: + operation_id: operation_id + mental_model_id: mental_model_id + properties: + mental_model_id: + nullable: true + type: string + operation_id: + description: Operation ID to track refresh progress + title: Operation Id + type: string + required: + - operation_id + title: CreateMentalModelResponse + DeleteDocumentResponse: + description: Response model for delete document endpoint. + example: + document_id: session_1 + memory_units_deleted: 5 + message: Document 'session_1' and 5 associated memory units deleted successfully + success: true + properties: + success: + title: Success + type: boolean + message: + title: Message + type: string + document_id: + title: Document Id + type: string + memory_units_deleted: + title: Memory Units Deleted + type: integer + required: + - document_id + - memory_units_deleted + - message + - success + title: DeleteDocumentResponse + DeleteResponse: + description: Response model for delete operations. + example: + deleted_count: 10 + message: Deleted successfully + success: true + properties: + success: + title: Success + type: boolean + message: + nullable: true + type: string + deleted_count: + nullable: true + type: integer + required: + - success + title: DeleteResponse + DirectiveListResponse: + description: Response model for listing directives. + example: + items: + - is_active: true + updated_at: updated_at + bank_id: bank_id + name: name + created_at: created_at + id: id + priority: 0 + content: content + tags: + - tags + - tags + - is_active: true + updated_at: updated_at + bank_id: bank_id + name: name + created_at: created_at + id: id + priority: 0 + content: content + tags: + - tags + - tags + properties: + items: + items: + $ref: '#/components/schemas/DirectiveResponse' + type: array + required: + - items + title: DirectiveListResponse + DirectiveResponse: + description: Response model for a directive. + example: + is_active: true + updated_at: updated_at + bank_id: bank_id + name: name + created_at: created_at + id: id + priority: 0 + content: content + tags: + - tags + - tags + properties: + id: + title: Id + type: string + bank_id: + title: Bank Id + type: string + name: + title: Name + type: string + content: + title: Content + type: string + priority: + default: 0 + title: Priority + type: integer + is_active: + default: true + title: Is Active + type: boolean + tags: + default: [] + items: + type: string + type: array + created_at: + nullable: true + type: string + updated_at: + nullable: true + type: string + required: + - bank_id + - content + - id + - name + title: DirectiveResponse + DispositionTraits: + description: Disposition traits that influence how memories are formed and interpreted. + example: + empathy: 3 + literalism: 3 + skepticism: 3 + properties: + skepticism: + description: "How skeptical vs trusting (1=trusting, 5=skeptical)" + maximum: 5.0 + minimum: 1.0 + title: Skepticism + type: integer + literalism: + description: "How literally to interpret information (1=flexible, 5=literal)" + maximum: 5.0 + minimum: 1.0 + title: Literalism + type: integer + empathy: + description: "How much to consider emotional context (1=detached, 5=empathetic)" + maximum: 5.0 + minimum: 1.0 + title: Empathy + type: integer + required: + - empathy + - literalism + - skepticism + title: DispositionTraits + DocumentResponse: + description: Response model for get document endpoint. + example: + bank_id: user123 + content_hash: abc123 + created_at: 2024-01-15T10:30:00Z + id: session_1 + memory_unit_count: 15 + original_text: Full document text here... + tags: + - user_a + - session_123 + updated_at: 2024-01-15T10:30:00Z + properties: + id: + title: Id + type: string + bank_id: + title: Bank Id + type: string + original_text: + title: Original Text + type: string + content_hash: + nullable: true + type: string + created_at: + title: Created At + type: string + updated_at: + title: Updated At + type: string + memory_unit_count: + title: Memory Unit Count + type: integer + tags: + default: [] + description: Tags associated with this document + items: + type: string + type: array + required: + - bank_id + - content_hash + - created_at + - id + - memory_unit_count + - original_text + - updated_at + title: DocumentResponse + EntityDetailResponse: + description: Response model for entity detail endpoint. + example: + canonical_name: John + first_seen: 2024-01-15T10:30:00Z + id: 123e4567-e89b-12d3-a456-426614174000 + last_seen: 2024-02-01T14:00:00Z + mention_count: 15 + observations: + - mentioned_at: 2024-01-15T10:30:00Z + text: John works at Google + properties: + id: + title: Id + type: string + canonical_name: + title: Canonical Name + type: string + mention_count: + title: Mention Count + type: integer + first_seen: + nullable: true + type: string + last_seen: + nullable: true + type: string + metadata: + additionalProperties: {} + nullable: true + observations: + items: + $ref: '#/components/schemas/EntityObservationResponse' + type: array + required: + - canonical_name + - id + - mention_count + - observations + title: EntityDetailResponse + EntityIncludeOptions: + description: Options for including entity observations in recall results. + properties: + max_tokens: + default: 500 + description: Maximum tokens for entity observations + title: Max Tokens + type: integer + title: EntityIncludeOptions + EntityInput: + description: Entity to associate with retained content. + properties: + text: + description: The entity name/text + title: Text + type: string + type: + nullable: true + type: string + required: + - text + title: EntityInput + EntityListItem: + description: Entity list item with summary. + example: + canonical_name: John + first_seen: 2024-01-15T10:30:00Z + id: 123e4567-e89b-12d3-a456-426614174000 + last_seen: 2024-02-01T14:00:00Z + mention_count: 15 + properties: + id: + title: Id + type: string + canonical_name: + title: Canonical Name + type: string + mention_count: + title: Mention Count + type: integer + first_seen: + nullable: true + type: string + last_seen: + nullable: true + type: string + metadata: + additionalProperties: {} + nullable: true + required: + - canonical_name + - id + - mention_count + title: EntityListItem + EntityListResponse: + description: Response model for entity list endpoint. + example: + items: + - canonical_name: John + first_seen: 2024-01-15T10:30:00Z + id: 123e4567-e89b-12d3-a456-426614174000 + last_seen: 2024-02-01T14:00:00Z + mention_count: 15 + limit: 100 + offset: 0 + total: 150 + properties: + items: + items: + $ref: '#/components/schemas/EntityListItem' + type: array + total: + title: Total + type: integer + limit: + title: Limit + type: integer + offset: + title: Offset + type: integer + required: + - items + - limit + - offset + - total + title: EntityListResponse + EntityObservationResponse: + description: An observation about an entity. + properties: + text: + title: Text + type: string + mentioned_at: + nullable: true + type: string + required: + - text + title: EntityObservationResponse + EntityStateResponse: + description: Current mental model of an entity. + properties: + entity_id: + title: Entity Id + type: string + canonical_name: + title: Canonical Name + type: string + observations: + items: + $ref: '#/components/schemas/EntityObservationResponse' + type: array + required: + - canonical_name + - entity_id + - observations + title: EntityStateResponse + FactsIncludeOptions: + description: Options for including facts (based_on) in reflect results. + properties: {} + title: FactsIncludeOptions + type: object + FeaturesInfo: + description: Feature flags indicating which capabilities are enabled. + properties: + observations: + description: Whether observations (auto-consolidation) are enabled + title: Observations + type: boolean + mcp: + description: Whether MCP (Model Context Protocol) server is enabled + title: Mcp + type: boolean + worker: + description: Whether the background worker is enabled + title: Worker + type: boolean + bank_config_api: + description: Whether per-bank configuration API is enabled + title: Bank Config Api + type: boolean + required: + - bank_config_api + - mcp + - observations + - worker + title: FeaturesInfo + GraphDataResponse: + description: Response model for graph data endpoint. + example: + edges: + - from: "1" + to: "2" + type: semantic + weight: 0.8 + limit: 1000 + nodes: + - id: "1" + label: Alice works at Google + type: world + - id: "2" + label: Bob went hiking + type: world + table_rows: + - context: Work info + date: 2024-01-15 10:30 + entities: "Alice (PERSON), Google (ORGANIZATION)" + id: abc12345... + text: Alice works at Google + total_units: 2 + properties: + nodes: + items: + additionalProperties: {} + type: array + edges: + items: + additionalProperties: {} + type: array + table_rows: + items: + additionalProperties: {} + type: array + total_units: + title: Total Units + type: integer + limit: + title: Limit + type: integer + required: + - edges + - limit + - nodes + - table_rows + - total_units + title: GraphDataResponse + HTTPValidationError: + example: + detail: + - msg: msg + loc: + - ValidationError_loc_inner + - ValidationError_loc_inner + type: type + - msg: msg + loc: + - ValidationError_loc_inner + - ValidationError_loc_inner + type: type + properties: + detail: + items: + $ref: '#/components/schemas/ValidationError' + type: array + title: HTTPValidationError + IncludeOptions: + description: Options for including additional data in recall results. + properties: + entities: + $ref: '#/components/schemas/EntityIncludeOptions' + chunks: + $ref: '#/components/schemas/ChunkIncludeOptions' + title: IncludeOptions + ListDocumentsResponse: + description: Response model for list documents endpoint. + example: + items: + - bank_id: user123 + content_hash: abc123 + created_at: 2024-01-15T10:30:00Z + id: session_1 + memory_unit_count: 15 + tags: + - user_a + - session_123 + text_length: 5420 + updated_at: 2024-01-15T10:30:00Z + limit: 100 + offset: 0 + total: 50 + properties: + items: + items: + additionalProperties: {} + type: array + total: + title: Total + type: integer + limit: + title: Limit + type: integer + offset: + title: Offset + type: integer + required: + - items + - limit + - offset + - total + title: ListDocumentsResponse + ListMemoryUnitsResponse: + description: Response model for list memory units endpoint. + example: + items: + - context: Work conversation + date: 2024-01-15T10:30:00Z + entities: "Alice (PERSON), Google (ORGANIZATION)" + id: 550e8400-e29b-41d4-a716-446655440000 + text: Alice works at Google on the AI team + type: world + limit: 100 + offset: 0 + total: 150 + properties: + items: + items: + additionalProperties: {} + type: array + total: + title: Total + type: integer + limit: + title: Limit + type: integer + offset: + title: Offset + type: integer + required: + - items + - limit + - offset + - total + title: ListMemoryUnitsResponse + ListTagsResponse: + description: Response model for list tags endpoint. + example: + items: + - count: 42 + tag: user:alice + - count: 15 + tag: user:bob + - count: 8 + tag: session:abc123 + limit: 100 + offset: 0 + total: 25 + properties: + items: + items: + $ref: '#/components/schemas/TagItem' + type: array + total: + title: Total + type: integer + limit: + title: Limit + type: integer + offset: + title: Offset + type: integer + required: + - items + - limit + - offset + - total + title: ListTagsResponse + MemoryItem: + description: Single memory item for retain. + example: + content: Alice mentioned she's working on a new ML model + context: team meeting + document_id: meeting_notes_2024_01_15 + entities: + - text: Alice + - text: ML model + type: CONCEPT + metadata: + channel: engineering + source: slack + tags: + - user_a + - user_b + timestamp: 2024-01-15T10:30:00Z + properties: + content: + title: Content + type: string + timestamp: + format: date-time + nullable: true + type: string + context: + nullable: true + type: string + metadata: + additionalProperties: + type: string + nullable: true + document_id: + nullable: true + type: string + entities: + items: + $ref: '#/components/schemas/EntityInput' + nullable: true + type: array + tags: + items: + type: string + nullable: true + type: array + required: + - content + title: MemoryItem + MentalModelListResponse: + description: Response model for listing mental models. + example: + items: + - source_query: source_query + max_tokens: 0 + bank_id: bank_id + reflect_response: + key: "" + name: name + created_at: created_at + id: id + trigger: + refresh_after_consolidation: false + last_refreshed_at: last_refreshed_at + content: content + tags: + - tags + - tags + - source_query: source_query + max_tokens: 0 + bank_id: bank_id + reflect_response: + key: "" + name: name + created_at: created_at + id: id + trigger: + refresh_after_consolidation: false + last_refreshed_at: last_refreshed_at + content: content + tags: + - tags + - tags + properties: + items: + items: + $ref: '#/components/schemas/MentalModelResponse' + type: array + required: + - items + title: MentalModelListResponse + MentalModelResponse: + description: Response model for a mental model (stored reflect response). + example: + source_query: source_query + max_tokens: 0 + bank_id: bank_id + reflect_response: + key: "" + name: name + created_at: created_at + id: id + trigger: + refresh_after_consolidation: false + last_refreshed_at: last_refreshed_at + content: content + tags: + - tags + - tags + properties: + id: + title: Id + type: string + bank_id: + title: Bank Id + type: string + name: + title: Name + type: string + source_query: + title: Source Query + type: string + content: + description: The mental model content as well-formatted markdown (auto-generated + from reflect endpoint) + title: Content + type: string + tags: + default: [] + items: + type: string + type: array + max_tokens: + default: 2048 + title: Max Tokens + type: integer + trigger: + $ref: '#/components/schemas/MentalModelTrigger' + last_refreshed_at: + nullable: true + type: string + created_at: + nullable: true + type: string + reflect_response: + additionalProperties: {} + nullable: true + required: + - bank_id + - content + - id + - name + - source_query + title: MentalModelResponse + MentalModelTrigger: + description: Trigger settings for a mental model. + example: + refresh_after_consolidation: false + properties: + refresh_after_consolidation: + default: false + description: "If true, refresh this mental model after observations consolidation\ + \ (real-time mode)" + title: Refresh After Consolidation + type: boolean + title: MentalModelTrigger + OperationResponse: + description: Response model for a single async operation. + example: + created_at: 2024-01-15T10:30:00Z + id: 550e8400-e29b-41d4-a716-446655440000 + items_count: 5 + status: pending + task_type: retain + properties: + id: + title: Id + type: string + task_type: + title: Task Type + type: string + items_count: + title: Items Count + type: integer + document_id: + nullable: true + type: string + created_at: + title: Created At + type: string + status: + title: Status + type: string + error_message: + nullable: true + type: string + required: + - created_at + - error_message + - id + - items_count + - status + - task_type + title: OperationResponse + OperationStatusResponse: + description: Response model for getting a single operation status. + example: + completed_at: 2024-01-15T10:31:30Z + created_at: 2024-01-15T10:30:00Z + operation_id: 550e8400-e29b-41d4-a716-446655440000 + operation_type: refresh_mental_models + status: completed + updated_at: 2024-01-15T10:31:30Z + properties: + operation_id: + title: Operation Id + type: string + status: + enum: + - pending + - completed + - failed + - not_found + title: Status + type: string + operation_type: + nullable: true + type: string + created_at: + nullable: true + type: string + updated_at: + nullable: true + type: string + completed_at: + nullable: true + type: string + error_message: + nullable: true + type: string + result_metadata: + additionalProperties: {} + nullable: true + child_operations: + items: + $ref: '#/components/schemas/ChildOperationStatus' + nullable: true + type: array + required: + - operation_id + - status + title: OperationStatusResponse + OperationsListResponse: + description: Response model for list operations endpoint. + example: + bank_id: user123 + limit: 20 + offset: 0 + operations: + - created_at: 2024-01-15T10:30:00Z + id: 550e8400-e29b-41d4-a716-446655440000 + status: pending + task_type: retain + total: 150 + properties: + bank_id: + title: Bank Id + type: string + total: + title: Total + type: integer + limit: + title: Limit + type: integer + offset: + title: Offset + type: integer + operations: + items: + $ref: '#/components/schemas/OperationResponse' + type: array + required: + - bank_id + - limit + - offset + - operations + - total + title: OperationsListResponse + RecallRequest: + description: Request model for recall endpoint. + example: + budget: mid + include: + entities: + max_tokens: 500 + max_tokens: 4096 + query: What did Alice say about machine learning? + query_timestamp: 2023-05-30T23:40:00 + tags: + - user_a + tags_match: any + trace: true + types: + - world + - experience + properties: + query: + title: Query + type: string + types: + items: + type: string + nullable: true + type: array + budget: + $ref: '#/components/schemas/Budget' + max_tokens: + default: 4096 + title: Max Tokens + type: integer + trace: + default: false + title: Trace + type: boolean + query_timestamp: + nullable: true + type: string + include: + $ref: '#/components/schemas/IncludeOptions' + tags: + items: + type: string + nullable: true + type: array + tags_match: + default: any + description: "How to match tags: 'any' (OR, includes untagged), 'all' (AND,\ + \ includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict'\ + \ (AND, excludes untagged)." + enum: + - any + - all + - any_strict + - all_strict + title: Tags Match + type: string + required: + - query + title: RecallRequest + RecallResponse: + description: Response model for recall endpoints. + example: + chunks: + "456e7890-e12b-34d5-a678-901234567890": + chunk_index: 0 + id: 456e7890-e12b-34d5-a678-901234567890 + text: Alice works at Google on the AI team. She's been there for 3 years... + entities: + Alice: + canonical_name: Alice + entity_id: 123e4567-e89b-12d3-a456-426614174001 + observations: + - mentioned_at: 2024-01-15T10:30:00Z + text: Alice works at Google on the AI team + results: + - chunk_id: 456e7890-e12b-34d5-a678-901234567890 + context: work info + entities: + - Alice + - Google + id: 123e4567-e89b-12d3-a456-426614174000 + occurred_end: 2024-01-15T10:30:00Z + occurred_start: 2024-01-15T10:30:00Z + text: Alice works at Google on the AI team + type: world + trace: + num_results: 1 + query: What did Alice say about machine learning? + time_seconds: 0.123 + properties: + results: + items: + $ref: '#/components/schemas/RecallResult' + type: array + trace: + additionalProperties: {} + nullable: true + entities: + additionalProperties: + $ref: '#/components/schemas/EntityStateResponse' + nullable: true + chunks: + additionalProperties: + $ref: '#/components/schemas/ChunkData' + nullable: true + required: + - results + title: RecallResponse + RecallResult: + description: Single recall result item. + example: + chunk_id: 456e7890-e12b-34d5-a678-901234567890 + context: work info + document_id: session_abc123 + entities: + - Alice + - Google + id: 123e4567-e89b-12d3-a456-426614174000 + mentioned_at: 2024-01-15T10:30:00Z + metadata: + source: slack + occurred_end: 2024-01-15T10:30:00Z + occurred_start: 2024-01-15T10:30:00Z + tags: + - user_a + - user_b + text: Alice works at Google on the AI team + type: world + properties: + id: + title: Id + type: string + text: + title: Text + type: string + type: + nullable: true + type: string + entities: + items: + type: string + nullable: true + type: array + context: + nullable: true + type: string + occurred_start: + nullable: true + type: string + occurred_end: + nullable: true + type: string + mentioned_at: + nullable: true + type: string + document_id: + nullable: true + type: string + metadata: + additionalProperties: + type: string + nullable: true + chunk_id: + nullable: true + type: string + tags: + items: + type: string + nullable: true + type: array + required: + - id + - text + title: RecallResult + ReflectBasedOn: + description: "Evidence the response is based on: memories, mental models, and\ + \ directives." + properties: + memories: + default: [] + description: Memory facts used to generate the response + items: + $ref: '#/components/schemas/ReflectFact' + type: array + mental_models: + default: [] + description: Mental models used during reflection + items: + $ref: '#/components/schemas/ReflectMentalModel' + type: array + directives: + default: [] + description: Directives applied during reflection + items: + $ref: '#/components/schemas/ReflectDirective' + type: array + title: ReflectBasedOn + ReflectDirective: + description: A directive applied during reflect. + properties: + id: + description: Directive ID + title: Id + type: string + name: + description: Directive name + title: Name + type: string + content: + description: Directive content + title: Content + type: string + required: + - content + - id + - name + title: ReflectDirective + ReflectFact: + description: A fact used in think response. + example: + context: healthcare discussion + id: 123e4567-e89b-12d3-a456-426614174000 + occurred_end: 2024-01-15T10:30:00Z + occurred_start: 2024-01-15T10:30:00Z + text: AI is used in healthcare + type: world + properties: + id: + nullable: true + type: string + text: + description: "Fact text. When type='observation', this contains markdown-formatted\ + \ consolidated knowledge" + title: Text + type: string + type: + nullable: true + type: string + context: + nullable: true + type: string + occurred_start: + nullable: true + type: string + occurred_end: + nullable: true + type: string + required: + - text + title: ReflectFact + ReflectIncludeOptions: + description: Options for including additional data in reflect results. + properties: + facts: + description: Options for including facts (based_on) in reflect results. + properties: {} + title: FactsIncludeOptions + type: object + tool_calls: + $ref: '#/components/schemas/ToolCallsIncludeOptions' + title: ReflectIncludeOptions + ReflectLLMCall: + description: An LLM call made during reflect agent execution. + properties: + scope: + description: "Call scope: agent_1, agent_2, final, etc." + title: Scope + type: string + duration_ms: + description: Execution time in milliseconds + title: Duration Ms + type: integer + required: + - duration_ms + - scope + title: ReflectLLMCall + ReflectMentalModel: + description: A mental model used during reflect. + properties: + id: + description: Mental model ID + title: Id + type: string + text: + description: Mental model content + title: Text + type: string + context: + nullable: true + type: string + required: + - id + - text + title: ReflectMentalModel + ReflectRequest: + description: Request model for reflect endpoint. + example: + budget: low + include: + facts: {} + max_tokens: 4096 + query: What do you think about artificial intelligence? + response_schema: + properties: + summary: + type: string + key_points: + items: + type: string + type: array + required: + - summary + - key_points + type: object + tags: + - user_a + tags_match: any + properties: + query: + title: Query + type: string + budget: + $ref: '#/components/schemas/Budget' + context: + nullable: true + type: string + max_tokens: + default: 4096 + description: Maximum tokens for the response + title: Max Tokens + type: integer + include: + $ref: '#/components/schemas/ReflectIncludeOptions' + response_schema: + additionalProperties: {} + nullable: true + tags: + items: + type: string + nullable: true + type: array + tags_match: + default: any + description: "How to match tags: 'any' (OR, includes untagged), 'all' (AND,\ + \ includes untagged), 'any_strict' (OR, excludes untagged), 'all_strict'\ + \ (AND, excludes untagged)." + enum: + - any + - all + - any_strict + - all_strict + title: Tags Match + type: string + required: + - query + title: ReflectRequest + ReflectResponse: + description: Response model for think endpoint. + example: + based_on: + memories: + - id: "123" + text: AI is used in healthcare + type: world + - id: "456" + text: I discussed AI applications last week + type: experience + structured_output: + key_points: + - Used in healthcare + - Discussed recently + summary: AI is transformative + text: |- + ## AI Overview + + Based on my understanding, AI is a **transformative technology**: + + - Used extensively in healthcare + - Discussed in recent conversations + - Continues to evolve rapidly + trace: + llm_calls: + - duration_ms: 1200 + scope: agent_1 + observations: + - id: obs-1 + name: AI Technology + subtype: structural + type: concept + tool_calls: + - duration_ms: 150 + input: + query: AI + tool: recall + usage: + input_tokens: 1500 + output_tokens: 500 + total_tokens: 2000 + properties: + text: + description: "The reflect response as well-formatted markdown (headers,\ + \ lists, bold/italic, code blocks, etc.)" + title: Text + type: string + based_on: + $ref: '#/components/schemas/ReflectBasedOn' + structured_output: + additionalProperties: {} + nullable: true + usage: + $ref: '#/components/schemas/TokenUsage' + trace: + $ref: '#/components/schemas/ReflectTrace' + required: + - text + title: ReflectResponse + ReflectToolCall: + description: A tool call made during reflect agent execution. + properties: + tool: + description: "Tool name: lookup, recall, learn, expand" + title: Tool + type: string + input: + additionalProperties: {} + description: Tool input parameters + title: Input + output: + additionalProperties: {} + nullable: true + duration_ms: + description: Execution time in milliseconds + title: Duration Ms + type: integer + iteration: + default: 0 + description: Iteration number (1-based) when this tool was called + title: Iteration + type: integer + required: + - duration_ms + - input + - tool + title: ReflectToolCall + ReflectTrace: + description: Execution trace of LLM and tool calls during reflection. + properties: + tool_calls: + default: [] + description: Tool calls made during reflection + items: + $ref: '#/components/schemas/ReflectToolCall' + type: array + llm_calls: + default: [] + description: LLM calls made during reflection + items: + $ref: '#/components/schemas/ReflectLLMCall' + type: array + title: ReflectTrace + RetainRequest: + description: Request model for retain endpoint. + example: + async: false + document_tags: + - user_a + - user_b + items: + - content: Alice works at Google + context: work + document_id: conversation_123 + - content: Bob went hiking yesterday + document_id: conversation_123 + timestamp: 2024-01-15T10:00:00Z + properties: + items: + items: + $ref: '#/components/schemas/MemoryItem' + type: array + async: + default: false + description: "If true, process asynchronously in background. If false, wait\ + \ for completion (default: false)" + title: Async + type: boolean + document_tags: + items: + type: string + nullable: true + type: array + required: + - items + title: RetainRequest + RetainResponse: + description: Response model for retain endpoint. + example: + async: false + bank_id: user123 + items_count: 2 + success: true + usage: + input_tokens: 500 + output_tokens: 100 + total_tokens: 600 + properties: + success: + title: Success + type: boolean + bank_id: + title: Bank Id + type: string + items_count: + title: Items Count + type: integer + async: + description: Whether the operation was processed asynchronously + title: Async + type: boolean + operation_id: + nullable: true + type: string + usage: + $ref: '#/components/schemas/TokenUsage' + required: + - async + - bank_id + - items_count + - success + title: RetainResponse + TagItem: + description: Single tag with usage count. + properties: + tag: + description: The tag value + title: Tag + type: string + count: + description: Number of memories with this tag + title: Count + type: integer + required: + - count + - tag + title: TagItem + TokenUsage: + description: |- + Token usage metrics for LLM calls. + + Tracks input/output tokens for a single request to enable + per-request cost tracking and monitoring. + example: + input_tokens: 1500 + output_tokens: 500 + total_tokens: 2000 + properties: + input_tokens: + default: 0 + description: Number of input/prompt tokens consumed + title: Input Tokens + type: integer + output_tokens: + default: 0 + description: Number of output/completion tokens generated + title: Output Tokens + type: integer + total_tokens: + default: 0 + description: Total tokens (input + output) + title: Total Tokens + type: integer + title: TokenUsage + ToolCallsIncludeOptions: + description: Options for including tool calls in reflect results. + properties: + output: + default: true + description: Include tool outputs in the trace. Set to false to only include + inputs (smaller payload). + title: Output + type: boolean + title: ToolCallsIncludeOptions + UpdateDirectiveRequest: + description: Request model for updating a directive. + example: + is_active: true + name: name + priority: 0 + content: content + tags: + - tags + - tags + properties: + name: + nullable: true + type: string + content: + nullable: true + type: string + priority: + nullable: true + type: integer + is_active: + nullable: true + type: boolean + tags: + items: + type: string + nullable: true + type: array + title: UpdateDirectiveRequest + UpdateDispositionRequest: + description: Request model for updating disposition traits. + example: + disposition: + empathy: 3 + literalism: 3 + skepticism: 3 + properties: + disposition: + $ref: '#/components/schemas/DispositionTraits' + required: + - disposition + title: UpdateDispositionRequest + UpdateMentalModelRequest: + description: Request model for updating a mental model. + example: + max_tokens: 4096 + name: Updated Team Communication Preferences + source_query: How does the team prefer to communicate? + tags: + - team + - communication + trigger: + refresh_after_consolidation: true + properties: + name: + nullable: true + type: string + source_query: + nullable: true + type: string + max_tokens: + maximum: 8192.0 + minimum: 256.0 + nullable: true + type: integer + tags: + items: + type: string + nullable: true + type: array + trigger: + $ref: '#/components/schemas/MentalModelTrigger' + title: UpdateMentalModelRequest + ValidationError: + example: + msg: msg + loc: + - ValidationError_loc_inner + - ValidationError_loc_inner + type: type + properties: + loc: + items: + $ref: '#/components/schemas/ValidationError_loc_inner' + type: array + msg: + title: Message + type: string + type: + title: Error Type + type: string + required: + - loc + - msg + - type + title: ValidationError + VersionResponse: + description: Response model for the version/info endpoint. + example: + api_version: 0.4.0 + features: + bank_config_api: false + mcp: true + observations: false + worker: true + properties: + api_version: + description: API version string + title: Api Version + type: string + features: + $ref: '#/components/schemas/FeaturesInfo' + required: + - api_version + - features + title: VersionResponse + ValidationError_loc_inner: + anyOf: + - type: string + - type: integer diff --git a/hindsight-clients/go/api_banks.go b/hindsight-clients/go/api_banks.go new file mode 100644 index 00000000..de59b622 --- /dev/null +++ b/hindsight-clients/go/api_banks.go @@ -0,0 +1,1664 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +// BanksAPIService BanksAPI service +type BanksAPIService service + +type ApiAddBankBackgroundRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + addBackgroundRequest *AddBackgroundRequest + authorization *string +} + +func (r ApiAddBankBackgroundRequest) AddBackgroundRequest(addBackgroundRequest AddBackgroundRequest) ApiAddBankBackgroundRequest { + r.addBackgroundRequest = &addBackgroundRequest + return r +} + +func (r ApiAddBankBackgroundRequest) Authorization(authorization string) ApiAddBankBackgroundRequest { + r.authorization = &authorization + return r +} + +func (r ApiAddBankBackgroundRequest) Execute() (*BackgroundResponse, *http.Response, error) { + return r.ApiService.AddBankBackgroundExecute(r) +} + +/* +AddBankBackground Add/merge memory bank background (deprecated) + +Deprecated: Use PUT /mission instead. This endpoint now updates the mission field. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiAddBankBackgroundRequest + +Deprecated +*/ +func (a *BanksAPIService) AddBankBackground(ctx context.Context, bankId string) ApiAddBankBackgroundRequest { + return ApiAddBankBackgroundRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BackgroundResponse +// Deprecated +func (a *BanksAPIService) AddBankBackgroundExecute(r ApiAddBankBackgroundRequest) (*BackgroundResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BackgroundResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.AddBankBackground") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/background" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.addBackgroundRequest == nil { + return localVarReturnValue, nil, reportError("addBackgroundRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.addBackgroundRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiClearObservationsRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + authorization *string +} + +func (r ApiClearObservationsRequest) Authorization(authorization string) ApiClearObservationsRequest { + r.authorization = &authorization + return r +} + +func (r ApiClearObservationsRequest) Execute() (*DeleteResponse, *http.Response, error) { + return r.ApiService.ClearObservationsExecute(r) +} + +/* +ClearObservations Clear all observations + +Delete all observations for a memory bank. This is useful for resetting the consolidated knowledge. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiClearObservationsRequest +*/ +func (a *BanksAPIService) ClearObservations(ctx context.Context, bankId string) ApiClearObservationsRequest { + return ApiClearObservationsRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return DeleteResponse +func (a *BanksAPIService) ClearObservationsExecute(r ApiClearObservationsRequest) (*DeleteResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.ClearObservations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/observations" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateOrUpdateBankRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + createBankRequest *CreateBankRequest + authorization *string +} + +func (r ApiCreateOrUpdateBankRequest) CreateBankRequest(createBankRequest CreateBankRequest) ApiCreateOrUpdateBankRequest { + r.createBankRequest = &createBankRequest + return r +} + +func (r ApiCreateOrUpdateBankRequest) Authorization(authorization string) ApiCreateOrUpdateBankRequest { + r.authorization = &authorization + return r +} + +func (r ApiCreateOrUpdateBankRequest) Execute() (*BankProfileResponse, *http.Response, error) { + return r.ApiService.CreateOrUpdateBankExecute(r) +} + +/* +CreateOrUpdateBank Create or update memory bank + +Create a new agent or update existing agent with disposition and mission. Auto-fills missing fields with defaults. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiCreateOrUpdateBankRequest +*/ +func (a *BanksAPIService) CreateOrUpdateBank(ctx context.Context, bankId string) ApiCreateOrUpdateBankRequest { + return ApiCreateOrUpdateBankRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankProfileResponse +func (a *BanksAPIService) CreateOrUpdateBankExecute(r ApiCreateOrUpdateBankRequest) (*BankProfileResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankProfileResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.CreateOrUpdateBank") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createBankRequest == nil { + return localVarReturnValue, nil, reportError("createBankRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.createBankRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteBankRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + authorization *string +} + +func (r ApiDeleteBankRequest) Authorization(authorization string) ApiDeleteBankRequest { + r.authorization = &authorization + return r +} + +func (r ApiDeleteBankRequest) Execute() (*DeleteResponse, *http.Response, error) { + return r.ApiService.DeleteBankExecute(r) +} + +/* +DeleteBank Delete memory bank + +Delete an entire memory bank including all memories, entities, documents, and the bank profile itself. This is a destructive operation that cannot be undone. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiDeleteBankRequest +*/ +func (a *BanksAPIService) DeleteBank(ctx context.Context, bankId string) ApiDeleteBankRequest { + return ApiDeleteBankRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return DeleteResponse +func (a *BanksAPIService) DeleteBankExecute(r ApiDeleteBankRequest) (*DeleteResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.DeleteBank") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetAgentStatsRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + authorization *string +} + +func (r ApiGetAgentStatsRequest) Authorization(authorization string) ApiGetAgentStatsRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetAgentStatsRequest) Execute() (*BankStatsResponse, *http.Response, error) { + return r.ApiService.GetAgentStatsExecute(r) +} + +/* +GetAgentStats Get statistics for memory bank + +Get statistics about nodes and links for a specific agent + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiGetAgentStatsRequest +*/ +func (a *BanksAPIService) GetAgentStats(ctx context.Context, bankId string) ApiGetAgentStatsRequest { + return ApiGetAgentStatsRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankStatsResponse +func (a *BanksAPIService) GetAgentStatsExecute(r ApiGetAgentStatsRequest) (*BankStatsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankStatsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.GetAgentStats") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/stats" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetBankConfigRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + authorization *string +} + +func (r ApiGetBankConfigRequest) Authorization(authorization string) ApiGetBankConfigRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetBankConfigRequest) Execute() (*BankConfigResponse, *http.Response, error) { + return r.ApiService.GetBankConfigExecute(r) +} + +/* +GetBankConfig Get bank configuration + +Get fully resolved configuration for a bank including all hierarchical overrides (global → tenant → bank). The 'config' field contains all resolved config values. The 'overrides' field shows only bank-specific overrides. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiGetBankConfigRequest +*/ +func (a *BanksAPIService) GetBankConfig(ctx context.Context, bankId string) ApiGetBankConfigRequest { + return ApiGetBankConfigRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankConfigResponse +func (a *BanksAPIService) GetBankConfigExecute(r ApiGetBankConfigRequest) (*BankConfigResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankConfigResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.GetBankConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/config" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetBankProfileRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + authorization *string +} + +func (r ApiGetBankProfileRequest) Authorization(authorization string) ApiGetBankProfileRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetBankProfileRequest) Execute() (*BankProfileResponse, *http.Response, error) { + return r.ApiService.GetBankProfileExecute(r) +} + +/* +GetBankProfile Get memory bank profile + +Get disposition traits and mission for a memory bank. Auto-creates agent with defaults if not exists. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiGetBankProfileRequest +*/ +func (a *BanksAPIService) GetBankProfile(ctx context.Context, bankId string) ApiGetBankProfileRequest { + return ApiGetBankProfileRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankProfileResponse +func (a *BanksAPIService) GetBankProfileExecute(r ApiGetBankProfileRequest) (*BankProfileResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankProfileResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.GetBankProfile") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/profile" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListBanksRequest struct { + ctx context.Context + ApiService *BanksAPIService + authorization *string +} + +func (r ApiListBanksRequest) Authorization(authorization string) ApiListBanksRequest { + r.authorization = &authorization + return r +} + +func (r ApiListBanksRequest) Execute() (*BankListResponse, *http.Response, error) { + return r.ApiService.ListBanksExecute(r) +} + +/* +ListBanks List all memory banks + +Get a list of all agents with their profiles + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListBanksRequest +*/ +func (a *BanksAPIService) ListBanks(ctx context.Context) ApiListBanksRequest { + return ApiListBanksRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return BankListResponse +func (a *BanksAPIService) ListBanksExecute(r ApiListBanksRequest) (*BankListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.ListBanks") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiResetBankConfigRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + authorization *string +} + +func (r ApiResetBankConfigRequest) Authorization(authorization string) ApiResetBankConfigRequest { + r.authorization = &authorization + return r +} + +func (r ApiResetBankConfigRequest) Execute() (*BankConfigResponse, *http.Response, error) { + return r.ApiService.ResetBankConfigExecute(r) +} + +/* +ResetBankConfig Reset bank configuration + +Reset bank configuration to defaults by removing all bank-specific overrides. The bank will then use global and tenant-level configuration only. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiResetBankConfigRequest +*/ +func (a *BanksAPIService) ResetBankConfig(ctx context.Context, bankId string) ApiResetBankConfigRequest { + return ApiResetBankConfigRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankConfigResponse +func (a *BanksAPIService) ResetBankConfigExecute(r ApiResetBankConfigRequest) (*BankConfigResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankConfigResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.ResetBankConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/config" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiTriggerConsolidationRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + authorization *string +} + +func (r ApiTriggerConsolidationRequest) Authorization(authorization string) ApiTriggerConsolidationRequest { + r.authorization = &authorization + return r +} + +func (r ApiTriggerConsolidationRequest) Execute() (*ConsolidationResponse, *http.Response, error) { + return r.ApiService.TriggerConsolidationExecute(r) +} + +/* +TriggerConsolidation Trigger consolidation + +Run memory consolidation to create/update observations from recent memories. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiTriggerConsolidationRequest +*/ +func (a *BanksAPIService) TriggerConsolidation(ctx context.Context, bankId string) ApiTriggerConsolidationRequest { + return ApiTriggerConsolidationRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return ConsolidationResponse +func (a *BanksAPIService) TriggerConsolidationExecute(r ApiTriggerConsolidationRequest) (*ConsolidationResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ConsolidationResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.TriggerConsolidation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/consolidate" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateBankRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + createBankRequest *CreateBankRequest + authorization *string +} + +func (r ApiUpdateBankRequest) CreateBankRequest(createBankRequest CreateBankRequest) ApiUpdateBankRequest { + r.createBankRequest = &createBankRequest + return r +} + +func (r ApiUpdateBankRequest) Authorization(authorization string) ApiUpdateBankRequest { + r.authorization = &authorization + return r +} + +func (r ApiUpdateBankRequest) Execute() (*BankProfileResponse, *http.Response, error) { + return r.ApiService.UpdateBankExecute(r) +} + +/* +UpdateBank Partial update memory bank + +Partially update an agent's profile. Only provided fields will be updated. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiUpdateBankRequest +*/ +func (a *BanksAPIService) UpdateBank(ctx context.Context, bankId string) ApiUpdateBankRequest { + return ApiUpdateBankRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankProfileResponse +func (a *BanksAPIService) UpdateBankExecute(r ApiUpdateBankRequest) (*BankProfileResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankProfileResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.UpdateBank") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createBankRequest == nil { + return localVarReturnValue, nil, reportError("createBankRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.createBankRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateBankConfigRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + bankConfigUpdate *BankConfigUpdate + authorization *string +} + +func (r ApiUpdateBankConfigRequest) BankConfigUpdate(bankConfigUpdate BankConfigUpdate) ApiUpdateBankConfigRequest { + r.bankConfigUpdate = &bankConfigUpdate + return r +} + +func (r ApiUpdateBankConfigRequest) Authorization(authorization string) ApiUpdateBankConfigRequest { + r.authorization = &authorization + return r +} + +func (r ApiUpdateBankConfigRequest) Execute() (*BankConfigResponse, *http.Response, error) { + return r.ApiService.UpdateBankConfigExecute(r) +} + +/* +UpdateBankConfig Update bank configuration + +Update configuration overrides for a bank. Only hierarchical fields can be overridden (LLM settings, retention parameters, etc.). Keys can be provided in Python field format (llm_provider) or environment variable format (HINDSIGHT_API_LLM_PROVIDER). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiUpdateBankConfigRequest +*/ +func (a *BanksAPIService) UpdateBankConfig(ctx context.Context, bankId string) ApiUpdateBankConfigRequest { + return ApiUpdateBankConfigRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankConfigResponse +func (a *BanksAPIService) UpdateBankConfigExecute(r ApiUpdateBankConfigRequest) (*BankConfigResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankConfigResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.UpdateBankConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/config" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.bankConfigUpdate == nil { + return localVarReturnValue, nil, reportError("bankConfigUpdate is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.bankConfigUpdate + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateBankDispositionRequest struct { + ctx context.Context + ApiService *BanksAPIService + bankId string + updateDispositionRequest *UpdateDispositionRequest + authorization *string +} + +func (r ApiUpdateBankDispositionRequest) UpdateDispositionRequest(updateDispositionRequest UpdateDispositionRequest) ApiUpdateBankDispositionRequest { + r.updateDispositionRequest = &updateDispositionRequest + return r +} + +func (r ApiUpdateBankDispositionRequest) Authorization(authorization string) ApiUpdateBankDispositionRequest { + r.authorization = &authorization + return r +} + +func (r ApiUpdateBankDispositionRequest) Execute() (*BankProfileResponse, *http.Response, error) { + return r.ApiService.UpdateBankDispositionExecute(r) +} + +/* +UpdateBankDisposition Update memory bank disposition + +Update bank's disposition traits (skepticism, literalism, empathy) + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiUpdateBankDispositionRequest +*/ +func (a *BanksAPIService) UpdateBankDisposition(ctx context.Context, bankId string) ApiUpdateBankDispositionRequest { + return ApiUpdateBankDispositionRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return BankProfileResponse +func (a *BanksAPIService) UpdateBankDispositionExecute(r ApiUpdateBankDispositionRequest) (*BankProfileResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *BankProfileResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BanksAPIService.UpdateBankDisposition") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/profile" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateDispositionRequest == nil { + return localVarReturnValue, nil, reportError("updateDispositionRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.updateDispositionRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/api_directives.go b/hindsight-clients/go/api_directives.go new file mode 100644 index 00000000..602ec0f6 --- /dev/null +++ b/hindsight-clients/go/api_directives.go @@ -0,0 +1,737 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + "reflect" +) + + +// DirectivesAPIService DirectivesAPI service +type DirectivesAPIService service + +type ApiCreateDirectiveRequest struct { + ctx context.Context + ApiService *DirectivesAPIService + bankId string + createDirectiveRequest *CreateDirectiveRequest + authorization *string +} + +func (r ApiCreateDirectiveRequest) CreateDirectiveRequest(createDirectiveRequest CreateDirectiveRequest) ApiCreateDirectiveRequest { + r.createDirectiveRequest = &createDirectiveRequest + return r +} + +func (r ApiCreateDirectiveRequest) Authorization(authorization string) ApiCreateDirectiveRequest { + r.authorization = &authorization + return r +} + +func (r ApiCreateDirectiveRequest) Execute() (*DirectiveResponse, *http.Response, error) { + return r.ApiService.CreateDirectiveExecute(r) +} + +/* +CreateDirective Create directive + +Create a hard rule that will be injected into prompts. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiCreateDirectiveRequest +*/ +func (a *DirectivesAPIService) CreateDirective(ctx context.Context, bankId string) ApiCreateDirectiveRequest { + return ApiCreateDirectiveRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return DirectiveResponse +func (a *DirectivesAPIService) CreateDirectiveExecute(r ApiCreateDirectiveRequest) (*DirectiveResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DirectiveResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DirectivesAPIService.CreateDirective") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/directives" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDirectiveRequest == nil { + return localVarReturnValue, nil, reportError("createDirectiveRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.createDirectiveRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteDirectiveRequest struct { + ctx context.Context + ApiService *DirectivesAPIService + bankId string + directiveId string + authorization *string +} + +func (r ApiDeleteDirectiveRequest) Authorization(authorization string) ApiDeleteDirectiveRequest { + r.authorization = &authorization + return r +} + +func (r ApiDeleteDirectiveRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.DeleteDirectiveExecute(r) +} + +/* +DeleteDirective Delete directive + +Delete a directive. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param directiveId + @return ApiDeleteDirectiveRequest +*/ +func (a *DirectivesAPIService) DeleteDirective(ctx context.Context, bankId string, directiveId string) ApiDeleteDirectiveRequest { + return ApiDeleteDirectiveRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + directiveId: directiveId, + } +} + +// Execute executes the request +// @return interface{} +func (a *DirectivesAPIService) DeleteDirectiveExecute(r ApiDeleteDirectiveRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DirectivesAPIService.DeleteDirective") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/directives/{directive_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"directive_id"+"}", url.PathEscape(parameterValueToString(r.directiveId, "directiveId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetDirectiveRequest struct { + ctx context.Context + ApiService *DirectivesAPIService + bankId string + directiveId string + authorization *string +} + +func (r ApiGetDirectiveRequest) Authorization(authorization string) ApiGetDirectiveRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetDirectiveRequest) Execute() (*DirectiveResponse, *http.Response, error) { + return r.ApiService.GetDirectiveExecute(r) +} + +/* +GetDirective Get directive + +Get a specific directive by ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param directiveId + @return ApiGetDirectiveRequest +*/ +func (a *DirectivesAPIService) GetDirective(ctx context.Context, bankId string, directiveId string) ApiGetDirectiveRequest { + return ApiGetDirectiveRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + directiveId: directiveId, + } +} + +// Execute executes the request +// @return DirectiveResponse +func (a *DirectivesAPIService) GetDirectiveExecute(r ApiGetDirectiveRequest) (*DirectiveResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DirectiveResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DirectivesAPIService.GetDirective") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/directives/{directive_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"directive_id"+"}", url.PathEscape(parameterValueToString(r.directiveId, "directiveId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListDirectivesRequest struct { + ctx context.Context + ApiService *DirectivesAPIService + bankId string + tags *[]string + tagsMatch *string + activeOnly *bool + limit *int32 + offset *int32 + authorization *string +} + +// Filter by tags +func (r ApiListDirectivesRequest) Tags(tags []string) ApiListDirectivesRequest { + r.tags = &tags + return r +} + +// How to match tags +func (r ApiListDirectivesRequest) TagsMatch(tagsMatch string) ApiListDirectivesRequest { + r.tagsMatch = &tagsMatch + return r +} + +// Only return active directives +func (r ApiListDirectivesRequest) ActiveOnly(activeOnly bool) ApiListDirectivesRequest { + r.activeOnly = &activeOnly + return r +} + +func (r ApiListDirectivesRequest) Limit(limit int32) ApiListDirectivesRequest { + r.limit = &limit + return r +} + +func (r ApiListDirectivesRequest) Offset(offset int32) ApiListDirectivesRequest { + r.offset = &offset + return r +} + +func (r ApiListDirectivesRequest) Authorization(authorization string) ApiListDirectivesRequest { + r.authorization = &authorization + return r +} + +func (r ApiListDirectivesRequest) Execute() (*DirectiveListResponse, *http.Response, error) { + return r.ApiService.ListDirectivesExecute(r) +} + +/* +ListDirectives List directives + +List hard rules that are injected into prompts. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiListDirectivesRequest +*/ +func (a *DirectivesAPIService) ListDirectives(ctx context.Context, bankId string) ApiListDirectivesRequest { + return ApiListDirectivesRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return DirectiveListResponse +func (a *DirectivesAPIService) ListDirectivesExecute(r ApiListDirectivesRequest) (*DirectiveListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DirectiveListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DirectivesAPIService.ListDirectives") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/directives" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.tags != nil { + t := *r.tags + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + parameterAddToHeaderOrQuery(localVarQueryParams, "tags", s.Index(i).Interface(), "form", "multi") + } + } else { + parameterAddToHeaderOrQuery(localVarQueryParams, "tags", t, "form", "multi") + } + } + if r.tagsMatch != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "tags_match", r.tagsMatch, "form", "") + } else { + var defaultValue string = "any" + r.tagsMatch = &defaultValue + } + if r.activeOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "active_only", r.activeOnly, "form", "") + } else { + var defaultValue bool = true + r.activeOnly = &defaultValue + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 100 + r.limit = &defaultValue + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } else { + var defaultValue int32 = 0 + r.offset = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateDirectiveRequest struct { + ctx context.Context + ApiService *DirectivesAPIService + bankId string + directiveId string + updateDirectiveRequest *UpdateDirectiveRequest + authorization *string +} + +func (r ApiUpdateDirectiveRequest) UpdateDirectiveRequest(updateDirectiveRequest UpdateDirectiveRequest) ApiUpdateDirectiveRequest { + r.updateDirectiveRequest = &updateDirectiveRequest + return r +} + +func (r ApiUpdateDirectiveRequest) Authorization(authorization string) ApiUpdateDirectiveRequest { + r.authorization = &authorization + return r +} + +func (r ApiUpdateDirectiveRequest) Execute() (*DirectiveResponse, *http.Response, error) { + return r.ApiService.UpdateDirectiveExecute(r) +} + +/* +UpdateDirective Update directive + +Update a directive's properties. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param directiveId + @return ApiUpdateDirectiveRequest +*/ +func (a *DirectivesAPIService) UpdateDirective(ctx context.Context, bankId string, directiveId string) ApiUpdateDirectiveRequest { + return ApiUpdateDirectiveRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + directiveId: directiveId, + } +} + +// Execute executes the request +// @return DirectiveResponse +func (a *DirectivesAPIService) UpdateDirectiveExecute(r ApiUpdateDirectiveRequest) (*DirectiveResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DirectiveResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DirectivesAPIService.UpdateDirective") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/directives/{directive_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"directive_id"+"}", url.PathEscape(parameterValueToString(r.directiveId, "directiveId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateDirectiveRequest == nil { + return localVarReturnValue, nil, reportError("updateDirectiveRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.updateDirectiveRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/api_documents.go b/hindsight-clients/go/api_documents.go new file mode 100644 index 00000000..077d7143 --- /dev/null +++ b/hindsight-clients/go/api_documents.go @@ -0,0 +1,560 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +// DocumentsAPIService DocumentsAPI service +type DocumentsAPIService service + +type ApiDeleteDocumentRequest struct { + ctx context.Context + ApiService *DocumentsAPIService + bankId string + documentId string + authorization *string +} + +func (r ApiDeleteDocumentRequest) Authorization(authorization string) ApiDeleteDocumentRequest { + r.authorization = &authorization + return r +} + +func (r ApiDeleteDocumentRequest) Execute() (*DeleteDocumentResponse, *http.Response, error) { + return r.ApiService.DeleteDocumentExecute(r) +} + +/* +DeleteDocument Delete a document + +Delete a document and all its associated memory units and links. + +This will cascade delete: +- The document itself +- All memory units extracted from this document +- All links (temporal, semantic, entity) associated with those memory units + +This operation cannot be undone. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param documentId + @return ApiDeleteDocumentRequest +*/ +func (a *DocumentsAPIService) DeleteDocument(ctx context.Context, bankId string, documentId string) ApiDeleteDocumentRequest { + return ApiDeleteDocumentRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + documentId: documentId, + } +} + +// Execute executes the request +// @return DeleteDocumentResponse +func (a *DocumentsAPIService) DeleteDocumentExecute(r ApiDeleteDocumentRequest) (*DeleteDocumentResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteDocumentResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DocumentsAPIService.DeleteDocument") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/documents/{document_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"document_id"+"}", url.PathEscape(parameterValueToString(r.documentId, "documentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetChunkRequest struct { + ctx context.Context + ApiService *DocumentsAPIService + chunkId string + authorization *string +} + +func (r ApiGetChunkRequest) Authorization(authorization string) ApiGetChunkRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetChunkRequest) Execute() (*ChunkResponse, *http.Response, error) { + return r.ApiService.GetChunkExecute(r) +} + +/* +GetChunk Get chunk details + +Get a specific chunk by its ID + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param chunkId + @return ApiGetChunkRequest +*/ +func (a *DocumentsAPIService) GetChunk(ctx context.Context, chunkId string) ApiGetChunkRequest { + return ApiGetChunkRequest{ + ApiService: a, + ctx: ctx, + chunkId: chunkId, + } +} + +// Execute executes the request +// @return ChunkResponse +func (a *DocumentsAPIService) GetChunkExecute(r ApiGetChunkRequest) (*ChunkResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ChunkResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DocumentsAPIService.GetChunk") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/chunks/{chunk_id}" + localVarPath = strings.Replace(localVarPath, "{"+"chunk_id"+"}", url.PathEscape(parameterValueToString(r.chunkId, "chunkId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetDocumentRequest struct { + ctx context.Context + ApiService *DocumentsAPIService + bankId string + documentId string + authorization *string +} + +func (r ApiGetDocumentRequest) Authorization(authorization string) ApiGetDocumentRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetDocumentRequest) Execute() (*DocumentResponse, *http.Response, error) { + return r.ApiService.GetDocumentExecute(r) +} + +/* +GetDocument Get document details + +Get a specific document including its original text + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param documentId + @return ApiGetDocumentRequest +*/ +func (a *DocumentsAPIService) GetDocument(ctx context.Context, bankId string, documentId string) ApiGetDocumentRequest { + return ApiGetDocumentRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + documentId: documentId, + } +} + +// Execute executes the request +// @return DocumentResponse +func (a *DocumentsAPIService) GetDocumentExecute(r ApiGetDocumentRequest) (*DocumentResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DocumentResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DocumentsAPIService.GetDocument") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/documents/{document_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"document_id"+"}", url.PathEscape(parameterValueToString(r.documentId, "documentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListDocumentsRequest struct { + ctx context.Context + ApiService *DocumentsAPIService + bankId string + q *string + limit *int32 + offset *int32 + authorization *string +} + +func (r ApiListDocumentsRequest) Q(q string) ApiListDocumentsRequest { + r.q = &q + return r +} + +func (r ApiListDocumentsRequest) Limit(limit int32) ApiListDocumentsRequest { + r.limit = &limit + return r +} + +func (r ApiListDocumentsRequest) Offset(offset int32) ApiListDocumentsRequest { + r.offset = &offset + return r +} + +func (r ApiListDocumentsRequest) Authorization(authorization string) ApiListDocumentsRequest { + r.authorization = &authorization + return r +} + +func (r ApiListDocumentsRequest) Execute() (*ListDocumentsResponse, *http.Response, error) { + return r.ApiService.ListDocumentsExecute(r) +} + +/* +ListDocuments List documents + +List documents with pagination and optional search. Documents are the source content from which memory units are extracted. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiListDocumentsRequest +*/ +func (a *DocumentsAPIService) ListDocuments(ctx context.Context, bankId string) ApiListDocumentsRequest { + return ApiListDocumentsRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return ListDocumentsResponse +func (a *DocumentsAPIService) ListDocumentsExecute(r ApiListDocumentsRequest) (*ListDocumentsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDocumentsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DocumentsAPIService.ListDocuments") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/documents" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.q != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "q", r.q, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 100 + r.limit = &defaultValue + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } else { + var defaultValue int32 = 0 + r.offset = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/api_entities.go b/hindsight-clients/go/api_entities.go new file mode 100644 index 00000000..16145559 --- /dev/null +++ b/hindsight-clients/go/api_entities.go @@ -0,0 +1,427 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +// EntitiesAPIService EntitiesAPI service +type EntitiesAPIService service + +type ApiGetEntityRequest struct { + ctx context.Context + ApiService *EntitiesAPIService + bankId string + entityId string + authorization *string +} + +func (r ApiGetEntityRequest) Authorization(authorization string) ApiGetEntityRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetEntityRequest) Execute() (*EntityDetailResponse, *http.Response, error) { + return r.ApiService.GetEntityExecute(r) +} + +/* +GetEntity Get entity details + +Get detailed information about an entity including observations (mental model). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param entityId + @return ApiGetEntityRequest +*/ +func (a *EntitiesAPIService) GetEntity(ctx context.Context, bankId string, entityId string) ApiGetEntityRequest { + return ApiGetEntityRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + entityId: entityId, + } +} + +// Execute executes the request +// @return EntityDetailResponse +func (a *EntitiesAPIService) GetEntityExecute(r ApiGetEntityRequest) (*EntityDetailResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EntityDetailResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EntitiesAPIService.GetEntity") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/entities/{entity_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"entity_id"+"}", url.PathEscape(parameterValueToString(r.entityId, "entityId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListEntitiesRequest struct { + ctx context.Context + ApiService *EntitiesAPIService + bankId string + limit *int32 + offset *int32 + authorization *string +} + +// Maximum number of entities to return +func (r ApiListEntitiesRequest) Limit(limit int32) ApiListEntitiesRequest { + r.limit = &limit + return r +} + +// Offset for pagination +func (r ApiListEntitiesRequest) Offset(offset int32) ApiListEntitiesRequest { + r.offset = &offset + return r +} + +func (r ApiListEntitiesRequest) Authorization(authorization string) ApiListEntitiesRequest { + r.authorization = &authorization + return r +} + +func (r ApiListEntitiesRequest) Execute() (*EntityListResponse, *http.Response, error) { + return r.ApiService.ListEntitiesExecute(r) +} + +/* +ListEntities List entities + +List all entities (people, organizations, etc.) known by the bank, ordered by mention count. Supports pagination. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiListEntitiesRequest +*/ +func (a *EntitiesAPIService) ListEntities(ctx context.Context, bankId string) ApiListEntitiesRequest { + return ApiListEntitiesRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return EntityListResponse +func (a *EntitiesAPIService) ListEntitiesExecute(r ApiListEntitiesRequest) (*EntityListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EntityListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EntitiesAPIService.ListEntities") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/entities" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 100 + r.limit = &defaultValue + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } else { + var defaultValue int32 = 0 + r.offset = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiRegenerateEntityObservationsRequest struct { + ctx context.Context + ApiService *EntitiesAPIService + bankId string + entityId string + authorization *string +} + +func (r ApiRegenerateEntityObservationsRequest) Authorization(authorization string) ApiRegenerateEntityObservationsRequest { + r.authorization = &authorization + return r +} + +func (r ApiRegenerateEntityObservationsRequest) Execute() (*EntityDetailResponse, *http.Response, error) { + return r.ApiService.RegenerateEntityObservationsExecute(r) +} + +/* +RegenerateEntityObservations Regenerate entity observations (deprecated) + +This endpoint is deprecated. Entity observations have been replaced by mental models. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param entityId + @return ApiRegenerateEntityObservationsRequest + +Deprecated +*/ +func (a *EntitiesAPIService) RegenerateEntityObservations(ctx context.Context, bankId string, entityId string) ApiRegenerateEntityObservationsRequest { + return ApiRegenerateEntityObservationsRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + entityId: entityId, + } +} + +// Execute executes the request +// @return EntityDetailResponse +// Deprecated +func (a *EntitiesAPIService) RegenerateEntityObservationsExecute(r ApiRegenerateEntityObservationsRequest) (*EntityDetailResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *EntityDetailResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "EntitiesAPIService.RegenerateEntityObservations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/entities/{entity_id}/regenerate" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"entity_id"+"}", url.PathEscape(parameterValueToString(r.entityId, "entityId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/api_memory.go b/hindsight-clients/go/api_memory.go new file mode 100644 index 00000000..e1bc1e7d --- /dev/null +++ b/hindsight-clients/go/api_memory.go @@ -0,0 +1,1180 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +// MemoryAPIService MemoryAPI service +type MemoryAPIService service + +type ApiClearBankMemoriesRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + type_ *string + authorization *string +} + +// Optional fact type filter (world, experience, opinion) +func (r ApiClearBankMemoriesRequest) Type_(type_ string) ApiClearBankMemoriesRequest { + r.type_ = &type_ + return r +} + +func (r ApiClearBankMemoriesRequest) Authorization(authorization string) ApiClearBankMemoriesRequest { + r.authorization = &authorization + return r +} + +func (r ApiClearBankMemoriesRequest) Execute() (*DeleteResponse, *http.Response, error) { + return r.ApiService.ClearBankMemoriesExecute(r) +} + +/* +ClearBankMemories Clear memory bank memories + +Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to delete only specific types. This is a destructive operation that cannot be undone. The bank profile (disposition and background) will be preserved. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiClearBankMemoriesRequest +*/ +func (a *MemoryAPIService) ClearBankMemories(ctx context.Context, bankId string) ApiClearBankMemoriesRequest { + return ApiClearBankMemoriesRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return DeleteResponse +func (a *MemoryAPIService) ClearBankMemoriesExecute(r ApiClearBankMemoriesRequest) (*DeleteResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.ClearBankMemories") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/memories" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.type_ != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "form", "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetGraphRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + type_ *string + limit *int32 + authorization *string +} + +func (r ApiGetGraphRequest) Type_(type_ string) ApiGetGraphRequest { + r.type_ = &type_ + return r +} + +func (r ApiGetGraphRequest) Limit(limit int32) ApiGetGraphRequest { + r.limit = &limit + return r +} + +func (r ApiGetGraphRequest) Authorization(authorization string) ApiGetGraphRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetGraphRequest) Execute() (*GraphDataResponse, *http.Response, error) { + return r.ApiService.GetGraphExecute(r) +} + +/* +GetGraph Get memory graph data + +Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiGetGraphRequest +*/ +func (a *MemoryAPIService) GetGraph(ctx context.Context, bankId string) ApiGetGraphRequest { + return ApiGetGraphRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return GraphDataResponse +func (a *MemoryAPIService) GetGraphExecute(r ApiGetGraphRequest) (*GraphDataResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GraphDataResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.GetGraph") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/graph" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.type_ != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 1000 + r.limit = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetMemoryRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + memoryId string + authorization *string +} + +func (r ApiGetMemoryRequest) Authorization(authorization string) ApiGetMemoryRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetMemoryRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.GetMemoryExecute(r) +} + +/* +GetMemory Get memory unit + +Get a single memory unit by ID with all its metadata including entities and tags. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param memoryId + @return ApiGetMemoryRequest +*/ +func (a *MemoryAPIService) GetMemory(ctx context.Context, bankId string, memoryId string) ApiGetMemoryRequest { + return ApiGetMemoryRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + memoryId: memoryId, + } +} + +// Execute executes the request +// @return interface{} +func (a *MemoryAPIService) GetMemoryExecute(r ApiGetMemoryRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.GetMemory") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/memories/{memory_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"memory_id"+"}", url.PathEscape(parameterValueToString(r.memoryId, "memoryId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListMemoriesRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + type_ *string + q *string + limit *int32 + offset *int32 + authorization *string +} + +func (r ApiListMemoriesRequest) Type_(type_ string) ApiListMemoriesRequest { + r.type_ = &type_ + return r +} + +func (r ApiListMemoriesRequest) Q(q string) ApiListMemoriesRequest { + r.q = &q + return r +} + +func (r ApiListMemoriesRequest) Limit(limit int32) ApiListMemoriesRequest { + r.limit = &limit + return r +} + +func (r ApiListMemoriesRequest) Offset(offset int32) ApiListMemoriesRequest { + r.offset = &offset + return r +} + +func (r ApiListMemoriesRequest) Authorization(authorization string) ApiListMemoriesRequest { + r.authorization = &authorization + return r +} + +func (r ApiListMemoriesRequest) Execute() (*ListMemoryUnitsResponse, *http.Response, error) { + return r.ApiService.ListMemoriesExecute(r) +} + +/* +ListMemories List memory units + +List memory units with pagination and optional full-text search. Supports filtering by type. Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiListMemoriesRequest +*/ +func (a *MemoryAPIService) ListMemories(ctx context.Context, bankId string) ApiListMemoriesRequest { + return ApiListMemoriesRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return ListMemoryUnitsResponse +func (a *MemoryAPIService) ListMemoriesExecute(r ApiListMemoriesRequest) (*ListMemoryUnitsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListMemoryUnitsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.ListMemories") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/memories/list" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.type_ != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "type", r.type_, "form", "") + } + if r.q != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "q", r.q, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 100 + r.limit = &defaultValue + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } else { + var defaultValue int32 = 0 + r.offset = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListTagsRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + q *string + limit *int32 + offset *int32 + authorization *string +} + +// Wildcard pattern to filter tags (e.g., 'user:*' for user:alice, '*-admin' for role-admin). Use '*' as wildcard. Case-insensitive. +func (r ApiListTagsRequest) Q(q string) ApiListTagsRequest { + r.q = &q + return r +} + +// Maximum number of tags to return +func (r ApiListTagsRequest) Limit(limit int32) ApiListTagsRequest { + r.limit = &limit + return r +} + +// Offset for pagination +func (r ApiListTagsRequest) Offset(offset int32) ApiListTagsRequest { + r.offset = &offset + return r +} + +func (r ApiListTagsRequest) Authorization(authorization string) ApiListTagsRequest { + r.authorization = &authorization + return r +} + +func (r ApiListTagsRequest) Execute() (*ListTagsResponse, *http.Response, error) { + return r.ApiService.ListTagsExecute(r) +} + +/* +ListTags List tags + +List all unique tags in a memory bank with usage counts. Supports wildcard search using '*' (e.g., 'user:*', '*-fred', 'tag*-2'). Case-insensitive. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiListTagsRequest +*/ +func (a *MemoryAPIService) ListTags(ctx context.Context, bankId string) ApiListTagsRequest { + return ApiListTagsRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return ListTagsResponse +func (a *MemoryAPIService) ListTagsExecute(r ApiListTagsRequest) (*ListTagsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListTagsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.ListTags") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/tags" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.q != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "q", r.q, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 100 + r.limit = &defaultValue + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } else { + var defaultValue int32 = 0 + r.offset = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiRecallMemoriesRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + recallRequest *RecallRequest + authorization *string +} + +func (r ApiRecallMemoriesRequest) RecallRequest(recallRequest RecallRequest) ApiRecallMemoriesRequest { + r.recallRequest = &recallRequest + return r +} + +func (r ApiRecallMemoriesRequest) Authorization(authorization string) ApiRecallMemoriesRequest { + r.authorization = &authorization + return r +} + +func (r ApiRecallMemoriesRequest) Execute() (*RecallResponse, *http.Response, error) { + return r.ApiService.RecallMemoriesExecute(r) +} + +/* +RecallMemories Recall memory + +Recall memory using semantic similarity and spreading activation. + +The type parameter is optional and must be one of: +- `world`: General knowledge about people, places, events, and things that happen +- `experience`: Memories about experience, conversations, actions taken, and tasks performed + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiRecallMemoriesRequest +*/ +func (a *MemoryAPIService) RecallMemories(ctx context.Context, bankId string) ApiRecallMemoriesRequest { + return ApiRecallMemoriesRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return RecallResponse +func (a *MemoryAPIService) RecallMemoriesExecute(r ApiRecallMemoriesRequest) (*RecallResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RecallResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.RecallMemories") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/memories/recall" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.recallRequest == nil { + return localVarReturnValue, nil, reportError("recallRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.recallRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiReflectRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + reflectRequest *ReflectRequest + authorization *string +} + +func (r ApiReflectRequest) ReflectRequest(reflectRequest ReflectRequest) ApiReflectRequest { + r.reflectRequest = &reflectRequest + return r +} + +func (r ApiReflectRequest) Authorization(authorization string) ApiReflectRequest { + r.authorization = &authorization + return r +} + +func (r ApiReflectRequest) Execute() (*ReflectResponse, *http.Response, error) { + return r.ApiService.ReflectExecute(r) +} + +/* +Reflect Reflect and generate answer + +Reflect and formulate an answer using bank identity, world facts, and opinions. + +This endpoint: +1. Retrieves experience (conversations and events) +2. Retrieves world facts relevant to the query +3. Retrieves existing opinions (bank's perspectives) +4. Uses LLM to formulate a contextual answer +5. Returns plain text answer and the facts used + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiReflectRequest +*/ +func (a *MemoryAPIService) Reflect(ctx context.Context, bankId string) ApiReflectRequest { + return ApiReflectRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return ReflectResponse +func (a *MemoryAPIService) ReflectExecute(r ApiReflectRequest) (*ReflectResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ReflectResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.Reflect") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/reflect" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.reflectRequest == nil { + return localVarReturnValue, nil, reportError("reflectRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.reflectRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiRetainMemoriesRequest struct { + ctx context.Context + ApiService *MemoryAPIService + bankId string + retainRequest *RetainRequest + authorization *string +} + +func (r ApiRetainMemoriesRequest) RetainRequest(retainRequest RetainRequest) ApiRetainMemoriesRequest { + r.retainRequest = &retainRequest + return r +} + +func (r ApiRetainMemoriesRequest) Authorization(authorization string) ApiRetainMemoriesRequest { + r.authorization = &authorization + return r +} + +func (r ApiRetainMemoriesRequest) Execute() (*RetainResponse, *http.Response, error) { + return r.ApiService.RetainMemoriesExecute(r) +} + +/* +RetainMemories Retain memories + +Retain memory items with automatic fact extraction. + +This is the main endpoint for storing memories. It supports both synchronous and asynchronous processing via the `async` parameter. + +**Features:** +- Efficient batch processing +- Automatic fact extraction from natural language +- Entity recognition and linking +- Document tracking with automatic upsert (when document_id is provided) +- Temporal and semantic linking +- Optional asynchronous processing + +**The system automatically:** +1. Extracts semantic facts from the content +2. Generates embeddings +3. Deduplicates similar facts +4. Creates temporal, semantic, and entity links +5. Tracks document metadata + +**When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor progress. + +**When `async=false` (default):** Waits for processing to complete. + +**Note:** If a memory item has a `document_id` that already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior). + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiRetainMemoriesRequest +*/ +func (a *MemoryAPIService) RetainMemories(ctx context.Context, bankId string) ApiRetainMemoriesRequest { + return ApiRetainMemoriesRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return RetainResponse +func (a *MemoryAPIService) RetainMemoriesExecute(r ApiRetainMemoriesRequest) (*RetainResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *RetainResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MemoryAPIService.RetainMemories") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/memories" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.retainRequest == nil { + return localVarReturnValue, nil, reportError("retainRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.retainRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/api_mental_models.go b/hindsight-clients/go/api_mental_models.go new file mode 100644 index 00000000..5829453b --- /dev/null +++ b/hindsight-clients/go/api_mental_models.go @@ -0,0 +1,850 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + "reflect" +) + + +// MentalModelsAPIService MentalModelsAPI service +type MentalModelsAPIService service + +type ApiCreateMentalModelRequest struct { + ctx context.Context + ApiService *MentalModelsAPIService + bankId string + createMentalModelRequest *CreateMentalModelRequest + authorization *string +} + +func (r ApiCreateMentalModelRequest) CreateMentalModelRequest(createMentalModelRequest CreateMentalModelRequest) ApiCreateMentalModelRequest { + r.createMentalModelRequest = &createMentalModelRequest + return r +} + +func (r ApiCreateMentalModelRequest) Authorization(authorization string) ApiCreateMentalModelRequest { + r.authorization = &authorization + return r +} + +func (r ApiCreateMentalModelRequest) Execute() (*CreateMentalModelResponse, *http.Response, error) { + return r.ApiService.CreateMentalModelExecute(r) +} + +/* +CreateMentalModel Create mental model + +Create a mental model by running reflect with the source query in the background. Returns an operation ID to track progress. The content is auto-generated by the reflect endpoint. Use the operations endpoint to check completion status. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiCreateMentalModelRequest +*/ +func (a *MentalModelsAPIService) CreateMentalModel(ctx context.Context, bankId string) ApiCreateMentalModelRequest { + return ApiCreateMentalModelRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return CreateMentalModelResponse +func (a *MentalModelsAPIService) CreateMentalModelExecute(r ApiCreateMentalModelRequest) (*CreateMentalModelResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateMentalModelResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MentalModelsAPIService.CreateMentalModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/mental-models" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createMentalModelRequest == nil { + return localVarReturnValue, nil, reportError("createMentalModelRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.createMentalModelRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteMentalModelRequest struct { + ctx context.Context + ApiService *MentalModelsAPIService + bankId string + mentalModelId string + authorization *string +} + +func (r ApiDeleteMentalModelRequest) Authorization(authorization string) ApiDeleteMentalModelRequest { + r.authorization = &authorization + return r +} + +func (r ApiDeleteMentalModelRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.DeleteMentalModelExecute(r) +} + +/* +DeleteMentalModel Delete mental model + +Delete a mental model. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param mentalModelId + @return ApiDeleteMentalModelRequest +*/ +func (a *MentalModelsAPIService) DeleteMentalModel(ctx context.Context, bankId string, mentalModelId string) ApiDeleteMentalModelRequest { + return ApiDeleteMentalModelRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + mentalModelId: mentalModelId, + } +} + +// Execute executes the request +// @return interface{} +func (a *MentalModelsAPIService) DeleteMentalModelExecute(r ApiDeleteMentalModelRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MentalModelsAPIService.DeleteMentalModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/mental-models/{mental_model_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"mental_model_id"+"}", url.PathEscape(parameterValueToString(r.mentalModelId, "mentalModelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetMentalModelRequest struct { + ctx context.Context + ApiService *MentalModelsAPIService + bankId string + mentalModelId string + authorization *string +} + +func (r ApiGetMentalModelRequest) Authorization(authorization string) ApiGetMentalModelRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetMentalModelRequest) Execute() (*MentalModelResponse, *http.Response, error) { + return r.ApiService.GetMentalModelExecute(r) +} + +/* +GetMentalModel Get mental model + +Get a specific mental model by ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param mentalModelId + @return ApiGetMentalModelRequest +*/ +func (a *MentalModelsAPIService) GetMentalModel(ctx context.Context, bankId string, mentalModelId string) ApiGetMentalModelRequest { + return ApiGetMentalModelRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + mentalModelId: mentalModelId, + } +} + +// Execute executes the request +// @return MentalModelResponse +func (a *MentalModelsAPIService) GetMentalModelExecute(r ApiGetMentalModelRequest) (*MentalModelResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MentalModelResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MentalModelsAPIService.GetMentalModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/mental-models/{mental_model_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"mental_model_id"+"}", url.PathEscape(parameterValueToString(r.mentalModelId, "mentalModelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListMentalModelsRequest struct { + ctx context.Context + ApiService *MentalModelsAPIService + bankId string + tags *[]string + tagsMatch *string + limit *int32 + offset *int32 + authorization *string +} + +// Filter by tags +func (r ApiListMentalModelsRequest) Tags(tags []string) ApiListMentalModelsRequest { + r.tags = &tags + return r +} + +// How to match tags +func (r ApiListMentalModelsRequest) TagsMatch(tagsMatch string) ApiListMentalModelsRequest { + r.tagsMatch = &tagsMatch + return r +} + +func (r ApiListMentalModelsRequest) Limit(limit int32) ApiListMentalModelsRequest { + r.limit = &limit + return r +} + +func (r ApiListMentalModelsRequest) Offset(offset int32) ApiListMentalModelsRequest { + r.offset = &offset + return r +} + +func (r ApiListMentalModelsRequest) Authorization(authorization string) ApiListMentalModelsRequest { + r.authorization = &authorization + return r +} + +func (r ApiListMentalModelsRequest) Execute() (*MentalModelListResponse, *http.Response, error) { + return r.ApiService.ListMentalModelsExecute(r) +} + +/* +ListMentalModels List mental models + +List user-curated living documents that stay current. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiListMentalModelsRequest +*/ +func (a *MentalModelsAPIService) ListMentalModels(ctx context.Context, bankId string) ApiListMentalModelsRequest { + return ApiListMentalModelsRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return MentalModelListResponse +func (a *MentalModelsAPIService) ListMentalModelsExecute(r ApiListMentalModelsRequest) (*MentalModelListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MentalModelListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MentalModelsAPIService.ListMentalModels") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/mental-models" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.tags != nil { + t := *r.tags + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + parameterAddToHeaderOrQuery(localVarQueryParams, "tags", s.Index(i).Interface(), "form", "multi") + } + } else { + parameterAddToHeaderOrQuery(localVarQueryParams, "tags", t, "form", "multi") + } + } + if r.tagsMatch != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "tags_match", r.tagsMatch, "form", "") + } else { + var defaultValue string = "any" + r.tagsMatch = &defaultValue + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 100 + r.limit = &defaultValue + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } else { + var defaultValue int32 = 0 + r.offset = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiRefreshMentalModelRequest struct { + ctx context.Context + ApiService *MentalModelsAPIService + bankId string + mentalModelId string + authorization *string +} + +func (r ApiRefreshMentalModelRequest) Authorization(authorization string) ApiRefreshMentalModelRequest { + r.authorization = &authorization + return r +} + +func (r ApiRefreshMentalModelRequest) Execute() (*AsyncOperationSubmitResponse, *http.Response, error) { + return r.ApiService.RefreshMentalModelExecute(r) +} + +/* +RefreshMentalModel Refresh mental model + +Submit an async task to re-run the source query through reflect and update the content. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param mentalModelId + @return ApiRefreshMentalModelRequest +*/ +func (a *MentalModelsAPIService) RefreshMentalModel(ctx context.Context, bankId string, mentalModelId string) ApiRefreshMentalModelRequest { + return ApiRefreshMentalModelRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + mentalModelId: mentalModelId, + } +} + +// Execute executes the request +// @return AsyncOperationSubmitResponse +func (a *MentalModelsAPIService) RefreshMentalModelExecute(r ApiRefreshMentalModelRequest) (*AsyncOperationSubmitResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AsyncOperationSubmitResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MentalModelsAPIService.RefreshMentalModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/mental-models/{mental_model_id}/refresh" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"mental_model_id"+"}", url.PathEscape(parameterValueToString(r.mentalModelId, "mentalModelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateMentalModelRequest struct { + ctx context.Context + ApiService *MentalModelsAPIService + bankId string + mentalModelId string + updateMentalModelRequest *UpdateMentalModelRequest + authorization *string +} + +func (r ApiUpdateMentalModelRequest) UpdateMentalModelRequest(updateMentalModelRequest UpdateMentalModelRequest) ApiUpdateMentalModelRequest { + r.updateMentalModelRequest = &updateMentalModelRequest + return r +} + +func (r ApiUpdateMentalModelRequest) Authorization(authorization string) ApiUpdateMentalModelRequest { + r.authorization = &authorization + return r +} + +func (r ApiUpdateMentalModelRequest) Execute() (*MentalModelResponse, *http.Response, error) { + return r.ApiService.UpdateMentalModelExecute(r) +} + +/* +UpdateMentalModel Update mental model + +Update a mental model's name and/or source query. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param mentalModelId + @return ApiUpdateMentalModelRequest +*/ +func (a *MentalModelsAPIService) UpdateMentalModel(ctx context.Context, bankId string, mentalModelId string) ApiUpdateMentalModelRequest { + return ApiUpdateMentalModelRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + mentalModelId: mentalModelId, + } +} + +// Execute executes the request +// @return MentalModelResponse +func (a *MentalModelsAPIService) UpdateMentalModelExecute(r ApiUpdateMentalModelRequest) (*MentalModelResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *MentalModelResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MentalModelsAPIService.UpdateMentalModel") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/mental-models/{mental_model_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"mental_model_id"+"}", url.PathEscape(parameterValueToString(r.mentalModelId, "mentalModelId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateMentalModelRequest == nil { + return localVarReturnValue, nil, reportError("updateMentalModelRequest is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + // body params + localVarPostBody = r.updateMentalModelRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/api_monitoring.go b/hindsight-clients/go/api_monitoring.go new file mode 100644 index 00000000..cac4b072 --- /dev/null +++ b/hindsight-clients/go/api_monitoring.go @@ -0,0 +1,320 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" +) + + +// MonitoringAPIService MonitoringAPI service +type MonitoringAPIService service + +type ApiGetVersionRequest struct { + ctx context.Context + ApiService *MonitoringAPIService +} + +func (r ApiGetVersionRequest) Execute() (*VersionResponse, *http.Response, error) { + return r.ApiService.GetVersionExecute(r) +} + +/* +GetVersion Get API version and feature flags + +Returns API version information and enabled feature flags. Use this to check which capabilities are available in this deployment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetVersionRequest +*/ +func (a *MonitoringAPIService) GetVersion(ctx context.Context) ApiGetVersionRequest { + return ApiGetVersionRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return VersionResponse +func (a *MonitoringAPIService) GetVersionExecute(r ApiGetVersionRequest) (*VersionResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *VersionResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MonitoringAPIService.GetVersion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/version" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiHealthEndpointHealthGetRequest struct { + ctx context.Context + ApiService *MonitoringAPIService +} + +func (r ApiHealthEndpointHealthGetRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.HealthEndpointHealthGetExecute(r) +} + +/* +HealthEndpointHealthGet Health check endpoint + +Checks the health of the API and database connection + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiHealthEndpointHealthGetRequest +*/ +func (a *MonitoringAPIService) HealthEndpointHealthGet(ctx context.Context) ApiHealthEndpointHealthGetRequest { + return ApiHealthEndpointHealthGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return interface{} +func (a *MonitoringAPIService) HealthEndpointHealthGetExecute(r ApiHealthEndpointHealthGetRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MonitoringAPIService.HealthEndpointHealthGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/health" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiMetricsEndpointMetricsGetRequest struct { + ctx context.Context + ApiService *MonitoringAPIService +} + +func (r ApiMetricsEndpointMetricsGetRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.MetricsEndpointMetricsGetExecute(r) +} + +/* +MetricsEndpointMetricsGet Prometheus metrics endpoint + +Exports metrics in Prometheus format for scraping + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiMetricsEndpointMetricsGetRequest +*/ +func (a *MonitoringAPIService) MetricsEndpointMetricsGet(ctx context.Context) ApiMetricsEndpointMetricsGetRequest { + return ApiMetricsEndpointMetricsGetRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return interface{} +func (a *MonitoringAPIService) MetricsEndpointMetricsGetExecute(r ApiMetricsEndpointMetricsGetRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MonitoringAPIService.MetricsEndpointMetricsGet") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/metrics" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/api_operations.go b/hindsight-clients/go/api_operations.go new file mode 100644 index 00000000..577bd47c --- /dev/null +++ b/hindsight-clients/go/api_operations.go @@ -0,0 +1,434 @@ +/* +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 ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + + +// OperationsAPIService OperationsAPI service +type OperationsAPIService service + +type ApiCancelOperationRequest struct { + ctx context.Context + ApiService *OperationsAPIService + bankId string + operationId string + authorization *string +} + +func (r ApiCancelOperationRequest) Authorization(authorization string) ApiCancelOperationRequest { + r.authorization = &authorization + return r +} + +func (r ApiCancelOperationRequest) Execute() (*CancelOperationResponse, *http.Response, error) { + return r.ApiService.CancelOperationExecute(r) +} + +/* +CancelOperation Cancel a pending async operation + +Cancel a pending async operation by removing it from the queue + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param operationId + @return ApiCancelOperationRequest +*/ +func (a *OperationsAPIService) CancelOperation(ctx context.Context, bankId string, operationId string) ApiCancelOperationRequest { + return ApiCancelOperationRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + operationId: operationId, + } +} + +// Execute executes the request +// @return CancelOperationResponse +func (a *OperationsAPIService) CancelOperationExecute(r ApiCancelOperationRequest) (*CancelOperationResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CancelOperationResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OperationsAPIService.CancelOperation") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/operations/{operation_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"operation_id"+"}", url.PathEscape(parameterValueToString(r.operationId, "operationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetOperationStatusRequest struct { + ctx context.Context + ApiService *OperationsAPIService + bankId string + operationId string + authorization *string +} + +func (r ApiGetOperationStatusRequest) Authorization(authorization string) ApiGetOperationStatusRequest { + r.authorization = &authorization + return r +} + +func (r ApiGetOperationStatusRequest) Execute() (*OperationStatusResponse, *http.Response, error) { + return r.ApiService.GetOperationStatusExecute(r) +} + +/* +GetOperationStatus Get operation status + +Get the status of a specific async operation. Returns 'pending', 'completed', or 'failed'. Completed operations are removed from storage, so 'completed' means the operation finished successfully. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @param operationId + @return ApiGetOperationStatusRequest +*/ +func (a *OperationsAPIService) GetOperationStatus(ctx context.Context, bankId string, operationId string) ApiGetOperationStatusRequest { + return ApiGetOperationStatusRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + operationId: operationId, + } +} + +// Execute executes the request +// @return OperationStatusResponse +func (a *OperationsAPIService) GetOperationStatusExecute(r ApiGetOperationStatusRequest) (*OperationStatusResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OperationStatusResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OperationsAPIService.GetOperationStatus") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/operations/{operation_id}" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"operation_id"+"}", url.PathEscape(parameterValueToString(r.operationId, "operationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListOperationsRequest struct { + ctx context.Context + ApiService *OperationsAPIService + bankId string + status *string + limit *int32 + offset *int32 + authorization *string +} + +// Filter by status: pending, completed, or failed +func (r ApiListOperationsRequest) Status(status string) ApiListOperationsRequest { + r.status = &status + return r +} + +// Maximum number of operations to return +func (r ApiListOperationsRequest) Limit(limit int32) ApiListOperationsRequest { + r.limit = &limit + return r +} + +// Number of operations to skip +func (r ApiListOperationsRequest) Offset(offset int32) ApiListOperationsRequest { + r.offset = &offset + return r +} + +func (r ApiListOperationsRequest) Authorization(authorization string) ApiListOperationsRequest { + r.authorization = &authorization + return r +} + +func (r ApiListOperationsRequest) Execute() (*OperationsListResponse, *http.Response, error) { + return r.ApiService.ListOperationsExecute(r) +} + +/* +ListOperations List async operations + +Get a list of async operations for a specific agent, with optional filtering by status. Results are sorted by most recent first. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param bankId + @return ApiListOperationsRequest +*/ +func (a *OperationsAPIService) ListOperations(ctx context.Context, bankId string) ApiListOperationsRequest { + return ApiListOperationsRequest{ + ApiService: a, + ctx: ctx, + bankId: bankId, + } +} + +// Execute executes the request +// @return OperationsListResponse +func (a *OperationsAPIService) ListOperationsExecute(r ApiListOperationsRequest) (*OperationsListResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *OperationsListResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OperationsAPIService.ListOperations") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/v1/default/banks/{bank_id}/operations" + localVarPath = strings.Replace(localVarPath, "{"+"bank_id"+"}", url.PathEscape(parameterValueToString(r.bankId, "bankId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.status != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "status", r.status, "form", "") + } + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "form", "") + } else { + var defaultValue int32 = 20 + r.limit = &defaultValue + } + if r.offset != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "form", "") + } else { + var defaultValue int32 = 0 + r.offset = &defaultValue + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.authorization != nil { + parameterAddToHeaderOrQuery(localVarHeaderParams, "authorization", r.authorization, "simple", "") + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 422 { + var v HTTPValidationError + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.model = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/hindsight-clients/go/banks.go b/hindsight-clients/go/banks.go deleted file mode 100644 index 54cf5c89..00000000 --- a/hindsight-clients/go/banks.go +++ /dev/null @@ -1,118 +0,0 @@ -package hindsight - -import ( - "context" - "fmt" - - "github.com/vectorize-io/hindsight-client-go/internal/ogenapi" -) - -// CreateBank creates a new memory bank or updates an existing one. -func (c *Client) CreateBank(ctx context.Context, bankID string, opts ...CreateBankOption) (*BankProfileResponse, error) { - var cfg createBankConfig - for _, o := range opts { - o(&cfg) - } - - req := &ogenapi.CreateBankRequest{} - if cfg.name != nil { - req.Name = ogenapi.NewOptString(*cfg.name) - } - if cfg.mission != nil { - req.Mission = ogenapi.NewOptString(*cfg.mission) - } - if cfg.disposition != nil { - req.Disposition = ogenapi.NewOptDispositionTraits(*cfg.disposition) - } - - res, err := c.api.CreateOrUpdateBank(ctx, req, ogenapi.CreateOrUpdateBankParams{ - BankID: bankID, - }) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.BankProfileResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} - -// GetBankProfile retrieves the profile for a memory bank. -func (c *Client) GetBankProfile(ctx context.Context, bankID string) (*BankProfileResponse, error) { - res, err := c.api.GetBankProfile(ctx, ogenapi.GetBankProfileParams{ - BankID: bankID, - }) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.BankProfileResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} - -// ListBanks returns all memory banks. -func (c *Client) ListBanks(ctx context.Context) (*BankListResponse, error) { - res, err := c.api.ListBanks(ctx) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.BankListResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} - -// DeleteBank permanently deletes a memory bank and all its data. -func (c *Client) DeleteBank(ctx context.Context, bankID string) error { - _, err := c.api.DeleteBank(ctx, ogenapi.DeleteBankParams{ - BankID: bankID, - }) - return err -} - -// SetMission updates the mission for a memory bank. -func (c *Client) SetMission(ctx context.Context, bankID, mission string) (*BankProfileResponse, error) { - req := &ogenapi.CreateBankRequest{ - Mission: ogenapi.NewOptString(mission), - } - - res, err := c.api.CreateOrUpdateBank(ctx, req, ogenapi.CreateOrUpdateBankParams{ - BankID: bankID, - }) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.BankProfileResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} - -// UpdateDisposition updates the personality traits for a memory bank. -func (c *Client) UpdateDisposition(ctx context.Context, bankID string, traits DispositionTraits) (*BankProfileResponse, error) { - req := &ogenapi.UpdateDispositionRequest{ - Disposition: traits, - } - - res, err := c.api.UpdateBankDisposition(ctx, req, ogenapi.UpdateBankDispositionParams{ - BankID: bankID, - }) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.BankProfileResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} diff --git a/hindsight-clients/go/client.go b/hindsight-clients/go/client.go new file mode 100644 index 00000000..02f2d095 --- /dev/null +++ b/hindsight-clients/go/client.go @@ -0,0 +1,673 @@ +/* +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 ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) +) + +// APIClient manages communication with the Hindsight HTTP API API v0.4.11 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + BanksAPI *BanksAPIService + + DirectivesAPI *DirectivesAPIService + + DocumentsAPI *DocumentsAPIService + + EntitiesAPI *EntitiesAPIService + + MemoryAPI *MemoryAPIService + + MentalModelsAPI *MentalModelsAPIService + + MonitoringAPI *MonitoringAPIService + + OperationsAPI *OperationsAPIService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.BanksAPI = (*BanksAPIService)(&c.common) + c.DirectivesAPI = (*DirectivesAPIService)(&c.common) + c.DocumentsAPI = (*DocumentsAPIService)(&c.common) + c.EntitiesAPI = (*EntitiesAPIService)(&c.common) + c.MemoryAPI = (*MemoryAPIService)(&c.common) + c.MentalModelsAPI = (*MentalModelsAPIService)(&c.common) + c.MonitoringAPI = (*MonitoringAPIService)(&c.common) + c.OperationsAPI = (*OperationsAPIService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/hindsight-clients/go/configuration.go b/hindsight-clients/go/configuration.go new file mode 100644 index 00000000..4263a38c --- /dev/null +++ b/hindsight-clients/go/configuration.go @@ -0,0 +1,215 @@ +/* +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 ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{ + }, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/hindsight-clients/go/doc.go b/hindsight-clients/go/doc.go deleted file mode 100644 index 262f7ae2..00000000 --- a/hindsight-clients/go/doc.go +++ /dev/null @@ -1,40 +0,0 @@ -// Package hindsight provides a Go client for the Hindsight agent memory API. -// -// Hindsight is a long-term memory system for AI agents. This client wraps the -// auto-generated ogen API client with a simpler, Go-idiomatic interface for the -// core operations: retain (store), recall (retrieve), and reflect (reason). -// -// # Quick Start -// -// client, err := hindsight.New("http://localhost:8888") -// if err != nil { -// log.Fatal(err) -// } -// -// // Store a memory -// _, err = client.Retain(ctx, "my-bank", "The user prefers dark mode") -// -// // Recall memories -// resp, err := client.Recall(ctx, "my-bank", "What are the user's preferences?") -// for _, r := range resp.Results { -// fmt.Println(r.Text) -// } -// -// // Reflect with reasoning -// ref, err := client.Reflect(ctx, "my-bank", "Summarize what you know about the user") -// fmt.Println(ref.Text) -// -// # Authentication -// -// For authenticated deployments, pass an API key: -// -// client, err := hindsight.New("http://localhost:8888", hindsight.WithAPIKey("your-key")) -// -// # Advanced Usage -// -// For operations not covered by the high-level wrapper (documents, entities, -// operations, mental models, directives), access the ogen-generated client: -// -// ogen := client.OgenClient() -// resp, err := ogen.ListEntities(ctx, ogenapi.ListEntitiesParams{BankID: "my-bank"}) -package hindsight diff --git a/hindsight-clients/go/example_test.go b/hindsight-clients/go/example_test.go deleted file mode 100644 index 17ffe657..00000000 --- a/hindsight-clients/go/example_test.go +++ /dev/null @@ -1,124 +0,0 @@ -package hindsight_test - -import ( - "context" - "fmt" - "log" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -func Example() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - - // Store a memory - _, err = client.Retain(ctx, "my-bank", "The user prefers dark mode") - if err != nil { - log.Fatal(err) - } - - // Recall memories - resp, err := client.Recall(ctx, "my-bank", "What are the user's preferences?") - if err != nil { - log.Fatal(err) - } - for _, r := range resp.Results { - fmt.Println(r.Text) - } - - // Reflect with reasoning - ref, err := client.Reflect(ctx, "my-bank", "Summarize what you know about the user") - if err != nil { - log.Fatal(err) - } - fmt.Println(ref.Text) -} - -func ExampleNew_withAPIKey() { - _, err := hindsight.New( - "http://localhost:8888", - hindsight.WithAPIKey("your-api-key"), - ) - if err != nil { - log.Fatal(err) - } -} - -func ExampleClient_Retain() { - client, _ := hindsight.New("http://localhost:8888") - ctx := context.Background() - - // Simple retain - _, _ = client.Retain(ctx, "my-bank", "Alice loves Python programming") - - // Retain with options - _, _ = client.Retain(ctx, "my-bank", "Bob went hiking", - hindsight.WithContext("outdoor activities"), - hindsight.WithTags([]string{"hobbies"}), - hindsight.WithDocumentID("conversation-123"), - ) -} - -func ExampleClient_RetainBatch() { - client, _ := hindsight.New("http://localhost:8888") - ctx := context.Background() - - items := []hindsight.MemoryItem{ - {Content: "Alice completed the project"}, - {Content: "Bob started learning Go"}, - {Content: "Charlie presented at the conference"}, - } - - _, _ = client.RetainBatch(ctx, "my-bank", items, - hindsight.WithDocumentTags([]string{"team-updates"}), - ) -} - -func ExampleClient_Recall() { - client, _ := hindsight.New("http://localhost:8888") - ctx := context.Background() - - resp, _ := client.Recall(ctx, "my-bank", "What does Alice like?", - hindsight.WithBudget(hindsight.BudgetHigh), - hindsight.WithMaxTokens(4096), - hindsight.WithTypes([]string{"world", "experience"}), - hindsight.WithTrace(true), - ) - - for _, r := range resp.Results { - fmt.Printf("[%s] %s\n", r.Type.Or("unknown"), r.Text) - } -} - -func ExampleClient_Reflect() { - client, _ := hindsight.New("http://localhost:8888") - ctx := context.Background() - - resp, _ := client.Reflect(ctx, "my-bank", - "What are the user's professional interests?", - hindsight.WithReflectBudget(hindsight.BudgetMid), - hindsight.WithReflectMaxTokens(2048), - ) - - fmt.Println(resp.Text) -} - -func ExampleClient_CreateBank() { - client, _ := hindsight.New("http://localhost:8888") - ctx := context.Background() - - _, _ = client.CreateBank(ctx, "my-bank", - hindsight.WithBankName("My Agent"), - hindsight.WithMission("Help users with programming tasks"), - hindsight.WithDisposition(hindsight.DispositionTraits{ - Skepticism: 3, - Literalism: 2, - Empathy: 4, - }), - ) -} diff --git a/hindsight-clients/go/generate.go b/hindsight-clients/go/generate.go deleted file mode 100644 index eba3da80..00000000 --- a/hindsight-clients/go/generate.go +++ /dev/null @@ -1,4 +0,0 @@ -package hindsight - -//go:generate go run ./internal/cmd/preprocess ../../hindsight-docs/static/openapi.json internal/ogenapi/openapi.json -//go:generate go run github.com/ogen-go/ogen/cmd/ogen --target internal/ogenapi -package ogenapi --clean --config ogen.yml internal/ogenapi/openapi.json diff --git a/hindsight-clients/go/go.mod b/hindsight-clients/go/go.mod index 39014484..592de041 100644 --- a/hindsight-clients/go/go.mod +++ b/hindsight-clients/go/go.mod @@ -1,29 +1,11 @@ module github.com/vectorize-io/hindsight-client-go -go 1.25.0 +go 1.18 + +require github.com/stretchr/testify v1.11.1 require ( - github.com/go-faster/errors v0.7.1 - github.com/go-faster/jx v1.2.0 - github.com/ogen-go/ogen v1.19.0 -) - -require ( - github.com/dlclark/regexp2 v1.11.5 // indirect - github.com/fatih/color v1.18.0 // indirect - github.com/ghodss/yaml v1.0.0 // indirect - github.com/go-faster/yaml v0.4.6 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/segmentio/asm v1.2.1 // indirect - github.com/shopspring/decimal v1.4.0 // indirect - go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.27.1 // indirect - golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect - golang.org/x/net v0.50.0 // indirect - golang.org/x/sync v0.19.0 // indirect - golang.org/x/sys v0.41.0 // indirect - golang.org/x/text v0.34.0 // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/hindsight-clients/go/go.sum b/hindsight-clients/go/go.sum index c97d746f..c4c1710c 100644 --- a/hindsight-clients/go/go.sum +++ b/hindsight-clients/go/go.sum @@ -1,60 +1,10 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ= -github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= -github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= -github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-faster/errors v0.7.1 h1:MkJTnDoEdi9pDabt1dpWf7AA8/BaSYZqibYyhZ20AYg= -github.com/go-faster/errors v0.7.1/go.mod h1:5ySTjWFiphBs07IKuiL69nxdfd5+fzh1u7FPGZP2quo= -github.com/go-faster/jx v1.2.0 h1:T2YHJPrFaYu21fJtUxC9GzmluKu8rVIFDwwGBKTDseI= -github.com/go-faster/jx v1.2.0/go.mod h1:UWLOVDmMG597a5tBFPLIWJdUxz5/2emOpfsj9Neg0PE= -github.com/go-faster/yaml v0.4.6 h1:lOK/EhI04gCpPgPhgt0bChS6bvw7G3WwI8xxVe0sw9I= -github.com/go-faster/yaml v0.4.6/go.mod h1:390dRIvV4zbnO7qC9FGo6YYutc+wyyUSHBgbXL52eXk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/ogen-go/ogen v1.19.0 h1:YvdNpeQJ8A8dLLpS6Vs4WxXL53BT6tBPxH0VSjfALhA= -github.com/ogen-go/ogen v1.19.0/go.mod h1:DeShwO+TEpLYXNCuZliSAedphphXsJaTGGbmSomWUjE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/segmentio/asm v1.2.1 h1:DTNbBqs57ioxAD4PrArqftgypG4/qNpXoJx8TVXxPR0= -github.com/segmentio/asm v1.2.1/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= -github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= -github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= -go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= -go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= -go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc= -go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 h1:Di6/M8l0O2lCLc6VVRWhgCiApHV8MnQurBnFSHsQtNY= -golang.org/x/exp v0.0.0-20230725093048-515e97ebf090/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/net v0.50.0 h1:ucWh9eiCGyDR3vtzso0WMQinm2Dnt8cFMuQa9K33J60= -golang.org/x/net v0.50.0/go.mod h1:UgoSli3F/pBgdJBHCTc+tp3gmrU4XswgGRgtnwWTfyM= -golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4= -golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k= -golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk= -golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/hindsight-clients/go/hindsight.go b/hindsight-clients/go/hindsight.go deleted file mode 100644 index 7b852fb0..00000000 --- a/hindsight-clients/go/hindsight.go +++ /dev/null @@ -1,66 +0,0 @@ -package hindsight - -import ( - "net/http" - - "github.com/vectorize-io/hindsight-client-go/internal/ogenapi" -) - -// Client is the high-level Hindsight API client. It wraps the ogen-generated -// client with convenience methods for core operations. -type Client struct { - api *ogenapi.Client -} - -// New creates a new Hindsight client for the given base URL. -// -// By default, no authentication is configured. Use [WithAPIKey] to set a -// Bearer token, or [WithHTTPClient] for full control over the HTTP transport. -func New(baseURL string, opts ...Option) (*Client, error) { - cfg := clientConfig{} - for _, o := range opts { - o(&cfg) - } - - var httpClient http.Client - if cfg.httpClient != nil { - httpClient = *cfg.httpClient - } - - if cfg.apiKey != "" { - base := httpClient.Transport - if base == nil { - base = http.DefaultTransport - } - httpClient.Transport = &authTransport{ - base: base, - token: cfg.apiKey, - } - } - - api, err := ogenapi.NewClient(baseURL, ogenapi.WithClient(&httpClient)) - if err != nil { - return nil, err - } - - return &Client{api: api}, nil -} - -// OgenClient returns the underlying ogen-generated client for advanced -// operations not covered by the high-level wrapper (documents, entities, -// operations, mental models, directives). -func (c *Client) OgenClient() *ogenapi.Client { - return c.api -} - -// authTransport injects a Bearer token into every request. -type authTransport struct { - base http.RoundTripper - token string -} - -func (t *authTransport) RoundTrip(r *http.Request) (*http.Response, error) { - r = r.Clone(r.Context()) - r.Header.Set("Authorization", "Bearer "+t.token) - return t.base.RoundTrip(r) -} diff --git a/hindsight-clients/go/integration_test.go b/hindsight-clients/go/integration_test.go index 618e9d4b..c4c3fb70 100644 --- a/hindsight-clients/go/integration_test.go +++ b/hindsight-clients/go/integration_test.go @@ -1,6 +1,6 @@ //go:build integration -package hindsight_test +package hindsight import ( "context" @@ -8,8 +8,6 @@ import ( "os" "testing" "time" - - hindsight "github.com/vectorize-io/hindsight-client-go" ) func apiURL(t *testing.T) string { @@ -21,13 +19,13 @@ func apiURL(t *testing.T) string { return u } -func newClient(t *testing.T) *hindsight.Client { +func newClient(t *testing.T) *APIClient { t.Helper() - c, err := hindsight.New(apiURL(t)) - if err != nil { - t.Fatal(err) + cfg := NewConfiguration() + cfg.Servers = ServerConfigurations{ + {URL: apiURL(t)}, } - return c + return NewAPIClient(cfg) } func uniqueBank(t *testing.T) string { @@ -38,335 +36,426 @@ func uniqueBank(t *testing.T) string { // --- Retain tests --- func TestRetainSingle(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() + bankID := uniqueBank(t) - resp, err := c.Retain(ctx, uniqueBank(t), "Alice loves artificial intelligence and machine learning") + req := RetainRequest{ + Items: []MemoryItem{ + {Content: "Alice loves artificial intelligence and machine learning"}, + }, + } + + resp, httpResp, err := client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(req).Execute() if err != nil { t.Fatal(err) } - if !resp.Success { + defer httpResp.Body.Close() + + if !resp.GetSuccess() { t.Error("expected success=true") } } func TestRetainWithContext(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() + bankID := uniqueBank(t) - resp, err := c.Retain(ctx, uniqueBank(t), "Bob went hiking in the mountains", - hindsight.WithTimestamp(time.Date(2024, 1, 15, 10, 30, 0, 0, time.UTC)), - hindsight.WithContext("outdoor activities"), - ) + timestamp := time.Date(2024, 1, 15, 10, 30, 0, 0, time.UTC) + req := RetainRequest{ + Items: []MemoryItem{ + { + Content: "Bob went hiking in the mountains", + Timestamp: *NewNullableTime(PtrTime(timestamp)), + Context: *NewNullableString(PtrString("outdoor activities")), + }, + }, + } + + resp, httpResp, err := client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(req).Execute() if err != nil { t.Fatal(err) } - if !resp.Success { + defer httpResp.Body.Close() + + if !resp.GetSuccess() { t.Error("expected success=true") } } func TestRetainBatch(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() + bankID := uniqueBank(t) - items := []hindsight.MemoryItem{ - {Content: "Charlie enjoys reading science fiction books"}, - {Content: "Diana is learning to play the guitar"}, - {Content: "Eve completed a marathon last month"}, + req := RetainRequest{ + Items: []MemoryItem{ + {Content: "Charlie enjoys reading science fiction books"}, + {Content: "Diana is learning to play the guitar"}, + {Content: "Eve completed a marathon last month"}, + }, } - resp, err := c.RetainBatch(ctx, uniqueBank(t), items) + resp, httpResp, err := client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(req).Execute() if err != nil { t.Fatal(err) } - if !resp.Success { + defer httpResp.Body.Close() + + if !resp.GetSuccess() { t.Error("expected success=true") } - if resp.ItemsCount != 3 { - t.Errorf("expected items_count=3, got %d", resp.ItemsCount) + if resp.GetItemsCount() != 3 { + t.Errorf("expected items_count=3, got %d", resp.GetItemsCount()) } } func TestRetainWithTags(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() + bankID := uniqueBank(t) - resp, err := c.Retain(ctx, uniqueBank(t), "New feature implementation for project Z", - hindsight.WithTags([]string{"project_z", "features"}), - ) + req := RetainRequest{ + Items: []MemoryItem{ + { + Content: "New feature implementation for project Z", + Tags: []string{"project_z", "features"}, + }, + }, + } + + resp, httpResp, err := client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(req).Execute() if err != nil { t.Fatal(err) } - if !resp.Success { + defer httpResp.Body.Close() + + if !resp.GetSuccess() { t.Error("expected success=true") } } func TestRetainBatchWithDocumentTags(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() + bankID := uniqueBank(t) - items := []hindsight.MemoryItem{ - {Content: "First item in batch"}, - {Content: "Second item in batch"}, + req := RetainRequest{ + Items: []MemoryItem{ + {Content: "Document with tags test 1"}, + {Content: "Document with tags test 2"}, + }, + DocumentTags: []string{"test_doc", "batch"}, } - resp, err := c.RetainBatch(ctx, uniqueBank(t), items, - hindsight.WithDocumentTags([]string{"batch_import", "test_data"}), - ) + resp, httpResp, err := client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(req).Execute() if err != nil { t.Fatal(err) } - if !resp.Success { + defer httpResp.Body.Close() + + if !resp.GetSuccess() { t.Error("expected success=true") } - if resp.ItemsCount != 2 { - t.Errorf("expected items_count=2, got %d", resp.ItemsCount) - } } // --- Recall tests --- -func setupRecallBank(t *testing.T, c *hindsight.Client, bankID string) { +func setupRecallBank(t *testing.T, client *APIClient, bankID string) { t.Helper() ctx := context.Background() - items := []hindsight.MemoryItem{ - {Content: "Alice loves programming in Python"}, - {Content: "Bob enjoys hiking and outdoor adventures"}, - {Content: "Charlie is interested in quantum physics"}, - {Content: "Diana plays the violin beautifully"}, + req := RetainRequest{ + Items: []MemoryItem{ + {Content: "Alice enjoys hiking in the mountains"}, + {Content: "Bob loves to read science fiction novels"}, + {Content: "Charlie is learning to play the piano"}, + }, } - _, err := c.RetainBatch(ctx, bankID, items) + _, _, err := client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(req).Execute() if err != nil { t.Fatal(err) } + + // Give the system time to process + time.Sleep(time.Second) } func TestRecallBasic(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() bankID := uniqueBank(t) - setupRecallBank(t, c, bankID) + setupRecallBank(t, client, bankID) - resp, err := c.Recall(ctx, bankID, "What does Alice like?") + req := RecallRequest{ + Query: "outdoor activities", + } + + resp, httpResp, err := client.MemoryAPI.RecallMemories(ctx, bankID).RecallRequest(req).Execute() if err != nil { t.Fatal(err) } - if len(resp.Results) == 0 { - t.Error("expected at least one result") - } + defer httpResp.Body.Close() - found := false - for _, r := range resp.Results { - if contains(r.Text, "Alice") || contains(r.Text, "Python") || contains(r.Text, "programming") { - found = true - break - } - } - if !found { - t.Error("expected a result mentioning Alice or Python") + if resp.Results == nil { + t.Error("expected results, got nil") } } func TestRecallWithMaxTokens(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() bankID := uniqueBank(t) - setupRecallBank(t, c, bankID) + setupRecallBank(t, client, bankID) - resp, err := c.Recall(ctx, bankID, "outdoor activities", - hindsight.WithMaxTokens(1024), - ) + req := RecallRequest{ + Query: "outdoor activities", + MaxTokens: PtrInt32(1024), + } + + resp, httpResp, err := client.MemoryAPI.RecallMemories(ctx, bankID).RecallRequest(req).Execute() if err != nil { t.Fatal(err) } + defer httpResp.Body.Close() + if resp.Results == nil { t.Error("expected results, got nil") } } func TestRecallFullFeatured(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() bankID := uniqueBank(t) - setupRecallBank(t, c, bankID) + setupRecallBank(t, client, bankID) - resp, err := c.Recall(ctx, bankID, "What are people's hobbies?", - hindsight.WithTypes([]string{"world"}), - hindsight.WithMaxTokens(2048), - hindsight.WithTrace(true), - ) + req := RecallRequest{ + Query: "What are people's hobbies?", + Types: []string{"world"}, + MaxTokens: PtrInt32(2048), + Trace: PtrBool(true), + } + + resp, httpResp, err := client.MemoryAPI.RecallMemories(ctx, bankID).RecallRequest(req).Execute() if err != nil { t.Fatal(err) } + defer httpResp.Body.Close() + if resp.Results == nil { t.Error("expected results, got nil") } + + // Verify trace data is present + if resp.Trace != nil && len(resp.Trace) > 0 { + t.Logf("✓ Trace data received with %d keys", len(resp.Trace)) + } } // --- Reflect tests --- -func setupReflectBank(t *testing.T, c *hindsight.Client, bankID string) { +func setupReflectBank(t *testing.T, client *APIClient, bankID string) { t.Helper() ctx := context.Background() - _, err := c.CreateBank(ctx, bankID, - hindsight.WithMission("I am a helpful AI assistant interested in technology and science."), - ) + // Create bank with mission + createReq := CreateBankRequest{ + Mission: *NewNullableString(PtrString("I am a helpful AI assistant interested in technology and science.")), + } + _, _, err := client.BanksAPI.CreateOrUpdateBank(ctx, bankID).CreateBankRequest(createReq).Execute() if err != nil { t.Fatal(err) } - items := []hindsight.MemoryItem{ - {Content: "The Python programming language is great for data science"}, - {Content: "Machine learning models can recognize patterns in data"}, - {Content: "Neural networks are inspired by biological neurons"}, + // Add memories + retainReq := RetainRequest{ + Items: []MemoryItem{ + {Content: "Quantum computing uses quantum bits (qubits) for processing"}, + {Content: "Neural networks are inspired by biological neurons"}, + }, } - - _, err = c.RetainBatch(ctx, bankID, items) + _, _, err = client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(retainReq).Execute() if err != nil { t.Fatal(err) } + + time.Sleep(time.Second) } func TestReflectBasic(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() bankID := uniqueBank(t) - setupReflectBank(t, c, bankID) + setupReflectBank(t, client, bankID) - resp, err := c.Reflect(ctx, bankID, "What do you think about artificial intelligence?") + req := ReflectRequest{ + Query: "What do you know about computing?", + } + + resp, httpResp, err := client.MemoryAPI.Reflect(ctx, bankID).ReflectRequest(req).Execute() if err != nil { t.Fatal(err) } - if resp.Text == "" { - t.Error("expected non-empty response text") + defer httpResp.Body.Close() + + if resp.GetText() == "" { + t.Error("expected non-empty answer") } } func TestReflectWithMaxTokens(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() bankID := uniqueBank(t) - setupReflectBank(t, c, bankID) + setupReflectBank(t, client, bankID) - resp, err := c.Reflect(ctx, bankID, "What do you think about Python?", - hindsight.WithReflectMaxTokens(500), - ) + req := ReflectRequest{ + Query: "Tell me about neural networks", + MaxTokens: PtrInt32(500), + } + + resp, httpResp, err := client.MemoryAPI.Reflect(ctx, bankID).ReflectRequest(req).Execute() if err != nil { t.Fatal(err) } - if resp.Text == "" { - t.Error("expected non-empty response text") + defer httpResp.Body.Close() + + if resp.GetText() == "" { + t.Error("expected non-empty answer") } } // --- Bank tests --- func TestCreateBank(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() - bankID := uniqueBank(t) - resp, err := c.CreateBank(ctx, bankID, - hindsight.WithBankName("Test Bank"), - hindsight.WithMission("A test bank for Go client"), - ) + + req := CreateBankRequest{ + Mission: *NewNullableString(PtrString("Test mission")), + } + + resp, httpResp, err := client.BanksAPI.CreateOrUpdateBank(ctx, bankID).CreateBankRequest(req).Execute() if err != nil { t.Fatal(err) } - if resp.BankID != bankID { - t.Errorf("expected bank_id=%q, got %q", bankID, resp.BankID) + defer httpResp.Body.Close() + + if resp.GetBankId() != bankID { + t.Errorf("expected bank_id=%s, got %s", bankID, resp.GetBankId()) } } func TestSetMission(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() - bankID := uniqueBank(t) - resp, err := c.SetMission(ctx, bankID, "Be a helpful PM tracking sprint progress") + + // Create bank with initial mission + createReq := CreateBankRequest{ + Mission: *NewNullableString(PtrString("Initial mission")), + } + _, _, err := client.BanksAPI.CreateOrUpdateBank(ctx, bankID).CreateBankRequest(createReq).Execute() if err != nil { t.Fatal(err) } - if resp.BankID != bankID { - t.Errorf("expected bank_id=%q, got %q", bankID, resp.BankID) + + // Update mission by creating/updating bank again + updateReq := CreateBankRequest{ + Mission: *NewNullableString(PtrString("Updated mission")), } - if resp.Mission != "Be a helpful PM tracking sprint progress" { - t.Errorf("expected mission=%q, got %q", "Be a helpful PM tracking sprint progress", resp.Mission) + resp, httpResp, err := client.BanksAPI.CreateOrUpdateBank(ctx, bankID).CreateBankRequest(updateReq).Execute() + if err != nil { + t.Fatal(err) + } + defer httpResp.Body.Close() + + if resp.GetMission() != "Updated mission" { + t.Errorf("expected mission='Updated mission', got %s", resp.GetMission()) } } func TestListBanks(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() - // Create a bank first - bankID := uniqueBank(t) - _, err := c.CreateBank(ctx, bankID) + resp, httpResp, err := client.BanksAPI.ListBanks(ctx).Execute() if err != nil { t.Fatal(err) } + defer httpResp.Body.Close() - resp, err := c.ListBanks(ctx) - if err != nil { - t.Fatal(err) - } - if len(resp.Banks) == 0 { - t.Error("expected at least one bank") + if resp.Banks == nil { + t.Error("expected banks list, got nil") } } func TestDeleteBank(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() - bankID := uniqueBank(t) - _, err := c.CreateBank(ctx, bankID, hindsight.WithMission("will be deleted")) + + // Create bank + createReq := CreateBankRequest{} + _, _, err := client.BanksAPI.CreateOrUpdateBank(ctx, bankID).CreateBankRequest(createReq).Execute() if err != nil { t.Fatal(err) } - err = c.DeleteBank(ctx, bankID) + // Delete bank + resp, httpResp, err := client.BanksAPI.DeleteBank(ctx, bankID).Execute() if err != nil { t.Fatal(err) } + defer httpResp.Body.Close() + + if !resp.GetSuccess() { + t.Error("expected success=true") + } } -// --- End-to-end workflow --- +// --- End-to-end workflow test --- func TestCompleteWorkflow(t *testing.T) { - c := newClient(t) + client := newClient(t) ctx := context.Background() bankID := uniqueBank(t) // 1. Create bank - _, err := c.CreateBank(ctx, bankID, - hindsight.WithMission("I am a software engineer who loves Python programming."), - ) + createReq := CreateBankRequest{ + Mission: *NewNullableString(PtrString("I am a helpful assistant")), + } + _, _, err := client.BanksAPI.CreateOrUpdateBank(ctx, bankID).CreateBankRequest(createReq).Execute() if err != nil { t.Fatal(err) } - // 2. Store memories - items := []hindsight.MemoryItem{ - {Content: "I completed a project using FastAPI"}, - {Content: "I learned about async programming in Python"}, - {Content: "I enjoy working on open source projects"}, + // 2. Retain memories + retainReq := RetainRequest{ + Items: []MemoryItem{ + {Content: "Paris is the capital of France"}, + {Content: "The Eiffel Tower is in Paris"}, + }, } - storeResp, err := c.RetainBatch(ctx, bankID, items) + retainResp, _, err := client.MemoryAPI.RetainMemories(ctx, bankID).RetainRequest(retainReq).Execute() if err != nil { t.Fatal(err) } - if !storeResp.Success { - t.Error("expected retain success") + if !retainResp.GetSuccess() { + t.Error("retain failed") } - // 3. Search for relevant memories - recallResp, err := c.Recall(ctx, bankID, "What programming technologies do I use?") + time.Sleep(time.Second) + + // 3. Recall + recallReq := RecallRequest{ + Query: "What is in Paris?", + } + recallResp, _, err := client.MemoryAPI.RecallMemories(ctx, bankID).RecallRequest(recallReq).Execute() if err != nil { t.Fatal(err) } @@ -374,26 +463,17 @@ func TestCompleteWorkflow(t *testing.T) { t.Error("expected recall results") } - // 4. Generate contextual answer - reflectResp, err := c.Reflect(ctx, bankID, "What are my professional interests?") + // 4. Reflect + reflectReq := ReflectRequest{ + Query: "Tell me about Paris", + } + reflectResp, _, err := client.MemoryAPI.Reflect(ctx, bankID).ReflectRequest(reflectReq).Execute() if err != nil { t.Fatal(err) } - if reflectResp.Text == "" { - t.Error("expected non-empty reflect response") + if reflectResp.GetText() == "" { + t.Error("expected reflect answer") } -} -// contains checks if s contains substr (case-sensitive). -func contains(s, substr string) bool { - return len(s) >= len(substr) && searchString(s, substr) -} - -func searchString(s, substr string) bool { - for i := 0; i <= len(s)-len(substr); i++ { - if s[i:i+len(substr)] == substr { - return true - } - } - return false + t.Log("✓ Complete workflow passed") } diff --git a/hindsight-clients/go/internal/cmd/preprocess/main.go b/hindsight-clients/go/internal/cmd/preprocess/main.go deleted file mode 100644 index 85eff26c..00000000 --- a/hindsight-clients/go/internal/cmd/preprocess/main.go +++ /dev/null @@ -1,111 +0,0 @@ -// Command preprocess converts an OpenAPI 3.1 spec to be ogen-compatible. -// -// Hindsight's OpenAPI spec uses anyOf: [{type: T}, {type: null}] for optional -// fields. ogen cannot handle the null type in header/query parameter schemas -// with style:simple. This tool rewrites such patterns to plain {type: T}, -// making the spec consumable by ogen while preserving semantic meaning (the -// fields are already marked as required: false). -package main - -import ( - "encoding/json" - "fmt" - "os" -) - -func main() { - if len(os.Args) != 3 { - fmt.Fprintf(os.Stderr, "usage: preprocess \n") - os.Exit(1) - } - - data, err := os.ReadFile(os.Args[1]) - if err != nil { - fmt.Fprintf(os.Stderr, "read: %v\n", err) - os.Exit(1) - } - - var spec map[string]any - if err := json.Unmarshal(data, &spec); err != nil { - fmt.Fprintf(os.Stderr, "parse: %v\n", err) - os.Exit(1) - } - - convertAnyOfNull(spec) - - out, err := json.MarshalIndent(spec, "", " ") - if err != nil { - fmt.Fprintf(os.Stderr, "marshal: %v\n", err) - os.Exit(1) - } - - if err := os.WriteFile(os.Args[2], out, 0o644); err != nil { - fmt.Fprintf(os.Stderr, "write: %v\n", err) - os.Exit(1) - } -} - -// convertAnyOfNull recursively walks the spec and converts -// anyOf: [{type: T}, {type: null}] → {type: T} (or just the non-null schema). -// For component schema properties, it also does the conversion but additionally -// handles cases where the non-null branch is a $ref. -func convertAnyOfNull(v any) { - switch val := v.(type) { - case map[string]any: - // Check if this object has an "anyOf" with exactly a non-null + null pair. - if tryConvertAnyOf(val) { - // Converted in place; recurse into the result. - convertAnyOfNull(val) - return - } - // Recurse into all values. - for _, child := range val { - convertAnyOfNull(child) - } - case []any: - for _, child := range val { - convertAnyOfNull(child) - } - } -} - -// tryConvertAnyOf checks if m has anyOf: [{...}, {type: null}] and converts -// it in-place. Returns true if conversion happened. -func tryConvertAnyOf(m map[string]any) bool { - anyOf, ok := m["anyOf"].([]any) - if !ok || len(anyOf) != 2 { - return false - } - - // Identify which branch is null and which is the real type. - var realIdx int = -1 - for i, branch := range anyOf { - branchMap, ok := branch.(map[string]any) - if !ok { - return false - } - if branchMap["type"] == "null" { - continue - } - realIdx = i - } - - if realIdx == -1 { - return false // Both are null? Skip. - } - - realBranch, ok := anyOf[realIdx].(map[string]any) - if !ok { - return false - } - - // Remove the anyOf key. - delete(m, "anyOf") - - // Copy all properties from the real branch into the parent. - for k, v := range realBranch { - m[k] = v - } - - return true -} diff --git a/hindsight-clients/go/internal/ogenapi/.gitignore b/hindsight-clients/go/internal/ogenapi/.gitignore deleted file mode 100644 index 80f61910..00000000 --- a/hindsight-clients/go/internal/ogenapi/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Preprocessed OpenAPI spec (intermediate artifact, regenerated by go generate) -openapi.json diff --git a/hindsight-clients/go/internal/ogenapi/oas_cfg_gen.go b/hindsight-clients/go/internal/ogenapi/oas_cfg_gen.go deleted file mode 100644 index 96a03bd7..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_cfg_gen.go +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -import ( - "net/http" - - ht "github.com/ogen-go/ogen/http" -) - -type ( - optionFunc[C any] func(*C) -) - -type clientConfig struct { - Client ht.Client -} - -// ClientOption is client config option. -type ClientOption interface { - applyClient(*clientConfig) -} - -var _ ClientOption = (optionFunc[clientConfig])(nil) - -func (o optionFunc[C]) applyClient(c *C) { - o(c) -} - -func newClientConfig(opts ...ClientOption) clientConfig { - cfg := clientConfig{ - Client: http.DefaultClient, - } - for _, opt := range opts { - opt.applyClient(&cfg) - } - return cfg -} - -type baseClient struct { - cfg clientConfig -} - -func (cfg clientConfig) baseClient() (c baseClient, err error) { - c = baseClient{cfg: cfg} - return c, nil -} - -// Option is config option. -type Option interface { - ClientOption -} - -// WithClient specifies http client to use. -func WithClient(client ht.Client) ClientOption { - return optionFunc[clientConfig](func(cfg *clientConfig) { - if client != nil { - cfg.Client = client - } - }) -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_client_gen.go b/hindsight-clients/go/internal/ogenapi/oas_client_gen.go deleted file mode 100644 index 341f3eaa..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_client_gen.go +++ /dev/null @@ -1,3638 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -import ( - "context" - "net/url" - "strings" - - "github.com/go-faster/errors" - "github.com/go-faster/jx" - "github.com/ogen-go/ogen/conv" - ht "github.com/ogen-go/ogen/http" - "github.com/ogen-go/ogen/uri" -) - -func trimTrailingSlashes(u *url.URL) { - u.Path = strings.TrimRight(u.Path, "/") - u.RawPath = strings.TrimRight(u.RawPath, "/") -} - -// Invoker invokes operations described by OpenAPI v3 specification. -type Invoker interface { - // AddBankBackground invokes add_bank_background operation. - // - // Deprecated: Use PUT /mission instead. This endpoint now updates the mission field. - // - // Deprecated: schema marks this operation as deprecated. - // - // POST /v1/default/banks/{bank_id}/background - AddBankBackground(ctx context.Context, request *AddBackgroundRequest, params AddBankBackgroundParams) (AddBankBackgroundRes, error) - // CancelOperation invokes cancel_operation operation. - // - // Cancel a pending async operation by removing it from the queue. - // - // DELETE /v1/default/banks/{bank_id}/operations/{operation_id} - CancelOperation(ctx context.Context, params CancelOperationParams) (CancelOperationRes, error) - // ClearBankMemories invokes clear_bank_memories operation. - // - // Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to - // delete only specific types. This is a destructive operation that cannot be undone. The bank - // profile (disposition and background) will be preserved. - // - // DELETE /v1/default/banks/{bank_id}/memories - ClearBankMemories(ctx context.Context, params ClearBankMemoriesParams) (ClearBankMemoriesRes, error) - // ClearObservations invokes clear_observations operation. - // - // Delete all observations for a memory bank. This is useful for resetting the consolidated knowledge. - // - // DELETE /v1/default/banks/{bank_id}/observations - ClearObservations(ctx context.Context, params ClearObservationsParams) (ClearObservationsRes, error) - // CreateDirective invokes create_directive operation. - // - // Create a hard rule that will be injected into prompts. - // - // POST /v1/default/banks/{bank_id}/directives - CreateDirective(ctx context.Context, request *CreateDirectiveRequest, params CreateDirectiveParams) (CreateDirectiveRes, error) - // CreateMentalModel invokes create_mental_model operation. - // - // Create a mental model by running reflect with the source query in the background. Returns an - // operation ID to track progress. The content is auto-generated by the reflect endpoint. Use the - // operations endpoint to check completion status. - // - // POST /v1/default/banks/{bank_id}/mental-models - CreateMentalModel(ctx context.Context, request *CreateMentalModelRequest, params CreateMentalModelParams) (CreateMentalModelRes, error) - // CreateOrUpdateBank invokes create_or_update_bank operation. - // - // Create a new agent or update existing agent with disposition and mission. Auto-fills missing - // fields with defaults. - // - // PUT /v1/default/banks/{bank_id} - CreateOrUpdateBank(ctx context.Context, request *CreateBankRequest, params CreateOrUpdateBankParams) (CreateOrUpdateBankRes, error) - // DeleteBank invokes delete_bank operation. - // - // Delete an entire memory bank including all memories, entities, documents, and the bank profile - // itself. This is a destructive operation that cannot be undone. - // - // DELETE /v1/default/banks/{bank_id} - DeleteBank(ctx context.Context, params DeleteBankParams) (DeleteBankRes, error) - // DeleteDirective invokes delete_directive operation. - // - // Delete a directive. - // - // DELETE /v1/default/banks/{bank_id}/directives/{directive_id} - DeleteDirective(ctx context.Context, params DeleteDirectiveParams) (DeleteDirectiveRes, error) - // DeleteDocument invokes delete_document operation. - // - // Delete a document and all its associated memory units and links. - // This will cascade delete: - // - The document itself - // - All memory units extracted from this document - // - All links (temporal, semantic, entity) associated with those memory units - // This operation cannot be undone. - // - // DELETE /v1/default/banks/{bank_id}/documents/{document_id} - DeleteDocument(ctx context.Context, params DeleteDocumentParams) (DeleteDocumentRes, error) - // DeleteMentalModel invokes delete_mental_model operation. - // - // Delete a mental model. - // - // DELETE /v1/default/banks/{bank_id}/mental-models/{mental_model_id} - DeleteMentalModel(ctx context.Context, params DeleteMentalModelParams) (DeleteMentalModelRes, error) - // GetAgentStats invokes get_agent_stats operation. - // - // Get statistics about nodes and links for a specific agent. - // - // GET /v1/default/banks/{bank_id}/stats - GetAgentStats(ctx context.Context, params GetAgentStatsParams) (GetAgentStatsRes, error) - // GetBankConfig invokes get_bank_config operation. - // - // Get fully resolved configuration for a bank including all hierarchical overrides (global → - // tenant → bank). The 'config' field contains all resolved config values. The 'overrides' field - // shows only bank-specific overrides. - // - // GET /v1/default/banks/{bank_id}/config - GetBankConfig(ctx context.Context, params GetBankConfigParams) (GetBankConfigRes, error) - // GetBankProfile invokes get_bank_profile operation. - // - // Get disposition traits and mission for a memory bank. Auto-creates agent with defaults if not - // exists. - // - // GET /v1/default/banks/{bank_id}/profile - GetBankProfile(ctx context.Context, params GetBankProfileParams) (GetBankProfileRes, error) - // GetChunk invokes get_chunk operation. - // - // Get a specific chunk by its ID. - // - // GET /v1/default/chunks/{chunk_id} - GetChunk(ctx context.Context, params GetChunkParams) (GetChunkRes, error) - // GetDirective invokes get_directive operation. - // - // Get a specific directive by ID. - // - // GET /v1/default/banks/{bank_id}/directives/{directive_id} - GetDirective(ctx context.Context, params GetDirectiveParams) (GetDirectiveRes, error) - // GetDocument invokes get_document operation. - // - // Get a specific document including its original text. - // - // GET /v1/default/banks/{bank_id}/documents/{document_id} - GetDocument(ctx context.Context, params GetDocumentParams) (GetDocumentRes, error) - // GetEntity invokes get_entity operation. - // - // Get detailed information about an entity including observations (mental model). - // - // GET /v1/default/banks/{bank_id}/entities/{entity_id} - GetEntity(ctx context.Context, params GetEntityParams) (GetEntityRes, error) - // GetGraph invokes get_graph operation. - // - // Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). - // - // GET /v1/default/banks/{bank_id}/graph - GetGraph(ctx context.Context, params GetGraphParams) (GetGraphRes, error) - // GetMemory invokes get_memory operation. - // - // Get a single memory unit by ID with all its metadata including entities and tags. - // - // GET /v1/default/banks/{bank_id}/memories/{memory_id} - GetMemory(ctx context.Context, params GetMemoryParams) (GetMemoryRes, error) - // GetMentalModel invokes get_mental_model operation. - // - // Get a specific mental model by ID. - // - // GET /v1/default/banks/{bank_id}/mental-models/{mental_model_id} - GetMentalModel(ctx context.Context, params GetMentalModelParams) (GetMentalModelRes, error) - // GetOperationStatus invokes get_operation_status operation. - // - // Get the status of a specific async operation. Returns 'pending', 'completed', or 'failed'. - // Completed operations are removed from storage, so 'completed' means the operation finished - // successfully. - // - // GET /v1/default/banks/{bank_id}/operations/{operation_id} - GetOperationStatus(ctx context.Context, params GetOperationStatusParams) (GetOperationStatusRes, error) - // GetVersion invokes get_version operation. - // - // Returns API version information and enabled feature flags. Use this to check which capabilities - // are available in this deployment. - // - // GET /version - GetVersion(ctx context.Context) (*VersionResponse, error) - // HealthEndpointHealthGet invokes health_endpoint_health_get operation. - // - // Checks the health of the API and database connection. - // - // GET /health - HealthEndpointHealthGet(ctx context.Context) (jx.Raw, error) - // ListBanks invokes list_banks operation. - // - // Get a list of all agents with their profiles. - // - // GET /v1/default/banks - ListBanks(ctx context.Context) (ListBanksRes, error) - // ListDirectives invokes list_directives operation. - // - // List hard rules that are injected into prompts. - // - // GET /v1/default/banks/{bank_id}/directives - ListDirectives(ctx context.Context, params ListDirectivesParams) (ListDirectivesRes, error) - // ListDocuments invokes list_documents operation. - // - // List documents with pagination and optional search. Documents are the source content from which - // memory units are extracted. - // - // GET /v1/default/banks/{bank_id}/documents - ListDocuments(ctx context.Context, params ListDocumentsParams) (ListDocumentsRes, error) - // ListEntities invokes list_entities operation. - // - // List all entities (people, organizations, etc.) known by the bank, ordered by mention count. - // Supports pagination. - // - // GET /v1/default/banks/{bank_id}/entities - ListEntities(ctx context.Context, params ListEntitiesParams) (ListEntitiesRes, error) - // ListMemories invokes list_memories operation. - // - // List memory units with pagination and optional full-text search. Supports filtering by type. - // Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). - // - // GET /v1/default/banks/{bank_id}/memories/list - ListMemories(ctx context.Context, params ListMemoriesParams) (ListMemoriesRes, error) - // ListMentalModels invokes list_mental_models operation. - // - // List user-curated living documents that stay current. - // - // GET /v1/default/banks/{bank_id}/mental-models - ListMentalModels(ctx context.Context, params ListMentalModelsParams) (ListMentalModelsRes, error) - // ListOperations invokes list_operations operation. - // - // Get a list of async operations for a specific agent, with optional filtering by status. Results - // are sorted by most recent first. - // - // GET /v1/default/banks/{bank_id}/operations - ListOperations(ctx context.Context, params ListOperationsParams) (ListOperationsRes, error) - // ListTags invokes list_tags operation. - // - // List all unique tags in a memory bank with usage counts. Supports wildcard search using '*' (e.g., - // 'user:*', '*-fred', 'tag*-2'). Case-insensitive. - // - // GET /v1/default/banks/{bank_id}/tags - ListTags(ctx context.Context, params ListTagsParams) (ListTagsRes, error) - // MetricsEndpointMetricsGet invokes metrics_endpoint_metrics_get operation. - // - // Exports metrics in Prometheus format for scraping. - // - // GET /metrics - MetricsEndpointMetricsGet(ctx context.Context) (jx.Raw, error) - // RecallMemories invokes recall_memories operation. - // - // Recall memory using semantic similarity and spreading activation. - // The type parameter is optional and must be one of: - // - `world`: General knowledge about people, places, events, and things that happen - // - `experience`: Memories about experience, conversations, actions taken, and tasks performed. - // - // POST /v1/default/banks/{bank_id}/memories/recall - RecallMemories(ctx context.Context, request *RecallRequest, params RecallMemoriesParams) (RecallMemoriesRes, error) - // Reflect invokes reflect operation. - // - // Reflect and formulate an answer using bank identity, world facts, and opinions. - // This endpoint: - // 1. Retrieves experience (conversations and events) - // 2. Retrieves world facts relevant to the query - // 3. Retrieves existing opinions (bank's perspectives) - // 4. Uses LLM to formulate a contextual answer - // 5. Returns plain text answer and the facts used. - // - // POST /v1/default/banks/{bank_id}/reflect - Reflect(ctx context.Context, request *ReflectRequest, params ReflectParams) (ReflectRes, error) - // RefreshMentalModel invokes refresh_mental_model operation. - // - // Submit an async task to re-run the source query through reflect and update the content. - // - // POST /v1/default/banks/{bank_id}/mental-models/{mental_model_id}/refresh - RefreshMentalModel(ctx context.Context, params RefreshMentalModelParams) (RefreshMentalModelRes, error) - // RegenerateEntityObservations invokes regenerate_entity_observations operation. - // - // This endpoint is deprecated. Entity observations have been replaced by mental models. - // - // Deprecated: schema marks this operation as deprecated. - // - // POST /v1/default/banks/{bank_id}/entities/{entity_id}/regenerate - RegenerateEntityObservations(ctx context.Context, params RegenerateEntityObservationsParams) (RegenerateEntityObservationsRes, error) - // ResetBankConfig invokes reset_bank_config operation. - // - // Reset bank configuration to defaults by removing all bank-specific overrides. The bank will then - // use global and tenant-level configuration only. - // - // DELETE /v1/default/banks/{bank_id}/config - ResetBankConfig(ctx context.Context, params ResetBankConfigParams) (ResetBankConfigRes, error) - // RetainMemories invokes retain_memories operation. - // - // Retain memory items with automatic fact extraction. - // This is the main endpoint for storing memories. It supports both synchronous and asynchronous - // processing via the `async` parameter. - // **Features:** - // - Efficient batch processing - // - Automatic fact extraction from natural language - // - Entity recognition and linking - // - Document tracking with automatic upsert (when document_id is provided) - // - Temporal and semantic linking - // - Optional asynchronous processing - // **The system automatically:** - // 1. Extracts semantic facts from the content - // 2. Generates embeddings - // 3. Deduplicates similar facts - // 4. Creates temporal, semantic, and entity links - // 5. Tracks document metadata - // **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor - // progress. - // **When `async=false` (default):** Waits for processing to complete. - // **Note:** If a memory item has a `document_id` that already exists, the old document and its - // memory units will be deleted before creating new ones (upsert behavior). - // - // POST /v1/default/banks/{bank_id}/memories - RetainMemories(ctx context.Context, request *RetainRequest, params RetainMemoriesParams) (RetainMemoriesRes, error) - // TriggerConsolidation invokes trigger_consolidation operation. - // - // Run memory consolidation to create/update observations from recent memories. - // - // POST /v1/default/banks/{bank_id}/consolidate - TriggerConsolidation(ctx context.Context, params TriggerConsolidationParams) (TriggerConsolidationRes, error) - // UpdateBank invokes update_bank operation. - // - // Partially update an agent's profile. Only provided fields will be updated. - // - // PATCH /v1/default/banks/{bank_id} - UpdateBank(ctx context.Context, request *CreateBankRequest, params UpdateBankParams) (UpdateBankRes, error) - // UpdateBankConfig invokes update_bank_config operation. - // - // Update configuration overrides for a bank. Only hierarchical fields can be overridden (LLM - // settings, retention parameters, etc.). Keys can be provided in Python field format (llm_provider) - // or environment variable format (HINDSIGHT_API_LLM_PROVIDER). - // - // PATCH /v1/default/banks/{bank_id}/config - UpdateBankConfig(ctx context.Context, request *BankConfigUpdate, params UpdateBankConfigParams) (UpdateBankConfigRes, error) - // UpdateBankDisposition invokes update_bank_disposition operation. - // - // Update bank's disposition traits (skepticism, literalism, empathy). - // - // PUT /v1/default/banks/{bank_id}/profile - UpdateBankDisposition(ctx context.Context, request *UpdateDispositionRequest, params UpdateBankDispositionParams) (UpdateBankDispositionRes, error) - // UpdateDirective invokes update_directive operation. - // - // Update a directive's properties. - // - // PATCH /v1/default/banks/{bank_id}/directives/{directive_id} - UpdateDirective(ctx context.Context, request *UpdateDirectiveRequest, params UpdateDirectiveParams) (UpdateDirectiveRes, error) - // UpdateMentalModel invokes update_mental_model operation. - // - // Update a mental model's name and/or source query. - // - // PATCH /v1/default/banks/{bank_id}/mental-models/{mental_model_id} - UpdateMentalModel(ctx context.Context, request *UpdateMentalModelRequest, params UpdateMentalModelParams) (UpdateMentalModelRes, error) -} - -// Client implements OAS client. -type Client struct { - serverURL *url.URL - baseClient -} - -// NewClient initializes new Client defined by OAS. -func NewClient(serverURL string, opts ...ClientOption) (*Client, error) { - u, err := url.Parse(serverURL) - if err != nil { - return nil, err - } - trimTrailingSlashes(u) - - c, err := newClientConfig(opts...).baseClient() - if err != nil { - return nil, err - } - return &Client{ - serverURL: u, - baseClient: c, - }, nil -} - -type serverURLKey struct{} - -// WithServerURL sets context key to override server URL. -func WithServerURL(ctx context.Context, u *url.URL) context.Context { - return context.WithValue(ctx, serverURLKey{}, u) -} - -func (c *Client) requestURL(ctx context.Context) *url.URL { - u, ok := ctx.Value(serverURLKey{}).(*url.URL) - if !ok { - return c.serverURL - } - return u -} - -// AddBankBackground invokes add_bank_background operation. -// -// Deprecated: Use PUT /mission instead. This endpoint now updates the mission field. -// -// Deprecated: schema marks this operation as deprecated. -// -// POST /v1/default/banks/{bank_id}/background -func (c *Client) AddBankBackground(ctx context.Context, request *AddBackgroundRequest, params AddBankBackgroundParams) (AddBankBackgroundRes, error) { - res, err := c.sendAddBankBackground(ctx, request, params) - return res, err -} - -func (c *Client) sendAddBankBackground(ctx context.Context, request *AddBackgroundRequest, params AddBankBackgroundParams) (res AddBankBackgroundRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/background" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeAddBankBackgroundRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeAddBankBackgroundResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// CancelOperation invokes cancel_operation operation. -// -// Cancel a pending async operation by removing it from the queue. -// -// DELETE /v1/default/banks/{bank_id}/operations/{operation_id} -func (c *Client) CancelOperation(ctx context.Context, params CancelOperationParams) (CancelOperationRes, error) { - res, err := c.sendCancelOperation(ctx, params) - return res, err -} - -func (c *Client) sendCancelOperation(ctx context.Context, params CancelOperationParams) (res CancelOperationRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/operations/" - { - // Encode "operation_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "operation_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.OperationID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeCancelOperationResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ClearBankMemories invokes clear_bank_memories operation. -// -// Delete memory units for a memory bank. Optionally filter by type (world, experience, opinion) to -// delete only specific types. This is a destructive operation that cannot be undone. The bank -// profile (disposition and background) will be preserved. -// -// DELETE /v1/default/banks/{bank_id}/memories -func (c *Client) ClearBankMemories(ctx context.Context, params ClearBankMemoriesParams) (ClearBankMemoriesRes, error) { - res, err := c.sendClearBankMemories(ctx, params) - return res, err -} - -func (c *Client) sendClearBankMemories(ctx context.Context, params ClearBankMemoriesParams) (res ClearBankMemoriesRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/memories" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "type" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "type", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Type.Get(); ok { - return e.EncodeValue(conv.StringToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeClearBankMemoriesResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ClearObservations invokes clear_observations operation. -// -// Delete all observations for a memory bank. This is useful for resetting the consolidated knowledge. -// -// DELETE /v1/default/banks/{bank_id}/observations -func (c *Client) ClearObservations(ctx context.Context, params ClearObservationsParams) (ClearObservationsRes, error) { - res, err := c.sendClearObservations(ctx, params) - return res, err -} - -func (c *Client) sendClearObservations(ctx context.Context, params ClearObservationsParams) (res ClearObservationsRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/observations" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeClearObservationsResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// CreateDirective invokes create_directive operation. -// -// Create a hard rule that will be injected into prompts. -// -// POST /v1/default/banks/{bank_id}/directives -func (c *Client) CreateDirective(ctx context.Context, request *CreateDirectiveRequest, params CreateDirectiveParams) (CreateDirectiveRes, error) { - res, err := c.sendCreateDirective(ctx, request, params) - return res, err -} - -func (c *Client) sendCreateDirective(ctx context.Context, request *CreateDirectiveRequest, params CreateDirectiveParams) (res CreateDirectiveRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/directives" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeCreateDirectiveRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeCreateDirectiveResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// CreateMentalModel invokes create_mental_model operation. -// -// Create a mental model by running reflect with the source query in the background. Returns an -// operation ID to track progress. The content is auto-generated by the reflect endpoint. Use the -// operations endpoint to check completion status. -// -// POST /v1/default/banks/{bank_id}/mental-models -func (c *Client) CreateMentalModel(ctx context.Context, request *CreateMentalModelRequest, params CreateMentalModelParams) (CreateMentalModelRes, error) { - res, err := c.sendCreateMentalModel(ctx, request, params) - return res, err -} - -func (c *Client) sendCreateMentalModel(ctx context.Context, request *CreateMentalModelRequest, params CreateMentalModelParams) (res CreateMentalModelRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/mental-models" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeCreateMentalModelRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeCreateMentalModelResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// CreateOrUpdateBank invokes create_or_update_bank operation. -// -// Create a new agent or update existing agent with disposition and mission. Auto-fills missing -// fields with defaults. -// -// PUT /v1/default/banks/{bank_id} -func (c *Client) CreateOrUpdateBank(ctx context.Context, request *CreateBankRequest, params CreateOrUpdateBankParams) (CreateOrUpdateBankRes, error) { - res, err := c.sendCreateOrUpdateBank(ctx, request, params) - return res, err -} - -func (c *Client) sendCreateOrUpdateBank(ctx context.Context, request *CreateBankRequest, params CreateOrUpdateBankParams) (res CreateOrUpdateBankRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [2]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "PUT", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeCreateOrUpdateBankRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeCreateOrUpdateBankResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// DeleteBank invokes delete_bank operation. -// -// Delete an entire memory bank including all memories, entities, documents, and the bank profile -// itself. This is a destructive operation that cannot be undone. -// -// DELETE /v1/default/banks/{bank_id} -func (c *Client) DeleteBank(ctx context.Context, params DeleteBankParams) (DeleteBankRes, error) { - res, err := c.sendDeleteBank(ctx, params) - return res, err -} - -func (c *Client) sendDeleteBank(ctx context.Context, params DeleteBankParams) (res DeleteBankRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [2]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeDeleteBankResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// DeleteDirective invokes delete_directive operation. -// -// Delete a directive. -// -// DELETE /v1/default/banks/{bank_id}/directives/{directive_id} -func (c *Client) DeleteDirective(ctx context.Context, params DeleteDirectiveParams) (DeleteDirectiveRes, error) { - res, err := c.sendDeleteDirective(ctx, params) - return res, err -} - -func (c *Client) sendDeleteDirective(ctx context.Context, params DeleteDirectiveParams) (res DeleteDirectiveRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/directives/" - { - // Encode "directive_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "directive_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.DirectiveID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeDeleteDirectiveResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// DeleteDocument invokes delete_document operation. -// -// Delete a document and all its associated memory units and links. -// This will cascade delete: -// - The document itself -// - All memory units extracted from this document -// - All links (temporal, semantic, entity) associated with those memory units -// This operation cannot be undone. -// -// DELETE /v1/default/banks/{bank_id}/documents/{document_id} -func (c *Client) DeleteDocument(ctx context.Context, params DeleteDocumentParams) (DeleteDocumentRes, error) { - res, err := c.sendDeleteDocument(ctx, params) - return res, err -} - -func (c *Client) sendDeleteDocument(ctx context.Context, params DeleteDocumentParams) (res DeleteDocumentRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/documents/" - { - // Encode "document_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "document_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.DocumentID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeDeleteDocumentResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// DeleteMentalModel invokes delete_mental_model operation. -// -// Delete a mental model. -// -// DELETE /v1/default/banks/{bank_id}/mental-models/{mental_model_id} -func (c *Client) DeleteMentalModel(ctx context.Context, params DeleteMentalModelParams) (DeleteMentalModelRes, error) { - res, err := c.sendDeleteMentalModel(ctx, params) - return res, err -} - -func (c *Client) sendDeleteMentalModel(ctx context.Context, params DeleteMentalModelParams) (res DeleteMentalModelRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/mental-models/" - { - // Encode "mental_model_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "mental_model_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.MentalModelID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeDeleteMentalModelResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetAgentStats invokes get_agent_stats operation. -// -// Get statistics about nodes and links for a specific agent. -// -// GET /v1/default/banks/{bank_id}/stats -func (c *Client) GetAgentStats(ctx context.Context, params GetAgentStatsParams) (GetAgentStatsRes, error) { - res, err := c.sendGetAgentStats(ctx, params) - return res, err -} - -func (c *Client) sendGetAgentStats(ctx context.Context, params GetAgentStatsParams) (res GetAgentStatsRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/stats" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetAgentStatsResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetBankConfig invokes get_bank_config operation. -// -// Get fully resolved configuration for a bank including all hierarchical overrides (global → -// tenant → bank). The 'config' field contains all resolved config values. The 'overrides' field -// shows only bank-specific overrides. -// -// GET /v1/default/banks/{bank_id}/config -func (c *Client) GetBankConfig(ctx context.Context, params GetBankConfigParams) (GetBankConfigRes, error) { - res, err := c.sendGetBankConfig(ctx, params) - return res, err -} - -func (c *Client) sendGetBankConfig(ctx context.Context, params GetBankConfigParams) (res GetBankConfigRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/config" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetBankConfigResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetBankProfile invokes get_bank_profile operation. -// -// Get disposition traits and mission for a memory bank. Auto-creates agent with defaults if not -// exists. -// -// GET /v1/default/banks/{bank_id}/profile -func (c *Client) GetBankProfile(ctx context.Context, params GetBankProfileParams) (GetBankProfileRes, error) { - res, err := c.sendGetBankProfile(ctx, params) - return res, err -} - -func (c *Client) sendGetBankProfile(ctx context.Context, params GetBankProfileParams) (res GetBankProfileRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/profile" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetBankProfileResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetChunk invokes get_chunk operation. -// -// Get a specific chunk by its ID. -// -// GET /v1/default/chunks/{chunk_id} -func (c *Client) GetChunk(ctx context.Context, params GetChunkParams) (GetChunkRes, error) { - res, err := c.sendGetChunk(ctx, params) - return res, err -} - -func (c *Client) sendGetChunk(ctx context.Context, params GetChunkParams) (res GetChunkRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [2]string - pathParts[0] = "/v1/default/chunks/" - { - // Encode "chunk_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "chunk_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.ChunkID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetChunkResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetDirective invokes get_directive operation. -// -// Get a specific directive by ID. -// -// GET /v1/default/banks/{bank_id}/directives/{directive_id} -func (c *Client) GetDirective(ctx context.Context, params GetDirectiveParams) (GetDirectiveRes, error) { - res, err := c.sendGetDirective(ctx, params) - return res, err -} - -func (c *Client) sendGetDirective(ctx context.Context, params GetDirectiveParams) (res GetDirectiveRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/directives/" - { - // Encode "directive_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "directive_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.DirectiveID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetDirectiveResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetDocument invokes get_document operation. -// -// Get a specific document including its original text. -// -// GET /v1/default/banks/{bank_id}/documents/{document_id} -func (c *Client) GetDocument(ctx context.Context, params GetDocumentParams) (GetDocumentRes, error) { - res, err := c.sendGetDocument(ctx, params) - return res, err -} - -func (c *Client) sendGetDocument(ctx context.Context, params GetDocumentParams) (res GetDocumentRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/documents/" - { - // Encode "document_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "document_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.DocumentID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetDocumentResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetEntity invokes get_entity operation. -// -// Get detailed information about an entity including observations (mental model). -// -// GET /v1/default/banks/{bank_id}/entities/{entity_id} -func (c *Client) GetEntity(ctx context.Context, params GetEntityParams) (GetEntityRes, error) { - res, err := c.sendGetEntity(ctx, params) - return res, err -} - -func (c *Client) sendGetEntity(ctx context.Context, params GetEntityParams) (res GetEntityRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/entities/" - { - // Encode "entity_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "entity_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.EntityID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetEntityResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetGraph invokes get_graph operation. -// -// Retrieve graph data for visualization, optionally filtered by type (world/experience/opinion). -// -// GET /v1/default/banks/{bank_id}/graph -func (c *Client) GetGraph(ctx context.Context, params GetGraphParams) (GetGraphRes, error) { - res, err := c.sendGetGraph(ctx, params) - return res, err -} - -func (c *Client) sendGetGraph(ctx context.Context, params GetGraphParams) (res GetGraphRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/graph" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "type" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "type", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Type.Get(); ok { - return e.EncodeValue(conv.StringToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetGraphResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetMemory invokes get_memory operation. -// -// Get a single memory unit by ID with all its metadata including entities and tags. -// -// GET /v1/default/banks/{bank_id}/memories/{memory_id} -func (c *Client) GetMemory(ctx context.Context, params GetMemoryParams) (GetMemoryRes, error) { - res, err := c.sendGetMemory(ctx, params) - return res, err -} - -func (c *Client) sendGetMemory(ctx context.Context, params GetMemoryParams) (res GetMemoryRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/memories/" - { - // Encode "memory_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "memory_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.MemoryID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetMemoryResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetMentalModel invokes get_mental_model operation. -// -// Get a specific mental model by ID. -// -// GET /v1/default/banks/{bank_id}/mental-models/{mental_model_id} -func (c *Client) GetMentalModel(ctx context.Context, params GetMentalModelParams) (GetMentalModelRes, error) { - res, err := c.sendGetMentalModel(ctx, params) - return res, err -} - -func (c *Client) sendGetMentalModel(ctx context.Context, params GetMentalModelParams) (res GetMentalModelRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/mental-models/" - { - // Encode "mental_model_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "mental_model_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.MentalModelID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetMentalModelResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetOperationStatus invokes get_operation_status operation. -// -// Get the status of a specific async operation. Returns 'pending', 'completed', or 'failed'. -// Completed operations are removed from storage, so 'completed' means the operation finished -// successfully. -// -// GET /v1/default/banks/{bank_id}/operations/{operation_id} -func (c *Client) GetOperationStatus(ctx context.Context, params GetOperationStatusParams) (GetOperationStatusRes, error) { - res, err := c.sendGetOperationStatus(ctx, params) - return res, err -} - -func (c *Client) sendGetOperationStatus(ctx context.Context, params GetOperationStatusParams) (res GetOperationStatusRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/operations/" - { - // Encode "operation_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "operation_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.OperationID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetOperationStatusResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// GetVersion invokes get_version operation. -// -// Returns API version information and enabled feature flags. Use this to check which capabilities -// are available in this deployment. -// -// GET /version -func (c *Client) GetVersion(ctx context.Context) (*VersionResponse, error) { - res, err := c.sendGetVersion(ctx) - return res, err -} - -func (c *Client) sendGetVersion(ctx context.Context) (res *VersionResponse, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [1]string - pathParts[0] = "/version" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeGetVersionResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// HealthEndpointHealthGet invokes health_endpoint_health_get operation. -// -// Checks the health of the API and database connection. -// -// GET /health -func (c *Client) HealthEndpointHealthGet(ctx context.Context) (jx.Raw, error) { - res, err := c.sendHealthEndpointHealthGet(ctx) - return res, err -} - -func (c *Client) sendHealthEndpointHealthGet(ctx context.Context) (res jx.Raw, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [1]string - pathParts[0] = "/health" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeHealthEndpointHealthGetResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListBanks invokes list_banks operation. -// -// Get a list of all agents with their profiles. -// -// GET /v1/default/banks -func (c *Client) ListBanks(ctx context.Context) (ListBanksRes, error) { - res, err := c.sendListBanks(ctx) - return res, err -} - -func (c *Client) sendListBanks(ctx context.Context) (res ListBanksRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [1]string - pathParts[0] = "/v1/default/banks" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListBanksResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListDirectives invokes list_directives operation. -// -// List hard rules that are injected into prompts. -// -// GET /v1/default/banks/{bank_id}/directives -func (c *Client) ListDirectives(ctx context.Context, params ListDirectivesParams) (ListDirectivesRes, error) { - res, err := c.sendListDirectives(ctx, params) - return res, err -} - -func (c *Client) sendListDirectives(ctx context.Context, params ListDirectivesParams) (res ListDirectivesRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/directives" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "tags" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "tags", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if params.Tags != nil { - return e.EncodeArray(func(e uri.Encoder) error { - for i, item := range params.Tags { - if err := func() error { - return e.EncodeValue(conv.StringToString(item)) - }(); err != nil { - return errors.Wrapf(err, "[%d]", i) - } - } - return nil - }) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "tags_match" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "tags_match", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.TagsMatch.Get(); ok { - return e.EncodeValue(conv.StringToString(string(val))) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "active_only" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "active_only", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.ActiveOnly.Get(); ok { - return e.EncodeValue(conv.BoolToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "offset" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "offset", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Offset.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListDirectivesResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListDocuments invokes list_documents operation. -// -// List documents with pagination and optional search. Documents are the source content from which -// memory units are extracted. -// -// GET /v1/default/banks/{bank_id}/documents -func (c *Client) ListDocuments(ctx context.Context, params ListDocumentsParams) (ListDocumentsRes, error) { - res, err := c.sendListDocuments(ctx, params) - return res, err -} - -func (c *Client) sendListDocuments(ctx context.Context, params ListDocumentsParams) (res ListDocumentsRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/documents" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "q" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "q", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Q.Get(); ok { - return e.EncodeValue(conv.StringToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "offset" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "offset", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Offset.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListDocumentsResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListEntities invokes list_entities operation. -// -// List all entities (people, organizations, etc.) known by the bank, ordered by mention count. -// Supports pagination. -// -// GET /v1/default/banks/{bank_id}/entities -func (c *Client) ListEntities(ctx context.Context, params ListEntitiesParams) (ListEntitiesRes, error) { - res, err := c.sendListEntities(ctx, params) - return res, err -} - -func (c *Client) sendListEntities(ctx context.Context, params ListEntitiesParams) (res ListEntitiesRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/entities" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "offset" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "offset", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Offset.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListEntitiesResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListMemories invokes list_memories operation. -// -// List memory units with pagination and optional full-text search. Supports filtering by type. -// Results are sorted by most recent first (mentioned_at DESC, then created_at DESC). -// -// GET /v1/default/banks/{bank_id}/memories/list -func (c *Client) ListMemories(ctx context.Context, params ListMemoriesParams) (ListMemoriesRes, error) { - res, err := c.sendListMemories(ctx, params) - return res, err -} - -func (c *Client) sendListMemories(ctx context.Context, params ListMemoriesParams) (res ListMemoriesRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/memories/list" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "type" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "type", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Type.Get(); ok { - return e.EncodeValue(conv.StringToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "q" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "q", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Q.Get(); ok { - return e.EncodeValue(conv.StringToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "offset" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "offset", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Offset.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListMemoriesResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListMentalModels invokes list_mental_models operation. -// -// List user-curated living documents that stay current. -// -// GET /v1/default/banks/{bank_id}/mental-models -func (c *Client) ListMentalModels(ctx context.Context, params ListMentalModelsParams) (ListMentalModelsRes, error) { - res, err := c.sendListMentalModels(ctx, params) - return res, err -} - -func (c *Client) sendListMentalModels(ctx context.Context, params ListMentalModelsParams) (res ListMentalModelsRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/mental-models" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "tags" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "tags", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if params.Tags != nil { - return e.EncodeArray(func(e uri.Encoder) error { - for i, item := range params.Tags { - if err := func() error { - return e.EncodeValue(conv.StringToString(item)) - }(); err != nil { - return errors.Wrapf(err, "[%d]", i) - } - } - return nil - }) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "tags_match" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "tags_match", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.TagsMatch.Get(); ok { - return e.EncodeValue(conv.StringToString(string(val))) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "offset" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "offset", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Offset.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListMentalModelsResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListOperations invokes list_operations operation. -// -// Get a list of async operations for a specific agent, with optional filtering by status. Results -// are sorted by most recent first. -// -// GET /v1/default/banks/{bank_id}/operations -func (c *Client) ListOperations(ctx context.Context, params ListOperationsParams) (ListOperationsRes, error) { - res, err := c.sendListOperations(ctx, params) - return res, err -} - -func (c *Client) sendListOperations(ctx context.Context, params ListOperationsParams) (res ListOperationsRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/operations" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "status" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "status", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Status.Get(); ok { - return e.EncodeValue(conv.StringToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "offset" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "offset", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Offset.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListOperationsResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ListTags invokes list_tags operation. -// -// List all unique tags in a memory bank with usage counts. Supports wildcard search using '*' (e.g., -// 'user:*', '*-fred', 'tag*-2'). Case-insensitive. -// -// GET /v1/default/banks/{bank_id}/tags -func (c *Client) ListTags(ctx context.Context, params ListTagsParams) (ListTagsRes, error) { - res, err := c.sendListTags(ctx, params) - return res, err -} - -func (c *Client) sendListTags(ctx context.Context, params ListTagsParams) (res ListTagsRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/tags" - uri.AddPathParts(u, pathParts[:]...) - - q := uri.NewQueryEncoder() - { - // Encode "q" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "q", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Q.Get(); ok { - return e.EncodeValue(conv.StringToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "limit" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "limit", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Limit.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - { - // Encode "offset" parameter. - cfg := uri.QueryParameterEncodingConfig{ - Name: "offset", - Style: uri.QueryStyleForm, - Explode: true, - } - - if err := q.EncodeParam(cfg, func(e uri.Encoder) error { - if val, ok := params.Offset.Get(); ok { - return e.EncodeValue(conv.IntToString(val)) - } - return nil - }); err != nil { - return res, errors.Wrap(err, "encode query") - } - } - u.RawQuery = q.Values().Encode() - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeListTagsResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// MetricsEndpointMetricsGet invokes metrics_endpoint_metrics_get operation. -// -// Exports metrics in Prometheus format for scraping. -// -// GET /metrics -func (c *Client) MetricsEndpointMetricsGet(ctx context.Context) (jx.Raw, error) { - res, err := c.sendMetricsEndpointMetricsGet(ctx) - return res, err -} - -func (c *Client) sendMetricsEndpointMetricsGet(ctx context.Context) (res jx.Raw, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [1]string - pathParts[0] = "/metrics" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "GET", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeMetricsEndpointMetricsGetResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// RecallMemories invokes recall_memories operation. -// -// Recall memory using semantic similarity and spreading activation. -// The type parameter is optional and must be one of: -// - `world`: General knowledge about people, places, events, and things that happen -// - `experience`: Memories about experience, conversations, actions taken, and tasks performed. -// -// POST /v1/default/banks/{bank_id}/memories/recall -func (c *Client) RecallMemories(ctx context.Context, request *RecallRequest, params RecallMemoriesParams) (RecallMemoriesRes, error) { - res, err := c.sendRecallMemories(ctx, request, params) - return res, err -} - -func (c *Client) sendRecallMemories(ctx context.Context, request *RecallRequest, params RecallMemoriesParams) (res RecallMemoriesRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/memories/recall" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeRecallMemoriesRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeRecallMemoriesResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// Reflect invokes reflect operation. -// -// Reflect and formulate an answer using bank identity, world facts, and opinions. -// This endpoint: -// 1. Retrieves experience (conversations and events) -// 2. Retrieves world facts relevant to the query -// 3. Retrieves existing opinions (bank's perspectives) -// 4. Uses LLM to formulate a contextual answer -// 5. Returns plain text answer and the facts used. -// -// POST /v1/default/banks/{bank_id}/reflect -func (c *Client) Reflect(ctx context.Context, request *ReflectRequest, params ReflectParams) (ReflectRes, error) { - res, err := c.sendReflect(ctx, request, params) - return res, err -} - -func (c *Client) sendReflect(ctx context.Context, request *ReflectRequest, params ReflectParams) (res ReflectRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/reflect" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeReflectRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeReflectResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// RefreshMentalModel invokes refresh_mental_model operation. -// -// Submit an async task to re-run the source query through reflect and update the content. -// -// POST /v1/default/banks/{bank_id}/mental-models/{mental_model_id}/refresh -func (c *Client) RefreshMentalModel(ctx context.Context, params RefreshMentalModelParams) (RefreshMentalModelRes, error) { - res, err := c.sendRefreshMentalModel(ctx, params) - return res, err -} - -func (c *Client) sendRefreshMentalModel(ctx context.Context, params RefreshMentalModelParams) (res RefreshMentalModelRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [5]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/mental-models/" - { - // Encode "mental_model_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "mental_model_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.MentalModelID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - pathParts[4] = "/refresh" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeRefreshMentalModelResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// RegenerateEntityObservations invokes regenerate_entity_observations operation. -// -// This endpoint is deprecated. Entity observations have been replaced by mental models. -// -// Deprecated: schema marks this operation as deprecated. -// -// POST /v1/default/banks/{bank_id}/entities/{entity_id}/regenerate -func (c *Client) RegenerateEntityObservations(ctx context.Context, params RegenerateEntityObservationsParams) (RegenerateEntityObservationsRes, error) { - res, err := c.sendRegenerateEntityObservations(ctx, params) - return res, err -} - -func (c *Client) sendRegenerateEntityObservations(ctx context.Context, params RegenerateEntityObservationsParams) (res RegenerateEntityObservationsRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [5]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/entities/" - { - // Encode "entity_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "entity_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.EntityID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - pathParts[4] = "/regenerate" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeRegenerateEntityObservationsResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// ResetBankConfig invokes reset_bank_config operation. -// -// Reset bank configuration to defaults by removing all bank-specific overrides. The bank will then -// use global and tenant-level configuration only. -// -// DELETE /v1/default/banks/{bank_id}/config -func (c *Client) ResetBankConfig(ctx context.Context, params ResetBankConfigParams) (ResetBankConfigRes, error) { - res, err := c.sendResetBankConfig(ctx, params) - return res, err -} - -func (c *Client) sendResetBankConfig(ctx context.Context, params ResetBankConfigParams) (res ResetBankConfigRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/config" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "DELETE", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeResetBankConfigResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// RetainMemories invokes retain_memories operation. -// -// Retain memory items with automatic fact extraction. -// This is the main endpoint for storing memories. It supports both synchronous and asynchronous -// processing via the `async` parameter. -// **Features:** -// - Efficient batch processing -// - Automatic fact extraction from natural language -// - Entity recognition and linking -// - Document tracking with automatic upsert (when document_id is provided) -// - Temporal and semantic linking -// - Optional asynchronous processing -// **The system automatically:** -// 1. Extracts semantic facts from the content -// 2. Generates embeddings -// 3. Deduplicates similar facts -// 4. Creates temporal, semantic, and entity links -// 5. Tracks document metadata -// **When `async=true`:** Returns immediately after queuing. Use the operations endpoint to monitor -// progress. -// **When `async=false` (default):** Waits for processing to complete. -// **Note:** If a memory item has a `document_id` that already exists, the old document and its -// memory units will be deleted before creating new ones (upsert behavior). -// -// POST /v1/default/banks/{bank_id}/memories -func (c *Client) RetainMemories(ctx context.Context, request *RetainRequest, params RetainMemoriesParams) (RetainMemoriesRes, error) { - res, err := c.sendRetainMemories(ctx, request, params) - return res, err -} - -func (c *Client) sendRetainMemories(ctx context.Context, request *RetainRequest, params RetainMemoriesParams) (res RetainMemoriesRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/memories" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeRetainMemoriesRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeRetainMemoriesResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// TriggerConsolidation invokes trigger_consolidation operation. -// -// Run memory consolidation to create/update observations from recent memories. -// -// POST /v1/default/banks/{bank_id}/consolidate -func (c *Client) TriggerConsolidation(ctx context.Context, params TriggerConsolidationParams) (TriggerConsolidationRes, error) { - res, err := c.sendTriggerConsolidation(ctx, params) - return res, err -} - -func (c *Client) sendTriggerConsolidation(ctx context.Context, params TriggerConsolidationParams) (res TriggerConsolidationRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/consolidate" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "POST", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeTriggerConsolidationResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// UpdateBank invokes update_bank operation. -// -// Partially update an agent's profile. Only provided fields will be updated. -// -// PATCH /v1/default/banks/{bank_id} -func (c *Client) UpdateBank(ctx context.Context, request *CreateBankRequest, params UpdateBankParams) (UpdateBankRes, error) { - res, err := c.sendUpdateBank(ctx, request, params) - return res, err -} - -func (c *Client) sendUpdateBank(ctx context.Context, request *CreateBankRequest, params UpdateBankParams) (res UpdateBankRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [2]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "PATCH", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeUpdateBankRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeUpdateBankResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// UpdateBankConfig invokes update_bank_config operation. -// -// Update configuration overrides for a bank. Only hierarchical fields can be overridden (LLM -// settings, retention parameters, etc.). Keys can be provided in Python field format (llm_provider) -// or environment variable format (HINDSIGHT_API_LLM_PROVIDER). -// -// PATCH /v1/default/banks/{bank_id}/config -func (c *Client) UpdateBankConfig(ctx context.Context, request *BankConfigUpdate, params UpdateBankConfigParams) (UpdateBankConfigRes, error) { - res, err := c.sendUpdateBankConfig(ctx, request, params) - return res, err -} - -func (c *Client) sendUpdateBankConfig(ctx context.Context, request *BankConfigUpdate, params UpdateBankConfigParams) (res UpdateBankConfigRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/config" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "PATCH", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeUpdateBankConfigRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeUpdateBankConfigResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// UpdateBankDisposition invokes update_bank_disposition operation. -// -// Update bank's disposition traits (skepticism, literalism, empathy). -// -// PUT /v1/default/banks/{bank_id}/profile -func (c *Client) UpdateBankDisposition(ctx context.Context, request *UpdateDispositionRequest, params UpdateBankDispositionParams) (UpdateBankDispositionRes, error) { - res, err := c.sendUpdateBankDisposition(ctx, request, params) - return res, err -} - -func (c *Client) sendUpdateBankDisposition(ctx context.Context, request *UpdateDispositionRequest, params UpdateBankDispositionParams) (res UpdateBankDispositionRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [3]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/profile" - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "PUT", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeUpdateBankDispositionRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeUpdateBankDispositionResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// UpdateDirective invokes update_directive operation. -// -// Update a directive's properties. -// -// PATCH /v1/default/banks/{bank_id}/directives/{directive_id} -func (c *Client) UpdateDirective(ctx context.Context, request *UpdateDirectiveRequest, params UpdateDirectiveParams) (UpdateDirectiveRes, error) { - res, err := c.sendUpdateDirective(ctx, request, params) - return res, err -} - -func (c *Client) sendUpdateDirective(ctx context.Context, request *UpdateDirectiveRequest, params UpdateDirectiveParams) (res UpdateDirectiveRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/directives/" - { - // Encode "directive_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "directive_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.DirectiveID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "PATCH", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeUpdateDirectiveRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeUpdateDirectiveResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} - -// UpdateMentalModel invokes update_mental_model operation. -// -// Update a mental model's name and/or source query. -// -// PATCH /v1/default/banks/{bank_id}/mental-models/{mental_model_id} -func (c *Client) UpdateMentalModel(ctx context.Context, request *UpdateMentalModelRequest, params UpdateMentalModelParams) (UpdateMentalModelRes, error) { - res, err := c.sendUpdateMentalModel(ctx, request, params) - return res, err -} - -func (c *Client) sendUpdateMentalModel(ctx context.Context, request *UpdateMentalModelRequest, params UpdateMentalModelParams) (res UpdateMentalModelRes, err error) { - - u := uri.Clone(c.requestURL(ctx)) - var pathParts [4]string - pathParts[0] = "/v1/default/banks/" - { - // Encode "bank_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "bank_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.BankID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[1] = encoded - } - pathParts[2] = "/mental-models/" - { - // Encode "mental_model_id" parameter. - e := uri.NewPathEncoder(uri.PathEncoderConfig{ - Param: "mental_model_id", - Style: uri.PathStyleSimple, - Explode: false, - }) - if err := func() error { - return e.EncodeValue(conv.StringToString(params.MentalModelID)) - }(); err != nil { - return res, errors.Wrap(err, "encode path") - } - encoded, err := e.Result() - if err != nil { - return res, errors.Wrap(err, "encode path") - } - pathParts[3] = encoded - } - uri.AddPathParts(u, pathParts[:]...) - - r, err := ht.NewRequest(ctx, "PATCH", u) - if err != nil { - return res, errors.Wrap(err, "create request") - } - if err := encodeUpdateMentalModelRequest(request, r); err != nil { - return res, errors.Wrap(err, "encode request") - } - - resp, err := c.cfg.Client.Do(r) - if err != nil { - return res, errors.Wrap(err, "do request") - } - defer resp.Body.Close() - - result, err := decodeUpdateMentalModelResponse(resp) - if err != nil { - return res, errors.Wrap(err, "decode response") - } - - return result, nil -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_defaults_gen.go b/hindsight-clients/go/internal/ogenapi/oas_defaults_gen.go deleted file mode 100644 index d60c9f18..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_defaults_gen.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -// setDefaults set default value of fields. -func (s *AddBackgroundRequest) setDefaults() { - { - val := bool(true) - s.UpdateDisposition.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *BankStatsResponse) setDefaults() { - { - val := int(0) - s.PendingConsolidation.SetTo(val) - } - { - val := int(0) - s.TotalObservations.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *ChunkData) setDefaults() { - { - val := bool(false) - s.Truncated.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *ChunkIncludeOptions) setDefaults() { - { - val := int(8192) - s.MaxTokens.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *ConsolidationResponse) setDefaults() { - { - val := bool(false) - s.Deduplicated.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *CreateDirectiveRequest) setDefaults() { - { - val := bool(true) - s.IsActive.SetTo(val) - } - { - val := int(0) - s.Priority.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *CreateMentalModelRequest) setDefaults() { - { - val := int(2048) - s.MaxTokens.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *DirectiveResponse) setDefaults() { - { - val := bool(true) - s.IsActive.SetTo(val) - } - { - val := int(0) - s.Priority.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *EntityIncludeOptions) setDefaults() { - { - val := int(500) - s.MaxTokens.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *MentalModelResponse) setDefaults() { - { - val := int(2048) - s.MaxTokens.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *MentalModelTrigger) setDefaults() { - { - val := bool(false) - s.RefreshAfterConsolidation.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *RecallRequest) setDefaults() { - { - val := Budget("low") - s.Budget.SetTo(val) - } - { - val := int(4096) - s.MaxTokens.SetTo(val) - } - { - val := RecallRequestTagsMatch("any") - s.TagsMatch.SetTo(val) - } - { - val := bool(false) - s.Trace.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *ReflectRequest) setDefaults() { - { - val := Budget("low") - s.Budget.SetTo(val) - } - { - val := int(4096) - s.MaxTokens.SetTo(val) - } - { - val := ReflectRequestTagsMatch("any") - s.TagsMatch.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *ReflectToolCall) setDefaults() { - { - val := int(0) - s.Iteration.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *RetainRequest) setDefaults() { - { - val := bool(false) - s.Async.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *TokenUsage) setDefaults() { - { - val := int(0) - s.InputTokens.SetTo(val) - } - { - val := int(0) - s.OutputTokens.SetTo(val) - } - { - val := int(0) - s.TotalTokens.SetTo(val) - } -} - -// setDefaults set default value of fields. -func (s *ToolCallsIncludeOptions) setDefaults() { - { - val := bool(true) - s.Output.SetTo(val) - } -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_interfaces_gen.go b/hindsight-clients/go/internal/ogenapi/oas_interfaces_gen.go deleted file mode 100644 index 38f74677..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_interfaces_gen.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. -package ogenapi - -type AddBankBackgroundRes interface { - addBankBackgroundRes() -} - -type CancelOperationRes interface { - cancelOperationRes() -} - -type ClearBankMemoriesRes interface { - clearBankMemoriesRes() -} - -type ClearObservationsRes interface { - clearObservationsRes() -} - -type CreateDirectiveRes interface { - createDirectiveRes() -} - -type CreateMentalModelRes interface { - createMentalModelRes() -} - -type CreateOrUpdateBankRes interface { - createOrUpdateBankRes() -} - -type DeleteBankRes interface { - deleteBankRes() -} - -type DeleteDirectiveRes interface { - deleteDirectiveRes() -} - -type DeleteDocumentRes interface { - deleteDocumentRes() -} - -type DeleteMentalModelRes interface { - deleteMentalModelRes() -} - -type GetAgentStatsRes interface { - getAgentStatsRes() -} - -type GetBankConfigRes interface { - getBankConfigRes() -} - -type GetBankProfileRes interface { - getBankProfileRes() -} - -type GetChunkRes interface { - getChunkRes() -} - -type GetDirectiveRes interface { - getDirectiveRes() -} - -type GetDocumentRes interface { - getDocumentRes() -} - -type GetEntityRes interface { - getEntityRes() -} - -type GetGraphRes interface { - getGraphRes() -} - -type GetMemoryRes interface { - getMemoryRes() -} - -type GetMentalModelRes interface { - getMentalModelRes() -} - -type GetOperationStatusRes interface { - getOperationStatusRes() -} - -type ListBanksRes interface { - listBanksRes() -} - -type ListDirectivesRes interface { - listDirectivesRes() -} - -type ListDocumentsRes interface { - listDocumentsRes() -} - -type ListEntitiesRes interface { - listEntitiesRes() -} - -type ListMemoriesRes interface { - listMemoriesRes() -} - -type ListMentalModelsRes interface { - listMentalModelsRes() -} - -type ListOperationsRes interface { - listOperationsRes() -} - -type ListTagsRes interface { - listTagsRes() -} - -type RecallMemoriesRes interface { - recallMemoriesRes() -} - -type ReflectRes interface { - reflectRes() -} - -type RefreshMentalModelRes interface { - refreshMentalModelRes() -} - -type RegenerateEntityObservationsRes interface { - regenerateEntityObservationsRes() -} - -type ResetBankConfigRes interface { - resetBankConfigRes() -} - -type RetainMemoriesRes interface { - retainMemoriesRes() -} - -type TriggerConsolidationRes interface { - triggerConsolidationRes() -} - -type UpdateBankConfigRes interface { - updateBankConfigRes() -} - -type UpdateBankDispositionRes interface { - updateBankDispositionRes() -} - -type UpdateBankRes interface { - updateBankRes() -} - -type UpdateDirectiveRes interface { - updateDirectiveRes() -} - -type UpdateMentalModelRes interface { - updateMentalModelRes() -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_json_gen.go b/hindsight-clients/go/internal/ogenapi/oas_json_gen.go deleted file mode 100644 index a2f4e2b5..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_json_gen.go +++ /dev/null @@ -1,12849 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -import ( - "math/bits" - "strconv" - "time" - - "github.com/go-faster/errors" - "github.com/go-faster/jx" - "github.com/ogen-go/ogen/json" - "github.com/ogen-go/ogen/validate" -) - -// Encode implements json.Marshaler. -func (s *AddBackgroundRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *AddBackgroundRequest) encodeFields(e *jx.Encoder) { - { - e.FieldStart("content") - e.Str(s.Content) - } - { - if s.UpdateDisposition.Set { - e.FieldStart("update_disposition") - s.UpdateDisposition.Encode(e) - } - } -} - -var jsonFieldsNameOfAddBackgroundRequest = [2]string{ - 0: "content", - 1: "update_disposition", -} - -// Decode decodes AddBackgroundRequest from json. -func (s *AddBackgroundRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode AddBackgroundRequest to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "content": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.Content = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content\"") - } - case "update_disposition": - if err := func() error { - s.UpdateDisposition.Reset() - if err := s.UpdateDisposition.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"update_disposition\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode AddBackgroundRequest") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfAddBackgroundRequest) { - name = jsonFieldsNameOfAddBackgroundRequest[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *AddBackgroundRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *AddBackgroundRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *AsyncOperationSubmitResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *AsyncOperationSubmitResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("operation_id") - e.Str(s.OperationID) - } - { - e.FieldStart("status") - e.Str(s.Status) - } -} - -var jsonFieldsNameOfAsyncOperationSubmitResponse = [2]string{ - 0: "operation_id", - 1: "status", -} - -// Decode decodes AsyncOperationSubmitResponse from json. -func (s *AsyncOperationSubmitResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode AsyncOperationSubmitResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "operation_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.OperationID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operation_id\"") - } - case "status": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.Status = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"status\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode AsyncOperationSubmitResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000011, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfAsyncOperationSubmitResponse) { - name = jsonFieldsNameOfAsyncOperationSubmitResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *AsyncOperationSubmitResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *AsyncOperationSubmitResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *BackgroundResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *BackgroundResponse) encodeFields(e *jx.Encoder) { - { - if s.Background.Set { - e.FieldStart("background") - s.Background.Encode(e) - } - } - { - if s.Disposition.Set { - e.FieldStart("disposition") - s.Disposition.Encode(e) - } - } - { - e.FieldStart("mission") - e.Str(s.Mission) - } -} - -var jsonFieldsNameOfBackgroundResponse = [3]string{ - 0: "background", - 1: "disposition", - 2: "mission", -} - -// Decode decodes BackgroundResponse from json. -func (s *BackgroundResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BackgroundResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "background": - if err := func() error { - s.Background.Reset() - if err := s.Background.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"background\"") - } - case "disposition": - if err := func() error { - s.Disposition.Reset() - if err := s.Disposition.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"disposition\"") - } - case "mission": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Mission = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mission\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode BackgroundResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000100, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfBackgroundResponse) { - name = jsonFieldsNameOfBackgroundResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *BackgroundResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BackgroundResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *BankConfigResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *BankConfigResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("config") - s.Config.Encode(e) - } - { - e.FieldStart("overrides") - s.Overrides.Encode(e) - } -} - -var jsonFieldsNameOfBankConfigResponse = [3]string{ - 0: "bank_id", - 1: "config", - 2: "overrides", -} - -// Decode decodes BankConfigResponse from json. -func (s *BankConfigResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankConfigResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "config": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - if err := s.Config.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"config\"") - } - case "overrides": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - if err := s.Overrides.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"overrides\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode BankConfigResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfBankConfigResponse) { - name = jsonFieldsNameOfBankConfigResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *BankConfigResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankConfigResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankConfigResponseConfig) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankConfigResponseConfig) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes BankConfigResponseConfig from json. -func (s *BankConfigResponseConfig) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankConfigResponseConfig to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankConfigResponseConfig") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankConfigResponseConfig) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankConfigResponseConfig) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankConfigResponseOverrides) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankConfigResponseOverrides) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes BankConfigResponseOverrides from json. -func (s *BankConfigResponseOverrides) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankConfigResponseOverrides to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankConfigResponseOverrides") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankConfigResponseOverrides) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankConfigResponseOverrides) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *BankConfigUpdate) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *BankConfigUpdate) encodeFields(e *jx.Encoder) { - { - e.FieldStart("updates") - s.Updates.Encode(e) - } -} - -var jsonFieldsNameOfBankConfigUpdate = [1]string{ - 0: "updates", -} - -// Decode decodes BankConfigUpdate from json. -func (s *BankConfigUpdate) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankConfigUpdate to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "updates": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - if err := s.Updates.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"updates\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode BankConfigUpdate") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfBankConfigUpdate) { - name = jsonFieldsNameOfBankConfigUpdate[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *BankConfigUpdate) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankConfigUpdate) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankConfigUpdateUpdates) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankConfigUpdateUpdates) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes BankConfigUpdateUpdates from json. -func (s *BankConfigUpdateUpdates) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankConfigUpdateUpdates to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankConfigUpdateUpdates") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankConfigUpdateUpdates) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankConfigUpdateUpdates) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *BankListItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *BankListItem) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - if s.CreatedAt.Set { - e.FieldStart("created_at") - s.CreatedAt.Encode(e) - } - } - { - e.FieldStart("disposition") - s.Disposition.Encode(e) - } - { - if s.Mission.Set { - e.FieldStart("mission") - s.Mission.Encode(e) - } - } - { - if s.Name.Set { - e.FieldStart("name") - s.Name.Encode(e) - } - } - { - if s.UpdatedAt.Set { - e.FieldStart("updated_at") - s.UpdatedAt.Encode(e) - } - } -} - -var jsonFieldsNameOfBankListItem = [6]string{ - 0: "bank_id", - 1: "created_at", - 2: "disposition", - 3: "mission", - 4: "name", - 5: "updated_at", -} - -// Decode decodes BankListItem from json. -func (s *BankListItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankListItem to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "created_at": - if err := func() error { - s.CreatedAt.Reset() - if err := s.CreatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"created_at\"") - } - case "disposition": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - if err := s.Disposition.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"disposition\"") - } - case "mission": - if err := func() error { - s.Mission.Reset() - if err := s.Mission.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mission\"") - } - case "name": - if err := func() error { - s.Name.Reset() - if err := s.Name.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - case "updated_at": - if err := func() error { - s.UpdatedAt.Reset() - if err := s.UpdatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"updated_at\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode BankListItem") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000101, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfBankListItem) { - name = jsonFieldsNameOfBankListItem[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *BankListItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankListItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *BankListResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *BankListResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("banks") - e.ArrStart() - for _, elem := range s.Banks { - elem.Encode(e) - } - e.ArrEnd() - } -} - -var jsonFieldsNameOfBankListResponse = [1]string{ - 0: "banks", -} - -// Decode decodes BankListResponse from json. -func (s *BankListResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankListResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "banks": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Banks = make([]BankListItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem BankListItem - if err := elem.Decode(d); err != nil { - return err - } - s.Banks = append(s.Banks, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"banks\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode BankListResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfBankListResponse) { - name = jsonFieldsNameOfBankListResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *BankListResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankListResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *BankProfileResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *BankProfileResponse) encodeFields(e *jx.Encoder) { - { - if s.Background.Set { - e.FieldStart("background") - s.Background.Encode(e) - } - } - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("disposition") - s.Disposition.Encode(e) - } - { - e.FieldStart("mission") - e.Str(s.Mission) - } - { - e.FieldStart("name") - e.Str(s.Name) - } -} - -var jsonFieldsNameOfBankProfileResponse = [5]string{ - 0: "background", - 1: "bank_id", - 2: "disposition", - 3: "mission", - 4: "name", -} - -// Decode decodes BankProfileResponse from json. -func (s *BankProfileResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankProfileResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "background": - if err := func() error { - s.Background.Reset() - if err := s.Background.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"background\"") - } - case "bank_id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "disposition": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - if err := s.Disposition.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"disposition\"") - } - case "mission": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.Mission = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mission\"") - } - case "name": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Str() - s.Name = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode BankProfileResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00011110, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfBankProfileResponse) { - name = jsonFieldsNameOfBankProfileResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *BankProfileResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankProfileResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *BankStatsResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *BankStatsResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("failed_operations") - e.Int(s.FailedOperations) - } - { - if s.LastConsolidatedAt.Set { - e.FieldStart("last_consolidated_at") - s.LastConsolidatedAt.Encode(e) - } - } - { - e.FieldStart("links_breakdown") - s.LinksBreakdown.Encode(e) - } - { - e.FieldStart("links_by_fact_type") - s.LinksByFactType.Encode(e) - } - { - e.FieldStart("links_by_link_type") - s.LinksByLinkType.Encode(e) - } - { - e.FieldStart("nodes_by_fact_type") - s.NodesByFactType.Encode(e) - } - { - if s.PendingConsolidation.Set { - e.FieldStart("pending_consolidation") - s.PendingConsolidation.Encode(e) - } - } - { - e.FieldStart("pending_operations") - e.Int(s.PendingOperations) - } - { - e.FieldStart("total_documents") - e.Int(s.TotalDocuments) - } - { - e.FieldStart("total_links") - e.Int(s.TotalLinks) - } - { - e.FieldStart("total_nodes") - e.Int(s.TotalNodes) - } - { - if s.TotalObservations.Set { - e.FieldStart("total_observations") - s.TotalObservations.Encode(e) - } - } -} - -var jsonFieldsNameOfBankStatsResponse = [13]string{ - 0: "bank_id", - 1: "failed_operations", - 2: "last_consolidated_at", - 3: "links_breakdown", - 4: "links_by_fact_type", - 5: "links_by_link_type", - 6: "nodes_by_fact_type", - 7: "pending_consolidation", - 8: "pending_operations", - 9: "total_documents", - 10: "total_links", - 11: "total_nodes", - 12: "total_observations", -} - -// Decode decodes BankStatsResponse from json. -func (s *BankStatsResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankStatsResponse to nil") - } - var requiredBitSet [2]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "failed_operations": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.FailedOperations = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"failed_operations\"") - } - case "last_consolidated_at": - if err := func() error { - s.LastConsolidatedAt.Reset() - if err := s.LastConsolidatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"last_consolidated_at\"") - } - case "links_breakdown": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - if err := s.LinksBreakdown.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"links_breakdown\"") - } - case "links_by_fact_type": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - if err := s.LinksByFactType.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"links_by_fact_type\"") - } - case "links_by_link_type": - requiredBitSet[0] |= 1 << 5 - if err := func() error { - if err := s.LinksByLinkType.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"links_by_link_type\"") - } - case "nodes_by_fact_type": - requiredBitSet[0] |= 1 << 6 - if err := func() error { - if err := s.NodesByFactType.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"nodes_by_fact_type\"") - } - case "pending_consolidation": - if err := func() error { - s.PendingConsolidation.Reset() - if err := s.PendingConsolidation.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"pending_consolidation\"") - } - case "pending_operations": - requiredBitSet[1] |= 1 << 0 - if err := func() error { - v, err := d.Int() - s.PendingOperations = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"pending_operations\"") - } - case "total_documents": - requiredBitSet[1] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.TotalDocuments = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total_documents\"") - } - case "total_links": - requiredBitSet[1] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.TotalLinks = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total_links\"") - } - case "total_nodes": - requiredBitSet[1] |= 1 << 3 - if err := func() error { - v, err := d.Int() - s.TotalNodes = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total_nodes\"") - } - case "total_observations": - if err := func() error { - s.TotalObservations.Reset() - if err := s.TotalObservations.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total_observations\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode BankStatsResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [2]uint8{ - 0b01111011, - 0b00001111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfBankStatsResponse) { - name = jsonFieldsNameOfBankStatsResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *BankStatsResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankStatsResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankStatsResponseLinksBreakdown) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankStatsResponseLinksBreakdown) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - elem.Encode(e) - } -} - -// Decode decodes BankStatsResponseLinksBreakdown from json. -func (s *BankStatsResponseLinksBreakdown) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankStatsResponseLinksBreakdown to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem BankStatsResponseLinksBreakdownItem - if err := func() error { - if err := elem.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankStatsResponseLinksBreakdown") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankStatsResponseLinksBreakdown) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankStatsResponseLinksBreakdown) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankStatsResponseLinksBreakdownItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankStatsResponseLinksBreakdownItem) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - e.Int(elem) - } -} - -// Decode decodes BankStatsResponseLinksBreakdownItem from json. -func (s *BankStatsResponseLinksBreakdownItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankStatsResponseLinksBreakdownItem to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem int - if err := func() error { - v, err := d.Int() - elem = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankStatsResponseLinksBreakdownItem") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankStatsResponseLinksBreakdownItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankStatsResponseLinksBreakdownItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankStatsResponseLinksByFactType) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankStatsResponseLinksByFactType) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - e.Int(elem) - } -} - -// Decode decodes BankStatsResponseLinksByFactType from json. -func (s *BankStatsResponseLinksByFactType) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankStatsResponseLinksByFactType to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem int - if err := func() error { - v, err := d.Int() - elem = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankStatsResponseLinksByFactType") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankStatsResponseLinksByFactType) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankStatsResponseLinksByFactType) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankStatsResponseLinksByLinkType) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankStatsResponseLinksByLinkType) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - e.Int(elem) - } -} - -// Decode decodes BankStatsResponseLinksByLinkType from json. -func (s *BankStatsResponseLinksByLinkType) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankStatsResponseLinksByLinkType to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem int - if err := func() error { - v, err := d.Int() - elem = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankStatsResponseLinksByLinkType") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankStatsResponseLinksByLinkType) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankStatsResponseLinksByLinkType) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s BankStatsResponseNodesByFactType) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s BankStatsResponseNodesByFactType) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - e.Int(elem) - } -} - -// Decode decodes BankStatsResponseNodesByFactType from json. -func (s *BankStatsResponseNodesByFactType) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode BankStatsResponseNodesByFactType to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem int - if err := func() error { - v, err := d.Int() - elem = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode BankStatsResponseNodesByFactType") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s BankStatsResponseNodesByFactType) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *BankStatsResponseNodesByFactType) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes Budget as json. -func (s Budget) Encode(e *jx.Encoder) { - e.Str(string(s)) -} - -// Decode decodes Budget from json. -func (s *Budget) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode Budget to nil") - } - v, err := d.StrBytes() - if err != nil { - return err - } - // Try to use constant string. - switch Budget(v) { - case BudgetLow: - *s = BudgetLow - case BudgetMid: - *s = BudgetMid - case BudgetHigh: - *s = BudgetHigh - default: - *s = Budget(v) - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s Budget) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *Budget) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *CancelOperationResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *CancelOperationResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("message") - e.Str(s.Message) - } - { - e.FieldStart("operation_id") - e.Str(s.OperationID) - } - { - e.FieldStart("success") - e.Bool(s.Success) - } -} - -var jsonFieldsNameOfCancelOperationResponse = [3]string{ - 0: "message", - 1: "operation_id", - 2: "success", -} - -// Decode decodes CancelOperationResponse from json. -func (s *CancelOperationResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode CancelOperationResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "message": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.Message = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"message\"") - } - case "operation_id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.OperationID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operation_id\"") - } - case "success": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Bool() - s.Success = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"success\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode CancelOperationResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfCancelOperationResponse) { - name = jsonFieldsNameOfCancelOperationResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *CancelOperationResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *CancelOperationResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ChunkData) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ChunkData) encodeFields(e *jx.Encoder) { - { - e.FieldStart("chunk_index") - e.Int(s.ChunkIndex) - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - e.FieldStart("text") - e.Str(s.Text) - } - { - if s.Truncated.Set { - e.FieldStart("truncated") - s.Truncated.Encode(e) - } - } -} - -var jsonFieldsNameOfChunkData = [4]string{ - 0: "chunk_index", - 1: "id", - 2: "text", - 3: "truncated", -} - -// Decode decodes ChunkData from json. -func (s *ChunkData) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ChunkData to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "chunk_index": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Int() - s.ChunkIndex = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"chunk_index\"") - } - case "id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "text": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Text = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"text\"") - } - case "truncated": - if err := func() error { - s.Truncated.Reset() - if err := s.Truncated.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"truncated\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ChunkData") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfChunkData) { - name = jsonFieldsNameOfChunkData[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ChunkData) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ChunkData) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ChunkIncludeOptions) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ChunkIncludeOptions) encodeFields(e *jx.Encoder) { - { - if s.MaxTokens.Set { - e.FieldStart("max_tokens") - s.MaxTokens.Encode(e) - } - } -} - -var jsonFieldsNameOfChunkIncludeOptions = [1]string{ - 0: "max_tokens", -} - -// Decode decodes ChunkIncludeOptions from json. -func (s *ChunkIncludeOptions) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ChunkIncludeOptions to nil") - } - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "max_tokens": - if err := func() error { - s.MaxTokens.Reset() - if err := s.MaxTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"max_tokens\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ChunkIncludeOptions") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ChunkIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ChunkIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ChunkResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ChunkResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("chunk_id") - e.Str(s.ChunkID) - } - { - e.FieldStart("chunk_index") - e.Int(s.ChunkIndex) - } - { - e.FieldStart("chunk_text") - e.Str(s.ChunkText) - } - { - e.FieldStart("created_at") - e.Str(s.CreatedAt) - } - { - e.FieldStart("document_id") - e.Str(s.DocumentID) - } -} - -var jsonFieldsNameOfChunkResponse = [6]string{ - 0: "bank_id", - 1: "chunk_id", - 2: "chunk_index", - 3: "chunk_text", - 4: "created_at", - 5: "document_id", -} - -// Decode decodes ChunkResponse from json. -func (s *ChunkResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ChunkResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "chunk_id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.ChunkID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"chunk_id\"") - } - case "chunk_index": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.ChunkIndex = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"chunk_index\"") - } - case "chunk_text": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.ChunkText = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"chunk_text\"") - } - case "created_at": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Str() - s.CreatedAt = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"created_at\"") - } - case "document_id": - requiredBitSet[0] |= 1 << 5 - if err := func() error { - v, err := d.Str() - s.DocumentID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"document_id\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ChunkResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00111111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfChunkResponse) { - name = jsonFieldsNameOfChunkResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ChunkResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ChunkResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ConsolidationResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ConsolidationResponse) encodeFields(e *jx.Encoder) { - { - if s.Deduplicated.Set { - e.FieldStart("deduplicated") - s.Deduplicated.Encode(e) - } - } - { - e.FieldStart("operation_id") - e.Str(s.OperationID) - } -} - -var jsonFieldsNameOfConsolidationResponse = [2]string{ - 0: "deduplicated", - 1: "operation_id", -} - -// Decode decodes ConsolidationResponse from json. -func (s *ConsolidationResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ConsolidationResponse to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "deduplicated": - if err := func() error { - s.Deduplicated.Reset() - if err := s.Deduplicated.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"deduplicated\"") - } - case "operation_id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.OperationID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operation_id\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ConsolidationResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000010, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfConsolidationResponse) { - name = jsonFieldsNameOfConsolidationResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ConsolidationResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ConsolidationResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *CreateBankRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *CreateBankRequest) encodeFields(e *jx.Encoder) { - { - if s.Background.Set { - e.FieldStart("background") - s.Background.Encode(e) - } - } - { - if s.Disposition.Set { - e.FieldStart("disposition") - s.Disposition.Encode(e) - } - } - { - if s.Mission.Set { - e.FieldStart("mission") - s.Mission.Encode(e) - } - } - { - if s.Name.Set { - e.FieldStart("name") - s.Name.Encode(e) - } - } -} - -var jsonFieldsNameOfCreateBankRequest = [4]string{ - 0: "background", - 1: "disposition", - 2: "mission", - 3: "name", -} - -// Decode decodes CreateBankRequest from json. -func (s *CreateBankRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode CreateBankRequest to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "background": - if err := func() error { - s.Background.Reset() - if err := s.Background.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"background\"") - } - case "disposition": - if err := func() error { - s.Disposition.Reset() - if err := s.Disposition.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"disposition\"") - } - case "mission": - if err := func() error { - s.Mission.Reset() - if err := s.Mission.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mission\"") - } - case "name": - if err := func() error { - s.Name.Reset() - if err := s.Name.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode CreateBankRequest") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *CreateBankRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *CreateBankRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *CreateDirectiveRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *CreateDirectiveRequest) encodeFields(e *jx.Encoder) { - { - e.FieldStart("content") - e.Str(s.Content) - } - { - if s.IsActive.Set { - e.FieldStart("is_active") - s.IsActive.Encode(e) - } - } - { - e.FieldStart("name") - e.Str(s.Name) - } - { - if s.Priority.Set { - e.FieldStart("priority") - s.Priority.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } -} - -var jsonFieldsNameOfCreateDirectiveRequest = [5]string{ - 0: "content", - 1: "is_active", - 2: "name", - 3: "priority", - 4: "tags", -} - -// Decode decodes CreateDirectiveRequest from json. -func (s *CreateDirectiveRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode CreateDirectiveRequest to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "content": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.Content = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content\"") - } - case "is_active": - if err := func() error { - s.IsActive.Reset() - if err := s.IsActive.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"is_active\"") - } - case "name": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Name = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - case "priority": - if err := func() error { - s.Priority.Reset() - if err := s.Priority.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"priority\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode CreateDirectiveRequest") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000101, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfCreateDirectiveRequest) { - name = jsonFieldsNameOfCreateDirectiveRequest[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *CreateDirectiveRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *CreateDirectiveRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *CreateMentalModelRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *CreateMentalModelRequest) encodeFields(e *jx.Encoder) { - { - if s.ID.Set { - e.FieldStart("id") - s.ID.Encode(e) - } - } - { - if s.MaxTokens.Set { - e.FieldStart("max_tokens") - s.MaxTokens.Encode(e) - } - } - { - e.FieldStart("name") - e.Str(s.Name) - } - { - e.FieldStart("source_query") - e.Str(s.SourceQuery) - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - if s.Trigger.Set { - e.FieldStart("trigger") - s.Trigger.Encode(e) - } - } -} - -var jsonFieldsNameOfCreateMentalModelRequest = [6]string{ - 0: "id", - 1: "max_tokens", - 2: "name", - 3: "source_query", - 4: "tags", - 5: "trigger", -} - -// Decode decodes CreateMentalModelRequest from json. -func (s *CreateMentalModelRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode CreateMentalModelRequest to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "id": - if err := func() error { - s.ID.Reset() - if err := s.ID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "max_tokens": - if err := func() error { - s.MaxTokens.Reset() - if err := s.MaxTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"max_tokens\"") - } - case "name": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Name = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - case "source_query": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.SourceQuery = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"source_query\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "trigger": - if err := func() error { - s.Trigger.Reset() - if err := s.Trigger.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"trigger\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode CreateMentalModelRequest") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00001100, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfCreateMentalModelRequest) { - name = jsonFieldsNameOfCreateMentalModelRequest[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *CreateMentalModelRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *CreateMentalModelRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *CreateMentalModelResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *CreateMentalModelResponse) encodeFields(e *jx.Encoder) { - { - if s.MentalModelID.Set { - e.FieldStart("mental_model_id") - s.MentalModelID.Encode(e) - } - } - { - e.FieldStart("operation_id") - e.Str(s.OperationID) - } -} - -var jsonFieldsNameOfCreateMentalModelResponse = [2]string{ - 0: "mental_model_id", - 1: "operation_id", -} - -// Decode decodes CreateMentalModelResponse from json. -func (s *CreateMentalModelResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode CreateMentalModelResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "mental_model_id": - if err := func() error { - s.MentalModelID.Reset() - if err := s.MentalModelID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mental_model_id\"") - } - case "operation_id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.OperationID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operation_id\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode CreateMentalModelResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000010, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfCreateMentalModelResponse) { - name = jsonFieldsNameOfCreateMentalModelResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *CreateMentalModelResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *CreateMentalModelResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes DeleteDirectiveOKApplicationJSON as json. -func (s DeleteDirectiveOKApplicationJSON) Encode(e *jx.Encoder) { - unwrapped := jx.Raw(s) - - if len(unwrapped) != 0 { - e.Raw(unwrapped) - } -} - -// Decode decodes DeleteDirectiveOKApplicationJSON from json. -func (s *DeleteDirectiveOKApplicationJSON) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DeleteDirectiveOKApplicationJSON to nil") - } - var unwrapped jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - unwrapped = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "alias") - } - *s = DeleteDirectiveOKApplicationJSON(unwrapped) - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s DeleteDirectiveOKApplicationJSON) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DeleteDirectiveOKApplicationJSON) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *DeleteDocumentResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *DeleteDocumentResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("document_id") - e.Str(s.DocumentID) - } - { - e.FieldStart("memory_units_deleted") - e.Int(s.MemoryUnitsDeleted) - } - { - e.FieldStart("message") - e.Str(s.Message) - } - { - e.FieldStart("success") - e.Bool(s.Success) - } -} - -var jsonFieldsNameOfDeleteDocumentResponse = [4]string{ - 0: "document_id", - 1: "memory_units_deleted", - 2: "message", - 3: "success", -} - -// Decode decodes DeleteDocumentResponse from json. -func (s *DeleteDocumentResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DeleteDocumentResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "document_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.DocumentID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"document_id\"") - } - case "memory_units_deleted": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.MemoryUnitsDeleted = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"memory_units_deleted\"") - } - case "message": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Message = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"message\"") - } - case "success": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Bool() - s.Success = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"success\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode DeleteDocumentResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00001111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfDeleteDocumentResponse) { - name = jsonFieldsNameOfDeleteDocumentResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *DeleteDocumentResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DeleteDocumentResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes DeleteMentalModelOKApplicationJSON as json. -func (s DeleteMentalModelOKApplicationJSON) Encode(e *jx.Encoder) { - unwrapped := jx.Raw(s) - - if len(unwrapped) != 0 { - e.Raw(unwrapped) - } -} - -// Decode decodes DeleteMentalModelOKApplicationJSON from json. -func (s *DeleteMentalModelOKApplicationJSON) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DeleteMentalModelOKApplicationJSON to nil") - } - var unwrapped jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - unwrapped = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "alias") - } - *s = DeleteMentalModelOKApplicationJSON(unwrapped) - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s DeleteMentalModelOKApplicationJSON) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DeleteMentalModelOKApplicationJSON) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *DeleteResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *DeleteResponse) encodeFields(e *jx.Encoder) { - { - if s.DeletedCount.Set { - e.FieldStart("deleted_count") - s.DeletedCount.Encode(e) - } - } - { - if s.Message.Set { - e.FieldStart("message") - s.Message.Encode(e) - } - } - { - e.FieldStart("success") - e.Bool(s.Success) - } -} - -var jsonFieldsNameOfDeleteResponse = [3]string{ - 0: "deleted_count", - 1: "message", - 2: "success", -} - -// Decode decodes DeleteResponse from json. -func (s *DeleteResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DeleteResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "deleted_count": - if err := func() error { - s.DeletedCount.Reset() - if err := s.DeletedCount.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"deleted_count\"") - } - case "message": - if err := func() error { - s.Message.Reset() - if err := s.Message.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"message\"") - } - case "success": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Bool() - s.Success = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"success\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode DeleteResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000100, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfDeleteResponse) { - name = jsonFieldsNameOfDeleteResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *DeleteResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DeleteResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *DirectiveListResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *DirectiveListResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("items") - e.ArrStart() - for _, elem := range s.Items { - elem.Encode(e) - } - e.ArrEnd() - } -} - -var jsonFieldsNameOfDirectiveListResponse = [1]string{ - 0: "items", -} - -// Decode decodes DirectiveListResponse from json. -func (s *DirectiveListResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DirectiveListResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "items": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Items = make([]DirectiveResponse, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem DirectiveResponse - if err := elem.Decode(d); err != nil { - return err - } - s.Items = append(s.Items, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode DirectiveListResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfDirectiveListResponse) { - name = jsonFieldsNameOfDirectiveListResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *DirectiveListResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DirectiveListResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *DirectiveResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *DirectiveResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("content") - e.Str(s.Content) - } - { - if s.CreatedAt.Set { - e.FieldStart("created_at") - s.CreatedAt.Encode(e) - } - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - if s.IsActive.Set { - e.FieldStart("is_active") - s.IsActive.Encode(e) - } - } - { - e.FieldStart("name") - e.Str(s.Name) - } - { - if s.Priority.Set { - e.FieldStart("priority") - s.Priority.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - if s.UpdatedAt.Set { - e.FieldStart("updated_at") - s.UpdatedAt.Encode(e) - } - } -} - -var jsonFieldsNameOfDirectiveResponse = [9]string{ - 0: "bank_id", - 1: "content", - 2: "created_at", - 3: "id", - 4: "is_active", - 5: "name", - 6: "priority", - 7: "tags", - 8: "updated_at", -} - -// Decode decodes DirectiveResponse from json. -func (s *DirectiveResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DirectiveResponse to nil") - } - var requiredBitSet [2]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "content": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.Content = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content\"") - } - case "created_at": - if err := func() error { - s.CreatedAt.Reset() - if err := s.CreatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"created_at\"") - } - case "id": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "is_active": - if err := func() error { - s.IsActive.Reset() - if err := s.IsActive.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"is_active\"") - } - case "name": - requiredBitSet[0] |= 1 << 5 - if err := func() error { - v, err := d.Str() - s.Name = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - case "priority": - if err := func() error { - s.Priority.Reset() - if err := s.Priority.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"priority\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "updated_at": - if err := func() error { - s.UpdatedAt.Reset() - if err := s.UpdatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"updated_at\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode DirectiveResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [2]uint8{ - 0b00101011, - 0b00000000, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfDirectiveResponse) { - name = jsonFieldsNameOfDirectiveResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *DirectiveResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DirectiveResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *DispositionTraits) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *DispositionTraits) encodeFields(e *jx.Encoder) { - { - e.FieldStart("empathy") - e.Int(s.Empathy) - } - { - e.FieldStart("literalism") - e.Int(s.Literalism) - } - { - e.FieldStart("skepticism") - e.Int(s.Skepticism) - } -} - -var jsonFieldsNameOfDispositionTraits = [3]string{ - 0: "empathy", - 1: "literalism", - 2: "skepticism", -} - -// Decode decodes DispositionTraits from json. -func (s *DispositionTraits) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DispositionTraits to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "empathy": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Int() - s.Empathy = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"empathy\"") - } - case "literalism": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.Literalism = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"literalism\"") - } - case "skepticism": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.Skepticism = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"skepticism\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode DispositionTraits") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfDispositionTraits) { - name = jsonFieldsNameOfDispositionTraits[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *DispositionTraits) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DispositionTraits) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *DocumentResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *DocumentResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("content_hash") - e.Str(s.ContentHash) - } - { - e.FieldStart("created_at") - e.Str(s.CreatedAt) - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - e.FieldStart("memory_unit_count") - e.Int(s.MemoryUnitCount) - } - { - e.FieldStart("original_text") - e.Str(s.OriginalText) - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - e.FieldStart("updated_at") - e.Str(s.UpdatedAt) - } -} - -var jsonFieldsNameOfDocumentResponse = [8]string{ - 0: "bank_id", - 1: "content_hash", - 2: "created_at", - 3: "id", - 4: "memory_unit_count", - 5: "original_text", - 6: "tags", - 7: "updated_at", -} - -// Decode decodes DocumentResponse from json. -func (s *DocumentResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode DocumentResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "content_hash": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.ContentHash = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content_hash\"") - } - case "created_at": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.CreatedAt = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"created_at\"") - } - case "id": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "memory_unit_count": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Int() - s.MemoryUnitCount = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"memory_unit_count\"") - } - case "original_text": - requiredBitSet[0] |= 1 << 5 - if err := func() error { - v, err := d.Str() - s.OriginalText = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"original_text\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "updated_at": - requiredBitSet[0] |= 1 << 7 - if err := func() error { - v, err := d.Str() - s.UpdatedAt = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"updated_at\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode DocumentResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b10111111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfDocumentResponse) { - name = jsonFieldsNameOfDocumentResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *DocumentResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *DocumentResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *EntityDetailResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *EntityDetailResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("canonical_name") - e.Str(s.CanonicalName) - } - { - if s.FirstSeen.Set { - e.FieldStart("first_seen") - s.FirstSeen.Encode(e) - } - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - if s.LastSeen.Set { - e.FieldStart("last_seen") - s.LastSeen.Encode(e) - } - } - { - e.FieldStart("mention_count") - e.Int(s.MentionCount) - } - { - if s.Metadata.Set { - e.FieldStart("metadata") - s.Metadata.Encode(e) - } - } - { - e.FieldStart("observations") - e.ArrStart() - for _, elem := range s.Observations { - elem.Encode(e) - } - e.ArrEnd() - } -} - -var jsonFieldsNameOfEntityDetailResponse = [7]string{ - 0: "canonical_name", - 1: "first_seen", - 2: "id", - 3: "last_seen", - 4: "mention_count", - 5: "metadata", - 6: "observations", -} - -// Decode decodes EntityDetailResponse from json. -func (s *EntityDetailResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityDetailResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "canonical_name": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.CanonicalName = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"canonical_name\"") - } - case "first_seen": - if err := func() error { - s.FirstSeen.Reset() - if err := s.FirstSeen.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"first_seen\"") - } - case "id": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "last_seen": - if err := func() error { - s.LastSeen.Reset() - if err := s.LastSeen.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"last_seen\"") - } - case "mention_count": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Int() - s.MentionCount = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mention_count\"") - } - case "metadata": - if err := func() error { - s.Metadata.Reset() - if err := s.Metadata.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"metadata\"") - } - case "observations": - requiredBitSet[0] |= 1 << 6 - if err := func() error { - s.Observations = make([]EntityObservationResponse, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem EntityObservationResponse - if err := elem.Decode(d); err != nil { - return err - } - s.Observations = append(s.Observations, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"observations\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityDetailResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b01010101, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfEntityDetailResponse) { - name = jsonFieldsNameOfEntityDetailResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *EntityDetailResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityDetailResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s EntityDetailResponseMetadata) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s EntityDetailResponseMetadata) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes EntityDetailResponseMetadata from json. -func (s *EntityDetailResponseMetadata) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityDetailResponseMetadata to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityDetailResponseMetadata") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s EntityDetailResponseMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityDetailResponseMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *EntityIncludeOptions) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *EntityIncludeOptions) encodeFields(e *jx.Encoder) { - { - if s.MaxTokens.Set { - e.FieldStart("max_tokens") - s.MaxTokens.Encode(e) - } - } -} - -var jsonFieldsNameOfEntityIncludeOptions = [1]string{ - 0: "max_tokens", -} - -// Decode decodes EntityIncludeOptions from json. -func (s *EntityIncludeOptions) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityIncludeOptions to nil") - } - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "max_tokens": - if err := func() error { - s.MaxTokens.Reset() - if err := s.MaxTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"max_tokens\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityIncludeOptions") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *EntityIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *EntityInput) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *EntityInput) encodeFields(e *jx.Encoder) { - { - e.FieldStart("text") - e.Str(s.Text) - } - { - if s.Type.Set { - e.FieldStart("type") - s.Type.Encode(e) - } - } -} - -var jsonFieldsNameOfEntityInput = [2]string{ - 0: "text", - 1: "type", -} - -// Decode decodes EntityInput from json. -func (s *EntityInput) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityInput to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "text": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.Text = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"text\"") - } - case "type": - if err := func() error { - s.Type.Reset() - if err := s.Type.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"type\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityInput") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfEntityInput) { - name = jsonFieldsNameOfEntityInput[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *EntityInput) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityInput) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *EntityListItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *EntityListItem) encodeFields(e *jx.Encoder) { - { - e.FieldStart("canonical_name") - e.Str(s.CanonicalName) - } - { - if s.FirstSeen.Set { - e.FieldStart("first_seen") - s.FirstSeen.Encode(e) - } - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - if s.LastSeen.Set { - e.FieldStart("last_seen") - s.LastSeen.Encode(e) - } - } - { - e.FieldStart("mention_count") - e.Int(s.MentionCount) - } - { - if s.Metadata.Set { - e.FieldStart("metadata") - s.Metadata.Encode(e) - } - } -} - -var jsonFieldsNameOfEntityListItem = [6]string{ - 0: "canonical_name", - 1: "first_seen", - 2: "id", - 3: "last_seen", - 4: "mention_count", - 5: "metadata", -} - -// Decode decodes EntityListItem from json. -func (s *EntityListItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityListItem to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "canonical_name": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.CanonicalName = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"canonical_name\"") - } - case "first_seen": - if err := func() error { - s.FirstSeen.Reset() - if err := s.FirstSeen.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"first_seen\"") - } - case "id": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "last_seen": - if err := func() error { - s.LastSeen.Reset() - if err := s.LastSeen.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"last_seen\"") - } - case "mention_count": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Int() - s.MentionCount = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mention_count\"") - } - case "metadata": - if err := func() error { - s.Metadata.Reset() - if err := s.Metadata.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"metadata\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityListItem") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00010101, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfEntityListItem) { - name = jsonFieldsNameOfEntityListItem[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *EntityListItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityListItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s EntityListItemMetadata) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s EntityListItemMetadata) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes EntityListItemMetadata from json. -func (s *EntityListItemMetadata) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityListItemMetadata to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityListItemMetadata") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s EntityListItemMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityListItemMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *EntityListResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *EntityListResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("items") - e.ArrStart() - for _, elem := range s.Items { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("limit") - e.Int(s.Limit) - } - { - e.FieldStart("offset") - e.Int(s.Offset) - } - { - e.FieldStart("total") - e.Int(s.Total) - } -} - -var jsonFieldsNameOfEntityListResponse = [4]string{ - 0: "items", - 1: "limit", - 2: "offset", - 3: "total", -} - -// Decode decodes EntityListResponse from json. -func (s *EntityListResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityListResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "items": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Items = make([]EntityListItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem EntityListItem - if err := elem.Decode(d); err != nil { - return err - } - s.Items = append(s.Items, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items\"") - } - case "limit": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.Limit = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"limit\"") - } - case "offset": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.Offset = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"offset\"") - } - case "total": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Int() - s.Total = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityListResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00001111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfEntityListResponse) { - name = jsonFieldsNameOfEntityListResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *EntityListResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityListResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *EntityObservationResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *EntityObservationResponse) encodeFields(e *jx.Encoder) { - { - if s.MentionedAt.Set { - e.FieldStart("mentioned_at") - s.MentionedAt.Encode(e) - } - } - { - e.FieldStart("text") - e.Str(s.Text) - } -} - -var jsonFieldsNameOfEntityObservationResponse = [2]string{ - 0: "mentioned_at", - 1: "text", -} - -// Decode decodes EntityObservationResponse from json. -func (s *EntityObservationResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityObservationResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "mentioned_at": - if err := func() error { - s.MentionedAt.Reset() - if err := s.MentionedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mentioned_at\"") - } - case "text": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.Text = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"text\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityObservationResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000010, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfEntityObservationResponse) { - name = jsonFieldsNameOfEntityObservationResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *EntityObservationResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityObservationResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *EntityStateResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *EntityStateResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("canonical_name") - e.Str(s.CanonicalName) - } - { - e.FieldStart("entity_id") - e.Str(s.EntityID) - } - { - e.FieldStart("observations") - e.ArrStart() - for _, elem := range s.Observations { - elem.Encode(e) - } - e.ArrEnd() - } -} - -var jsonFieldsNameOfEntityStateResponse = [3]string{ - 0: "canonical_name", - 1: "entity_id", - 2: "observations", -} - -// Decode decodes EntityStateResponse from json. -func (s *EntityStateResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode EntityStateResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "canonical_name": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.CanonicalName = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"canonical_name\"") - } - case "entity_id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.EntityID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"entity_id\"") - } - case "observations": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - s.Observations = make([]EntityObservationResponse, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem EntityObservationResponse - if err := elem.Decode(d); err != nil { - return err - } - s.Observations = append(s.Observations, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"observations\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode EntityStateResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfEntityStateResponse) { - name = jsonFieldsNameOfEntityStateResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *EntityStateResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *EntityStateResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *FactsIncludeOptions) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *FactsIncludeOptions) encodeFields(e *jx.Encoder) { -} - -var jsonFieldsNameOfFactsIncludeOptions = [0]string{} - -// Decode decodes FactsIncludeOptions from json. -func (s *FactsIncludeOptions) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode FactsIncludeOptions to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - default: - return d.Skip() - } - }); err != nil { - return errors.Wrap(err, "decode FactsIncludeOptions") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *FactsIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *FactsIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *FeaturesInfo) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *FeaturesInfo) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_config_api") - e.Bool(s.BankConfigAPI) - } - { - e.FieldStart("mcp") - e.Bool(s.Mcp) - } - { - e.FieldStart("observations") - e.Bool(s.Observations) - } - { - e.FieldStart("worker") - e.Bool(s.Worker) - } -} - -var jsonFieldsNameOfFeaturesInfo = [4]string{ - 0: "bank_config_api", - 1: "mcp", - 2: "observations", - 3: "worker", -} - -// Decode decodes FeaturesInfo from json. -func (s *FeaturesInfo) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode FeaturesInfo to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_config_api": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Bool() - s.BankConfigAPI = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_config_api\"") - } - case "mcp": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Bool() - s.Mcp = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mcp\"") - } - case "observations": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Bool() - s.Observations = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"observations\"") - } - case "worker": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Bool() - s.Worker = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"worker\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode FeaturesInfo") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00001111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfFeaturesInfo) { - name = jsonFieldsNameOfFeaturesInfo[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *FeaturesInfo) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *FeaturesInfo) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes GetMemoryOKApplicationJSON as json. -func (s GetMemoryOKApplicationJSON) Encode(e *jx.Encoder) { - unwrapped := jx.Raw(s) - - if len(unwrapped) != 0 { - e.Raw(unwrapped) - } -} - -// Decode decodes GetMemoryOKApplicationJSON from json. -func (s *GetMemoryOKApplicationJSON) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode GetMemoryOKApplicationJSON to nil") - } - var unwrapped jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - unwrapped = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "alias") - } - *s = GetMemoryOKApplicationJSON(unwrapped) - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s GetMemoryOKApplicationJSON) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GetMemoryOKApplicationJSON) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *GraphDataResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *GraphDataResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("edges") - e.ArrStart() - for _, elem := range s.Edges { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("limit") - e.Int(s.Limit) - } - { - e.FieldStart("nodes") - e.ArrStart() - for _, elem := range s.Nodes { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("table_rows") - e.ArrStart() - for _, elem := range s.TableRows { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("total_units") - e.Int(s.TotalUnits) - } -} - -var jsonFieldsNameOfGraphDataResponse = [5]string{ - 0: "edges", - 1: "limit", - 2: "nodes", - 3: "table_rows", - 4: "total_units", -} - -// Decode decodes GraphDataResponse from json. -func (s *GraphDataResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode GraphDataResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "edges": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Edges = make([]GraphDataResponseEdgesItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem GraphDataResponseEdgesItem - if err := elem.Decode(d); err != nil { - return err - } - s.Edges = append(s.Edges, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"edges\"") - } - case "limit": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.Limit = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"limit\"") - } - case "nodes": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - s.Nodes = make([]GraphDataResponseNodesItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem GraphDataResponseNodesItem - if err := elem.Decode(d); err != nil { - return err - } - s.Nodes = append(s.Nodes, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"nodes\"") - } - case "table_rows": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - s.TableRows = make([]GraphDataResponseTableRowsItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem GraphDataResponseTableRowsItem - if err := elem.Decode(d); err != nil { - return err - } - s.TableRows = append(s.TableRows, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"table_rows\"") - } - case "total_units": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Int() - s.TotalUnits = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total_units\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode GraphDataResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00011111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfGraphDataResponse) { - name = jsonFieldsNameOfGraphDataResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *GraphDataResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GraphDataResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s GraphDataResponseEdgesItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s GraphDataResponseEdgesItem) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes GraphDataResponseEdgesItem from json. -func (s *GraphDataResponseEdgesItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode GraphDataResponseEdgesItem to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode GraphDataResponseEdgesItem") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s GraphDataResponseEdgesItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GraphDataResponseEdgesItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s GraphDataResponseNodesItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s GraphDataResponseNodesItem) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes GraphDataResponseNodesItem from json. -func (s *GraphDataResponseNodesItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode GraphDataResponseNodesItem to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode GraphDataResponseNodesItem") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s GraphDataResponseNodesItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GraphDataResponseNodesItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s GraphDataResponseTableRowsItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s GraphDataResponseTableRowsItem) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes GraphDataResponseTableRowsItem from json. -func (s *GraphDataResponseTableRowsItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode GraphDataResponseTableRowsItem to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode GraphDataResponseTableRowsItem") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s GraphDataResponseTableRowsItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *GraphDataResponseTableRowsItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *HTTPValidationError) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *HTTPValidationError) encodeFields(e *jx.Encoder) { - { - if s.Detail != nil { - e.FieldStart("detail") - e.ArrStart() - for _, elem := range s.Detail { - elem.Encode(e) - } - e.ArrEnd() - } - } -} - -var jsonFieldsNameOfHTTPValidationError = [1]string{ - 0: "detail", -} - -// Decode decodes HTTPValidationError from json. -func (s *HTTPValidationError) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode HTTPValidationError to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "detail": - if err := func() error { - s.Detail = make([]ValidationError, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ValidationError - if err := elem.Decode(d); err != nil { - return err - } - s.Detail = append(s.Detail, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"detail\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode HTTPValidationError") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *HTTPValidationError) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *HTTPValidationError) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *IncludeOptions) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *IncludeOptions) encodeFields(e *jx.Encoder) { - { - if s.Chunks.Set { - e.FieldStart("chunks") - s.Chunks.Encode(e) - } - } - { - if s.Entities.Set { - e.FieldStart("entities") - s.Entities.Encode(e) - } - } -} - -var jsonFieldsNameOfIncludeOptions = [2]string{ - 0: "chunks", - 1: "entities", -} - -// Decode decodes IncludeOptions from json. -func (s *IncludeOptions) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode IncludeOptions to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "chunks": - if err := func() error { - s.Chunks.Reset() - if err := s.Chunks.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"chunks\"") - } - case "entities": - if err := func() error { - s.Entities.Reset() - if err := s.Entities.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"entities\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode IncludeOptions") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *IncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *IncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ListDocumentsResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ListDocumentsResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("items") - e.ArrStart() - for _, elem := range s.Items { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("limit") - e.Int(s.Limit) - } - { - e.FieldStart("offset") - e.Int(s.Offset) - } - { - e.FieldStart("total") - e.Int(s.Total) - } -} - -var jsonFieldsNameOfListDocumentsResponse = [4]string{ - 0: "items", - 1: "limit", - 2: "offset", - 3: "total", -} - -// Decode decodes ListDocumentsResponse from json. -func (s *ListDocumentsResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ListDocumentsResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "items": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Items = make([]ListDocumentsResponseItemsItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ListDocumentsResponseItemsItem - if err := elem.Decode(d); err != nil { - return err - } - s.Items = append(s.Items, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items\"") - } - case "limit": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.Limit = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"limit\"") - } - case "offset": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.Offset = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"offset\"") - } - case "total": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Int() - s.Total = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ListDocumentsResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00001111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfListDocumentsResponse) { - name = jsonFieldsNameOfListDocumentsResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ListDocumentsResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ListDocumentsResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s ListDocumentsResponseItemsItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s ListDocumentsResponseItemsItem) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes ListDocumentsResponseItemsItem from json. -func (s *ListDocumentsResponseItemsItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ListDocumentsResponseItemsItem to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode ListDocumentsResponseItemsItem") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s ListDocumentsResponseItemsItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ListDocumentsResponseItemsItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ListMemoryUnitsResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ListMemoryUnitsResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("items") - e.ArrStart() - for _, elem := range s.Items { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("limit") - e.Int(s.Limit) - } - { - e.FieldStart("offset") - e.Int(s.Offset) - } - { - e.FieldStart("total") - e.Int(s.Total) - } -} - -var jsonFieldsNameOfListMemoryUnitsResponse = [4]string{ - 0: "items", - 1: "limit", - 2: "offset", - 3: "total", -} - -// Decode decodes ListMemoryUnitsResponse from json. -func (s *ListMemoryUnitsResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ListMemoryUnitsResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "items": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Items = make([]ListMemoryUnitsResponseItemsItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ListMemoryUnitsResponseItemsItem - if err := elem.Decode(d); err != nil { - return err - } - s.Items = append(s.Items, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items\"") - } - case "limit": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.Limit = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"limit\"") - } - case "offset": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.Offset = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"offset\"") - } - case "total": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Int() - s.Total = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ListMemoryUnitsResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00001111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfListMemoryUnitsResponse) { - name = jsonFieldsNameOfListMemoryUnitsResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ListMemoryUnitsResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ListMemoryUnitsResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s ListMemoryUnitsResponseItemsItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s ListMemoryUnitsResponseItemsItem) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes ListMemoryUnitsResponseItemsItem from json. -func (s *ListMemoryUnitsResponseItemsItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ListMemoryUnitsResponseItemsItem to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode ListMemoryUnitsResponseItemsItem") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s ListMemoryUnitsResponseItemsItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ListMemoryUnitsResponseItemsItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ListTagsResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ListTagsResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("items") - e.ArrStart() - for _, elem := range s.Items { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("limit") - e.Int(s.Limit) - } - { - e.FieldStart("offset") - e.Int(s.Offset) - } - { - e.FieldStart("total") - e.Int(s.Total) - } -} - -var jsonFieldsNameOfListTagsResponse = [4]string{ - 0: "items", - 1: "limit", - 2: "offset", - 3: "total", -} - -// Decode decodes ListTagsResponse from json. -func (s *ListTagsResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ListTagsResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "items": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Items = make([]TagItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem TagItem - if err := elem.Decode(d); err != nil { - return err - } - s.Items = append(s.Items, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items\"") - } - case "limit": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.Limit = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"limit\"") - } - case "offset": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.Offset = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"offset\"") - } - case "total": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Int() - s.Total = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ListTagsResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00001111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfListTagsResponse) { - name = jsonFieldsNameOfListTagsResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ListTagsResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ListTagsResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *MemoryItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *MemoryItem) encodeFields(e *jx.Encoder) { - { - e.FieldStart("content") - e.Str(s.Content) - } - { - if s.Context.Set { - e.FieldStart("context") - s.Context.Encode(e) - } - } - { - if s.DocumentID.Set { - e.FieldStart("document_id") - s.DocumentID.Encode(e) - } - } - { - if s.Entities != nil { - e.FieldStart("entities") - e.ArrStart() - for _, elem := range s.Entities { - elem.Encode(e) - } - e.ArrEnd() - } - } - { - if s.Metadata.Set { - e.FieldStart("metadata") - s.Metadata.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - if s.Timestamp.Set { - e.FieldStart("timestamp") - s.Timestamp.Encode(e, json.EncodeDateTime) - } - } -} - -var jsonFieldsNameOfMemoryItem = [7]string{ - 0: "content", - 1: "context", - 2: "document_id", - 3: "entities", - 4: "metadata", - 5: "tags", - 6: "timestamp", -} - -// Decode decodes MemoryItem from json. -func (s *MemoryItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode MemoryItem to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "content": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.Content = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content\"") - } - case "context": - if err := func() error { - s.Context.Reset() - if err := s.Context.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"context\"") - } - case "document_id": - if err := func() error { - s.DocumentID.Reset() - if err := s.DocumentID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"document_id\"") - } - case "entities": - if err := func() error { - s.Entities = make([]EntityInput, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem EntityInput - if err := elem.Decode(d); err != nil { - return err - } - s.Entities = append(s.Entities, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"entities\"") - } - case "metadata": - if err := func() error { - s.Metadata.Reset() - if err := s.Metadata.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"metadata\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "timestamp": - if err := func() error { - s.Timestamp.Reset() - if err := s.Timestamp.Decode(d, json.DecodeDateTime); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"timestamp\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode MemoryItem") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfMemoryItem) { - name = jsonFieldsNameOfMemoryItem[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *MemoryItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *MemoryItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s MemoryItemMetadata) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s MemoryItemMetadata) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - e.Str(elem) - } -} - -// Decode decodes MemoryItemMetadata from json. -func (s *MemoryItemMetadata) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode MemoryItemMetadata to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem string - if err := func() error { - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode MemoryItemMetadata") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s MemoryItemMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *MemoryItemMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *MentalModelListResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *MentalModelListResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("items") - e.ArrStart() - for _, elem := range s.Items { - elem.Encode(e) - } - e.ArrEnd() - } -} - -var jsonFieldsNameOfMentalModelListResponse = [1]string{ - 0: "items", -} - -// Decode decodes MentalModelListResponse from json. -func (s *MentalModelListResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode MentalModelListResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "items": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Items = make([]MentalModelResponse, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem MentalModelResponse - if err := elem.Decode(d); err != nil { - return err - } - s.Items = append(s.Items, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode MentalModelListResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfMentalModelListResponse) { - name = jsonFieldsNameOfMentalModelListResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *MentalModelListResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *MentalModelListResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *MentalModelResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *MentalModelResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("content") - e.Str(s.Content) - } - { - if s.CreatedAt.Set { - e.FieldStart("created_at") - s.CreatedAt.Encode(e) - } - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - if s.LastRefreshedAt.Set { - e.FieldStart("last_refreshed_at") - s.LastRefreshedAt.Encode(e) - } - } - { - if s.MaxTokens.Set { - e.FieldStart("max_tokens") - s.MaxTokens.Encode(e) - } - } - { - e.FieldStart("name") - e.Str(s.Name) - } - { - if s.ReflectResponse.Set { - e.FieldStart("reflect_response") - s.ReflectResponse.Encode(e) - } - } - { - e.FieldStart("source_query") - e.Str(s.SourceQuery) - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - if s.Trigger.Set { - e.FieldStart("trigger") - s.Trigger.Encode(e) - } - } -} - -var jsonFieldsNameOfMentalModelResponse = [11]string{ - 0: "bank_id", - 1: "content", - 2: "created_at", - 3: "id", - 4: "last_refreshed_at", - 5: "max_tokens", - 6: "name", - 7: "reflect_response", - 8: "source_query", - 9: "tags", - 10: "trigger", -} - -// Decode decodes MentalModelResponse from json. -func (s *MentalModelResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode MentalModelResponse to nil") - } - var requiredBitSet [2]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "content": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.Content = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content\"") - } - case "created_at": - if err := func() error { - s.CreatedAt.Reset() - if err := s.CreatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"created_at\"") - } - case "id": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "last_refreshed_at": - if err := func() error { - s.LastRefreshedAt.Reset() - if err := s.LastRefreshedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"last_refreshed_at\"") - } - case "max_tokens": - if err := func() error { - s.MaxTokens.Reset() - if err := s.MaxTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"max_tokens\"") - } - case "name": - requiredBitSet[0] |= 1 << 6 - if err := func() error { - v, err := d.Str() - s.Name = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - case "reflect_response": - if err := func() error { - s.ReflectResponse.Reset() - if err := s.ReflectResponse.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"reflect_response\"") - } - case "source_query": - requiredBitSet[1] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.SourceQuery = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"source_query\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "trigger": - if err := func() error { - s.Trigger.Reset() - if err := s.Trigger.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"trigger\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode MentalModelResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [2]uint8{ - 0b01001011, - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfMentalModelResponse) { - name = jsonFieldsNameOfMentalModelResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *MentalModelResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *MentalModelResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s MentalModelResponseReflectResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s MentalModelResponseReflectResponse) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes MentalModelResponseReflectResponse from json. -func (s *MentalModelResponseReflectResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode MentalModelResponseReflectResponse to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode MentalModelResponseReflectResponse") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s MentalModelResponseReflectResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *MentalModelResponseReflectResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *MentalModelTrigger) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *MentalModelTrigger) encodeFields(e *jx.Encoder) { - { - if s.RefreshAfterConsolidation.Set { - e.FieldStart("refresh_after_consolidation") - s.RefreshAfterConsolidation.Encode(e) - } - } -} - -var jsonFieldsNameOfMentalModelTrigger = [1]string{ - 0: "refresh_after_consolidation", -} - -// Decode decodes MentalModelTrigger from json. -func (s *MentalModelTrigger) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode MentalModelTrigger to nil") - } - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "refresh_after_consolidation": - if err := func() error { - s.RefreshAfterConsolidation.Reset() - if err := s.RefreshAfterConsolidation.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"refresh_after_consolidation\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode MentalModelTrigger") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *MentalModelTrigger) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *MentalModelTrigger) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *OperationResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *OperationResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("created_at") - e.Str(s.CreatedAt) - } - { - if s.DocumentID.Set { - e.FieldStart("document_id") - s.DocumentID.Encode(e) - } - } - { - e.FieldStart("error_message") - e.Str(s.ErrorMessage) - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - e.FieldStart("items_count") - e.Int(s.ItemsCount) - } - { - e.FieldStart("status") - e.Str(s.Status) - } - { - e.FieldStart("task_type") - e.Str(s.TaskType) - } -} - -var jsonFieldsNameOfOperationResponse = [7]string{ - 0: "created_at", - 1: "document_id", - 2: "error_message", - 3: "id", - 4: "items_count", - 5: "status", - 6: "task_type", -} - -// Decode decodes OperationResponse from json. -func (s *OperationResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode OperationResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "created_at": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.CreatedAt = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"created_at\"") - } - case "document_id": - if err := func() error { - s.DocumentID.Reset() - if err := s.DocumentID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"document_id\"") - } - case "error_message": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.ErrorMessage = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"error_message\"") - } - case "id": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "items_count": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Int() - s.ItemsCount = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items_count\"") - } - case "status": - requiredBitSet[0] |= 1 << 5 - if err := func() error { - v, err := d.Str() - s.Status = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"status\"") - } - case "task_type": - requiredBitSet[0] |= 1 << 6 - if err := func() error { - v, err := d.Str() - s.TaskType = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"task_type\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode OperationResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b01111101, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfOperationResponse) { - name = jsonFieldsNameOfOperationResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *OperationResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OperationResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *OperationStatusResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *OperationStatusResponse) encodeFields(e *jx.Encoder) { - { - if s.CompletedAt.Set { - e.FieldStart("completed_at") - s.CompletedAt.Encode(e) - } - } - { - if s.CreatedAt.Set { - e.FieldStart("created_at") - s.CreatedAt.Encode(e) - } - } - { - if s.ErrorMessage.Set { - e.FieldStart("error_message") - s.ErrorMessage.Encode(e) - } - } - { - e.FieldStart("operation_id") - e.Str(s.OperationID) - } - { - if s.OperationType.Set { - e.FieldStart("operation_type") - s.OperationType.Encode(e) - } - } - { - e.FieldStart("status") - s.Status.Encode(e) - } - { - if s.UpdatedAt.Set { - e.FieldStart("updated_at") - s.UpdatedAt.Encode(e) - } - } -} - -var jsonFieldsNameOfOperationStatusResponse = [7]string{ - 0: "completed_at", - 1: "created_at", - 2: "error_message", - 3: "operation_id", - 4: "operation_type", - 5: "status", - 6: "updated_at", -} - -// Decode decodes OperationStatusResponse from json. -func (s *OperationStatusResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode OperationStatusResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "completed_at": - if err := func() error { - s.CompletedAt.Reset() - if err := s.CompletedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"completed_at\"") - } - case "created_at": - if err := func() error { - s.CreatedAt.Reset() - if err := s.CreatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"created_at\"") - } - case "error_message": - if err := func() error { - s.ErrorMessage.Reset() - if err := s.ErrorMessage.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"error_message\"") - } - case "operation_id": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.OperationID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operation_id\"") - } - case "operation_type": - if err := func() error { - s.OperationType.Reset() - if err := s.OperationType.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operation_type\"") - } - case "status": - requiredBitSet[0] |= 1 << 5 - if err := func() error { - if err := s.Status.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"status\"") - } - case "updated_at": - if err := func() error { - s.UpdatedAt.Reset() - if err := s.UpdatedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"updated_at\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode OperationStatusResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00101000, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfOperationStatusResponse) { - name = jsonFieldsNameOfOperationStatusResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *OperationStatusResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OperationStatusResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes OperationStatusResponseStatus as json. -func (s OperationStatusResponseStatus) Encode(e *jx.Encoder) { - e.Str(string(s)) -} - -// Decode decodes OperationStatusResponseStatus from json. -func (s *OperationStatusResponseStatus) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode OperationStatusResponseStatus to nil") - } - v, err := d.StrBytes() - if err != nil { - return err - } - // Try to use constant string. - switch OperationStatusResponseStatus(v) { - case OperationStatusResponseStatusPending: - *s = OperationStatusResponseStatusPending - case OperationStatusResponseStatusCompleted: - *s = OperationStatusResponseStatusCompleted - case OperationStatusResponseStatusFailed: - *s = OperationStatusResponseStatusFailed - case OperationStatusResponseStatusNotFound: - *s = OperationStatusResponseStatusNotFound - default: - *s = OperationStatusResponseStatus(v) - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OperationStatusResponseStatus) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OperationStatusResponseStatus) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *OperationsListResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *OperationsListResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("limit") - e.Int(s.Limit) - } - { - e.FieldStart("offset") - e.Int(s.Offset) - } - { - e.FieldStart("operations") - e.ArrStart() - for _, elem := range s.Operations { - elem.Encode(e) - } - e.ArrEnd() - } - { - e.FieldStart("total") - e.Int(s.Total) - } -} - -var jsonFieldsNameOfOperationsListResponse = [5]string{ - 0: "bank_id", - 1: "limit", - 2: "offset", - 3: "operations", - 4: "total", -} - -// Decode decodes OperationsListResponse from json. -func (s *OperationsListResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode OperationsListResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "bank_id": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "limit": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Int() - s.Limit = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"limit\"") - } - case "offset": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.Offset = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"offset\"") - } - case "operations": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - s.Operations = make([]OperationResponse, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem OperationResponse - if err := elem.Decode(d); err != nil { - return err - } - s.Operations = append(s.Operations, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operations\"") - } - case "total": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Int() - s.Total = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode OperationsListResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00011111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfOperationsListResponse) { - name = jsonFieldsNameOfOperationsListResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *OperationsListResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OperationsListResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes bool as json. -func (o OptBool) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Bool(bool(o.Value)) -} - -// Decode decodes bool from json. -func (o *OptBool) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptBool to nil") - } - o.Set = true - v, err := d.Bool() - if err != nil { - return err - } - o.Value = bool(v) - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptBool) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptBool) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes Budget as json. -func (o OptBudget) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) -} - -// Decode decodes Budget from json. -func (o *OptBudget) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptBudget to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptBudget) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptBudget) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ChunkIncludeOptions as json. -func (o OptChunkIncludeOptions) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ChunkIncludeOptions from json. -func (o *OptChunkIncludeOptions) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptChunkIncludeOptions to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptChunkIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptChunkIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes time.Time as json. -func (o OptDateTime) Encode(e *jx.Encoder, format func(*jx.Encoder, time.Time)) { - if !o.Set { - return - } - format(e, o.Value) -} - -// Decode decodes time.Time from json. -func (o *OptDateTime) Decode(d *jx.Decoder, format func(*jx.Decoder) (time.Time, error)) error { - if o == nil { - return errors.New("invalid: unable to decode OptDateTime to nil") - } - o.Set = true - v, err := format(d) - if err != nil { - return err - } - o.Value = v - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptDateTime) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e, json.EncodeDateTime) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptDateTime) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d, json.DecodeDateTime) -} - -// Encode encodes DispositionTraits as json. -func (o OptDispositionTraits) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes DispositionTraits from json. -func (o *OptDispositionTraits) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptDispositionTraits to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptDispositionTraits) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptDispositionTraits) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes EntityDetailResponseMetadata as json. -func (o OptEntityDetailResponseMetadata) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes EntityDetailResponseMetadata from json. -func (o *OptEntityDetailResponseMetadata) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptEntityDetailResponseMetadata to nil") - } - o.Set = true - o.Value = make(EntityDetailResponseMetadata) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptEntityDetailResponseMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptEntityDetailResponseMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes EntityIncludeOptions as json. -func (o OptEntityIncludeOptions) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes EntityIncludeOptions from json. -func (o *OptEntityIncludeOptions) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptEntityIncludeOptions to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptEntityIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptEntityIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes EntityListItemMetadata as json. -func (o OptEntityListItemMetadata) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes EntityListItemMetadata from json. -func (o *OptEntityListItemMetadata) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptEntityListItemMetadata to nil") - } - o.Set = true - o.Value = make(EntityListItemMetadata) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptEntityListItemMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptEntityListItemMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes IncludeOptions as json. -func (o OptIncludeOptions) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes IncludeOptions from json. -func (o *OptIncludeOptions) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptIncludeOptions to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes int as json. -func (o OptInt) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Int(int(o.Value)) -} - -// Decode decodes int from json. -func (o *OptInt) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptInt to nil") - } - o.Set = true - v, err := d.Int() - if err != nil { - return err - } - o.Value = int(v) - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptInt) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptInt) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes MemoryItemMetadata as json. -func (o OptMemoryItemMetadata) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes MemoryItemMetadata from json. -func (o *OptMemoryItemMetadata) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptMemoryItemMetadata to nil") - } - o.Set = true - o.Value = make(MemoryItemMetadata) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptMemoryItemMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptMemoryItemMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes MentalModelResponseReflectResponse as json. -func (o OptMentalModelResponseReflectResponse) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes MentalModelResponseReflectResponse from json. -func (o *OptMentalModelResponseReflectResponse) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptMentalModelResponseReflectResponse to nil") - } - o.Set = true - o.Value = make(MentalModelResponseReflectResponse) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptMentalModelResponseReflectResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptMentalModelResponseReflectResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes MentalModelTrigger as json. -func (o OptMentalModelTrigger) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes MentalModelTrigger from json. -func (o *OptMentalModelTrigger) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptMentalModelTrigger to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptMentalModelTrigger) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptMentalModelTrigger) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes RecallRequestTagsMatch as json. -func (o OptRecallRequestTagsMatch) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) -} - -// Decode decodes RecallRequestTagsMatch from json. -func (o *OptRecallRequestTagsMatch) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptRecallRequestTagsMatch to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptRecallRequestTagsMatch) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptRecallRequestTagsMatch) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes RecallResponseChunks as json. -func (o OptRecallResponseChunks) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes RecallResponseChunks from json. -func (o *OptRecallResponseChunks) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptRecallResponseChunks to nil") - } - o.Set = true - o.Value = make(RecallResponseChunks) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptRecallResponseChunks) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptRecallResponseChunks) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes RecallResponseEntities as json. -func (o OptRecallResponseEntities) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes RecallResponseEntities from json. -func (o *OptRecallResponseEntities) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptRecallResponseEntities to nil") - } - o.Set = true - o.Value = make(RecallResponseEntities) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptRecallResponseEntities) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptRecallResponseEntities) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes RecallResponseTrace as json. -func (o OptRecallResponseTrace) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes RecallResponseTrace from json. -func (o *OptRecallResponseTrace) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptRecallResponseTrace to nil") - } - o.Set = true - o.Value = make(RecallResponseTrace) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptRecallResponseTrace) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptRecallResponseTrace) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes RecallResultMetadata as json. -func (o OptRecallResultMetadata) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes RecallResultMetadata from json. -func (o *OptRecallResultMetadata) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptRecallResultMetadata to nil") - } - o.Set = true - o.Value = make(RecallResultMetadata) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptRecallResultMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptRecallResultMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectBasedOn as json. -func (o OptReflectBasedOn) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ReflectBasedOn from json. -func (o *OptReflectBasedOn) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptReflectBasedOn to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptReflectBasedOn) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptReflectBasedOn) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectIncludeOptions as json. -func (o OptReflectIncludeOptions) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ReflectIncludeOptions from json. -func (o *OptReflectIncludeOptions) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptReflectIncludeOptions to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptReflectIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptReflectIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectRequestResponseSchema as json. -func (o OptReflectRequestResponseSchema) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ReflectRequestResponseSchema from json. -func (o *OptReflectRequestResponseSchema) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptReflectRequestResponseSchema to nil") - } - o.Set = true - o.Value = make(ReflectRequestResponseSchema) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptReflectRequestResponseSchema) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptReflectRequestResponseSchema) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectRequestTagsMatch as json. -func (o OptReflectRequestTagsMatch) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) -} - -// Decode decodes ReflectRequestTagsMatch from json. -func (o *OptReflectRequestTagsMatch) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptReflectRequestTagsMatch to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptReflectRequestTagsMatch) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptReflectRequestTagsMatch) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectResponseStructuredOutput as json. -func (o OptReflectResponseStructuredOutput) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ReflectResponseStructuredOutput from json. -func (o *OptReflectResponseStructuredOutput) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptReflectResponseStructuredOutput to nil") - } - o.Set = true - o.Value = make(ReflectResponseStructuredOutput) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptReflectResponseStructuredOutput) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptReflectResponseStructuredOutput) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectToolCallOutput as json. -func (o OptReflectToolCallOutput) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ReflectToolCallOutput from json. -func (o *OptReflectToolCallOutput) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptReflectToolCallOutput to nil") - } - o.Set = true - o.Value = make(ReflectToolCallOutput) - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptReflectToolCallOutput) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptReflectToolCallOutput) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectTrace as json. -func (o OptReflectTrace) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ReflectTrace from json. -func (o *OptReflectTrace) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptReflectTrace to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptReflectTrace) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptReflectTrace) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes string as json. -func (o OptString) Encode(e *jx.Encoder) { - if !o.Set { - return - } - e.Str(string(o.Value)) -} - -// Decode decodes string from json. -func (o *OptString) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptString to nil") - } - o.Set = true - v, err := d.Str() - if err != nil { - return err - } - o.Value = string(v) - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptString) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptString) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes TokenUsage as json. -func (o OptTokenUsage) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes TokenUsage from json. -func (o *OptTokenUsage) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptTokenUsage to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptTokenUsage) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptTokenUsage) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ToolCallsIncludeOptions as json. -func (o OptToolCallsIncludeOptions) Encode(e *jx.Encoder) { - if !o.Set { - return - } - o.Value.Encode(e) -} - -// Decode decodes ToolCallsIncludeOptions from json. -func (o *OptToolCallsIncludeOptions) Decode(d *jx.Decoder) error { - if o == nil { - return errors.New("invalid: unable to decode OptToolCallsIncludeOptions to nil") - } - o.Set = true - if err := o.Value.Decode(d); err != nil { - return err - } - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s OptToolCallsIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *OptToolCallsIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *RecallRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *RecallRequest) encodeFields(e *jx.Encoder) { - { - if s.Budget.Set { - e.FieldStart("budget") - s.Budget.Encode(e) - } - } - { - if s.Include.Set { - e.FieldStart("include") - s.Include.Encode(e) - } - } - { - if s.MaxTokens.Set { - e.FieldStart("max_tokens") - s.MaxTokens.Encode(e) - } - } - { - e.FieldStart("query") - e.Str(s.Query) - } - { - if s.QueryTimestamp.Set { - e.FieldStart("query_timestamp") - s.QueryTimestamp.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - if s.TagsMatch.Set { - e.FieldStart("tags_match") - s.TagsMatch.Encode(e) - } - } - { - if s.Trace.Set { - e.FieldStart("trace") - s.Trace.Encode(e) - } - } - { - if s.Types != nil { - e.FieldStart("types") - e.ArrStart() - for _, elem := range s.Types { - e.Str(elem) - } - e.ArrEnd() - } - } -} - -var jsonFieldsNameOfRecallRequest = [9]string{ - 0: "budget", - 1: "include", - 2: "max_tokens", - 3: "query", - 4: "query_timestamp", - 5: "tags", - 6: "tags_match", - 7: "trace", - 8: "types", -} - -// Decode decodes RecallRequest from json. -func (s *RecallRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallRequest to nil") - } - var requiredBitSet [2]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "budget": - if err := func() error { - s.Budget.Reset() - if err := s.Budget.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"budget\"") - } - case "include": - if err := func() error { - s.Include.Reset() - if err := s.Include.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"include\"") - } - case "max_tokens": - if err := func() error { - s.MaxTokens.Reset() - if err := s.MaxTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"max_tokens\"") - } - case "query": - requiredBitSet[0] |= 1 << 3 - if err := func() error { - v, err := d.Str() - s.Query = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"query\"") - } - case "query_timestamp": - if err := func() error { - s.QueryTimestamp.Reset() - if err := s.QueryTimestamp.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"query_timestamp\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "tags_match": - if err := func() error { - s.TagsMatch.Reset() - if err := s.TagsMatch.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags_match\"") - } - case "trace": - if err := func() error { - s.Trace.Reset() - if err := s.Trace.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"trace\"") - } - case "types": - if err := func() error { - s.Types = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Types = append(s.Types, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"types\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode RecallRequest") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [2]uint8{ - 0b00001000, - 0b00000000, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfRecallRequest) { - name = jsonFieldsNameOfRecallRequest[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *RecallRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes RecallRequestTagsMatch as json. -func (s RecallRequestTagsMatch) Encode(e *jx.Encoder) { - e.Str(string(s)) -} - -// Decode decodes RecallRequestTagsMatch from json. -func (s *RecallRequestTagsMatch) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallRequestTagsMatch to nil") - } - v, err := d.StrBytes() - if err != nil { - return err - } - // Try to use constant string. - switch RecallRequestTagsMatch(v) { - case RecallRequestTagsMatchAny: - *s = RecallRequestTagsMatchAny - case RecallRequestTagsMatchAll: - *s = RecallRequestTagsMatchAll - case RecallRequestTagsMatchAnyStrict: - *s = RecallRequestTagsMatchAnyStrict - case RecallRequestTagsMatchAllStrict: - *s = RecallRequestTagsMatchAllStrict - default: - *s = RecallRequestTagsMatch(v) - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s RecallRequestTagsMatch) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallRequestTagsMatch) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *RecallResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *RecallResponse) encodeFields(e *jx.Encoder) { - { - if s.Chunks.Set { - e.FieldStart("chunks") - s.Chunks.Encode(e) - } - } - { - if s.Entities.Set { - e.FieldStart("entities") - s.Entities.Encode(e) - } - } - { - e.FieldStart("results") - e.ArrStart() - for _, elem := range s.Results { - elem.Encode(e) - } - e.ArrEnd() - } - { - if s.Trace.Set { - e.FieldStart("trace") - s.Trace.Encode(e) - } - } -} - -var jsonFieldsNameOfRecallResponse = [4]string{ - 0: "chunks", - 1: "entities", - 2: "results", - 3: "trace", -} - -// Decode decodes RecallResponse from json. -func (s *RecallResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "chunks": - if err := func() error { - s.Chunks.Reset() - if err := s.Chunks.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"chunks\"") - } - case "entities": - if err := func() error { - s.Entities.Reset() - if err := s.Entities.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"entities\"") - } - case "results": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - s.Results = make([]RecallResult, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem RecallResult - if err := elem.Decode(d); err != nil { - return err - } - s.Results = append(s.Results, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"results\"") - } - case "trace": - if err := func() error { - s.Trace.Reset() - if err := s.Trace.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"trace\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode RecallResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000100, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfRecallResponse) { - name = jsonFieldsNameOfRecallResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *RecallResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s RecallResponseChunks) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s RecallResponseChunks) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - elem.Encode(e) - } -} - -// Decode decodes RecallResponseChunks from json. -func (s *RecallResponseChunks) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallResponseChunks to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem ChunkData - if err := func() error { - if err := elem.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode RecallResponseChunks") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s RecallResponseChunks) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallResponseChunks) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s RecallResponseEntities) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s RecallResponseEntities) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - elem.Encode(e) - } -} - -// Decode decodes RecallResponseEntities from json. -func (s *RecallResponseEntities) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallResponseEntities to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem EntityStateResponse - if err := func() error { - if err := elem.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode RecallResponseEntities") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s RecallResponseEntities) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallResponseEntities) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s RecallResponseTrace) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s RecallResponseTrace) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes RecallResponseTrace from json. -func (s *RecallResponseTrace) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallResponseTrace to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode RecallResponseTrace") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s RecallResponseTrace) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallResponseTrace) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *RecallResult) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *RecallResult) encodeFields(e *jx.Encoder) { - { - if s.ChunkID.Set { - e.FieldStart("chunk_id") - s.ChunkID.Encode(e) - } - } - { - if s.Context.Set { - e.FieldStart("context") - s.Context.Encode(e) - } - } - { - if s.DocumentID.Set { - e.FieldStart("document_id") - s.DocumentID.Encode(e) - } - } - { - if s.Entities != nil { - e.FieldStart("entities") - e.ArrStart() - for _, elem := range s.Entities { - e.Str(elem) - } - e.ArrEnd() - } - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - if s.MentionedAt.Set { - e.FieldStart("mentioned_at") - s.MentionedAt.Encode(e) - } - } - { - if s.Metadata.Set { - e.FieldStart("metadata") - s.Metadata.Encode(e) - } - } - { - if s.OccurredEnd.Set { - e.FieldStart("occurred_end") - s.OccurredEnd.Encode(e) - } - } - { - if s.OccurredStart.Set { - e.FieldStart("occurred_start") - s.OccurredStart.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - e.FieldStart("text") - e.Str(s.Text) - } - { - if s.Type.Set { - e.FieldStart("type") - s.Type.Encode(e) - } - } -} - -var jsonFieldsNameOfRecallResult = [12]string{ - 0: "chunk_id", - 1: "context", - 2: "document_id", - 3: "entities", - 4: "id", - 5: "mentioned_at", - 6: "metadata", - 7: "occurred_end", - 8: "occurred_start", - 9: "tags", - 10: "text", - 11: "type", -} - -// Decode decodes RecallResult from json. -func (s *RecallResult) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallResult to nil") - } - var requiredBitSet [2]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "chunk_id": - if err := func() error { - s.ChunkID.Reset() - if err := s.ChunkID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"chunk_id\"") - } - case "context": - if err := func() error { - s.Context.Reset() - if err := s.Context.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"context\"") - } - case "document_id": - if err := func() error { - s.DocumentID.Reset() - if err := s.DocumentID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"document_id\"") - } - case "entities": - if err := func() error { - s.Entities = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Entities = append(s.Entities, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"entities\"") - } - case "id": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "mentioned_at": - if err := func() error { - s.MentionedAt.Reset() - if err := s.MentionedAt.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mentioned_at\"") - } - case "metadata": - if err := func() error { - s.Metadata.Reset() - if err := s.Metadata.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"metadata\"") - } - case "occurred_end": - if err := func() error { - s.OccurredEnd.Reset() - if err := s.OccurredEnd.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"occurred_end\"") - } - case "occurred_start": - if err := func() error { - s.OccurredStart.Reset() - if err := s.OccurredStart.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"occurred_start\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "text": - requiredBitSet[1] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Text = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"text\"") - } - case "type": - if err := func() error { - s.Type.Reset() - if err := s.Type.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"type\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode RecallResult") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [2]uint8{ - 0b00010000, - 0b00000100, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfRecallResult) { - name = jsonFieldsNameOfRecallResult[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *RecallResult) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallResult) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s RecallResultMetadata) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s RecallResultMetadata) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - e.Str(elem) - } -} - -// Decode decodes RecallResultMetadata from json. -func (s *RecallResultMetadata) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RecallResultMetadata to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem string - if err := func() error { - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode RecallResultMetadata") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s RecallResultMetadata) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RecallResultMetadata) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectBasedOn) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectBasedOn) encodeFields(e *jx.Encoder) { - { - if s.Directives != nil { - e.FieldStart("directives") - e.ArrStart() - for _, elem := range s.Directives { - elem.Encode(e) - } - e.ArrEnd() - } - } - { - if s.Memories != nil { - e.FieldStart("memories") - e.ArrStart() - for _, elem := range s.Memories { - elem.Encode(e) - } - e.ArrEnd() - } - } - { - if s.MentalModels != nil { - e.FieldStart("mental_models") - e.ArrStart() - for _, elem := range s.MentalModels { - elem.Encode(e) - } - e.ArrEnd() - } - } -} - -var jsonFieldsNameOfReflectBasedOn = [3]string{ - 0: "directives", - 1: "memories", - 2: "mental_models", -} - -// Decode decodes ReflectBasedOn from json. -func (s *ReflectBasedOn) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectBasedOn to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "directives": - if err := func() error { - s.Directives = make([]ReflectDirective, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ReflectDirective - if err := elem.Decode(d); err != nil { - return err - } - s.Directives = append(s.Directives, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"directives\"") - } - case "memories": - if err := func() error { - s.Memories = make([]ReflectFact, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ReflectFact - if err := elem.Decode(d); err != nil { - return err - } - s.Memories = append(s.Memories, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"memories\"") - } - case "mental_models": - if err := func() error { - s.MentalModels = make([]ReflectMentalModel, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ReflectMentalModel - if err := elem.Decode(d); err != nil { - return err - } - s.MentalModels = append(s.MentalModels, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"mental_models\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectBasedOn") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectBasedOn) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectBasedOn) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectDirective) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectDirective) encodeFields(e *jx.Encoder) { - { - e.FieldStart("content") - e.Str(s.Content) - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - e.FieldStart("name") - e.Str(s.Name) - } -} - -var jsonFieldsNameOfReflectDirective = [3]string{ - 0: "content", - 1: "id", - 2: "name", -} - -// Decode decodes ReflectDirective from json. -func (s *ReflectDirective) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectDirective to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "content": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.Content = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content\"") - } - case "id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "name": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Name = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectDirective") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfReflectDirective) { - name = jsonFieldsNameOfReflectDirective[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectDirective) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectDirective) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectFact) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectFact) encodeFields(e *jx.Encoder) { - { - if s.Context.Set { - e.FieldStart("context") - s.Context.Encode(e) - } - } - { - if s.ID.Set { - e.FieldStart("id") - s.ID.Encode(e) - } - } - { - if s.OccurredEnd.Set { - e.FieldStart("occurred_end") - s.OccurredEnd.Encode(e) - } - } - { - if s.OccurredStart.Set { - e.FieldStart("occurred_start") - s.OccurredStart.Encode(e) - } - } - { - e.FieldStart("text") - e.Str(s.Text) - } - { - if s.Type.Set { - e.FieldStart("type") - s.Type.Encode(e) - } - } -} - -var jsonFieldsNameOfReflectFact = [6]string{ - 0: "context", - 1: "id", - 2: "occurred_end", - 3: "occurred_start", - 4: "text", - 5: "type", -} - -// Decode decodes ReflectFact from json. -func (s *ReflectFact) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectFact to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "context": - if err := func() error { - s.Context.Reset() - if err := s.Context.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"context\"") - } - case "id": - if err := func() error { - s.ID.Reset() - if err := s.ID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "occurred_end": - if err := func() error { - s.OccurredEnd.Reset() - if err := s.OccurredEnd.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"occurred_end\"") - } - case "occurred_start": - if err := func() error { - s.OccurredStart.Reset() - if err := s.OccurredStart.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"occurred_start\"") - } - case "text": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Str() - s.Text = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"text\"") - } - case "type": - if err := func() error { - s.Type.Reset() - if err := s.Type.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"type\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectFact") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00010000, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfReflectFact) { - name = jsonFieldsNameOfReflectFact[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectFact) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectFact) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectIncludeOptions) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectIncludeOptions) encodeFields(e *jx.Encoder) { - { - if s.Facts != nil { - e.FieldStart("facts") - s.Facts.Encode(e) - } - } - { - if s.ToolCalls.Set { - e.FieldStart("tool_calls") - s.ToolCalls.Encode(e) - } - } -} - -var jsonFieldsNameOfReflectIncludeOptions = [2]string{ - 0: "facts", - 1: "tool_calls", -} - -// Decode decodes ReflectIncludeOptions from json. -func (s *ReflectIncludeOptions) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectIncludeOptions to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "facts": - if err := func() error { - s.Facts = nil - var elem FactsIncludeOptions - if err := elem.Decode(d); err != nil { - return err - } - s.Facts = &elem - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"facts\"") - } - case "tool_calls": - if err := func() error { - s.ToolCalls.Reset() - if err := s.ToolCalls.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tool_calls\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectIncludeOptions") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectLLMCall) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectLLMCall) encodeFields(e *jx.Encoder) { - { - e.FieldStart("duration_ms") - e.Int(s.DurationMs) - } - { - e.FieldStart("scope") - e.Str(s.Scope) - } -} - -var jsonFieldsNameOfReflectLLMCall = [2]string{ - 0: "duration_ms", - 1: "scope", -} - -// Decode decodes ReflectLLMCall from json. -func (s *ReflectLLMCall) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectLLMCall to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "duration_ms": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Int() - s.DurationMs = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"duration_ms\"") - } - case "scope": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.Scope = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"scope\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectLLMCall") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000011, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfReflectLLMCall) { - name = jsonFieldsNameOfReflectLLMCall[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectLLMCall) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectLLMCall) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectMentalModel) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectMentalModel) encodeFields(e *jx.Encoder) { - { - if s.Context.Set { - e.FieldStart("context") - s.Context.Encode(e) - } - } - { - e.FieldStart("id") - e.Str(s.ID) - } - { - e.FieldStart("text") - e.Str(s.Text) - } -} - -var jsonFieldsNameOfReflectMentalModel = [3]string{ - 0: "context", - 1: "id", - 2: "text", -} - -// Decode decodes ReflectMentalModel from json. -func (s *ReflectMentalModel) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectMentalModel to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "context": - if err := func() error { - s.Context.Reset() - if err := s.Context.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"context\"") - } - case "id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.ID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"id\"") - } - case "text": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Text = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"text\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectMentalModel") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000110, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfReflectMentalModel) { - name = jsonFieldsNameOfReflectMentalModel[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectMentalModel) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectMentalModel) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectRequest) encodeFields(e *jx.Encoder) { - { - if s.Budget.Set { - e.FieldStart("budget") - s.Budget.Encode(e) - } - } - { - if s.Context.Set { - e.FieldStart("context") - s.Context.Encode(e) - } - } - { - if s.Include.Set { - e.FieldStart("include") - s.Include.Encode(e) - } - } - { - if s.MaxTokens.Set { - e.FieldStart("max_tokens") - s.MaxTokens.Encode(e) - } - } - { - e.FieldStart("query") - e.Str(s.Query) - } - { - if s.ResponseSchema.Set { - e.FieldStart("response_schema") - s.ResponseSchema.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - if s.TagsMatch.Set { - e.FieldStart("tags_match") - s.TagsMatch.Encode(e) - } - } -} - -var jsonFieldsNameOfReflectRequest = [8]string{ - 0: "budget", - 1: "context", - 2: "include", - 3: "max_tokens", - 4: "query", - 5: "response_schema", - 6: "tags", - 7: "tags_match", -} - -// Decode decodes ReflectRequest from json. -func (s *ReflectRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectRequest to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "budget": - if err := func() error { - s.Budget.Reset() - if err := s.Budget.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"budget\"") - } - case "context": - if err := func() error { - s.Context.Reset() - if err := s.Context.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"context\"") - } - case "include": - if err := func() error { - s.Include.Reset() - if err := s.Include.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"include\"") - } - case "max_tokens": - if err := func() error { - s.MaxTokens.Reset() - if err := s.MaxTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"max_tokens\"") - } - case "query": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Str() - s.Query = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"query\"") - } - case "response_schema": - if err := func() error { - s.ResponseSchema.Reset() - if err := s.ResponseSchema.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"response_schema\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "tags_match": - if err := func() error { - s.TagsMatch.Reset() - if err := s.TagsMatch.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags_match\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectRequest") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00010000, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfReflectRequest) { - name = jsonFieldsNameOfReflectRequest[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s ReflectRequestResponseSchema) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s ReflectRequestResponseSchema) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes ReflectRequestResponseSchema from json. -func (s *ReflectRequestResponseSchema) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectRequestResponseSchema to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectRequestResponseSchema") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s ReflectRequestResponseSchema) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectRequestResponseSchema) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode encodes ReflectRequestTagsMatch as json. -func (s ReflectRequestTagsMatch) Encode(e *jx.Encoder) { - e.Str(string(s)) -} - -// Decode decodes ReflectRequestTagsMatch from json. -func (s *ReflectRequestTagsMatch) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectRequestTagsMatch to nil") - } - v, err := d.StrBytes() - if err != nil { - return err - } - // Try to use constant string. - switch ReflectRequestTagsMatch(v) { - case ReflectRequestTagsMatchAny: - *s = ReflectRequestTagsMatchAny - case ReflectRequestTagsMatchAll: - *s = ReflectRequestTagsMatchAll - case ReflectRequestTagsMatchAnyStrict: - *s = ReflectRequestTagsMatchAnyStrict - case ReflectRequestTagsMatchAllStrict: - *s = ReflectRequestTagsMatchAllStrict - default: - *s = ReflectRequestTagsMatch(v) - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s ReflectRequestTagsMatch) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectRequestTagsMatch) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectResponse) encodeFields(e *jx.Encoder) { - { - if s.BasedOn.Set { - e.FieldStart("based_on") - s.BasedOn.Encode(e) - } - } - { - if s.StructuredOutput.Set { - e.FieldStart("structured_output") - s.StructuredOutput.Encode(e) - } - } - { - e.FieldStart("text") - e.Str(s.Text) - } - { - if s.Trace.Set { - e.FieldStart("trace") - s.Trace.Encode(e) - } - } - { - if s.Usage.Set { - e.FieldStart("usage") - s.Usage.Encode(e) - } - } -} - -var jsonFieldsNameOfReflectResponse = [5]string{ - 0: "based_on", - 1: "structured_output", - 2: "text", - 3: "trace", - 4: "usage", -} - -// Decode decodes ReflectResponse from json. -func (s *ReflectResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "based_on": - if err := func() error { - s.BasedOn.Reset() - if err := s.BasedOn.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"based_on\"") - } - case "structured_output": - if err := func() error { - s.StructuredOutput.Reset() - if err := s.StructuredOutput.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"structured_output\"") - } - case "text": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Text = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"text\"") - } - case "trace": - if err := func() error { - s.Trace.Reset() - if err := s.Trace.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"trace\"") - } - case "usage": - if err := func() error { - s.Usage.Reset() - if err := s.Usage.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"usage\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000100, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfReflectResponse) { - name = jsonFieldsNameOfReflectResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s ReflectResponseStructuredOutput) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s ReflectResponseStructuredOutput) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes ReflectResponseStructuredOutput from json. -func (s *ReflectResponseStructuredOutput) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectResponseStructuredOutput to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectResponseStructuredOutput") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s ReflectResponseStructuredOutput) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectResponseStructuredOutput) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectToolCall) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectToolCall) encodeFields(e *jx.Encoder) { - { - e.FieldStart("duration_ms") - e.Int(s.DurationMs) - } - { - e.FieldStart("input") - s.Input.Encode(e) - } - { - if s.Iteration.Set { - e.FieldStart("iteration") - s.Iteration.Encode(e) - } - } - { - if s.Output.Set { - e.FieldStart("output") - s.Output.Encode(e) - } - } - { - e.FieldStart("tool") - e.Str(s.Tool) - } -} - -var jsonFieldsNameOfReflectToolCall = [5]string{ - 0: "duration_ms", - 1: "input", - 2: "iteration", - 3: "output", - 4: "tool", -} - -// Decode decodes ReflectToolCall from json. -func (s *ReflectToolCall) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectToolCall to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "duration_ms": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Int() - s.DurationMs = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"duration_ms\"") - } - case "input": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - if err := s.Input.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"input\"") - } - case "iteration": - if err := func() error { - s.Iteration.Reset() - if err := s.Iteration.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"iteration\"") - } - case "output": - if err := func() error { - s.Output.Reset() - if err := s.Output.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"output\"") - } - case "tool": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Str() - s.Tool = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tool\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectToolCall") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00010011, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfReflectToolCall) { - name = jsonFieldsNameOfReflectToolCall[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectToolCall) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectToolCall) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s ReflectToolCallInput) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s ReflectToolCallInput) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes ReflectToolCallInput from json. -func (s *ReflectToolCallInput) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectToolCallInput to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectToolCallInput") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s ReflectToolCallInput) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectToolCallInput) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s ReflectToolCallOutput) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields implements json.Marshaler. -func (s ReflectToolCallOutput) encodeFields(e *jx.Encoder) { - for k, elem := range s { - e.FieldStart(k) - - if len(elem) != 0 { - e.Raw(elem) - } - } -} - -// Decode decodes ReflectToolCallOutput from json. -func (s *ReflectToolCallOutput) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectToolCallOutput to nil") - } - m := s.init() - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - var elem jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - elem = jx.Raw(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrapf(err, "decode field %q", k) - } - m[string(k)] = elem - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectToolCallOutput") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s ReflectToolCallOutput) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectToolCallOutput) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ReflectTrace) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ReflectTrace) encodeFields(e *jx.Encoder) { - { - if s.LlmCalls != nil { - e.FieldStart("llm_calls") - e.ArrStart() - for _, elem := range s.LlmCalls { - elem.Encode(e) - } - e.ArrEnd() - } - } - { - if s.ToolCalls != nil { - e.FieldStart("tool_calls") - e.ArrStart() - for _, elem := range s.ToolCalls { - elem.Encode(e) - } - e.ArrEnd() - } - } -} - -var jsonFieldsNameOfReflectTrace = [2]string{ - 0: "llm_calls", - 1: "tool_calls", -} - -// Decode decodes ReflectTrace from json. -func (s *ReflectTrace) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ReflectTrace to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "llm_calls": - if err := func() error { - s.LlmCalls = make([]ReflectLLMCall, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ReflectLLMCall - if err := elem.Decode(d); err != nil { - return err - } - s.LlmCalls = append(s.LlmCalls, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"llm_calls\"") - } - case "tool_calls": - if err := func() error { - s.ToolCalls = make([]ReflectToolCall, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem ReflectToolCall - if err := elem.Decode(d); err != nil { - return err - } - s.ToolCalls = append(s.ToolCalls, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tool_calls\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ReflectTrace") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ReflectTrace) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ReflectTrace) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *RetainRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *RetainRequest) encodeFields(e *jx.Encoder) { - { - if s.Async.Set { - e.FieldStart("async") - s.Async.Encode(e) - } - } - { - if s.DocumentTags != nil { - e.FieldStart("document_tags") - e.ArrStart() - for _, elem := range s.DocumentTags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - e.FieldStart("items") - e.ArrStart() - for _, elem := range s.Items { - elem.Encode(e) - } - e.ArrEnd() - } -} - -var jsonFieldsNameOfRetainRequest = [3]string{ - 0: "async", - 1: "document_tags", - 2: "items", -} - -// Decode decodes RetainRequest from json. -func (s *RetainRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RetainRequest to nil") - } - var requiredBitSet [1]uint8 - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "async": - if err := func() error { - s.Async.Reset() - if err := s.Async.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"async\"") - } - case "document_tags": - if err := func() error { - s.DocumentTags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.DocumentTags = append(s.DocumentTags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"document_tags\"") - } - case "items": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - s.Items = make([]MemoryItem, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem MemoryItem - if err := elem.Decode(d); err != nil { - return err - } - s.Items = append(s.Items, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode RetainRequest") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000100, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfRetainRequest) { - name = jsonFieldsNameOfRetainRequest[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *RetainRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RetainRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *RetainResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *RetainResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("async") - e.Bool(s.Async) - } - { - e.FieldStart("bank_id") - e.Str(s.BankID) - } - { - e.FieldStart("items_count") - e.Int(s.ItemsCount) - } - { - if s.OperationID.Set { - e.FieldStart("operation_id") - s.OperationID.Encode(e) - } - } - { - e.FieldStart("success") - e.Bool(s.Success) - } - { - if s.Usage.Set { - e.FieldStart("usage") - s.Usage.Encode(e) - } - } -} - -var jsonFieldsNameOfRetainResponse = [6]string{ - 0: "async", - 1: "bank_id", - 2: "items_count", - 3: "operation_id", - 4: "success", - 5: "usage", -} - -// Decode decodes RetainResponse from json. -func (s *RetainResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode RetainResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "async": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Bool() - s.Async = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"async\"") - } - case "bank_id": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.BankID = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"bank_id\"") - } - case "items_count": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Int() - s.ItemsCount = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"items_count\"") - } - case "operation_id": - if err := func() error { - s.OperationID.Reset() - if err := s.OperationID.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"operation_id\"") - } - case "success": - requiredBitSet[0] |= 1 << 4 - if err := func() error { - v, err := d.Bool() - s.Success = bool(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"success\"") - } - case "usage": - if err := func() error { - s.Usage.Reset() - if err := s.Usage.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"usage\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode RetainResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00010111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfRetainResponse) { - name = jsonFieldsNameOfRetainResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *RetainResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *RetainResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *TagItem) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *TagItem) encodeFields(e *jx.Encoder) { - { - e.FieldStart("count") - e.Int(s.Count) - } - { - e.FieldStart("tag") - e.Str(s.Tag) - } -} - -var jsonFieldsNameOfTagItem = [2]string{ - 0: "count", - 1: "tag", -} - -// Decode decodes TagItem from json. -func (s *TagItem) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode TagItem to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "count": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Int() - s.Count = int(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"count\"") - } - case "tag": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.Tag = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tag\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode TagItem") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000011, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfTagItem) { - name = jsonFieldsNameOfTagItem[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *TagItem) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *TagItem) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *TokenUsage) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *TokenUsage) encodeFields(e *jx.Encoder) { - { - if s.InputTokens.Set { - e.FieldStart("input_tokens") - s.InputTokens.Encode(e) - } - } - { - if s.OutputTokens.Set { - e.FieldStart("output_tokens") - s.OutputTokens.Encode(e) - } - } - { - if s.TotalTokens.Set { - e.FieldStart("total_tokens") - s.TotalTokens.Encode(e) - } - } -} - -var jsonFieldsNameOfTokenUsage = [3]string{ - 0: "input_tokens", - 1: "output_tokens", - 2: "total_tokens", -} - -// Decode decodes TokenUsage from json. -func (s *TokenUsage) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode TokenUsage to nil") - } - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "input_tokens": - if err := func() error { - s.InputTokens.Reset() - if err := s.InputTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"input_tokens\"") - } - case "output_tokens": - if err := func() error { - s.OutputTokens.Reset() - if err := s.OutputTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"output_tokens\"") - } - case "total_tokens": - if err := func() error { - s.TotalTokens.Reset() - if err := s.TotalTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"total_tokens\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode TokenUsage") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *TokenUsage) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *TokenUsage) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ToolCallsIncludeOptions) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ToolCallsIncludeOptions) encodeFields(e *jx.Encoder) { - { - if s.Output.Set { - e.FieldStart("output") - s.Output.Encode(e) - } - } -} - -var jsonFieldsNameOfToolCallsIncludeOptions = [1]string{ - 0: "output", -} - -// Decode decodes ToolCallsIncludeOptions from json. -func (s *ToolCallsIncludeOptions) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ToolCallsIncludeOptions to nil") - } - s.setDefaults() - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "output": - if err := func() error { - s.Output.Reset() - if err := s.Output.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"output\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ToolCallsIncludeOptions") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ToolCallsIncludeOptions) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ToolCallsIncludeOptions) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *UpdateDirectiveRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *UpdateDirectiveRequest) encodeFields(e *jx.Encoder) { - { - if s.Content.Set { - e.FieldStart("content") - s.Content.Encode(e) - } - } - { - if s.IsActive.Set { - e.FieldStart("is_active") - s.IsActive.Encode(e) - } - } - { - if s.Name.Set { - e.FieldStart("name") - s.Name.Encode(e) - } - } - { - if s.Priority.Set { - e.FieldStart("priority") - s.Priority.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } -} - -var jsonFieldsNameOfUpdateDirectiveRequest = [5]string{ - 0: "content", - 1: "is_active", - 2: "name", - 3: "priority", - 4: "tags", -} - -// Decode decodes UpdateDirectiveRequest from json. -func (s *UpdateDirectiveRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode UpdateDirectiveRequest to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "content": - if err := func() error { - s.Content.Reset() - if err := s.Content.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"content\"") - } - case "is_active": - if err := func() error { - s.IsActive.Reset() - if err := s.IsActive.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"is_active\"") - } - case "name": - if err := func() error { - s.Name.Reset() - if err := s.Name.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - case "priority": - if err := func() error { - s.Priority.Reset() - if err := s.Priority.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"priority\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode UpdateDirectiveRequest") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *UpdateDirectiveRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *UpdateDirectiveRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *UpdateDispositionRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *UpdateDispositionRequest) encodeFields(e *jx.Encoder) { - { - e.FieldStart("disposition") - s.Disposition.Encode(e) - } -} - -var jsonFieldsNameOfUpdateDispositionRequest = [1]string{ - 0: "disposition", -} - -// Decode decodes UpdateDispositionRequest from json. -func (s *UpdateDispositionRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode UpdateDispositionRequest to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "disposition": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - if err := s.Disposition.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"disposition\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode UpdateDispositionRequest") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000001, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfUpdateDispositionRequest) { - name = jsonFieldsNameOfUpdateDispositionRequest[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *UpdateDispositionRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *UpdateDispositionRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *UpdateMentalModelRequest) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *UpdateMentalModelRequest) encodeFields(e *jx.Encoder) { - { - if s.MaxTokens.Set { - e.FieldStart("max_tokens") - s.MaxTokens.Encode(e) - } - } - { - if s.Name.Set { - e.FieldStart("name") - s.Name.Encode(e) - } - } - { - if s.SourceQuery.Set { - e.FieldStart("source_query") - s.SourceQuery.Encode(e) - } - } - { - if s.Tags != nil { - e.FieldStart("tags") - e.ArrStart() - for _, elem := range s.Tags { - e.Str(elem) - } - e.ArrEnd() - } - } - { - if s.Trigger.Set { - e.FieldStart("trigger") - s.Trigger.Encode(e) - } - } -} - -var jsonFieldsNameOfUpdateMentalModelRequest = [5]string{ - 0: "max_tokens", - 1: "name", - 2: "source_query", - 3: "tags", - 4: "trigger", -} - -// Decode decodes UpdateMentalModelRequest from json. -func (s *UpdateMentalModelRequest) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode UpdateMentalModelRequest to nil") - } - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "max_tokens": - if err := func() error { - s.MaxTokens.Reset() - if err := s.MaxTokens.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"max_tokens\"") - } - case "name": - if err := func() error { - s.Name.Reset() - if err := s.Name.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"name\"") - } - case "source_query": - if err := func() error { - s.SourceQuery.Reset() - if err := s.SourceQuery.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"source_query\"") - } - case "tags": - if err := func() error { - s.Tags = make([]string, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem string - v, err := d.Str() - elem = string(v) - if err != nil { - return err - } - s.Tags = append(s.Tags, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"tags\"") - } - case "trigger": - if err := func() error { - s.Trigger.Reset() - if err := s.Trigger.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"trigger\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode UpdateMentalModelRequest") - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *UpdateMentalModelRequest) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *UpdateMentalModelRequest) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *ValidationError) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *ValidationError) encodeFields(e *jx.Encoder) { - { - e.FieldStart("loc") - e.ArrStart() - for _, elem := range s.Loc { - e.Int(elem) - } - e.ArrEnd() - } - { - e.FieldStart("msg") - e.Str(s.Msg) - } - { - e.FieldStart("type") - e.Str(s.Type) - } -} - -var jsonFieldsNameOfValidationError = [3]string{ - 0: "loc", - 1: "msg", - 2: "type", -} - -// Decode decodes ValidationError from json. -func (s *ValidationError) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode ValidationError to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "loc": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - s.Loc = make([]int, 0) - if err := d.Arr(func(d *jx.Decoder) error { - var elem int - v, err := d.Int() - elem = int(v) - if err != nil { - return err - } - s.Loc = append(s.Loc, elem) - return nil - }); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"loc\"") - } - case "msg": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - v, err := d.Str() - s.Msg = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"msg\"") - } - case "type": - requiredBitSet[0] |= 1 << 2 - if err := func() error { - v, err := d.Str() - s.Type = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"type\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode ValidationError") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000111, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfValidationError) { - name = jsonFieldsNameOfValidationError[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *ValidationError) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *ValidationError) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} - -// Encode implements json.Marshaler. -func (s *VersionResponse) Encode(e *jx.Encoder) { - e.ObjStart() - s.encodeFields(e) - e.ObjEnd() -} - -// encodeFields encodes fields. -func (s *VersionResponse) encodeFields(e *jx.Encoder) { - { - e.FieldStart("api_version") - e.Str(s.APIVersion) - } - { - e.FieldStart("features") - s.Features.Encode(e) - } -} - -var jsonFieldsNameOfVersionResponse = [2]string{ - 0: "api_version", - 1: "features", -} - -// Decode decodes VersionResponse from json. -func (s *VersionResponse) Decode(d *jx.Decoder) error { - if s == nil { - return errors.New("invalid: unable to decode VersionResponse to nil") - } - var requiredBitSet [1]uint8 - - if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error { - switch string(k) { - case "api_version": - requiredBitSet[0] |= 1 << 0 - if err := func() error { - v, err := d.Str() - s.APIVersion = string(v) - if err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"api_version\"") - } - case "features": - requiredBitSet[0] |= 1 << 1 - if err := func() error { - if err := s.Features.Decode(d); err != nil { - return err - } - return nil - }(); err != nil { - return errors.Wrap(err, "decode field \"features\"") - } - default: - return d.Skip() - } - return nil - }); err != nil { - return errors.Wrap(err, "decode VersionResponse") - } - // Validate required fields. - var failures []validate.FieldError - for i, mask := range [1]uint8{ - 0b00000011, - } { - if result := (requiredBitSet[i] & mask) ^ mask; result != 0 { - // Mask only required fields and check equality to mask using XOR. - // - // If XOR result is not zero, result is not equal to expected, so some fields are missed. - // Bits of fields which would be set are actually bits of missed fields. - missed := bits.OnesCount8(result) - for bitN := 0; bitN < missed; bitN++ { - bitIdx := bits.TrailingZeros8(result) - fieldIdx := i*8 + bitIdx - var name string - if fieldIdx < len(jsonFieldsNameOfVersionResponse) { - name = jsonFieldsNameOfVersionResponse[fieldIdx] - } else { - name = strconv.Itoa(fieldIdx) - } - failures = append(failures, validate.FieldError{ - Name: name, - Error: validate.ErrFieldRequired, - }) - // Reset bit. - result &^= 1 << bitIdx - } - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - - return nil -} - -// MarshalJSON implements stdjson.Marshaler. -func (s *VersionResponse) MarshalJSON() ([]byte, error) { - e := jx.Encoder{} - s.Encode(&e) - return e.Bytes(), nil -} - -// UnmarshalJSON implements stdjson.Unmarshaler. -func (s *VersionResponse) UnmarshalJSON(data []byte) error { - d := jx.DecodeBytes(data) - return s.Decode(d) -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_operations_gen.go b/hindsight-clients/go/internal/ogenapi/oas_operations_gen.go deleted file mode 100644 index 16cda15c..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_operations_gen.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -// OperationName is the ogen operation name -type OperationName = string - -const ( - AddBankBackgroundOperation OperationName = "AddBankBackground" - CancelOperationOperation OperationName = "CancelOperation" - ClearBankMemoriesOperation OperationName = "ClearBankMemories" - ClearObservationsOperation OperationName = "ClearObservations" - CreateDirectiveOperation OperationName = "CreateDirective" - CreateMentalModelOperation OperationName = "CreateMentalModel" - CreateOrUpdateBankOperation OperationName = "CreateOrUpdateBank" - DeleteBankOperation OperationName = "DeleteBank" - DeleteDirectiveOperation OperationName = "DeleteDirective" - DeleteDocumentOperation OperationName = "DeleteDocument" - DeleteMentalModelOperation OperationName = "DeleteMentalModel" - GetAgentStatsOperation OperationName = "GetAgentStats" - GetBankConfigOperation OperationName = "GetBankConfig" - GetBankProfileOperation OperationName = "GetBankProfile" - GetChunkOperation OperationName = "GetChunk" - GetDirectiveOperation OperationName = "GetDirective" - GetDocumentOperation OperationName = "GetDocument" - GetEntityOperation OperationName = "GetEntity" - GetGraphOperation OperationName = "GetGraph" - GetMemoryOperation OperationName = "GetMemory" - GetMentalModelOperation OperationName = "GetMentalModel" - GetOperationStatusOperation OperationName = "GetOperationStatus" - GetVersionOperation OperationName = "GetVersion" - HealthEndpointHealthGetOperation OperationName = "HealthEndpointHealthGet" - ListBanksOperation OperationName = "ListBanks" - ListDirectivesOperation OperationName = "ListDirectives" - ListDocumentsOperation OperationName = "ListDocuments" - ListEntitiesOperation OperationName = "ListEntities" - ListMemoriesOperation OperationName = "ListMemories" - ListMentalModelsOperation OperationName = "ListMentalModels" - ListOperationsOperation OperationName = "ListOperations" - ListTagsOperation OperationName = "ListTags" - MetricsEndpointMetricsGetOperation OperationName = "MetricsEndpointMetricsGet" - RecallMemoriesOperation OperationName = "RecallMemories" - ReflectOperation OperationName = "Reflect" - RefreshMentalModelOperation OperationName = "RefreshMentalModel" - RegenerateEntityObservationsOperation OperationName = "RegenerateEntityObservations" - ResetBankConfigOperation OperationName = "ResetBankConfig" - RetainMemoriesOperation OperationName = "RetainMemories" - TriggerConsolidationOperation OperationName = "TriggerConsolidation" - UpdateBankOperation OperationName = "UpdateBank" - UpdateBankConfigOperation OperationName = "UpdateBankConfig" - UpdateBankDispositionOperation OperationName = "UpdateBankDisposition" - UpdateDirectiveOperation OperationName = "UpdateDirective" - UpdateMentalModelOperation OperationName = "UpdateMentalModel" -) diff --git a/hindsight-clients/go/internal/ogenapi/oas_parameters_gen.go b/hindsight-clients/go/internal/ogenapi/oas_parameters_gen.go deleted file mode 100644 index ac32bcee..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_parameters_gen.go +++ /dev/null @@ -1,264 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -// AddBankBackgroundParams is parameters of add_bank_background operation. -type AddBankBackgroundParams struct { - BankID string -} - -// CancelOperationParams is parameters of cancel_operation operation. -type CancelOperationParams struct { - BankID string - OperationID string -} - -// ClearBankMemoriesParams is parameters of clear_bank_memories operation. -type ClearBankMemoriesParams struct { - BankID string - // Optional fact type filter (world, experience, opinion). - Type OptString `json:",omitempty,omitzero"` -} - -// ClearObservationsParams is parameters of clear_observations operation. -type ClearObservationsParams struct { - BankID string -} - -// CreateDirectiveParams is parameters of create_directive operation. -type CreateDirectiveParams struct { - BankID string -} - -// CreateMentalModelParams is parameters of create_mental_model operation. -type CreateMentalModelParams struct { - BankID string -} - -// CreateOrUpdateBankParams is parameters of create_or_update_bank operation. -type CreateOrUpdateBankParams struct { - BankID string -} - -// DeleteBankParams is parameters of delete_bank operation. -type DeleteBankParams struct { - BankID string -} - -// DeleteDirectiveParams is parameters of delete_directive operation. -type DeleteDirectiveParams struct { - BankID string - DirectiveID string -} - -// DeleteDocumentParams is parameters of delete_document operation. -type DeleteDocumentParams struct { - BankID string - DocumentID string -} - -// DeleteMentalModelParams is parameters of delete_mental_model operation. -type DeleteMentalModelParams struct { - BankID string - MentalModelID string -} - -// GetAgentStatsParams is parameters of get_agent_stats operation. -type GetAgentStatsParams struct { - BankID string -} - -// GetBankConfigParams is parameters of get_bank_config operation. -type GetBankConfigParams struct { - BankID string -} - -// GetBankProfileParams is parameters of get_bank_profile operation. -type GetBankProfileParams struct { - BankID string -} - -// GetChunkParams is parameters of get_chunk operation. -type GetChunkParams struct { - ChunkID string -} - -// GetDirectiveParams is parameters of get_directive operation. -type GetDirectiveParams struct { - BankID string - DirectiveID string -} - -// GetDocumentParams is parameters of get_document operation. -type GetDocumentParams struct { - BankID string - DocumentID string -} - -// GetEntityParams is parameters of get_entity operation. -type GetEntityParams struct { - BankID string - EntityID string -} - -// GetGraphParams is parameters of get_graph operation. -type GetGraphParams struct { - BankID string - Type OptString `json:",omitempty,omitzero"` - Limit OptInt `json:",omitempty,omitzero"` -} - -// GetMemoryParams is parameters of get_memory operation. -type GetMemoryParams struct { - BankID string - MemoryID string -} - -// GetMentalModelParams is parameters of get_mental_model operation. -type GetMentalModelParams struct { - BankID string - MentalModelID string -} - -// GetOperationStatusParams is parameters of get_operation_status operation. -type GetOperationStatusParams struct { - BankID string - OperationID string -} - -// ListDirectivesParams is parameters of list_directives operation. -type ListDirectivesParams struct { - BankID string - // Filter by tags. - Tags []string `json:",omitempty"` - // How to match tags. - TagsMatch OptListDirectivesTagsMatch `json:",omitempty,omitzero"` - // Only return active directives. - ActiveOnly OptBool `json:",omitempty,omitzero"` - Limit OptInt `json:",omitempty,omitzero"` - Offset OptInt `json:",omitempty,omitzero"` -} - -// ListDocumentsParams is parameters of list_documents operation. -type ListDocumentsParams struct { - BankID string - Q OptString `json:",omitempty,omitzero"` - Limit OptInt `json:",omitempty,omitzero"` - Offset OptInt `json:",omitempty,omitzero"` -} - -// ListEntitiesParams is parameters of list_entities operation. -type ListEntitiesParams struct { - BankID string - // Maximum number of entities to return. - Limit OptInt `json:",omitempty,omitzero"` - // Offset for pagination. - Offset OptInt `json:",omitempty,omitzero"` -} - -// ListMemoriesParams is parameters of list_memories operation. -type ListMemoriesParams struct { - BankID string - Type OptString `json:",omitempty,omitzero"` - Q OptString `json:",omitempty,omitzero"` - Limit OptInt `json:",omitempty,omitzero"` - Offset OptInt `json:",omitempty,omitzero"` -} - -// ListMentalModelsParams is parameters of list_mental_models operation. -type ListMentalModelsParams struct { - BankID string - // Filter by tags. - Tags []string `json:",omitempty"` - // How to match tags. - TagsMatch OptListMentalModelsTagsMatch `json:",omitempty,omitzero"` - Limit OptInt `json:",omitempty,omitzero"` - Offset OptInt `json:",omitempty,omitzero"` -} - -// ListOperationsParams is parameters of list_operations operation. -type ListOperationsParams struct { - BankID string - // Filter by status: pending, completed, or failed. - Status OptString `json:",omitempty,omitzero"` - // Maximum number of operations to return. - Limit OptInt `json:",omitempty,omitzero"` - // Number of operations to skip. - Offset OptInt `json:",omitempty,omitzero"` -} - -// ListTagsParams is parameters of list_tags operation. -type ListTagsParams struct { - BankID string - // Wildcard pattern to filter tags (e.g., 'user:*' for user:alice, '*-admin' for role-admin). Use '*' - // as wildcard. Case-insensitive. - Q OptString `json:",omitempty,omitzero"` - // Maximum number of tags to return. - Limit OptInt `json:",omitempty,omitzero"` - // Offset for pagination. - Offset OptInt `json:",omitempty,omitzero"` -} - -// RecallMemoriesParams is parameters of recall_memories operation. -type RecallMemoriesParams struct { - BankID string -} - -// ReflectParams is parameters of reflect operation. -type ReflectParams struct { - BankID string -} - -// RefreshMentalModelParams is parameters of refresh_mental_model operation. -type RefreshMentalModelParams struct { - BankID string - MentalModelID string -} - -// RegenerateEntityObservationsParams is parameters of regenerate_entity_observations operation. -type RegenerateEntityObservationsParams struct { - BankID string - EntityID string -} - -// ResetBankConfigParams is parameters of reset_bank_config operation. -type ResetBankConfigParams struct { - BankID string -} - -// RetainMemoriesParams is parameters of retain_memories operation. -type RetainMemoriesParams struct { - BankID string -} - -// TriggerConsolidationParams is parameters of trigger_consolidation operation. -type TriggerConsolidationParams struct { - BankID string -} - -// UpdateBankParams is parameters of update_bank operation. -type UpdateBankParams struct { - BankID string -} - -// UpdateBankConfigParams is parameters of update_bank_config operation. -type UpdateBankConfigParams struct { - BankID string -} - -// UpdateBankDispositionParams is parameters of update_bank_disposition operation. -type UpdateBankDispositionParams struct { - BankID string -} - -// UpdateDirectiveParams is parameters of update_directive operation. -type UpdateDirectiveParams struct { - BankID string - DirectiveID string -} - -// UpdateMentalModelParams is parameters of update_mental_model operation. -type UpdateMentalModelParams struct { - BankID string - MentalModelID string -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_request_encoders_gen.go b/hindsight-clients/go/internal/ogenapi/oas_request_encoders_gen.go deleted file mode 100644 index c7c9e755..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_request_encoders_gen.go +++ /dev/null @@ -1,179 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -import ( - "bytes" - "net/http" - - "github.com/go-faster/jx" - ht "github.com/ogen-go/ogen/http" -) - -func encodeAddBankBackgroundRequest( - req *AddBackgroundRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeCreateDirectiveRequest( - req *CreateDirectiveRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeCreateMentalModelRequest( - req *CreateMentalModelRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeCreateOrUpdateBankRequest( - req *CreateBankRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeRecallMemoriesRequest( - req *RecallRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeReflectRequest( - req *ReflectRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeRetainMemoriesRequest( - req *RetainRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeUpdateBankRequest( - req *CreateBankRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeUpdateBankConfigRequest( - req *BankConfigUpdate, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeUpdateBankDispositionRequest( - req *UpdateDispositionRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeUpdateDirectiveRequest( - req *UpdateDirectiveRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} - -func encodeUpdateMentalModelRequest( - req *UpdateMentalModelRequest, - r *http.Request, -) error { - const contentType = "application/json" - e := new(jx.Encoder) - { - req.Encode(e) - } - encoded := e.Bytes() - ht.SetBody(r, bytes.NewReader(encoded), contentType) - return nil -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_response_decoders_gen.go b/hindsight-clients/go/internal/ogenapi/oas_response_decoders_gen.go deleted file mode 100644 index cd441acb..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_response_decoders_gen.go +++ /dev/null @@ -1,3873 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -import ( - "io" - "mime" - "net/http" - - "github.com/go-faster/errors" - "github.com/go-faster/jx" - "github.com/ogen-go/ogen/ogenerrors" - "github.com/ogen-go/ogen/validate" -) - -func decodeAddBankBackgroundResponse(resp *http.Response) (res AddBankBackgroundRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BackgroundResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeCancelOperationResponse(resp *http.Response) (res CancelOperationRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response CancelOperationResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeClearBankMemoriesResponse(resp *http.Response) (res ClearBankMemoriesRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DeleteResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeClearObservationsResponse(resp *http.Response) (res ClearObservationsRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DeleteResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeCreateDirectiveResponse(resp *http.Response) (res CreateDirectiveRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DirectiveResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeCreateMentalModelResponse(resp *http.Response) (res CreateMentalModelRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response CreateMentalModelResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeCreateOrUpdateBankResponse(resp *http.Response) (res CreateOrUpdateBankRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankProfileResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeDeleteBankResponse(resp *http.Response) (res DeleteBankRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DeleteResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeDeleteDirectiveResponse(resp *http.Response) (res DeleteDirectiveRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DeleteDirectiveOKApplicationJSON - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeDeleteDocumentResponse(resp *http.Response) (res DeleteDocumentRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DeleteDocumentResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeDeleteMentalModelResponse(resp *http.Response) (res DeleteMentalModelRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DeleteMentalModelOKApplicationJSON - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetAgentStatsResponse(resp *http.Response) (res GetAgentStatsRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankStatsResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetBankConfigResponse(resp *http.Response) (res GetBankConfigRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankConfigResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetBankProfileResponse(resp *http.Response) (res GetBankProfileRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankProfileResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetChunkResponse(resp *http.Response) (res GetChunkRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response ChunkResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetDirectiveResponse(resp *http.Response) (res GetDirectiveRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DirectiveResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetDocumentResponse(resp *http.Response) (res GetDocumentRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DocumentResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetEntityResponse(resp *http.Response) (res GetEntityRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response EntityDetailResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetGraphResponse(resp *http.Response) (res GetGraphRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response GraphDataResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetMemoryResponse(resp *http.Response) (res GetMemoryRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response GetMemoryOKApplicationJSON - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetMentalModelResponse(resp *http.Response) (res GetMentalModelRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response MentalModelResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetOperationStatusResponse(resp *http.Response) (res GetOperationStatusRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response OperationStatusResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeGetVersionResponse(resp *http.Response) (res *VersionResponse, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response VersionResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeHealthEndpointHealthGetResponse(resp *http.Response) (res jx.Raw, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - response = jx.Raw(v) - if err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListBanksResponse(resp *http.Response) (res ListBanksRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankListResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListDirectivesResponse(resp *http.Response) (res ListDirectivesRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DirectiveListResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListDocumentsResponse(resp *http.Response) (res ListDocumentsRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response ListDocumentsResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListEntitiesResponse(resp *http.Response) (res ListEntitiesRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response EntityListResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListMemoriesResponse(resp *http.Response) (res ListMemoriesRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response ListMemoryUnitsResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListMentalModelsResponse(resp *http.Response) (res ListMentalModelsRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response MentalModelListResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListOperationsResponse(resp *http.Response) (res ListOperationsRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response OperationsListResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeListTagsResponse(resp *http.Response) (res ListTagsRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response ListTagsResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeMetricsEndpointMetricsGetResponse(resp *http.Response) (res jx.Raw, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response jx.Raw - if err := func() error { - v, err := d.RawAppend(nil) - response = jx.Raw(v) - if err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeRecallMemoriesResponse(resp *http.Response) (res RecallMemoriesRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response RecallResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeReflectResponse(resp *http.Response) (res ReflectRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response ReflectResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeRefreshMentalModelResponse(resp *http.Response) (res RefreshMentalModelRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response AsyncOperationSubmitResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeRegenerateEntityObservationsResponse(resp *http.Response) (res RegenerateEntityObservationsRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response EntityDetailResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeResetBankConfigResponse(resp *http.Response) (res ResetBankConfigRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankConfigResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeRetainMemoriesResponse(resp *http.Response) (res RetainMemoriesRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response RetainResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeTriggerConsolidationResponse(resp *http.Response) (res TriggerConsolidationRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response ConsolidationResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeUpdateBankResponse(resp *http.Response) (res UpdateBankRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankProfileResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeUpdateBankConfigResponse(resp *http.Response) (res UpdateBankConfigRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankConfigResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeUpdateBankDispositionResponse(resp *http.Response) (res UpdateBankDispositionRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response BankProfileResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeUpdateDirectiveResponse(resp *http.Response) (res UpdateDirectiveRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response DirectiveResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} - -func decodeUpdateMentalModelResponse(resp *http.Response) (res UpdateMentalModelRes, _ error) { - switch resp.StatusCode { - case 200: - // Code 200. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response MentalModelResponse - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - case 422: - // Code 422. - ct, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type")) - if err != nil { - return res, errors.Wrap(err, "parse media type") - } - switch { - case ct == "application/json": - buf, err := io.ReadAll(resp.Body) - if err != nil { - return res, err - } - d := jx.DecodeBytes(buf) - - var response HTTPValidationError - if err := func() error { - if err := response.Decode(d); err != nil { - return err - } - if err := d.Skip(); err != io.EOF { - return errors.New("unexpected trailing data") - } - return nil - }(); err != nil { - err = &ogenerrors.DecodeBodyError{ - ContentType: ct, - Body: buf, - Err: err, - } - return res, err - } - // Validate response. - if err := func() error { - if err := response.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return res, errors.Wrap(err, "validate") - } - return &response, nil - default: - return res, validate.InvalidContentType(ct) - } - } - return res, validate.UnexpectedStatusCodeWithResponse(resp) -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_schemas_gen.go b/hindsight-clients/go/internal/ogenapi/oas_schemas_gen.go deleted file mode 100644 index 1ab1f97c..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_schemas_gen.go +++ /dev/null @@ -1,5666 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -import ( - "time" - - "github.com/go-faster/errors" - "github.com/go-faster/jx" -) - -// Request model for adding/merging background information. Deprecated: use SetMissionRequest instead. -// Ref: #/components/schemas/AddBackgroundRequest -type AddBackgroundRequest struct { - // New background information to add or merge. - Content string `json:"content"` - // Deprecated - disposition is no longer auto-inferred from mission. - UpdateDisposition OptBool `json:"update_disposition"` -} - -// GetContent returns the value of Content. -func (s *AddBackgroundRequest) GetContent() string { - return s.Content -} - -// GetUpdateDisposition returns the value of UpdateDisposition. -func (s *AddBackgroundRequest) GetUpdateDisposition() OptBool { - return s.UpdateDisposition -} - -// SetContent sets the value of Content. -func (s *AddBackgroundRequest) SetContent(val string) { - s.Content = val -} - -// SetUpdateDisposition sets the value of UpdateDisposition. -func (s *AddBackgroundRequest) SetUpdateDisposition(val OptBool) { - s.UpdateDisposition = val -} - -// Response model for submitting an async operation. -// Ref: #/components/schemas/AsyncOperationSubmitResponse -type AsyncOperationSubmitResponse struct { - OperationID string `json:"operation_id"` - Status string `json:"status"` -} - -// GetOperationID returns the value of OperationID. -func (s *AsyncOperationSubmitResponse) GetOperationID() string { - return s.OperationID -} - -// GetStatus returns the value of Status. -func (s *AsyncOperationSubmitResponse) GetStatus() string { - return s.Status -} - -// SetOperationID sets the value of OperationID. -func (s *AsyncOperationSubmitResponse) SetOperationID(val string) { - s.OperationID = val -} - -// SetStatus sets the value of Status. -func (s *AsyncOperationSubmitResponse) SetStatus(val string) { - s.Status = val -} - -func (*AsyncOperationSubmitResponse) refreshMentalModelRes() {} - -// Response model for background update. Deprecated: use MissionResponse instead. -// Ref: #/components/schemas/BackgroundResponse -type BackgroundResponse struct { - // Deprecated: same as mission. - Background OptString `json:"background"` - Disposition OptDispositionTraits `json:"disposition"` - Mission string `json:"mission"` -} - -// GetBackground returns the value of Background. -func (s *BackgroundResponse) GetBackground() OptString { - return s.Background -} - -// GetDisposition returns the value of Disposition. -func (s *BackgroundResponse) GetDisposition() OptDispositionTraits { - return s.Disposition -} - -// GetMission returns the value of Mission. -func (s *BackgroundResponse) GetMission() string { - return s.Mission -} - -// SetBackground sets the value of Background. -func (s *BackgroundResponse) SetBackground(val OptString) { - s.Background = val -} - -// SetDisposition sets the value of Disposition. -func (s *BackgroundResponse) SetDisposition(val OptDispositionTraits) { - s.Disposition = val -} - -// SetMission sets the value of Mission. -func (s *BackgroundResponse) SetMission(val string) { - s.Mission = val -} - -func (*BackgroundResponse) addBankBackgroundRes() {} - -// Response model for bank configuration. -// Ref: #/components/schemas/BankConfigResponse -type BankConfigResponse struct { - // Bank identifier. - BankID string `json:"bank_id"` - // Fully resolved configuration with all hierarchical overrides applied (Python field names). - Config BankConfigResponseConfig `json:"config"` - // Bank-specific configuration overrides only (Python field names). - Overrides BankConfigResponseOverrides `json:"overrides"` -} - -// GetBankID returns the value of BankID. -func (s *BankConfigResponse) GetBankID() string { - return s.BankID -} - -// GetConfig returns the value of Config. -func (s *BankConfigResponse) GetConfig() BankConfigResponseConfig { - return s.Config -} - -// GetOverrides returns the value of Overrides. -func (s *BankConfigResponse) GetOverrides() BankConfigResponseOverrides { - return s.Overrides -} - -// SetBankID sets the value of BankID. -func (s *BankConfigResponse) SetBankID(val string) { - s.BankID = val -} - -// SetConfig sets the value of Config. -func (s *BankConfigResponse) SetConfig(val BankConfigResponseConfig) { - s.Config = val -} - -// SetOverrides sets the value of Overrides. -func (s *BankConfigResponse) SetOverrides(val BankConfigResponseOverrides) { - s.Overrides = val -} - -func (*BankConfigResponse) getBankConfigRes() {} -func (*BankConfigResponse) resetBankConfigRes() {} -func (*BankConfigResponse) updateBankConfigRes() {} - -// Fully resolved configuration with all hierarchical overrides applied (Python field names). -type BankConfigResponseConfig map[string]jx.Raw - -func (s *BankConfigResponseConfig) init() BankConfigResponseConfig { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Bank-specific configuration overrides only (Python field names). -type BankConfigResponseOverrides map[string]jx.Raw - -func (s *BankConfigResponseOverrides) init() BankConfigResponseOverrides { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Request model for updating bank configuration. -// Ref: #/components/schemas/BankConfigUpdate -type BankConfigUpdate struct { - // Configuration overrides. Keys can be in Python field format (llm_provider) or environment variable - // format (HINDSIGHT_API_LLM_PROVIDER). Only hierarchical fields can be overridden per-bank. - Updates BankConfigUpdateUpdates `json:"updates"` -} - -// GetUpdates returns the value of Updates. -func (s *BankConfigUpdate) GetUpdates() BankConfigUpdateUpdates { - return s.Updates -} - -// SetUpdates sets the value of Updates. -func (s *BankConfigUpdate) SetUpdates(val BankConfigUpdateUpdates) { - s.Updates = val -} - -// Configuration overrides. Keys can be in Python field format (llm_provider) or environment variable -// format (HINDSIGHT_API_LLM_PROVIDER). Only hierarchical fields can be overridden per-bank. -type BankConfigUpdateUpdates map[string]jx.Raw - -func (s *BankConfigUpdateUpdates) init() BankConfigUpdateUpdates { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Bank list item with profile summary. -// Ref: #/components/schemas/BankListItem -type BankListItem struct { - BankID string `json:"bank_id"` - CreatedAt OptString `json:"created_at"` - Disposition DispositionTraits `json:"disposition"` - Mission OptString `json:"mission"` - Name OptString `json:"name"` - UpdatedAt OptString `json:"updated_at"` -} - -// GetBankID returns the value of BankID. -func (s *BankListItem) GetBankID() string { - return s.BankID -} - -// GetCreatedAt returns the value of CreatedAt. -func (s *BankListItem) GetCreatedAt() OptString { - return s.CreatedAt -} - -// GetDisposition returns the value of Disposition. -func (s *BankListItem) GetDisposition() DispositionTraits { - return s.Disposition -} - -// GetMission returns the value of Mission. -func (s *BankListItem) GetMission() OptString { - return s.Mission -} - -// GetName returns the value of Name. -func (s *BankListItem) GetName() OptString { - return s.Name -} - -// GetUpdatedAt returns the value of UpdatedAt. -func (s *BankListItem) GetUpdatedAt() OptString { - return s.UpdatedAt -} - -// SetBankID sets the value of BankID. -func (s *BankListItem) SetBankID(val string) { - s.BankID = val -} - -// SetCreatedAt sets the value of CreatedAt. -func (s *BankListItem) SetCreatedAt(val OptString) { - s.CreatedAt = val -} - -// SetDisposition sets the value of Disposition. -func (s *BankListItem) SetDisposition(val DispositionTraits) { - s.Disposition = val -} - -// SetMission sets the value of Mission. -func (s *BankListItem) SetMission(val OptString) { - s.Mission = val -} - -// SetName sets the value of Name. -func (s *BankListItem) SetName(val OptString) { - s.Name = val -} - -// SetUpdatedAt sets the value of UpdatedAt. -func (s *BankListItem) SetUpdatedAt(val OptString) { - s.UpdatedAt = val -} - -// Response model for listing all banks. -// Ref: #/components/schemas/BankListResponse -type BankListResponse struct { - Banks []BankListItem `json:"banks"` -} - -// GetBanks returns the value of Banks. -func (s *BankListResponse) GetBanks() []BankListItem { - return s.Banks -} - -// SetBanks sets the value of Banks. -func (s *BankListResponse) SetBanks(val []BankListItem) { - s.Banks = val -} - -func (*BankListResponse) listBanksRes() {} - -// Response model for bank profile. -// Ref: #/components/schemas/BankProfileResponse -type BankProfileResponse struct { - // Deprecated: use mission instead. - Background OptString `json:"background"` - BankID string `json:"bank_id"` - Disposition DispositionTraits `json:"disposition"` - // The agent's mission - who they are and what they're trying to accomplish. - Mission string `json:"mission"` - Name string `json:"name"` -} - -// GetBackground returns the value of Background. -func (s *BankProfileResponse) GetBackground() OptString { - return s.Background -} - -// GetBankID returns the value of BankID. -func (s *BankProfileResponse) GetBankID() string { - return s.BankID -} - -// GetDisposition returns the value of Disposition. -func (s *BankProfileResponse) GetDisposition() DispositionTraits { - return s.Disposition -} - -// GetMission returns the value of Mission. -func (s *BankProfileResponse) GetMission() string { - return s.Mission -} - -// GetName returns the value of Name. -func (s *BankProfileResponse) GetName() string { - return s.Name -} - -// SetBackground sets the value of Background. -func (s *BankProfileResponse) SetBackground(val OptString) { - s.Background = val -} - -// SetBankID sets the value of BankID. -func (s *BankProfileResponse) SetBankID(val string) { - s.BankID = val -} - -// SetDisposition sets the value of Disposition. -func (s *BankProfileResponse) SetDisposition(val DispositionTraits) { - s.Disposition = val -} - -// SetMission sets the value of Mission. -func (s *BankProfileResponse) SetMission(val string) { - s.Mission = val -} - -// SetName sets the value of Name. -func (s *BankProfileResponse) SetName(val string) { - s.Name = val -} - -func (*BankProfileResponse) createOrUpdateBankRes() {} -func (*BankProfileResponse) getBankProfileRes() {} -func (*BankProfileResponse) updateBankDispositionRes() {} -func (*BankProfileResponse) updateBankRes() {} - -// Response model for bank statistics endpoint. -// Ref: #/components/schemas/BankStatsResponse -type BankStatsResponse struct { - BankID string `json:"bank_id"` - FailedOperations int `json:"failed_operations"` - // When consolidation last ran (ISO format). - LastConsolidatedAt OptString `json:"last_consolidated_at"` - LinksBreakdown BankStatsResponseLinksBreakdown `json:"links_breakdown"` - LinksByFactType BankStatsResponseLinksByFactType `json:"links_by_fact_type"` - LinksByLinkType BankStatsResponseLinksByLinkType `json:"links_by_link_type"` - NodesByFactType BankStatsResponseNodesByFactType `json:"nodes_by_fact_type"` - // Number of memories not yet processed into observations. - PendingConsolidation OptInt `json:"pending_consolidation"` - PendingOperations int `json:"pending_operations"` - TotalDocuments int `json:"total_documents"` - TotalLinks int `json:"total_links"` - TotalNodes int `json:"total_nodes"` - // Total number of observations. - TotalObservations OptInt `json:"total_observations"` -} - -// GetBankID returns the value of BankID. -func (s *BankStatsResponse) GetBankID() string { - return s.BankID -} - -// GetFailedOperations returns the value of FailedOperations. -func (s *BankStatsResponse) GetFailedOperations() int { - return s.FailedOperations -} - -// GetLastConsolidatedAt returns the value of LastConsolidatedAt. -func (s *BankStatsResponse) GetLastConsolidatedAt() OptString { - return s.LastConsolidatedAt -} - -// GetLinksBreakdown returns the value of LinksBreakdown. -func (s *BankStatsResponse) GetLinksBreakdown() BankStatsResponseLinksBreakdown { - return s.LinksBreakdown -} - -// GetLinksByFactType returns the value of LinksByFactType. -func (s *BankStatsResponse) GetLinksByFactType() BankStatsResponseLinksByFactType { - return s.LinksByFactType -} - -// GetLinksByLinkType returns the value of LinksByLinkType. -func (s *BankStatsResponse) GetLinksByLinkType() BankStatsResponseLinksByLinkType { - return s.LinksByLinkType -} - -// GetNodesByFactType returns the value of NodesByFactType. -func (s *BankStatsResponse) GetNodesByFactType() BankStatsResponseNodesByFactType { - return s.NodesByFactType -} - -// GetPendingConsolidation returns the value of PendingConsolidation. -func (s *BankStatsResponse) GetPendingConsolidation() OptInt { - return s.PendingConsolidation -} - -// GetPendingOperations returns the value of PendingOperations. -func (s *BankStatsResponse) GetPendingOperations() int { - return s.PendingOperations -} - -// GetTotalDocuments returns the value of TotalDocuments. -func (s *BankStatsResponse) GetTotalDocuments() int { - return s.TotalDocuments -} - -// GetTotalLinks returns the value of TotalLinks. -func (s *BankStatsResponse) GetTotalLinks() int { - return s.TotalLinks -} - -// GetTotalNodes returns the value of TotalNodes. -func (s *BankStatsResponse) GetTotalNodes() int { - return s.TotalNodes -} - -// GetTotalObservations returns the value of TotalObservations. -func (s *BankStatsResponse) GetTotalObservations() OptInt { - return s.TotalObservations -} - -// SetBankID sets the value of BankID. -func (s *BankStatsResponse) SetBankID(val string) { - s.BankID = val -} - -// SetFailedOperations sets the value of FailedOperations. -func (s *BankStatsResponse) SetFailedOperations(val int) { - s.FailedOperations = val -} - -// SetLastConsolidatedAt sets the value of LastConsolidatedAt. -func (s *BankStatsResponse) SetLastConsolidatedAt(val OptString) { - s.LastConsolidatedAt = val -} - -// SetLinksBreakdown sets the value of LinksBreakdown. -func (s *BankStatsResponse) SetLinksBreakdown(val BankStatsResponseLinksBreakdown) { - s.LinksBreakdown = val -} - -// SetLinksByFactType sets the value of LinksByFactType. -func (s *BankStatsResponse) SetLinksByFactType(val BankStatsResponseLinksByFactType) { - s.LinksByFactType = val -} - -// SetLinksByLinkType sets the value of LinksByLinkType. -func (s *BankStatsResponse) SetLinksByLinkType(val BankStatsResponseLinksByLinkType) { - s.LinksByLinkType = val -} - -// SetNodesByFactType sets the value of NodesByFactType. -func (s *BankStatsResponse) SetNodesByFactType(val BankStatsResponseNodesByFactType) { - s.NodesByFactType = val -} - -// SetPendingConsolidation sets the value of PendingConsolidation. -func (s *BankStatsResponse) SetPendingConsolidation(val OptInt) { - s.PendingConsolidation = val -} - -// SetPendingOperations sets the value of PendingOperations. -func (s *BankStatsResponse) SetPendingOperations(val int) { - s.PendingOperations = val -} - -// SetTotalDocuments sets the value of TotalDocuments. -func (s *BankStatsResponse) SetTotalDocuments(val int) { - s.TotalDocuments = val -} - -// SetTotalLinks sets the value of TotalLinks. -func (s *BankStatsResponse) SetTotalLinks(val int) { - s.TotalLinks = val -} - -// SetTotalNodes sets the value of TotalNodes. -func (s *BankStatsResponse) SetTotalNodes(val int) { - s.TotalNodes = val -} - -// SetTotalObservations sets the value of TotalObservations. -func (s *BankStatsResponse) SetTotalObservations(val OptInt) { - s.TotalObservations = val -} - -func (*BankStatsResponse) getAgentStatsRes() {} - -type BankStatsResponseLinksBreakdown map[string]BankStatsResponseLinksBreakdownItem - -func (s *BankStatsResponseLinksBreakdown) init() BankStatsResponseLinksBreakdown { - m := *s - if m == nil { - m = map[string]BankStatsResponseLinksBreakdownItem{} - *s = m - } - return m -} - -type BankStatsResponseLinksBreakdownItem map[string]int - -func (s *BankStatsResponseLinksBreakdownItem) init() BankStatsResponseLinksBreakdownItem { - m := *s - if m == nil { - m = map[string]int{} - *s = m - } - return m -} - -type BankStatsResponseLinksByFactType map[string]int - -func (s *BankStatsResponseLinksByFactType) init() BankStatsResponseLinksByFactType { - m := *s - if m == nil { - m = map[string]int{} - *s = m - } - return m -} - -type BankStatsResponseLinksByLinkType map[string]int - -func (s *BankStatsResponseLinksByLinkType) init() BankStatsResponseLinksByLinkType { - m := *s - if m == nil { - m = map[string]int{} - *s = m - } - return m -} - -type BankStatsResponseNodesByFactType map[string]int - -func (s *BankStatsResponseNodesByFactType) init() BankStatsResponseNodesByFactType { - m := *s - if m == nil { - m = map[string]int{} - *s = m - } - return m -} - -// Budget levels for recall/reflect operations. -// Ref: #/components/schemas/Budget -type Budget string - -const ( - BudgetLow Budget = "low" - BudgetMid Budget = "mid" - BudgetHigh Budget = "high" -) - -// AllValues returns all Budget values. -func (Budget) AllValues() []Budget { - return []Budget{ - BudgetLow, - BudgetMid, - BudgetHigh, - } -} - -// MarshalText implements encoding.TextMarshaler. -func (s Budget) MarshalText() ([]byte, error) { - switch s { - case BudgetLow: - return []byte(s), nil - case BudgetMid: - return []byte(s), nil - case BudgetHigh: - return []byte(s), nil - default: - return nil, errors.Errorf("invalid value: %q", s) - } -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (s *Budget) UnmarshalText(data []byte) error { - switch Budget(data) { - case BudgetLow: - *s = BudgetLow - return nil - case BudgetMid: - *s = BudgetMid - return nil - case BudgetHigh: - *s = BudgetHigh - return nil - default: - return errors.Errorf("invalid value: %q", data) - } -} - -// Response model for cancel operation endpoint. -// Ref: #/components/schemas/CancelOperationResponse -type CancelOperationResponse struct { - Message string `json:"message"` - OperationID string `json:"operation_id"` - Success bool `json:"success"` -} - -// GetMessage returns the value of Message. -func (s *CancelOperationResponse) GetMessage() string { - return s.Message -} - -// GetOperationID returns the value of OperationID. -func (s *CancelOperationResponse) GetOperationID() string { - return s.OperationID -} - -// GetSuccess returns the value of Success. -func (s *CancelOperationResponse) GetSuccess() bool { - return s.Success -} - -// SetMessage sets the value of Message. -func (s *CancelOperationResponse) SetMessage(val string) { - s.Message = val -} - -// SetOperationID sets the value of OperationID. -func (s *CancelOperationResponse) SetOperationID(val string) { - s.OperationID = val -} - -// SetSuccess sets the value of Success. -func (s *CancelOperationResponse) SetSuccess(val bool) { - s.Success = val -} - -func (*CancelOperationResponse) cancelOperationRes() {} - -// Chunk data for a single chunk. -// Ref: #/components/schemas/ChunkData -type ChunkData struct { - ChunkIndex int `json:"chunk_index"` - ID string `json:"id"` - Text string `json:"text"` - // Whether the chunk text was truncated due to token limits. - Truncated OptBool `json:"truncated"` -} - -// GetChunkIndex returns the value of ChunkIndex. -func (s *ChunkData) GetChunkIndex() int { - return s.ChunkIndex -} - -// GetID returns the value of ID. -func (s *ChunkData) GetID() string { - return s.ID -} - -// GetText returns the value of Text. -func (s *ChunkData) GetText() string { - return s.Text -} - -// GetTruncated returns the value of Truncated. -func (s *ChunkData) GetTruncated() OptBool { - return s.Truncated -} - -// SetChunkIndex sets the value of ChunkIndex. -func (s *ChunkData) SetChunkIndex(val int) { - s.ChunkIndex = val -} - -// SetID sets the value of ID. -func (s *ChunkData) SetID(val string) { - s.ID = val -} - -// SetText sets the value of Text. -func (s *ChunkData) SetText(val string) { - s.Text = val -} - -// SetTruncated sets the value of Truncated. -func (s *ChunkData) SetTruncated(val OptBool) { - s.Truncated = val -} - -// Options for including chunks in recall results. -// Ref: #/components/schemas/ChunkIncludeOptions -type ChunkIncludeOptions struct { - // Maximum tokens for chunks (chunks may be truncated). - MaxTokens OptInt `json:"max_tokens"` -} - -// GetMaxTokens returns the value of MaxTokens. -func (s *ChunkIncludeOptions) GetMaxTokens() OptInt { - return s.MaxTokens -} - -// SetMaxTokens sets the value of MaxTokens. -func (s *ChunkIncludeOptions) SetMaxTokens(val OptInt) { - s.MaxTokens = val -} - -// Response model for get chunk endpoint. -// Ref: #/components/schemas/ChunkResponse -type ChunkResponse struct { - BankID string `json:"bank_id"` - ChunkID string `json:"chunk_id"` - ChunkIndex int `json:"chunk_index"` - ChunkText string `json:"chunk_text"` - CreatedAt string `json:"created_at"` - DocumentID string `json:"document_id"` -} - -// GetBankID returns the value of BankID. -func (s *ChunkResponse) GetBankID() string { - return s.BankID -} - -// GetChunkID returns the value of ChunkID. -func (s *ChunkResponse) GetChunkID() string { - return s.ChunkID -} - -// GetChunkIndex returns the value of ChunkIndex. -func (s *ChunkResponse) GetChunkIndex() int { - return s.ChunkIndex -} - -// GetChunkText returns the value of ChunkText. -func (s *ChunkResponse) GetChunkText() string { - return s.ChunkText -} - -// GetCreatedAt returns the value of CreatedAt. -func (s *ChunkResponse) GetCreatedAt() string { - return s.CreatedAt -} - -// GetDocumentID returns the value of DocumentID. -func (s *ChunkResponse) GetDocumentID() string { - return s.DocumentID -} - -// SetBankID sets the value of BankID. -func (s *ChunkResponse) SetBankID(val string) { - s.BankID = val -} - -// SetChunkID sets the value of ChunkID. -func (s *ChunkResponse) SetChunkID(val string) { - s.ChunkID = val -} - -// SetChunkIndex sets the value of ChunkIndex. -func (s *ChunkResponse) SetChunkIndex(val int) { - s.ChunkIndex = val -} - -// SetChunkText sets the value of ChunkText. -func (s *ChunkResponse) SetChunkText(val string) { - s.ChunkText = val -} - -// SetCreatedAt sets the value of CreatedAt. -func (s *ChunkResponse) SetCreatedAt(val string) { - s.CreatedAt = val -} - -// SetDocumentID sets the value of DocumentID. -func (s *ChunkResponse) SetDocumentID(val string) { - s.DocumentID = val -} - -func (*ChunkResponse) getChunkRes() {} - -// Response model for consolidation trigger endpoint. -// Ref: #/components/schemas/ConsolidationResponse -type ConsolidationResponse struct { - // True if an existing pending task was reused. - Deduplicated OptBool `json:"deduplicated"` - // ID of the async consolidation operation. - OperationID string `json:"operation_id"` -} - -// GetDeduplicated returns the value of Deduplicated. -func (s *ConsolidationResponse) GetDeduplicated() OptBool { - return s.Deduplicated -} - -// GetOperationID returns the value of OperationID. -func (s *ConsolidationResponse) GetOperationID() string { - return s.OperationID -} - -// SetDeduplicated sets the value of Deduplicated. -func (s *ConsolidationResponse) SetDeduplicated(val OptBool) { - s.Deduplicated = val -} - -// SetOperationID sets the value of OperationID. -func (s *ConsolidationResponse) SetOperationID(val string) { - s.OperationID = val -} - -func (*ConsolidationResponse) triggerConsolidationRes() {} - -// Request model for creating/updating a bank. -// Ref: #/components/schemas/CreateBankRequest -type CreateBankRequest struct { - // Deprecated: use mission instead. - Background OptString `json:"background"` - Disposition OptDispositionTraits `json:"disposition"` - // The agent's mission. - Mission OptString `json:"mission"` - Name OptString `json:"name"` -} - -// GetBackground returns the value of Background. -func (s *CreateBankRequest) GetBackground() OptString { - return s.Background -} - -// GetDisposition returns the value of Disposition. -func (s *CreateBankRequest) GetDisposition() OptDispositionTraits { - return s.Disposition -} - -// GetMission returns the value of Mission. -func (s *CreateBankRequest) GetMission() OptString { - return s.Mission -} - -// GetName returns the value of Name. -func (s *CreateBankRequest) GetName() OptString { - return s.Name -} - -// SetBackground sets the value of Background. -func (s *CreateBankRequest) SetBackground(val OptString) { - s.Background = val -} - -// SetDisposition sets the value of Disposition. -func (s *CreateBankRequest) SetDisposition(val OptDispositionTraits) { - s.Disposition = val -} - -// SetMission sets the value of Mission. -func (s *CreateBankRequest) SetMission(val OptString) { - s.Mission = val -} - -// SetName sets the value of Name. -func (s *CreateBankRequest) SetName(val OptString) { - s.Name = val -} - -// Request model for creating a directive. -// Ref: #/components/schemas/CreateDirectiveRequest -type CreateDirectiveRequest struct { - // The directive text to inject into prompts. - Content string `json:"content"` - // Whether this directive is active. - IsActive OptBool `json:"is_active"` - // Human-readable name for the directive. - Name string `json:"name"` - // Higher priority directives are injected first. - Priority OptInt `json:"priority"` - // Tags for filtering. - Tags []string `json:"tags"` -} - -// GetContent returns the value of Content. -func (s *CreateDirectiveRequest) GetContent() string { - return s.Content -} - -// GetIsActive returns the value of IsActive. -func (s *CreateDirectiveRequest) GetIsActive() OptBool { - return s.IsActive -} - -// GetName returns the value of Name. -func (s *CreateDirectiveRequest) GetName() string { - return s.Name -} - -// GetPriority returns the value of Priority. -func (s *CreateDirectiveRequest) GetPriority() OptInt { - return s.Priority -} - -// GetTags returns the value of Tags. -func (s *CreateDirectiveRequest) GetTags() []string { - return s.Tags -} - -// SetContent sets the value of Content. -func (s *CreateDirectiveRequest) SetContent(val string) { - s.Content = val -} - -// SetIsActive sets the value of IsActive. -func (s *CreateDirectiveRequest) SetIsActive(val OptBool) { - s.IsActive = val -} - -// SetName sets the value of Name. -func (s *CreateDirectiveRequest) SetName(val string) { - s.Name = val -} - -// SetPriority sets the value of Priority. -func (s *CreateDirectiveRequest) SetPriority(val OptInt) { - s.Priority = val -} - -// SetTags sets the value of Tags. -func (s *CreateDirectiveRequest) SetTags(val []string) { - s.Tags = val -} - -// Request model for creating a mental model. -// Ref: #/components/schemas/CreateMentalModelRequest -type CreateMentalModelRequest struct { - // Optional custom ID for the mental model (alphanumeric lowercase with hyphens). - ID OptString `json:"id"` - // Maximum tokens for generated content. - MaxTokens OptInt `json:"max_tokens"` - // Human-readable name for the mental model. - Name string `json:"name"` - // The query to run to generate content. - SourceQuery string `json:"source_query"` - // Tags for scoped visibility. - Tags []string `json:"tags"` - // Trigger settings. - Trigger OptMentalModelTrigger `json:"trigger"` -} - -// GetID returns the value of ID. -func (s *CreateMentalModelRequest) GetID() OptString { - return s.ID -} - -// GetMaxTokens returns the value of MaxTokens. -func (s *CreateMentalModelRequest) GetMaxTokens() OptInt { - return s.MaxTokens -} - -// GetName returns the value of Name. -func (s *CreateMentalModelRequest) GetName() string { - return s.Name -} - -// GetSourceQuery returns the value of SourceQuery. -func (s *CreateMentalModelRequest) GetSourceQuery() string { - return s.SourceQuery -} - -// GetTags returns the value of Tags. -func (s *CreateMentalModelRequest) GetTags() []string { - return s.Tags -} - -// GetTrigger returns the value of Trigger. -func (s *CreateMentalModelRequest) GetTrigger() OptMentalModelTrigger { - return s.Trigger -} - -// SetID sets the value of ID. -func (s *CreateMentalModelRequest) SetID(val OptString) { - s.ID = val -} - -// SetMaxTokens sets the value of MaxTokens. -func (s *CreateMentalModelRequest) SetMaxTokens(val OptInt) { - s.MaxTokens = val -} - -// SetName sets the value of Name. -func (s *CreateMentalModelRequest) SetName(val string) { - s.Name = val -} - -// SetSourceQuery sets the value of SourceQuery. -func (s *CreateMentalModelRequest) SetSourceQuery(val string) { - s.SourceQuery = val -} - -// SetTags sets the value of Tags. -func (s *CreateMentalModelRequest) SetTags(val []string) { - s.Tags = val -} - -// SetTrigger sets the value of Trigger. -func (s *CreateMentalModelRequest) SetTrigger(val OptMentalModelTrigger) { - s.Trigger = val -} - -// Response model for mental model creation. -// Ref: #/components/schemas/CreateMentalModelResponse -type CreateMentalModelResponse struct { - // ID of the created mental model. - MentalModelID OptString `json:"mental_model_id"` - // Operation ID to track refresh progress. - OperationID string `json:"operation_id"` -} - -// GetMentalModelID returns the value of MentalModelID. -func (s *CreateMentalModelResponse) GetMentalModelID() OptString { - return s.MentalModelID -} - -// GetOperationID returns the value of OperationID. -func (s *CreateMentalModelResponse) GetOperationID() string { - return s.OperationID -} - -// SetMentalModelID sets the value of MentalModelID. -func (s *CreateMentalModelResponse) SetMentalModelID(val OptString) { - s.MentalModelID = val -} - -// SetOperationID sets the value of OperationID. -func (s *CreateMentalModelResponse) SetOperationID(val string) { - s.OperationID = val -} - -func (*CreateMentalModelResponse) createMentalModelRes() {} - -type DeleteDirectiveOKApplicationJSON jx.Raw - -func (*DeleteDirectiveOKApplicationJSON) deleteDirectiveRes() {} - -// Response model for delete document endpoint. -// Ref: #/components/schemas/DeleteDocumentResponse -type DeleteDocumentResponse struct { - DocumentID string `json:"document_id"` - MemoryUnitsDeleted int `json:"memory_units_deleted"` - Message string `json:"message"` - Success bool `json:"success"` -} - -// GetDocumentID returns the value of DocumentID. -func (s *DeleteDocumentResponse) GetDocumentID() string { - return s.DocumentID -} - -// GetMemoryUnitsDeleted returns the value of MemoryUnitsDeleted. -func (s *DeleteDocumentResponse) GetMemoryUnitsDeleted() int { - return s.MemoryUnitsDeleted -} - -// GetMessage returns the value of Message. -func (s *DeleteDocumentResponse) GetMessage() string { - return s.Message -} - -// GetSuccess returns the value of Success. -func (s *DeleteDocumentResponse) GetSuccess() bool { - return s.Success -} - -// SetDocumentID sets the value of DocumentID. -func (s *DeleteDocumentResponse) SetDocumentID(val string) { - s.DocumentID = val -} - -// SetMemoryUnitsDeleted sets the value of MemoryUnitsDeleted. -func (s *DeleteDocumentResponse) SetMemoryUnitsDeleted(val int) { - s.MemoryUnitsDeleted = val -} - -// SetMessage sets the value of Message. -func (s *DeleteDocumentResponse) SetMessage(val string) { - s.Message = val -} - -// SetSuccess sets the value of Success. -func (s *DeleteDocumentResponse) SetSuccess(val bool) { - s.Success = val -} - -func (*DeleteDocumentResponse) deleteDocumentRes() {} - -type DeleteMentalModelOKApplicationJSON jx.Raw - -func (*DeleteMentalModelOKApplicationJSON) deleteMentalModelRes() {} - -// Response model for delete operations. -// Ref: #/components/schemas/DeleteResponse -type DeleteResponse struct { - DeletedCount OptInt `json:"deleted_count"` - Message OptString `json:"message"` - Success bool `json:"success"` -} - -// GetDeletedCount returns the value of DeletedCount. -func (s *DeleteResponse) GetDeletedCount() OptInt { - return s.DeletedCount -} - -// GetMessage returns the value of Message. -func (s *DeleteResponse) GetMessage() OptString { - return s.Message -} - -// GetSuccess returns the value of Success. -func (s *DeleteResponse) GetSuccess() bool { - return s.Success -} - -// SetDeletedCount sets the value of DeletedCount. -func (s *DeleteResponse) SetDeletedCount(val OptInt) { - s.DeletedCount = val -} - -// SetMessage sets the value of Message. -func (s *DeleteResponse) SetMessage(val OptString) { - s.Message = val -} - -// SetSuccess sets the value of Success. -func (s *DeleteResponse) SetSuccess(val bool) { - s.Success = val -} - -func (*DeleteResponse) clearBankMemoriesRes() {} -func (*DeleteResponse) clearObservationsRes() {} -func (*DeleteResponse) deleteBankRes() {} - -// Response model for listing directives. -// Ref: #/components/schemas/DirectiveListResponse -type DirectiveListResponse struct { - Items []DirectiveResponse `json:"items"` -} - -// GetItems returns the value of Items. -func (s *DirectiveListResponse) GetItems() []DirectiveResponse { - return s.Items -} - -// SetItems sets the value of Items. -func (s *DirectiveListResponse) SetItems(val []DirectiveResponse) { - s.Items = val -} - -func (*DirectiveListResponse) listDirectivesRes() {} - -// Response model for a directive. -// Ref: #/components/schemas/DirectiveResponse -type DirectiveResponse struct { - BankID string `json:"bank_id"` - Content string `json:"content"` - CreatedAt OptString `json:"created_at"` - ID string `json:"id"` - IsActive OptBool `json:"is_active"` - Name string `json:"name"` - Priority OptInt `json:"priority"` - Tags []string `json:"tags"` - UpdatedAt OptString `json:"updated_at"` -} - -// GetBankID returns the value of BankID. -func (s *DirectiveResponse) GetBankID() string { - return s.BankID -} - -// GetContent returns the value of Content. -func (s *DirectiveResponse) GetContent() string { - return s.Content -} - -// GetCreatedAt returns the value of CreatedAt. -func (s *DirectiveResponse) GetCreatedAt() OptString { - return s.CreatedAt -} - -// GetID returns the value of ID. -func (s *DirectiveResponse) GetID() string { - return s.ID -} - -// GetIsActive returns the value of IsActive. -func (s *DirectiveResponse) GetIsActive() OptBool { - return s.IsActive -} - -// GetName returns the value of Name. -func (s *DirectiveResponse) GetName() string { - return s.Name -} - -// GetPriority returns the value of Priority. -func (s *DirectiveResponse) GetPriority() OptInt { - return s.Priority -} - -// GetTags returns the value of Tags. -func (s *DirectiveResponse) GetTags() []string { - return s.Tags -} - -// GetUpdatedAt returns the value of UpdatedAt. -func (s *DirectiveResponse) GetUpdatedAt() OptString { - return s.UpdatedAt -} - -// SetBankID sets the value of BankID. -func (s *DirectiveResponse) SetBankID(val string) { - s.BankID = val -} - -// SetContent sets the value of Content. -func (s *DirectiveResponse) SetContent(val string) { - s.Content = val -} - -// SetCreatedAt sets the value of CreatedAt. -func (s *DirectiveResponse) SetCreatedAt(val OptString) { - s.CreatedAt = val -} - -// SetID sets the value of ID. -func (s *DirectiveResponse) SetID(val string) { - s.ID = val -} - -// SetIsActive sets the value of IsActive. -func (s *DirectiveResponse) SetIsActive(val OptBool) { - s.IsActive = val -} - -// SetName sets the value of Name. -func (s *DirectiveResponse) SetName(val string) { - s.Name = val -} - -// SetPriority sets the value of Priority. -func (s *DirectiveResponse) SetPriority(val OptInt) { - s.Priority = val -} - -// SetTags sets the value of Tags. -func (s *DirectiveResponse) SetTags(val []string) { - s.Tags = val -} - -// SetUpdatedAt sets the value of UpdatedAt. -func (s *DirectiveResponse) SetUpdatedAt(val OptString) { - s.UpdatedAt = val -} - -func (*DirectiveResponse) createDirectiveRes() {} -func (*DirectiveResponse) getDirectiveRes() {} -func (*DirectiveResponse) updateDirectiveRes() {} - -// Disposition traits that influence how memories are formed and interpreted. -// Ref: #/components/schemas/DispositionTraits -type DispositionTraits struct { - // How much to consider emotional context (1=detached, 5=empathetic). - Empathy int `json:"empathy"` - // How literally to interpret information (1=flexible, 5=literal). - Literalism int `json:"literalism"` - // How skeptical vs trusting (1=trusting, 5=skeptical). - Skepticism int `json:"skepticism"` -} - -// GetEmpathy returns the value of Empathy. -func (s *DispositionTraits) GetEmpathy() int { - return s.Empathy -} - -// GetLiteralism returns the value of Literalism. -func (s *DispositionTraits) GetLiteralism() int { - return s.Literalism -} - -// GetSkepticism returns the value of Skepticism. -func (s *DispositionTraits) GetSkepticism() int { - return s.Skepticism -} - -// SetEmpathy sets the value of Empathy. -func (s *DispositionTraits) SetEmpathy(val int) { - s.Empathy = val -} - -// SetLiteralism sets the value of Literalism. -func (s *DispositionTraits) SetLiteralism(val int) { - s.Literalism = val -} - -// SetSkepticism sets the value of Skepticism. -func (s *DispositionTraits) SetSkepticism(val int) { - s.Skepticism = val -} - -// Response model for get document endpoint. -// Ref: #/components/schemas/DocumentResponse -type DocumentResponse struct { - BankID string `json:"bank_id"` - ContentHash string `json:"content_hash"` - CreatedAt string `json:"created_at"` - ID string `json:"id"` - MemoryUnitCount int `json:"memory_unit_count"` - OriginalText string `json:"original_text"` - // Tags associated with this document. - Tags []string `json:"tags"` - UpdatedAt string `json:"updated_at"` -} - -// GetBankID returns the value of BankID. -func (s *DocumentResponse) GetBankID() string { - return s.BankID -} - -// GetContentHash returns the value of ContentHash. -func (s *DocumentResponse) GetContentHash() string { - return s.ContentHash -} - -// GetCreatedAt returns the value of CreatedAt. -func (s *DocumentResponse) GetCreatedAt() string { - return s.CreatedAt -} - -// GetID returns the value of ID. -func (s *DocumentResponse) GetID() string { - return s.ID -} - -// GetMemoryUnitCount returns the value of MemoryUnitCount. -func (s *DocumentResponse) GetMemoryUnitCount() int { - return s.MemoryUnitCount -} - -// GetOriginalText returns the value of OriginalText. -func (s *DocumentResponse) GetOriginalText() string { - return s.OriginalText -} - -// GetTags returns the value of Tags. -func (s *DocumentResponse) GetTags() []string { - return s.Tags -} - -// GetUpdatedAt returns the value of UpdatedAt. -func (s *DocumentResponse) GetUpdatedAt() string { - return s.UpdatedAt -} - -// SetBankID sets the value of BankID. -func (s *DocumentResponse) SetBankID(val string) { - s.BankID = val -} - -// SetContentHash sets the value of ContentHash. -func (s *DocumentResponse) SetContentHash(val string) { - s.ContentHash = val -} - -// SetCreatedAt sets the value of CreatedAt. -func (s *DocumentResponse) SetCreatedAt(val string) { - s.CreatedAt = val -} - -// SetID sets the value of ID. -func (s *DocumentResponse) SetID(val string) { - s.ID = val -} - -// SetMemoryUnitCount sets the value of MemoryUnitCount. -func (s *DocumentResponse) SetMemoryUnitCount(val int) { - s.MemoryUnitCount = val -} - -// SetOriginalText sets the value of OriginalText. -func (s *DocumentResponse) SetOriginalText(val string) { - s.OriginalText = val -} - -// SetTags sets the value of Tags. -func (s *DocumentResponse) SetTags(val []string) { - s.Tags = val -} - -// SetUpdatedAt sets the value of UpdatedAt. -func (s *DocumentResponse) SetUpdatedAt(val string) { - s.UpdatedAt = val -} - -func (*DocumentResponse) getDocumentRes() {} - -// Response model for entity detail endpoint. -// Ref: #/components/schemas/EntityDetailResponse -type EntityDetailResponse struct { - CanonicalName string `json:"canonical_name"` - FirstSeen OptString `json:"first_seen"` - ID string `json:"id"` - LastSeen OptString `json:"last_seen"` - MentionCount int `json:"mention_count"` - Metadata OptEntityDetailResponseMetadata `json:"metadata"` - Observations []EntityObservationResponse `json:"observations"` -} - -// GetCanonicalName returns the value of CanonicalName. -func (s *EntityDetailResponse) GetCanonicalName() string { - return s.CanonicalName -} - -// GetFirstSeen returns the value of FirstSeen. -func (s *EntityDetailResponse) GetFirstSeen() OptString { - return s.FirstSeen -} - -// GetID returns the value of ID. -func (s *EntityDetailResponse) GetID() string { - return s.ID -} - -// GetLastSeen returns the value of LastSeen. -func (s *EntityDetailResponse) GetLastSeen() OptString { - return s.LastSeen -} - -// GetMentionCount returns the value of MentionCount. -func (s *EntityDetailResponse) GetMentionCount() int { - return s.MentionCount -} - -// GetMetadata returns the value of Metadata. -func (s *EntityDetailResponse) GetMetadata() OptEntityDetailResponseMetadata { - return s.Metadata -} - -// GetObservations returns the value of Observations. -func (s *EntityDetailResponse) GetObservations() []EntityObservationResponse { - return s.Observations -} - -// SetCanonicalName sets the value of CanonicalName. -func (s *EntityDetailResponse) SetCanonicalName(val string) { - s.CanonicalName = val -} - -// SetFirstSeen sets the value of FirstSeen. -func (s *EntityDetailResponse) SetFirstSeen(val OptString) { - s.FirstSeen = val -} - -// SetID sets the value of ID. -func (s *EntityDetailResponse) SetID(val string) { - s.ID = val -} - -// SetLastSeen sets the value of LastSeen. -func (s *EntityDetailResponse) SetLastSeen(val OptString) { - s.LastSeen = val -} - -// SetMentionCount sets the value of MentionCount. -func (s *EntityDetailResponse) SetMentionCount(val int) { - s.MentionCount = val -} - -// SetMetadata sets the value of Metadata. -func (s *EntityDetailResponse) SetMetadata(val OptEntityDetailResponseMetadata) { - s.Metadata = val -} - -// SetObservations sets the value of Observations. -func (s *EntityDetailResponse) SetObservations(val []EntityObservationResponse) { - s.Observations = val -} - -func (*EntityDetailResponse) getEntityRes() {} -func (*EntityDetailResponse) regenerateEntityObservationsRes() {} - -type EntityDetailResponseMetadata map[string]jx.Raw - -func (s *EntityDetailResponseMetadata) init() EntityDetailResponseMetadata { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Options for including entity observations in recall results. -// Ref: #/components/schemas/EntityIncludeOptions -type EntityIncludeOptions struct { - // Maximum tokens for entity observations. - MaxTokens OptInt `json:"max_tokens"` -} - -// GetMaxTokens returns the value of MaxTokens. -func (s *EntityIncludeOptions) GetMaxTokens() OptInt { - return s.MaxTokens -} - -// SetMaxTokens sets the value of MaxTokens. -func (s *EntityIncludeOptions) SetMaxTokens(val OptInt) { - s.MaxTokens = val -} - -// Entity to associate with retained content. -// Ref: #/components/schemas/EntityInput -type EntityInput struct { - // The entity name/text. - Text string `json:"text"` - // Optional entity type (e.g., 'PERSON', 'ORG', 'CONCEPT'). - Type OptString `json:"type"` -} - -// GetText returns the value of Text. -func (s *EntityInput) GetText() string { - return s.Text -} - -// GetType returns the value of Type. -func (s *EntityInput) GetType() OptString { - return s.Type -} - -// SetText sets the value of Text. -func (s *EntityInput) SetText(val string) { - s.Text = val -} - -// SetType sets the value of Type. -func (s *EntityInput) SetType(val OptString) { - s.Type = val -} - -// Entity list item with summary. -// Ref: #/components/schemas/EntityListItem -type EntityListItem struct { - CanonicalName string `json:"canonical_name"` - FirstSeen OptString `json:"first_seen"` - ID string `json:"id"` - LastSeen OptString `json:"last_seen"` - MentionCount int `json:"mention_count"` - Metadata OptEntityListItemMetadata `json:"metadata"` -} - -// GetCanonicalName returns the value of CanonicalName. -func (s *EntityListItem) GetCanonicalName() string { - return s.CanonicalName -} - -// GetFirstSeen returns the value of FirstSeen. -func (s *EntityListItem) GetFirstSeen() OptString { - return s.FirstSeen -} - -// GetID returns the value of ID. -func (s *EntityListItem) GetID() string { - return s.ID -} - -// GetLastSeen returns the value of LastSeen. -func (s *EntityListItem) GetLastSeen() OptString { - return s.LastSeen -} - -// GetMentionCount returns the value of MentionCount. -func (s *EntityListItem) GetMentionCount() int { - return s.MentionCount -} - -// GetMetadata returns the value of Metadata. -func (s *EntityListItem) GetMetadata() OptEntityListItemMetadata { - return s.Metadata -} - -// SetCanonicalName sets the value of CanonicalName. -func (s *EntityListItem) SetCanonicalName(val string) { - s.CanonicalName = val -} - -// SetFirstSeen sets the value of FirstSeen. -func (s *EntityListItem) SetFirstSeen(val OptString) { - s.FirstSeen = val -} - -// SetID sets the value of ID. -func (s *EntityListItem) SetID(val string) { - s.ID = val -} - -// SetLastSeen sets the value of LastSeen. -func (s *EntityListItem) SetLastSeen(val OptString) { - s.LastSeen = val -} - -// SetMentionCount sets the value of MentionCount. -func (s *EntityListItem) SetMentionCount(val int) { - s.MentionCount = val -} - -// SetMetadata sets the value of Metadata. -func (s *EntityListItem) SetMetadata(val OptEntityListItemMetadata) { - s.Metadata = val -} - -type EntityListItemMetadata map[string]jx.Raw - -func (s *EntityListItemMetadata) init() EntityListItemMetadata { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Response model for entity list endpoint. -// Ref: #/components/schemas/EntityListResponse -type EntityListResponse struct { - Items []EntityListItem `json:"items"` - Limit int `json:"limit"` - Offset int `json:"offset"` - Total int `json:"total"` -} - -// GetItems returns the value of Items. -func (s *EntityListResponse) GetItems() []EntityListItem { - return s.Items -} - -// GetLimit returns the value of Limit. -func (s *EntityListResponse) GetLimit() int { - return s.Limit -} - -// GetOffset returns the value of Offset. -func (s *EntityListResponse) GetOffset() int { - return s.Offset -} - -// GetTotal returns the value of Total. -func (s *EntityListResponse) GetTotal() int { - return s.Total -} - -// SetItems sets the value of Items. -func (s *EntityListResponse) SetItems(val []EntityListItem) { - s.Items = val -} - -// SetLimit sets the value of Limit. -func (s *EntityListResponse) SetLimit(val int) { - s.Limit = val -} - -// SetOffset sets the value of Offset. -func (s *EntityListResponse) SetOffset(val int) { - s.Offset = val -} - -// SetTotal sets the value of Total. -func (s *EntityListResponse) SetTotal(val int) { - s.Total = val -} - -func (*EntityListResponse) listEntitiesRes() {} - -// An observation about an entity. -// Ref: #/components/schemas/EntityObservationResponse -type EntityObservationResponse struct { - MentionedAt OptString `json:"mentioned_at"` - Text string `json:"text"` -} - -// GetMentionedAt returns the value of MentionedAt. -func (s *EntityObservationResponse) GetMentionedAt() OptString { - return s.MentionedAt -} - -// GetText returns the value of Text. -func (s *EntityObservationResponse) GetText() string { - return s.Text -} - -// SetMentionedAt sets the value of MentionedAt. -func (s *EntityObservationResponse) SetMentionedAt(val OptString) { - s.MentionedAt = val -} - -// SetText sets the value of Text. -func (s *EntityObservationResponse) SetText(val string) { - s.Text = val -} - -// Current mental model of an entity. -// Ref: #/components/schemas/EntityStateResponse -type EntityStateResponse struct { - CanonicalName string `json:"canonical_name"` - EntityID string `json:"entity_id"` - Observations []EntityObservationResponse `json:"observations"` -} - -// GetCanonicalName returns the value of CanonicalName. -func (s *EntityStateResponse) GetCanonicalName() string { - return s.CanonicalName -} - -// GetEntityID returns the value of EntityID. -func (s *EntityStateResponse) GetEntityID() string { - return s.EntityID -} - -// GetObservations returns the value of Observations. -func (s *EntityStateResponse) GetObservations() []EntityObservationResponse { - return s.Observations -} - -// SetCanonicalName sets the value of CanonicalName. -func (s *EntityStateResponse) SetCanonicalName(val string) { - s.CanonicalName = val -} - -// SetEntityID sets the value of EntityID. -func (s *EntityStateResponse) SetEntityID(val string) { - s.EntityID = val -} - -// SetObservations sets the value of Observations. -func (s *EntityStateResponse) SetObservations(val []EntityObservationResponse) { - s.Observations = val -} - -// Options for including facts (based_on) in reflect results. -// Ref: #/components/schemas/FactsIncludeOptions -type FactsIncludeOptions struct{} - -// Feature flags indicating which capabilities are enabled. -// Ref: #/components/schemas/FeaturesInfo -type FeaturesInfo struct { - // Whether per-bank configuration API is enabled. - BankConfigAPI bool `json:"bank_config_api"` - // Whether MCP (Model Context Protocol) server is enabled. - Mcp bool `json:"mcp"` - // Whether observations (auto-consolidation) are enabled. - Observations bool `json:"observations"` - // Whether the background worker is enabled. - Worker bool `json:"worker"` -} - -// GetBankConfigAPI returns the value of BankConfigAPI. -func (s *FeaturesInfo) GetBankConfigAPI() bool { - return s.BankConfigAPI -} - -// GetMcp returns the value of Mcp. -func (s *FeaturesInfo) GetMcp() bool { - return s.Mcp -} - -// GetObservations returns the value of Observations. -func (s *FeaturesInfo) GetObservations() bool { - return s.Observations -} - -// GetWorker returns the value of Worker. -func (s *FeaturesInfo) GetWorker() bool { - return s.Worker -} - -// SetBankConfigAPI sets the value of BankConfigAPI. -func (s *FeaturesInfo) SetBankConfigAPI(val bool) { - s.BankConfigAPI = val -} - -// SetMcp sets the value of Mcp. -func (s *FeaturesInfo) SetMcp(val bool) { - s.Mcp = val -} - -// SetObservations sets the value of Observations. -func (s *FeaturesInfo) SetObservations(val bool) { - s.Observations = val -} - -// SetWorker sets the value of Worker. -func (s *FeaturesInfo) SetWorker(val bool) { - s.Worker = val -} - -type GetMemoryOKApplicationJSON jx.Raw - -func (*GetMemoryOKApplicationJSON) getMemoryRes() {} - -// Response model for graph data endpoint. -// Ref: #/components/schemas/GraphDataResponse -type GraphDataResponse struct { - Edges []GraphDataResponseEdgesItem `json:"edges"` - Limit int `json:"limit"` - Nodes []GraphDataResponseNodesItem `json:"nodes"` - TableRows []GraphDataResponseTableRowsItem `json:"table_rows"` - TotalUnits int `json:"total_units"` -} - -// GetEdges returns the value of Edges. -func (s *GraphDataResponse) GetEdges() []GraphDataResponseEdgesItem { - return s.Edges -} - -// GetLimit returns the value of Limit. -func (s *GraphDataResponse) GetLimit() int { - return s.Limit -} - -// GetNodes returns the value of Nodes. -func (s *GraphDataResponse) GetNodes() []GraphDataResponseNodesItem { - return s.Nodes -} - -// GetTableRows returns the value of TableRows. -func (s *GraphDataResponse) GetTableRows() []GraphDataResponseTableRowsItem { - return s.TableRows -} - -// GetTotalUnits returns the value of TotalUnits. -func (s *GraphDataResponse) GetTotalUnits() int { - return s.TotalUnits -} - -// SetEdges sets the value of Edges. -func (s *GraphDataResponse) SetEdges(val []GraphDataResponseEdgesItem) { - s.Edges = val -} - -// SetLimit sets the value of Limit. -func (s *GraphDataResponse) SetLimit(val int) { - s.Limit = val -} - -// SetNodes sets the value of Nodes. -func (s *GraphDataResponse) SetNodes(val []GraphDataResponseNodesItem) { - s.Nodes = val -} - -// SetTableRows sets the value of TableRows. -func (s *GraphDataResponse) SetTableRows(val []GraphDataResponseTableRowsItem) { - s.TableRows = val -} - -// SetTotalUnits sets the value of TotalUnits. -func (s *GraphDataResponse) SetTotalUnits(val int) { - s.TotalUnits = val -} - -func (*GraphDataResponse) getGraphRes() {} - -type GraphDataResponseEdgesItem map[string]jx.Raw - -func (s *GraphDataResponseEdgesItem) init() GraphDataResponseEdgesItem { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -type GraphDataResponseNodesItem map[string]jx.Raw - -func (s *GraphDataResponseNodesItem) init() GraphDataResponseNodesItem { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -type GraphDataResponseTableRowsItem map[string]jx.Raw - -func (s *GraphDataResponseTableRowsItem) init() GraphDataResponseTableRowsItem { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Ref: #/components/schemas/HTTPValidationError -type HTTPValidationError struct { - Detail []ValidationError `json:"detail"` -} - -// GetDetail returns the value of Detail. -func (s *HTTPValidationError) GetDetail() []ValidationError { - return s.Detail -} - -// SetDetail sets the value of Detail. -func (s *HTTPValidationError) SetDetail(val []ValidationError) { - s.Detail = val -} - -func (*HTTPValidationError) addBankBackgroundRes() {} -func (*HTTPValidationError) cancelOperationRes() {} -func (*HTTPValidationError) clearBankMemoriesRes() {} -func (*HTTPValidationError) clearObservationsRes() {} -func (*HTTPValidationError) createDirectiveRes() {} -func (*HTTPValidationError) createMentalModelRes() {} -func (*HTTPValidationError) createOrUpdateBankRes() {} -func (*HTTPValidationError) deleteBankRes() {} -func (*HTTPValidationError) deleteDirectiveRes() {} -func (*HTTPValidationError) deleteDocumentRes() {} -func (*HTTPValidationError) deleteMentalModelRes() {} -func (*HTTPValidationError) getAgentStatsRes() {} -func (*HTTPValidationError) getBankConfigRes() {} -func (*HTTPValidationError) getBankProfileRes() {} -func (*HTTPValidationError) getChunkRes() {} -func (*HTTPValidationError) getDirectiveRes() {} -func (*HTTPValidationError) getDocumentRes() {} -func (*HTTPValidationError) getEntityRes() {} -func (*HTTPValidationError) getGraphRes() {} -func (*HTTPValidationError) getMemoryRes() {} -func (*HTTPValidationError) getMentalModelRes() {} -func (*HTTPValidationError) getOperationStatusRes() {} -func (*HTTPValidationError) listBanksRes() {} -func (*HTTPValidationError) listDirectivesRes() {} -func (*HTTPValidationError) listDocumentsRes() {} -func (*HTTPValidationError) listEntitiesRes() {} -func (*HTTPValidationError) listMemoriesRes() {} -func (*HTTPValidationError) listMentalModelsRes() {} -func (*HTTPValidationError) listOperationsRes() {} -func (*HTTPValidationError) listTagsRes() {} -func (*HTTPValidationError) recallMemoriesRes() {} -func (*HTTPValidationError) reflectRes() {} -func (*HTTPValidationError) refreshMentalModelRes() {} -func (*HTTPValidationError) regenerateEntityObservationsRes() {} -func (*HTTPValidationError) resetBankConfigRes() {} -func (*HTTPValidationError) retainMemoriesRes() {} -func (*HTTPValidationError) triggerConsolidationRes() {} -func (*HTTPValidationError) updateBankConfigRes() {} -func (*HTTPValidationError) updateBankDispositionRes() {} -func (*HTTPValidationError) updateBankRes() {} -func (*HTTPValidationError) updateDirectiveRes() {} -func (*HTTPValidationError) updateMentalModelRes() {} - -// Options for including additional data in recall results. -// Ref: #/components/schemas/IncludeOptions -type IncludeOptions struct { - // Include raw chunks. Set to {} to enable, null to disable (default: disabled). - Chunks OptChunkIncludeOptions `json:"chunks"` - // Include entity observations. Set to null to disable entity inclusion. - Entities OptEntityIncludeOptions `json:"entities"` -} - -// GetChunks returns the value of Chunks. -func (s *IncludeOptions) GetChunks() OptChunkIncludeOptions { - return s.Chunks -} - -// GetEntities returns the value of Entities. -func (s *IncludeOptions) GetEntities() OptEntityIncludeOptions { - return s.Entities -} - -// SetChunks sets the value of Chunks. -func (s *IncludeOptions) SetChunks(val OptChunkIncludeOptions) { - s.Chunks = val -} - -// SetEntities sets the value of Entities. -func (s *IncludeOptions) SetEntities(val OptEntityIncludeOptions) { - s.Entities = val -} - -// How to match tags. -type ListDirectivesTagsMatch string - -const ( - ListDirectivesTagsMatchAny ListDirectivesTagsMatch = "any" - ListDirectivesTagsMatchAll ListDirectivesTagsMatch = "all" - ListDirectivesTagsMatchExact ListDirectivesTagsMatch = "exact" -) - -// AllValues returns all ListDirectivesTagsMatch values. -func (ListDirectivesTagsMatch) AllValues() []ListDirectivesTagsMatch { - return []ListDirectivesTagsMatch{ - ListDirectivesTagsMatchAny, - ListDirectivesTagsMatchAll, - ListDirectivesTagsMatchExact, - } -} - -// MarshalText implements encoding.TextMarshaler. -func (s ListDirectivesTagsMatch) MarshalText() ([]byte, error) { - switch s { - case ListDirectivesTagsMatchAny: - return []byte(s), nil - case ListDirectivesTagsMatchAll: - return []byte(s), nil - case ListDirectivesTagsMatchExact: - return []byte(s), nil - default: - return nil, errors.Errorf("invalid value: %q", s) - } -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (s *ListDirectivesTagsMatch) UnmarshalText(data []byte) error { - switch ListDirectivesTagsMatch(data) { - case ListDirectivesTagsMatchAny: - *s = ListDirectivesTagsMatchAny - return nil - case ListDirectivesTagsMatchAll: - *s = ListDirectivesTagsMatchAll - return nil - case ListDirectivesTagsMatchExact: - *s = ListDirectivesTagsMatchExact - return nil - default: - return errors.Errorf("invalid value: %q", data) - } -} - -// Response model for list documents endpoint. -// Ref: #/components/schemas/ListDocumentsResponse -type ListDocumentsResponse struct { - Items []ListDocumentsResponseItemsItem `json:"items"` - Limit int `json:"limit"` - Offset int `json:"offset"` - Total int `json:"total"` -} - -// GetItems returns the value of Items. -func (s *ListDocumentsResponse) GetItems() []ListDocumentsResponseItemsItem { - return s.Items -} - -// GetLimit returns the value of Limit. -func (s *ListDocumentsResponse) GetLimit() int { - return s.Limit -} - -// GetOffset returns the value of Offset. -func (s *ListDocumentsResponse) GetOffset() int { - return s.Offset -} - -// GetTotal returns the value of Total. -func (s *ListDocumentsResponse) GetTotal() int { - return s.Total -} - -// SetItems sets the value of Items. -func (s *ListDocumentsResponse) SetItems(val []ListDocumentsResponseItemsItem) { - s.Items = val -} - -// SetLimit sets the value of Limit. -func (s *ListDocumentsResponse) SetLimit(val int) { - s.Limit = val -} - -// SetOffset sets the value of Offset. -func (s *ListDocumentsResponse) SetOffset(val int) { - s.Offset = val -} - -// SetTotal sets the value of Total. -func (s *ListDocumentsResponse) SetTotal(val int) { - s.Total = val -} - -func (*ListDocumentsResponse) listDocumentsRes() {} - -type ListDocumentsResponseItemsItem map[string]jx.Raw - -func (s *ListDocumentsResponseItemsItem) init() ListDocumentsResponseItemsItem { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Response model for list memory units endpoint. -// Ref: #/components/schemas/ListMemoryUnitsResponse -type ListMemoryUnitsResponse struct { - Items []ListMemoryUnitsResponseItemsItem `json:"items"` - Limit int `json:"limit"` - Offset int `json:"offset"` - Total int `json:"total"` -} - -// GetItems returns the value of Items. -func (s *ListMemoryUnitsResponse) GetItems() []ListMemoryUnitsResponseItemsItem { - return s.Items -} - -// GetLimit returns the value of Limit. -func (s *ListMemoryUnitsResponse) GetLimit() int { - return s.Limit -} - -// GetOffset returns the value of Offset. -func (s *ListMemoryUnitsResponse) GetOffset() int { - return s.Offset -} - -// GetTotal returns the value of Total. -func (s *ListMemoryUnitsResponse) GetTotal() int { - return s.Total -} - -// SetItems sets the value of Items. -func (s *ListMemoryUnitsResponse) SetItems(val []ListMemoryUnitsResponseItemsItem) { - s.Items = val -} - -// SetLimit sets the value of Limit. -func (s *ListMemoryUnitsResponse) SetLimit(val int) { - s.Limit = val -} - -// SetOffset sets the value of Offset. -func (s *ListMemoryUnitsResponse) SetOffset(val int) { - s.Offset = val -} - -// SetTotal sets the value of Total. -func (s *ListMemoryUnitsResponse) SetTotal(val int) { - s.Total = val -} - -func (*ListMemoryUnitsResponse) listMemoriesRes() {} - -type ListMemoryUnitsResponseItemsItem map[string]jx.Raw - -func (s *ListMemoryUnitsResponseItemsItem) init() ListMemoryUnitsResponseItemsItem { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// How to match tags. -type ListMentalModelsTagsMatch string - -const ( - ListMentalModelsTagsMatchAny ListMentalModelsTagsMatch = "any" - ListMentalModelsTagsMatchAll ListMentalModelsTagsMatch = "all" - ListMentalModelsTagsMatchExact ListMentalModelsTagsMatch = "exact" -) - -// AllValues returns all ListMentalModelsTagsMatch values. -func (ListMentalModelsTagsMatch) AllValues() []ListMentalModelsTagsMatch { - return []ListMentalModelsTagsMatch{ - ListMentalModelsTagsMatchAny, - ListMentalModelsTagsMatchAll, - ListMentalModelsTagsMatchExact, - } -} - -// MarshalText implements encoding.TextMarshaler. -func (s ListMentalModelsTagsMatch) MarshalText() ([]byte, error) { - switch s { - case ListMentalModelsTagsMatchAny: - return []byte(s), nil - case ListMentalModelsTagsMatchAll: - return []byte(s), nil - case ListMentalModelsTagsMatchExact: - return []byte(s), nil - default: - return nil, errors.Errorf("invalid value: %q", s) - } -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (s *ListMentalModelsTagsMatch) UnmarshalText(data []byte) error { - switch ListMentalModelsTagsMatch(data) { - case ListMentalModelsTagsMatchAny: - *s = ListMentalModelsTagsMatchAny - return nil - case ListMentalModelsTagsMatchAll: - *s = ListMentalModelsTagsMatchAll - return nil - case ListMentalModelsTagsMatchExact: - *s = ListMentalModelsTagsMatchExact - return nil - default: - return errors.Errorf("invalid value: %q", data) - } -} - -// Response model for list tags endpoint. -// Ref: #/components/schemas/ListTagsResponse -type ListTagsResponse struct { - Items []TagItem `json:"items"` - Limit int `json:"limit"` - Offset int `json:"offset"` - Total int `json:"total"` -} - -// GetItems returns the value of Items. -func (s *ListTagsResponse) GetItems() []TagItem { - return s.Items -} - -// GetLimit returns the value of Limit. -func (s *ListTagsResponse) GetLimit() int { - return s.Limit -} - -// GetOffset returns the value of Offset. -func (s *ListTagsResponse) GetOffset() int { - return s.Offset -} - -// GetTotal returns the value of Total. -func (s *ListTagsResponse) GetTotal() int { - return s.Total -} - -// SetItems sets the value of Items. -func (s *ListTagsResponse) SetItems(val []TagItem) { - s.Items = val -} - -// SetLimit sets the value of Limit. -func (s *ListTagsResponse) SetLimit(val int) { - s.Limit = val -} - -// SetOffset sets the value of Offset. -func (s *ListTagsResponse) SetOffset(val int) { - s.Offset = val -} - -// SetTotal sets the value of Total. -func (s *ListTagsResponse) SetTotal(val int) { - s.Total = val -} - -func (*ListTagsResponse) listTagsRes() {} - -// Single memory item for retain. -// Ref: #/components/schemas/MemoryItem -type MemoryItem struct { - Content string `json:"content"` - Context OptString `json:"context"` - // Optional document ID for this memory item. - DocumentID OptString `json:"document_id"` - // Optional entities to combine with auto-extracted entities. - Entities []EntityInput `json:"entities"` - Metadata OptMemoryItemMetadata `json:"metadata"` - // Optional tags for visibility scoping. Memories with tags can be filtered during recall. - Tags []string `json:"tags"` - Timestamp OptDateTime `json:"timestamp"` -} - -// GetContent returns the value of Content. -func (s *MemoryItem) GetContent() string { - return s.Content -} - -// GetContext returns the value of Context. -func (s *MemoryItem) GetContext() OptString { - return s.Context -} - -// GetDocumentID returns the value of DocumentID. -func (s *MemoryItem) GetDocumentID() OptString { - return s.DocumentID -} - -// GetEntities returns the value of Entities. -func (s *MemoryItem) GetEntities() []EntityInput { - return s.Entities -} - -// GetMetadata returns the value of Metadata. -func (s *MemoryItem) GetMetadata() OptMemoryItemMetadata { - return s.Metadata -} - -// GetTags returns the value of Tags. -func (s *MemoryItem) GetTags() []string { - return s.Tags -} - -// GetTimestamp returns the value of Timestamp. -func (s *MemoryItem) GetTimestamp() OptDateTime { - return s.Timestamp -} - -// SetContent sets the value of Content. -func (s *MemoryItem) SetContent(val string) { - s.Content = val -} - -// SetContext sets the value of Context. -func (s *MemoryItem) SetContext(val OptString) { - s.Context = val -} - -// SetDocumentID sets the value of DocumentID. -func (s *MemoryItem) SetDocumentID(val OptString) { - s.DocumentID = val -} - -// SetEntities sets the value of Entities. -func (s *MemoryItem) SetEntities(val []EntityInput) { - s.Entities = val -} - -// SetMetadata sets the value of Metadata. -func (s *MemoryItem) SetMetadata(val OptMemoryItemMetadata) { - s.Metadata = val -} - -// SetTags sets the value of Tags. -func (s *MemoryItem) SetTags(val []string) { - s.Tags = val -} - -// SetTimestamp sets the value of Timestamp. -func (s *MemoryItem) SetTimestamp(val OptDateTime) { - s.Timestamp = val -} - -type MemoryItemMetadata map[string]string - -func (s *MemoryItemMetadata) init() MemoryItemMetadata { - m := *s - if m == nil { - m = map[string]string{} - *s = m - } - return m -} - -// Response model for listing mental models. -// Ref: #/components/schemas/MentalModelListResponse -type MentalModelListResponse struct { - Items []MentalModelResponse `json:"items"` -} - -// GetItems returns the value of Items. -func (s *MentalModelListResponse) GetItems() []MentalModelResponse { - return s.Items -} - -// SetItems sets the value of Items. -func (s *MentalModelListResponse) SetItems(val []MentalModelResponse) { - s.Items = val -} - -func (*MentalModelListResponse) listMentalModelsRes() {} - -// Response model for a mental model (stored reflect response). -// Ref: #/components/schemas/MentalModelResponse -type MentalModelResponse struct { - BankID string `json:"bank_id"` - // The mental model content as well-formatted markdown (auto-generated from reflect endpoint). - Content string `json:"content"` - CreatedAt OptString `json:"created_at"` - ID string `json:"id"` - LastRefreshedAt OptString `json:"last_refreshed_at"` - MaxTokens OptInt `json:"max_tokens"` - Name string `json:"name"` - // Full reflect API response payload including based_on facts and observations. - ReflectResponse OptMentalModelResponseReflectResponse `json:"reflect_response"` - SourceQuery string `json:"source_query"` - Tags []string `json:"tags"` - Trigger OptMentalModelTrigger `json:"trigger"` -} - -// GetBankID returns the value of BankID. -func (s *MentalModelResponse) GetBankID() string { - return s.BankID -} - -// GetContent returns the value of Content. -func (s *MentalModelResponse) GetContent() string { - return s.Content -} - -// GetCreatedAt returns the value of CreatedAt. -func (s *MentalModelResponse) GetCreatedAt() OptString { - return s.CreatedAt -} - -// GetID returns the value of ID. -func (s *MentalModelResponse) GetID() string { - return s.ID -} - -// GetLastRefreshedAt returns the value of LastRefreshedAt. -func (s *MentalModelResponse) GetLastRefreshedAt() OptString { - return s.LastRefreshedAt -} - -// GetMaxTokens returns the value of MaxTokens. -func (s *MentalModelResponse) GetMaxTokens() OptInt { - return s.MaxTokens -} - -// GetName returns the value of Name. -func (s *MentalModelResponse) GetName() string { - return s.Name -} - -// GetReflectResponse returns the value of ReflectResponse. -func (s *MentalModelResponse) GetReflectResponse() OptMentalModelResponseReflectResponse { - return s.ReflectResponse -} - -// GetSourceQuery returns the value of SourceQuery. -func (s *MentalModelResponse) GetSourceQuery() string { - return s.SourceQuery -} - -// GetTags returns the value of Tags. -func (s *MentalModelResponse) GetTags() []string { - return s.Tags -} - -// GetTrigger returns the value of Trigger. -func (s *MentalModelResponse) GetTrigger() OptMentalModelTrigger { - return s.Trigger -} - -// SetBankID sets the value of BankID. -func (s *MentalModelResponse) SetBankID(val string) { - s.BankID = val -} - -// SetContent sets the value of Content. -func (s *MentalModelResponse) SetContent(val string) { - s.Content = val -} - -// SetCreatedAt sets the value of CreatedAt. -func (s *MentalModelResponse) SetCreatedAt(val OptString) { - s.CreatedAt = val -} - -// SetID sets the value of ID. -func (s *MentalModelResponse) SetID(val string) { - s.ID = val -} - -// SetLastRefreshedAt sets the value of LastRefreshedAt. -func (s *MentalModelResponse) SetLastRefreshedAt(val OptString) { - s.LastRefreshedAt = val -} - -// SetMaxTokens sets the value of MaxTokens. -func (s *MentalModelResponse) SetMaxTokens(val OptInt) { - s.MaxTokens = val -} - -// SetName sets the value of Name. -func (s *MentalModelResponse) SetName(val string) { - s.Name = val -} - -// SetReflectResponse sets the value of ReflectResponse. -func (s *MentalModelResponse) SetReflectResponse(val OptMentalModelResponseReflectResponse) { - s.ReflectResponse = val -} - -// SetSourceQuery sets the value of SourceQuery. -func (s *MentalModelResponse) SetSourceQuery(val string) { - s.SourceQuery = val -} - -// SetTags sets the value of Tags. -func (s *MentalModelResponse) SetTags(val []string) { - s.Tags = val -} - -// SetTrigger sets the value of Trigger. -func (s *MentalModelResponse) SetTrigger(val OptMentalModelTrigger) { - s.Trigger = val -} - -func (*MentalModelResponse) getMentalModelRes() {} -func (*MentalModelResponse) updateMentalModelRes() {} - -// Full reflect API response payload including based_on facts and observations. -type MentalModelResponseReflectResponse map[string]jx.Raw - -func (s *MentalModelResponseReflectResponse) init() MentalModelResponseReflectResponse { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Trigger settings for a mental model. -// Ref: #/components/schemas/MentalModelTrigger -type MentalModelTrigger struct { - // If true, refresh this mental model after observations consolidation (real-time mode). - RefreshAfterConsolidation OptBool `json:"refresh_after_consolidation"` -} - -// GetRefreshAfterConsolidation returns the value of RefreshAfterConsolidation. -func (s *MentalModelTrigger) GetRefreshAfterConsolidation() OptBool { - return s.RefreshAfterConsolidation -} - -// SetRefreshAfterConsolidation sets the value of RefreshAfterConsolidation. -func (s *MentalModelTrigger) SetRefreshAfterConsolidation(val OptBool) { - s.RefreshAfterConsolidation = val -} - -// Response model for a single async operation. -// Ref: #/components/schemas/OperationResponse -type OperationResponse struct { - CreatedAt string `json:"created_at"` - DocumentID OptString `json:"document_id"` - ErrorMessage string `json:"error_message"` - ID string `json:"id"` - ItemsCount int `json:"items_count"` - Status string `json:"status"` - TaskType string `json:"task_type"` -} - -// GetCreatedAt returns the value of CreatedAt. -func (s *OperationResponse) GetCreatedAt() string { - return s.CreatedAt -} - -// GetDocumentID returns the value of DocumentID. -func (s *OperationResponse) GetDocumentID() OptString { - return s.DocumentID -} - -// GetErrorMessage returns the value of ErrorMessage. -func (s *OperationResponse) GetErrorMessage() string { - return s.ErrorMessage -} - -// GetID returns the value of ID. -func (s *OperationResponse) GetID() string { - return s.ID -} - -// GetItemsCount returns the value of ItemsCount. -func (s *OperationResponse) GetItemsCount() int { - return s.ItemsCount -} - -// GetStatus returns the value of Status. -func (s *OperationResponse) GetStatus() string { - return s.Status -} - -// GetTaskType returns the value of TaskType. -func (s *OperationResponse) GetTaskType() string { - return s.TaskType -} - -// SetCreatedAt sets the value of CreatedAt. -func (s *OperationResponse) SetCreatedAt(val string) { - s.CreatedAt = val -} - -// SetDocumentID sets the value of DocumentID. -func (s *OperationResponse) SetDocumentID(val OptString) { - s.DocumentID = val -} - -// SetErrorMessage sets the value of ErrorMessage. -func (s *OperationResponse) SetErrorMessage(val string) { - s.ErrorMessage = val -} - -// SetID sets the value of ID. -func (s *OperationResponse) SetID(val string) { - s.ID = val -} - -// SetItemsCount sets the value of ItemsCount. -func (s *OperationResponse) SetItemsCount(val int) { - s.ItemsCount = val -} - -// SetStatus sets the value of Status. -func (s *OperationResponse) SetStatus(val string) { - s.Status = val -} - -// SetTaskType sets the value of TaskType. -func (s *OperationResponse) SetTaskType(val string) { - s.TaskType = val -} - -// Response model for getting a single operation status. -// Ref: #/components/schemas/OperationStatusResponse -type OperationStatusResponse struct { - CompletedAt OptString `json:"completed_at"` - CreatedAt OptString `json:"created_at"` - ErrorMessage OptString `json:"error_message"` - OperationID string `json:"operation_id"` - OperationType OptString `json:"operation_type"` - Status OperationStatusResponseStatus `json:"status"` - UpdatedAt OptString `json:"updated_at"` -} - -// GetCompletedAt returns the value of CompletedAt. -func (s *OperationStatusResponse) GetCompletedAt() OptString { - return s.CompletedAt -} - -// GetCreatedAt returns the value of CreatedAt. -func (s *OperationStatusResponse) GetCreatedAt() OptString { - return s.CreatedAt -} - -// GetErrorMessage returns the value of ErrorMessage. -func (s *OperationStatusResponse) GetErrorMessage() OptString { - return s.ErrorMessage -} - -// GetOperationID returns the value of OperationID. -func (s *OperationStatusResponse) GetOperationID() string { - return s.OperationID -} - -// GetOperationType returns the value of OperationType. -func (s *OperationStatusResponse) GetOperationType() OptString { - return s.OperationType -} - -// GetStatus returns the value of Status. -func (s *OperationStatusResponse) GetStatus() OperationStatusResponseStatus { - return s.Status -} - -// GetUpdatedAt returns the value of UpdatedAt. -func (s *OperationStatusResponse) GetUpdatedAt() OptString { - return s.UpdatedAt -} - -// SetCompletedAt sets the value of CompletedAt. -func (s *OperationStatusResponse) SetCompletedAt(val OptString) { - s.CompletedAt = val -} - -// SetCreatedAt sets the value of CreatedAt. -func (s *OperationStatusResponse) SetCreatedAt(val OptString) { - s.CreatedAt = val -} - -// SetErrorMessage sets the value of ErrorMessage. -func (s *OperationStatusResponse) SetErrorMessage(val OptString) { - s.ErrorMessage = val -} - -// SetOperationID sets the value of OperationID. -func (s *OperationStatusResponse) SetOperationID(val string) { - s.OperationID = val -} - -// SetOperationType sets the value of OperationType. -func (s *OperationStatusResponse) SetOperationType(val OptString) { - s.OperationType = val -} - -// SetStatus sets the value of Status. -func (s *OperationStatusResponse) SetStatus(val OperationStatusResponseStatus) { - s.Status = val -} - -// SetUpdatedAt sets the value of UpdatedAt. -func (s *OperationStatusResponse) SetUpdatedAt(val OptString) { - s.UpdatedAt = val -} - -func (*OperationStatusResponse) getOperationStatusRes() {} - -type OperationStatusResponseStatus string - -const ( - OperationStatusResponseStatusPending OperationStatusResponseStatus = "pending" - OperationStatusResponseStatusCompleted OperationStatusResponseStatus = "completed" - OperationStatusResponseStatusFailed OperationStatusResponseStatus = "failed" - OperationStatusResponseStatusNotFound OperationStatusResponseStatus = "not_found" -) - -// AllValues returns all OperationStatusResponseStatus values. -func (OperationStatusResponseStatus) AllValues() []OperationStatusResponseStatus { - return []OperationStatusResponseStatus{ - OperationStatusResponseStatusPending, - OperationStatusResponseStatusCompleted, - OperationStatusResponseStatusFailed, - OperationStatusResponseStatusNotFound, - } -} - -// MarshalText implements encoding.TextMarshaler. -func (s OperationStatusResponseStatus) MarshalText() ([]byte, error) { - switch s { - case OperationStatusResponseStatusPending: - return []byte(s), nil - case OperationStatusResponseStatusCompleted: - return []byte(s), nil - case OperationStatusResponseStatusFailed: - return []byte(s), nil - case OperationStatusResponseStatusNotFound: - return []byte(s), nil - default: - return nil, errors.Errorf("invalid value: %q", s) - } -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (s *OperationStatusResponseStatus) UnmarshalText(data []byte) error { - switch OperationStatusResponseStatus(data) { - case OperationStatusResponseStatusPending: - *s = OperationStatusResponseStatusPending - return nil - case OperationStatusResponseStatusCompleted: - *s = OperationStatusResponseStatusCompleted - return nil - case OperationStatusResponseStatusFailed: - *s = OperationStatusResponseStatusFailed - return nil - case OperationStatusResponseStatusNotFound: - *s = OperationStatusResponseStatusNotFound - return nil - default: - return errors.Errorf("invalid value: %q", data) - } -} - -// Response model for list operations endpoint. -// Ref: #/components/schemas/OperationsListResponse -type OperationsListResponse struct { - BankID string `json:"bank_id"` - Limit int `json:"limit"` - Offset int `json:"offset"` - Operations []OperationResponse `json:"operations"` - Total int `json:"total"` -} - -// GetBankID returns the value of BankID. -func (s *OperationsListResponse) GetBankID() string { - return s.BankID -} - -// GetLimit returns the value of Limit. -func (s *OperationsListResponse) GetLimit() int { - return s.Limit -} - -// GetOffset returns the value of Offset. -func (s *OperationsListResponse) GetOffset() int { - return s.Offset -} - -// GetOperations returns the value of Operations. -func (s *OperationsListResponse) GetOperations() []OperationResponse { - return s.Operations -} - -// GetTotal returns the value of Total. -func (s *OperationsListResponse) GetTotal() int { - return s.Total -} - -// SetBankID sets the value of BankID. -func (s *OperationsListResponse) SetBankID(val string) { - s.BankID = val -} - -// SetLimit sets the value of Limit. -func (s *OperationsListResponse) SetLimit(val int) { - s.Limit = val -} - -// SetOffset sets the value of Offset. -func (s *OperationsListResponse) SetOffset(val int) { - s.Offset = val -} - -// SetOperations sets the value of Operations. -func (s *OperationsListResponse) SetOperations(val []OperationResponse) { - s.Operations = val -} - -// SetTotal sets the value of Total. -func (s *OperationsListResponse) SetTotal(val int) { - s.Total = val -} - -func (*OperationsListResponse) listOperationsRes() {} - -// NewOptBool returns new OptBool with value set to v. -func NewOptBool(v bool) OptBool { - return OptBool{ - Value: v, - Set: true, - } -} - -// OptBool is optional bool. -type OptBool struct { - Value bool - Set bool -} - -// IsSet returns true if OptBool was set. -func (o OptBool) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptBool) Reset() { - var v bool - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptBool) SetTo(v bool) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptBool) Get() (v bool, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptBool) Or(d bool) bool { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptBudget returns new OptBudget with value set to v. -func NewOptBudget(v Budget) OptBudget { - return OptBudget{ - Value: v, - Set: true, - } -} - -// OptBudget is optional Budget. -type OptBudget struct { - Value Budget - Set bool -} - -// IsSet returns true if OptBudget was set. -func (o OptBudget) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptBudget) Reset() { - var v Budget - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptBudget) SetTo(v Budget) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptBudget) Get() (v Budget, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptBudget) Or(d Budget) Budget { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptChunkIncludeOptions returns new OptChunkIncludeOptions with value set to v. -func NewOptChunkIncludeOptions(v ChunkIncludeOptions) OptChunkIncludeOptions { - return OptChunkIncludeOptions{ - Value: v, - Set: true, - } -} - -// OptChunkIncludeOptions is optional ChunkIncludeOptions. -type OptChunkIncludeOptions struct { - Value ChunkIncludeOptions - Set bool -} - -// IsSet returns true if OptChunkIncludeOptions was set. -func (o OptChunkIncludeOptions) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptChunkIncludeOptions) Reset() { - var v ChunkIncludeOptions - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptChunkIncludeOptions) SetTo(v ChunkIncludeOptions) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptChunkIncludeOptions) Get() (v ChunkIncludeOptions, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptChunkIncludeOptions) Or(d ChunkIncludeOptions) ChunkIncludeOptions { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptDateTime returns new OptDateTime with value set to v. -func NewOptDateTime(v time.Time) OptDateTime { - return OptDateTime{ - Value: v, - Set: true, - } -} - -// OptDateTime is optional time.Time. -type OptDateTime struct { - Value time.Time - Set bool -} - -// IsSet returns true if OptDateTime was set. -func (o OptDateTime) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptDateTime) Reset() { - var v time.Time - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptDateTime) SetTo(v time.Time) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptDateTime) Get() (v time.Time, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptDateTime) Or(d time.Time) time.Time { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptDispositionTraits returns new OptDispositionTraits with value set to v. -func NewOptDispositionTraits(v DispositionTraits) OptDispositionTraits { - return OptDispositionTraits{ - Value: v, - Set: true, - } -} - -// OptDispositionTraits is optional DispositionTraits. -type OptDispositionTraits struct { - Value DispositionTraits - Set bool -} - -// IsSet returns true if OptDispositionTraits was set. -func (o OptDispositionTraits) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptDispositionTraits) Reset() { - var v DispositionTraits - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptDispositionTraits) SetTo(v DispositionTraits) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptDispositionTraits) Get() (v DispositionTraits, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptDispositionTraits) Or(d DispositionTraits) DispositionTraits { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptEntityDetailResponseMetadata returns new OptEntityDetailResponseMetadata with value set to v. -func NewOptEntityDetailResponseMetadata(v EntityDetailResponseMetadata) OptEntityDetailResponseMetadata { - return OptEntityDetailResponseMetadata{ - Value: v, - Set: true, - } -} - -// OptEntityDetailResponseMetadata is optional EntityDetailResponseMetadata. -type OptEntityDetailResponseMetadata struct { - Value EntityDetailResponseMetadata - Set bool -} - -// IsSet returns true if OptEntityDetailResponseMetadata was set. -func (o OptEntityDetailResponseMetadata) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptEntityDetailResponseMetadata) Reset() { - var v EntityDetailResponseMetadata - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptEntityDetailResponseMetadata) SetTo(v EntityDetailResponseMetadata) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptEntityDetailResponseMetadata) Get() (v EntityDetailResponseMetadata, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptEntityDetailResponseMetadata) Or(d EntityDetailResponseMetadata) EntityDetailResponseMetadata { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptEntityIncludeOptions returns new OptEntityIncludeOptions with value set to v. -func NewOptEntityIncludeOptions(v EntityIncludeOptions) OptEntityIncludeOptions { - return OptEntityIncludeOptions{ - Value: v, - Set: true, - } -} - -// OptEntityIncludeOptions is optional EntityIncludeOptions. -type OptEntityIncludeOptions struct { - Value EntityIncludeOptions - Set bool -} - -// IsSet returns true if OptEntityIncludeOptions was set. -func (o OptEntityIncludeOptions) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptEntityIncludeOptions) Reset() { - var v EntityIncludeOptions - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptEntityIncludeOptions) SetTo(v EntityIncludeOptions) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptEntityIncludeOptions) Get() (v EntityIncludeOptions, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptEntityIncludeOptions) Or(d EntityIncludeOptions) EntityIncludeOptions { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptEntityListItemMetadata returns new OptEntityListItemMetadata with value set to v. -func NewOptEntityListItemMetadata(v EntityListItemMetadata) OptEntityListItemMetadata { - return OptEntityListItemMetadata{ - Value: v, - Set: true, - } -} - -// OptEntityListItemMetadata is optional EntityListItemMetadata. -type OptEntityListItemMetadata struct { - Value EntityListItemMetadata - Set bool -} - -// IsSet returns true if OptEntityListItemMetadata was set. -func (o OptEntityListItemMetadata) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptEntityListItemMetadata) Reset() { - var v EntityListItemMetadata - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptEntityListItemMetadata) SetTo(v EntityListItemMetadata) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptEntityListItemMetadata) Get() (v EntityListItemMetadata, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptEntityListItemMetadata) Or(d EntityListItemMetadata) EntityListItemMetadata { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptIncludeOptions returns new OptIncludeOptions with value set to v. -func NewOptIncludeOptions(v IncludeOptions) OptIncludeOptions { - return OptIncludeOptions{ - Value: v, - Set: true, - } -} - -// OptIncludeOptions is optional IncludeOptions. -type OptIncludeOptions struct { - Value IncludeOptions - Set bool -} - -// IsSet returns true if OptIncludeOptions was set. -func (o OptIncludeOptions) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptIncludeOptions) Reset() { - var v IncludeOptions - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptIncludeOptions) SetTo(v IncludeOptions) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptIncludeOptions) Get() (v IncludeOptions, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptIncludeOptions) Or(d IncludeOptions) IncludeOptions { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptInt returns new OptInt with value set to v. -func NewOptInt(v int) OptInt { - return OptInt{ - Value: v, - Set: true, - } -} - -// OptInt is optional int. -type OptInt struct { - Value int - Set bool -} - -// IsSet returns true if OptInt was set. -func (o OptInt) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptInt) Reset() { - var v int - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptInt) SetTo(v int) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptInt) Get() (v int, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptInt) Or(d int) int { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptListDirectivesTagsMatch returns new OptListDirectivesTagsMatch with value set to v. -func NewOptListDirectivesTagsMatch(v ListDirectivesTagsMatch) OptListDirectivesTagsMatch { - return OptListDirectivesTagsMatch{ - Value: v, - Set: true, - } -} - -// OptListDirectivesTagsMatch is optional ListDirectivesTagsMatch. -type OptListDirectivesTagsMatch struct { - Value ListDirectivesTagsMatch - Set bool -} - -// IsSet returns true if OptListDirectivesTagsMatch was set. -func (o OptListDirectivesTagsMatch) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptListDirectivesTagsMatch) Reset() { - var v ListDirectivesTagsMatch - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptListDirectivesTagsMatch) SetTo(v ListDirectivesTagsMatch) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptListDirectivesTagsMatch) Get() (v ListDirectivesTagsMatch, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptListDirectivesTagsMatch) Or(d ListDirectivesTagsMatch) ListDirectivesTagsMatch { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptListMentalModelsTagsMatch returns new OptListMentalModelsTagsMatch with value set to v. -func NewOptListMentalModelsTagsMatch(v ListMentalModelsTagsMatch) OptListMentalModelsTagsMatch { - return OptListMentalModelsTagsMatch{ - Value: v, - Set: true, - } -} - -// OptListMentalModelsTagsMatch is optional ListMentalModelsTagsMatch. -type OptListMentalModelsTagsMatch struct { - Value ListMentalModelsTagsMatch - Set bool -} - -// IsSet returns true if OptListMentalModelsTagsMatch was set. -func (o OptListMentalModelsTagsMatch) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptListMentalModelsTagsMatch) Reset() { - var v ListMentalModelsTagsMatch - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptListMentalModelsTagsMatch) SetTo(v ListMentalModelsTagsMatch) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptListMentalModelsTagsMatch) Get() (v ListMentalModelsTagsMatch, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptListMentalModelsTagsMatch) Or(d ListMentalModelsTagsMatch) ListMentalModelsTagsMatch { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptMemoryItemMetadata returns new OptMemoryItemMetadata with value set to v. -func NewOptMemoryItemMetadata(v MemoryItemMetadata) OptMemoryItemMetadata { - return OptMemoryItemMetadata{ - Value: v, - Set: true, - } -} - -// OptMemoryItemMetadata is optional MemoryItemMetadata. -type OptMemoryItemMetadata struct { - Value MemoryItemMetadata - Set bool -} - -// IsSet returns true if OptMemoryItemMetadata was set. -func (o OptMemoryItemMetadata) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptMemoryItemMetadata) Reset() { - var v MemoryItemMetadata - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptMemoryItemMetadata) SetTo(v MemoryItemMetadata) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptMemoryItemMetadata) Get() (v MemoryItemMetadata, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptMemoryItemMetadata) Or(d MemoryItemMetadata) MemoryItemMetadata { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptMentalModelResponseReflectResponse returns new OptMentalModelResponseReflectResponse with value set to v. -func NewOptMentalModelResponseReflectResponse(v MentalModelResponseReflectResponse) OptMentalModelResponseReflectResponse { - return OptMentalModelResponseReflectResponse{ - Value: v, - Set: true, - } -} - -// OptMentalModelResponseReflectResponse is optional MentalModelResponseReflectResponse. -type OptMentalModelResponseReflectResponse struct { - Value MentalModelResponseReflectResponse - Set bool -} - -// IsSet returns true if OptMentalModelResponseReflectResponse was set. -func (o OptMentalModelResponseReflectResponse) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptMentalModelResponseReflectResponse) Reset() { - var v MentalModelResponseReflectResponse - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptMentalModelResponseReflectResponse) SetTo(v MentalModelResponseReflectResponse) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptMentalModelResponseReflectResponse) Get() (v MentalModelResponseReflectResponse, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptMentalModelResponseReflectResponse) Or(d MentalModelResponseReflectResponse) MentalModelResponseReflectResponse { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptMentalModelTrigger returns new OptMentalModelTrigger with value set to v. -func NewOptMentalModelTrigger(v MentalModelTrigger) OptMentalModelTrigger { - return OptMentalModelTrigger{ - Value: v, - Set: true, - } -} - -// OptMentalModelTrigger is optional MentalModelTrigger. -type OptMentalModelTrigger struct { - Value MentalModelTrigger - Set bool -} - -// IsSet returns true if OptMentalModelTrigger was set. -func (o OptMentalModelTrigger) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptMentalModelTrigger) Reset() { - var v MentalModelTrigger - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptMentalModelTrigger) SetTo(v MentalModelTrigger) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptMentalModelTrigger) Get() (v MentalModelTrigger, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptMentalModelTrigger) Or(d MentalModelTrigger) MentalModelTrigger { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptRecallRequestTagsMatch returns new OptRecallRequestTagsMatch with value set to v. -func NewOptRecallRequestTagsMatch(v RecallRequestTagsMatch) OptRecallRequestTagsMatch { - return OptRecallRequestTagsMatch{ - Value: v, - Set: true, - } -} - -// OptRecallRequestTagsMatch is optional RecallRequestTagsMatch. -type OptRecallRequestTagsMatch struct { - Value RecallRequestTagsMatch - Set bool -} - -// IsSet returns true if OptRecallRequestTagsMatch was set. -func (o OptRecallRequestTagsMatch) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptRecallRequestTagsMatch) Reset() { - var v RecallRequestTagsMatch - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptRecallRequestTagsMatch) SetTo(v RecallRequestTagsMatch) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptRecallRequestTagsMatch) Get() (v RecallRequestTagsMatch, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptRecallRequestTagsMatch) Or(d RecallRequestTagsMatch) RecallRequestTagsMatch { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptRecallResponseChunks returns new OptRecallResponseChunks with value set to v. -func NewOptRecallResponseChunks(v RecallResponseChunks) OptRecallResponseChunks { - return OptRecallResponseChunks{ - Value: v, - Set: true, - } -} - -// OptRecallResponseChunks is optional RecallResponseChunks. -type OptRecallResponseChunks struct { - Value RecallResponseChunks - Set bool -} - -// IsSet returns true if OptRecallResponseChunks was set. -func (o OptRecallResponseChunks) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptRecallResponseChunks) Reset() { - var v RecallResponseChunks - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptRecallResponseChunks) SetTo(v RecallResponseChunks) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptRecallResponseChunks) Get() (v RecallResponseChunks, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptRecallResponseChunks) Or(d RecallResponseChunks) RecallResponseChunks { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptRecallResponseEntities returns new OptRecallResponseEntities with value set to v. -func NewOptRecallResponseEntities(v RecallResponseEntities) OptRecallResponseEntities { - return OptRecallResponseEntities{ - Value: v, - Set: true, - } -} - -// OptRecallResponseEntities is optional RecallResponseEntities. -type OptRecallResponseEntities struct { - Value RecallResponseEntities - Set bool -} - -// IsSet returns true if OptRecallResponseEntities was set. -func (o OptRecallResponseEntities) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptRecallResponseEntities) Reset() { - var v RecallResponseEntities - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptRecallResponseEntities) SetTo(v RecallResponseEntities) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptRecallResponseEntities) Get() (v RecallResponseEntities, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptRecallResponseEntities) Or(d RecallResponseEntities) RecallResponseEntities { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptRecallResponseTrace returns new OptRecallResponseTrace with value set to v. -func NewOptRecallResponseTrace(v RecallResponseTrace) OptRecallResponseTrace { - return OptRecallResponseTrace{ - Value: v, - Set: true, - } -} - -// OptRecallResponseTrace is optional RecallResponseTrace. -type OptRecallResponseTrace struct { - Value RecallResponseTrace - Set bool -} - -// IsSet returns true if OptRecallResponseTrace was set. -func (o OptRecallResponseTrace) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptRecallResponseTrace) Reset() { - var v RecallResponseTrace - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptRecallResponseTrace) SetTo(v RecallResponseTrace) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptRecallResponseTrace) Get() (v RecallResponseTrace, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptRecallResponseTrace) Or(d RecallResponseTrace) RecallResponseTrace { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptRecallResultMetadata returns new OptRecallResultMetadata with value set to v. -func NewOptRecallResultMetadata(v RecallResultMetadata) OptRecallResultMetadata { - return OptRecallResultMetadata{ - Value: v, - Set: true, - } -} - -// OptRecallResultMetadata is optional RecallResultMetadata. -type OptRecallResultMetadata struct { - Value RecallResultMetadata - Set bool -} - -// IsSet returns true if OptRecallResultMetadata was set. -func (o OptRecallResultMetadata) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptRecallResultMetadata) Reset() { - var v RecallResultMetadata - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptRecallResultMetadata) SetTo(v RecallResultMetadata) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptRecallResultMetadata) Get() (v RecallResultMetadata, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptRecallResultMetadata) Or(d RecallResultMetadata) RecallResultMetadata { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptReflectBasedOn returns new OptReflectBasedOn with value set to v. -func NewOptReflectBasedOn(v ReflectBasedOn) OptReflectBasedOn { - return OptReflectBasedOn{ - Value: v, - Set: true, - } -} - -// OptReflectBasedOn is optional ReflectBasedOn. -type OptReflectBasedOn struct { - Value ReflectBasedOn - Set bool -} - -// IsSet returns true if OptReflectBasedOn was set. -func (o OptReflectBasedOn) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptReflectBasedOn) Reset() { - var v ReflectBasedOn - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptReflectBasedOn) SetTo(v ReflectBasedOn) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptReflectBasedOn) Get() (v ReflectBasedOn, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptReflectBasedOn) Or(d ReflectBasedOn) ReflectBasedOn { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptReflectIncludeOptions returns new OptReflectIncludeOptions with value set to v. -func NewOptReflectIncludeOptions(v ReflectIncludeOptions) OptReflectIncludeOptions { - return OptReflectIncludeOptions{ - Value: v, - Set: true, - } -} - -// OptReflectIncludeOptions is optional ReflectIncludeOptions. -type OptReflectIncludeOptions struct { - Value ReflectIncludeOptions - Set bool -} - -// IsSet returns true if OptReflectIncludeOptions was set. -func (o OptReflectIncludeOptions) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptReflectIncludeOptions) Reset() { - var v ReflectIncludeOptions - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptReflectIncludeOptions) SetTo(v ReflectIncludeOptions) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptReflectIncludeOptions) Get() (v ReflectIncludeOptions, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptReflectIncludeOptions) Or(d ReflectIncludeOptions) ReflectIncludeOptions { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptReflectRequestResponseSchema returns new OptReflectRequestResponseSchema with value set to v. -func NewOptReflectRequestResponseSchema(v ReflectRequestResponseSchema) OptReflectRequestResponseSchema { - return OptReflectRequestResponseSchema{ - Value: v, - Set: true, - } -} - -// OptReflectRequestResponseSchema is optional ReflectRequestResponseSchema. -type OptReflectRequestResponseSchema struct { - Value ReflectRequestResponseSchema - Set bool -} - -// IsSet returns true if OptReflectRequestResponseSchema was set. -func (o OptReflectRequestResponseSchema) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptReflectRequestResponseSchema) Reset() { - var v ReflectRequestResponseSchema - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptReflectRequestResponseSchema) SetTo(v ReflectRequestResponseSchema) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptReflectRequestResponseSchema) Get() (v ReflectRequestResponseSchema, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptReflectRequestResponseSchema) Or(d ReflectRequestResponseSchema) ReflectRequestResponseSchema { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptReflectRequestTagsMatch returns new OptReflectRequestTagsMatch with value set to v. -func NewOptReflectRequestTagsMatch(v ReflectRequestTagsMatch) OptReflectRequestTagsMatch { - return OptReflectRequestTagsMatch{ - Value: v, - Set: true, - } -} - -// OptReflectRequestTagsMatch is optional ReflectRequestTagsMatch. -type OptReflectRequestTagsMatch struct { - Value ReflectRequestTagsMatch - Set bool -} - -// IsSet returns true if OptReflectRequestTagsMatch was set. -func (o OptReflectRequestTagsMatch) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptReflectRequestTagsMatch) Reset() { - var v ReflectRequestTagsMatch - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptReflectRequestTagsMatch) SetTo(v ReflectRequestTagsMatch) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptReflectRequestTagsMatch) Get() (v ReflectRequestTagsMatch, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptReflectRequestTagsMatch) Or(d ReflectRequestTagsMatch) ReflectRequestTagsMatch { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptReflectResponseStructuredOutput returns new OptReflectResponseStructuredOutput with value set to v. -func NewOptReflectResponseStructuredOutput(v ReflectResponseStructuredOutput) OptReflectResponseStructuredOutput { - return OptReflectResponseStructuredOutput{ - Value: v, - Set: true, - } -} - -// OptReflectResponseStructuredOutput is optional ReflectResponseStructuredOutput. -type OptReflectResponseStructuredOutput struct { - Value ReflectResponseStructuredOutput - Set bool -} - -// IsSet returns true if OptReflectResponseStructuredOutput was set. -func (o OptReflectResponseStructuredOutput) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptReflectResponseStructuredOutput) Reset() { - var v ReflectResponseStructuredOutput - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptReflectResponseStructuredOutput) SetTo(v ReflectResponseStructuredOutput) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptReflectResponseStructuredOutput) Get() (v ReflectResponseStructuredOutput, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptReflectResponseStructuredOutput) Or(d ReflectResponseStructuredOutput) ReflectResponseStructuredOutput { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptReflectToolCallOutput returns new OptReflectToolCallOutput with value set to v. -func NewOptReflectToolCallOutput(v ReflectToolCallOutput) OptReflectToolCallOutput { - return OptReflectToolCallOutput{ - Value: v, - Set: true, - } -} - -// OptReflectToolCallOutput is optional ReflectToolCallOutput. -type OptReflectToolCallOutput struct { - Value ReflectToolCallOutput - Set bool -} - -// IsSet returns true if OptReflectToolCallOutput was set. -func (o OptReflectToolCallOutput) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptReflectToolCallOutput) Reset() { - var v ReflectToolCallOutput - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptReflectToolCallOutput) SetTo(v ReflectToolCallOutput) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptReflectToolCallOutput) Get() (v ReflectToolCallOutput, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptReflectToolCallOutput) Or(d ReflectToolCallOutput) ReflectToolCallOutput { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptReflectTrace returns new OptReflectTrace with value set to v. -func NewOptReflectTrace(v ReflectTrace) OptReflectTrace { - return OptReflectTrace{ - Value: v, - Set: true, - } -} - -// OptReflectTrace is optional ReflectTrace. -type OptReflectTrace struct { - Value ReflectTrace - Set bool -} - -// IsSet returns true if OptReflectTrace was set. -func (o OptReflectTrace) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptReflectTrace) Reset() { - var v ReflectTrace - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptReflectTrace) SetTo(v ReflectTrace) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptReflectTrace) Get() (v ReflectTrace, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptReflectTrace) Or(d ReflectTrace) ReflectTrace { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptString returns new OptString with value set to v. -func NewOptString(v string) OptString { - return OptString{ - Value: v, - Set: true, - } -} - -// OptString is optional string. -type OptString struct { - Value string - Set bool -} - -// IsSet returns true if OptString was set. -func (o OptString) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptString) Reset() { - var v string - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptString) SetTo(v string) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptString) Get() (v string, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptString) Or(d string) string { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptTokenUsage returns new OptTokenUsage with value set to v. -func NewOptTokenUsage(v TokenUsage) OptTokenUsage { - return OptTokenUsage{ - Value: v, - Set: true, - } -} - -// OptTokenUsage is optional TokenUsage. -type OptTokenUsage struct { - Value TokenUsage - Set bool -} - -// IsSet returns true if OptTokenUsage was set. -func (o OptTokenUsage) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptTokenUsage) Reset() { - var v TokenUsage - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptTokenUsage) SetTo(v TokenUsage) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptTokenUsage) Get() (v TokenUsage, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptTokenUsage) Or(d TokenUsage) TokenUsage { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// NewOptToolCallsIncludeOptions returns new OptToolCallsIncludeOptions with value set to v. -func NewOptToolCallsIncludeOptions(v ToolCallsIncludeOptions) OptToolCallsIncludeOptions { - return OptToolCallsIncludeOptions{ - Value: v, - Set: true, - } -} - -// OptToolCallsIncludeOptions is optional ToolCallsIncludeOptions. -type OptToolCallsIncludeOptions struct { - Value ToolCallsIncludeOptions - Set bool -} - -// IsSet returns true if OptToolCallsIncludeOptions was set. -func (o OptToolCallsIncludeOptions) IsSet() bool { return o.Set } - -// Reset unsets value. -func (o *OptToolCallsIncludeOptions) Reset() { - var v ToolCallsIncludeOptions - o.Value = v - o.Set = false -} - -// SetTo sets value to v. -func (o *OptToolCallsIncludeOptions) SetTo(v ToolCallsIncludeOptions) { - o.Set = true - o.Value = v -} - -// Get returns value and boolean that denotes whether value was set. -func (o OptToolCallsIncludeOptions) Get() (v ToolCallsIncludeOptions, ok bool) { - if !o.Set { - return v, false - } - return o.Value, true -} - -// Or returns value if set, or given parameter if does not. -func (o OptToolCallsIncludeOptions) Or(d ToolCallsIncludeOptions) ToolCallsIncludeOptions { - if v, ok := o.Get(); ok { - return v - } - return d -} - -// Request model for recall endpoint. -// Ref: #/components/schemas/RecallRequest -type RecallRequest struct { - Budget OptBudget `json:"budget"` - // Options for including additional data (entities are included by default). - Include OptIncludeOptions `json:"include"` - MaxTokens OptInt `json:"max_tokens"` - Query string `json:"query"` - // ISO format date string (e.g., '2023-05-30T23:40:00'). - QueryTimestamp OptString `json:"query_timestamp"` - // Filter memories by tags. If not specified, all memories are returned. - Tags []string `json:"tags"` - // How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, - // excludes untagged), 'all_strict' (AND, excludes untagged). - TagsMatch OptRecallRequestTagsMatch `json:"tags_match"` - Trace OptBool `json:"trace"` - // List of fact types to recall: 'world', 'experience', 'observation'. Defaults to world and - // experience if not specified. - Types []string `json:"types"` -} - -// GetBudget returns the value of Budget. -func (s *RecallRequest) GetBudget() OptBudget { - return s.Budget -} - -// GetInclude returns the value of Include. -func (s *RecallRequest) GetInclude() OptIncludeOptions { - return s.Include -} - -// GetMaxTokens returns the value of MaxTokens. -func (s *RecallRequest) GetMaxTokens() OptInt { - return s.MaxTokens -} - -// GetQuery returns the value of Query. -func (s *RecallRequest) GetQuery() string { - return s.Query -} - -// GetQueryTimestamp returns the value of QueryTimestamp. -func (s *RecallRequest) GetQueryTimestamp() OptString { - return s.QueryTimestamp -} - -// GetTags returns the value of Tags. -func (s *RecallRequest) GetTags() []string { - return s.Tags -} - -// GetTagsMatch returns the value of TagsMatch. -func (s *RecallRequest) GetTagsMatch() OptRecallRequestTagsMatch { - return s.TagsMatch -} - -// GetTrace returns the value of Trace. -func (s *RecallRequest) GetTrace() OptBool { - return s.Trace -} - -// GetTypes returns the value of Types. -func (s *RecallRequest) GetTypes() []string { - return s.Types -} - -// SetBudget sets the value of Budget. -func (s *RecallRequest) SetBudget(val OptBudget) { - s.Budget = val -} - -// SetInclude sets the value of Include. -func (s *RecallRequest) SetInclude(val OptIncludeOptions) { - s.Include = val -} - -// SetMaxTokens sets the value of MaxTokens. -func (s *RecallRequest) SetMaxTokens(val OptInt) { - s.MaxTokens = val -} - -// SetQuery sets the value of Query. -func (s *RecallRequest) SetQuery(val string) { - s.Query = val -} - -// SetQueryTimestamp sets the value of QueryTimestamp. -func (s *RecallRequest) SetQueryTimestamp(val OptString) { - s.QueryTimestamp = val -} - -// SetTags sets the value of Tags. -func (s *RecallRequest) SetTags(val []string) { - s.Tags = val -} - -// SetTagsMatch sets the value of TagsMatch. -func (s *RecallRequest) SetTagsMatch(val OptRecallRequestTagsMatch) { - s.TagsMatch = val -} - -// SetTrace sets the value of Trace. -func (s *RecallRequest) SetTrace(val OptBool) { - s.Trace = val -} - -// SetTypes sets the value of Types. -func (s *RecallRequest) SetTypes(val []string) { - s.Types = val -} - -// How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, -// -// excludes untagged), 'all_strict' (AND, excludes untagged). -type RecallRequestTagsMatch string - -const ( - RecallRequestTagsMatchAny RecallRequestTagsMatch = "any" - RecallRequestTagsMatchAll RecallRequestTagsMatch = "all" - RecallRequestTagsMatchAnyStrict RecallRequestTagsMatch = "any_strict" - RecallRequestTagsMatchAllStrict RecallRequestTagsMatch = "all_strict" -) - -// AllValues returns all RecallRequestTagsMatch values. -func (RecallRequestTagsMatch) AllValues() []RecallRequestTagsMatch { - return []RecallRequestTagsMatch{ - RecallRequestTagsMatchAny, - RecallRequestTagsMatchAll, - RecallRequestTagsMatchAnyStrict, - RecallRequestTagsMatchAllStrict, - } -} - -// MarshalText implements encoding.TextMarshaler. -func (s RecallRequestTagsMatch) MarshalText() ([]byte, error) { - switch s { - case RecallRequestTagsMatchAny: - return []byte(s), nil - case RecallRequestTagsMatchAll: - return []byte(s), nil - case RecallRequestTagsMatchAnyStrict: - return []byte(s), nil - case RecallRequestTagsMatchAllStrict: - return []byte(s), nil - default: - return nil, errors.Errorf("invalid value: %q", s) - } -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (s *RecallRequestTagsMatch) UnmarshalText(data []byte) error { - switch RecallRequestTagsMatch(data) { - case RecallRequestTagsMatchAny: - *s = RecallRequestTagsMatchAny - return nil - case RecallRequestTagsMatchAll: - *s = RecallRequestTagsMatchAll - return nil - case RecallRequestTagsMatchAnyStrict: - *s = RecallRequestTagsMatchAnyStrict - return nil - case RecallRequestTagsMatchAllStrict: - *s = RecallRequestTagsMatchAllStrict - return nil - default: - return errors.Errorf("invalid value: %q", data) - } -} - -// Response model for recall endpoints. -// Ref: #/components/schemas/RecallResponse -type RecallResponse struct { - // Chunks for facts, keyed by chunk_id. - Chunks OptRecallResponseChunks `json:"chunks"` - // Entity states for entities mentioned in results. - Entities OptRecallResponseEntities `json:"entities"` - Results []RecallResult `json:"results"` - Trace OptRecallResponseTrace `json:"trace"` -} - -// GetChunks returns the value of Chunks. -func (s *RecallResponse) GetChunks() OptRecallResponseChunks { - return s.Chunks -} - -// GetEntities returns the value of Entities. -func (s *RecallResponse) GetEntities() OptRecallResponseEntities { - return s.Entities -} - -// GetResults returns the value of Results. -func (s *RecallResponse) GetResults() []RecallResult { - return s.Results -} - -// GetTrace returns the value of Trace. -func (s *RecallResponse) GetTrace() OptRecallResponseTrace { - return s.Trace -} - -// SetChunks sets the value of Chunks. -func (s *RecallResponse) SetChunks(val OptRecallResponseChunks) { - s.Chunks = val -} - -// SetEntities sets the value of Entities. -func (s *RecallResponse) SetEntities(val OptRecallResponseEntities) { - s.Entities = val -} - -// SetResults sets the value of Results. -func (s *RecallResponse) SetResults(val []RecallResult) { - s.Results = val -} - -// SetTrace sets the value of Trace. -func (s *RecallResponse) SetTrace(val OptRecallResponseTrace) { - s.Trace = val -} - -func (*RecallResponse) recallMemoriesRes() {} - -// Chunks for facts, keyed by chunk_id. -type RecallResponseChunks map[string]ChunkData - -func (s *RecallResponseChunks) init() RecallResponseChunks { - m := *s - if m == nil { - m = map[string]ChunkData{} - *s = m - } - return m -} - -// Entity states for entities mentioned in results. -type RecallResponseEntities map[string]EntityStateResponse - -func (s *RecallResponseEntities) init() RecallResponseEntities { - m := *s - if m == nil { - m = map[string]EntityStateResponse{} - *s = m - } - return m -} - -type RecallResponseTrace map[string]jx.Raw - -func (s *RecallResponseTrace) init() RecallResponseTrace { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Single recall result item. -// Ref: #/components/schemas/RecallResult -type RecallResult struct { - ChunkID OptString `json:"chunk_id"` - Context OptString `json:"context"` - DocumentID OptString `json:"document_id"` - Entities []string `json:"entities"` - ID string `json:"id"` - MentionedAt OptString `json:"mentioned_at"` - Metadata OptRecallResultMetadata `json:"metadata"` - OccurredEnd OptString `json:"occurred_end"` - OccurredStart OptString `json:"occurred_start"` - Tags []string `json:"tags"` - Text string `json:"text"` - Type OptString `json:"type"` -} - -// GetChunkID returns the value of ChunkID. -func (s *RecallResult) GetChunkID() OptString { - return s.ChunkID -} - -// GetContext returns the value of Context. -func (s *RecallResult) GetContext() OptString { - return s.Context -} - -// GetDocumentID returns the value of DocumentID. -func (s *RecallResult) GetDocumentID() OptString { - return s.DocumentID -} - -// GetEntities returns the value of Entities. -func (s *RecallResult) GetEntities() []string { - return s.Entities -} - -// GetID returns the value of ID. -func (s *RecallResult) GetID() string { - return s.ID -} - -// GetMentionedAt returns the value of MentionedAt. -func (s *RecallResult) GetMentionedAt() OptString { - return s.MentionedAt -} - -// GetMetadata returns the value of Metadata. -func (s *RecallResult) GetMetadata() OptRecallResultMetadata { - return s.Metadata -} - -// GetOccurredEnd returns the value of OccurredEnd. -func (s *RecallResult) GetOccurredEnd() OptString { - return s.OccurredEnd -} - -// GetOccurredStart returns the value of OccurredStart. -func (s *RecallResult) GetOccurredStart() OptString { - return s.OccurredStart -} - -// GetTags returns the value of Tags. -func (s *RecallResult) GetTags() []string { - return s.Tags -} - -// GetText returns the value of Text. -func (s *RecallResult) GetText() string { - return s.Text -} - -// GetType returns the value of Type. -func (s *RecallResult) GetType() OptString { - return s.Type -} - -// SetChunkID sets the value of ChunkID. -func (s *RecallResult) SetChunkID(val OptString) { - s.ChunkID = val -} - -// SetContext sets the value of Context. -func (s *RecallResult) SetContext(val OptString) { - s.Context = val -} - -// SetDocumentID sets the value of DocumentID. -func (s *RecallResult) SetDocumentID(val OptString) { - s.DocumentID = val -} - -// SetEntities sets the value of Entities. -func (s *RecallResult) SetEntities(val []string) { - s.Entities = val -} - -// SetID sets the value of ID. -func (s *RecallResult) SetID(val string) { - s.ID = val -} - -// SetMentionedAt sets the value of MentionedAt. -func (s *RecallResult) SetMentionedAt(val OptString) { - s.MentionedAt = val -} - -// SetMetadata sets the value of Metadata. -func (s *RecallResult) SetMetadata(val OptRecallResultMetadata) { - s.Metadata = val -} - -// SetOccurredEnd sets the value of OccurredEnd. -func (s *RecallResult) SetOccurredEnd(val OptString) { - s.OccurredEnd = val -} - -// SetOccurredStart sets the value of OccurredStart. -func (s *RecallResult) SetOccurredStart(val OptString) { - s.OccurredStart = val -} - -// SetTags sets the value of Tags. -func (s *RecallResult) SetTags(val []string) { - s.Tags = val -} - -// SetText sets the value of Text. -func (s *RecallResult) SetText(val string) { - s.Text = val -} - -// SetType sets the value of Type. -func (s *RecallResult) SetType(val OptString) { - s.Type = val -} - -type RecallResultMetadata map[string]string - -func (s *RecallResultMetadata) init() RecallResultMetadata { - m := *s - if m == nil { - m = map[string]string{} - *s = m - } - return m -} - -// Evidence the response is based on: memories, mental models, and directives. -// Ref: #/components/schemas/ReflectBasedOn -type ReflectBasedOn struct { - // Directives applied during reflection. - Directives []ReflectDirective `json:"directives"` - // Memory facts used to generate the response. - Memories []ReflectFact `json:"memories"` - // Mental models used during reflection. - MentalModels []ReflectMentalModel `json:"mental_models"` -} - -// GetDirectives returns the value of Directives. -func (s *ReflectBasedOn) GetDirectives() []ReflectDirective { - return s.Directives -} - -// GetMemories returns the value of Memories. -func (s *ReflectBasedOn) GetMemories() []ReflectFact { - return s.Memories -} - -// GetMentalModels returns the value of MentalModels. -func (s *ReflectBasedOn) GetMentalModels() []ReflectMentalModel { - return s.MentalModels -} - -// SetDirectives sets the value of Directives. -func (s *ReflectBasedOn) SetDirectives(val []ReflectDirective) { - s.Directives = val -} - -// SetMemories sets the value of Memories. -func (s *ReflectBasedOn) SetMemories(val []ReflectFact) { - s.Memories = val -} - -// SetMentalModels sets the value of MentalModels. -func (s *ReflectBasedOn) SetMentalModels(val []ReflectMentalModel) { - s.MentalModels = val -} - -// A directive applied during reflect. -// Ref: #/components/schemas/ReflectDirective -type ReflectDirective struct { - // Directive content. - Content string `json:"content"` - // Directive ID. - ID string `json:"id"` - // Directive name. - Name string `json:"name"` -} - -// GetContent returns the value of Content. -func (s *ReflectDirective) GetContent() string { - return s.Content -} - -// GetID returns the value of ID. -func (s *ReflectDirective) GetID() string { - return s.ID -} - -// GetName returns the value of Name. -func (s *ReflectDirective) GetName() string { - return s.Name -} - -// SetContent sets the value of Content. -func (s *ReflectDirective) SetContent(val string) { - s.Content = val -} - -// SetID sets the value of ID. -func (s *ReflectDirective) SetID(val string) { - s.ID = val -} - -// SetName sets the value of Name. -func (s *ReflectDirective) SetName(val string) { - s.Name = val -} - -// A fact used in think response. -// Ref: #/components/schemas/ReflectFact -type ReflectFact struct { - Context OptString `json:"context"` - ID OptString `json:"id"` - OccurredEnd OptString `json:"occurred_end"` - OccurredStart OptString `json:"occurred_start"` - // Fact text. When type='observation', this contains markdown-formatted consolidated knowledge. - Text string `json:"text"` - Type OptString `json:"type"` -} - -// GetContext returns the value of Context. -func (s *ReflectFact) GetContext() OptString { - return s.Context -} - -// GetID returns the value of ID. -func (s *ReflectFact) GetID() OptString { - return s.ID -} - -// GetOccurredEnd returns the value of OccurredEnd. -func (s *ReflectFact) GetOccurredEnd() OptString { - return s.OccurredEnd -} - -// GetOccurredStart returns the value of OccurredStart. -func (s *ReflectFact) GetOccurredStart() OptString { - return s.OccurredStart -} - -// GetText returns the value of Text. -func (s *ReflectFact) GetText() string { - return s.Text -} - -// GetType returns the value of Type. -func (s *ReflectFact) GetType() OptString { - return s.Type -} - -// SetContext sets the value of Context. -func (s *ReflectFact) SetContext(val OptString) { - s.Context = val -} - -// SetID sets the value of ID. -func (s *ReflectFact) SetID(val OptString) { - s.ID = val -} - -// SetOccurredEnd sets the value of OccurredEnd. -func (s *ReflectFact) SetOccurredEnd(val OptString) { - s.OccurredEnd = val -} - -// SetOccurredStart sets the value of OccurredStart. -func (s *ReflectFact) SetOccurredStart(val OptString) { - s.OccurredStart = val -} - -// SetText sets the value of Text. -func (s *ReflectFact) SetText(val string) { - s.Text = val -} - -// SetType sets the value of Type. -func (s *ReflectFact) SetType(val OptString) { - s.Type = val -} - -// Options for including additional data in reflect results. -// Ref: #/components/schemas/ReflectIncludeOptions -type ReflectIncludeOptions struct { - // Include facts that the answer is based on. Set to {} to enable, null to disable (default: - // disabled). - Facts *FactsIncludeOptions `json:"facts"` - // Include tool calls trace. Set to {} for full trace (input+output), {output: false} for inputs only. - ToolCalls OptToolCallsIncludeOptions `json:"tool_calls"` -} - -// GetFacts returns the value of Facts. -func (s *ReflectIncludeOptions) GetFacts() *FactsIncludeOptions { - return s.Facts -} - -// GetToolCalls returns the value of ToolCalls. -func (s *ReflectIncludeOptions) GetToolCalls() OptToolCallsIncludeOptions { - return s.ToolCalls -} - -// SetFacts sets the value of Facts. -func (s *ReflectIncludeOptions) SetFacts(val *FactsIncludeOptions) { - s.Facts = val -} - -// SetToolCalls sets the value of ToolCalls. -func (s *ReflectIncludeOptions) SetToolCalls(val OptToolCallsIncludeOptions) { - s.ToolCalls = val -} - -// An LLM call made during reflect agent execution. -// Ref: #/components/schemas/ReflectLLMCall -type ReflectLLMCall struct { - // Execution time in milliseconds. - DurationMs int `json:"duration_ms"` - // Call scope: agent_1, agent_2, final, etc. - Scope string `json:"scope"` -} - -// GetDurationMs returns the value of DurationMs. -func (s *ReflectLLMCall) GetDurationMs() int { - return s.DurationMs -} - -// GetScope returns the value of Scope. -func (s *ReflectLLMCall) GetScope() string { - return s.Scope -} - -// SetDurationMs sets the value of DurationMs. -func (s *ReflectLLMCall) SetDurationMs(val int) { - s.DurationMs = val -} - -// SetScope sets the value of Scope. -func (s *ReflectLLMCall) SetScope(val string) { - s.Scope = val -} - -// A mental model used during reflect. -// Ref: #/components/schemas/ReflectMentalModel -type ReflectMentalModel struct { - // Additional context. - Context OptString `json:"context"` - // Mental model ID. - ID string `json:"id"` - // Mental model content. - Text string `json:"text"` -} - -// GetContext returns the value of Context. -func (s *ReflectMentalModel) GetContext() OptString { - return s.Context -} - -// GetID returns the value of ID. -func (s *ReflectMentalModel) GetID() string { - return s.ID -} - -// GetText returns the value of Text. -func (s *ReflectMentalModel) GetText() string { - return s.Text -} - -// SetContext sets the value of Context. -func (s *ReflectMentalModel) SetContext(val OptString) { - s.Context = val -} - -// SetID sets the value of ID. -func (s *ReflectMentalModel) SetID(val string) { - s.ID = val -} - -// SetText sets the value of Text. -func (s *ReflectMentalModel) SetText(val string) { - s.Text = val -} - -// Request model for reflect endpoint. -// Ref: #/components/schemas/ReflectRequest -type ReflectRequest struct { - Budget OptBudget `json:"budget"` - // DEPRECATED: Additional context is now concatenated with the query. Pass context directly in the - // query field instead. If provided, it will be appended to the query for backward compatibility. - // - // Deprecated: schema marks this property as deprecated. - Context OptString `json:"context"` - // Options for including additional data (disabled by default). - Include OptReflectIncludeOptions `json:"include"` - // Maximum tokens for the response. - MaxTokens OptInt `json:"max_tokens"` - Query string `json:"query"` - // Optional JSON Schema for structured output. When provided, the response will include a - // 'structured_output' field with the LLM response parsed according to this schema. - ResponseSchema OptReflectRequestResponseSchema `json:"response_schema"` - // Filter memories by tags during reflection. If not specified, all memories are considered. - Tags []string `json:"tags"` - // How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, - // excludes untagged), 'all_strict' (AND, excludes untagged). - TagsMatch OptReflectRequestTagsMatch `json:"tags_match"` -} - -// GetBudget returns the value of Budget. -func (s *ReflectRequest) GetBudget() OptBudget { - return s.Budget -} - -// GetContext returns the value of Context. -func (s *ReflectRequest) GetContext() OptString { - return s.Context -} - -// GetInclude returns the value of Include. -func (s *ReflectRequest) GetInclude() OptReflectIncludeOptions { - return s.Include -} - -// GetMaxTokens returns the value of MaxTokens. -func (s *ReflectRequest) GetMaxTokens() OptInt { - return s.MaxTokens -} - -// GetQuery returns the value of Query. -func (s *ReflectRequest) GetQuery() string { - return s.Query -} - -// GetResponseSchema returns the value of ResponseSchema. -func (s *ReflectRequest) GetResponseSchema() OptReflectRequestResponseSchema { - return s.ResponseSchema -} - -// GetTags returns the value of Tags. -func (s *ReflectRequest) GetTags() []string { - return s.Tags -} - -// GetTagsMatch returns the value of TagsMatch. -func (s *ReflectRequest) GetTagsMatch() OptReflectRequestTagsMatch { - return s.TagsMatch -} - -// SetBudget sets the value of Budget. -func (s *ReflectRequest) SetBudget(val OptBudget) { - s.Budget = val -} - -// SetContext sets the value of Context. -func (s *ReflectRequest) SetContext(val OptString) { - s.Context = val -} - -// SetInclude sets the value of Include. -func (s *ReflectRequest) SetInclude(val OptReflectIncludeOptions) { - s.Include = val -} - -// SetMaxTokens sets the value of MaxTokens. -func (s *ReflectRequest) SetMaxTokens(val OptInt) { - s.MaxTokens = val -} - -// SetQuery sets the value of Query. -func (s *ReflectRequest) SetQuery(val string) { - s.Query = val -} - -// SetResponseSchema sets the value of ResponseSchema. -func (s *ReflectRequest) SetResponseSchema(val OptReflectRequestResponseSchema) { - s.ResponseSchema = val -} - -// SetTags sets the value of Tags. -func (s *ReflectRequest) SetTags(val []string) { - s.Tags = val -} - -// SetTagsMatch sets the value of TagsMatch. -func (s *ReflectRequest) SetTagsMatch(val OptReflectRequestTagsMatch) { - s.TagsMatch = val -} - -// Optional JSON Schema for structured output. When provided, the response will include a -// 'structured_output' field with the LLM response parsed according to this schema. -type ReflectRequestResponseSchema map[string]jx.Raw - -func (s *ReflectRequestResponseSchema) init() ReflectRequestResponseSchema { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// How to match tags: 'any' (OR, includes untagged), 'all' (AND, includes untagged), 'any_strict' (OR, -// -// excludes untagged), 'all_strict' (AND, excludes untagged). -type ReflectRequestTagsMatch string - -const ( - ReflectRequestTagsMatchAny ReflectRequestTagsMatch = "any" - ReflectRequestTagsMatchAll ReflectRequestTagsMatch = "all" - ReflectRequestTagsMatchAnyStrict ReflectRequestTagsMatch = "any_strict" - ReflectRequestTagsMatchAllStrict ReflectRequestTagsMatch = "all_strict" -) - -// AllValues returns all ReflectRequestTagsMatch values. -func (ReflectRequestTagsMatch) AllValues() []ReflectRequestTagsMatch { - return []ReflectRequestTagsMatch{ - ReflectRequestTagsMatchAny, - ReflectRequestTagsMatchAll, - ReflectRequestTagsMatchAnyStrict, - ReflectRequestTagsMatchAllStrict, - } -} - -// MarshalText implements encoding.TextMarshaler. -func (s ReflectRequestTagsMatch) MarshalText() ([]byte, error) { - switch s { - case ReflectRequestTagsMatchAny: - return []byte(s), nil - case ReflectRequestTagsMatchAll: - return []byte(s), nil - case ReflectRequestTagsMatchAnyStrict: - return []byte(s), nil - case ReflectRequestTagsMatchAllStrict: - return []byte(s), nil - default: - return nil, errors.Errorf("invalid value: %q", s) - } -} - -// UnmarshalText implements encoding.TextUnmarshaler. -func (s *ReflectRequestTagsMatch) UnmarshalText(data []byte) error { - switch ReflectRequestTagsMatch(data) { - case ReflectRequestTagsMatchAny: - *s = ReflectRequestTagsMatchAny - return nil - case ReflectRequestTagsMatchAll: - *s = ReflectRequestTagsMatchAll - return nil - case ReflectRequestTagsMatchAnyStrict: - *s = ReflectRequestTagsMatchAnyStrict - return nil - case ReflectRequestTagsMatchAllStrict: - *s = ReflectRequestTagsMatchAllStrict - return nil - default: - return errors.Errorf("invalid value: %q", data) - } -} - -// Response model for think endpoint. -// Ref: #/components/schemas/ReflectResponse -type ReflectResponse struct { - // Evidence used to generate the response. Only present when include.facts is set. - BasedOn OptReflectBasedOn `json:"based_on"` - // Structured output parsed according to the request's response_schema. Only present when - // response_schema was provided in the request. - StructuredOutput OptReflectResponseStructuredOutput `json:"structured_output"` - // The reflect response as well-formatted markdown (headers, lists, bold/italic, code blocks, etc.). - Text string `json:"text"` - // Execution trace of tool and LLM calls. Only present when include.tool_calls is set. - Trace OptReflectTrace `json:"trace"` - // Token usage metrics for LLM calls during reflection. - Usage OptTokenUsage `json:"usage"` -} - -// GetBasedOn returns the value of BasedOn. -func (s *ReflectResponse) GetBasedOn() OptReflectBasedOn { - return s.BasedOn -} - -// GetStructuredOutput returns the value of StructuredOutput. -func (s *ReflectResponse) GetStructuredOutput() OptReflectResponseStructuredOutput { - return s.StructuredOutput -} - -// GetText returns the value of Text. -func (s *ReflectResponse) GetText() string { - return s.Text -} - -// GetTrace returns the value of Trace. -func (s *ReflectResponse) GetTrace() OptReflectTrace { - return s.Trace -} - -// GetUsage returns the value of Usage. -func (s *ReflectResponse) GetUsage() OptTokenUsage { - return s.Usage -} - -// SetBasedOn sets the value of BasedOn. -func (s *ReflectResponse) SetBasedOn(val OptReflectBasedOn) { - s.BasedOn = val -} - -// SetStructuredOutput sets the value of StructuredOutput. -func (s *ReflectResponse) SetStructuredOutput(val OptReflectResponseStructuredOutput) { - s.StructuredOutput = val -} - -// SetText sets the value of Text. -func (s *ReflectResponse) SetText(val string) { - s.Text = val -} - -// SetTrace sets the value of Trace. -func (s *ReflectResponse) SetTrace(val OptReflectTrace) { - s.Trace = val -} - -// SetUsage sets the value of Usage. -func (s *ReflectResponse) SetUsage(val OptTokenUsage) { - s.Usage = val -} - -func (*ReflectResponse) reflectRes() {} - -// Structured output parsed according to the request's response_schema. Only present when -// response_schema was provided in the request. -type ReflectResponseStructuredOutput map[string]jx.Raw - -func (s *ReflectResponseStructuredOutput) init() ReflectResponseStructuredOutput { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// A tool call made during reflect agent execution. -// Ref: #/components/schemas/ReflectToolCall -type ReflectToolCall struct { - // Execution time in milliseconds. - DurationMs int `json:"duration_ms"` - // Tool input parameters. - Input ReflectToolCallInput `json:"input"` - // Iteration number (1-based) when this tool was called. - Iteration OptInt `json:"iteration"` - // Tool output (only included when include.tool_calls.output is true). - Output OptReflectToolCallOutput `json:"output"` - // Tool name: lookup, recall, learn, expand. - Tool string `json:"tool"` -} - -// GetDurationMs returns the value of DurationMs. -func (s *ReflectToolCall) GetDurationMs() int { - return s.DurationMs -} - -// GetInput returns the value of Input. -func (s *ReflectToolCall) GetInput() ReflectToolCallInput { - return s.Input -} - -// GetIteration returns the value of Iteration. -func (s *ReflectToolCall) GetIteration() OptInt { - return s.Iteration -} - -// GetOutput returns the value of Output. -func (s *ReflectToolCall) GetOutput() OptReflectToolCallOutput { - return s.Output -} - -// GetTool returns the value of Tool. -func (s *ReflectToolCall) GetTool() string { - return s.Tool -} - -// SetDurationMs sets the value of DurationMs. -func (s *ReflectToolCall) SetDurationMs(val int) { - s.DurationMs = val -} - -// SetInput sets the value of Input. -func (s *ReflectToolCall) SetInput(val ReflectToolCallInput) { - s.Input = val -} - -// SetIteration sets the value of Iteration. -func (s *ReflectToolCall) SetIteration(val OptInt) { - s.Iteration = val -} - -// SetOutput sets the value of Output. -func (s *ReflectToolCall) SetOutput(val OptReflectToolCallOutput) { - s.Output = val -} - -// SetTool sets the value of Tool. -func (s *ReflectToolCall) SetTool(val string) { - s.Tool = val -} - -// Tool input parameters. -type ReflectToolCallInput map[string]jx.Raw - -func (s *ReflectToolCallInput) init() ReflectToolCallInput { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Tool output (only included when include.tool_calls.output is true). -type ReflectToolCallOutput map[string]jx.Raw - -func (s *ReflectToolCallOutput) init() ReflectToolCallOutput { - m := *s - if m == nil { - m = map[string]jx.Raw{} - *s = m - } - return m -} - -// Execution trace of LLM and tool calls during reflection. -// Ref: #/components/schemas/ReflectTrace -type ReflectTrace struct { - // LLM calls made during reflection. - LlmCalls []ReflectLLMCall `json:"llm_calls"` - // Tool calls made during reflection. - ToolCalls []ReflectToolCall `json:"tool_calls"` -} - -// GetLlmCalls returns the value of LlmCalls. -func (s *ReflectTrace) GetLlmCalls() []ReflectLLMCall { - return s.LlmCalls -} - -// GetToolCalls returns the value of ToolCalls. -func (s *ReflectTrace) GetToolCalls() []ReflectToolCall { - return s.ToolCalls -} - -// SetLlmCalls sets the value of LlmCalls. -func (s *ReflectTrace) SetLlmCalls(val []ReflectLLMCall) { - s.LlmCalls = val -} - -// SetToolCalls sets the value of ToolCalls. -func (s *ReflectTrace) SetToolCalls(val []ReflectToolCall) { - s.ToolCalls = val -} - -// Request model for retain endpoint. -// Ref: #/components/schemas/RetainRequest -type RetainRequest struct { - // If true, process asynchronously in background. If false, wait for completion (default: false). - Async OptBool `json:"async"` - // Tags applied to all items in this request. These are merged with any item-level tags. - DocumentTags []string `json:"document_tags"` - Items []MemoryItem `json:"items"` -} - -// GetAsync returns the value of Async. -func (s *RetainRequest) GetAsync() OptBool { - return s.Async -} - -// GetDocumentTags returns the value of DocumentTags. -func (s *RetainRequest) GetDocumentTags() []string { - return s.DocumentTags -} - -// GetItems returns the value of Items. -func (s *RetainRequest) GetItems() []MemoryItem { - return s.Items -} - -// SetAsync sets the value of Async. -func (s *RetainRequest) SetAsync(val OptBool) { - s.Async = val -} - -// SetDocumentTags sets the value of DocumentTags. -func (s *RetainRequest) SetDocumentTags(val []string) { - s.DocumentTags = val -} - -// SetItems sets the value of Items. -func (s *RetainRequest) SetItems(val []MemoryItem) { - s.Items = val -} - -// Response model for retain endpoint. -// Ref: #/components/schemas/RetainResponse -type RetainResponse struct { - // Whether the operation was processed asynchronously. - Async bool `json:"async"` - BankID string `json:"bank_id"` - ItemsCount int `json:"items_count"` - // Operation ID for tracking async operations. Use GET /v1/default/banks/{bank_id}/operations to list - // operations and find this ID. Only present when async=true. - OperationID OptString `json:"operation_id"` - Success bool `json:"success"` - // Token usage metrics for LLM calls during fact extraction (only present for synchronous operations). - Usage OptTokenUsage `json:"usage"` -} - -// GetAsync returns the value of Async. -func (s *RetainResponse) GetAsync() bool { - return s.Async -} - -// GetBankID returns the value of BankID. -func (s *RetainResponse) GetBankID() string { - return s.BankID -} - -// GetItemsCount returns the value of ItemsCount. -func (s *RetainResponse) GetItemsCount() int { - return s.ItemsCount -} - -// GetOperationID returns the value of OperationID. -func (s *RetainResponse) GetOperationID() OptString { - return s.OperationID -} - -// GetSuccess returns the value of Success. -func (s *RetainResponse) GetSuccess() bool { - return s.Success -} - -// GetUsage returns the value of Usage. -func (s *RetainResponse) GetUsage() OptTokenUsage { - return s.Usage -} - -// SetAsync sets the value of Async. -func (s *RetainResponse) SetAsync(val bool) { - s.Async = val -} - -// SetBankID sets the value of BankID. -func (s *RetainResponse) SetBankID(val string) { - s.BankID = val -} - -// SetItemsCount sets the value of ItemsCount. -func (s *RetainResponse) SetItemsCount(val int) { - s.ItemsCount = val -} - -// SetOperationID sets the value of OperationID. -func (s *RetainResponse) SetOperationID(val OptString) { - s.OperationID = val -} - -// SetSuccess sets the value of Success. -func (s *RetainResponse) SetSuccess(val bool) { - s.Success = val -} - -// SetUsage sets the value of Usage. -func (s *RetainResponse) SetUsage(val OptTokenUsage) { - s.Usage = val -} - -func (*RetainResponse) retainMemoriesRes() {} - -// Single tag with usage count. -// Ref: #/components/schemas/TagItem -type TagItem struct { - // Number of memories with this tag. - Count int `json:"count"` - // The tag value. - Tag string `json:"tag"` -} - -// GetCount returns the value of Count. -func (s *TagItem) GetCount() int { - return s.Count -} - -// GetTag returns the value of Tag. -func (s *TagItem) GetTag() string { - return s.Tag -} - -// SetCount sets the value of Count. -func (s *TagItem) SetCount(val int) { - s.Count = val -} - -// SetTag sets the value of Tag. -func (s *TagItem) SetTag(val string) { - s.Tag = val -} - -// Token usage metrics for LLM calls. -// Tracks input/output tokens for a single request to enable -// per-request cost tracking and monitoring. -// Ref: #/components/schemas/TokenUsage -type TokenUsage struct { - // Number of input/prompt tokens consumed. - InputTokens OptInt `json:"input_tokens"` - // Number of output/completion tokens generated. - OutputTokens OptInt `json:"output_tokens"` - // Total tokens (input + output). - TotalTokens OptInt `json:"total_tokens"` -} - -// GetInputTokens returns the value of InputTokens. -func (s *TokenUsage) GetInputTokens() OptInt { - return s.InputTokens -} - -// GetOutputTokens returns the value of OutputTokens. -func (s *TokenUsage) GetOutputTokens() OptInt { - return s.OutputTokens -} - -// GetTotalTokens returns the value of TotalTokens. -func (s *TokenUsage) GetTotalTokens() OptInt { - return s.TotalTokens -} - -// SetInputTokens sets the value of InputTokens. -func (s *TokenUsage) SetInputTokens(val OptInt) { - s.InputTokens = val -} - -// SetOutputTokens sets the value of OutputTokens. -func (s *TokenUsage) SetOutputTokens(val OptInt) { - s.OutputTokens = val -} - -// SetTotalTokens sets the value of TotalTokens. -func (s *TokenUsage) SetTotalTokens(val OptInt) { - s.TotalTokens = val -} - -// Options for including tool calls in reflect results. -// Ref: #/components/schemas/ToolCallsIncludeOptions -type ToolCallsIncludeOptions struct { - // Include tool outputs in the trace. Set to false to only include inputs (smaller payload). - Output OptBool `json:"output"` -} - -// GetOutput returns the value of Output. -func (s *ToolCallsIncludeOptions) GetOutput() OptBool { - return s.Output -} - -// SetOutput sets the value of Output. -func (s *ToolCallsIncludeOptions) SetOutput(val OptBool) { - s.Output = val -} - -// Request model for updating a directive. -// Ref: #/components/schemas/UpdateDirectiveRequest -type UpdateDirectiveRequest struct { - // New content. - Content OptString `json:"content"` - // New active status. - IsActive OptBool `json:"is_active"` - // New name. - Name OptString `json:"name"` - // New priority. - Priority OptInt `json:"priority"` - // New tags. - Tags []string `json:"tags"` -} - -// GetContent returns the value of Content. -func (s *UpdateDirectiveRequest) GetContent() OptString { - return s.Content -} - -// GetIsActive returns the value of IsActive. -func (s *UpdateDirectiveRequest) GetIsActive() OptBool { - return s.IsActive -} - -// GetName returns the value of Name. -func (s *UpdateDirectiveRequest) GetName() OptString { - return s.Name -} - -// GetPriority returns the value of Priority. -func (s *UpdateDirectiveRequest) GetPriority() OptInt { - return s.Priority -} - -// GetTags returns the value of Tags. -func (s *UpdateDirectiveRequest) GetTags() []string { - return s.Tags -} - -// SetContent sets the value of Content. -func (s *UpdateDirectiveRequest) SetContent(val OptString) { - s.Content = val -} - -// SetIsActive sets the value of IsActive. -func (s *UpdateDirectiveRequest) SetIsActive(val OptBool) { - s.IsActive = val -} - -// SetName sets the value of Name. -func (s *UpdateDirectiveRequest) SetName(val OptString) { - s.Name = val -} - -// SetPriority sets the value of Priority. -func (s *UpdateDirectiveRequest) SetPriority(val OptInt) { - s.Priority = val -} - -// SetTags sets the value of Tags. -func (s *UpdateDirectiveRequest) SetTags(val []string) { - s.Tags = val -} - -// Request model for updating disposition traits. -// Ref: #/components/schemas/UpdateDispositionRequest -type UpdateDispositionRequest struct { - Disposition DispositionTraits `json:"disposition"` -} - -// GetDisposition returns the value of Disposition. -func (s *UpdateDispositionRequest) GetDisposition() DispositionTraits { - return s.Disposition -} - -// SetDisposition sets the value of Disposition. -func (s *UpdateDispositionRequest) SetDisposition(val DispositionTraits) { - s.Disposition = val -} - -// Request model for updating a mental model. -// Ref: #/components/schemas/UpdateMentalModelRequest -type UpdateMentalModelRequest struct { - // Maximum tokens for generated content. - MaxTokens OptInt `json:"max_tokens"` - // New name for the mental model. - Name OptString `json:"name"` - // New source query for the mental model. - SourceQuery OptString `json:"source_query"` - // Tags for scoped visibility. - Tags []string `json:"tags"` - // Trigger settings. - Trigger OptMentalModelTrigger `json:"trigger"` -} - -// GetMaxTokens returns the value of MaxTokens. -func (s *UpdateMentalModelRequest) GetMaxTokens() OptInt { - return s.MaxTokens -} - -// GetName returns the value of Name. -func (s *UpdateMentalModelRequest) GetName() OptString { - return s.Name -} - -// GetSourceQuery returns the value of SourceQuery. -func (s *UpdateMentalModelRequest) GetSourceQuery() OptString { - return s.SourceQuery -} - -// GetTags returns the value of Tags. -func (s *UpdateMentalModelRequest) GetTags() []string { - return s.Tags -} - -// GetTrigger returns the value of Trigger. -func (s *UpdateMentalModelRequest) GetTrigger() OptMentalModelTrigger { - return s.Trigger -} - -// SetMaxTokens sets the value of MaxTokens. -func (s *UpdateMentalModelRequest) SetMaxTokens(val OptInt) { - s.MaxTokens = val -} - -// SetName sets the value of Name. -func (s *UpdateMentalModelRequest) SetName(val OptString) { - s.Name = val -} - -// SetSourceQuery sets the value of SourceQuery. -func (s *UpdateMentalModelRequest) SetSourceQuery(val OptString) { - s.SourceQuery = val -} - -// SetTags sets the value of Tags. -func (s *UpdateMentalModelRequest) SetTags(val []string) { - s.Tags = val -} - -// SetTrigger sets the value of Trigger. -func (s *UpdateMentalModelRequest) SetTrigger(val OptMentalModelTrigger) { - s.Trigger = val -} - -// Ref: #/components/schemas/ValidationError -type ValidationError struct { - Loc []int `json:"loc"` - Msg string `json:"msg"` - Type string `json:"type"` -} - -// GetLoc returns the value of Loc. -func (s *ValidationError) GetLoc() []int { - return s.Loc -} - -// GetMsg returns the value of Msg. -func (s *ValidationError) GetMsg() string { - return s.Msg -} - -// GetType returns the value of Type. -func (s *ValidationError) GetType() string { - return s.Type -} - -// SetLoc sets the value of Loc. -func (s *ValidationError) SetLoc(val []int) { - s.Loc = val -} - -// SetMsg sets the value of Msg. -func (s *ValidationError) SetMsg(val string) { - s.Msg = val -} - -// SetType sets the value of Type. -func (s *ValidationError) SetType(val string) { - s.Type = val -} - -// Response model for the version/info endpoint. -// Ref: #/components/schemas/VersionResponse -type VersionResponse struct { - // API version string. - APIVersion string `json:"api_version"` - // Enabled feature flags. - Features FeaturesInfo `json:"features"` -} - -// GetAPIVersion returns the value of APIVersion. -func (s *VersionResponse) GetAPIVersion() string { - return s.APIVersion -} - -// GetFeatures returns the value of Features. -func (s *VersionResponse) GetFeatures() FeaturesInfo { - return s.Features -} - -// SetAPIVersion sets the value of APIVersion. -func (s *VersionResponse) SetAPIVersion(val string) { - s.APIVersion = val -} - -// SetFeatures sets the value of Features. -func (s *VersionResponse) SetFeatures(val FeaturesInfo) { - s.Features = val -} diff --git a/hindsight-clients/go/internal/ogenapi/oas_validators_gen.go b/hindsight-clients/go/internal/ogenapi/oas_validators_gen.go deleted file mode 100644 index de367519..00000000 --- a/hindsight-clients/go/internal/ogenapi/oas_validators_gen.go +++ /dev/null @@ -1,935 +0,0 @@ -// Code generated by ogen, DO NOT EDIT. - -package ogenapi - -import ( - "fmt" - - "github.com/go-faster/errors" - "github.com/ogen-go/ogen/validate" -) - -func (s *BackgroundResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.Disposition.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "disposition", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *BankListItem) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if err := s.Disposition.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "disposition", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *BankListResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Banks == nil { - return errors.New("nil is invalid value") - } - var failures []validate.FieldError - for i, elem := range s.Banks { - if err := func() error { - if err := elem.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: fmt.Sprintf("[%d]", i), - Error: err, - }) - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "banks", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *BankProfileResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if err := s.Disposition.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "disposition", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s Budget) Validate() error { - switch s { - case "low": - return nil - case "mid": - return nil - case "high": - return nil - default: - return errors.Errorf("invalid value: %v", s) - } -} - -func (s *CreateBankRequest) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.Disposition.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "disposition", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *CreateMentalModelRequest) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.MaxTokens.Get(); ok { - if err := func() error { - if err := (validate.Int{ - MinSet: true, - Min: 256, - MaxSet: true, - Max: 8192, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - Pattern: nil, - }).Validate(int64(value)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "max_tokens", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *DirectiveListResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Items == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "items", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *DispositionTraits) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if err := (validate.Int{ - MinSet: true, - Min: 1, - MaxSet: true, - Max: 5, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - Pattern: nil, - }).Validate(int64(s.Empathy)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "empathy", - Error: err, - }) - } - if err := func() error { - if err := (validate.Int{ - MinSet: true, - Min: 1, - MaxSet: true, - Max: 5, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - Pattern: nil, - }).Validate(int64(s.Literalism)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "literalism", - Error: err, - }) - } - if err := func() error { - if err := (validate.Int{ - MinSet: true, - Min: 1, - MaxSet: true, - Max: 5, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - Pattern: nil, - }).Validate(int64(s.Skepticism)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "skepticism", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *EntityDetailResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Observations == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "observations", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *EntityListResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Items == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "items", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *EntityStateResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Observations == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "observations", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *GraphDataResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Edges == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "edges", - Error: err, - }) - } - if err := func() error { - if s.Nodes == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "nodes", - Error: err, - }) - } - if err := func() error { - if s.TableRows == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "table_rows", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *HTTPValidationError) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - var failures []validate.FieldError - for i, elem := range s.Detail { - if err := func() error { - if err := elem.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: fmt.Sprintf("[%d]", i), - Error: err, - }) - } - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "detail", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s ListDirectivesTagsMatch) Validate() error { - switch s { - case "any": - return nil - case "all": - return nil - case "exact": - return nil - default: - return errors.Errorf("invalid value: %v", s) - } -} - -func (s *ListDocumentsResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Items == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "items", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *ListMemoryUnitsResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Items == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "items", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s ListMentalModelsTagsMatch) Validate() error { - switch s { - case "any": - return nil - case "all": - return nil - case "exact": - return nil - default: - return errors.Errorf("invalid value: %v", s) - } -} - -func (s *ListTagsResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Items == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "items", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *MentalModelListResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Items == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "items", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *OperationStatusResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if err := s.Status.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "status", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s OperationStatusResponseStatus) Validate() error { - switch s { - case "pending": - return nil - case "completed": - return nil - case "failed": - return nil - case "not_found": - return nil - default: - return errors.Errorf("invalid value: %v", s) - } -} - -func (s *OperationsListResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Operations == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "operations", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *RecallRequest) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.Budget.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "budget", - Error: err, - }) - } - if err := func() error { - if value, ok := s.TagsMatch.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "tags_match", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s RecallRequestTagsMatch) Validate() error { - switch s { - case "any": - return nil - case "all": - return nil - case "any_strict": - return nil - case "all_strict": - return nil - default: - return errors.Errorf("invalid value: %v", s) - } -} - -func (s *RecallResponse) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.Entities.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "entities", - Error: err, - }) - } - if err := func() error { - if s.Results == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "results", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s RecallResponseEntities) Validate() error { - var failures []validate.FieldError - for key, elem := range s { - if err := func() error { - if err := elem.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: key, - Error: err, - }) - } - } - - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *ReflectRequest) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.Budget.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "budget", - Error: err, - }) - } - if err := func() error { - if value, ok := s.TagsMatch.Get(); ok { - if err := func() error { - if err := value.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "tags_match", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s ReflectRequestTagsMatch) Validate() error { - switch s { - case "any": - return nil - case "all": - return nil - case "any_strict": - return nil - case "all_strict": - return nil - default: - return errors.Errorf("invalid value: %v", s) - } -} - -func (s *RetainRequest) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Items == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "items", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *UpdateDispositionRequest) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if err := s.Disposition.Validate(); err != nil { - return err - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "disposition", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *UpdateMentalModelRequest) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if value, ok := s.MaxTokens.Get(); ok { - if err := func() error { - if err := (validate.Int{ - MinSet: true, - Min: 256, - MaxSet: true, - Max: 8192, - MinExclusive: false, - MaxExclusive: false, - MultipleOfSet: false, - MultipleOf: 0, - Pattern: nil, - }).Validate(int64(value)); err != nil { - return errors.Wrap(err, "int") - } - return nil - }(); err != nil { - return err - } - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "max_tokens", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} - -func (s *ValidationError) Validate() error { - if s == nil { - return validate.ErrNilPointer - } - - var failures []validate.FieldError - if err := func() error { - if s.Loc == nil { - return errors.New("nil is invalid value") - } - return nil - }(); err != nil { - failures = append(failures, validate.FieldError{ - Name: "loc", - Error: err, - }) - } - if len(failures) > 0 { - return &validate.Error{Fields: failures} - } - return nil -} diff --git a/hindsight-clients/go/model_add_background_request.go b/hindsight-clients/go/model_add_background_request.go new file mode 100644 index 00000000..571a10f1 --- /dev/null +++ b/hindsight-clients/go/model_add_background_request.go @@ -0,0 +1,200 @@ +/* +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 AddBackgroundRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AddBackgroundRequest{} + +// AddBackgroundRequest Request model for adding/merging background information. Deprecated: use SetMissionRequest instead. +type AddBackgroundRequest struct { + // New background information to add or merge + Content string `json:"content"` + // Deprecated - disposition is no longer auto-inferred from mission + UpdateDisposition *bool `json:"update_disposition,omitempty"` +} + +type _AddBackgroundRequest AddBackgroundRequest + +// NewAddBackgroundRequest instantiates a new AddBackgroundRequest 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 NewAddBackgroundRequest(content string) *AddBackgroundRequest { + this := AddBackgroundRequest{} + this.Content = content + var updateDisposition bool = true + this.UpdateDisposition = &updateDisposition + return &this +} + +// NewAddBackgroundRequestWithDefaults instantiates a new AddBackgroundRequest 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 NewAddBackgroundRequestWithDefaults() *AddBackgroundRequest { + this := AddBackgroundRequest{} + var updateDisposition bool = true + this.UpdateDisposition = &updateDisposition + return &this +} + +// GetContent returns the Content field value +func (o *AddBackgroundRequest) GetContent() string { + if o == nil { + var ret string + return ret + } + + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *AddBackgroundRequest) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value +func (o *AddBackgroundRequest) SetContent(v string) { + o.Content = v +} + +// GetUpdateDisposition returns the UpdateDisposition field value if set, zero value otherwise. +func (o *AddBackgroundRequest) GetUpdateDisposition() bool { + if o == nil || IsNil(o.UpdateDisposition) { + var ret bool + return ret + } + return *o.UpdateDisposition +} + +// GetUpdateDispositionOk returns a tuple with the UpdateDisposition field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AddBackgroundRequest) GetUpdateDispositionOk() (*bool, bool) { + if o == nil || IsNil(o.UpdateDisposition) { + return nil, false + } + return o.UpdateDisposition, true +} + +// HasUpdateDisposition returns a boolean if a field has been set. +func (o *AddBackgroundRequest) HasUpdateDisposition() bool { + if o != nil && !IsNil(o.UpdateDisposition) { + return true + } + + return false +} + +// SetUpdateDisposition gets a reference to the given bool and assigns it to the UpdateDisposition field. +func (o *AddBackgroundRequest) SetUpdateDisposition(v bool) { + o.UpdateDisposition = &v +} + +func (o AddBackgroundRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AddBackgroundRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["content"] = o.Content + if !IsNil(o.UpdateDisposition) { + toSerialize["update_disposition"] = o.UpdateDisposition + } + return toSerialize, nil +} + +func (o *AddBackgroundRequest) 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{ + "content", + } + + 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) + } + } + + varAddBackgroundRequest := _AddBackgroundRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAddBackgroundRequest) + + if err != nil { + return err + } + + *o = AddBackgroundRequest(varAddBackgroundRequest) + + return err +} + +type NullableAddBackgroundRequest struct { + value *AddBackgroundRequest + isSet bool +} + +func (v NullableAddBackgroundRequest) Get() *AddBackgroundRequest { + return v.value +} + +func (v *NullableAddBackgroundRequest) Set(val *AddBackgroundRequest) { + v.value = val + v.isSet = true +} + +func (v NullableAddBackgroundRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableAddBackgroundRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAddBackgroundRequest(val *AddBackgroundRequest) *NullableAddBackgroundRequest { + return &NullableAddBackgroundRequest{value: val, isSet: true} +} + +func (v NullableAddBackgroundRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAddBackgroundRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_async_operation_submit_response.go b/hindsight-clients/go/model_async_operation_submit_response.go new file mode 100644 index 00000000..fc2fcd38 --- /dev/null +++ b/hindsight-clients/go/model_async_operation_submit_response.go @@ -0,0 +1,186 @@ +/* +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 AsyncOperationSubmitResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AsyncOperationSubmitResponse{} + +// AsyncOperationSubmitResponse Response model for submitting an async operation. +type AsyncOperationSubmitResponse struct { + OperationId string `json:"operation_id"` + Status string `json:"status"` +} + +type _AsyncOperationSubmitResponse AsyncOperationSubmitResponse + +// NewAsyncOperationSubmitResponse instantiates a new AsyncOperationSubmitResponse 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 NewAsyncOperationSubmitResponse(operationId string, status string) *AsyncOperationSubmitResponse { + this := AsyncOperationSubmitResponse{} + this.OperationId = operationId + this.Status = status + return &this +} + +// NewAsyncOperationSubmitResponseWithDefaults instantiates a new AsyncOperationSubmitResponse 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 NewAsyncOperationSubmitResponseWithDefaults() *AsyncOperationSubmitResponse { + this := AsyncOperationSubmitResponse{} + return &this +} + +// GetOperationId returns the OperationId field value +func (o *AsyncOperationSubmitResponse) 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 *AsyncOperationSubmitResponse) GetOperationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperationId, true +} + +// SetOperationId sets field value +func (o *AsyncOperationSubmitResponse) SetOperationId(v string) { + o.OperationId = v +} + +// GetStatus returns the Status field value +func (o *AsyncOperationSubmitResponse) 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 *AsyncOperationSubmitResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *AsyncOperationSubmitResponse) SetStatus(v string) { + o.Status = v +} + +func (o AsyncOperationSubmitResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AsyncOperationSubmitResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["operation_id"] = o.OperationId + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *AsyncOperationSubmitResponse) 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) + } + } + + varAsyncOperationSubmitResponse := _AsyncOperationSubmitResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAsyncOperationSubmitResponse) + + if err != nil { + return err + } + + *o = AsyncOperationSubmitResponse(varAsyncOperationSubmitResponse) + + return err +} + +type NullableAsyncOperationSubmitResponse struct { + value *AsyncOperationSubmitResponse + isSet bool +} + +func (v NullableAsyncOperationSubmitResponse) Get() *AsyncOperationSubmitResponse { + return v.value +} + +func (v *NullableAsyncOperationSubmitResponse) Set(val *AsyncOperationSubmitResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAsyncOperationSubmitResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAsyncOperationSubmitResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAsyncOperationSubmitResponse(val *AsyncOperationSubmitResponse) *NullableAsyncOperationSubmitResponse { + return &NullableAsyncOperationSubmitResponse{value: val, isSet: true} +} + +func (v NullableAsyncOperationSubmitResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAsyncOperationSubmitResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_background_response.go b/hindsight-clients/go/model_background_response.go new file mode 100644 index 00000000..30d95876 --- /dev/null +++ b/hindsight-clients/go/model_background_response.go @@ -0,0 +1,250 @@ +/* +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 BackgroundResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackgroundResponse{} + +// BackgroundResponse Response model for background update. Deprecated: use MissionResponse instead. +type BackgroundResponse struct { + Mission string `json:"mission"` + Background NullableString `json:"background,omitempty"` + Disposition NullableDispositionTraits `json:"disposition,omitempty"` +} + +type _BackgroundResponse BackgroundResponse + +// NewBackgroundResponse instantiates a new BackgroundResponse 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 NewBackgroundResponse(mission string) *BackgroundResponse { + this := BackgroundResponse{} + this.Mission = mission + return &this +} + +// NewBackgroundResponseWithDefaults instantiates a new BackgroundResponse 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 NewBackgroundResponseWithDefaults() *BackgroundResponse { + this := BackgroundResponse{} + return &this +} + +// GetMission returns the Mission field value +func (o *BackgroundResponse) GetMission() string { + if o == nil { + var ret string + return ret + } + + return o.Mission +} + +// GetMissionOk returns a tuple with the Mission field value +// and a boolean to check if the value has been set. +func (o *BackgroundResponse) GetMissionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Mission, true +} + +// SetMission sets field value +func (o *BackgroundResponse) SetMission(v string) { + o.Mission = v +} + +// GetBackground returns the Background field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BackgroundResponse) GetBackground() string { + if o == nil || IsNil(o.Background.Get()) { + var ret string + return ret + } + return *o.Background.Get() +} + +// GetBackgroundOk returns a tuple with the Background 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 *BackgroundResponse) GetBackgroundOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Background.Get(), o.Background.IsSet() +} + +// HasBackground returns a boolean if a field has been set. +func (o *BackgroundResponse) HasBackground() bool { + if o != nil && o.Background.IsSet() { + return true + } + + return false +} + +// SetBackground gets a reference to the given NullableString and assigns it to the Background field. +func (o *BackgroundResponse) SetBackground(v string) { + o.Background.Set(&v) +} +// SetBackgroundNil sets the value for Background to be an explicit nil +func (o *BackgroundResponse) SetBackgroundNil() { + o.Background.Set(nil) +} + +// UnsetBackground ensures that no value is present for Background, not even an explicit nil +func (o *BackgroundResponse) UnsetBackground() { + o.Background.Unset() +} + +// GetDisposition returns the Disposition field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BackgroundResponse) GetDisposition() DispositionTraits { + if o == nil || IsNil(o.Disposition.Get()) { + var ret DispositionTraits + return ret + } + return *o.Disposition.Get() +} + +// GetDispositionOk returns a tuple with the Disposition 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 *BackgroundResponse) GetDispositionOk() (*DispositionTraits, bool) { + if o == nil { + return nil, false + } + return o.Disposition.Get(), o.Disposition.IsSet() +} + +// HasDisposition returns a boolean if a field has been set. +func (o *BackgroundResponse) HasDisposition() bool { + if o != nil && o.Disposition.IsSet() { + return true + } + + return false +} + +// SetDisposition gets a reference to the given NullableDispositionTraits and assigns it to the Disposition field. +func (o *BackgroundResponse) SetDisposition(v DispositionTraits) { + o.Disposition.Set(&v) +} +// SetDispositionNil sets the value for Disposition to be an explicit nil +func (o *BackgroundResponse) SetDispositionNil() { + o.Disposition.Set(nil) +} + +// UnsetDisposition ensures that no value is present for Disposition, not even an explicit nil +func (o *BackgroundResponse) UnsetDisposition() { + o.Disposition.Unset() +} + +func (o BackgroundResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BackgroundResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["mission"] = o.Mission + if o.Background.IsSet() { + toSerialize["background"] = o.Background.Get() + } + if o.Disposition.IsSet() { + toSerialize["disposition"] = o.Disposition.Get() + } + return toSerialize, nil +} + +func (o *BackgroundResponse) 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{ + "mission", + } + + 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) + } + } + + varBackgroundResponse := _BackgroundResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBackgroundResponse) + + if err != nil { + return err + } + + *o = BackgroundResponse(varBackgroundResponse) + + return err +} + +type NullableBackgroundResponse struct { + value *BackgroundResponse + isSet bool +} + +func (v NullableBackgroundResponse) Get() *BackgroundResponse { + return v.value +} + +func (v *NullableBackgroundResponse) Set(val *BackgroundResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBackgroundResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBackgroundResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackgroundResponse(val *BackgroundResponse) *NullableBackgroundResponse { + return &NullableBackgroundResponse{value: val, isSet: true} +} + +func (v NullableBackgroundResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackgroundResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_bank_config_response.go b/hindsight-clients/go/model_bank_config_response.go new file mode 100644 index 00000000..09981fa8 --- /dev/null +++ b/hindsight-clients/go/model_bank_config_response.go @@ -0,0 +1,217 @@ +/* +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 BankConfigResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BankConfigResponse{} + +// BankConfigResponse Response model for bank configuration. +type BankConfigResponse struct { + // Bank identifier + BankId string `json:"bank_id"` + // Fully resolved configuration with all hierarchical overrides applied (Python field names) + Config map[string]interface{} `json:"config"` + // Bank-specific configuration overrides only (Python field names) + Overrides map[string]interface{} `json:"overrides"` +} + +type _BankConfigResponse BankConfigResponse + +// NewBankConfigResponse instantiates a new BankConfigResponse 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 NewBankConfigResponse(bankId string, config map[string]interface{}, overrides map[string]interface{}) *BankConfigResponse { + this := BankConfigResponse{} + this.BankId = bankId + this.Config = config + this.Overrides = overrides + return &this +} + +// NewBankConfigResponseWithDefaults instantiates a new BankConfigResponse 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 NewBankConfigResponseWithDefaults() *BankConfigResponse { + this := BankConfigResponse{} + return &this +} + +// GetBankId returns the BankId field value +func (o *BankConfigResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *BankConfigResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *BankConfigResponse) SetBankId(v string) { + o.BankId = v +} + +// GetConfig returns the Config field value +func (o *BankConfigResponse) GetConfig() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *BankConfigResponse) GetConfigOk() (map[string]interface{}, bool) { + if o == nil { + return map[string]interface{}{}, false + } + return o.Config, true +} + +// SetConfig sets field value +func (o *BankConfigResponse) SetConfig(v map[string]interface{}) { + o.Config = v +} + +// GetOverrides returns the Overrides field value +func (o *BankConfigResponse) GetOverrides() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.Overrides +} + +// GetOverridesOk returns a tuple with the Overrides field value +// and a boolean to check if the value has been set. +func (o *BankConfigResponse) GetOverridesOk() (map[string]interface{}, bool) { + if o == nil { + return map[string]interface{}{}, false + } + return o.Overrides, true +} + +// SetOverrides sets field value +func (o *BankConfigResponse) SetOverrides(v map[string]interface{}) { + o.Overrides = v +} + +func (o BankConfigResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BankConfigResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bank_id"] = o.BankId + toSerialize["config"] = o.Config + toSerialize["overrides"] = o.Overrides + return toSerialize, nil +} + +func (o *BankConfigResponse) 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{ + "bank_id", + "config", + "overrides", + } + + 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) + } + } + + varBankConfigResponse := _BankConfigResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBankConfigResponse) + + if err != nil { + return err + } + + *o = BankConfigResponse(varBankConfigResponse) + + return err +} + +type NullableBankConfigResponse struct { + value *BankConfigResponse + isSet bool +} + +func (v NullableBankConfigResponse) Get() *BankConfigResponse { + return v.value +} + +func (v *NullableBankConfigResponse) Set(val *BankConfigResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBankConfigResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBankConfigResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBankConfigResponse(val *BankConfigResponse) *NullableBankConfigResponse { + return &NullableBankConfigResponse{value: val, isSet: true} +} + +func (v NullableBankConfigResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBankConfigResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_bank_config_update.go b/hindsight-clients/go/model_bank_config_update.go new file mode 100644 index 00000000..d061a3a4 --- /dev/null +++ b/hindsight-clients/go/model_bank_config_update.go @@ -0,0 +1,159 @@ +/* +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 BankConfigUpdate type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BankConfigUpdate{} + +// BankConfigUpdate Request model for updating bank configuration. +type BankConfigUpdate struct { + // Configuration overrides. Keys can be in Python field format (llm_provider) or environment variable format (HINDSIGHT_API_LLM_PROVIDER). Only hierarchical fields can be overridden per-bank. + Updates map[string]interface{} `json:"updates"` +} + +type _BankConfigUpdate BankConfigUpdate + +// NewBankConfigUpdate instantiates a new BankConfigUpdate 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 NewBankConfigUpdate(updates map[string]interface{}) *BankConfigUpdate { + this := BankConfigUpdate{} + this.Updates = updates + return &this +} + +// NewBankConfigUpdateWithDefaults instantiates a new BankConfigUpdate 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 NewBankConfigUpdateWithDefaults() *BankConfigUpdate { + this := BankConfigUpdate{} + return &this +} + +// GetUpdates returns the Updates field value +func (o *BankConfigUpdate) GetUpdates() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.Updates +} + +// GetUpdatesOk returns a tuple with the Updates field value +// and a boolean to check if the value has been set. +func (o *BankConfigUpdate) GetUpdatesOk() (map[string]interface{}, bool) { + if o == nil { + return map[string]interface{}{}, false + } + return o.Updates, true +} + +// SetUpdates sets field value +func (o *BankConfigUpdate) SetUpdates(v map[string]interface{}) { + o.Updates = v +} + +func (o BankConfigUpdate) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BankConfigUpdate) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["updates"] = o.Updates + return toSerialize, nil +} + +func (o *BankConfigUpdate) 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{ + "updates", + } + + 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) + } + } + + varBankConfigUpdate := _BankConfigUpdate{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBankConfigUpdate) + + if err != nil { + return err + } + + *o = BankConfigUpdate(varBankConfigUpdate) + + return err +} + +type NullableBankConfigUpdate struct { + value *BankConfigUpdate + isSet bool +} + +func (v NullableBankConfigUpdate) Get() *BankConfigUpdate { + return v.value +} + +func (v *NullableBankConfigUpdate) Set(val *BankConfigUpdate) { + v.value = val + v.isSet = true +} + +func (v NullableBankConfigUpdate) IsSet() bool { + return v.isSet +} + +func (v *NullableBankConfigUpdate) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBankConfigUpdate(val *BankConfigUpdate) *NullableBankConfigUpdate { + return &NullableBankConfigUpdate{value: val, isSet: true} +} + +func (v NullableBankConfigUpdate) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBankConfigUpdate) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_bank_list_item.go b/hindsight-clients/go/model_bank_list_item.go new file mode 100644 index 00000000..b640a17b --- /dev/null +++ b/hindsight-clients/go/model_bank_list_item.go @@ -0,0 +1,370 @@ +/* +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 BankListItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BankListItem{} + +// BankListItem Bank list item with profile summary. +type BankListItem struct { + BankId string `json:"bank_id"` + Name NullableString `json:"name,omitempty"` + Disposition DispositionTraits `json:"disposition"` + Mission NullableString `json:"mission,omitempty"` + CreatedAt NullableString `json:"created_at,omitempty"` + UpdatedAt NullableString `json:"updated_at,omitempty"` +} + +type _BankListItem BankListItem + +// NewBankListItem instantiates a new BankListItem 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 NewBankListItem(bankId string, disposition DispositionTraits) *BankListItem { + this := BankListItem{} + this.BankId = bankId + this.Disposition = disposition + return &this +} + +// NewBankListItemWithDefaults instantiates a new BankListItem 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 NewBankListItemWithDefaults() *BankListItem { + this := BankListItem{} + return &this +} + +// GetBankId returns the BankId field value +func (o *BankListItem) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *BankListItem) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *BankListItem) SetBankId(v string) { + o.BankId = v +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BankListItem) GetName() string { + if o == nil || IsNil(o.Name.Get()) { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *BankListItem) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *BankListItem) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given NullableString and assigns it to the Name field. +func (o *BankListItem) SetName(v string) { + o.Name.Set(&v) +} +// SetNameNil sets the value for Name to be an explicit nil +func (o *BankListItem) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *BankListItem) UnsetName() { + o.Name.Unset() +} + +// GetDisposition returns the Disposition field value +func (o *BankListItem) GetDisposition() DispositionTraits { + if o == nil { + var ret DispositionTraits + return ret + } + + return o.Disposition +} + +// GetDispositionOk returns a tuple with the Disposition field value +// and a boolean to check if the value has been set. +func (o *BankListItem) GetDispositionOk() (*DispositionTraits, bool) { + if o == nil { + return nil, false + } + return &o.Disposition, true +} + +// SetDisposition sets field value +func (o *BankListItem) SetDisposition(v DispositionTraits) { + o.Disposition = v +} + +// GetMission returns the Mission field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BankListItem) GetMission() string { + if o == nil || IsNil(o.Mission.Get()) { + var ret string + return ret + } + return *o.Mission.Get() +} + +// GetMissionOk returns a tuple with the Mission 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 *BankListItem) GetMissionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Mission.Get(), o.Mission.IsSet() +} + +// HasMission returns a boolean if a field has been set. +func (o *BankListItem) HasMission() bool { + if o != nil && o.Mission.IsSet() { + return true + } + + return false +} + +// SetMission gets a reference to the given NullableString and assigns it to the Mission field. +func (o *BankListItem) SetMission(v string) { + o.Mission.Set(&v) +} +// SetMissionNil sets the value for Mission to be an explicit nil +func (o *BankListItem) SetMissionNil() { + o.Mission.Set(nil) +} + +// UnsetMission ensures that no value is present for Mission, not even an explicit nil +func (o *BankListItem) UnsetMission() { + o.Mission.Unset() +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BankListItem) 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 *BankListItem) 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 *BankListItem) 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 *BankListItem) SetCreatedAt(v string) { + o.CreatedAt.Set(&v) +} +// SetCreatedAtNil sets the value for CreatedAt to be an explicit nil +func (o *BankListItem) SetCreatedAtNil() { + o.CreatedAt.Set(nil) +} + +// UnsetCreatedAt ensures that no value is present for CreatedAt, not even an explicit nil +func (o *BankListItem) 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 *BankListItem) 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 *BankListItem) 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 *BankListItem) 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 *BankListItem) SetUpdatedAt(v string) { + o.UpdatedAt.Set(&v) +} +// SetUpdatedAtNil sets the value for UpdatedAt to be an explicit nil +func (o *BankListItem) SetUpdatedAtNil() { + o.UpdatedAt.Set(nil) +} + +// UnsetUpdatedAt ensures that no value is present for UpdatedAt, not even an explicit nil +func (o *BankListItem) UnsetUpdatedAt() { + o.UpdatedAt.Unset() +} + +func (o BankListItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BankListItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bank_id"] = o.BankId + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + toSerialize["disposition"] = o.Disposition + if o.Mission.IsSet() { + toSerialize["mission"] = o.Mission.Get() + } + if o.CreatedAt.IsSet() { + toSerialize["created_at"] = o.CreatedAt.Get() + } + if o.UpdatedAt.IsSet() { + toSerialize["updated_at"] = o.UpdatedAt.Get() + } + return toSerialize, nil +} + +func (o *BankListItem) 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{ + "bank_id", + "disposition", + } + + 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) + } + } + + varBankListItem := _BankListItem{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBankListItem) + + if err != nil { + return err + } + + *o = BankListItem(varBankListItem) + + return err +} + +type NullableBankListItem struct { + value *BankListItem + isSet bool +} + +func (v NullableBankListItem) Get() *BankListItem { + return v.value +} + +func (v *NullableBankListItem) Set(val *BankListItem) { + v.value = val + v.isSet = true +} + +func (v NullableBankListItem) IsSet() bool { + return v.isSet +} + +func (v *NullableBankListItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBankListItem(val *BankListItem) *NullableBankListItem { + return &NullableBankListItem{value: val, isSet: true} +} + +func (v NullableBankListItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBankListItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_bank_list_response.go b/hindsight-clients/go/model_bank_list_response.go new file mode 100644 index 00000000..832390dd --- /dev/null +++ b/hindsight-clients/go/model_bank_list_response.go @@ -0,0 +1,158 @@ +/* +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 BankListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BankListResponse{} + +// BankListResponse Response model for listing all banks. +type BankListResponse struct { + Banks []BankListItem `json:"banks"` +} + +type _BankListResponse BankListResponse + +// NewBankListResponse instantiates a new BankListResponse 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 NewBankListResponse(banks []BankListItem) *BankListResponse { + this := BankListResponse{} + this.Banks = banks + return &this +} + +// NewBankListResponseWithDefaults instantiates a new BankListResponse 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 NewBankListResponseWithDefaults() *BankListResponse { + this := BankListResponse{} + return &this +} + +// GetBanks returns the Banks field value +func (o *BankListResponse) GetBanks() []BankListItem { + if o == nil { + var ret []BankListItem + return ret + } + + return o.Banks +} + +// GetBanksOk returns a tuple with the Banks field value +// and a boolean to check if the value has been set. +func (o *BankListResponse) GetBanksOk() ([]BankListItem, bool) { + if o == nil { + return nil, false + } + return o.Banks, true +} + +// SetBanks sets field value +func (o *BankListResponse) SetBanks(v []BankListItem) { + o.Banks = v +} + +func (o BankListResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BankListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["banks"] = o.Banks + return toSerialize, nil +} + +func (o *BankListResponse) 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{ + "banks", + } + + 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) + } + } + + varBankListResponse := _BankListResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBankListResponse) + + if err != nil { + return err + } + + *o = BankListResponse(varBankListResponse) + + return err +} + +type NullableBankListResponse struct { + value *BankListResponse + isSet bool +} + +func (v NullableBankListResponse) Get() *BankListResponse { + return v.value +} + +func (v *NullableBankListResponse) Set(val *BankListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBankListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBankListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBankListResponse(val *BankListResponse) *NullableBankListResponse { + return &NullableBankListResponse{value: val, isSet: true} +} + +func (v NullableBankListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBankListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_bank_profile_response.go b/hindsight-clients/go/model_bank_profile_response.go new file mode 100644 index 00000000..a0a1cd9d --- /dev/null +++ b/hindsight-clients/go/model_bank_profile_response.go @@ -0,0 +1,289 @@ +/* +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 BankProfileResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BankProfileResponse{} + +// BankProfileResponse Response model for bank profile. +type BankProfileResponse struct { + BankId string `json:"bank_id"` + Name string `json:"name"` + Disposition DispositionTraits `json:"disposition"` + // The agent's mission - who they are and what they're trying to accomplish + Mission string `json:"mission"` + Background NullableString `json:"background,omitempty"` +} + +type _BankProfileResponse BankProfileResponse + +// NewBankProfileResponse instantiates a new BankProfileResponse 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 NewBankProfileResponse(bankId string, name string, disposition DispositionTraits, mission string) *BankProfileResponse { + this := BankProfileResponse{} + this.BankId = bankId + this.Name = name + this.Disposition = disposition + this.Mission = mission + return &this +} + +// NewBankProfileResponseWithDefaults instantiates a new BankProfileResponse 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 NewBankProfileResponseWithDefaults() *BankProfileResponse { + this := BankProfileResponse{} + return &this +} + +// GetBankId returns the BankId field value +func (o *BankProfileResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *BankProfileResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *BankProfileResponse) SetBankId(v string) { + o.BankId = v +} + +// GetName returns the Name field value +func (o *BankProfileResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *BankProfileResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *BankProfileResponse) SetName(v string) { + o.Name = v +} + +// GetDisposition returns the Disposition field value +func (o *BankProfileResponse) GetDisposition() DispositionTraits { + if o == nil { + var ret DispositionTraits + return ret + } + + return o.Disposition +} + +// GetDispositionOk returns a tuple with the Disposition field value +// and a boolean to check if the value has been set. +func (o *BankProfileResponse) GetDispositionOk() (*DispositionTraits, bool) { + if o == nil { + return nil, false + } + return &o.Disposition, true +} + +// SetDisposition sets field value +func (o *BankProfileResponse) SetDisposition(v DispositionTraits) { + o.Disposition = v +} + +// GetMission returns the Mission field value +func (o *BankProfileResponse) GetMission() string { + if o == nil { + var ret string + return ret + } + + return o.Mission +} + +// GetMissionOk returns a tuple with the Mission field value +// and a boolean to check if the value has been set. +func (o *BankProfileResponse) GetMissionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Mission, true +} + +// SetMission sets field value +func (o *BankProfileResponse) SetMission(v string) { + o.Mission = v +} + +// GetBackground returns the Background field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BankProfileResponse) GetBackground() string { + if o == nil || IsNil(o.Background.Get()) { + var ret string + return ret + } + return *o.Background.Get() +} + +// GetBackgroundOk returns a tuple with the Background 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 *BankProfileResponse) GetBackgroundOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Background.Get(), o.Background.IsSet() +} + +// HasBackground returns a boolean if a field has been set. +func (o *BankProfileResponse) HasBackground() bool { + if o != nil && o.Background.IsSet() { + return true + } + + return false +} + +// SetBackground gets a reference to the given NullableString and assigns it to the Background field. +func (o *BankProfileResponse) SetBackground(v string) { + o.Background.Set(&v) +} +// SetBackgroundNil sets the value for Background to be an explicit nil +func (o *BankProfileResponse) SetBackgroundNil() { + o.Background.Set(nil) +} + +// UnsetBackground ensures that no value is present for Background, not even an explicit nil +func (o *BankProfileResponse) UnsetBackground() { + o.Background.Unset() +} + +func (o BankProfileResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BankProfileResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bank_id"] = o.BankId + toSerialize["name"] = o.Name + toSerialize["disposition"] = o.Disposition + toSerialize["mission"] = o.Mission + if o.Background.IsSet() { + toSerialize["background"] = o.Background.Get() + } + return toSerialize, nil +} + +func (o *BankProfileResponse) 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{ + "bank_id", + "name", + "disposition", + "mission", + } + + 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) + } + } + + varBankProfileResponse := _BankProfileResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBankProfileResponse) + + if err != nil { + return err + } + + *o = BankProfileResponse(varBankProfileResponse) + + return err +} + +type NullableBankProfileResponse struct { + value *BankProfileResponse + isSet bool +} + +func (v NullableBankProfileResponse) Get() *BankProfileResponse { + return v.value +} + +func (v *NullableBankProfileResponse) Set(val *BankProfileResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBankProfileResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBankProfileResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBankProfileResponse(val *BankProfileResponse) *NullableBankProfileResponse { + return &NullableBankProfileResponse{value: val, isSet: true} +} + +func (v NullableBankProfileResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBankProfileResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_bank_stats_response.go b/hindsight-clients/go/model_bank_stats_response.go new file mode 100644 index 00000000..d0ef5e14 --- /dev/null +++ b/hindsight-clients/go/model_bank_stats_response.go @@ -0,0 +1,538 @@ +/* +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 BankStatsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BankStatsResponse{} + +// BankStatsResponse Response model for bank statistics endpoint. +type BankStatsResponse struct { + BankId string `json:"bank_id"` + TotalNodes int32 `json:"total_nodes"` + TotalLinks int32 `json:"total_links"` + TotalDocuments int32 `json:"total_documents"` + NodesByFactType map[string]int32 `json:"nodes_by_fact_type"` + LinksByLinkType map[string]int32 `json:"links_by_link_type"` + LinksByFactType map[string]int32 `json:"links_by_fact_type"` + LinksBreakdown map[string]map[string]int32 `json:"links_breakdown"` + PendingOperations int32 `json:"pending_operations"` + FailedOperations int32 `json:"failed_operations"` + LastConsolidatedAt NullableString `json:"last_consolidated_at,omitempty"` + // Number of memories not yet processed into observations + PendingConsolidation *int32 `json:"pending_consolidation,omitempty"` + // Total number of observations + TotalObservations *int32 `json:"total_observations,omitempty"` +} + +type _BankStatsResponse BankStatsResponse + +// NewBankStatsResponse instantiates a new BankStatsResponse 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 NewBankStatsResponse(bankId string, totalNodes int32, totalLinks int32, totalDocuments int32, nodesByFactType map[string]int32, linksByLinkType map[string]int32, linksByFactType map[string]int32, linksBreakdown map[string]map[string]int32, pendingOperations int32, failedOperations int32) *BankStatsResponse { + this := BankStatsResponse{} + this.BankId = bankId + this.TotalNodes = totalNodes + this.TotalLinks = totalLinks + this.TotalDocuments = totalDocuments + this.NodesByFactType = nodesByFactType + this.LinksByLinkType = linksByLinkType + this.LinksByFactType = linksByFactType + this.LinksBreakdown = linksBreakdown + this.PendingOperations = pendingOperations + this.FailedOperations = failedOperations + var pendingConsolidation int32 = 0 + this.PendingConsolidation = &pendingConsolidation + var totalObservations int32 = 0 + this.TotalObservations = &totalObservations + return &this +} + +// NewBankStatsResponseWithDefaults instantiates a new BankStatsResponse 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 NewBankStatsResponseWithDefaults() *BankStatsResponse { + this := BankStatsResponse{} + var pendingConsolidation int32 = 0 + this.PendingConsolidation = &pendingConsolidation + var totalObservations int32 = 0 + this.TotalObservations = &totalObservations + return &this +} + +// GetBankId returns the BankId field value +func (o *BankStatsResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *BankStatsResponse) SetBankId(v string) { + o.BankId = v +} + +// GetTotalNodes returns the TotalNodes field value +func (o *BankStatsResponse) GetTotalNodes() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalNodes +} + +// GetTotalNodesOk returns a tuple with the TotalNodes field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetTotalNodesOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalNodes, true +} + +// SetTotalNodes sets field value +func (o *BankStatsResponse) SetTotalNodes(v int32) { + o.TotalNodes = v +} + +// GetTotalLinks returns the TotalLinks field value +func (o *BankStatsResponse) GetTotalLinks() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalLinks +} + +// GetTotalLinksOk returns a tuple with the TotalLinks field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetTotalLinksOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalLinks, true +} + +// SetTotalLinks sets field value +func (o *BankStatsResponse) SetTotalLinks(v int32) { + o.TotalLinks = v +} + +// GetTotalDocuments returns the TotalDocuments field value +func (o *BankStatsResponse) GetTotalDocuments() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalDocuments +} + +// GetTotalDocumentsOk returns a tuple with the TotalDocuments field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetTotalDocumentsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalDocuments, true +} + +// SetTotalDocuments sets field value +func (o *BankStatsResponse) SetTotalDocuments(v int32) { + o.TotalDocuments = v +} + +// GetNodesByFactType returns the NodesByFactType field value +func (o *BankStatsResponse) GetNodesByFactType() map[string]int32 { + if o == nil { + var ret map[string]int32 + return ret + } + + return o.NodesByFactType +} + +// GetNodesByFactTypeOk returns a tuple with the NodesByFactType field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetNodesByFactTypeOk() (map[string]int32, bool) { + if o == nil { + return map[string]int32{}, false + } + return o.NodesByFactType, true +} + +// SetNodesByFactType sets field value +func (o *BankStatsResponse) SetNodesByFactType(v map[string]int32) { + o.NodesByFactType = v +} + +// GetLinksByLinkType returns the LinksByLinkType field value +func (o *BankStatsResponse) GetLinksByLinkType() map[string]int32 { + if o == nil { + var ret map[string]int32 + return ret + } + + return o.LinksByLinkType +} + +// GetLinksByLinkTypeOk returns a tuple with the LinksByLinkType field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetLinksByLinkTypeOk() (map[string]int32, bool) { + if o == nil { + return map[string]int32{}, false + } + return o.LinksByLinkType, true +} + +// SetLinksByLinkType sets field value +func (o *BankStatsResponse) SetLinksByLinkType(v map[string]int32) { + o.LinksByLinkType = v +} + +// GetLinksByFactType returns the LinksByFactType field value +func (o *BankStatsResponse) GetLinksByFactType() map[string]int32 { + if o == nil { + var ret map[string]int32 + return ret + } + + return o.LinksByFactType +} + +// GetLinksByFactTypeOk returns a tuple with the LinksByFactType field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetLinksByFactTypeOk() (map[string]int32, bool) { + if o == nil { + return map[string]int32{}, false + } + return o.LinksByFactType, true +} + +// SetLinksByFactType sets field value +func (o *BankStatsResponse) SetLinksByFactType(v map[string]int32) { + o.LinksByFactType = v +} + +// GetLinksBreakdown returns the LinksBreakdown field value +func (o *BankStatsResponse) GetLinksBreakdown() map[string]map[string]int32 { + if o == nil { + var ret map[string]map[string]int32 + return ret + } + + return o.LinksBreakdown +} + +// GetLinksBreakdownOk returns a tuple with the LinksBreakdown field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetLinksBreakdownOk() (map[string]map[string]int32, bool) { + if o == nil { + return map[string]map[string]int32{}, false + } + return o.LinksBreakdown, true +} + +// SetLinksBreakdown sets field value +func (o *BankStatsResponse) SetLinksBreakdown(v map[string]map[string]int32) { + o.LinksBreakdown = v +} + +// GetPendingOperations returns the PendingOperations field value +func (o *BankStatsResponse) GetPendingOperations() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.PendingOperations +} + +// GetPendingOperationsOk returns a tuple with the PendingOperations field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetPendingOperationsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.PendingOperations, true +} + +// SetPendingOperations sets field value +func (o *BankStatsResponse) SetPendingOperations(v int32) { + o.PendingOperations = v +} + +// GetFailedOperations returns the FailedOperations field value +func (o *BankStatsResponse) GetFailedOperations() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.FailedOperations +} + +// GetFailedOperationsOk returns a tuple with the FailedOperations field value +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetFailedOperationsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.FailedOperations, true +} + +// SetFailedOperations sets field value +func (o *BankStatsResponse) SetFailedOperations(v int32) { + o.FailedOperations = v +} + +// GetLastConsolidatedAt returns the LastConsolidatedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *BankStatsResponse) GetLastConsolidatedAt() string { + if o == nil || IsNil(o.LastConsolidatedAt.Get()) { + var ret string + return ret + } + return *o.LastConsolidatedAt.Get() +} + +// GetLastConsolidatedAtOk returns a tuple with the LastConsolidatedAt 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 *BankStatsResponse) GetLastConsolidatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastConsolidatedAt.Get(), o.LastConsolidatedAt.IsSet() +} + +// HasLastConsolidatedAt returns a boolean if a field has been set. +func (o *BankStatsResponse) HasLastConsolidatedAt() bool { + if o != nil && o.LastConsolidatedAt.IsSet() { + return true + } + + return false +} + +// SetLastConsolidatedAt gets a reference to the given NullableString and assigns it to the LastConsolidatedAt field. +func (o *BankStatsResponse) SetLastConsolidatedAt(v string) { + o.LastConsolidatedAt.Set(&v) +} +// SetLastConsolidatedAtNil sets the value for LastConsolidatedAt to be an explicit nil +func (o *BankStatsResponse) SetLastConsolidatedAtNil() { + o.LastConsolidatedAt.Set(nil) +} + +// UnsetLastConsolidatedAt ensures that no value is present for LastConsolidatedAt, not even an explicit nil +func (o *BankStatsResponse) UnsetLastConsolidatedAt() { + o.LastConsolidatedAt.Unset() +} + +// GetPendingConsolidation returns the PendingConsolidation field value if set, zero value otherwise. +func (o *BankStatsResponse) GetPendingConsolidation() int32 { + if o == nil || IsNil(o.PendingConsolidation) { + var ret int32 + return ret + } + return *o.PendingConsolidation +} + +// GetPendingConsolidationOk returns a tuple with the PendingConsolidation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetPendingConsolidationOk() (*int32, bool) { + if o == nil || IsNil(o.PendingConsolidation) { + return nil, false + } + return o.PendingConsolidation, true +} + +// HasPendingConsolidation returns a boolean if a field has been set. +func (o *BankStatsResponse) HasPendingConsolidation() bool { + if o != nil && !IsNil(o.PendingConsolidation) { + return true + } + + return false +} + +// SetPendingConsolidation gets a reference to the given int32 and assigns it to the PendingConsolidation field. +func (o *BankStatsResponse) SetPendingConsolidation(v int32) { + o.PendingConsolidation = &v +} + +// GetTotalObservations returns the TotalObservations field value if set, zero value otherwise. +func (o *BankStatsResponse) GetTotalObservations() int32 { + if o == nil || IsNil(o.TotalObservations) { + var ret int32 + return ret + } + return *o.TotalObservations +} + +// GetTotalObservationsOk returns a tuple with the TotalObservations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BankStatsResponse) GetTotalObservationsOk() (*int32, bool) { + if o == nil || IsNil(o.TotalObservations) { + return nil, false + } + return o.TotalObservations, true +} + +// HasTotalObservations returns a boolean if a field has been set. +func (o *BankStatsResponse) HasTotalObservations() bool { + if o != nil && !IsNil(o.TotalObservations) { + return true + } + + return false +} + +// SetTotalObservations gets a reference to the given int32 and assigns it to the TotalObservations field. +func (o *BankStatsResponse) SetTotalObservations(v int32) { + o.TotalObservations = &v +} + +func (o BankStatsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BankStatsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bank_id"] = o.BankId + toSerialize["total_nodes"] = o.TotalNodes + toSerialize["total_links"] = o.TotalLinks + toSerialize["total_documents"] = o.TotalDocuments + toSerialize["nodes_by_fact_type"] = o.NodesByFactType + toSerialize["links_by_link_type"] = o.LinksByLinkType + toSerialize["links_by_fact_type"] = o.LinksByFactType + toSerialize["links_breakdown"] = o.LinksBreakdown + toSerialize["pending_operations"] = o.PendingOperations + toSerialize["failed_operations"] = o.FailedOperations + if o.LastConsolidatedAt.IsSet() { + toSerialize["last_consolidated_at"] = o.LastConsolidatedAt.Get() + } + if !IsNil(o.PendingConsolidation) { + toSerialize["pending_consolidation"] = o.PendingConsolidation + } + if !IsNil(o.TotalObservations) { + toSerialize["total_observations"] = o.TotalObservations + } + return toSerialize, nil +} + +func (o *BankStatsResponse) 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{ + "bank_id", + "total_nodes", + "total_links", + "total_documents", + "nodes_by_fact_type", + "links_by_link_type", + "links_by_fact_type", + "links_breakdown", + "pending_operations", + "failed_operations", + } + + 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) + } + } + + varBankStatsResponse := _BankStatsResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varBankStatsResponse) + + if err != nil { + return err + } + + *o = BankStatsResponse(varBankStatsResponse) + + return err +} + +type NullableBankStatsResponse struct { + value *BankStatsResponse + isSet bool +} + +func (v NullableBankStatsResponse) Get() *BankStatsResponse { + return v.value +} + +func (v *NullableBankStatsResponse) Set(val *BankStatsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableBankStatsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableBankStatsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBankStatsResponse(val *BankStatsResponse) *NullableBankStatsResponse { + return &NullableBankStatsResponse{value: val, isSet: true} +} + +func (v NullableBankStatsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBankStatsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_budget.go b/hindsight-clients/go/model_budget.go new file mode 100644 index 00000000..02dcc432 --- /dev/null +++ b/hindsight-clients/go/model_budget.go @@ -0,0 +1,113 @@ +/* +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) +} + diff --git a/hindsight-clients/go/model_cancel_operation_response.go b/hindsight-clients/go/model_cancel_operation_response.go new file mode 100644 index 00000000..427b6f4d --- /dev/null +++ b/hindsight-clients/go/model_cancel_operation_response.go @@ -0,0 +1,214 @@ +/* +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 CancelOperationResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CancelOperationResponse{} + +// CancelOperationResponse Response model for cancel operation endpoint. +type CancelOperationResponse struct { + Success bool `json:"success"` + Message string `json:"message"` + OperationId string `json:"operation_id"` +} + +type _CancelOperationResponse CancelOperationResponse + +// NewCancelOperationResponse instantiates a new CancelOperationResponse 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 NewCancelOperationResponse(success bool, message string, operationId string) *CancelOperationResponse { + this := CancelOperationResponse{} + this.Success = success + this.Message = message + this.OperationId = operationId + return &this +} + +// NewCancelOperationResponseWithDefaults instantiates a new CancelOperationResponse 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 NewCancelOperationResponseWithDefaults() *CancelOperationResponse { + this := CancelOperationResponse{} + return &this +} + +// GetSuccess returns the Success field value +func (o *CancelOperationResponse) GetSuccess() bool { + if o == nil { + var ret bool + return ret + } + + return o.Success +} + +// GetSuccessOk returns a tuple with the Success field value +// and a boolean to check if the value has been set. +func (o *CancelOperationResponse) GetSuccessOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Success, true +} + +// SetSuccess sets field value +func (o *CancelOperationResponse) SetSuccess(v bool) { + o.Success = v +} + +// GetMessage returns the Message field value +func (o *CancelOperationResponse) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *CancelOperationResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *CancelOperationResponse) SetMessage(v string) { + o.Message = v +} + +// GetOperationId returns the OperationId field value +func (o *CancelOperationResponse) 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 *CancelOperationResponse) GetOperationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperationId, true +} + +// SetOperationId sets field value +func (o *CancelOperationResponse) SetOperationId(v string) { + o.OperationId = v +} + +func (o CancelOperationResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CancelOperationResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["success"] = o.Success + toSerialize["message"] = o.Message + toSerialize["operation_id"] = o.OperationId + return toSerialize, nil +} + +func (o *CancelOperationResponse) 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{ + "success", + "message", + "operation_id", + } + + 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) + } + } + + varCancelOperationResponse := _CancelOperationResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCancelOperationResponse) + + if err != nil { + return err + } + + *o = CancelOperationResponse(varCancelOperationResponse) + + return err +} + +type NullableCancelOperationResponse struct { + value *CancelOperationResponse + isSet bool +} + +func (v NullableCancelOperationResponse) Get() *CancelOperationResponse { + return v.value +} + +func (v *NullableCancelOperationResponse) Set(val *CancelOperationResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCancelOperationResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCancelOperationResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCancelOperationResponse(val *CancelOperationResponse) *NullableCancelOperationResponse { + return &NullableCancelOperationResponse{value: val, isSet: true} +} + +func (v NullableCancelOperationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCancelOperationResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_child_operation_status.go b/hindsight-clients/go/model_child_operation_status.go new file mode 100644 index 00000000..68126dd3 --- /dev/null +++ b/hindsight-clients/go/model_child_operation_status.go @@ -0,0 +1,324 @@ +/* +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 ChildOperationStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ChildOperationStatus{} + +// ChildOperationStatus Status of a child operation (for batch operations). +type ChildOperationStatus struct { + OperationId string `json:"operation_id"` + Status string `json:"status"` + SubBatchIndex NullableInt32 `json:"sub_batch_index,omitempty"` + ItemsCount NullableInt32 `json:"items_count,omitempty"` + ErrorMessage NullableString `json:"error_message,omitempty"` +} + +type _ChildOperationStatus ChildOperationStatus + +// NewChildOperationStatus instantiates a new ChildOperationStatus 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 NewChildOperationStatus(operationId string, status string) *ChildOperationStatus { + this := ChildOperationStatus{} + this.OperationId = operationId + this.Status = status + return &this +} + +// NewChildOperationStatusWithDefaults instantiates a new ChildOperationStatus 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 NewChildOperationStatusWithDefaults() *ChildOperationStatus { + this := ChildOperationStatus{} + return &this +} + +// GetOperationId returns the OperationId field value +func (o *ChildOperationStatus) 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 *ChildOperationStatus) GetOperationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperationId, true +} + +// SetOperationId sets field value +func (o *ChildOperationStatus) SetOperationId(v string) { + o.OperationId = v +} + +// GetStatus returns the Status field value +func (o *ChildOperationStatus) 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 *ChildOperationStatus) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *ChildOperationStatus) SetStatus(v string) { + o.Status = v +} + +// GetSubBatchIndex returns the SubBatchIndex field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ChildOperationStatus) GetSubBatchIndex() int32 { + if o == nil || IsNil(o.SubBatchIndex.Get()) { + var ret int32 + return ret + } + return *o.SubBatchIndex.Get() +} + +// GetSubBatchIndexOk returns a tuple with the SubBatchIndex 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 *ChildOperationStatus) GetSubBatchIndexOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.SubBatchIndex.Get(), o.SubBatchIndex.IsSet() +} + +// HasSubBatchIndex returns a boolean if a field has been set. +func (o *ChildOperationStatus) HasSubBatchIndex() bool { + if o != nil && o.SubBatchIndex.IsSet() { + return true + } + + return false +} + +// SetSubBatchIndex gets a reference to the given NullableInt32 and assigns it to the SubBatchIndex field. +func (o *ChildOperationStatus) SetSubBatchIndex(v int32) { + o.SubBatchIndex.Set(&v) +} +// SetSubBatchIndexNil sets the value for SubBatchIndex to be an explicit nil +func (o *ChildOperationStatus) SetSubBatchIndexNil() { + o.SubBatchIndex.Set(nil) +} + +// UnsetSubBatchIndex ensures that no value is present for SubBatchIndex, not even an explicit nil +func (o *ChildOperationStatus) UnsetSubBatchIndex() { + o.SubBatchIndex.Unset() +} + +// GetItemsCount returns the ItemsCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ChildOperationStatus) GetItemsCount() int32 { + if o == nil || IsNil(o.ItemsCount.Get()) { + var ret int32 + return ret + } + return *o.ItemsCount.Get() +} + +// GetItemsCountOk returns a tuple with the ItemsCount 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 *ChildOperationStatus) GetItemsCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.ItemsCount.Get(), o.ItemsCount.IsSet() +} + +// HasItemsCount returns a boolean if a field has been set. +func (o *ChildOperationStatus) HasItemsCount() bool { + if o != nil && o.ItemsCount.IsSet() { + return true + } + + return false +} + +// SetItemsCount gets a reference to the given NullableInt32 and assigns it to the ItemsCount field. +func (o *ChildOperationStatus) SetItemsCount(v int32) { + o.ItemsCount.Set(&v) +} +// SetItemsCountNil sets the value for ItemsCount to be an explicit nil +func (o *ChildOperationStatus) SetItemsCountNil() { + o.ItemsCount.Set(nil) +} + +// UnsetItemsCount ensures that no value is present for ItemsCount, not even an explicit nil +func (o *ChildOperationStatus) UnsetItemsCount() { + o.ItemsCount.Unset() +} + +// GetErrorMessage returns the ErrorMessage field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ChildOperationStatus) 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 *ChildOperationStatus) 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 *ChildOperationStatus) 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 *ChildOperationStatus) SetErrorMessage(v string) { + o.ErrorMessage.Set(&v) +} +// SetErrorMessageNil sets the value for ErrorMessage to be an explicit nil +func (o *ChildOperationStatus) SetErrorMessageNil() { + o.ErrorMessage.Set(nil) +} + +// UnsetErrorMessage ensures that no value is present for ErrorMessage, not even an explicit nil +func (o *ChildOperationStatus) UnsetErrorMessage() { + o.ErrorMessage.Unset() +} + +func (o ChildOperationStatus) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ChildOperationStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["operation_id"] = o.OperationId + toSerialize["status"] = o.Status + if o.SubBatchIndex.IsSet() { + toSerialize["sub_batch_index"] = o.SubBatchIndex.Get() + } + if o.ItemsCount.IsSet() { + toSerialize["items_count"] = o.ItemsCount.Get() + } + if o.ErrorMessage.IsSet() { + toSerialize["error_message"] = o.ErrorMessage.Get() + } + return toSerialize, nil +} + +func (o *ChildOperationStatus) 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) + } + } + + varChildOperationStatus := _ChildOperationStatus{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varChildOperationStatus) + + if err != nil { + return err + } + + *o = ChildOperationStatus(varChildOperationStatus) + + return err +} + +type NullableChildOperationStatus struct { + value *ChildOperationStatus + isSet bool +} + +func (v NullableChildOperationStatus) Get() *ChildOperationStatus { + return v.value +} + +func (v *NullableChildOperationStatus) Set(val *ChildOperationStatus) { + v.value = val + v.isSet = true +} + +func (v NullableChildOperationStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableChildOperationStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChildOperationStatus(val *ChildOperationStatus) *NullableChildOperationStatus { + return &NullableChildOperationStatus{value: val, isSet: true} +} + +func (v NullableChildOperationStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChildOperationStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_chunk_data.go b/hindsight-clients/go/model_chunk_data.go new file mode 100644 index 00000000..c914680c --- /dev/null +++ b/hindsight-clients/go/model_chunk_data.go @@ -0,0 +1,255 @@ +/* +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 ChunkData type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ChunkData{} + +// ChunkData Chunk data for a single chunk. +type ChunkData struct { + Id string `json:"id"` + Text string `json:"text"` + ChunkIndex int32 `json:"chunk_index"` + // Whether the chunk text was truncated due to token limits + Truncated *bool `json:"truncated,omitempty"` +} + +type _ChunkData ChunkData + +// NewChunkData instantiates a new ChunkData 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 NewChunkData(id string, text string, chunkIndex int32) *ChunkData { + this := ChunkData{} + this.Id = id + this.Text = text + this.ChunkIndex = chunkIndex + var truncated bool = false + this.Truncated = &truncated + return &this +} + +// NewChunkDataWithDefaults instantiates a new ChunkData 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 NewChunkDataWithDefaults() *ChunkData { + this := ChunkData{} + var truncated bool = false + this.Truncated = &truncated + return &this +} + +// GetId returns the Id field value +func (o *ChunkData) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ChunkData) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ChunkData) SetId(v string) { + o.Id = v +} + +// GetText returns the Text field value +func (o *ChunkData) GetText() string { + if o == nil { + var ret string + return ret + } + + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *ChunkData) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value +func (o *ChunkData) SetText(v string) { + o.Text = v +} + +// GetChunkIndex returns the ChunkIndex field value +func (o *ChunkData) GetChunkIndex() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ChunkIndex +} + +// GetChunkIndexOk returns a tuple with the ChunkIndex field value +// and a boolean to check if the value has been set. +func (o *ChunkData) GetChunkIndexOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ChunkIndex, true +} + +// SetChunkIndex sets field value +func (o *ChunkData) SetChunkIndex(v int32) { + o.ChunkIndex = v +} + +// GetTruncated returns the Truncated field value if set, zero value otherwise. +func (o *ChunkData) GetTruncated() bool { + if o == nil || IsNil(o.Truncated) { + var ret bool + return ret + } + return *o.Truncated +} + +// GetTruncatedOk returns a tuple with the Truncated field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ChunkData) GetTruncatedOk() (*bool, bool) { + if o == nil || IsNil(o.Truncated) { + return nil, false + } + return o.Truncated, true +} + +// HasTruncated returns a boolean if a field has been set. +func (o *ChunkData) HasTruncated() bool { + if o != nil && !IsNil(o.Truncated) { + return true + } + + return false +} + +// SetTruncated gets a reference to the given bool and assigns it to the Truncated field. +func (o *ChunkData) SetTruncated(v bool) { + o.Truncated = &v +} + +func (o ChunkData) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ChunkData) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["text"] = o.Text + toSerialize["chunk_index"] = o.ChunkIndex + if !IsNil(o.Truncated) { + toSerialize["truncated"] = o.Truncated + } + return toSerialize, nil +} + +func (o *ChunkData) 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{ + "id", + "text", + "chunk_index", + } + + 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) + } + } + + varChunkData := _ChunkData{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varChunkData) + + if err != nil { + return err + } + + *o = ChunkData(varChunkData) + + return err +} + +type NullableChunkData struct { + value *ChunkData + isSet bool +} + +func (v NullableChunkData) Get() *ChunkData { + return v.value +} + +func (v *NullableChunkData) Set(val *ChunkData) { + v.value = val + v.isSet = true +} + +func (v NullableChunkData) IsSet() bool { + return v.isSet +} + +func (v *NullableChunkData) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChunkData(val *ChunkData) *NullableChunkData { + return &NullableChunkData{value: val, isSet: true} +} + +func (v NullableChunkData) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChunkData) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_chunk_include_options.go b/hindsight-clients/go/model_chunk_include_options.go new file mode 100644 index 00000000..6050bfc5 --- /dev/null +++ b/hindsight-clients/go/model_chunk_include_options.go @@ -0,0 +1,131 @@ +/* +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" +) + +// checks if the ChunkIncludeOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ChunkIncludeOptions{} + +// ChunkIncludeOptions Options for including chunks in recall results. +type ChunkIncludeOptions struct { + // Maximum tokens for chunks (chunks may be truncated) + MaxTokens *int32 `json:"max_tokens,omitempty"` +} + +// NewChunkIncludeOptions instantiates a new ChunkIncludeOptions 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 NewChunkIncludeOptions() *ChunkIncludeOptions { + this := ChunkIncludeOptions{} + var maxTokens int32 = 8192 + this.MaxTokens = &maxTokens + return &this +} + +// NewChunkIncludeOptionsWithDefaults instantiates a new ChunkIncludeOptions 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 NewChunkIncludeOptionsWithDefaults() *ChunkIncludeOptions { + this := ChunkIncludeOptions{} + var maxTokens int32 = 8192 + this.MaxTokens = &maxTokens + return &this +} + +// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise. +func (o *ChunkIncludeOptions) 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 *ChunkIncludeOptions) 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 *ChunkIncludeOptions) 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 *ChunkIncludeOptions) SetMaxTokens(v int32) { + o.MaxTokens = &v +} + +func (o ChunkIncludeOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ChunkIncludeOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MaxTokens) { + toSerialize["max_tokens"] = o.MaxTokens + } + return toSerialize, nil +} + +type NullableChunkIncludeOptions struct { + value *ChunkIncludeOptions + isSet bool +} + +func (v NullableChunkIncludeOptions) Get() *ChunkIncludeOptions { + return v.value +} + +func (v *NullableChunkIncludeOptions) Set(val *ChunkIncludeOptions) { + v.value = val + v.isSet = true +} + +func (v NullableChunkIncludeOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableChunkIncludeOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChunkIncludeOptions(val *ChunkIncludeOptions) *NullableChunkIncludeOptions { + return &NullableChunkIncludeOptions{value: val, isSet: true} +} + +func (v NullableChunkIncludeOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChunkIncludeOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_chunk_response.go b/hindsight-clients/go/model_chunk_response.go new file mode 100644 index 00000000..b43ae6d4 --- /dev/null +++ b/hindsight-clients/go/model_chunk_response.go @@ -0,0 +1,298 @@ +/* +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 ChunkResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ChunkResponse{} + +// ChunkResponse Response model for get chunk endpoint. +type ChunkResponse struct { + ChunkId string `json:"chunk_id"` + DocumentId string `json:"document_id"` + BankId string `json:"bank_id"` + ChunkIndex int32 `json:"chunk_index"` + ChunkText string `json:"chunk_text"` + CreatedAt string `json:"created_at"` +} + +type _ChunkResponse ChunkResponse + +// NewChunkResponse instantiates a new ChunkResponse 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 NewChunkResponse(chunkId string, documentId string, bankId string, chunkIndex int32, chunkText string, createdAt string) *ChunkResponse { + this := ChunkResponse{} + this.ChunkId = chunkId + this.DocumentId = documentId + this.BankId = bankId + this.ChunkIndex = chunkIndex + this.ChunkText = chunkText + this.CreatedAt = createdAt + return &this +} + +// NewChunkResponseWithDefaults instantiates a new ChunkResponse 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 NewChunkResponseWithDefaults() *ChunkResponse { + this := ChunkResponse{} + return &this +} + +// GetChunkId returns the ChunkId field value +func (o *ChunkResponse) GetChunkId() string { + if o == nil { + var ret string + return ret + } + + return o.ChunkId +} + +// GetChunkIdOk returns a tuple with the ChunkId field value +// and a boolean to check if the value has been set. +func (o *ChunkResponse) GetChunkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChunkId, true +} + +// SetChunkId sets field value +func (o *ChunkResponse) SetChunkId(v string) { + o.ChunkId = v +} + +// GetDocumentId returns the DocumentId field value +func (o *ChunkResponse) GetDocumentId() string { + if o == nil { + var ret string + return ret + } + + return o.DocumentId +} + +// GetDocumentIdOk returns a tuple with the DocumentId field value +// and a boolean to check if the value has been set. +func (o *ChunkResponse) GetDocumentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DocumentId, true +} + +// SetDocumentId sets field value +func (o *ChunkResponse) SetDocumentId(v string) { + o.DocumentId = v +} + +// GetBankId returns the BankId field value +func (o *ChunkResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *ChunkResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *ChunkResponse) SetBankId(v string) { + o.BankId = v +} + +// GetChunkIndex returns the ChunkIndex field value +func (o *ChunkResponse) GetChunkIndex() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ChunkIndex +} + +// GetChunkIndexOk returns a tuple with the ChunkIndex field value +// and a boolean to check if the value has been set. +func (o *ChunkResponse) GetChunkIndexOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ChunkIndex, true +} + +// SetChunkIndex sets field value +func (o *ChunkResponse) SetChunkIndex(v int32) { + o.ChunkIndex = v +} + +// GetChunkText returns the ChunkText field value +func (o *ChunkResponse) GetChunkText() string { + if o == nil { + var ret string + return ret + } + + return o.ChunkText +} + +// GetChunkTextOk returns a tuple with the ChunkText field value +// and a boolean to check if the value has been set. +func (o *ChunkResponse) GetChunkTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ChunkText, true +} + +// SetChunkText sets field value +func (o *ChunkResponse) SetChunkText(v string) { + o.ChunkText = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *ChunkResponse) GetCreatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *ChunkResponse) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *ChunkResponse) SetCreatedAt(v string) { + o.CreatedAt = v +} + +func (o ChunkResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ChunkResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["chunk_id"] = o.ChunkId + toSerialize["document_id"] = o.DocumentId + toSerialize["bank_id"] = o.BankId + toSerialize["chunk_index"] = o.ChunkIndex + toSerialize["chunk_text"] = o.ChunkText + toSerialize["created_at"] = o.CreatedAt + return toSerialize, nil +} + +func (o *ChunkResponse) 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{ + "chunk_id", + "document_id", + "bank_id", + "chunk_index", + "chunk_text", + "created_at", + } + + 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) + } + } + + varChunkResponse := _ChunkResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varChunkResponse) + + if err != nil { + return err + } + + *o = ChunkResponse(varChunkResponse) + + return err +} + +type NullableChunkResponse struct { + value *ChunkResponse + isSet bool +} + +func (v NullableChunkResponse) Get() *ChunkResponse { + return v.value +} + +func (v *NullableChunkResponse) Set(val *ChunkResponse) { + v.value = val + v.isSet = true +} + +func (v NullableChunkResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableChunkResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableChunkResponse(val *ChunkResponse) *NullableChunkResponse { + return &NullableChunkResponse{value: val, isSet: true} +} + +func (v NullableChunkResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableChunkResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_consolidation_response.go b/hindsight-clients/go/model_consolidation_response.go new file mode 100644 index 00000000..05857918 --- /dev/null +++ b/hindsight-clients/go/model_consolidation_response.go @@ -0,0 +1,200 @@ +/* +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 ConsolidationResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConsolidationResponse{} + +// ConsolidationResponse Response model for consolidation trigger endpoint. +type ConsolidationResponse struct { + // ID of the async consolidation operation + OperationId string `json:"operation_id"` + // True if an existing pending task was reused + Deduplicated *bool `json:"deduplicated,omitempty"` +} + +type _ConsolidationResponse ConsolidationResponse + +// NewConsolidationResponse instantiates a new ConsolidationResponse 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 NewConsolidationResponse(operationId string) *ConsolidationResponse { + this := ConsolidationResponse{} + this.OperationId = operationId + var deduplicated bool = false + this.Deduplicated = &deduplicated + return &this +} + +// NewConsolidationResponseWithDefaults instantiates a new ConsolidationResponse 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 NewConsolidationResponseWithDefaults() *ConsolidationResponse { + this := ConsolidationResponse{} + var deduplicated bool = false + this.Deduplicated = &deduplicated + return &this +} + +// GetOperationId returns the OperationId field value +func (o *ConsolidationResponse) 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 *ConsolidationResponse) GetOperationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperationId, true +} + +// SetOperationId sets field value +func (o *ConsolidationResponse) SetOperationId(v string) { + o.OperationId = v +} + +// GetDeduplicated returns the Deduplicated field value if set, zero value otherwise. +func (o *ConsolidationResponse) GetDeduplicated() bool { + if o == nil || IsNil(o.Deduplicated) { + var ret bool + return ret + } + return *o.Deduplicated +} + +// GetDeduplicatedOk returns a tuple with the Deduplicated field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConsolidationResponse) GetDeduplicatedOk() (*bool, bool) { + if o == nil || IsNil(o.Deduplicated) { + return nil, false + } + return o.Deduplicated, true +} + +// HasDeduplicated returns a boolean if a field has been set. +func (o *ConsolidationResponse) HasDeduplicated() bool { + if o != nil && !IsNil(o.Deduplicated) { + return true + } + + return false +} + +// SetDeduplicated gets a reference to the given bool and assigns it to the Deduplicated field. +func (o *ConsolidationResponse) SetDeduplicated(v bool) { + o.Deduplicated = &v +} + +func (o ConsolidationResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConsolidationResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["operation_id"] = o.OperationId + if !IsNil(o.Deduplicated) { + toSerialize["deduplicated"] = o.Deduplicated + } + return toSerialize, nil +} + +func (o *ConsolidationResponse) 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", + } + + 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) + } + } + + varConsolidationResponse := _ConsolidationResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varConsolidationResponse) + + if err != nil { + return err + } + + *o = ConsolidationResponse(varConsolidationResponse) + + return err +} + +type NullableConsolidationResponse struct { + value *ConsolidationResponse + isSet bool +} + +func (v NullableConsolidationResponse) Get() *ConsolidationResponse { + return v.value +} + +func (v *NullableConsolidationResponse) Set(val *ConsolidationResponse) { + v.value = val + v.isSet = true +} + +func (v NullableConsolidationResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableConsolidationResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConsolidationResponse(val *ConsolidationResponse) *NullableConsolidationResponse { + return &NullableConsolidationResponse{value: val, isSet: true} +} + +func (v NullableConsolidationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConsolidationResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_create_bank_request.go b/hindsight-clients/go/model_create_bank_request.go new file mode 100644 index 00000000..3f1d076e --- /dev/null +++ b/hindsight-clients/go/model_create_bank_request.go @@ -0,0 +1,274 @@ +/* +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" +) + +// checks if the CreateBankRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateBankRequest{} + +// CreateBankRequest Request model for creating/updating a bank. +type CreateBankRequest struct { + Name NullableString `json:"name,omitempty"` + Disposition NullableDispositionTraits `json:"disposition,omitempty"` + Mission NullableString `json:"mission,omitempty"` + Background NullableString `json:"background,omitempty"` +} + +// NewCreateBankRequest instantiates a new CreateBankRequest 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 NewCreateBankRequest() *CreateBankRequest { + this := CreateBankRequest{} + return &this +} + +// NewCreateBankRequestWithDefaults instantiates a new CreateBankRequest 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 NewCreateBankRequestWithDefaults() *CreateBankRequest { + this := CreateBankRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateBankRequest) GetName() string { + if o == nil || IsNil(o.Name.Get()) { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *CreateBankRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *CreateBankRequest) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given NullableString and assigns it to the Name field. +func (o *CreateBankRequest) SetName(v string) { + o.Name.Set(&v) +} +// SetNameNil sets the value for Name to be an explicit nil +func (o *CreateBankRequest) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *CreateBankRequest) UnsetName() { + o.Name.Unset() +} + +// GetDisposition returns the Disposition field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateBankRequest) GetDisposition() DispositionTraits { + if o == nil || IsNil(o.Disposition.Get()) { + var ret DispositionTraits + return ret + } + return *o.Disposition.Get() +} + +// GetDispositionOk returns a tuple with the Disposition 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 *CreateBankRequest) GetDispositionOk() (*DispositionTraits, bool) { + if o == nil { + return nil, false + } + return o.Disposition.Get(), o.Disposition.IsSet() +} + +// HasDisposition returns a boolean if a field has been set. +func (o *CreateBankRequest) HasDisposition() bool { + if o != nil && o.Disposition.IsSet() { + return true + } + + return false +} + +// SetDisposition gets a reference to the given NullableDispositionTraits and assigns it to the Disposition field. +func (o *CreateBankRequest) SetDisposition(v DispositionTraits) { + o.Disposition.Set(&v) +} +// SetDispositionNil sets the value for Disposition to be an explicit nil +func (o *CreateBankRequest) SetDispositionNil() { + o.Disposition.Set(nil) +} + +// UnsetDisposition ensures that no value is present for Disposition, not even an explicit nil +func (o *CreateBankRequest) UnsetDisposition() { + o.Disposition.Unset() +} + +// GetMission returns the Mission field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateBankRequest) GetMission() string { + if o == nil || IsNil(o.Mission.Get()) { + var ret string + return ret + } + return *o.Mission.Get() +} + +// GetMissionOk returns a tuple with the Mission 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 *CreateBankRequest) GetMissionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Mission.Get(), o.Mission.IsSet() +} + +// HasMission returns a boolean if a field has been set. +func (o *CreateBankRequest) HasMission() bool { + if o != nil && o.Mission.IsSet() { + return true + } + + return false +} + +// SetMission gets a reference to the given NullableString and assigns it to the Mission field. +func (o *CreateBankRequest) SetMission(v string) { + o.Mission.Set(&v) +} +// SetMissionNil sets the value for Mission to be an explicit nil +func (o *CreateBankRequest) SetMissionNil() { + o.Mission.Set(nil) +} + +// UnsetMission ensures that no value is present for Mission, not even an explicit nil +func (o *CreateBankRequest) UnsetMission() { + o.Mission.Unset() +} + +// GetBackground returns the Background field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateBankRequest) GetBackground() string { + if o == nil || IsNil(o.Background.Get()) { + var ret string + return ret + } + return *o.Background.Get() +} + +// GetBackgroundOk returns a tuple with the Background 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 *CreateBankRequest) GetBackgroundOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Background.Get(), o.Background.IsSet() +} + +// HasBackground returns a boolean if a field has been set. +func (o *CreateBankRequest) HasBackground() bool { + if o != nil && o.Background.IsSet() { + return true + } + + return false +} + +// SetBackground gets a reference to the given NullableString and assigns it to the Background field. +func (o *CreateBankRequest) SetBackground(v string) { + o.Background.Set(&v) +} +// SetBackgroundNil sets the value for Background to be an explicit nil +func (o *CreateBankRequest) SetBackgroundNil() { + o.Background.Set(nil) +} + +// UnsetBackground ensures that no value is present for Background, not even an explicit nil +func (o *CreateBankRequest) UnsetBackground() { + o.Background.Unset() +} + +func (o CreateBankRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateBankRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if o.Disposition.IsSet() { + toSerialize["disposition"] = o.Disposition.Get() + } + if o.Mission.IsSet() { + toSerialize["mission"] = o.Mission.Get() + } + if o.Background.IsSet() { + toSerialize["background"] = o.Background.Get() + } + return toSerialize, nil +} + +type NullableCreateBankRequest struct { + value *CreateBankRequest + isSet bool +} + +func (v NullableCreateBankRequest) Get() *CreateBankRequest { + return v.value +} + +func (v *NullableCreateBankRequest) Set(val *CreateBankRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateBankRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateBankRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateBankRequest(val *CreateBankRequest) *NullableCreateBankRequest { + return &NullableCreateBankRequest{value: val, isSet: true} +} + +func (v NullableCreateBankRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateBankRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_create_directive_request.go b/hindsight-clients/go/model_create_directive_request.go new file mode 100644 index 00000000..cdbb3a6e --- /dev/null +++ b/hindsight-clients/go/model_create_directive_request.go @@ -0,0 +1,307 @@ +/* +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 CreateDirectiveRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDirectiveRequest{} + +// CreateDirectiveRequest Request model for creating a directive. +type CreateDirectiveRequest struct { + // Human-readable name for the directive + Name string `json:"name"` + // The directive text to inject into prompts + Content string `json:"content"` + // Higher priority directives are injected first + Priority *int32 `json:"priority,omitempty"` + // Whether this directive is active + IsActive *bool `json:"is_active,omitempty"` + // Tags for filtering + Tags []string `json:"tags,omitempty"` +} + +type _CreateDirectiveRequest CreateDirectiveRequest + +// NewCreateDirectiveRequest instantiates a new CreateDirectiveRequest 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 NewCreateDirectiveRequest(name string, content string) *CreateDirectiveRequest { + this := CreateDirectiveRequest{} + this.Name = name + this.Content = content + var priority int32 = 0 + this.Priority = &priority + var isActive bool = true + this.IsActive = &isActive + return &this +} + +// NewCreateDirectiveRequestWithDefaults instantiates a new CreateDirectiveRequest 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 NewCreateDirectiveRequestWithDefaults() *CreateDirectiveRequest { + this := CreateDirectiveRequest{} + var priority int32 = 0 + this.Priority = &priority + var isActive bool = true + this.IsActive = &isActive + return &this +} + +// GetName returns the Name field value +func (o *CreateDirectiveRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateDirectiveRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateDirectiveRequest) SetName(v string) { + o.Name = v +} + +// GetContent returns the Content field value +func (o *CreateDirectiveRequest) GetContent() string { + if o == nil { + var ret string + return ret + } + + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *CreateDirectiveRequest) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value +func (o *CreateDirectiveRequest) SetContent(v string) { + o.Content = v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *CreateDirectiveRequest) GetPriority() int32 { + if o == nil || IsNil(o.Priority) { + var ret int32 + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDirectiveRequest) GetPriorityOk() (*int32, bool) { + if o == nil || IsNil(o.Priority) { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *CreateDirectiveRequest) HasPriority() bool { + if o != nil && !IsNil(o.Priority) { + return true + } + + return false +} + +// SetPriority gets a reference to the given int32 and assigns it to the Priority field. +func (o *CreateDirectiveRequest) SetPriority(v int32) { + o.Priority = &v +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *CreateDirectiveRequest) GetIsActive() bool { + if o == nil || IsNil(o.IsActive) { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDirectiveRequest) GetIsActiveOk() (*bool, bool) { + if o == nil || IsNil(o.IsActive) { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *CreateDirectiveRequest) HasIsActive() bool { + if o != nil && !IsNil(o.IsActive) { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *CreateDirectiveRequest) SetIsActive(v bool) { + o.IsActive = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *CreateDirectiveRequest) GetTags() []string { + if o == nil || IsNil(o.Tags) { + 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. +func (o *CreateDirectiveRequest) 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 *CreateDirectiveRequest) 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 *CreateDirectiveRequest) SetTags(v []string) { + o.Tags = v +} + +func (o CreateDirectiveRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateDirectiveRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["name"] = o.Name + toSerialize["content"] = o.Content + if !IsNil(o.Priority) { + toSerialize["priority"] = o.Priority + } + if !IsNil(o.IsActive) { + toSerialize["is_active"] = o.IsActive + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + return toSerialize, nil +} + +func (o *CreateDirectiveRequest) 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{ + "name", + "content", + } + + 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) + } + } + + varCreateDirectiveRequest := _CreateDirectiveRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateDirectiveRequest) + + if err != nil { + return err + } + + *o = CreateDirectiveRequest(varCreateDirectiveRequest) + + return err +} + +type NullableCreateDirectiveRequest struct { + value *CreateDirectiveRequest + isSet bool +} + +func (v NullableCreateDirectiveRequest) Get() *CreateDirectiveRequest { + return v.value +} + +func (v *NullableCreateDirectiveRequest) Set(val *CreateDirectiveRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDirectiveRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDirectiveRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDirectiveRequest(val *CreateDirectiveRequest) *NullableCreateDirectiveRequest { + return &NullableCreateDirectiveRequest{value: val, isSet: true} +} + +func (v NullableCreateDirectiveRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDirectiveRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_create_mental_model_request.go b/hindsight-clients/go/model_create_mental_model_request.go new file mode 100644 index 00000000..52fbbfcf --- /dev/null +++ b/hindsight-clients/go/model_create_mental_model_request.go @@ -0,0 +1,349 @@ +/* +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 CreateMentalModelRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateMentalModelRequest{} + +// CreateMentalModelRequest Request model for creating a mental model. +type CreateMentalModelRequest struct { + Id NullableString `json:"id,omitempty"` + // Human-readable name for the mental model + Name string `json:"name"` + // The query to run to generate content + SourceQuery string `json:"source_query"` + // Tags for scoped visibility + Tags []string `json:"tags,omitempty"` + // Maximum tokens for generated content + MaxTokens *int32 `json:"max_tokens,omitempty"` + // Trigger settings + Trigger *MentalModelTrigger `json:"trigger,omitempty"` +} + +type _CreateMentalModelRequest CreateMentalModelRequest + +// NewCreateMentalModelRequest instantiates a new CreateMentalModelRequest 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 NewCreateMentalModelRequest(name string, sourceQuery string) *CreateMentalModelRequest { + this := CreateMentalModelRequest{} + this.Name = name + this.SourceQuery = sourceQuery + var maxTokens int32 = 2048 + this.MaxTokens = &maxTokens + return &this +} + +// NewCreateMentalModelRequestWithDefaults instantiates a new CreateMentalModelRequest 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 NewCreateMentalModelRequestWithDefaults() *CreateMentalModelRequest { + this := CreateMentalModelRequest{} + var maxTokens int32 = 2048 + this.MaxTokens = &maxTokens + return &this +} + +// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateMentalModelRequest) GetId() string { + if o == nil || IsNil(o.Id.Get()) { + var ret string + return ret + } + return *o.Id.Get() +} + +// GetIdOk returns a tuple with the Id 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 *CreateMentalModelRequest) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id.Get(), o.Id.IsSet() +} + +// HasId returns a boolean if a field has been set. +func (o *CreateMentalModelRequest) HasId() bool { + if o != nil && o.Id.IsSet() { + return true + } + + return false +} + +// SetId gets a reference to the given NullableString and assigns it to the Id field. +func (o *CreateMentalModelRequest) SetId(v string) { + o.Id.Set(&v) +} +// SetIdNil sets the value for Id to be an explicit nil +func (o *CreateMentalModelRequest) SetIdNil() { + o.Id.Set(nil) +} + +// UnsetId ensures that no value is present for Id, not even an explicit nil +func (o *CreateMentalModelRequest) UnsetId() { + o.Id.Unset() +} + +// GetName returns the Name field value +func (o *CreateMentalModelRequest) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateMentalModelRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *CreateMentalModelRequest) SetName(v string) { + o.Name = v +} + +// GetSourceQuery returns the SourceQuery field value +func (o *CreateMentalModelRequest) GetSourceQuery() string { + if o == nil { + var ret string + return ret + } + + return o.SourceQuery +} + +// GetSourceQueryOk returns a tuple with the SourceQuery field value +// and a boolean to check if the value has been set. +func (o *CreateMentalModelRequest) GetSourceQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SourceQuery, true +} + +// SetSourceQuery sets field value +func (o *CreateMentalModelRequest) SetSourceQuery(v string) { + o.SourceQuery = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *CreateMentalModelRequest) GetTags() []string { + if o == nil || IsNil(o.Tags) { + 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. +func (o *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) SetTags(v []string) { + o.Tags = v +} + +// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise. +func (o *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) 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 *CreateMentalModelRequest) SetMaxTokens(v int32) { + o.MaxTokens = &v +} + +// GetTrigger returns the Trigger field value if set, zero value otherwise. +func (o *CreateMentalModelRequest) GetTrigger() MentalModelTrigger { + if o == nil || IsNil(o.Trigger) { + var ret MentalModelTrigger + return ret + } + return *o.Trigger +} + +// GetTriggerOk returns a tuple with the Trigger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateMentalModelRequest) GetTriggerOk() (*MentalModelTrigger, bool) { + if o == nil || IsNil(o.Trigger) { + return nil, false + } + return o.Trigger, true +} + +// HasTrigger returns a boolean if a field has been set. +func (o *CreateMentalModelRequest) HasTrigger() bool { + if o != nil && !IsNil(o.Trigger) { + return true + } + + return false +} + +// SetTrigger gets a reference to the given MentalModelTrigger and assigns it to the Trigger field. +func (o *CreateMentalModelRequest) SetTrigger(v MentalModelTrigger) { + o.Trigger = &v +} + +func (o CreateMentalModelRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateMentalModelRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Id.IsSet() { + toSerialize["id"] = o.Id.Get() + } + toSerialize["name"] = o.Name + toSerialize["source_query"] = o.SourceQuery + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.MaxTokens) { + toSerialize["max_tokens"] = o.MaxTokens + } + if !IsNil(o.Trigger) { + toSerialize["trigger"] = o.Trigger + } + return toSerialize, nil +} + +func (o *CreateMentalModelRequest) 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{ + "name", + "source_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) + } + } + + varCreateMentalModelRequest := _CreateMentalModelRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateMentalModelRequest) + + if err != nil { + return err + } + + *o = CreateMentalModelRequest(varCreateMentalModelRequest) + + return err +} + +type NullableCreateMentalModelRequest struct { + value *CreateMentalModelRequest + isSet bool +} + +func (v NullableCreateMentalModelRequest) Get() *CreateMentalModelRequest { + return v.value +} + +func (v *NullableCreateMentalModelRequest) Set(val *CreateMentalModelRequest) { + v.value = val + v.isSet = true +} + +func (v NullableCreateMentalModelRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateMentalModelRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateMentalModelRequest(val *CreateMentalModelRequest) *NullableCreateMentalModelRequest { + return &NullableCreateMentalModelRequest{value: val, isSet: true} +} + +func (v NullableCreateMentalModelRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateMentalModelRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_create_mental_model_response.go b/hindsight-clients/go/model_create_mental_model_response.go new file mode 100644 index 00000000..9f2500d3 --- /dev/null +++ b/hindsight-clients/go/model_create_mental_model_response.go @@ -0,0 +1,205 @@ +/* +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 CreateMentalModelResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateMentalModelResponse{} + +// CreateMentalModelResponse Response model for mental model creation. +type CreateMentalModelResponse struct { + MentalModelId NullableString `json:"mental_model_id,omitempty"` + // Operation ID to track refresh progress + OperationId string `json:"operation_id"` +} + +type _CreateMentalModelResponse CreateMentalModelResponse + +// NewCreateMentalModelResponse instantiates a new CreateMentalModelResponse 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 NewCreateMentalModelResponse(operationId string) *CreateMentalModelResponse { + this := CreateMentalModelResponse{} + this.OperationId = operationId + return &this +} + +// NewCreateMentalModelResponseWithDefaults instantiates a new CreateMentalModelResponse 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 NewCreateMentalModelResponseWithDefaults() *CreateMentalModelResponse { + this := CreateMentalModelResponse{} + return &this +} + +// GetMentalModelId returns the MentalModelId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CreateMentalModelResponse) GetMentalModelId() string { + if o == nil || IsNil(o.MentalModelId.Get()) { + var ret string + return ret + } + return *o.MentalModelId.Get() +} + +// GetMentalModelIdOk returns a tuple with the MentalModelId 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 *CreateMentalModelResponse) GetMentalModelIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.MentalModelId.Get(), o.MentalModelId.IsSet() +} + +// HasMentalModelId returns a boolean if a field has been set. +func (o *CreateMentalModelResponse) HasMentalModelId() bool { + if o != nil && o.MentalModelId.IsSet() { + return true + } + + return false +} + +// SetMentalModelId gets a reference to the given NullableString and assigns it to the MentalModelId field. +func (o *CreateMentalModelResponse) SetMentalModelId(v string) { + o.MentalModelId.Set(&v) +} +// SetMentalModelIdNil sets the value for MentalModelId to be an explicit nil +func (o *CreateMentalModelResponse) SetMentalModelIdNil() { + o.MentalModelId.Set(nil) +} + +// UnsetMentalModelId ensures that no value is present for MentalModelId, not even an explicit nil +func (o *CreateMentalModelResponse) UnsetMentalModelId() { + o.MentalModelId.Unset() +} + +// GetOperationId returns the OperationId field value +func (o *CreateMentalModelResponse) 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 *CreateMentalModelResponse) GetOperationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OperationId, true +} + +// SetOperationId sets field value +func (o *CreateMentalModelResponse) SetOperationId(v string) { + o.OperationId = v +} + +func (o CreateMentalModelResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateMentalModelResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.MentalModelId.IsSet() { + toSerialize["mental_model_id"] = o.MentalModelId.Get() + } + toSerialize["operation_id"] = o.OperationId + return toSerialize, nil +} + +func (o *CreateMentalModelResponse) 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", + } + + 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) + } + } + + varCreateMentalModelResponse := _CreateMentalModelResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateMentalModelResponse) + + if err != nil { + return err + } + + *o = CreateMentalModelResponse(varCreateMentalModelResponse) + + return err +} + +type NullableCreateMentalModelResponse struct { + value *CreateMentalModelResponse + isSet bool +} + +func (v NullableCreateMentalModelResponse) Get() *CreateMentalModelResponse { + return v.value +} + +func (v *NullableCreateMentalModelResponse) Set(val *CreateMentalModelResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateMentalModelResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateMentalModelResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateMentalModelResponse(val *CreateMentalModelResponse) *NullableCreateMentalModelResponse { + return &NullableCreateMentalModelResponse{value: val, isSet: true} +} + +func (v NullableCreateMentalModelResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateMentalModelResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_delete_document_response.go b/hindsight-clients/go/model_delete_document_response.go new file mode 100644 index 00000000..7455756a --- /dev/null +++ b/hindsight-clients/go/model_delete_document_response.go @@ -0,0 +1,242 @@ +/* +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 DeleteDocumentResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteDocumentResponse{} + +// DeleteDocumentResponse Response model for delete document endpoint. +type DeleteDocumentResponse struct { + Success bool `json:"success"` + Message string `json:"message"` + DocumentId string `json:"document_id"` + MemoryUnitsDeleted int32 `json:"memory_units_deleted"` +} + +type _DeleteDocumentResponse DeleteDocumentResponse + +// NewDeleteDocumentResponse instantiates a new DeleteDocumentResponse 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 NewDeleteDocumentResponse(success bool, message string, documentId string, memoryUnitsDeleted int32) *DeleteDocumentResponse { + this := DeleteDocumentResponse{} + this.Success = success + this.Message = message + this.DocumentId = documentId + this.MemoryUnitsDeleted = memoryUnitsDeleted + return &this +} + +// NewDeleteDocumentResponseWithDefaults instantiates a new DeleteDocumentResponse 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 NewDeleteDocumentResponseWithDefaults() *DeleteDocumentResponse { + this := DeleteDocumentResponse{} + return &this +} + +// GetSuccess returns the Success field value +func (o *DeleteDocumentResponse) GetSuccess() bool { + if o == nil { + var ret bool + return ret + } + + return o.Success +} + +// GetSuccessOk returns a tuple with the Success field value +// and a boolean to check if the value has been set. +func (o *DeleteDocumentResponse) GetSuccessOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Success, true +} + +// SetSuccess sets field value +func (o *DeleteDocumentResponse) SetSuccess(v bool) { + o.Success = v +} + +// GetMessage returns the Message field value +func (o *DeleteDocumentResponse) GetMessage() string { + if o == nil { + var ret string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *DeleteDocumentResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Message, true +} + +// SetMessage sets field value +func (o *DeleteDocumentResponse) SetMessage(v string) { + o.Message = v +} + +// GetDocumentId returns the DocumentId field value +func (o *DeleteDocumentResponse) GetDocumentId() string { + if o == nil { + var ret string + return ret + } + + return o.DocumentId +} + +// GetDocumentIdOk returns a tuple with the DocumentId field value +// and a boolean to check if the value has been set. +func (o *DeleteDocumentResponse) GetDocumentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DocumentId, true +} + +// SetDocumentId sets field value +func (o *DeleteDocumentResponse) SetDocumentId(v string) { + o.DocumentId = v +} + +// GetMemoryUnitsDeleted returns the MemoryUnitsDeleted field value +func (o *DeleteDocumentResponse) GetMemoryUnitsDeleted() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryUnitsDeleted +} + +// GetMemoryUnitsDeletedOk returns a tuple with the MemoryUnitsDeleted field value +// and a boolean to check if the value has been set. +func (o *DeleteDocumentResponse) GetMemoryUnitsDeletedOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryUnitsDeleted, true +} + +// SetMemoryUnitsDeleted sets field value +func (o *DeleteDocumentResponse) SetMemoryUnitsDeleted(v int32) { + o.MemoryUnitsDeleted = v +} + +func (o DeleteDocumentResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteDocumentResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["success"] = o.Success + toSerialize["message"] = o.Message + toSerialize["document_id"] = o.DocumentId + toSerialize["memory_units_deleted"] = o.MemoryUnitsDeleted + return toSerialize, nil +} + +func (o *DeleteDocumentResponse) 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{ + "success", + "message", + "document_id", + "memory_units_deleted", + } + + 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) + } + } + + varDeleteDocumentResponse := _DeleteDocumentResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDeleteDocumentResponse) + + if err != nil { + return err + } + + *o = DeleteDocumentResponse(varDeleteDocumentResponse) + + return err +} + +type NullableDeleteDocumentResponse struct { + value *DeleteDocumentResponse + isSet bool +} + +func (v NullableDeleteDocumentResponse) Get() *DeleteDocumentResponse { + return v.value +} + +func (v *NullableDeleteDocumentResponse) Set(val *DeleteDocumentResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteDocumentResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteDocumentResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteDocumentResponse(val *DeleteDocumentResponse) *NullableDeleteDocumentResponse { + return &NullableDeleteDocumentResponse{value: val, isSet: true} +} + +func (v NullableDeleteDocumentResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteDocumentResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_delete_response.go b/hindsight-clients/go/model_delete_response.go new file mode 100644 index 00000000..6903e90e --- /dev/null +++ b/hindsight-clients/go/model_delete_response.go @@ -0,0 +1,250 @@ +/* +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 DeleteResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteResponse{} + +// DeleteResponse Response model for delete operations. +type DeleteResponse struct { + Success bool `json:"success"` + Message NullableString `json:"message,omitempty"` + DeletedCount NullableInt32 `json:"deleted_count,omitempty"` +} + +type _DeleteResponse DeleteResponse + +// NewDeleteResponse instantiates a new DeleteResponse 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 NewDeleteResponse(success bool) *DeleteResponse { + this := DeleteResponse{} + this.Success = success + return &this +} + +// NewDeleteResponseWithDefaults instantiates a new DeleteResponse 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 NewDeleteResponseWithDefaults() *DeleteResponse { + this := DeleteResponse{} + return &this +} + +// GetSuccess returns the Success field value +func (o *DeleteResponse) GetSuccess() bool { + if o == nil { + var ret bool + return ret + } + + return o.Success +} + +// GetSuccessOk returns a tuple with the Success field value +// and a boolean to check if the value has been set. +func (o *DeleteResponse) GetSuccessOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Success, true +} + +// SetSuccess sets field value +func (o *DeleteResponse) SetSuccess(v bool) { + o.Success = v +} + +// GetMessage returns the Message field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DeleteResponse) GetMessage() string { + if o == nil || IsNil(o.Message.Get()) { + var ret string + return ret + } + return *o.Message.Get() +} + +// GetMessageOk returns a tuple with the Message 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 *DeleteResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message.Get(), o.Message.IsSet() +} + +// HasMessage returns a boolean if a field has been set. +func (o *DeleteResponse) HasMessage() bool { + if o != nil && o.Message.IsSet() { + return true + } + + return false +} + +// SetMessage gets a reference to the given NullableString and assigns it to the Message field. +func (o *DeleteResponse) SetMessage(v string) { + o.Message.Set(&v) +} +// SetMessageNil sets the value for Message to be an explicit nil +func (o *DeleteResponse) SetMessageNil() { + o.Message.Set(nil) +} + +// UnsetMessage ensures that no value is present for Message, not even an explicit nil +func (o *DeleteResponse) UnsetMessage() { + o.Message.Unset() +} + +// GetDeletedCount returns the DeletedCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DeleteResponse) GetDeletedCount() int32 { + if o == nil || IsNil(o.DeletedCount.Get()) { + var ret int32 + return ret + } + return *o.DeletedCount.Get() +} + +// GetDeletedCountOk returns a tuple with the DeletedCount 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 *DeleteResponse) GetDeletedCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.DeletedCount.Get(), o.DeletedCount.IsSet() +} + +// HasDeletedCount returns a boolean if a field has been set. +func (o *DeleteResponse) HasDeletedCount() bool { + if o != nil && o.DeletedCount.IsSet() { + return true + } + + return false +} + +// SetDeletedCount gets a reference to the given NullableInt32 and assigns it to the DeletedCount field. +func (o *DeleteResponse) SetDeletedCount(v int32) { + o.DeletedCount.Set(&v) +} +// SetDeletedCountNil sets the value for DeletedCount to be an explicit nil +func (o *DeleteResponse) SetDeletedCountNil() { + o.DeletedCount.Set(nil) +} + +// UnsetDeletedCount ensures that no value is present for DeletedCount, not even an explicit nil +func (o *DeleteResponse) UnsetDeletedCount() { + o.DeletedCount.Unset() +} + +func (o DeleteResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DeleteResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["success"] = o.Success + if o.Message.IsSet() { + toSerialize["message"] = o.Message.Get() + } + if o.DeletedCount.IsSet() { + toSerialize["deleted_count"] = o.DeletedCount.Get() + } + return toSerialize, nil +} + +func (o *DeleteResponse) 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{ + "success", + } + + 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) + } + } + + varDeleteResponse := _DeleteResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDeleteResponse) + + if err != nil { + return err + } + + *o = DeleteResponse(varDeleteResponse) + + return err +} + +type NullableDeleteResponse struct { + value *DeleteResponse + isSet bool +} + +func (v NullableDeleteResponse) Get() *DeleteResponse { + return v.value +} + +func (v *NullableDeleteResponse) Set(val *DeleteResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteResponse(val *DeleteResponse) *NullableDeleteResponse { + return &NullableDeleteResponse{value: val, isSet: true} +} + +func (v NullableDeleteResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_directive_list_response.go b/hindsight-clients/go/model_directive_list_response.go new file mode 100644 index 00000000..c19ccfb3 --- /dev/null +++ b/hindsight-clients/go/model_directive_list_response.go @@ -0,0 +1,158 @@ +/* +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 DirectiveListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DirectiveListResponse{} + +// DirectiveListResponse Response model for listing directives. +type DirectiveListResponse struct { + Items []DirectiveResponse `json:"items"` +} + +type _DirectiveListResponse DirectiveListResponse + +// NewDirectiveListResponse instantiates a new DirectiveListResponse 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 NewDirectiveListResponse(items []DirectiveResponse) *DirectiveListResponse { + this := DirectiveListResponse{} + this.Items = items + return &this +} + +// NewDirectiveListResponseWithDefaults instantiates a new DirectiveListResponse 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 NewDirectiveListResponseWithDefaults() *DirectiveListResponse { + this := DirectiveListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *DirectiveListResponse) GetItems() []DirectiveResponse { + if o == nil { + var ret []DirectiveResponse + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *DirectiveListResponse) GetItemsOk() ([]DirectiveResponse, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *DirectiveListResponse) SetItems(v []DirectiveResponse) { + o.Items = v +} + +func (o DirectiveListResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DirectiveListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +func (o *DirectiveListResponse) 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{ + "items", + } + + 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) + } + } + + varDirectiveListResponse := _DirectiveListResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDirectiveListResponse) + + if err != nil { + return err + } + + *o = DirectiveListResponse(varDirectiveListResponse) + + return err +} + +type NullableDirectiveListResponse struct { + value *DirectiveListResponse + isSet bool +} + +func (v NullableDirectiveListResponse) Get() *DirectiveListResponse { + return v.value +} + +func (v *NullableDirectiveListResponse) Set(val *DirectiveListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDirectiveListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDirectiveListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDirectiveListResponse(val *DirectiveListResponse) *NullableDirectiveListResponse { + return &NullableDirectiveListResponse{value: val, isSet: true} +} + +func (v NullableDirectiveListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDirectiveListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_directive_response.go b/hindsight-clients/go/model_directive_response.go new file mode 100644 index 00000000..24da6312 --- /dev/null +++ b/hindsight-clients/go/model_directive_response.go @@ -0,0 +1,450 @@ +/* +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 DirectiveResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DirectiveResponse{} + +// DirectiveResponse Response model for a directive. +type DirectiveResponse struct { + Id string `json:"id"` + BankId string `json:"bank_id"` + Name string `json:"name"` + Content string `json:"content"` + Priority *int32 `json:"priority,omitempty"` + IsActive *bool `json:"is_active,omitempty"` + Tags []string `json:"tags,omitempty"` + CreatedAt NullableString `json:"created_at,omitempty"` + UpdatedAt NullableString `json:"updated_at,omitempty"` +} + +type _DirectiveResponse DirectiveResponse + +// NewDirectiveResponse instantiates a new DirectiveResponse 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 NewDirectiveResponse(id string, bankId string, name string, content string) *DirectiveResponse { + this := DirectiveResponse{} + this.Id = id + this.BankId = bankId + this.Name = name + this.Content = content + var priority int32 = 0 + this.Priority = &priority + var isActive bool = true + this.IsActive = &isActive + return &this +} + +// NewDirectiveResponseWithDefaults instantiates a new DirectiveResponse 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 NewDirectiveResponseWithDefaults() *DirectiveResponse { + this := DirectiveResponse{} + var priority int32 = 0 + this.Priority = &priority + var isActive bool = true + this.IsActive = &isActive + return &this +} + +// GetId returns the Id field value +func (o *DirectiveResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *DirectiveResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *DirectiveResponse) SetId(v string) { + o.Id = v +} + +// GetBankId returns the BankId field value +func (o *DirectiveResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *DirectiveResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *DirectiveResponse) SetBankId(v string) { + o.BankId = v +} + +// GetName returns the Name field value +func (o *DirectiveResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *DirectiveResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *DirectiveResponse) SetName(v string) { + o.Name = v +} + +// GetContent returns the Content field value +func (o *DirectiveResponse) GetContent() string { + if o == nil { + var ret string + return ret + } + + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *DirectiveResponse) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value +func (o *DirectiveResponse) SetContent(v string) { + o.Content = v +} + +// GetPriority returns the Priority field value if set, zero value otherwise. +func (o *DirectiveResponse) GetPriority() int32 { + if o == nil || IsNil(o.Priority) { + var ret int32 + return ret + } + return *o.Priority +} + +// GetPriorityOk returns a tuple with the Priority field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DirectiveResponse) GetPriorityOk() (*int32, bool) { + if o == nil || IsNil(o.Priority) { + return nil, false + } + return o.Priority, true +} + +// HasPriority returns a boolean if a field has been set. +func (o *DirectiveResponse) HasPriority() bool { + if o != nil && !IsNil(o.Priority) { + return true + } + + return false +} + +// SetPriority gets a reference to the given int32 and assigns it to the Priority field. +func (o *DirectiveResponse) SetPriority(v int32) { + o.Priority = &v +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise. +func (o *DirectiveResponse) GetIsActive() bool { + if o == nil || IsNil(o.IsActive) { + var ret bool + return ret + } + return *o.IsActive +} + +// GetIsActiveOk returns a tuple with the IsActive field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DirectiveResponse) GetIsActiveOk() (*bool, bool) { + if o == nil || IsNil(o.IsActive) { + return nil, false + } + return o.IsActive, true +} + +// HasIsActive returns a boolean if a field has been set. +func (o *DirectiveResponse) HasIsActive() bool { + if o != nil && !IsNil(o.IsActive) { + return true + } + + return false +} + +// SetIsActive gets a reference to the given bool and assigns it to the IsActive field. +func (o *DirectiveResponse) SetIsActive(v bool) { + o.IsActive = &v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DirectiveResponse) GetTags() []string { + if o == nil || IsNil(o.Tags) { + 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. +func (o *DirectiveResponse) 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 *DirectiveResponse) 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 *DirectiveResponse) SetTags(v []string) { + o.Tags = v +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DirectiveResponse) 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 *DirectiveResponse) 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 *DirectiveResponse) 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 *DirectiveResponse) SetCreatedAt(v string) { + o.CreatedAt.Set(&v) +} +// SetCreatedAtNil sets the value for CreatedAt to be an explicit nil +func (o *DirectiveResponse) SetCreatedAtNil() { + o.CreatedAt.Set(nil) +} + +// UnsetCreatedAt ensures that no value is present for CreatedAt, not even an explicit nil +func (o *DirectiveResponse) 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 *DirectiveResponse) 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 *DirectiveResponse) 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 *DirectiveResponse) 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 *DirectiveResponse) SetUpdatedAt(v string) { + o.UpdatedAt.Set(&v) +} +// SetUpdatedAtNil sets the value for UpdatedAt to be an explicit nil +func (o *DirectiveResponse) SetUpdatedAtNil() { + o.UpdatedAt.Set(nil) +} + +// UnsetUpdatedAt ensures that no value is present for UpdatedAt, not even an explicit nil +func (o *DirectiveResponse) UnsetUpdatedAt() { + o.UpdatedAt.Unset() +} + +func (o DirectiveResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DirectiveResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["bank_id"] = o.BankId + toSerialize["name"] = o.Name + toSerialize["content"] = o.Content + if !IsNil(o.Priority) { + toSerialize["priority"] = o.Priority + } + if !IsNil(o.IsActive) { + toSerialize["is_active"] = o.IsActive + } + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if o.CreatedAt.IsSet() { + toSerialize["created_at"] = o.CreatedAt.Get() + } + if o.UpdatedAt.IsSet() { + toSerialize["updated_at"] = o.UpdatedAt.Get() + } + return toSerialize, nil +} + +func (o *DirectiveResponse) 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{ + "id", + "bank_id", + "name", + "content", + } + + 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) + } + } + + varDirectiveResponse := _DirectiveResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDirectiveResponse) + + if err != nil { + return err + } + + *o = DirectiveResponse(varDirectiveResponse) + + return err +} + +type NullableDirectiveResponse struct { + value *DirectiveResponse + isSet bool +} + +func (v NullableDirectiveResponse) Get() *DirectiveResponse { + return v.value +} + +func (v *NullableDirectiveResponse) Set(val *DirectiveResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDirectiveResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDirectiveResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDirectiveResponse(val *DirectiveResponse) *NullableDirectiveResponse { + return &NullableDirectiveResponse{value: val, isSet: true} +} + +func (v NullableDirectiveResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDirectiveResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_disposition_traits.go b/hindsight-clients/go/model_disposition_traits.go new file mode 100644 index 00000000..aafb13c1 --- /dev/null +++ b/hindsight-clients/go/model_disposition_traits.go @@ -0,0 +1,217 @@ +/* +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 DispositionTraits type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DispositionTraits{} + +// DispositionTraits Disposition traits that influence how memories are formed and interpreted. +type DispositionTraits struct { + // How skeptical vs trusting (1=trusting, 5=skeptical) + Skepticism int32 `json:"skepticism"` + // How literally to interpret information (1=flexible, 5=literal) + Literalism int32 `json:"literalism"` + // How much to consider emotional context (1=detached, 5=empathetic) + Empathy int32 `json:"empathy"` +} + +type _DispositionTraits DispositionTraits + +// NewDispositionTraits instantiates a new DispositionTraits 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 NewDispositionTraits(skepticism int32, literalism int32, empathy int32) *DispositionTraits { + this := DispositionTraits{} + this.Skepticism = skepticism + this.Literalism = literalism + this.Empathy = empathy + return &this +} + +// NewDispositionTraitsWithDefaults instantiates a new DispositionTraits 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 NewDispositionTraitsWithDefaults() *DispositionTraits { + this := DispositionTraits{} + return &this +} + +// GetSkepticism returns the Skepticism field value +func (o *DispositionTraits) GetSkepticism() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Skepticism +} + +// GetSkepticismOk returns a tuple with the Skepticism field value +// and a boolean to check if the value has been set. +func (o *DispositionTraits) GetSkepticismOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Skepticism, true +} + +// SetSkepticism sets field value +func (o *DispositionTraits) SetSkepticism(v int32) { + o.Skepticism = v +} + +// GetLiteralism returns the Literalism field value +func (o *DispositionTraits) GetLiteralism() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Literalism +} + +// GetLiteralismOk returns a tuple with the Literalism field value +// and a boolean to check if the value has been set. +func (o *DispositionTraits) GetLiteralismOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Literalism, true +} + +// SetLiteralism sets field value +func (o *DispositionTraits) SetLiteralism(v int32) { + o.Literalism = v +} + +// GetEmpathy returns the Empathy field value +func (o *DispositionTraits) GetEmpathy() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Empathy +} + +// GetEmpathyOk returns a tuple with the Empathy field value +// and a boolean to check if the value has been set. +func (o *DispositionTraits) GetEmpathyOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Empathy, true +} + +// SetEmpathy sets field value +func (o *DispositionTraits) SetEmpathy(v int32) { + o.Empathy = v +} + +func (o DispositionTraits) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DispositionTraits) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["skepticism"] = o.Skepticism + toSerialize["literalism"] = o.Literalism + toSerialize["empathy"] = o.Empathy + return toSerialize, nil +} + +func (o *DispositionTraits) 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{ + "skepticism", + "literalism", + "empathy", + } + + 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) + } + } + + varDispositionTraits := _DispositionTraits{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDispositionTraits) + + if err != nil { + return err + } + + *o = DispositionTraits(varDispositionTraits) + + return err +} + +type NullableDispositionTraits struct { + value *DispositionTraits + isSet bool +} + +func (v NullableDispositionTraits) Get() *DispositionTraits { + return v.value +} + +func (v *NullableDispositionTraits) Set(val *DispositionTraits) { + v.value = val + v.isSet = true +} + +func (v NullableDispositionTraits) IsSet() bool { + return v.isSet +} + +func (v *NullableDispositionTraits) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDispositionTraits(val *DispositionTraits) *NullableDispositionTraits { + return &NullableDispositionTraits{value: val, isSet: true} +} + +func (v NullableDispositionTraits) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDispositionTraits) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_document_response.go b/hindsight-clients/go/model_document_response.go new file mode 100644 index 00000000..9a0aa92d --- /dev/null +++ b/hindsight-clients/go/model_document_response.go @@ -0,0 +1,365 @@ +/* +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 DocumentResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DocumentResponse{} + +// DocumentResponse Response model for get document endpoint. +type DocumentResponse struct { + Id string `json:"id"` + BankId string `json:"bank_id"` + OriginalText string `json:"original_text"` + ContentHash NullableString `json:"content_hash"` + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` + MemoryUnitCount int32 `json:"memory_unit_count"` + // Tags associated with this document + Tags []string `json:"tags,omitempty"` +} + +type _DocumentResponse DocumentResponse + +// NewDocumentResponse instantiates a new DocumentResponse 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 NewDocumentResponse(id string, bankId string, originalText string, contentHash NullableString, createdAt string, updatedAt string, memoryUnitCount int32) *DocumentResponse { + this := DocumentResponse{} + this.Id = id + this.BankId = bankId + this.OriginalText = originalText + this.ContentHash = contentHash + this.CreatedAt = createdAt + this.UpdatedAt = updatedAt + this.MemoryUnitCount = memoryUnitCount + return &this +} + +// NewDocumentResponseWithDefaults instantiates a new DocumentResponse 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 NewDocumentResponseWithDefaults() *DocumentResponse { + this := DocumentResponse{} + return &this +} + +// GetId returns the Id field value +func (o *DocumentResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *DocumentResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *DocumentResponse) SetId(v string) { + o.Id = v +} + +// GetBankId returns the BankId field value +func (o *DocumentResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *DocumentResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *DocumentResponse) SetBankId(v string) { + o.BankId = v +} + +// GetOriginalText returns the OriginalText field value +func (o *DocumentResponse) GetOriginalText() string { + if o == nil { + var ret string + return ret + } + + return o.OriginalText +} + +// GetOriginalTextOk returns a tuple with the OriginalText field value +// and a boolean to check if the value has been set. +func (o *DocumentResponse) GetOriginalTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.OriginalText, true +} + +// SetOriginalText sets field value +func (o *DocumentResponse) SetOriginalText(v string) { + o.OriginalText = v +} + +// GetContentHash returns the ContentHash field value +// If the value is explicit nil, the zero value for string will be returned +func (o *DocumentResponse) GetContentHash() string { + if o == nil || o.ContentHash.Get() == nil { + var ret string + return ret + } + + return *o.ContentHash.Get() +} + +// GetContentHashOk returns a tuple with the ContentHash field value +// 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 *DocumentResponse) GetContentHashOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ContentHash.Get(), o.ContentHash.IsSet() +} + +// SetContentHash sets field value +func (o *DocumentResponse) SetContentHash(v string) { + o.ContentHash.Set(&v) +} + +// GetCreatedAt returns the CreatedAt field value +func (o *DocumentResponse) GetCreatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *DocumentResponse) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *DocumentResponse) SetCreatedAt(v string) { + o.CreatedAt = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *DocumentResponse) GetUpdatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *DocumentResponse) GetUpdatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *DocumentResponse) SetUpdatedAt(v string) { + o.UpdatedAt = v +} + +// GetMemoryUnitCount returns the MemoryUnitCount field value +func (o *DocumentResponse) GetMemoryUnitCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MemoryUnitCount +} + +// GetMemoryUnitCountOk returns a tuple with the MemoryUnitCount field value +// and a boolean to check if the value has been set. +func (o *DocumentResponse) GetMemoryUnitCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MemoryUnitCount, true +} + +// SetMemoryUnitCount sets field value +func (o *DocumentResponse) SetMemoryUnitCount(v int32) { + o.MemoryUnitCount = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *DocumentResponse) GetTags() []string { + if o == nil || IsNil(o.Tags) { + 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. +func (o *DocumentResponse) 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 *DocumentResponse) 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 *DocumentResponse) SetTags(v []string) { + o.Tags = v +} + +func (o DocumentResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DocumentResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["bank_id"] = o.BankId + toSerialize["original_text"] = o.OriginalText + toSerialize["content_hash"] = o.ContentHash.Get() + toSerialize["created_at"] = o.CreatedAt + toSerialize["updated_at"] = o.UpdatedAt + toSerialize["memory_unit_count"] = o.MemoryUnitCount + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + return toSerialize, nil +} + +func (o *DocumentResponse) 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{ + "id", + "bank_id", + "original_text", + "content_hash", + "created_at", + "updated_at", + "memory_unit_count", + } + + 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) + } + } + + varDocumentResponse := _DocumentResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varDocumentResponse) + + if err != nil { + return err + } + + *o = DocumentResponse(varDocumentResponse) + + return err +} + +type NullableDocumentResponse struct { + value *DocumentResponse + isSet bool +} + +func (v NullableDocumentResponse) Get() *DocumentResponse { + return v.value +} + +func (v *NullableDocumentResponse) Set(val *DocumentResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDocumentResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDocumentResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDocumentResponse(val *DocumentResponse) *NullableDocumentResponse { + return &NullableDocumentResponse{value: val, isSet: true} +} + +func (v NullableDocumentResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDocumentResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_entity_detail_response.go b/hindsight-clients/go/model_entity_detail_response.go new file mode 100644 index 00000000..14bc06cb --- /dev/null +++ b/hindsight-clients/go/model_entity_detail_response.go @@ -0,0 +1,371 @@ +/* +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 EntityDetailResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EntityDetailResponse{} + +// EntityDetailResponse Response model for entity detail endpoint. +type EntityDetailResponse struct { + Id string `json:"id"` + CanonicalName string `json:"canonical_name"` + MentionCount int32 `json:"mention_count"` + FirstSeen NullableString `json:"first_seen,omitempty"` + LastSeen NullableString `json:"last_seen,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` + Observations []EntityObservationResponse `json:"observations"` +} + +type _EntityDetailResponse EntityDetailResponse + +// NewEntityDetailResponse instantiates a new EntityDetailResponse 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 NewEntityDetailResponse(id string, canonicalName string, mentionCount int32, observations []EntityObservationResponse) *EntityDetailResponse { + this := EntityDetailResponse{} + this.Id = id + this.CanonicalName = canonicalName + this.MentionCount = mentionCount + this.Observations = observations + return &this +} + +// NewEntityDetailResponseWithDefaults instantiates a new EntityDetailResponse 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 NewEntityDetailResponseWithDefaults() *EntityDetailResponse { + this := EntityDetailResponse{} + return &this +} + +// GetId returns the Id field value +func (o *EntityDetailResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *EntityDetailResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *EntityDetailResponse) SetId(v string) { + o.Id = v +} + +// GetCanonicalName returns the CanonicalName field value +func (o *EntityDetailResponse) GetCanonicalName() string { + if o == nil { + var ret string + return ret + } + + return o.CanonicalName +} + +// GetCanonicalNameOk returns a tuple with the CanonicalName field value +// and a boolean to check if the value has been set. +func (o *EntityDetailResponse) GetCanonicalNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CanonicalName, true +} + +// SetCanonicalName sets field value +func (o *EntityDetailResponse) SetCanonicalName(v string) { + o.CanonicalName = v +} + +// GetMentionCount returns the MentionCount field value +func (o *EntityDetailResponse) GetMentionCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MentionCount +} + +// GetMentionCountOk returns a tuple with the MentionCount field value +// and a boolean to check if the value has been set. +func (o *EntityDetailResponse) GetMentionCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MentionCount, true +} + +// SetMentionCount sets field value +func (o *EntityDetailResponse) SetMentionCount(v int32) { + o.MentionCount = v +} + +// GetFirstSeen returns the FirstSeen field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityDetailResponse) GetFirstSeen() string { + if o == nil || IsNil(o.FirstSeen.Get()) { + var ret string + return ret + } + return *o.FirstSeen.Get() +} + +// GetFirstSeenOk returns a tuple with the FirstSeen 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 *EntityDetailResponse) GetFirstSeenOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.FirstSeen.Get(), o.FirstSeen.IsSet() +} + +// HasFirstSeen returns a boolean if a field has been set. +func (o *EntityDetailResponse) HasFirstSeen() bool { + if o != nil && o.FirstSeen.IsSet() { + return true + } + + return false +} + +// SetFirstSeen gets a reference to the given NullableString and assigns it to the FirstSeen field. +func (o *EntityDetailResponse) SetFirstSeen(v string) { + o.FirstSeen.Set(&v) +} +// SetFirstSeenNil sets the value for FirstSeen to be an explicit nil +func (o *EntityDetailResponse) SetFirstSeenNil() { + o.FirstSeen.Set(nil) +} + +// UnsetFirstSeen ensures that no value is present for FirstSeen, not even an explicit nil +func (o *EntityDetailResponse) UnsetFirstSeen() { + o.FirstSeen.Unset() +} + +// GetLastSeen returns the LastSeen field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityDetailResponse) GetLastSeen() string { + if o == nil || IsNil(o.LastSeen.Get()) { + var ret string + return ret + } + return *o.LastSeen.Get() +} + +// GetLastSeenOk returns a tuple with the LastSeen 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 *EntityDetailResponse) GetLastSeenOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastSeen.Get(), o.LastSeen.IsSet() +} + +// HasLastSeen returns a boolean if a field has been set. +func (o *EntityDetailResponse) HasLastSeen() bool { + if o != nil && o.LastSeen.IsSet() { + return true + } + + return false +} + +// SetLastSeen gets a reference to the given NullableString and assigns it to the LastSeen field. +func (o *EntityDetailResponse) SetLastSeen(v string) { + o.LastSeen.Set(&v) +} +// SetLastSeenNil sets the value for LastSeen to be an explicit nil +func (o *EntityDetailResponse) SetLastSeenNil() { + o.LastSeen.Set(nil) +} + +// UnsetLastSeen ensures that no value is present for LastSeen, not even an explicit nil +func (o *EntityDetailResponse) UnsetLastSeen() { + o.LastSeen.Unset() +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityDetailResponse) GetMetadata() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata 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 *EntityDetailResponse) GetMetadataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Metadata) { + return map[string]interface{}{}, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *EntityDetailResponse) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *EntityDetailResponse) SetMetadata(v map[string]interface{}) { + o.Metadata = v +} + +// GetObservations returns the Observations field value +func (o *EntityDetailResponse) GetObservations() []EntityObservationResponse { + if o == nil { + var ret []EntityObservationResponse + return ret + } + + return o.Observations +} + +// GetObservationsOk returns a tuple with the Observations field value +// and a boolean to check if the value has been set. +func (o *EntityDetailResponse) GetObservationsOk() ([]EntityObservationResponse, bool) { + if o == nil { + return nil, false + } + return o.Observations, true +} + +// SetObservations sets field value +func (o *EntityDetailResponse) SetObservations(v []EntityObservationResponse) { + o.Observations = v +} + +func (o EntityDetailResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EntityDetailResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["canonical_name"] = o.CanonicalName + toSerialize["mention_count"] = o.MentionCount + if o.FirstSeen.IsSet() { + toSerialize["first_seen"] = o.FirstSeen.Get() + } + if o.LastSeen.IsSet() { + toSerialize["last_seen"] = o.LastSeen.Get() + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + toSerialize["observations"] = o.Observations + return toSerialize, nil +} + +func (o *EntityDetailResponse) 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{ + "id", + "canonical_name", + "mention_count", + "observations", + } + + 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) + } + } + + varEntityDetailResponse := _EntityDetailResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEntityDetailResponse) + + if err != nil { + return err + } + + *o = EntityDetailResponse(varEntityDetailResponse) + + return err +} + +type NullableEntityDetailResponse struct { + value *EntityDetailResponse + isSet bool +} + +func (v NullableEntityDetailResponse) Get() *EntityDetailResponse { + return v.value +} + +func (v *NullableEntityDetailResponse) Set(val *EntityDetailResponse) { + v.value = val + v.isSet = true +} + +func (v NullableEntityDetailResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableEntityDetailResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntityDetailResponse(val *EntityDetailResponse) *NullableEntityDetailResponse { + return &NullableEntityDetailResponse{value: val, isSet: true} +} + +func (v NullableEntityDetailResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntityDetailResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_entity_include_options.go b/hindsight-clients/go/model_entity_include_options.go new file mode 100644 index 00000000..c82c441d --- /dev/null +++ b/hindsight-clients/go/model_entity_include_options.go @@ -0,0 +1,131 @@ +/* +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" +) + +// checks if the EntityIncludeOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EntityIncludeOptions{} + +// EntityIncludeOptions Options for including entity observations in recall results. +type EntityIncludeOptions struct { + // Maximum tokens for entity observations + MaxTokens *int32 `json:"max_tokens,omitempty"` +} + +// NewEntityIncludeOptions instantiates a new EntityIncludeOptions 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 NewEntityIncludeOptions() *EntityIncludeOptions { + this := EntityIncludeOptions{} + var maxTokens int32 = 500 + this.MaxTokens = &maxTokens + return &this +} + +// NewEntityIncludeOptionsWithDefaults instantiates a new EntityIncludeOptions 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 NewEntityIncludeOptionsWithDefaults() *EntityIncludeOptions { + this := EntityIncludeOptions{} + var maxTokens int32 = 500 + this.MaxTokens = &maxTokens + return &this +} + +// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise. +func (o *EntityIncludeOptions) 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 *EntityIncludeOptions) 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 *EntityIncludeOptions) 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 *EntityIncludeOptions) SetMaxTokens(v int32) { + o.MaxTokens = &v +} + +func (o EntityIncludeOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EntityIncludeOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MaxTokens) { + toSerialize["max_tokens"] = o.MaxTokens + } + return toSerialize, nil +} + +type NullableEntityIncludeOptions struct { + value *EntityIncludeOptions + isSet bool +} + +func (v NullableEntityIncludeOptions) Get() *EntityIncludeOptions { + return v.value +} + +func (v *NullableEntityIncludeOptions) Set(val *EntityIncludeOptions) { + v.value = val + v.isSet = true +} + +func (v NullableEntityIncludeOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableEntityIncludeOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntityIncludeOptions(val *EntityIncludeOptions) *NullableEntityIncludeOptions { + return &NullableEntityIncludeOptions{value: val, isSet: true} +} + +func (v NullableEntityIncludeOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntityIncludeOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_entity_input.go b/hindsight-clients/go/model_entity_input.go new file mode 100644 index 00000000..b7013b88 --- /dev/null +++ b/hindsight-clients/go/model_entity_input.go @@ -0,0 +1,205 @@ +/* +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 EntityInput type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EntityInput{} + +// EntityInput Entity to associate with retained content. +type EntityInput struct { + // The entity name/text + Text string `json:"text"` + Type NullableString `json:"type,omitempty"` +} + +type _EntityInput EntityInput + +// NewEntityInput instantiates a new EntityInput 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 NewEntityInput(text string) *EntityInput { + this := EntityInput{} + this.Text = text + return &this +} + +// NewEntityInputWithDefaults instantiates a new EntityInput 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 NewEntityInputWithDefaults() *EntityInput { + this := EntityInput{} + return &this +} + +// GetText returns the Text field value +func (o *EntityInput) GetText() string { + if o == nil { + var ret string + return ret + } + + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *EntityInput) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value +func (o *EntityInput) SetText(v string) { + o.Text = v +} + +// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityInput) GetType() string { + if o == nil || IsNil(o.Type.Get()) { + var ret string + return ret + } + return *o.Type.Get() +} + +// GetTypeOk returns a tuple with the Type 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 *EntityInput) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type.Get(), o.Type.IsSet() +} + +// HasType returns a boolean if a field has been set. +func (o *EntityInput) HasType() bool { + if o != nil && o.Type.IsSet() { + return true + } + + return false +} + +// SetType gets a reference to the given NullableString and assigns it to the Type field. +func (o *EntityInput) SetType(v string) { + o.Type.Set(&v) +} +// SetTypeNil sets the value for Type to be an explicit nil +func (o *EntityInput) SetTypeNil() { + o.Type.Set(nil) +} + +// UnsetType ensures that no value is present for Type, not even an explicit nil +func (o *EntityInput) UnsetType() { + o.Type.Unset() +} + +func (o EntityInput) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EntityInput) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["text"] = o.Text + if o.Type.IsSet() { + toSerialize["type"] = o.Type.Get() + } + return toSerialize, nil +} + +func (o *EntityInput) 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{ + "text", + } + + 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) + } + } + + varEntityInput := _EntityInput{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEntityInput) + + if err != nil { + return err + } + + *o = EntityInput(varEntityInput) + + return err +} + +type NullableEntityInput struct { + value *EntityInput + isSet bool +} + +func (v NullableEntityInput) Get() *EntityInput { + return v.value +} + +func (v *NullableEntityInput) Set(val *EntityInput) { + v.value = val + v.isSet = true +} + +func (v NullableEntityInput) IsSet() bool { + return v.isSet +} + +func (v *NullableEntityInput) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntityInput(val *EntityInput) *NullableEntityInput { + return &NullableEntityInput{value: val, isSet: true} +} + +func (v NullableEntityInput) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntityInput) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_entity_list_item.go b/hindsight-clients/go/model_entity_list_item.go new file mode 100644 index 00000000..93c956d5 --- /dev/null +++ b/hindsight-clients/go/model_entity_list_item.go @@ -0,0 +1,343 @@ +/* +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 EntityListItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EntityListItem{} + +// EntityListItem Entity list item with summary. +type EntityListItem struct { + Id string `json:"id"` + CanonicalName string `json:"canonical_name"` + MentionCount int32 `json:"mention_count"` + FirstSeen NullableString `json:"first_seen,omitempty"` + LastSeen NullableString `json:"last_seen,omitempty"` + Metadata map[string]interface{} `json:"metadata,omitempty"` +} + +type _EntityListItem EntityListItem + +// NewEntityListItem instantiates a new EntityListItem 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 NewEntityListItem(id string, canonicalName string, mentionCount int32) *EntityListItem { + this := EntityListItem{} + this.Id = id + this.CanonicalName = canonicalName + this.MentionCount = mentionCount + return &this +} + +// NewEntityListItemWithDefaults instantiates a new EntityListItem 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 NewEntityListItemWithDefaults() *EntityListItem { + this := EntityListItem{} + return &this +} + +// GetId returns the Id field value +func (o *EntityListItem) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *EntityListItem) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *EntityListItem) SetId(v string) { + o.Id = v +} + +// GetCanonicalName returns the CanonicalName field value +func (o *EntityListItem) GetCanonicalName() string { + if o == nil { + var ret string + return ret + } + + return o.CanonicalName +} + +// GetCanonicalNameOk returns a tuple with the CanonicalName field value +// and a boolean to check if the value has been set. +func (o *EntityListItem) GetCanonicalNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CanonicalName, true +} + +// SetCanonicalName sets field value +func (o *EntityListItem) SetCanonicalName(v string) { + o.CanonicalName = v +} + +// GetMentionCount returns the MentionCount field value +func (o *EntityListItem) GetMentionCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.MentionCount +} + +// GetMentionCountOk returns a tuple with the MentionCount field value +// and a boolean to check if the value has been set. +func (o *EntityListItem) GetMentionCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.MentionCount, true +} + +// SetMentionCount sets field value +func (o *EntityListItem) SetMentionCount(v int32) { + o.MentionCount = v +} + +// GetFirstSeen returns the FirstSeen field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityListItem) GetFirstSeen() string { + if o == nil || IsNil(o.FirstSeen.Get()) { + var ret string + return ret + } + return *o.FirstSeen.Get() +} + +// GetFirstSeenOk returns a tuple with the FirstSeen 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 *EntityListItem) GetFirstSeenOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.FirstSeen.Get(), o.FirstSeen.IsSet() +} + +// HasFirstSeen returns a boolean if a field has been set. +func (o *EntityListItem) HasFirstSeen() bool { + if o != nil && o.FirstSeen.IsSet() { + return true + } + + return false +} + +// SetFirstSeen gets a reference to the given NullableString and assigns it to the FirstSeen field. +func (o *EntityListItem) SetFirstSeen(v string) { + o.FirstSeen.Set(&v) +} +// SetFirstSeenNil sets the value for FirstSeen to be an explicit nil +func (o *EntityListItem) SetFirstSeenNil() { + o.FirstSeen.Set(nil) +} + +// UnsetFirstSeen ensures that no value is present for FirstSeen, not even an explicit nil +func (o *EntityListItem) UnsetFirstSeen() { + o.FirstSeen.Unset() +} + +// GetLastSeen returns the LastSeen field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityListItem) GetLastSeen() string { + if o == nil || IsNil(o.LastSeen.Get()) { + var ret string + return ret + } + return *o.LastSeen.Get() +} + +// GetLastSeenOk returns a tuple with the LastSeen 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 *EntityListItem) GetLastSeenOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastSeen.Get(), o.LastSeen.IsSet() +} + +// HasLastSeen returns a boolean if a field has been set. +func (o *EntityListItem) HasLastSeen() bool { + if o != nil && o.LastSeen.IsSet() { + return true + } + + return false +} + +// SetLastSeen gets a reference to the given NullableString and assigns it to the LastSeen field. +func (o *EntityListItem) SetLastSeen(v string) { + o.LastSeen.Set(&v) +} +// SetLastSeenNil sets the value for LastSeen to be an explicit nil +func (o *EntityListItem) SetLastSeenNil() { + o.LastSeen.Set(nil) +} + +// UnsetLastSeen ensures that no value is present for LastSeen, not even an explicit nil +func (o *EntityListItem) UnsetLastSeen() { + o.LastSeen.Unset() +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityListItem) GetMetadata() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata 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 *EntityListItem) GetMetadataOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Metadata) { + return map[string]interface{}{}, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *EntityListItem) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]interface{} and assigns it to the Metadata field. +func (o *EntityListItem) SetMetadata(v map[string]interface{}) { + o.Metadata = v +} + +func (o EntityListItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EntityListItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["canonical_name"] = o.CanonicalName + toSerialize["mention_count"] = o.MentionCount + if o.FirstSeen.IsSet() { + toSerialize["first_seen"] = o.FirstSeen.Get() + } + if o.LastSeen.IsSet() { + toSerialize["last_seen"] = o.LastSeen.Get() + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + return toSerialize, nil +} + +func (o *EntityListItem) 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{ + "id", + "canonical_name", + "mention_count", + } + + 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) + } + } + + varEntityListItem := _EntityListItem{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEntityListItem) + + if err != nil { + return err + } + + *o = EntityListItem(varEntityListItem) + + return err +} + +type NullableEntityListItem struct { + value *EntityListItem + isSet bool +} + +func (v NullableEntityListItem) Get() *EntityListItem { + return v.value +} + +func (v *NullableEntityListItem) Set(val *EntityListItem) { + v.value = val + v.isSet = true +} + +func (v NullableEntityListItem) IsSet() bool { + return v.isSet +} + +func (v *NullableEntityListItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntityListItem(val *EntityListItem) *NullableEntityListItem { + return &NullableEntityListItem{value: val, isSet: true} +} + +func (v NullableEntityListItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntityListItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_entity_list_response.go b/hindsight-clients/go/model_entity_list_response.go new file mode 100644 index 00000000..24567e9a --- /dev/null +++ b/hindsight-clients/go/model_entity_list_response.go @@ -0,0 +1,242 @@ +/* +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 EntityListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EntityListResponse{} + +// EntityListResponse Response model for entity list endpoint. +type EntityListResponse struct { + Items []EntityListItem `json:"items"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` +} + +type _EntityListResponse EntityListResponse + +// NewEntityListResponse instantiates a new EntityListResponse 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 NewEntityListResponse(items []EntityListItem, total int32, limit int32, offset int32) *EntityListResponse { + this := EntityListResponse{} + this.Items = items + this.Total = total + this.Limit = limit + this.Offset = offset + return &this +} + +// NewEntityListResponseWithDefaults instantiates a new EntityListResponse 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 NewEntityListResponseWithDefaults() *EntityListResponse { + this := EntityListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *EntityListResponse) GetItems() []EntityListItem { + if o == nil { + var ret []EntityListItem + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *EntityListResponse) GetItemsOk() ([]EntityListItem, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *EntityListResponse) SetItems(v []EntityListItem) { + o.Items = v +} + +// GetTotal returns the Total field value +func (o *EntityListResponse) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *EntityListResponse) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *EntityListResponse) SetTotal(v int32) { + o.Total = v +} + +// GetLimit returns the Limit field value +func (o *EntityListResponse) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *EntityListResponse) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *EntityListResponse) SetLimit(v int32) { + o.Limit = v +} + +// GetOffset returns the Offset field value +func (o *EntityListResponse) GetOffset() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +func (o *EntityListResponse) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Offset, true +} + +// SetOffset sets field value +func (o *EntityListResponse) SetOffset(v int32) { + o.Offset = v +} + +func (o EntityListResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EntityListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + toSerialize["total"] = o.Total + toSerialize["limit"] = o.Limit + toSerialize["offset"] = o.Offset + return toSerialize, nil +} + +func (o *EntityListResponse) 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{ + "items", + "total", + "limit", + "offset", + } + + 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) + } + } + + varEntityListResponse := _EntityListResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEntityListResponse) + + if err != nil { + return err + } + + *o = EntityListResponse(varEntityListResponse) + + return err +} + +type NullableEntityListResponse struct { + value *EntityListResponse + isSet bool +} + +func (v NullableEntityListResponse) Get() *EntityListResponse { + return v.value +} + +func (v *NullableEntityListResponse) Set(val *EntityListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableEntityListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableEntityListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntityListResponse(val *EntityListResponse) *NullableEntityListResponse { + return &NullableEntityListResponse{value: val, isSet: true} +} + +func (v NullableEntityListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntityListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_entity_observation_response.go b/hindsight-clients/go/model_entity_observation_response.go new file mode 100644 index 00000000..c942d4e0 --- /dev/null +++ b/hindsight-clients/go/model_entity_observation_response.go @@ -0,0 +1,204 @@ +/* +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 EntityObservationResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EntityObservationResponse{} + +// EntityObservationResponse An observation about an entity. +type EntityObservationResponse struct { + Text string `json:"text"` + MentionedAt NullableString `json:"mentioned_at,omitempty"` +} + +type _EntityObservationResponse EntityObservationResponse + +// NewEntityObservationResponse instantiates a new EntityObservationResponse 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 NewEntityObservationResponse(text string) *EntityObservationResponse { + this := EntityObservationResponse{} + this.Text = text + return &this +} + +// NewEntityObservationResponseWithDefaults instantiates a new EntityObservationResponse 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 NewEntityObservationResponseWithDefaults() *EntityObservationResponse { + this := EntityObservationResponse{} + return &this +} + +// GetText returns the Text field value +func (o *EntityObservationResponse) GetText() string { + if o == nil { + var ret string + return ret + } + + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *EntityObservationResponse) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value +func (o *EntityObservationResponse) SetText(v string) { + o.Text = v +} + +// GetMentionedAt returns the MentionedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *EntityObservationResponse) GetMentionedAt() string { + if o == nil || IsNil(o.MentionedAt.Get()) { + var ret string + return ret + } + return *o.MentionedAt.Get() +} + +// GetMentionedAtOk returns a tuple with the MentionedAt 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 *EntityObservationResponse) GetMentionedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.MentionedAt.Get(), o.MentionedAt.IsSet() +} + +// HasMentionedAt returns a boolean if a field has been set. +func (o *EntityObservationResponse) HasMentionedAt() bool { + if o != nil && o.MentionedAt.IsSet() { + return true + } + + return false +} + +// SetMentionedAt gets a reference to the given NullableString and assigns it to the MentionedAt field. +func (o *EntityObservationResponse) SetMentionedAt(v string) { + o.MentionedAt.Set(&v) +} +// SetMentionedAtNil sets the value for MentionedAt to be an explicit nil +func (o *EntityObservationResponse) SetMentionedAtNil() { + o.MentionedAt.Set(nil) +} + +// UnsetMentionedAt ensures that no value is present for MentionedAt, not even an explicit nil +func (o *EntityObservationResponse) UnsetMentionedAt() { + o.MentionedAt.Unset() +} + +func (o EntityObservationResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EntityObservationResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["text"] = o.Text + if o.MentionedAt.IsSet() { + toSerialize["mentioned_at"] = o.MentionedAt.Get() + } + return toSerialize, nil +} + +func (o *EntityObservationResponse) 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{ + "text", + } + + 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) + } + } + + varEntityObservationResponse := _EntityObservationResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEntityObservationResponse) + + if err != nil { + return err + } + + *o = EntityObservationResponse(varEntityObservationResponse) + + return err +} + +type NullableEntityObservationResponse struct { + value *EntityObservationResponse + isSet bool +} + +func (v NullableEntityObservationResponse) Get() *EntityObservationResponse { + return v.value +} + +func (v *NullableEntityObservationResponse) Set(val *EntityObservationResponse) { + v.value = val + v.isSet = true +} + +func (v NullableEntityObservationResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableEntityObservationResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntityObservationResponse(val *EntityObservationResponse) *NullableEntityObservationResponse { + return &NullableEntityObservationResponse{value: val, isSet: true} +} + +func (v NullableEntityObservationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntityObservationResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_entity_state_response.go b/hindsight-clients/go/model_entity_state_response.go new file mode 100644 index 00000000..fec26bd4 --- /dev/null +++ b/hindsight-clients/go/model_entity_state_response.go @@ -0,0 +1,214 @@ +/* +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 EntityStateResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &EntityStateResponse{} + +// EntityStateResponse Current mental model of an entity. +type EntityStateResponse struct { + EntityId string `json:"entity_id"` + CanonicalName string `json:"canonical_name"` + Observations []EntityObservationResponse `json:"observations"` +} + +type _EntityStateResponse EntityStateResponse + +// NewEntityStateResponse instantiates a new EntityStateResponse 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 NewEntityStateResponse(entityId string, canonicalName string, observations []EntityObservationResponse) *EntityStateResponse { + this := EntityStateResponse{} + this.EntityId = entityId + this.CanonicalName = canonicalName + this.Observations = observations + return &this +} + +// NewEntityStateResponseWithDefaults instantiates a new EntityStateResponse 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 NewEntityStateResponseWithDefaults() *EntityStateResponse { + this := EntityStateResponse{} + return &this +} + +// GetEntityId returns the EntityId field value +func (o *EntityStateResponse) GetEntityId() string { + if o == nil { + var ret string + return ret + } + + return o.EntityId +} + +// GetEntityIdOk returns a tuple with the EntityId field value +// and a boolean to check if the value has been set. +func (o *EntityStateResponse) GetEntityIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EntityId, true +} + +// SetEntityId sets field value +func (o *EntityStateResponse) SetEntityId(v string) { + o.EntityId = v +} + +// GetCanonicalName returns the CanonicalName field value +func (o *EntityStateResponse) GetCanonicalName() string { + if o == nil { + var ret string + return ret + } + + return o.CanonicalName +} + +// GetCanonicalNameOk returns a tuple with the CanonicalName field value +// and a boolean to check if the value has been set. +func (o *EntityStateResponse) GetCanonicalNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CanonicalName, true +} + +// SetCanonicalName sets field value +func (o *EntityStateResponse) SetCanonicalName(v string) { + o.CanonicalName = v +} + +// GetObservations returns the Observations field value +func (o *EntityStateResponse) GetObservations() []EntityObservationResponse { + if o == nil { + var ret []EntityObservationResponse + return ret + } + + return o.Observations +} + +// GetObservationsOk returns a tuple with the Observations field value +// and a boolean to check if the value has been set. +func (o *EntityStateResponse) GetObservationsOk() ([]EntityObservationResponse, bool) { + if o == nil { + return nil, false + } + return o.Observations, true +} + +// SetObservations sets field value +func (o *EntityStateResponse) SetObservations(v []EntityObservationResponse) { + o.Observations = v +} + +func (o EntityStateResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o EntityStateResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["entity_id"] = o.EntityId + toSerialize["canonical_name"] = o.CanonicalName + toSerialize["observations"] = o.Observations + return toSerialize, nil +} + +func (o *EntityStateResponse) 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{ + "entity_id", + "canonical_name", + "observations", + } + + 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) + } + } + + varEntityStateResponse := _EntityStateResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varEntityStateResponse) + + if err != nil { + return err + } + + *o = EntityStateResponse(varEntityStateResponse) + + return err +} + +type NullableEntityStateResponse struct { + value *EntityStateResponse + isSet bool +} + +func (v NullableEntityStateResponse) Get() *EntityStateResponse { + return v.value +} + +func (v *NullableEntityStateResponse) Set(val *EntityStateResponse) { + v.value = val + v.isSet = true +} + +func (v NullableEntityStateResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableEntityStateResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEntityStateResponse(val *EntityStateResponse) *NullableEntityStateResponse { + return &NullableEntityStateResponse{value: val, isSet: true} +} + +func (v NullableEntityStateResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEntityStateResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_features_info.go b/hindsight-clients/go/model_features_info.go new file mode 100644 index 00000000..8752b96c --- /dev/null +++ b/hindsight-clients/go/model_features_info.go @@ -0,0 +1,246 @@ +/* +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 FeaturesInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FeaturesInfo{} + +// FeaturesInfo Feature flags indicating which capabilities are enabled. +type FeaturesInfo struct { + // Whether observations (auto-consolidation) are enabled + Observations bool `json:"observations"` + // Whether MCP (Model Context Protocol) server is enabled + Mcp bool `json:"mcp"` + // Whether the background worker is enabled + Worker bool `json:"worker"` + // Whether per-bank configuration API is enabled + BankConfigApi bool `json:"bank_config_api"` +} + +type _FeaturesInfo FeaturesInfo + +// NewFeaturesInfo instantiates a new FeaturesInfo 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 NewFeaturesInfo(observations bool, mcp bool, worker bool, bankConfigApi bool) *FeaturesInfo { + this := FeaturesInfo{} + this.Observations = observations + this.Mcp = mcp + this.Worker = worker + this.BankConfigApi = bankConfigApi + return &this +} + +// NewFeaturesInfoWithDefaults instantiates a new FeaturesInfo 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 NewFeaturesInfoWithDefaults() *FeaturesInfo { + this := FeaturesInfo{} + return &this +} + +// GetObservations returns the Observations field value +func (o *FeaturesInfo) GetObservations() bool { + if o == nil { + var ret bool + return ret + } + + return o.Observations +} + +// GetObservationsOk returns a tuple with the Observations field value +// and a boolean to check if the value has been set. +func (o *FeaturesInfo) GetObservationsOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Observations, true +} + +// SetObservations sets field value +func (o *FeaturesInfo) SetObservations(v bool) { + o.Observations = v +} + +// GetMcp returns the Mcp field value +func (o *FeaturesInfo) GetMcp() bool { + if o == nil { + var ret bool + return ret + } + + return o.Mcp +} + +// GetMcpOk returns a tuple with the Mcp field value +// and a boolean to check if the value has been set. +func (o *FeaturesInfo) GetMcpOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Mcp, true +} + +// SetMcp sets field value +func (o *FeaturesInfo) SetMcp(v bool) { + o.Mcp = v +} + +// GetWorker returns the Worker field value +func (o *FeaturesInfo) GetWorker() bool { + if o == nil { + var ret bool + return ret + } + + return o.Worker +} + +// GetWorkerOk returns a tuple with the Worker field value +// and a boolean to check if the value has been set. +func (o *FeaturesInfo) GetWorkerOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Worker, true +} + +// SetWorker sets field value +func (o *FeaturesInfo) SetWorker(v bool) { + o.Worker = v +} + +// GetBankConfigApi returns the BankConfigApi field value +func (o *FeaturesInfo) GetBankConfigApi() bool { + if o == nil { + var ret bool + return ret + } + + return o.BankConfigApi +} + +// GetBankConfigApiOk returns a tuple with the BankConfigApi field value +// and a boolean to check if the value has been set. +func (o *FeaturesInfo) GetBankConfigApiOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.BankConfigApi, true +} + +// SetBankConfigApi sets field value +func (o *FeaturesInfo) SetBankConfigApi(v bool) { + o.BankConfigApi = v +} + +func (o FeaturesInfo) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o FeaturesInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["observations"] = o.Observations + toSerialize["mcp"] = o.Mcp + toSerialize["worker"] = o.Worker + toSerialize["bank_config_api"] = o.BankConfigApi + return toSerialize, nil +} + +func (o *FeaturesInfo) 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{ + "observations", + "mcp", + "worker", + "bank_config_api", + } + + 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) + } + } + + varFeaturesInfo := _FeaturesInfo{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varFeaturesInfo) + + if err != nil { + return err + } + + *o = FeaturesInfo(varFeaturesInfo) + + return err +} + +type NullableFeaturesInfo struct { + value *FeaturesInfo + isSet bool +} + +func (v NullableFeaturesInfo) Get() *FeaturesInfo { + return v.value +} + +func (v *NullableFeaturesInfo) Set(val *FeaturesInfo) { + v.value = val + v.isSet = true +} + +func (v NullableFeaturesInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableFeaturesInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFeaturesInfo(val *FeaturesInfo) *NullableFeaturesInfo { + return &NullableFeaturesInfo{value: val, isSet: true} +} + +func (v NullableFeaturesInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFeaturesInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_graph_data_response.go b/hindsight-clients/go/model_graph_data_response.go new file mode 100644 index 00000000..35240505 --- /dev/null +++ b/hindsight-clients/go/model_graph_data_response.go @@ -0,0 +1,270 @@ +/* +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 GraphDataResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GraphDataResponse{} + +// GraphDataResponse Response model for graph data endpoint. +type GraphDataResponse struct { + Nodes []map[string]interface{} `json:"nodes"` + Edges []map[string]interface{} `json:"edges"` + TableRows []map[string]interface{} `json:"table_rows"` + TotalUnits int32 `json:"total_units"` + Limit int32 `json:"limit"` +} + +type _GraphDataResponse GraphDataResponse + +// NewGraphDataResponse instantiates a new GraphDataResponse 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 NewGraphDataResponse(nodes []map[string]interface{}, edges []map[string]interface{}, tableRows []map[string]interface{}, totalUnits int32, limit int32) *GraphDataResponse { + this := GraphDataResponse{} + this.Nodes = nodes + this.Edges = edges + this.TableRows = tableRows + this.TotalUnits = totalUnits + this.Limit = limit + return &this +} + +// NewGraphDataResponseWithDefaults instantiates a new GraphDataResponse 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 NewGraphDataResponseWithDefaults() *GraphDataResponse { + this := GraphDataResponse{} + return &this +} + +// GetNodes returns the Nodes field value +func (o *GraphDataResponse) GetNodes() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + + return o.Nodes +} + +// GetNodesOk returns a tuple with the Nodes field value +// and a boolean to check if the value has been set. +func (o *GraphDataResponse) GetNodesOk() ([]map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return o.Nodes, true +} + +// SetNodes sets field value +func (o *GraphDataResponse) SetNodes(v []map[string]interface{}) { + o.Nodes = v +} + +// GetEdges returns the Edges field value +func (o *GraphDataResponse) GetEdges() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + + return o.Edges +} + +// GetEdgesOk returns a tuple with the Edges field value +// and a boolean to check if the value has been set. +func (o *GraphDataResponse) GetEdgesOk() ([]map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return o.Edges, true +} + +// SetEdges sets field value +func (o *GraphDataResponse) SetEdges(v []map[string]interface{}) { + o.Edges = v +} + +// GetTableRows returns the TableRows field value +func (o *GraphDataResponse) GetTableRows() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + + return o.TableRows +} + +// GetTableRowsOk returns a tuple with the TableRows field value +// and a boolean to check if the value has been set. +func (o *GraphDataResponse) GetTableRowsOk() ([]map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return o.TableRows, true +} + +// SetTableRows sets field value +func (o *GraphDataResponse) SetTableRows(v []map[string]interface{}) { + o.TableRows = v +} + +// GetTotalUnits returns the TotalUnits field value +func (o *GraphDataResponse) GetTotalUnits() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.TotalUnits +} + +// GetTotalUnitsOk returns a tuple with the TotalUnits field value +// and a boolean to check if the value has been set. +func (o *GraphDataResponse) GetTotalUnitsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.TotalUnits, true +} + +// SetTotalUnits sets field value +func (o *GraphDataResponse) SetTotalUnits(v int32) { + o.TotalUnits = v +} + +// GetLimit returns the Limit field value +func (o *GraphDataResponse) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *GraphDataResponse) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *GraphDataResponse) SetLimit(v int32) { + o.Limit = v +} + +func (o GraphDataResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GraphDataResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nodes"] = o.Nodes + toSerialize["edges"] = o.Edges + toSerialize["table_rows"] = o.TableRows + toSerialize["total_units"] = o.TotalUnits + toSerialize["limit"] = o.Limit + return toSerialize, nil +} + +func (o *GraphDataResponse) 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{ + "nodes", + "edges", + "table_rows", + "total_units", + "limit", + } + + 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) + } + } + + varGraphDataResponse := _GraphDataResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varGraphDataResponse) + + if err != nil { + return err + } + + *o = GraphDataResponse(varGraphDataResponse) + + return err +} + +type NullableGraphDataResponse struct { + value *GraphDataResponse + isSet bool +} + +func (v NullableGraphDataResponse) Get() *GraphDataResponse { + return v.value +} + +func (v *NullableGraphDataResponse) Set(val *GraphDataResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGraphDataResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGraphDataResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGraphDataResponse(val *GraphDataResponse) *NullableGraphDataResponse { + return &NullableGraphDataResponse{value: val, isSet: true} +} + +func (v NullableGraphDataResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGraphDataResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_http_validation_error.go b/hindsight-clients/go/model_http_validation_error.go new file mode 100644 index 00000000..6e4138da --- /dev/null +++ b/hindsight-clients/go/model_http_validation_error.go @@ -0,0 +1,126 @@ +/* +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" +) + +// checks if the HTTPValidationError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HTTPValidationError{} + +// HTTPValidationError struct for HTTPValidationError +type HTTPValidationError struct { + Detail []ValidationError `json:"detail,omitempty"` +} + +// NewHTTPValidationError instantiates a new HTTPValidationError 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 NewHTTPValidationError() *HTTPValidationError { + this := HTTPValidationError{} + return &this +} + +// NewHTTPValidationErrorWithDefaults instantiates a new HTTPValidationError 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 NewHTTPValidationErrorWithDefaults() *HTTPValidationError { + this := HTTPValidationError{} + return &this +} + +// GetDetail returns the Detail field value if set, zero value otherwise. +func (o *HTTPValidationError) GetDetail() []ValidationError { + if o == nil || IsNil(o.Detail) { + var ret []ValidationError + return ret + } + return o.Detail +} + +// GetDetailOk returns a tuple with the Detail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HTTPValidationError) GetDetailOk() ([]ValidationError, bool) { + if o == nil || IsNil(o.Detail) { + return nil, false + } + return o.Detail, true +} + +// HasDetail returns a boolean if a field has been set. +func (o *HTTPValidationError) HasDetail() bool { + if o != nil && !IsNil(o.Detail) { + return true + } + + return false +} + +// SetDetail gets a reference to the given []ValidationError and assigns it to the Detail field. +func (o *HTTPValidationError) SetDetail(v []ValidationError) { + o.Detail = v +} + +func (o HTTPValidationError) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o HTTPValidationError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Detail) { + toSerialize["detail"] = o.Detail + } + return toSerialize, nil +} + +type NullableHTTPValidationError struct { + value *HTTPValidationError + isSet bool +} + +func (v NullableHTTPValidationError) Get() *HTTPValidationError { + return v.value +} + +func (v *NullableHTTPValidationError) Set(val *HTTPValidationError) { + v.value = val + v.isSet = true +} + +func (v NullableHTTPValidationError) IsSet() bool { + return v.isSet +} + +func (v *NullableHTTPValidationError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHTTPValidationError(val *HTTPValidationError) *NullableHTTPValidationError { + return &NullableHTTPValidationError{value: val, isSet: true} +} + +func (v NullableHTTPValidationError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHTTPValidationError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_include_options.go b/hindsight-clients/go/model_include_options.go new file mode 100644 index 00000000..ab5e5ac6 --- /dev/null +++ b/hindsight-clients/go/model_include_options.go @@ -0,0 +1,182 @@ +/* +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" +) + +// checks if the IncludeOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &IncludeOptions{} + +// IncludeOptions Options for including additional data in recall results. +type IncludeOptions struct { + Entities NullableEntityIncludeOptions `json:"entities,omitempty"` + Chunks NullableChunkIncludeOptions `json:"chunks,omitempty"` +} + +// NewIncludeOptions instantiates a new IncludeOptions 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 NewIncludeOptions() *IncludeOptions { + this := IncludeOptions{} + return &this +} + +// NewIncludeOptionsWithDefaults instantiates a new IncludeOptions 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 NewIncludeOptionsWithDefaults() *IncludeOptions { + this := IncludeOptions{} + return &this +} + +// GetEntities returns the Entities field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncludeOptions) GetEntities() EntityIncludeOptions { + if o == nil || IsNil(o.Entities.Get()) { + var ret EntityIncludeOptions + return ret + } + return *o.Entities.Get() +} + +// GetEntitiesOk returns a tuple with the Entities 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 *IncludeOptions) GetEntitiesOk() (*EntityIncludeOptions, bool) { + if o == nil { + return nil, false + } + return o.Entities.Get(), o.Entities.IsSet() +} + +// HasEntities returns a boolean if a field has been set. +func (o *IncludeOptions) HasEntities() bool { + if o != nil && o.Entities.IsSet() { + return true + } + + return false +} + +// SetEntities gets a reference to the given NullableEntityIncludeOptions and assigns it to the Entities field. +func (o *IncludeOptions) SetEntities(v EntityIncludeOptions) { + o.Entities.Set(&v) +} +// SetEntitiesNil sets the value for Entities to be an explicit nil +func (o *IncludeOptions) SetEntitiesNil() { + o.Entities.Set(nil) +} + +// UnsetEntities ensures that no value is present for Entities, not even an explicit nil +func (o *IncludeOptions) UnsetEntities() { + o.Entities.Unset() +} + +// GetChunks returns the Chunks field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *IncludeOptions) GetChunks() ChunkIncludeOptions { + if o == nil || IsNil(o.Chunks.Get()) { + var ret ChunkIncludeOptions + return ret + } + return *o.Chunks.Get() +} + +// GetChunksOk returns a tuple with the Chunks 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 *IncludeOptions) GetChunksOk() (*ChunkIncludeOptions, bool) { + if o == nil { + return nil, false + } + return o.Chunks.Get(), o.Chunks.IsSet() +} + +// HasChunks returns a boolean if a field has been set. +func (o *IncludeOptions) HasChunks() bool { + if o != nil && o.Chunks.IsSet() { + return true + } + + return false +} + +// SetChunks gets a reference to the given NullableChunkIncludeOptions and assigns it to the Chunks field. +func (o *IncludeOptions) SetChunks(v ChunkIncludeOptions) { + o.Chunks.Set(&v) +} +// SetChunksNil sets the value for Chunks to be an explicit nil +func (o *IncludeOptions) SetChunksNil() { + o.Chunks.Set(nil) +} + +// UnsetChunks ensures that no value is present for Chunks, not even an explicit nil +func (o *IncludeOptions) UnsetChunks() { + o.Chunks.Unset() +} + +func (o IncludeOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o IncludeOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Entities.IsSet() { + toSerialize["entities"] = o.Entities.Get() + } + if o.Chunks.IsSet() { + toSerialize["chunks"] = o.Chunks.Get() + } + return toSerialize, nil +} + +type NullableIncludeOptions struct { + value *IncludeOptions + isSet bool +} + +func (v NullableIncludeOptions) Get() *IncludeOptions { + return v.value +} + +func (v *NullableIncludeOptions) Set(val *IncludeOptions) { + v.value = val + v.isSet = true +} + +func (v NullableIncludeOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableIncludeOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableIncludeOptions(val *IncludeOptions) *NullableIncludeOptions { + return &NullableIncludeOptions{value: val, isSet: true} +} + +func (v NullableIncludeOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableIncludeOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_list_documents_response.go b/hindsight-clients/go/model_list_documents_response.go new file mode 100644 index 00000000..49f0cb9a --- /dev/null +++ b/hindsight-clients/go/model_list_documents_response.go @@ -0,0 +1,242 @@ +/* +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 ListDocumentsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDocumentsResponse{} + +// ListDocumentsResponse Response model for list documents endpoint. +type ListDocumentsResponse struct { + Items []map[string]interface{} `json:"items"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` +} + +type _ListDocumentsResponse ListDocumentsResponse + +// NewListDocumentsResponse instantiates a new ListDocumentsResponse 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 NewListDocumentsResponse(items []map[string]interface{}, total int32, limit int32, offset int32) *ListDocumentsResponse { + this := ListDocumentsResponse{} + this.Items = items + this.Total = total + this.Limit = limit + this.Offset = offset + return &this +} + +// NewListDocumentsResponseWithDefaults instantiates a new ListDocumentsResponse 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 NewListDocumentsResponseWithDefaults() *ListDocumentsResponse { + this := ListDocumentsResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ListDocumentsResponse) GetItems() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListDocumentsResponse) GetItemsOk() ([]map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListDocumentsResponse) SetItems(v []map[string]interface{}) { + o.Items = v +} + +// GetTotal returns the Total field value +func (o *ListDocumentsResponse) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *ListDocumentsResponse) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *ListDocumentsResponse) SetTotal(v int32) { + o.Total = v +} + +// GetLimit returns the Limit field value +func (o *ListDocumentsResponse) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *ListDocumentsResponse) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *ListDocumentsResponse) SetLimit(v int32) { + o.Limit = v +} + +// GetOffset returns the Offset field value +func (o *ListDocumentsResponse) GetOffset() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +func (o *ListDocumentsResponse) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Offset, true +} + +// SetOffset sets field value +func (o *ListDocumentsResponse) SetOffset(v int32) { + o.Offset = v +} + +func (o ListDocumentsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListDocumentsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + toSerialize["total"] = o.Total + toSerialize["limit"] = o.Limit + toSerialize["offset"] = o.Offset + return toSerialize, nil +} + +func (o *ListDocumentsResponse) 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{ + "items", + "total", + "limit", + "offset", + } + + 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) + } + } + + varListDocumentsResponse := _ListDocumentsResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varListDocumentsResponse) + + if err != nil { + return err + } + + *o = ListDocumentsResponse(varListDocumentsResponse) + + return err +} + +type NullableListDocumentsResponse struct { + value *ListDocumentsResponse + isSet bool +} + +func (v NullableListDocumentsResponse) Get() *ListDocumentsResponse { + return v.value +} + +func (v *NullableListDocumentsResponse) Set(val *ListDocumentsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDocumentsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDocumentsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDocumentsResponse(val *ListDocumentsResponse) *NullableListDocumentsResponse { + return &NullableListDocumentsResponse{value: val, isSet: true} +} + +func (v NullableListDocumentsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDocumentsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_list_memory_units_response.go b/hindsight-clients/go/model_list_memory_units_response.go new file mode 100644 index 00000000..4680e1f0 --- /dev/null +++ b/hindsight-clients/go/model_list_memory_units_response.go @@ -0,0 +1,242 @@ +/* +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 ListMemoryUnitsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListMemoryUnitsResponse{} + +// ListMemoryUnitsResponse Response model for list memory units endpoint. +type ListMemoryUnitsResponse struct { + Items []map[string]interface{} `json:"items"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` +} + +type _ListMemoryUnitsResponse ListMemoryUnitsResponse + +// NewListMemoryUnitsResponse instantiates a new ListMemoryUnitsResponse 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 NewListMemoryUnitsResponse(items []map[string]interface{}, total int32, limit int32, offset int32) *ListMemoryUnitsResponse { + this := ListMemoryUnitsResponse{} + this.Items = items + this.Total = total + this.Limit = limit + this.Offset = offset + return &this +} + +// NewListMemoryUnitsResponseWithDefaults instantiates a new ListMemoryUnitsResponse 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 NewListMemoryUnitsResponseWithDefaults() *ListMemoryUnitsResponse { + this := ListMemoryUnitsResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ListMemoryUnitsResponse) GetItems() []map[string]interface{} { + if o == nil { + var ret []map[string]interface{} + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListMemoryUnitsResponse) GetItemsOk() ([]map[string]interface{}, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListMemoryUnitsResponse) SetItems(v []map[string]interface{}) { + o.Items = v +} + +// GetTotal returns the Total field value +func (o *ListMemoryUnitsResponse) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *ListMemoryUnitsResponse) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *ListMemoryUnitsResponse) SetTotal(v int32) { + o.Total = v +} + +// GetLimit returns the Limit field value +func (o *ListMemoryUnitsResponse) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *ListMemoryUnitsResponse) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *ListMemoryUnitsResponse) SetLimit(v int32) { + o.Limit = v +} + +// GetOffset returns the Offset field value +func (o *ListMemoryUnitsResponse) GetOffset() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +func (o *ListMemoryUnitsResponse) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Offset, true +} + +// SetOffset sets field value +func (o *ListMemoryUnitsResponse) SetOffset(v int32) { + o.Offset = v +} + +func (o ListMemoryUnitsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListMemoryUnitsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + toSerialize["total"] = o.Total + toSerialize["limit"] = o.Limit + toSerialize["offset"] = o.Offset + return toSerialize, nil +} + +func (o *ListMemoryUnitsResponse) 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{ + "items", + "total", + "limit", + "offset", + } + + 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) + } + } + + varListMemoryUnitsResponse := _ListMemoryUnitsResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varListMemoryUnitsResponse) + + if err != nil { + return err + } + + *o = ListMemoryUnitsResponse(varListMemoryUnitsResponse) + + return err +} + +type NullableListMemoryUnitsResponse struct { + value *ListMemoryUnitsResponse + isSet bool +} + +func (v NullableListMemoryUnitsResponse) Get() *ListMemoryUnitsResponse { + return v.value +} + +func (v *NullableListMemoryUnitsResponse) Set(val *ListMemoryUnitsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListMemoryUnitsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListMemoryUnitsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListMemoryUnitsResponse(val *ListMemoryUnitsResponse) *NullableListMemoryUnitsResponse { + return &NullableListMemoryUnitsResponse{value: val, isSet: true} +} + +func (v NullableListMemoryUnitsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListMemoryUnitsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_list_tags_response.go b/hindsight-clients/go/model_list_tags_response.go new file mode 100644 index 00000000..1f7e806e --- /dev/null +++ b/hindsight-clients/go/model_list_tags_response.go @@ -0,0 +1,242 @@ +/* +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 ListTagsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListTagsResponse{} + +// ListTagsResponse Response model for list tags endpoint. +type ListTagsResponse struct { + Items []TagItem `json:"items"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` +} + +type _ListTagsResponse ListTagsResponse + +// NewListTagsResponse instantiates a new ListTagsResponse 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 NewListTagsResponse(items []TagItem, total int32, limit int32, offset int32) *ListTagsResponse { + this := ListTagsResponse{} + this.Items = items + this.Total = total + this.Limit = limit + this.Offset = offset + return &this +} + +// NewListTagsResponseWithDefaults instantiates a new ListTagsResponse 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 NewListTagsResponseWithDefaults() *ListTagsResponse { + this := ListTagsResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *ListTagsResponse) GetItems() []TagItem { + if o == nil { + var ret []TagItem + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *ListTagsResponse) GetItemsOk() ([]TagItem, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *ListTagsResponse) SetItems(v []TagItem) { + o.Items = v +} + +// GetTotal returns the Total field value +func (o *ListTagsResponse) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *ListTagsResponse) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *ListTagsResponse) SetTotal(v int32) { + o.Total = v +} + +// GetLimit returns the Limit field value +func (o *ListTagsResponse) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *ListTagsResponse) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *ListTagsResponse) SetLimit(v int32) { + o.Limit = v +} + +// GetOffset returns the Offset field value +func (o *ListTagsResponse) GetOffset() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +func (o *ListTagsResponse) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Offset, true +} + +// SetOffset sets field value +func (o *ListTagsResponse) SetOffset(v int32) { + o.Offset = v +} + +func (o ListTagsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListTagsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + toSerialize["total"] = o.Total + toSerialize["limit"] = o.Limit + toSerialize["offset"] = o.Offset + return toSerialize, nil +} + +func (o *ListTagsResponse) 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{ + "items", + "total", + "limit", + "offset", + } + + 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) + } + } + + varListTagsResponse := _ListTagsResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varListTagsResponse) + + if err != nil { + return err + } + + *o = ListTagsResponse(varListTagsResponse) + + return err +} + +type NullableListTagsResponse struct { + value *ListTagsResponse + isSet bool +} + +func (v NullableListTagsResponse) Get() *ListTagsResponse { + return v.value +} + +func (v *NullableListTagsResponse) Set(val *ListTagsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListTagsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListTagsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListTagsResponse(val *ListTagsResponse) *NullableListTagsResponse { + return &NullableListTagsResponse{value: val, isSet: true} +} + +func (v NullableListTagsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListTagsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_memory_item.go b/hindsight-clients/go/model_memory_item.go new file mode 100644 index 00000000..aa3cfee9 --- /dev/null +++ b/hindsight-clients/go/model_memory_item.go @@ -0,0 +1,408 @@ +/* +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" + "time" + "bytes" + "fmt" +) + +// checks if the MemoryItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MemoryItem{} + +// MemoryItem Single memory item for retain. +type MemoryItem struct { + Content string `json:"content"` + Timestamp NullableTime `json:"timestamp,omitempty"` + Context NullableString `json:"context,omitempty"` + Metadata map[string]string `json:"metadata,omitempty"` + DocumentId NullableString `json:"document_id,omitempty"` + Entities []EntityInput `json:"entities,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +type _MemoryItem MemoryItem + +// NewMemoryItem instantiates a new MemoryItem 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 NewMemoryItem(content string) *MemoryItem { + this := MemoryItem{} + this.Content = content + return &this +} + +// NewMemoryItemWithDefaults instantiates a new MemoryItem 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 NewMemoryItemWithDefaults() *MemoryItem { + this := MemoryItem{} + return &this +} + +// GetContent returns the Content field value +func (o *MemoryItem) GetContent() string { + if o == nil { + var ret string + return ret + } + + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *MemoryItem) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value +func (o *MemoryItem) SetContent(v string) { + o.Content = v +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MemoryItem) GetTimestamp() time.Time { + if o == nil || IsNil(o.Timestamp.Get()) { + var ret time.Time + return ret + } + return *o.Timestamp.Get() +} + +// GetTimestampOk returns a tuple with the Timestamp 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 *MemoryItem) GetTimestampOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Timestamp.Get(), o.Timestamp.IsSet() +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *MemoryItem) HasTimestamp() bool { + if o != nil && o.Timestamp.IsSet() { + return true + } + + return false +} + +// SetTimestamp gets a reference to the given NullableTime and assigns it to the Timestamp field. +func (o *MemoryItem) SetTimestamp(v time.Time) { + o.Timestamp.Set(&v) +} +// SetTimestampNil sets the value for Timestamp to be an explicit nil +func (o *MemoryItem) SetTimestampNil() { + o.Timestamp.Set(nil) +} + +// UnsetTimestamp ensures that no value is present for Timestamp, not even an explicit nil +func (o *MemoryItem) UnsetTimestamp() { + o.Timestamp.Unset() +} + +// GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MemoryItem) 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 *MemoryItem) 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 *MemoryItem) 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 *MemoryItem) SetContext(v string) { + o.Context.Set(&v) +} +// SetContextNil sets the value for Context to be an explicit nil +func (o *MemoryItem) SetContextNil() { + o.Context.Set(nil) +} + +// UnsetContext ensures that no value is present for Context, not even an explicit nil +func (o *MemoryItem) UnsetContext() { + o.Context.Unset() +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MemoryItem) GetMetadata() map[string]string { + if o == nil { + var ret map[string]string + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata 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 *MemoryItem) GetMetadataOk() (map[string]string, bool) { + if o == nil || IsNil(o.Metadata) { + return map[string]string{}, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *MemoryItem) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *MemoryItem) SetMetadata(v map[string]string) { + o.Metadata = v +} + +// GetDocumentId returns the DocumentId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MemoryItem) GetDocumentId() string { + if o == nil || IsNil(o.DocumentId.Get()) { + var ret string + return ret + } + return *o.DocumentId.Get() +} + +// GetDocumentIdOk returns a tuple with the DocumentId 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 *MemoryItem) GetDocumentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DocumentId.Get(), o.DocumentId.IsSet() +} + +// HasDocumentId returns a boolean if a field has been set. +func (o *MemoryItem) HasDocumentId() bool { + if o != nil && o.DocumentId.IsSet() { + return true + } + + return false +} + +// SetDocumentId gets a reference to the given NullableString and assigns it to the DocumentId field. +func (o *MemoryItem) SetDocumentId(v string) { + o.DocumentId.Set(&v) +} +// SetDocumentIdNil sets the value for DocumentId to be an explicit nil +func (o *MemoryItem) SetDocumentIdNil() { + o.DocumentId.Set(nil) +} + +// UnsetDocumentId ensures that no value is present for DocumentId, not even an explicit nil +func (o *MemoryItem) UnsetDocumentId() { + o.DocumentId.Unset() +} + +// GetEntities returns the Entities field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MemoryItem) GetEntities() []EntityInput { + if o == nil { + var ret []EntityInput + return ret + } + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities 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 *MemoryItem) GetEntitiesOk() ([]EntityInput, bool) { + if o == nil || IsNil(o.Entities) { + return nil, false + } + return o.Entities, true +} + +// HasEntities returns a boolean if a field has been set. +func (o *MemoryItem) HasEntities() bool { + if o != nil && !IsNil(o.Entities) { + return true + } + + return false +} + +// SetEntities gets a reference to the given []EntityInput and assigns it to the Entities field. +func (o *MemoryItem) SetEntities(v []EntityInput) { + o.Entities = v +} + +// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MemoryItem) 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 *MemoryItem) 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 *MemoryItem) 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 *MemoryItem) SetTags(v []string) { + o.Tags = v +} + +func (o MemoryItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MemoryItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["content"] = o.Content + if o.Timestamp.IsSet() { + toSerialize["timestamp"] = o.Timestamp.Get() + } + if o.Context.IsSet() { + toSerialize["context"] = o.Context.Get() + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.DocumentId.IsSet() { + toSerialize["document_id"] = o.DocumentId.Get() + } + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + return toSerialize, nil +} + +func (o *MemoryItem) 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{ + "content", + } + + 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) + } + } + + varMemoryItem := _MemoryItem{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMemoryItem) + + if err != nil { + return err + } + + *o = MemoryItem(varMemoryItem) + + return err +} + +type NullableMemoryItem struct { + value *MemoryItem + isSet bool +} + +func (v NullableMemoryItem) Get() *MemoryItem { + return v.value +} + +func (v *NullableMemoryItem) Set(val *MemoryItem) { + v.value = val + v.isSet = true +} + +func (v NullableMemoryItem) IsSet() bool { + return v.isSet +} + +func (v *NullableMemoryItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMemoryItem(val *MemoryItem) *NullableMemoryItem { + return &NullableMemoryItem{value: val, isSet: true} +} + +func (v NullableMemoryItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMemoryItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_mental_model_list_response.go b/hindsight-clients/go/model_mental_model_list_response.go new file mode 100644 index 00000000..b4dd1d76 --- /dev/null +++ b/hindsight-clients/go/model_mental_model_list_response.go @@ -0,0 +1,158 @@ +/* +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 MentalModelListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MentalModelListResponse{} + +// MentalModelListResponse Response model for listing mental models. +type MentalModelListResponse struct { + Items []MentalModelResponse `json:"items"` +} + +type _MentalModelListResponse MentalModelListResponse + +// NewMentalModelListResponse instantiates a new MentalModelListResponse 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 NewMentalModelListResponse(items []MentalModelResponse) *MentalModelListResponse { + this := MentalModelListResponse{} + this.Items = items + return &this +} + +// NewMentalModelListResponseWithDefaults instantiates a new MentalModelListResponse 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 NewMentalModelListResponseWithDefaults() *MentalModelListResponse { + this := MentalModelListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *MentalModelListResponse) GetItems() []MentalModelResponse { + if o == nil { + var ret []MentalModelResponse + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *MentalModelListResponse) GetItemsOk() ([]MentalModelResponse, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *MentalModelListResponse) SetItems(v []MentalModelResponse) { + o.Items = v +} + +func (o MentalModelListResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MentalModelListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +func (o *MentalModelListResponse) 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{ + "items", + } + + 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) + } + } + + varMentalModelListResponse := _MentalModelListResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMentalModelListResponse) + + if err != nil { + return err + } + + *o = MentalModelListResponse(varMentalModelListResponse) + + return err +} + +type NullableMentalModelListResponse struct { + value *MentalModelListResponse + isSet bool +} + +func (v NullableMentalModelListResponse) Get() *MentalModelListResponse { + return v.value +} + +func (v *NullableMentalModelListResponse) Set(val *MentalModelListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableMentalModelListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableMentalModelListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMentalModelListResponse(val *MentalModelListResponse) *NullableMentalModelListResponse { + return &NullableMentalModelListResponse{value: val, isSet: true} +} + +func (v NullableMentalModelListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMentalModelListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_mental_model_response.go b/hindsight-clients/go/model_mental_model_response.go new file mode 100644 index 00000000..3acbf5d8 --- /dev/null +++ b/hindsight-clients/go/model_mental_model_response.go @@ -0,0 +1,512 @@ +/* +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 MentalModelResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MentalModelResponse{} + +// MentalModelResponse Response model for a mental model (stored reflect response). +type MentalModelResponse struct { + Id string `json:"id"` + BankId string `json:"bank_id"` + Name string `json:"name"` + SourceQuery string `json:"source_query"` + // The mental model content as well-formatted markdown (auto-generated from reflect endpoint) + Content string `json:"content"` + Tags []string `json:"tags,omitempty"` + MaxTokens *int32 `json:"max_tokens,omitempty"` + Trigger *MentalModelTrigger `json:"trigger,omitempty"` + LastRefreshedAt NullableString `json:"last_refreshed_at,omitempty"` + CreatedAt NullableString `json:"created_at,omitempty"` + ReflectResponse map[string]interface{} `json:"reflect_response,omitempty"` +} + +type _MentalModelResponse MentalModelResponse + +// NewMentalModelResponse instantiates a new MentalModelResponse 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 NewMentalModelResponse(id string, bankId string, name string, sourceQuery string, content string) *MentalModelResponse { + this := MentalModelResponse{} + this.Id = id + this.BankId = bankId + this.Name = name + this.SourceQuery = sourceQuery + this.Content = content + var maxTokens int32 = 2048 + this.MaxTokens = &maxTokens + return &this +} + +// NewMentalModelResponseWithDefaults instantiates a new MentalModelResponse 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 NewMentalModelResponseWithDefaults() *MentalModelResponse { + this := MentalModelResponse{} + var maxTokens int32 = 2048 + this.MaxTokens = &maxTokens + return &this +} + +// GetId returns the Id field value +func (o *MentalModelResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *MentalModelResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *MentalModelResponse) SetId(v string) { + o.Id = v +} + +// GetBankId returns the BankId field value +func (o *MentalModelResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *MentalModelResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *MentalModelResponse) SetBankId(v string) { + o.BankId = v +} + +// GetName returns the Name field value +func (o *MentalModelResponse) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *MentalModelResponse) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *MentalModelResponse) SetName(v string) { + o.Name = v +} + +// GetSourceQuery returns the SourceQuery field value +func (o *MentalModelResponse) GetSourceQuery() string { + if o == nil { + var ret string + return ret + } + + return o.SourceQuery +} + +// GetSourceQueryOk returns a tuple with the SourceQuery field value +// and a boolean to check if the value has been set. +func (o *MentalModelResponse) GetSourceQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.SourceQuery, true +} + +// SetSourceQuery sets field value +func (o *MentalModelResponse) SetSourceQuery(v string) { + o.SourceQuery = v +} + +// GetContent returns the Content field value +func (o *MentalModelResponse) GetContent() string { + if o == nil { + var ret string + return ret + } + + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *MentalModelResponse) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value +func (o *MentalModelResponse) SetContent(v string) { + o.Content = v +} + +// GetTags returns the Tags field value if set, zero value otherwise. +func (o *MentalModelResponse) GetTags() []string { + if o == nil || IsNil(o.Tags) { + 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. +func (o *MentalModelResponse) 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 *MentalModelResponse) 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 *MentalModelResponse) SetTags(v []string) { + o.Tags = v +} + +// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise. +func (o *MentalModelResponse) 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 *MentalModelResponse) 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 *MentalModelResponse) 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 *MentalModelResponse) SetMaxTokens(v int32) { + o.MaxTokens = &v +} + +// GetTrigger returns the Trigger field value if set, zero value otherwise. +func (o *MentalModelResponse) GetTrigger() MentalModelTrigger { + if o == nil || IsNil(o.Trigger) { + var ret MentalModelTrigger + return ret + } + return *o.Trigger +} + +// GetTriggerOk returns a tuple with the Trigger field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MentalModelResponse) GetTriggerOk() (*MentalModelTrigger, bool) { + if o == nil || IsNil(o.Trigger) { + return nil, false + } + return o.Trigger, true +} + +// HasTrigger returns a boolean if a field has been set. +func (o *MentalModelResponse) HasTrigger() bool { + if o != nil && !IsNil(o.Trigger) { + return true + } + + return false +} + +// SetTrigger gets a reference to the given MentalModelTrigger and assigns it to the Trigger field. +func (o *MentalModelResponse) SetTrigger(v MentalModelTrigger) { + o.Trigger = &v +} + +// GetLastRefreshedAt returns the LastRefreshedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MentalModelResponse) GetLastRefreshedAt() string { + if o == nil || IsNil(o.LastRefreshedAt.Get()) { + var ret string + return ret + } + return *o.LastRefreshedAt.Get() +} + +// GetLastRefreshedAtOk returns a tuple with the LastRefreshedAt 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 *MentalModelResponse) GetLastRefreshedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.LastRefreshedAt.Get(), o.LastRefreshedAt.IsSet() +} + +// HasLastRefreshedAt returns a boolean if a field has been set. +func (o *MentalModelResponse) HasLastRefreshedAt() bool { + if o != nil && o.LastRefreshedAt.IsSet() { + return true + } + + return false +} + +// SetLastRefreshedAt gets a reference to the given NullableString and assigns it to the LastRefreshedAt field. +func (o *MentalModelResponse) SetLastRefreshedAt(v string) { + o.LastRefreshedAt.Set(&v) +} +// SetLastRefreshedAtNil sets the value for LastRefreshedAt to be an explicit nil +func (o *MentalModelResponse) SetLastRefreshedAtNil() { + o.LastRefreshedAt.Set(nil) +} + +// UnsetLastRefreshedAt ensures that no value is present for LastRefreshedAt, not even an explicit nil +func (o *MentalModelResponse) UnsetLastRefreshedAt() { + o.LastRefreshedAt.Unset() +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MentalModelResponse) 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 *MentalModelResponse) 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 *MentalModelResponse) 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 *MentalModelResponse) SetCreatedAt(v string) { + o.CreatedAt.Set(&v) +} +// SetCreatedAtNil sets the value for CreatedAt to be an explicit nil +func (o *MentalModelResponse) SetCreatedAtNil() { + o.CreatedAt.Set(nil) +} + +// UnsetCreatedAt ensures that no value is present for CreatedAt, not even an explicit nil +func (o *MentalModelResponse) UnsetCreatedAt() { + o.CreatedAt.Unset() +} + +// GetReflectResponse returns the ReflectResponse field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *MentalModelResponse) GetReflectResponse() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.ReflectResponse +} + +// GetReflectResponseOk returns a tuple with the ReflectResponse 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 *MentalModelResponse) GetReflectResponseOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.ReflectResponse) { + return map[string]interface{}{}, false + } + return o.ReflectResponse, true +} + +// HasReflectResponse returns a boolean if a field has been set. +func (o *MentalModelResponse) HasReflectResponse() bool { + if o != nil && !IsNil(o.ReflectResponse) { + return true + } + + return false +} + +// SetReflectResponse gets a reference to the given map[string]interface{} and assigns it to the ReflectResponse field. +func (o *MentalModelResponse) SetReflectResponse(v map[string]interface{}) { + o.ReflectResponse = v +} + +func (o MentalModelResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MentalModelResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["bank_id"] = o.BankId + toSerialize["name"] = o.Name + toSerialize["source_query"] = o.SourceQuery + toSerialize["content"] = o.Content + if !IsNil(o.Tags) { + toSerialize["tags"] = o.Tags + } + if !IsNil(o.MaxTokens) { + toSerialize["max_tokens"] = o.MaxTokens + } + if !IsNil(o.Trigger) { + toSerialize["trigger"] = o.Trigger + } + if o.LastRefreshedAt.IsSet() { + toSerialize["last_refreshed_at"] = o.LastRefreshedAt.Get() + } + if o.CreatedAt.IsSet() { + toSerialize["created_at"] = o.CreatedAt.Get() + } + if o.ReflectResponse != nil { + toSerialize["reflect_response"] = o.ReflectResponse + } + return toSerialize, nil +} + +func (o *MentalModelResponse) 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{ + "id", + "bank_id", + "name", + "source_query", + "content", + } + + 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) + } + } + + varMentalModelResponse := _MentalModelResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varMentalModelResponse) + + if err != nil { + return err + } + + *o = MentalModelResponse(varMentalModelResponse) + + return err +} + +type NullableMentalModelResponse struct { + value *MentalModelResponse + isSet bool +} + +func (v NullableMentalModelResponse) Get() *MentalModelResponse { + return v.value +} + +func (v *NullableMentalModelResponse) Set(val *MentalModelResponse) { + v.value = val + v.isSet = true +} + +func (v NullableMentalModelResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableMentalModelResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMentalModelResponse(val *MentalModelResponse) *NullableMentalModelResponse { + return &NullableMentalModelResponse{value: val, isSet: true} +} + +func (v NullableMentalModelResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMentalModelResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_mental_model_trigger.go b/hindsight-clients/go/model_mental_model_trigger.go new file mode 100644 index 00000000..4c227907 --- /dev/null +++ b/hindsight-clients/go/model_mental_model_trigger.go @@ -0,0 +1,131 @@ +/* +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" +) + +// checks if the MentalModelTrigger type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MentalModelTrigger{} + +// MentalModelTrigger Trigger settings for a mental model. +type MentalModelTrigger struct { + // If true, refresh this mental model after observations consolidation (real-time mode) + RefreshAfterConsolidation *bool `json:"refresh_after_consolidation,omitempty"` +} + +// NewMentalModelTrigger instantiates a new MentalModelTrigger 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 NewMentalModelTrigger() *MentalModelTrigger { + this := MentalModelTrigger{} + var refreshAfterConsolidation bool = false + this.RefreshAfterConsolidation = &refreshAfterConsolidation + return &this +} + +// NewMentalModelTriggerWithDefaults instantiates a new MentalModelTrigger 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 NewMentalModelTriggerWithDefaults() *MentalModelTrigger { + this := MentalModelTrigger{} + var refreshAfterConsolidation bool = false + this.RefreshAfterConsolidation = &refreshAfterConsolidation + return &this +} + +// GetRefreshAfterConsolidation returns the RefreshAfterConsolidation field value if set, zero value otherwise. +func (o *MentalModelTrigger) GetRefreshAfterConsolidation() bool { + if o == nil || IsNil(o.RefreshAfterConsolidation) { + var ret bool + return ret + } + return *o.RefreshAfterConsolidation +} + +// GetRefreshAfterConsolidationOk returns a tuple with the RefreshAfterConsolidation field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MentalModelTrigger) GetRefreshAfterConsolidationOk() (*bool, bool) { + if o == nil || IsNil(o.RefreshAfterConsolidation) { + return nil, false + } + return o.RefreshAfterConsolidation, true +} + +// HasRefreshAfterConsolidation returns a boolean if a field has been set. +func (o *MentalModelTrigger) HasRefreshAfterConsolidation() bool { + if o != nil && !IsNil(o.RefreshAfterConsolidation) { + return true + } + + return false +} + +// SetRefreshAfterConsolidation gets a reference to the given bool and assigns it to the RefreshAfterConsolidation field. +func (o *MentalModelTrigger) SetRefreshAfterConsolidation(v bool) { + o.RefreshAfterConsolidation = &v +} + +func (o MentalModelTrigger) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MentalModelTrigger) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.RefreshAfterConsolidation) { + toSerialize["refresh_after_consolidation"] = o.RefreshAfterConsolidation + } + return toSerialize, nil +} + +type NullableMentalModelTrigger struct { + value *MentalModelTrigger + isSet bool +} + +func (v NullableMentalModelTrigger) Get() *MentalModelTrigger { + return v.value +} + +func (v *NullableMentalModelTrigger) Set(val *MentalModelTrigger) { + v.value = val + v.isSet = true +} + +func (v NullableMentalModelTrigger) IsSet() bool { + return v.isSet +} + +func (v *NullableMentalModelTrigger) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMentalModelTrigger(val *MentalModelTrigger) *NullableMentalModelTrigger { + return &NullableMentalModelTrigger{value: val, isSet: true} +} + +func (v NullableMentalModelTrigger) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMentalModelTrigger) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_operation_response.go b/hindsight-clients/go/model_operation_response.go new file mode 100644 index 00000000..f516218f --- /dev/null +++ b/hindsight-clients/go/model_operation_response.go @@ -0,0 +1,346 @@ +/* +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 OperationResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OperationResponse{} + +// OperationResponse Response model for a single async operation. +type OperationResponse struct { + Id string `json:"id"` + TaskType string `json:"task_type"` + ItemsCount int32 `json:"items_count"` + DocumentId NullableString `json:"document_id,omitempty"` + CreatedAt string `json:"created_at"` + Status string `json:"status"` + ErrorMessage NullableString `json:"error_message"` +} + +type _OperationResponse OperationResponse + +// NewOperationResponse instantiates a new OperationResponse 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 NewOperationResponse(id string, taskType string, itemsCount int32, createdAt string, status string, errorMessage NullableString) *OperationResponse { + this := OperationResponse{} + this.Id = id + this.TaskType = taskType + this.ItemsCount = itemsCount + this.CreatedAt = createdAt + this.Status = status + this.ErrorMessage = errorMessage + return &this +} + +// NewOperationResponseWithDefaults instantiates a new OperationResponse 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 NewOperationResponseWithDefaults() *OperationResponse { + this := OperationResponse{} + return &this +} + +// GetId returns the Id field value +func (o *OperationResponse) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *OperationResponse) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *OperationResponse) SetId(v string) { + o.Id = v +} + +// GetTaskType returns the TaskType field value +func (o *OperationResponse) GetTaskType() string { + if o == nil { + var ret string + return ret + } + + return o.TaskType +} + +// GetTaskTypeOk returns a tuple with the TaskType field value +// and a boolean to check if the value has been set. +func (o *OperationResponse) GetTaskTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TaskType, true +} + +// SetTaskType sets field value +func (o *OperationResponse) SetTaskType(v string) { + o.TaskType = v +} + +// GetItemsCount returns the ItemsCount field value +func (o *OperationResponse) GetItemsCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ItemsCount +} + +// GetItemsCountOk returns a tuple with the ItemsCount field value +// and a boolean to check if the value has been set. +func (o *OperationResponse) GetItemsCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ItemsCount, true +} + +// SetItemsCount sets field value +func (o *OperationResponse) SetItemsCount(v int32) { + o.ItemsCount = v +} + +// GetDocumentId returns the DocumentId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *OperationResponse) GetDocumentId() string { + if o == nil || IsNil(o.DocumentId.Get()) { + var ret string + return ret + } + return *o.DocumentId.Get() +} + +// GetDocumentIdOk returns a tuple with the DocumentId 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 *OperationResponse) GetDocumentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DocumentId.Get(), o.DocumentId.IsSet() +} + +// HasDocumentId returns a boolean if a field has been set. +func (o *OperationResponse) HasDocumentId() bool { + if o != nil && o.DocumentId.IsSet() { + return true + } + + return false +} + +// SetDocumentId gets a reference to the given NullableString and assigns it to the DocumentId field. +func (o *OperationResponse) SetDocumentId(v string) { + o.DocumentId.Set(&v) +} +// SetDocumentIdNil sets the value for DocumentId to be an explicit nil +func (o *OperationResponse) SetDocumentIdNil() { + o.DocumentId.Set(nil) +} + +// UnsetDocumentId ensures that no value is present for DocumentId, not even an explicit nil +func (o *OperationResponse) UnsetDocumentId() { + o.DocumentId.Unset() +} + +// GetCreatedAt returns the CreatedAt field value +func (o *OperationResponse) GetCreatedAt() string { + if o == nil { + var ret string + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *OperationResponse) GetCreatedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *OperationResponse) SetCreatedAt(v string) { + o.CreatedAt = v +} + +// GetStatus returns the Status field value +func (o *OperationResponse) 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 *OperationResponse) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *OperationResponse) SetStatus(v string) { + o.Status = v +} + +// GetErrorMessage returns the ErrorMessage field value +// If the value is explicit nil, the zero value for string will be returned +func (o *OperationResponse) GetErrorMessage() string { + if o == nil || o.ErrorMessage.Get() == nil { + var ret string + return ret + } + + return *o.ErrorMessage.Get() +} + +// GetErrorMessageOk returns a tuple with the ErrorMessage field value +// 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 *OperationResponse) GetErrorMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ErrorMessage.Get(), o.ErrorMessage.IsSet() +} + +// SetErrorMessage sets field value +func (o *OperationResponse) SetErrorMessage(v string) { + o.ErrorMessage.Set(&v) +} + +func (o OperationResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OperationResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["task_type"] = o.TaskType + toSerialize["items_count"] = o.ItemsCount + if o.DocumentId.IsSet() { + toSerialize["document_id"] = o.DocumentId.Get() + } + toSerialize["created_at"] = o.CreatedAt + toSerialize["status"] = o.Status + toSerialize["error_message"] = o.ErrorMessage.Get() + return toSerialize, nil +} + +func (o *OperationResponse) 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{ + "id", + "task_type", + "items_count", + "created_at", + "status", + "error_message", + } + + 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) + } + } + + varOperationResponse := _OperationResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varOperationResponse) + + if err != nil { + return err + } + + *o = OperationResponse(varOperationResponse) + + return err +} + +type NullableOperationResponse struct { + value *OperationResponse + isSet bool +} + +func (v NullableOperationResponse) Get() *OperationResponse { + return v.value +} + +func (v *NullableOperationResponse) Set(val *OperationResponse) { + v.value = val + v.isSet = true +} + +func (v NullableOperationResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableOperationResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOperationResponse(val *OperationResponse) *NullableOperationResponse { + return &NullableOperationResponse{value: val, isSet: true} +} + +func (v NullableOperationResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOperationResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_operation_status_response.go b/hindsight-clients/go/model_operation_status_response.go new file mode 100644 index 00000000..a493f087 --- /dev/null +++ b/hindsight-clients/go/model_operation_status_response.go @@ -0,0 +1,490 @@ +/* +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) +} + + diff --git a/hindsight-clients/go/model_operations_list_response.go b/hindsight-clients/go/model_operations_list_response.go new file mode 100644 index 00000000..07ec76c5 --- /dev/null +++ b/hindsight-clients/go/model_operations_list_response.go @@ -0,0 +1,270 @@ +/* +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 OperationsListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &OperationsListResponse{} + +// OperationsListResponse Response model for list operations endpoint. +type OperationsListResponse struct { + BankId string `json:"bank_id"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` + Offset int32 `json:"offset"` + Operations []OperationResponse `json:"operations"` +} + +type _OperationsListResponse OperationsListResponse + +// NewOperationsListResponse instantiates a new OperationsListResponse 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 NewOperationsListResponse(bankId string, total int32, limit int32, offset int32, operations []OperationResponse) *OperationsListResponse { + this := OperationsListResponse{} + this.BankId = bankId + this.Total = total + this.Limit = limit + this.Offset = offset + this.Operations = operations + return &this +} + +// NewOperationsListResponseWithDefaults instantiates a new OperationsListResponse 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 NewOperationsListResponseWithDefaults() *OperationsListResponse { + this := OperationsListResponse{} + return &this +} + +// GetBankId returns the BankId field value +func (o *OperationsListResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *OperationsListResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *OperationsListResponse) SetBankId(v string) { + o.BankId = v +} + +// GetTotal returns the Total field value +func (o *OperationsListResponse) GetTotal() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Total +} + +// GetTotalOk returns a tuple with the Total field value +// and a boolean to check if the value has been set. +func (o *OperationsListResponse) GetTotalOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Total, true +} + +// SetTotal sets field value +func (o *OperationsListResponse) SetTotal(v int32) { + o.Total = v +} + +// GetLimit returns the Limit field value +func (o *OperationsListResponse) GetLimit() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Limit +} + +// GetLimitOk returns a tuple with the Limit field value +// and a boolean to check if the value has been set. +func (o *OperationsListResponse) GetLimitOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Limit, true +} + +// SetLimit sets field value +func (o *OperationsListResponse) SetLimit(v int32) { + o.Limit = v +} + +// GetOffset returns the Offset field value +func (o *OperationsListResponse) GetOffset() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Offset +} + +// GetOffsetOk returns a tuple with the Offset field value +// and a boolean to check if the value has been set. +func (o *OperationsListResponse) GetOffsetOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Offset, true +} + +// SetOffset sets field value +func (o *OperationsListResponse) SetOffset(v int32) { + o.Offset = v +} + +// GetOperations returns the Operations field value +func (o *OperationsListResponse) GetOperations() []OperationResponse { + if o == nil { + var ret []OperationResponse + return ret + } + + return o.Operations +} + +// GetOperationsOk returns a tuple with the Operations field value +// and a boolean to check if the value has been set. +func (o *OperationsListResponse) GetOperationsOk() ([]OperationResponse, bool) { + if o == nil { + return nil, false + } + return o.Operations, true +} + +// SetOperations sets field value +func (o *OperationsListResponse) SetOperations(v []OperationResponse) { + o.Operations = v +} + +func (o OperationsListResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o OperationsListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["bank_id"] = o.BankId + toSerialize["total"] = o.Total + toSerialize["limit"] = o.Limit + toSerialize["offset"] = o.Offset + toSerialize["operations"] = o.Operations + return toSerialize, nil +} + +func (o *OperationsListResponse) 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{ + "bank_id", + "total", + "limit", + "offset", + "operations", + } + + 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) + } + } + + varOperationsListResponse := _OperationsListResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varOperationsListResponse) + + if err != nil { + return err + } + + *o = OperationsListResponse(varOperationsListResponse) + + return err +} + +type NullableOperationsListResponse struct { + value *OperationsListResponse + isSet bool +} + +func (v NullableOperationsListResponse) Get() *OperationsListResponse { + return v.value +} + +func (v *NullableOperationsListResponse) Set(val *OperationsListResponse) { + v.value = val + v.isSet = true +} + +func (v NullableOperationsListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableOperationsListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableOperationsListResponse(val *OperationsListResponse) *NullableOperationsListResponse { + return &NullableOperationsListResponse{value: val, isSet: true} +} + +func (v NullableOperationsListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableOperationsListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_recall_request.go b/hindsight-clients/go/model_recall_request.go new file mode 100644 index 00000000..0bc6ee59 --- /dev/null +++ b/hindsight-clients/go/model_recall_request.go @@ -0,0 +1,472 @@ +/* +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) +} + + diff --git a/hindsight-clients/go/model_recall_response.go b/hindsight-clients/go/model_recall_response.go new file mode 100644 index 00000000..d6a7fe3c --- /dev/null +++ b/hindsight-clients/go/model_recall_response.go @@ -0,0 +1,269 @@ +/* +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 RecallResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecallResponse{} + +// RecallResponse Response model for recall endpoints. +type RecallResponse struct { + Results []RecallResult `json:"results"` + Trace map[string]interface{} `json:"trace,omitempty"` + Entities map[string]EntityStateResponse `json:"entities,omitempty"` + Chunks map[string]ChunkData `json:"chunks,omitempty"` +} + +type _RecallResponse RecallResponse + +// NewRecallResponse instantiates a new RecallResponse 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 NewRecallResponse(results []RecallResult) *RecallResponse { + this := RecallResponse{} + this.Results = results + return &this +} + +// NewRecallResponseWithDefaults instantiates a new RecallResponse 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 NewRecallResponseWithDefaults() *RecallResponse { + this := RecallResponse{} + return &this +} + +// GetResults returns the Results field value +func (o *RecallResponse) GetResults() []RecallResult { + if o == nil { + var ret []RecallResult + return ret + } + + return o.Results +} + +// GetResultsOk returns a tuple with the Results field value +// and a boolean to check if the value has been set. +func (o *RecallResponse) GetResultsOk() ([]RecallResult, bool) { + if o == nil { + return nil, false + } + return o.Results, true +} + +// SetResults sets field value +func (o *RecallResponse) SetResults(v []RecallResult) { + o.Results = v +} + +// GetTrace returns the Trace field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResponse) GetTrace() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + 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. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *RecallResponse) GetTraceOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Trace) { + return map[string]interface{}{}, false + } + return o.Trace, true +} + +// HasTrace returns a boolean if a field has been set. +func (o *RecallResponse) HasTrace() bool { + if o != nil && !IsNil(o.Trace) { + return true + } + + return false +} + +// SetTrace gets a reference to the given map[string]interface{} and assigns it to the Trace field. +func (o *RecallResponse) SetTrace(v map[string]interface{}) { + o.Trace = v +} + +// GetEntities returns the Entities field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResponse) GetEntities() map[string]EntityStateResponse { + if o == nil { + var ret map[string]EntityStateResponse + return ret + } + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities 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 *RecallResponse) GetEntitiesOk() (map[string]EntityStateResponse, bool) { + if o == nil || IsNil(o.Entities) { + return map[string]EntityStateResponse{}, false + } + return o.Entities, true +} + +// HasEntities returns a boolean if a field has been set. +func (o *RecallResponse) HasEntities() bool { + if o != nil && !IsNil(o.Entities) { + return true + } + + return false +} + +// SetEntities gets a reference to the given map[string]EntityStateResponse and assigns it to the Entities field. +func (o *RecallResponse) SetEntities(v map[string]EntityStateResponse) { + o.Entities = v +} + +// GetChunks returns the Chunks field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResponse) GetChunks() map[string]ChunkData { + if o == nil { + var ret map[string]ChunkData + return ret + } + return o.Chunks +} + +// GetChunksOk returns a tuple with the Chunks 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 *RecallResponse) GetChunksOk() (map[string]ChunkData, bool) { + if o == nil || IsNil(o.Chunks) { + return map[string]ChunkData{}, false + } + return o.Chunks, true +} + +// HasChunks returns a boolean if a field has been set. +func (o *RecallResponse) HasChunks() bool { + if o != nil && !IsNil(o.Chunks) { + return true + } + + return false +} + +// SetChunks gets a reference to the given map[string]ChunkData and assigns it to the Chunks field. +func (o *RecallResponse) SetChunks(v map[string]ChunkData) { + o.Chunks = v +} + +func (o RecallResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecallResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["results"] = o.Results + if o.Trace != nil { + toSerialize["trace"] = o.Trace + } + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + if o.Chunks != nil { + toSerialize["chunks"] = o.Chunks + } + return toSerialize, nil +} + +func (o *RecallResponse) 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{ + "results", + } + + 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) + } + } + + varRecallResponse := _RecallResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecallResponse) + + if err != nil { + return err + } + + *o = RecallResponse(varRecallResponse) + + return err +} + +type NullableRecallResponse struct { + value *RecallResponse + isSet bool +} + +func (v NullableRecallResponse) Get() *RecallResponse { + return v.value +} + +func (v *NullableRecallResponse) Set(val *RecallResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRecallResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRecallResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRecallResponse(val *RecallResponse) *NullableRecallResponse { + return &NullableRecallResponse{value: val, isSet: true} +} + +func (v NullableRecallResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRecallResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_recall_result.go b/hindsight-clients/go/model_recall_result.go new file mode 100644 index 00000000..cb871fad --- /dev/null +++ b/hindsight-clients/go/model_recall_result.go @@ -0,0 +1,619 @@ +/* +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 RecallResult type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RecallResult{} + +// RecallResult Single recall result item. +type RecallResult struct { + Id string `json:"id"` + Text string `json:"text"` + Type NullableString `json:"type,omitempty"` + Entities []string `json:"entities,omitempty"` + Context NullableString `json:"context,omitempty"` + OccurredStart NullableString `json:"occurred_start,omitempty"` + OccurredEnd NullableString `json:"occurred_end,omitempty"` + MentionedAt NullableString `json:"mentioned_at,omitempty"` + DocumentId NullableString `json:"document_id,omitempty"` + Metadata map[string]string `json:"metadata,omitempty"` + ChunkId NullableString `json:"chunk_id,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +type _RecallResult RecallResult + +// NewRecallResult instantiates a new RecallResult 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 NewRecallResult(id string, text string) *RecallResult { + this := RecallResult{} + this.Id = id + this.Text = text + return &this +} + +// NewRecallResultWithDefaults instantiates a new RecallResult 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 NewRecallResultWithDefaults() *RecallResult { + this := RecallResult{} + return &this +} + +// GetId returns the Id field value +func (o *RecallResult) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RecallResult) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *RecallResult) SetId(v string) { + o.Id = v +} + +// GetText returns the Text field value +func (o *RecallResult) GetText() string { + if o == nil { + var ret string + return ret + } + + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *RecallResult) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value +func (o *RecallResult) SetText(v string) { + o.Text = v +} + +// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetType() string { + if o == nil || IsNil(o.Type.Get()) { + var ret string + return ret + } + return *o.Type.Get() +} + +// GetTypeOk returns a tuple with the Type 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 *RecallResult) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type.Get(), o.Type.IsSet() +} + +// HasType returns a boolean if a field has been set. +func (o *RecallResult) HasType() bool { + if o != nil && o.Type.IsSet() { + return true + } + + return false +} + +// SetType gets a reference to the given NullableString and assigns it to the Type field. +func (o *RecallResult) SetType(v string) { + o.Type.Set(&v) +} +// SetTypeNil sets the value for Type to be an explicit nil +func (o *RecallResult) SetTypeNil() { + o.Type.Set(nil) +} + +// UnsetType ensures that no value is present for Type, not even an explicit nil +func (o *RecallResult) UnsetType() { + o.Type.Unset() +} + +// GetEntities returns the Entities field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetEntities() []string { + if o == nil { + var ret []string + return ret + } + return o.Entities +} + +// GetEntitiesOk returns a tuple with the Entities 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 *RecallResult) GetEntitiesOk() ([]string, bool) { + if o == nil || IsNil(o.Entities) { + return nil, false + } + return o.Entities, true +} + +// HasEntities returns a boolean if a field has been set. +func (o *RecallResult) HasEntities() bool { + if o != nil && !IsNil(o.Entities) { + return true + } + + return false +} + +// SetEntities gets a reference to the given []string and assigns it to the Entities field. +func (o *RecallResult) SetEntities(v []string) { + o.Entities = v +} + +// GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) SetContext(v string) { + o.Context.Set(&v) +} +// SetContextNil sets the value for Context to be an explicit nil +func (o *RecallResult) SetContextNil() { + o.Context.Set(nil) +} + +// UnsetContext ensures that no value is present for Context, not even an explicit nil +func (o *RecallResult) UnsetContext() { + o.Context.Unset() +} + +// GetOccurredStart returns the OccurredStart field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetOccurredStart() string { + if o == nil || IsNil(o.OccurredStart.Get()) { + var ret string + return ret + } + return *o.OccurredStart.Get() +} + +// GetOccurredStartOk returns a tuple with the OccurredStart 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 *RecallResult) GetOccurredStartOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OccurredStart.Get(), o.OccurredStart.IsSet() +} + +// HasOccurredStart returns a boolean if a field has been set. +func (o *RecallResult) HasOccurredStart() bool { + if o != nil && o.OccurredStart.IsSet() { + return true + } + + return false +} + +// SetOccurredStart gets a reference to the given NullableString and assigns it to the OccurredStart field. +func (o *RecallResult) SetOccurredStart(v string) { + o.OccurredStart.Set(&v) +} +// SetOccurredStartNil sets the value for OccurredStart to be an explicit nil +func (o *RecallResult) SetOccurredStartNil() { + o.OccurredStart.Set(nil) +} + +// UnsetOccurredStart ensures that no value is present for OccurredStart, not even an explicit nil +func (o *RecallResult) UnsetOccurredStart() { + o.OccurredStart.Unset() +} + +// GetOccurredEnd returns the OccurredEnd field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetOccurredEnd() string { + if o == nil || IsNil(o.OccurredEnd.Get()) { + var ret string + return ret + } + return *o.OccurredEnd.Get() +} + +// GetOccurredEndOk returns a tuple with the OccurredEnd 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 *RecallResult) GetOccurredEndOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OccurredEnd.Get(), o.OccurredEnd.IsSet() +} + +// HasOccurredEnd returns a boolean if a field has been set. +func (o *RecallResult) HasOccurredEnd() bool { + if o != nil && o.OccurredEnd.IsSet() { + return true + } + + return false +} + +// SetOccurredEnd gets a reference to the given NullableString and assigns it to the OccurredEnd field. +func (o *RecallResult) SetOccurredEnd(v string) { + o.OccurredEnd.Set(&v) +} +// SetOccurredEndNil sets the value for OccurredEnd to be an explicit nil +func (o *RecallResult) SetOccurredEndNil() { + o.OccurredEnd.Set(nil) +} + +// UnsetOccurredEnd ensures that no value is present for OccurredEnd, not even an explicit nil +func (o *RecallResult) UnsetOccurredEnd() { + o.OccurredEnd.Unset() +} + +// GetMentionedAt returns the MentionedAt field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetMentionedAt() string { + if o == nil || IsNil(o.MentionedAt.Get()) { + var ret string + return ret + } + return *o.MentionedAt.Get() +} + +// GetMentionedAtOk returns a tuple with the MentionedAt 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 *RecallResult) GetMentionedAtOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.MentionedAt.Get(), o.MentionedAt.IsSet() +} + +// HasMentionedAt returns a boolean if a field has been set. +func (o *RecallResult) HasMentionedAt() bool { + if o != nil && o.MentionedAt.IsSet() { + return true + } + + return false +} + +// SetMentionedAt gets a reference to the given NullableString and assigns it to the MentionedAt field. +func (o *RecallResult) SetMentionedAt(v string) { + o.MentionedAt.Set(&v) +} +// SetMentionedAtNil sets the value for MentionedAt to be an explicit nil +func (o *RecallResult) SetMentionedAtNil() { + o.MentionedAt.Set(nil) +} + +// UnsetMentionedAt ensures that no value is present for MentionedAt, not even an explicit nil +func (o *RecallResult) UnsetMentionedAt() { + o.MentionedAt.Unset() +} + +// GetDocumentId returns the DocumentId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetDocumentId() string { + if o == nil || IsNil(o.DocumentId.Get()) { + var ret string + return ret + } + return *o.DocumentId.Get() +} + +// GetDocumentIdOk returns a tuple with the DocumentId 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 *RecallResult) GetDocumentIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.DocumentId.Get(), o.DocumentId.IsSet() +} + +// HasDocumentId returns a boolean if a field has been set. +func (o *RecallResult) HasDocumentId() bool { + if o != nil && o.DocumentId.IsSet() { + return true + } + + return false +} + +// SetDocumentId gets a reference to the given NullableString and assigns it to the DocumentId field. +func (o *RecallResult) SetDocumentId(v string) { + o.DocumentId.Set(&v) +} +// SetDocumentIdNil sets the value for DocumentId to be an explicit nil +func (o *RecallResult) SetDocumentIdNil() { + o.DocumentId.Set(nil) +} + +// UnsetDocumentId ensures that no value is present for DocumentId, not even an explicit nil +func (o *RecallResult) UnsetDocumentId() { + o.DocumentId.Unset() +} + +// GetMetadata returns the Metadata field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetMetadata() map[string]string { + if o == nil { + var ret map[string]string + return ret + } + return o.Metadata +} + +// GetMetadataOk returns a tuple with the Metadata 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 *RecallResult) GetMetadataOk() (map[string]string, bool) { + if o == nil || IsNil(o.Metadata) { + return map[string]string{}, false + } + return o.Metadata, true +} + +// HasMetadata returns a boolean if a field has been set. +func (o *RecallResult) HasMetadata() bool { + if o != nil && !IsNil(o.Metadata) { + return true + } + + return false +} + +// SetMetadata gets a reference to the given map[string]string and assigns it to the Metadata field. +func (o *RecallResult) SetMetadata(v map[string]string) { + o.Metadata = v +} + +// GetChunkId returns the ChunkId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) GetChunkId() string { + if o == nil || IsNil(o.ChunkId.Get()) { + var ret string + return ret + } + return *o.ChunkId.Get() +} + +// GetChunkIdOk returns a tuple with the ChunkId 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 *RecallResult) GetChunkIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ChunkId.Get(), o.ChunkId.IsSet() +} + +// HasChunkId returns a boolean if a field has been set. +func (o *RecallResult) HasChunkId() bool { + if o != nil && o.ChunkId.IsSet() { + return true + } + + return false +} + +// SetChunkId gets a reference to the given NullableString and assigns it to the ChunkId field. +func (o *RecallResult) SetChunkId(v string) { + o.ChunkId.Set(&v) +} +// SetChunkIdNil sets the value for ChunkId to be an explicit nil +func (o *RecallResult) SetChunkIdNil() { + o.ChunkId.Set(nil) +} + +// UnsetChunkId ensures that no value is present for ChunkId, not even an explicit nil +func (o *RecallResult) UnsetChunkId() { + o.ChunkId.Unset() +} + +// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RecallResult) 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 *RecallResult) 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 *RecallResult) 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 *RecallResult) SetTags(v []string) { + o.Tags = v +} + +func (o RecallResult) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RecallResult) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["text"] = o.Text + if o.Type.IsSet() { + toSerialize["type"] = o.Type.Get() + } + if o.Entities != nil { + toSerialize["entities"] = o.Entities + } + if o.Context.IsSet() { + toSerialize["context"] = o.Context.Get() + } + if o.OccurredStart.IsSet() { + toSerialize["occurred_start"] = o.OccurredStart.Get() + } + if o.OccurredEnd.IsSet() { + toSerialize["occurred_end"] = o.OccurredEnd.Get() + } + if o.MentionedAt.IsSet() { + toSerialize["mentioned_at"] = o.MentionedAt.Get() + } + if o.DocumentId.IsSet() { + toSerialize["document_id"] = o.DocumentId.Get() + } + if o.Metadata != nil { + toSerialize["metadata"] = o.Metadata + } + if o.ChunkId.IsSet() { + toSerialize["chunk_id"] = o.ChunkId.Get() + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + return toSerialize, nil +} + +func (o *RecallResult) 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{ + "id", + "text", + } + + 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) + } + } + + varRecallResult := _RecallResult{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRecallResult) + + if err != nil { + return err + } + + *o = RecallResult(varRecallResult) + + return err +} + +type NullableRecallResult struct { + value *RecallResult + isSet bool +} + +func (v NullableRecallResult) Get() *RecallResult { + return v.value +} + +func (v *NullableRecallResult) Set(val *RecallResult) { + v.value = val + v.isSet = true +} + +func (v NullableRecallResult) IsSet() bool { + return v.isSet +} + +func (v *NullableRecallResult) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRecallResult(val *RecallResult) *NullableRecallResult { + return &NullableRecallResult{value: val, isSet: true} +} + +func (v NullableRecallResult) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRecallResult) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_based_on.go b/hindsight-clients/go/model_reflect_based_on.go new file mode 100644 index 00000000..ae6c2d67 --- /dev/null +++ b/hindsight-clients/go/model_reflect_based_on.go @@ -0,0 +1,201 @@ +/* +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" +) + +// checks if the ReflectBasedOn type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectBasedOn{} + +// ReflectBasedOn Evidence the response is based on: memories, mental models, and directives. +type ReflectBasedOn struct { + // Memory facts used to generate the response + Memories []ReflectFact `json:"memories,omitempty"` + // Mental models used during reflection + MentalModels []ReflectMentalModel `json:"mental_models,omitempty"` + // Directives applied during reflection + Directives []ReflectDirective `json:"directives,omitempty"` +} + +// NewReflectBasedOn instantiates a new ReflectBasedOn 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 NewReflectBasedOn() *ReflectBasedOn { + this := ReflectBasedOn{} + return &this +} + +// NewReflectBasedOnWithDefaults instantiates a new ReflectBasedOn 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 NewReflectBasedOnWithDefaults() *ReflectBasedOn { + this := ReflectBasedOn{} + return &this +} + +// GetMemories returns the Memories field value if set, zero value otherwise. +func (o *ReflectBasedOn) GetMemories() []ReflectFact { + if o == nil || IsNil(o.Memories) { + var ret []ReflectFact + return ret + } + return o.Memories +} + +// GetMemoriesOk returns a tuple with the Memories field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReflectBasedOn) GetMemoriesOk() ([]ReflectFact, bool) { + if o == nil || IsNil(o.Memories) { + return nil, false + } + return o.Memories, true +} + +// HasMemories returns a boolean if a field has been set. +func (o *ReflectBasedOn) HasMemories() bool { + if o != nil && !IsNil(o.Memories) { + return true + } + + return false +} + +// SetMemories gets a reference to the given []ReflectFact and assigns it to the Memories field. +func (o *ReflectBasedOn) SetMemories(v []ReflectFact) { + o.Memories = v +} + +// GetMentalModels returns the MentalModels field value if set, zero value otherwise. +func (o *ReflectBasedOn) GetMentalModels() []ReflectMentalModel { + if o == nil || IsNil(o.MentalModels) { + var ret []ReflectMentalModel + return ret + } + return o.MentalModels +} + +// GetMentalModelsOk returns a tuple with the MentalModels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReflectBasedOn) GetMentalModelsOk() ([]ReflectMentalModel, bool) { + if o == nil || IsNil(o.MentalModels) { + return nil, false + } + return o.MentalModels, true +} + +// HasMentalModels returns a boolean if a field has been set. +func (o *ReflectBasedOn) HasMentalModels() bool { + if o != nil && !IsNil(o.MentalModels) { + return true + } + + return false +} + +// SetMentalModels gets a reference to the given []ReflectMentalModel and assigns it to the MentalModels field. +func (o *ReflectBasedOn) SetMentalModels(v []ReflectMentalModel) { + o.MentalModels = v +} + +// GetDirectives returns the Directives field value if set, zero value otherwise. +func (o *ReflectBasedOn) GetDirectives() []ReflectDirective { + if o == nil || IsNil(o.Directives) { + var ret []ReflectDirective + return ret + } + return o.Directives +} + +// GetDirectivesOk returns a tuple with the Directives field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReflectBasedOn) GetDirectivesOk() ([]ReflectDirective, bool) { + if o == nil || IsNil(o.Directives) { + return nil, false + } + return o.Directives, true +} + +// HasDirectives returns a boolean if a field has been set. +func (o *ReflectBasedOn) HasDirectives() bool { + if o != nil && !IsNil(o.Directives) { + return true + } + + return false +} + +// SetDirectives gets a reference to the given []ReflectDirective and assigns it to the Directives field. +func (o *ReflectBasedOn) SetDirectives(v []ReflectDirective) { + o.Directives = v +} + +func (o ReflectBasedOn) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectBasedOn) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Memories) { + toSerialize["memories"] = o.Memories + } + if !IsNil(o.MentalModels) { + toSerialize["mental_models"] = o.MentalModels + } + if !IsNil(o.Directives) { + toSerialize["directives"] = o.Directives + } + return toSerialize, nil +} + +type NullableReflectBasedOn struct { + value *ReflectBasedOn + isSet bool +} + +func (v NullableReflectBasedOn) Get() *ReflectBasedOn { + return v.value +} + +func (v *NullableReflectBasedOn) Set(val *ReflectBasedOn) { + v.value = val + v.isSet = true +} + +func (v NullableReflectBasedOn) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectBasedOn) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectBasedOn(val *ReflectBasedOn) *NullableReflectBasedOn { + return &NullableReflectBasedOn{value: val, isSet: true} +} + +func (v NullableReflectBasedOn) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectBasedOn) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_directive.go b/hindsight-clients/go/model_reflect_directive.go new file mode 100644 index 00000000..52508822 --- /dev/null +++ b/hindsight-clients/go/model_reflect_directive.go @@ -0,0 +1,217 @@ +/* +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 ReflectDirective type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectDirective{} + +// ReflectDirective A directive applied during reflect. +type ReflectDirective struct { + // Directive ID + Id string `json:"id"` + // Directive name + Name string `json:"name"` + // Directive content + Content string `json:"content"` +} + +type _ReflectDirective ReflectDirective + +// NewReflectDirective instantiates a new ReflectDirective 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 NewReflectDirective(id string, name string, content string) *ReflectDirective { + this := ReflectDirective{} + this.Id = id + this.Name = name + this.Content = content + return &this +} + +// NewReflectDirectiveWithDefaults instantiates a new ReflectDirective 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 NewReflectDirectiveWithDefaults() *ReflectDirective { + this := ReflectDirective{} + return &this +} + +// GetId returns the Id field value +func (o *ReflectDirective) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ReflectDirective) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ReflectDirective) SetId(v string) { + o.Id = v +} + +// GetName returns the Name field value +func (o *ReflectDirective) GetName() string { + if o == nil { + var ret string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *ReflectDirective) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value +func (o *ReflectDirective) SetName(v string) { + o.Name = v +} + +// GetContent returns the Content field value +func (o *ReflectDirective) GetContent() string { + if o == nil { + var ret string + return ret + } + + return o.Content +} + +// GetContentOk returns a tuple with the Content field value +// and a boolean to check if the value has been set. +func (o *ReflectDirective) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Content, true +} + +// SetContent sets field value +func (o *ReflectDirective) SetContent(v string) { + o.Content = v +} + +func (o ReflectDirective) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectDirective) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["name"] = o.Name + toSerialize["content"] = o.Content + return toSerialize, nil +} + +func (o *ReflectDirective) 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{ + "id", + "name", + "content", + } + + 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) + } + } + + varReflectDirective := _ReflectDirective{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReflectDirective) + + if err != nil { + return err + } + + *o = ReflectDirective(varReflectDirective) + + return err +} + +type NullableReflectDirective struct { + value *ReflectDirective + isSet bool +} + +func (v NullableReflectDirective) Get() *ReflectDirective { + return v.value +} + +func (v *NullableReflectDirective) Set(val *ReflectDirective) { + v.value = val + v.isSet = true +} + +func (v NullableReflectDirective) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectDirective) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectDirective(val *ReflectDirective) *NullableReflectDirective { + return &NullableReflectDirective{value: val, isSet: true} +} + +func (v NullableReflectDirective) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectDirective) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_fact.go b/hindsight-clients/go/model_reflect_fact.go new file mode 100644 index 00000000..c3856823 --- /dev/null +++ b/hindsight-clients/go/model_reflect_fact.go @@ -0,0 +1,389 @@ +/* +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 ReflectFact type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectFact{} + +// ReflectFact A fact used in think response. +type ReflectFact struct { + Id NullableString `json:"id,omitempty"` + // Fact text. When type='observation', this contains markdown-formatted consolidated knowledge + Text string `json:"text"` + Type NullableString `json:"type,omitempty"` + Context NullableString `json:"context,omitempty"` + OccurredStart NullableString `json:"occurred_start,omitempty"` + OccurredEnd NullableString `json:"occurred_end,omitempty"` +} + +type _ReflectFact ReflectFact + +// NewReflectFact instantiates a new ReflectFact 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 NewReflectFact(text string) *ReflectFact { + this := ReflectFact{} + this.Text = text + return &this +} + +// NewReflectFactWithDefaults instantiates a new ReflectFact 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 NewReflectFactWithDefaults() *ReflectFact { + this := ReflectFact{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectFact) GetId() string { + if o == nil || IsNil(o.Id.Get()) { + var ret string + return ret + } + return *o.Id.Get() +} + +// GetIdOk returns a tuple with the Id 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 *ReflectFact) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id.Get(), o.Id.IsSet() +} + +// HasId returns a boolean if a field has been set. +func (o *ReflectFact) HasId() bool { + if o != nil && o.Id.IsSet() { + return true + } + + return false +} + +// SetId gets a reference to the given NullableString and assigns it to the Id field. +func (o *ReflectFact) SetId(v string) { + o.Id.Set(&v) +} +// SetIdNil sets the value for Id to be an explicit nil +func (o *ReflectFact) SetIdNil() { + o.Id.Set(nil) +} + +// UnsetId ensures that no value is present for Id, not even an explicit nil +func (o *ReflectFact) UnsetId() { + o.Id.Unset() +} + +// GetText returns the Text field value +func (o *ReflectFact) GetText() string { + if o == nil { + var ret string + return ret + } + + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *ReflectFact) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value +func (o *ReflectFact) SetText(v string) { + o.Text = v +} + +// GetType returns the Type field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectFact) GetType() string { + if o == nil || IsNil(o.Type.Get()) { + var ret string + return ret + } + return *o.Type.Get() +} + +// GetTypeOk returns a tuple with the Type 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 *ReflectFact) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type.Get(), o.Type.IsSet() +} + +// HasType returns a boolean if a field has been set. +func (o *ReflectFact) HasType() bool { + if o != nil && o.Type.IsSet() { + return true + } + + return false +} + +// SetType gets a reference to the given NullableString and assigns it to the Type field. +func (o *ReflectFact) SetType(v string) { + o.Type.Set(&v) +} +// SetTypeNil sets the value for Type to be an explicit nil +func (o *ReflectFact) SetTypeNil() { + o.Type.Set(nil) +} + +// UnsetType ensures that no value is present for Type, not even an explicit nil +func (o *ReflectFact) UnsetType() { + o.Type.Unset() +} + +// GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectFact) 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 *ReflectFact) 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 *ReflectFact) 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 *ReflectFact) SetContext(v string) { + o.Context.Set(&v) +} +// SetContextNil sets the value for Context to be an explicit nil +func (o *ReflectFact) SetContextNil() { + o.Context.Set(nil) +} + +// UnsetContext ensures that no value is present for Context, not even an explicit nil +func (o *ReflectFact) UnsetContext() { + o.Context.Unset() +} + +// GetOccurredStart returns the OccurredStart field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectFact) GetOccurredStart() string { + if o == nil || IsNil(o.OccurredStart.Get()) { + var ret string + return ret + } + return *o.OccurredStart.Get() +} + +// GetOccurredStartOk returns a tuple with the OccurredStart 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 *ReflectFact) GetOccurredStartOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OccurredStart.Get(), o.OccurredStart.IsSet() +} + +// HasOccurredStart returns a boolean if a field has been set. +func (o *ReflectFact) HasOccurredStart() bool { + if o != nil && o.OccurredStart.IsSet() { + return true + } + + return false +} + +// SetOccurredStart gets a reference to the given NullableString and assigns it to the OccurredStart field. +func (o *ReflectFact) SetOccurredStart(v string) { + o.OccurredStart.Set(&v) +} +// SetOccurredStartNil sets the value for OccurredStart to be an explicit nil +func (o *ReflectFact) SetOccurredStartNil() { + o.OccurredStart.Set(nil) +} + +// UnsetOccurredStart ensures that no value is present for OccurredStart, not even an explicit nil +func (o *ReflectFact) UnsetOccurredStart() { + o.OccurredStart.Unset() +} + +// GetOccurredEnd returns the OccurredEnd field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectFact) GetOccurredEnd() string { + if o == nil || IsNil(o.OccurredEnd.Get()) { + var ret string + return ret + } + return *o.OccurredEnd.Get() +} + +// GetOccurredEndOk returns a tuple with the OccurredEnd 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 *ReflectFact) GetOccurredEndOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OccurredEnd.Get(), o.OccurredEnd.IsSet() +} + +// HasOccurredEnd returns a boolean if a field has been set. +func (o *ReflectFact) HasOccurredEnd() bool { + if o != nil && o.OccurredEnd.IsSet() { + return true + } + + return false +} + +// SetOccurredEnd gets a reference to the given NullableString and assigns it to the OccurredEnd field. +func (o *ReflectFact) SetOccurredEnd(v string) { + o.OccurredEnd.Set(&v) +} +// SetOccurredEndNil sets the value for OccurredEnd to be an explicit nil +func (o *ReflectFact) SetOccurredEndNil() { + o.OccurredEnd.Set(nil) +} + +// UnsetOccurredEnd ensures that no value is present for OccurredEnd, not even an explicit nil +func (o *ReflectFact) UnsetOccurredEnd() { + o.OccurredEnd.Unset() +} + +func (o ReflectFact) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectFact) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Id.IsSet() { + toSerialize["id"] = o.Id.Get() + } + toSerialize["text"] = o.Text + if o.Type.IsSet() { + toSerialize["type"] = o.Type.Get() + } + if o.Context.IsSet() { + toSerialize["context"] = o.Context.Get() + } + if o.OccurredStart.IsSet() { + toSerialize["occurred_start"] = o.OccurredStart.Get() + } + if o.OccurredEnd.IsSet() { + toSerialize["occurred_end"] = o.OccurredEnd.Get() + } + return toSerialize, nil +} + +func (o *ReflectFact) 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{ + "text", + } + + 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) + } + } + + varReflectFact := _ReflectFact{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReflectFact) + + if err != nil { + return err + } + + *o = ReflectFact(varReflectFact) + + return err +} + +type NullableReflectFact struct { + value *ReflectFact + isSet bool +} + +func (v NullableReflectFact) Get() *ReflectFact { + return v.value +} + +func (v *NullableReflectFact) Set(val *ReflectFact) { + v.value = val + v.isSet = true +} + +func (v NullableReflectFact) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectFact) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectFact(val *ReflectFact) *NullableReflectFact { + return &NullableReflectFact{value: val, isSet: true} +} + +func (v NullableReflectFact) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectFact) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_include_options.go b/hindsight-clients/go/model_reflect_include_options.go new file mode 100644 index 00000000..7a229103 --- /dev/null +++ b/hindsight-clients/go/model_reflect_include_options.go @@ -0,0 +1,173 @@ +/* +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" +) + +// checks if the ReflectIncludeOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectIncludeOptions{} + +// ReflectIncludeOptions Options for including additional data in reflect results. +type ReflectIncludeOptions struct { + // Options for including facts (based_on) in reflect results. + Facts map[string]interface{} `json:"facts,omitempty"` + ToolCalls NullableToolCallsIncludeOptions `json:"tool_calls,omitempty"` +} + +// NewReflectIncludeOptions instantiates a new ReflectIncludeOptions 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 NewReflectIncludeOptions() *ReflectIncludeOptions { + this := ReflectIncludeOptions{} + return &this +} + +// NewReflectIncludeOptionsWithDefaults instantiates a new ReflectIncludeOptions 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 NewReflectIncludeOptionsWithDefaults() *ReflectIncludeOptions { + this := ReflectIncludeOptions{} + return &this +} + +// GetFacts returns the Facts field value if set, zero value otherwise. +func (o *ReflectIncludeOptions) GetFacts() map[string]interface{} { + if o == nil || IsNil(o.Facts) { + var ret map[string]interface{} + return ret + } + return o.Facts +} + +// GetFactsOk returns a tuple with the Facts field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReflectIncludeOptions) GetFactsOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Facts) { + return map[string]interface{}{}, false + } + return o.Facts, true +} + +// HasFacts returns a boolean if a field has been set. +func (o *ReflectIncludeOptions) HasFacts() bool { + if o != nil && !IsNil(o.Facts) { + return true + } + + return false +} + +// SetFacts gets a reference to the given map[string]interface{} and assigns it to the Facts field. +func (o *ReflectIncludeOptions) SetFacts(v map[string]interface{}) { + o.Facts = v +} + +// GetToolCalls returns the ToolCalls field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectIncludeOptions) GetToolCalls() ToolCallsIncludeOptions { + if o == nil || IsNil(o.ToolCalls.Get()) { + var ret ToolCallsIncludeOptions + return ret + } + return *o.ToolCalls.Get() +} + +// GetToolCallsOk returns a tuple with the ToolCalls 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 *ReflectIncludeOptions) GetToolCallsOk() (*ToolCallsIncludeOptions, bool) { + if o == nil { + return nil, false + } + return o.ToolCalls.Get(), o.ToolCalls.IsSet() +} + +// HasToolCalls returns a boolean if a field has been set. +func (o *ReflectIncludeOptions) HasToolCalls() bool { + if o != nil && o.ToolCalls.IsSet() { + return true + } + + return false +} + +// SetToolCalls gets a reference to the given NullableToolCallsIncludeOptions and assigns it to the ToolCalls field. +func (o *ReflectIncludeOptions) SetToolCalls(v ToolCallsIncludeOptions) { + o.ToolCalls.Set(&v) +} +// SetToolCallsNil sets the value for ToolCalls to be an explicit nil +func (o *ReflectIncludeOptions) SetToolCallsNil() { + o.ToolCalls.Set(nil) +} + +// UnsetToolCalls ensures that no value is present for ToolCalls, not even an explicit nil +func (o *ReflectIncludeOptions) UnsetToolCalls() { + o.ToolCalls.Unset() +} + +func (o ReflectIncludeOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectIncludeOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Facts) { + toSerialize["facts"] = o.Facts + } + if o.ToolCalls.IsSet() { + toSerialize["tool_calls"] = o.ToolCalls.Get() + } + return toSerialize, nil +} + +type NullableReflectIncludeOptions struct { + value *ReflectIncludeOptions + isSet bool +} + +func (v NullableReflectIncludeOptions) Get() *ReflectIncludeOptions { + return v.value +} + +func (v *NullableReflectIncludeOptions) Set(val *ReflectIncludeOptions) { + v.value = val + v.isSet = true +} + +func (v NullableReflectIncludeOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectIncludeOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectIncludeOptions(val *ReflectIncludeOptions) *NullableReflectIncludeOptions { + return &NullableReflectIncludeOptions{value: val, isSet: true} +} + +func (v NullableReflectIncludeOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectIncludeOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_llm_call.go b/hindsight-clients/go/model_reflect_llm_call.go new file mode 100644 index 00000000..45183c81 --- /dev/null +++ b/hindsight-clients/go/model_reflect_llm_call.go @@ -0,0 +1,188 @@ +/* +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 ReflectLLMCall type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectLLMCall{} + +// ReflectLLMCall An LLM call made during reflect agent execution. +type ReflectLLMCall struct { + // Call scope: agent_1, agent_2, final, etc. + Scope string `json:"scope"` + // Execution time in milliseconds + DurationMs int32 `json:"duration_ms"` +} + +type _ReflectLLMCall ReflectLLMCall + +// NewReflectLLMCall instantiates a new ReflectLLMCall 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 NewReflectLLMCall(scope string, durationMs int32) *ReflectLLMCall { + this := ReflectLLMCall{} + this.Scope = scope + this.DurationMs = durationMs + return &this +} + +// NewReflectLLMCallWithDefaults instantiates a new ReflectLLMCall 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 NewReflectLLMCallWithDefaults() *ReflectLLMCall { + this := ReflectLLMCall{} + return &this +} + +// GetScope returns the Scope field value +func (o *ReflectLLMCall) GetScope() string { + if o == nil { + var ret string + return ret + } + + return o.Scope +} + +// GetScopeOk returns a tuple with the Scope field value +// and a boolean to check if the value has been set. +func (o *ReflectLLMCall) GetScopeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Scope, true +} + +// SetScope sets field value +func (o *ReflectLLMCall) SetScope(v string) { + o.Scope = v +} + +// GetDurationMs returns the DurationMs field value +func (o *ReflectLLMCall) GetDurationMs() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DurationMs +} + +// GetDurationMsOk returns a tuple with the DurationMs field value +// and a boolean to check if the value has been set. +func (o *ReflectLLMCall) GetDurationMsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DurationMs, true +} + +// SetDurationMs sets field value +func (o *ReflectLLMCall) SetDurationMs(v int32) { + o.DurationMs = v +} + +func (o ReflectLLMCall) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectLLMCall) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["scope"] = o.Scope + toSerialize["duration_ms"] = o.DurationMs + return toSerialize, nil +} + +func (o *ReflectLLMCall) 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{ + "scope", + "duration_ms", + } + + 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) + } + } + + varReflectLLMCall := _ReflectLLMCall{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReflectLLMCall) + + if err != nil { + return err + } + + *o = ReflectLLMCall(varReflectLLMCall) + + return err +} + +type NullableReflectLLMCall struct { + value *ReflectLLMCall + isSet bool +} + +func (v NullableReflectLLMCall) Get() *ReflectLLMCall { + return v.value +} + +func (v *NullableReflectLLMCall) Set(val *ReflectLLMCall) { + v.value = val + v.isSet = true +} + +func (v NullableReflectLLMCall) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectLLMCall) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectLLMCall(val *ReflectLLMCall) *NullableReflectLLMCall { + return &NullableReflectLLMCall{value: val, isSet: true} +} + +func (v NullableReflectLLMCall) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectLLMCall) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_mental_model.go b/hindsight-clients/go/model_reflect_mental_model.go new file mode 100644 index 00000000..0d9735ef --- /dev/null +++ b/hindsight-clients/go/model_reflect_mental_model.go @@ -0,0 +1,234 @@ +/* +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 ReflectMentalModel type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectMentalModel{} + +// ReflectMentalModel A mental model used during reflect. +type ReflectMentalModel struct { + // Mental model ID + Id string `json:"id"` + // Mental model content + Text string `json:"text"` + Context NullableString `json:"context,omitempty"` +} + +type _ReflectMentalModel ReflectMentalModel + +// NewReflectMentalModel instantiates a new ReflectMentalModel 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 NewReflectMentalModel(id string, text string) *ReflectMentalModel { + this := ReflectMentalModel{} + this.Id = id + this.Text = text + return &this +} + +// NewReflectMentalModelWithDefaults instantiates a new ReflectMentalModel 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 NewReflectMentalModelWithDefaults() *ReflectMentalModel { + this := ReflectMentalModel{} + return &this +} + +// GetId returns the Id field value +func (o *ReflectMentalModel) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ReflectMentalModel) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *ReflectMentalModel) SetId(v string) { + o.Id = v +} + +// GetText returns the Text field value +func (o *ReflectMentalModel) GetText() string { + if o == nil { + var ret string + return ret + } + + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *ReflectMentalModel) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value +func (o *ReflectMentalModel) SetText(v string) { + o.Text = v +} + +// GetContext returns the Context field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectMentalModel) 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 *ReflectMentalModel) 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 *ReflectMentalModel) 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 *ReflectMentalModel) SetContext(v string) { + o.Context.Set(&v) +} +// SetContextNil sets the value for Context to be an explicit nil +func (o *ReflectMentalModel) SetContextNil() { + o.Context.Set(nil) +} + +// UnsetContext ensures that no value is present for Context, not even an explicit nil +func (o *ReflectMentalModel) UnsetContext() { + o.Context.Unset() +} + +func (o ReflectMentalModel) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectMentalModel) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["id"] = o.Id + toSerialize["text"] = o.Text + if o.Context.IsSet() { + toSerialize["context"] = o.Context.Get() + } + return toSerialize, nil +} + +func (o *ReflectMentalModel) 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{ + "id", + "text", + } + + 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) + } + } + + varReflectMentalModel := _ReflectMentalModel{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReflectMentalModel) + + if err != nil { + return err + } + + *o = ReflectMentalModel(varReflectMentalModel) + + return err +} + +type NullableReflectMentalModel struct { + value *ReflectMentalModel + isSet bool +} + +func (v NullableReflectMentalModel) Get() *ReflectMentalModel { + return v.value +} + +func (v *NullableReflectMentalModel) Set(val *ReflectMentalModel) { + v.value = val + v.isSet = true +} + +func (v NullableReflectMentalModel) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectMentalModel) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectMentalModel(val *ReflectMentalModel) *NullableReflectMentalModel { + return &NullableReflectMentalModel{value: val, isSet: true} +} + +func (v NullableReflectMentalModel) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectMentalModel) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_request.go b/hindsight-clients/go/model_reflect_request.go new file mode 100644 index 00000000..f902e75d --- /dev/null +++ b/hindsight-clients/go/model_reflect_request.go @@ -0,0 +1,433 @@ +/* +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) +} + + diff --git a/hindsight-clients/go/model_reflect_response.go b/hindsight-clients/go/model_reflect_response.go new file mode 100644 index 00000000..d09a2718 --- /dev/null +++ b/hindsight-clients/go/model_reflect_response.go @@ -0,0 +1,334 @@ +/* +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 ReflectResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectResponse{} + +// ReflectResponse Response model for think endpoint. +type ReflectResponse struct { + // The reflect response as well-formatted markdown (headers, lists, bold/italic, code blocks, etc.) + Text string `json:"text"` + BasedOn NullableReflectBasedOn `json:"based_on,omitempty"` + StructuredOutput map[string]interface{} `json:"structured_output,omitempty"` + Usage NullableTokenUsage `json:"usage,omitempty"` + Trace NullableReflectTrace `json:"trace,omitempty"` +} + +type _ReflectResponse ReflectResponse + +// NewReflectResponse instantiates a new ReflectResponse 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 NewReflectResponse(text string) *ReflectResponse { + this := ReflectResponse{} + this.Text = text + return &this +} + +// NewReflectResponseWithDefaults instantiates a new ReflectResponse 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 NewReflectResponseWithDefaults() *ReflectResponse { + this := ReflectResponse{} + return &this +} + +// GetText returns the Text field value +func (o *ReflectResponse) GetText() string { + if o == nil { + var ret string + return ret + } + + return o.Text +} + +// GetTextOk returns a tuple with the Text field value +// and a boolean to check if the value has been set. +func (o *ReflectResponse) GetTextOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Text, true +} + +// SetText sets field value +func (o *ReflectResponse) SetText(v string) { + o.Text = v +} + +// GetBasedOn returns the BasedOn field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectResponse) GetBasedOn() ReflectBasedOn { + if o == nil || IsNil(o.BasedOn.Get()) { + var ret ReflectBasedOn + return ret + } + return *o.BasedOn.Get() +} + +// GetBasedOnOk returns a tuple with the BasedOn 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 *ReflectResponse) GetBasedOnOk() (*ReflectBasedOn, bool) { + if o == nil { + return nil, false + } + return o.BasedOn.Get(), o.BasedOn.IsSet() +} + +// HasBasedOn returns a boolean if a field has been set. +func (o *ReflectResponse) HasBasedOn() bool { + if o != nil && o.BasedOn.IsSet() { + return true + } + + return false +} + +// SetBasedOn gets a reference to the given NullableReflectBasedOn and assigns it to the BasedOn field. +func (o *ReflectResponse) SetBasedOn(v ReflectBasedOn) { + o.BasedOn.Set(&v) +} +// SetBasedOnNil sets the value for BasedOn to be an explicit nil +func (o *ReflectResponse) SetBasedOnNil() { + o.BasedOn.Set(nil) +} + +// UnsetBasedOn ensures that no value is present for BasedOn, not even an explicit nil +func (o *ReflectResponse) UnsetBasedOn() { + o.BasedOn.Unset() +} + +// GetStructuredOutput returns the StructuredOutput field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectResponse) GetStructuredOutput() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.StructuredOutput +} + +// GetStructuredOutputOk returns a tuple with the StructuredOutput 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 *ReflectResponse) GetStructuredOutputOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.StructuredOutput) { + return map[string]interface{}{}, false + } + return o.StructuredOutput, true +} + +// HasStructuredOutput returns a boolean if a field has been set. +func (o *ReflectResponse) HasStructuredOutput() bool { + if o != nil && !IsNil(o.StructuredOutput) { + return true + } + + return false +} + +// SetStructuredOutput gets a reference to the given map[string]interface{} and assigns it to the StructuredOutput field. +func (o *ReflectResponse) SetStructuredOutput(v map[string]interface{}) { + o.StructuredOutput = v +} + +// GetUsage returns the Usage field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectResponse) GetUsage() TokenUsage { + if o == nil || IsNil(o.Usage.Get()) { + var ret TokenUsage + return ret + } + return *o.Usage.Get() +} + +// GetUsageOk returns a tuple with the Usage 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 *ReflectResponse) GetUsageOk() (*TokenUsage, bool) { + if o == nil { + return nil, false + } + return o.Usage.Get(), o.Usage.IsSet() +} + +// HasUsage returns a boolean if a field has been set. +func (o *ReflectResponse) HasUsage() bool { + if o != nil && o.Usage.IsSet() { + return true + } + + return false +} + +// SetUsage gets a reference to the given NullableTokenUsage and assigns it to the Usage field. +func (o *ReflectResponse) SetUsage(v TokenUsage) { + o.Usage.Set(&v) +} +// SetUsageNil sets the value for Usage to be an explicit nil +func (o *ReflectResponse) SetUsageNil() { + o.Usage.Set(nil) +} + +// UnsetUsage ensures that no value is present for Usage, not even an explicit nil +func (o *ReflectResponse) UnsetUsage() { + o.Usage.Unset() +} + +// GetTrace returns the Trace field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectResponse) GetTrace() ReflectTrace { + if o == nil || IsNil(o.Trace.Get()) { + var ret ReflectTrace + return ret + } + return *o.Trace.Get() +} + +// GetTraceOk returns a tuple with the Trace 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 *ReflectResponse) GetTraceOk() (*ReflectTrace, bool) { + if o == nil { + return nil, false + } + return o.Trace.Get(), o.Trace.IsSet() +} + +// HasTrace returns a boolean if a field has been set. +func (o *ReflectResponse) HasTrace() bool { + if o != nil && o.Trace.IsSet() { + return true + } + + return false +} + +// SetTrace gets a reference to the given NullableReflectTrace and assigns it to the Trace field. +func (o *ReflectResponse) SetTrace(v ReflectTrace) { + o.Trace.Set(&v) +} +// SetTraceNil sets the value for Trace to be an explicit nil +func (o *ReflectResponse) SetTraceNil() { + o.Trace.Set(nil) +} + +// UnsetTrace ensures that no value is present for Trace, not even an explicit nil +func (o *ReflectResponse) UnsetTrace() { + o.Trace.Unset() +} + +func (o ReflectResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["text"] = o.Text + if o.BasedOn.IsSet() { + toSerialize["based_on"] = o.BasedOn.Get() + } + if o.StructuredOutput != nil { + toSerialize["structured_output"] = o.StructuredOutput + } + if o.Usage.IsSet() { + toSerialize["usage"] = o.Usage.Get() + } + if o.Trace.IsSet() { + toSerialize["trace"] = o.Trace.Get() + } + return toSerialize, nil +} + +func (o *ReflectResponse) 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{ + "text", + } + + 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) + } + } + + varReflectResponse := _ReflectResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReflectResponse) + + if err != nil { + return err + } + + *o = ReflectResponse(varReflectResponse) + + return err +} + +type NullableReflectResponse struct { + value *ReflectResponse + isSet bool +} + +func (v NullableReflectResponse) Get() *ReflectResponse { + return v.value +} + +func (v *NullableReflectResponse) Set(val *ReflectResponse) { + v.value = val + v.isSet = true +} + +func (v NullableReflectResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectResponse(val *ReflectResponse) *NullableReflectResponse { + return &NullableReflectResponse{value: val, isSet: true} +} + +func (v NullableReflectResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_tool_call.go b/hindsight-clients/go/model_reflect_tool_call.go new file mode 100644 index 00000000..52266a88 --- /dev/null +++ b/hindsight-clients/go/model_reflect_tool_call.go @@ -0,0 +1,295 @@ +/* +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 ReflectToolCall type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectToolCall{} + +// ReflectToolCall A tool call made during reflect agent execution. +type ReflectToolCall struct { + // Tool name: lookup, recall, learn, expand + Tool string `json:"tool"` + // Tool input parameters + Input map[string]interface{} `json:"input"` + Output map[string]interface{} `json:"output,omitempty"` + // Execution time in milliseconds + DurationMs int32 `json:"duration_ms"` + // Iteration number (1-based) when this tool was called + Iteration *int32 `json:"iteration,omitempty"` +} + +type _ReflectToolCall ReflectToolCall + +// NewReflectToolCall instantiates a new ReflectToolCall 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 NewReflectToolCall(tool string, input map[string]interface{}, durationMs int32) *ReflectToolCall { + this := ReflectToolCall{} + this.Tool = tool + this.Input = input + this.DurationMs = durationMs + var iteration int32 = 0 + this.Iteration = &iteration + return &this +} + +// NewReflectToolCallWithDefaults instantiates a new ReflectToolCall 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 NewReflectToolCallWithDefaults() *ReflectToolCall { + this := ReflectToolCall{} + var iteration int32 = 0 + this.Iteration = &iteration + return &this +} + +// GetTool returns the Tool field value +func (o *ReflectToolCall) GetTool() string { + if o == nil { + var ret string + return ret + } + + return o.Tool +} + +// GetToolOk returns a tuple with the Tool field value +// and a boolean to check if the value has been set. +func (o *ReflectToolCall) GetToolOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tool, true +} + +// SetTool sets field value +func (o *ReflectToolCall) SetTool(v string) { + o.Tool = v +} + +// GetInput returns the Input field value +func (o *ReflectToolCall) GetInput() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + + return o.Input +} + +// GetInputOk returns a tuple with the Input field value +// and a boolean to check if the value has been set. +func (o *ReflectToolCall) GetInputOk() (map[string]interface{}, bool) { + if o == nil { + return map[string]interface{}{}, false + } + return o.Input, true +} + +// SetInput sets field value +func (o *ReflectToolCall) SetInput(v map[string]interface{}) { + o.Input = v +} + +// GetOutput returns the Output field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ReflectToolCall) GetOutput() map[string]interface{} { + if o == nil { + var ret map[string]interface{} + return ret + } + return o.Output +} + +// GetOutputOk returns a tuple with the Output 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 *ReflectToolCall) GetOutputOk() (map[string]interface{}, bool) { + if o == nil || IsNil(o.Output) { + return map[string]interface{}{}, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *ReflectToolCall) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given map[string]interface{} and assigns it to the Output field. +func (o *ReflectToolCall) SetOutput(v map[string]interface{}) { + o.Output = v +} + +// GetDurationMs returns the DurationMs field value +func (o *ReflectToolCall) GetDurationMs() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DurationMs +} + +// GetDurationMsOk returns a tuple with the DurationMs field value +// and a boolean to check if the value has been set. +func (o *ReflectToolCall) GetDurationMsOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DurationMs, true +} + +// SetDurationMs sets field value +func (o *ReflectToolCall) SetDurationMs(v int32) { + o.DurationMs = v +} + +// GetIteration returns the Iteration field value if set, zero value otherwise. +func (o *ReflectToolCall) GetIteration() int32 { + if o == nil || IsNil(o.Iteration) { + var ret int32 + return ret + } + return *o.Iteration +} + +// GetIterationOk returns a tuple with the Iteration field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReflectToolCall) GetIterationOk() (*int32, bool) { + if o == nil || IsNil(o.Iteration) { + return nil, false + } + return o.Iteration, true +} + +// HasIteration returns a boolean if a field has been set. +func (o *ReflectToolCall) HasIteration() bool { + if o != nil && !IsNil(o.Iteration) { + return true + } + + return false +} + +// SetIteration gets a reference to the given int32 and assigns it to the Iteration field. +func (o *ReflectToolCall) SetIteration(v int32) { + o.Iteration = &v +} + +func (o ReflectToolCall) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectToolCall) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tool"] = o.Tool + toSerialize["input"] = o.Input + if o.Output != nil { + toSerialize["output"] = o.Output + } + toSerialize["duration_ms"] = o.DurationMs + if !IsNil(o.Iteration) { + toSerialize["iteration"] = o.Iteration + } + return toSerialize, nil +} + +func (o *ReflectToolCall) 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{ + "tool", + "input", + "duration_ms", + } + + 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) + } + } + + varReflectToolCall := _ReflectToolCall{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varReflectToolCall) + + if err != nil { + return err + } + + *o = ReflectToolCall(varReflectToolCall) + + return err +} + +type NullableReflectToolCall struct { + value *ReflectToolCall + isSet bool +} + +func (v NullableReflectToolCall) Get() *ReflectToolCall { + return v.value +} + +func (v *NullableReflectToolCall) Set(val *ReflectToolCall) { + v.value = val + v.isSet = true +} + +func (v NullableReflectToolCall) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectToolCall) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectToolCall(val *ReflectToolCall) *NullableReflectToolCall { + return &NullableReflectToolCall{value: val, isSet: true} +} + +func (v NullableReflectToolCall) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectToolCall) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_reflect_trace.go b/hindsight-clients/go/model_reflect_trace.go new file mode 100644 index 00000000..f25aaae1 --- /dev/null +++ b/hindsight-clients/go/model_reflect_trace.go @@ -0,0 +1,164 @@ +/* +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" +) + +// checks if the ReflectTrace type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ReflectTrace{} + +// ReflectTrace Execution trace of LLM and tool calls during reflection. +type ReflectTrace struct { + // Tool calls made during reflection + ToolCalls []ReflectToolCall `json:"tool_calls,omitempty"` + // LLM calls made during reflection + LlmCalls []ReflectLLMCall `json:"llm_calls,omitempty"` +} + +// NewReflectTrace instantiates a new ReflectTrace 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 NewReflectTrace() *ReflectTrace { + this := ReflectTrace{} + return &this +} + +// NewReflectTraceWithDefaults instantiates a new ReflectTrace 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 NewReflectTraceWithDefaults() *ReflectTrace { + this := ReflectTrace{} + return &this +} + +// GetToolCalls returns the ToolCalls field value if set, zero value otherwise. +func (o *ReflectTrace) GetToolCalls() []ReflectToolCall { + if o == nil || IsNil(o.ToolCalls) { + var ret []ReflectToolCall + return ret + } + return o.ToolCalls +} + +// GetToolCallsOk returns a tuple with the ToolCalls field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReflectTrace) GetToolCallsOk() ([]ReflectToolCall, bool) { + if o == nil || IsNil(o.ToolCalls) { + return nil, false + } + return o.ToolCalls, true +} + +// HasToolCalls returns a boolean if a field has been set. +func (o *ReflectTrace) HasToolCalls() bool { + if o != nil && !IsNil(o.ToolCalls) { + return true + } + + return false +} + +// SetToolCalls gets a reference to the given []ReflectToolCall and assigns it to the ToolCalls field. +func (o *ReflectTrace) SetToolCalls(v []ReflectToolCall) { + o.ToolCalls = v +} + +// GetLlmCalls returns the LlmCalls field value if set, zero value otherwise. +func (o *ReflectTrace) GetLlmCalls() []ReflectLLMCall { + if o == nil || IsNil(o.LlmCalls) { + var ret []ReflectLLMCall + return ret + } + return o.LlmCalls +} + +// GetLlmCallsOk returns a tuple with the LlmCalls field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ReflectTrace) GetLlmCallsOk() ([]ReflectLLMCall, bool) { + if o == nil || IsNil(o.LlmCalls) { + return nil, false + } + return o.LlmCalls, true +} + +// HasLlmCalls returns a boolean if a field has been set. +func (o *ReflectTrace) HasLlmCalls() bool { + if o != nil && !IsNil(o.LlmCalls) { + return true + } + + return false +} + +// SetLlmCalls gets a reference to the given []ReflectLLMCall and assigns it to the LlmCalls field. +func (o *ReflectTrace) SetLlmCalls(v []ReflectLLMCall) { + o.LlmCalls = v +} + +func (o ReflectTrace) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ReflectTrace) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ToolCalls) { + toSerialize["tool_calls"] = o.ToolCalls + } + if !IsNil(o.LlmCalls) { + toSerialize["llm_calls"] = o.LlmCalls + } + return toSerialize, nil +} + +type NullableReflectTrace struct { + value *ReflectTrace + isSet bool +} + +func (v NullableReflectTrace) Get() *ReflectTrace { + return v.value +} + +func (v *NullableReflectTrace) Set(val *ReflectTrace) { + v.value = val + v.isSet = true +} + +func (v NullableReflectTrace) IsSet() bool { + return v.isSet +} + +func (v *NullableReflectTrace) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableReflectTrace(val *ReflectTrace) *NullableReflectTrace { + return &NullableReflectTrace{value: val, isSet: true} +} + +func (v NullableReflectTrace) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableReflectTrace) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_retain_request.go b/hindsight-clients/go/model_retain_request.go new file mode 100644 index 00000000..e473fbb0 --- /dev/null +++ b/hindsight-clients/go/model_retain_request.go @@ -0,0 +1,236 @@ +/* +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 RetainRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RetainRequest{} + +// RetainRequest Request model for retain endpoint. +type RetainRequest struct { + Items []MemoryItem `json:"items"` + // If true, process asynchronously in background. If false, wait for completion (default: false) + Async *bool `json:"async,omitempty"` + DocumentTags []string `json:"document_tags,omitempty"` +} + +type _RetainRequest RetainRequest + +// NewRetainRequest instantiates a new RetainRequest 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 NewRetainRequest(items []MemoryItem) *RetainRequest { + this := RetainRequest{} + this.Items = items + var async bool = false + this.Async = &async + return &this +} + +// NewRetainRequestWithDefaults instantiates a new RetainRequest 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 NewRetainRequestWithDefaults() *RetainRequest { + this := RetainRequest{} + var async bool = false + this.Async = &async + return &this +} + +// GetItems returns the Items field value +func (o *RetainRequest) GetItems() []MemoryItem { + if o == nil { + var ret []MemoryItem + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *RetainRequest) GetItemsOk() ([]MemoryItem, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *RetainRequest) SetItems(v []MemoryItem) { + o.Items = v +} + +// GetAsync returns the Async field value if set, zero value otherwise. +func (o *RetainRequest) GetAsync() bool { + if o == nil || IsNil(o.Async) { + var ret bool + return ret + } + return *o.Async +} + +// GetAsyncOk returns a tuple with the Async field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RetainRequest) GetAsyncOk() (*bool, bool) { + if o == nil || IsNil(o.Async) { + return nil, false + } + return o.Async, true +} + +// HasAsync returns a boolean if a field has been set. +func (o *RetainRequest) HasAsync() bool { + if o != nil && !IsNil(o.Async) { + return true + } + + return false +} + +// SetAsync gets a reference to the given bool and assigns it to the Async field. +func (o *RetainRequest) SetAsync(v bool) { + o.Async = &v +} + +// GetDocumentTags returns the DocumentTags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RetainRequest) GetDocumentTags() []string { + if o == nil { + var ret []string + return ret + } + return o.DocumentTags +} + +// GetDocumentTagsOk returns a tuple with the DocumentTags 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 *RetainRequest) GetDocumentTagsOk() ([]string, bool) { + if o == nil || IsNil(o.DocumentTags) { + return nil, false + } + return o.DocumentTags, true +} + +// HasDocumentTags returns a boolean if a field has been set. +func (o *RetainRequest) HasDocumentTags() bool { + if o != nil && !IsNil(o.DocumentTags) { + return true + } + + return false +} + +// SetDocumentTags gets a reference to the given []string and assigns it to the DocumentTags field. +func (o *RetainRequest) SetDocumentTags(v []string) { + o.DocumentTags = v +} + +func (o RetainRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RetainRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + if !IsNil(o.Async) { + toSerialize["async"] = o.Async + } + if o.DocumentTags != nil { + toSerialize["document_tags"] = o.DocumentTags + } + return toSerialize, nil +} + +func (o *RetainRequest) 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{ + "items", + } + + 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) + } + } + + varRetainRequest := _RetainRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRetainRequest) + + if err != nil { + return err + } + + *o = RetainRequest(varRetainRequest) + + return err +} + +type NullableRetainRequest struct { + value *RetainRequest + isSet bool +} + +func (v NullableRetainRequest) Get() *RetainRequest { + return v.value +} + +func (v *NullableRetainRequest) Set(val *RetainRequest) { + v.value = val + v.isSet = true +} + +func (v NullableRetainRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableRetainRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRetainRequest(val *RetainRequest) *NullableRetainRequest { + return &NullableRetainRequest{value: val, isSet: true} +} + +func (v NullableRetainRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRetainRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_retain_response.go b/hindsight-clients/go/model_retain_response.go new file mode 100644 index 00000000..6aba004e --- /dev/null +++ b/hindsight-clients/go/model_retain_response.go @@ -0,0 +1,335 @@ +/* +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 RetainResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &RetainResponse{} + +// RetainResponse Response model for retain endpoint. +type RetainResponse struct { + Success bool `json:"success"` + BankId string `json:"bank_id"` + ItemsCount int32 `json:"items_count"` + // Whether the operation was processed asynchronously + Async bool `json:"async"` + OperationId NullableString `json:"operation_id,omitempty"` + Usage NullableTokenUsage `json:"usage,omitempty"` +} + +type _RetainResponse RetainResponse + +// NewRetainResponse instantiates a new RetainResponse 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 NewRetainResponse(success bool, bankId string, itemsCount int32, async bool) *RetainResponse { + this := RetainResponse{} + this.Success = success + this.BankId = bankId + this.ItemsCount = itemsCount + this.Async = async + return &this +} + +// NewRetainResponseWithDefaults instantiates a new RetainResponse 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 NewRetainResponseWithDefaults() *RetainResponse { + this := RetainResponse{} + return &this +} + +// GetSuccess returns the Success field value +func (o *RetainResponse) GetSuccess() bool { + if o == nil { + var ret bool + return ret + } + + return o.Success +} + +// GetSuccessOk returns a tuple with the Success field value +// and a boolean to check if the value has been set. +func (o *RetainResponse) GetSuccessOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Success, true +} + +// SetSuccess sets field value +func (o *RetainResponse) SetSuccess(v bool) { + o.Success = v +} + +// GetBankId returns the BankId field value +func (o *RetainResponse) GetBankId() string { + if o == nil { + var ret string + return ret + } + + return o.BankId +} + +// GetBankIdOk returns a tuple with the BankId field value +// and a boolean to check if the value has been set. +func (o *RetainResponse) GetBankIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BankId, true +} + +// SetBankId sets field value +func (o *RetainResponse) SetBankId(v string) { + o.BankId = v +} + +// GetItemsCount returns the ItemsCount field value +func (o *RetainResponse) GetItemsCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.ItemsCount +} + +// GetItemsCountOk returns a tuple with the ItemsCount field value +// and a boolean to check if the value has been set. +func (o *RetainResponse) GetItemsCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.ItemsCount, true +} + +// SetItemsCount sets field value +func (o *RetainResponse) SetItemsCount(v int32) { + o.ItemsCount = v +} + +// GetAsync returns the Async field value +func (o *RetainResponse) GetAsync() bool { + if o == nil { + var ret bool + return ret + } + + return o.Async +} + +// GetAsyncOk returns a tuple with the Async field value +// and a boolean to check if the value has been set. +func (o *RetainResponse) GetAsyncOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Async, true +} + +// SetAsync sets field value +func (o *RetainResponse) SetAsync(v bool) { + o.Async = v +} + +// GetOperationId returns the OperationId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RetainResponse) GetOperationId() string { + if o == nil || IsNil(o.OperationId.Get()) { + var ret string + return ret + } + return *o.OperationId.Get() +} + +// GetOperationIdOk returns a tuple with the OperationId 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 *RetainResponse) GetOperationIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OperationId.Get(), o.OperationId.IsSet() +} + +// HasOperationId returns a boolean if a field has been set. +func (o *RetainResponse) HasOperationId() bool { + if o != nil && o.OperationId.IsSet() { + return true + } + + return false +} + +// SetOperationId gets a reference to the given NullableString and assigns it to the OperationId field. +func (o *RetainResponse) SetOperationId(v string) { + o.OperationId.Set(&v) +} +// SetOperationIdNil sets the value for OperationId to be an explicit nil +func (o *RetainResponse) SetOperationIdNil() { + o.OperationId.Set(nil) +} + +// UnsetOperationId ensures that no value is present for OperationId, not even an explicit nil +func (o *RetainResponse) UnsetOperationId() { + o.OperationId.Unset() +} + +// GetUsage returns the Usage field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *RetainResponse) GetUsage() TokenUsage { + if o == nil || IsNil(o.Usage.Get()) { + var ret TokenUsage + return ret + } + return *o.Usage.Get() +} + +// GetUsageOk returns a tuple with the Usage 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 *RetainResponse) GetUsageOk() (*TokenUsage, bool) { + if o == nil { + return nil, false + } + return o.Usage.Get(), o.Usage.IsSet() +} + +// HasUsage returns a boolean if a field has been set. +func (o *RetainResponse) HasUsage() bool { + if o != nil && o.Usage.IsSet() { + return true + } + + return false +} + +// SetUsage gets a reference to the given NullableTokenUsage and assigns it to the Usage field. +func (o *RetainResponse) SetUsage(v TokenUsage) { + o.Usage.Set(&v) +} +// SetUsageNil sets the value for Usage to be an explicit nil +func (o *RetainResponse) SetUsageNil() { + o.Usage.Set(nil) +} + +// UnsetUsage ensures that no value is present for Usage, not even an explicit nil +func (o *RetainResponse) UnsetUsage() { + o.Usage.Unset() +} + +func (o RetainResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o RetainResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["success"] = o.Success + toSerialize["bank_id"] = o.BankId + toSerialize["items_count"] = o.ItemsCount + toSerialize["async"] = o.Async + if o.OperationId.IsSet() { + toSerialize["operation_id"] = o.OperationId.Get() + } + if o.Usage.IsSet() { + toSerialize["usage"] = o.Usage.Get() + } + return toSerialize, nil +} + +func (o *RetainResponse) 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{ + "success", + "bank_id", + "items_count", + "async", + } + + 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) + } + } + + varRetainResponse := _RetainResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varRetainResponse) + + if err != nil { + return err + } + + *o = RetainResponse(varRetainResponse) + + return err +} + +type NullableRetainResponse struct { + value *RetainResponse + isSet bool +} + +func (v NullableRetainResponse) Get() *RetainResponse { + return v.value +} + +func (v *NullableRetainResponse) Set(val *RetainResponse) { + v.value = val + v.isSet = true +} + +func (v NullableRetainResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableRetainResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRetainResponse(val *RetainResponse) *NullableRetainResponse { + return &NullableRetainResponse{value: val, isSet: true} +} + +func (v NullableRetainResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRetainResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_tag_item.go b/hindsight-clients/go/model_tag_item.go new file mode 100644 index 00000000..019c88cb --- /dev/null +++ b/hindsight-clients/go/model_tag_item.go @@ -0,0 +1,188 @@ +/* +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 TagItem type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TagItem{} + +// TagItem Single tag with usage count. +type TagItem struct { + // The tag value + Tag string `json:"tag"` + // Number of memories with this tag + Count int32 `json:"count"` +} + +type _TagItem TagItem + +// NewTagItem instantiates a new TagItem 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 NewTagItem(tag string, count int32) *TagItem { + this := TagItem{} + this.Tag = tag + this.Count = count + return &this +} + +// NewTagItemWithDefaults instantiates a new TagItem 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 NewTagItemWithDefaults() *TagItem { + this := TagItem{} + return &this +} + +// GetTag returns the Tag field value +func (o *TagItem) GetTag() string { + if o == nil { + var ret string + return ret + } + + return o.Tag +} + +// GetTagOk returns a tuple with the Tag field value +// and a boolean to check if the value has been set. +func (o *TagItem) GetTagOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Tag, true +} + +// SetTag sets field value +func (o *TagItem) SetTag(v string) { + o.Tag = v +} + +// GetCount returns the Count field value +func (o *TagItem) GetCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Count +} + +// GetCountOk returns a tuple with the Count field value +// and a boolean to check if the value has been set. +func (o *TagItem) GetCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Count, true +} + +// SetCount sets field value +func (o *TagItem) SetCount(v int32) { + o.Count = v +} + +func (o TagItem) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TagItem) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tag"] = o.Tag + toSerialize["count"] = o.Count + return toSerialize, nil +} + +func (o *TagItem) 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{ + "tag", + "count", + } + + 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) + } + } + + varTagItem := _TagItem{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varTagItem) + + if err != nil { + return err + } + + *o = TagItem(varTagItem) + + return err +} + +type NullableTagItem struct { + value *TagItem + isSet bool +} + +func (v NullableTagItem) Get() *TagItem { + return v.value +} + +func (v *NullableTagItem) Set(val *TagItem) { + v.value = val + v.isSet = true +} + +func (v NullableTagItem) IsSet() bool { + return v.isSet +} + +func (v *NullableTagItem) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTagItem(val *TagItem) *NullableTagItem { + return &NullableTagItem{value: val, isSet: true} +} + +func (v NullableTagItem) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTagItem) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_token_usage.go b/hindsight-clients/go/model_token_usage.go new file mode 100644 index 00000000..1834836a --- /dev/null +++ b/hindsight-clients/go/model_token_usage.go @@ -0,0 +1,213 @@ +/* +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" +) + +// checks if the TokenUsage type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TokenUsage{} + +// TokenUsage Token usage metrics for LLM calls. Tracks input/output tokens for a single request to enable per-request cost tracking and monitoring. +type TokenUsage struct { + // Number of input/prompt tokens consumed + InputTokens *int32 `json:"input_tokens,omitempty"` + // Number of output/completion tokens generated + OutputTokens *int32 `json:"output_tokens,omitempty"` + // Total tokens (input + output) + TotalTokens *int32 `json:"total_tokens,omitempty"` +} + +// NewTokenUsage instantiates a new TokenUsage 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 NewTokenUsage() *TokenUsage { + this := TokenUsage{} + var inputTokens int32 = 0 + this.InputTokens = &inputTokens + var outputTokens int32 = 0 + this.OutputTokens = &outputTokens + var totalTokens int32 = 0 + this.TotalTokens = &totalTokens + return &this +} + +// NewTokenUsageWithDefaults instantiates a new TokenUsage 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 NewTokenUsageWithDefaults() *TokenUsage { + this := TokenUsage{} + var inputTokens int32 = 0 + this.InputTokens = &inputTokens + var outputTokens int32 = 0 + this.OutputTokens = &outputTokens + var totalTokens int32 = 0 + this.TotalTokens = &totalTokens + return &this +} + +// GetInputTokens returns the InputTokens field value if set, zero value otherwise. +func (o *TokenUsage) GetInputTokens() int32 { + if o == nil || IsNil(o.InputTokens) { + var ret int32 + return ret + } + return *o.InputTokens +} + +// GetInputTokensOk returns a tuple with the InputTokens field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TokenUsage) GetInputTokensOk() (*int32, bool) { + if o == nil || IsNil(o.InputTokens) { + return nil, false + } + return o.InputTokens, true +} + +// HasInputTokens returns a boolean if a field has been set. +func (o *TokenUsage) HasInputTokens() bool { + if o != nil && !IsNil(o.InputTokens) { + return true + } + + return false +} + +// SetInputTokens gets a reference to the given int32 and assigns it to the InputTokens field. +func (o *TokenUsage) SetInputTokens(v int32) { + o.InputTokens = &v +} + +// GetOutputTokens returns the OutputTokens field value if set, zero value otherwise. +func (o *TokenUsage) GetOutputTokens() int32 { + if o == nil || IsNil(o.OutputTokens) { + var ret int32 + return ret + } + return *o.OutputTokens +} + +// GetOutputTokensOk returns a tuple with the OutputTokens field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TokenUsage) GetOutputTokensOk() (*int32, bool) { + if o == nil || IsNil(o.OutputTokens) { + return nil, false + } + return o.OutputTokens, true +} + +// HasOutputTokens returns a boolean if a field has been set. +func (o *TokenUsage) HasOutputTokens() bool { + if o != nil && !IsNil(o.OutputTokens) { + return true + } + + return false +} + +// SetOutputTokens gets a reference to the given int32 and assigns it to the OutputTokens field. +func (o *TokenUsage) SetOutputTokens(v int32) { + o.OutputTokens = &v +} + +// GetTotalTokens returns the TotalTokens field value if set, zero value otherwise. +func (o *TokenUsage) GetTotalTokens() int32 { + if o == nil || IsNil(o.TotalTokens) { + var ret int32 + return ret + } + return *o.TotalTokens +} + +// GetTotalTokensOk returns a tuple with the TotalTokens field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TokenUsage) GetTotalTokensOk() (*int32, bool) { + if o == nil || IsNil(o.TotalTokens) { + return nil, false + } + return o.TotalTokens, true +} + +// HasTotalTokens returns a boolean if a field has been set. +func (o *TokenUsage) HasTotalTokens() bool { + if o != nil && !IsNil(o.TotalTokens) { + return true + } + + return false +} + +// SetTotalTokens gets a reference to the given int32 and assigns it to the TotalTokens field. +func (o *TokenUsage) SetTotalTokens(v int32) { + o.TotalTokens = &v +} + +func (o TokenUsage) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TokenUsage) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.InputTokens) { + toSerialize["input_tokens"] = o.InputTokens + } + if !IsNil(o.OutputTokens) { + toSerialize["output_tokens"] = o.OutputTokens + } + if !IsNil(o.TotalTokens) { + toSerialize["total_tokens"] = o.TotalTokens + } + return toSerialize, nil +} + +type NullableTokenUsage struct { + value *TokenUsage + isSet bool +} + +func (v NullableTokenUsage) Get() *TokenUsage { + return v.value +} + +func (v *NullableTokenUsage) Set(val *TokenUsage) { + v.value = val + v.isSet = true +} + +func (v NullableTokenUsage) IsSet() bool { + return v.isSet +} + +func (v *NullableTokenUsage) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTokenUsage(val *TokenUsage) *NullableTokenUsage { + return &NullableTokenUsage{value: val, isSet: true} +} + +func (v NullableTokenUsage) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTokenUsage) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_tool_calls_include_options.go b/hindsight-clients/go/model_tool_calls_include_options.go new file mode 100644 index 00000000..3f78475c --- /dev/null +++ b/hindsight-clients/go/model_tool_calls_include_options.go @@ -0,0 +1,131 @@ +/* +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" +) + +// checks if the ToolCallsIncludeOptions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ToolCallsIncludeOptions{} + +// ToolCallsIncludeOptions Options for including tool calls in reflect results. +type ToolCallsIncludeOptions struct { + // Include tool outputs in the trace. Set to false to only include inputs (smaller payload). + Output *bool `json:"output,omitempty"` +} + +// NewToolCallsIncludeOptions instantiates a new ToolCallsIncludeOptions 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 NewToolCallsIncludeOptions() *ToolCallsIncludeOptions { + this := ToolCallsIncludeOptions{} + var output bool = true + this.Output = &output + return &this +} + +// NewToolCallsIncludeOptionsWithDefaults instantiates a new ToolCallsIncludeOptions 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 NewToolCallsIncludeOptionsWithDefaults() *ToolCallsIncludeOptions { + this := ToolCallsIncludeOptions{} + var output bool = true + this.Output = &output + return &this +} + +// GetOutput returns the Output field value if set, zero value otherwise. +func (o *ToolCallsIncludeOptions) GetOutput() bool { + if o == nil || IsNil(o.Output) { + var ret bool + return ret + } + return *o.Output +} + +// GetOutputOk returns a tuple with the Output field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ToolCallsIncludeOptions) GetOutputOk() (*bool, bool) { + if o == nil || IsNil(o.Output) { + return nil, false + } + return o.Output, true +} + +// HasOutput returns a boolean if a field has been set. +func (o *ToolCallsIncludeOptions) HasOutput() bool { + if o != nil && !IsNil(o.Output) { + return true + } + + return false +} + +// SetOutput gets a reference to the given bool and assigns it to the Output field. +func (o *ToolCallsIncludeOptions) SetOutput(v bool) { + o.Output = &v +} + +func (o ToolCallsIncludeOptions) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ToolCallsIncludeOptions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Output) { + toSerialize["output"] = o.Output + } + return toSerialize, nil +} + +type NullableToolCallsIncludeOptions struct { + value *ToolCallsIncludeOptions + isSet bool +} + +func (v NullableToolCallsIncludeOptions) Get() *ToolCallsIncludeOptions { + return v.value +} + +func (v *NullableToolCallsIncludeOptions) Set(val *ToolCallsIncludeOptions) { + v.value = val + v.isSet = true +} + +func (v NullableToolCallsIncludeOptions) IsSet() bool { + return v.isSet +} + +func (v *NullableToolCallsIncludeOptions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableToolCallsIncludeOptions(val *ToolCallsIncludeOptions) *NullableToolCallsIncludeOptions { + return &NullableToolCallsIncludeOptions{value: val, isSet: true} +} + +func (v NullableToolCallsIncludeOptions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableToolCallsIncludeOptions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_update_directive_request.go b/hindsight-clients/go/model_update_directive_request.go new file mode 100644 index 00000000..dae648ff --- /dev/null +++ b/hindsight-clients/go/model_update_directive_request.go @@ -0,0 +1,311 @@ +/* +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" +) + +// checks if the UpdateDirectiveRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDirectiveRequest{} + +// UpdateDirectiveRequest Request model for updating a directive. +type UpdateDirectiveRequest struct { + Name NullableString `json:"name,omitempty"` + Content NullableString `json:"content,omitempty"` + Priority NullableInt32 `json:"priority,omitempty"` + IsActive NullableBool `json:"is_active,omitempty"` + Tags []string `json:"tags,omitempty"` +} + +// NewUpdateDirectiveRequest instantiates a new UpdateDirectiveRequest 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 NewUpdateDirectiveRequest() *UpdateDirectiveRequest { + this := UpdateDirectiveRequest{} + return &this +} + +// NewUpdateDirectiveRequestWithDefaults instantiates a new UpdateDirectiveRequest 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 NewUpdateDirectiveRequestWithDefaults() *UpdateDirectiveRequest { + this := UpdateDirectiveRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateDirectiveRequest) GetName() string { + if o == nil || IsNil(o.Name.Get()) { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *UpdateDirectiveRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateDirectiveRequest) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given NullableString and assigns it to the Name field. +func (o *UpdateDirectiveRequest) SetName(v string) { + o.Name.Set(&v) +} +// SetNameNil sets the value for Name to be an explicit nil +func (o *UpdateDirectiveRequest) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *UpdateDirectiveRequest) UnsetName() { + o.Name.Unset() +} + +// GetContent returns the Content field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateDirectiveRequest) GetContent() string { + if o == nil || IsNil(o.Content.Get()) { + var ret string + return ret + } + return *o.Content.Get() +} + +// GetContentOk returns a tuple with the Content 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 *UpdateDirectiveRequest) GetContentOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Content.Get(), o.Content.IsSet() +} + +// HasContent returns a boolean if a field has been set. +func (o *UpdateDirectiveRequest) HasContent() bool { + if o != nil && o.Content.IsSet() { + return true + } + + return false +} + +// SetContent gets a reference to the given NullableString and assigns it to the Content field. +func (o *UpdateDirectiveRequest) SetContent(v string) { + o.Content.Set(&v) +} +// SetContentNil sets the value for Content to be an explicit nil +func (o *UpdateDirectiveRequest) SetContentNil() { + o.Content.Set(nil) +} + +// UnsetContent ensures that no value is present for Content, not even an explicit nil +func (o *UpdateDirectiveRequest) UnsetContent() { + o.Content.Unset() +} + +// GetPriority returns the Priority field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateDirectiveRequest) GetPriority() int32 { + if o == nil || IsNil(o.Priority.Get()) { + var ret int32 + return ret + } + return *o.Priority.Get() +} + +// GetPriorityOk returns a tuple with the Priority 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 *UpdateDirectiveRequest) GetPriorityOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.Priority.Get(), o.Priority.IsSet() +} + +// HasPriority returns a boolean if a field has been set. +func (o *UpdateDirectiveRequest) HasPriority() bool { + if o != nil && o.Priority.IsSet() { + return true + } + + return false +} + +// SetPriority gets a reference to the given NullableInt32 and assigns it to the Priority field. +func (o *UpdateDirectiveRequest) SetPriority(v int32) { + o.Priority.Set(&v) +} +// SetPriorityNil sets the value for Priority to be an explicit nil +func (o *UpdateDirectiveRequest) SetPriorityNil() { + o.Priority.Set(nil) +} + +// UnsetPriority ensures that no value is present for Priority, not even an explicit nil +func (o *UpdateDirectiveRequest) UnsetPriority() { + o.Priority.Unset() +} + +// GetIsActive returns the IsActive field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateDirectiveRequest) GetIsActive() bool { + if o == nil || IsNil(o.IsActive.Get()) { + var ret bool + return ret + } + return *o.IsActive.Get() +} + +// GetIsActiveOk returns a tuple with the IsActive 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 *UpdateDirectiveRequest) GetIsActiveOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.IsActive.Get(), o.IsActive.IsSet() +} + +// HasIsActive returns a boolean if a field has been set. +func (o *UpdateDirectiveRequest) HasIsActive() bool { + if o != nil && o.IsActive.IsSet() { + return true + } + + return false +} + +// SetIsActive gets a reference to the given NullableBool and assigns it to the IsActive field. +func (o *UpdateDirectiveRequest) SetIsActive(v bool) { + o.IsActive.Set(&v) +} +// SetIsActiveNil sets the value for IsActive to be an explicit nil +func (o *UpdateDirectiveRequest) SetIsActiveNil() { + o.IsActive.Set(nil) +} + +// UnsetIsActive ensures that no value is present for IsActive, not even an explicit nil +func (o *UpdateDirectiveRequest) UnsetIsActive() { + o.IsActive.Unset() +} + +// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateDirectiveRequest) 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 *UpdateDirectiveRequest) 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 *UpdateDirectiveRequest) 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 *UpdateDirectiveRequest) SetTags(v []string) { + o.Tags = v +} + +func (o UpdateDirectiveRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDirectiveRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if o.Content.IsSet() { + toSerialize["content"] = o.Content.Get() + } + if o.Priority.IsSet() { + toSerialize["priority"] = o.Priority.Get() + } + if o.IsActive.IsSet() { + toSerialize["is_active"] = o.IsActive.Get() + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + return toSerialize, nil +} + +type NullableUpdateDirectiveRequest struct { + value *UpdateDirectiveRequest + isSet bool +} + +func (v NullableUpdateDirectiveRequest) Get() *UpdateDirectiveRequest { + return v.value +} + +func (v *NullableUpdateDirectiveRequest) Set(val *UpdateDirectiveRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDirectiveRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDirectiveRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDirectiveRequest(val *UpdateDirectiveRequest) *NullableUpdateDirectiveRequest { + return &NullableUpdateDirectiveRequest{value: val, isSet: true} +} + +func (v NullableUpdateDirectiveRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDirectiveRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_update_disposition_request.go b/hindsight-clients/go/model_update_disposition_request.go new file mode 100644 index 00000000..af486ce6 --- /dev/null +++ b/hindsight-clients/go/model_update_disposition_request.go @@ -0,0 +1,158 @@ +/* +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 UpdateDispositionRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateDispositionRequest{} + +// UpdateDispositionRequest Request model for updating disposition traits. +type UpdateDispositionRequest struct { + Disposition DispositionTraits `json:"disposition"` +} + +type _UpdateDispositionRequest UpdateDispositionRequest + +// NewUpdateDispositionRequest instantiates a new UpdateDispositionRequest 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 NewUpdateDispositionRequest(disposition DispositionTraits) *UpdateDispositionRequest { + this := UpdateDispositionRequest{} + this.Disposition = disposition + return &this +} + +// NewUpdateDispositionRequestWithDefaults instantiates a new UpdateDispositionRequest 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 NewUpdateDispositionRequestWithDefaults() *UpdateDispositionRequest { + this := UpdateDispositionRequest{} + return &this +} + +// GetDisposition returns the Disposition field value +func (o *UpdateDispositionRequest) GetDisposition() DispositionTraits { + if o == nil { + var ret DispositionTraits + return ret + } + + return o.Disposition +} + +// GetDispositionOk returns a tuple with the Disposition field value +// and a boolean to check if the value has been set. +func (o *UpdateDispositionRequest) GetDispositionOk() (*DispositionTraits, bool) { + if o == nil { + return nil, false + } + return &o.Disposition, true +} + +// SetDisposition sets field value +func (o *UpdateDispositionRequest) SetDisposition(v DispositionTraits) { + o.Disposition = v +} + +func (o UpdateDispositionRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateDispositionRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["disposition"] = o.Disposition + return toSerialize, nil +} + +func (o *UpdateDispositionRequest) 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{ + "disposition", + } + + 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) + } + } + + varUpdateDispositionRequest := _UpdateDispositionRequest{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varUpdateDispositionRequest) + + if err != nil { + return err + } + + *o = UpdateDispositionRequest(varUpdateDispositionRequest) + + return err +} + +type NullableUpdateDispositionRequest struct { + value *UpdateDispositionRequest + isSet bool +} + +func (v NullableUpdateDispositionRequest) Get() *UpdateDispositionRequest { + return v.value +} + +func (v *NullableUpdateDispositionRequest) Set(val *UpdateDispositionRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateDispositionRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateDispositionRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateDispositionRequest(val *UpdateDispositionRequest) *NullableUpdateDispositionRequest { + return &NullableUpdateDispositionRequest{value: val, isSet: true} +} + +func (v NullableUpdateDispositionRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateDispositionRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_update_mental_model_request.go b/hindsight-clients/go/model_update_mental_model_request.go new file mode 100644 index 00000000..e13ae2a8 --- /dev/null +++ b/hindsight-clients/go/model_update_mental_model_request.go @@ -0,0 +1,311 @@ +/* +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" +) + +// checks if the UpdateMentalModelRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateMentalModelRequest{} + +// UpdateMentalModelRequest Request model for updating a mental model. +type UpdateMentalModelRequest struct { + Name NullableString `json:"name,omitempty"` + SourceQuery NullableString `json:"source_query,omitempty"` + MaxTokens NullableInt32 `json:"max_tokens,omitempty"` + Tags []string `json:"tags,omitempty"` + Trigger NullableMentalModelTrigger `json:"trigger,omitempty"` +} + +// NewUpdateMentalModelRequest instantiates a new UpdateMentalModelRequest 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 NewUpdateMentalModelRequest() *UpdateMentalModelRequest { + this := UpdateMentalModelRequest{} + return &this +} + +// NewUpdateMentalModelRequestWithDefaults instantiates a new UpdateMentalModelRequest 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 NewUpdateMentalModelRequestWithDefaults() *UpdateMentalModelRequest { + this := UpdateMentalModelRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateMentalModelRequest) GetName() string { + if o == nil || IsNil(o.Name.Get()) { + var ret string + return ret + } + return *o.Name.Get() +} + +// GetNameOk returns a tuple with the Name 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 *UpdateMentalModelRequest) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name.Get(), o.Name.IsSet() +} + +// HasName returns a boolean if a field has been set. +func (o *UpdateMentalModelRequest) HasName() bool { + if o != nil && o.Name.IsSet() { + return true + } + + return false +} + +// SetName gets a reference to the given NullableString and assigns it to the Name field. +func (o *UpdateMentalModelRequest) SetName(v string) { + o.Name.Set(&v) +} +// SetNameNil sets the value for Name to be an explicit nil +func (o *UpdateMentalModelRequest) SetNameNil() { + o.Name.Set(nil) +} + +// UnsetName ensures that no value is present for Name, not even an explicit nil +func (o *UpdateMentalModelRequest) UnsetName() { + o.Name.Unset() +} + +// GetSourceQuery returns the SourceQuery field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateMentalModelRequest) GetSourceQuery() string { + if o == nil || IsNil(o.SourceQuery.Get()) { + var ret string + return ret + } + return *o.SourceQuery.Get() +} + +// GetSourceQueryOk returns a tuple with the SourceQuery 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 *UpdateMentalModelRequest) GetSourceQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.SourceQuery.Get(), o.SourceQuery.IsSet() +} + +// HasSourceQuery returns a boolean if a field has been set. +func (o *UpdateMentalModelRequest) HasSourceQuery() bool { + if o != nil && o.SourceQuery.IsSet() { + return true + } + + return false +} + +// SetSourceQuery gets a reference to the given NullableString and assigns it to the SourceQuery field. +func (o *UpdateMentalModelRequest) SetSourceQuery(v string) { + o.SourceQuery.Set(&v) +} +// SetSourceQueryNil sets the value for SourceQuery to be an explicit nil +func (o *UpdateMentalModelRequest) SetSourceQueryNil() { + o.SourceQuery.Set(nil) +} + +// UnsetSourceQuery ensures that no value is present for SourceQuery, not even an explicit nil +func (o *UpdateMentalModelRequest) UnsetSourceQuery() { + o.SourceQuery.Unset() +} + +// GetMaxTokens returns the MaxTokens field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateMentalModelRequest) GetMaxTokens() int32 { + if o == nil || IsNil(o.MaxTokens.Get()) { + var ret int32 + return ret + } + return *o.MaxTokens.Get() +} + +// GetMaxTokensOk returns a tuple with the MaxTokens 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 *UpdateMentalModelRequest) GetMaxTokensOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.MaxTokens.Get(), o.MaxTokens.IsSet() +} + +// HasMaxTokens returns a boolean if a field has been set. +func (o *UpdateMentalModelRequest) HasMaxTokens() bool { + if o != nil && o.MaxTokens.IsSet() { + return true + } + + return false +} + +// SetMaxTokens gets a reference to the given NullableInt32 and assigns it to the MaxTokens field. +func (o *UpdateMentalModelRequest) SetMaxTokens(v int32) { + o.MaxTokens.Set(&v) +} +// SetMaxTokensNil sets the value for MaxTokens to be an explicit nil +func (o *UpdateMentalModelRequest) SetMaxTokensNil() { + o.MaxTokens.Set(nil) +} + +// UnsetMaxTokens ensures that no value is present for MaxTokens, not even an explicit nil +func (o *UpdateMentalModelRequest) UnsetMaxTokens() { + o.MaxTokens.Unset() +} + +// GetTags returns the Tags field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateMentalModelRequest) 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 *UpdateMentalModelRequest) 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 *UpdateMentalModelRequest) 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 *UpdateMentalModelRequest) SetTags(v []string) { + o.Tags = v +} + +// GetTrigger returns the Trigger field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateMentalModelRequest) GetTrigger() MentalModelTrigger { + if o == nil || IsNil(o.Trigger.Get()) { + var ret MentalModelTrigger + return ret + } + return *o.Trigger.Get() +} + +// GetTriggerOk returns a tuple with the Trigger 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 *UpdateMentalModelRequest) GetTriggerOk() (*MentalModelTrigger, bool) { + if o == nil { + return nil, false + } + return o.Trigger.Get(), o.Trigger.IsSet() +} + +// HasTrigger returns a boolean if a field has been set. +func (o *UpdateMentalModelRequest) HasTrigger() bool { + if o != nil && o.Trigger.IsSet() { + return true + } + + return false +} + +// SetTrigger gets a reference to the given NullableMentalModelTrigger and assigns it to the Trigger field. +func (o *UpdateMentalModelRequest) SetTrigger(v MentalModelTrigger) { + o.Trigger.Set(&v) +} +// SetTriggerNil sets the value for Trigger to be an explicit nil +func (o *UpdateMentalModelRequest) SetTriggerNil() { + o.Trigger.Set(nil) +} + +// UnsetTrigger ensures that no value is present for Trigger, not even an explicit nil +func (o *UpdateMentalModelRequest) UnsetTrigger() { + o.Trigger.Unset() +} + +func (o UpdateMentalModelRequest) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateMentalModelRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Name.IsSet() { + toSerialize["name"] = o.Name.Get() + } + if o.SourceQuery.IsSet() { + toSerialize["source_query"] = o.SourceQuery.Get() + } + if o.MaxTokens.IsSet() { + toSerialize["max_tokens"] = o.MaxTokens.Get() + } + if o.Tags != nil { + toSerialize["tags"] = o.Tags + } + if o.Trigger.IsSet() { + toSerialize["trigger"] = o.Trigger.Get() + } + return toSerialize, nil +} + +type NullableUpdateMentalModelRequest struct { + value *UpdateMentalModelRequest + isSet bool +} + +func (v NullableUpdateMentalModelRequest) Get() *UpdateMentalModelRequest { + return v.value +} + +func (v *NullableUpdateMentalModelRequest) Set(val *UpdateMentalModelRequest) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateMentalModelRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateMentalModelRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateMentalModelRequest(val *UpdateMentalModelRequest) *NullableUpdateMentalModelRequest { + return &NullableUpdateMentalModelRequest{value: val, isSet: true} +} + +func (v NullableUpdateMentalModelRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateMentalModelRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_validation_error.go b/hindsight-clients/go/model_validation_error.go new file mode 100644 index 00000000..a2dd835a --- /dev/null +++ b/hindsight-clients/go/model_validation_error.go @@ -0,0 +1,214 @@ +/* +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 ValidationError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ValidationError{} + +// ValidationError struct for ValidationError +type ValidationError struct { + Loc []ValidationErrorLocInner `json:"loc"` + Msg string `json:"msg"` + Type string `json:"type"` +} + +type _ValidationError ValidationError + +// NewValidationError instantiates a new ValidationError 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 NewValidationError(loc []ValidationErrorLocInner, msg string, type_ string) *ValidationError { + this := ValidationError{} + this.Loc = loc + this.Msg = msg + this.Type = type_ + return &this +} + +// NewValidationErrorWithDefaults instantiates a new ValidationError 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 NewValidationErrorWithDefaults() *ValidationError { + this := ValidationError{} + return &this +} + +// GetLoc returns the Loc field value +func (o *ValidationError) GetLoc() []ValidationErrorLocInner { + if o == nil { + var ret []ValidationErrorLocInner + return ret + } + + return o.Loc +} + +// GetLocOk returns a tuple with the Loc field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetLocOk() ([]ValidationErrorLocInner, bool) { + if o == nil { + return nil, false + } + return o.Loc, true +} + +// SetLoc sets field value +func (o *ValidationError) SetLoc(v []ValidationErrorLocInner) { + o.Loc = v +} + +// GetMsg returns the Msg field value +func (o *ValidationError) GetMsg() string { + if o == nil { + var ret string + return ret + } + + return o.Msg +} + +// GetMsgOk returns a tuple with the Msg field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetMsgOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Msg, true +} + +// SetMsg sets field value +func (o *ValidationError) SetMsg(v string) { + o.Msg = v +} + +// GetType returns the Type field value +func (o *ValidationError) GetType() string { + if o == nil { + var ret string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *ValidationError) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value +func (o *ValidationError) SetType(v string) { + o.Type = v +} + +func (o ValidationError) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ValidationError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["loc"] = o.Loc + toSerialize["msg"] = o.Msg + toSerialize["type"] = o.Type + return toSerialize, nil +} + +func (o *ValidationError) 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{ + "loc", + "msg", + "type", + } + + 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) + } + } + + varValidationError := _ValidationError{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varValidationError) + + if err != nil { + return err + } + + *o = ValidationError(varValidationError) + + return err +} + +type NullableValidationError struct { + value *ValidationError + isSet bool +} + +func (v NullableValidationError) Get() *ValidationError { + return v.value +} + +func (v *NullableValidationError) Set(val *ValidationError) { + v.value = val + v.isSet = true +} + +func (v NullableValidationError) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationError(val *ValidationError) *NullableValidationError { + return &NullableValidationError{value: val, isSet: true} +} + +func (v NullableValidationError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_validation_error_loc_inner.go b/hindsight-clients/go/model_validation_error_loc_inner.go new file mode 100644 index 00000000..d8601e3a --- /dev/null +++ b/hindsight-clients/go/model_validation_error_loc_inner.go @@ -0,0 +1,107 @@ +/* +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" +) + + +// ValidationErrorLocInner struct for ValidationErrorLocInner +type ValidationErrorLocInner struct { + Int32 *int32 + String *string +} + +// Unmarshal JSON data into any of the pointers in the struct +func (dst *ValidationErrorLocInner) UnmarshalJSON(data []byte) error { + var err error + // try to unmarshal JSON data into Int32 + err = json.Unmarshal(data, &dst.Int32); + if err == nil { + jsonInt32, _ := json.Marshal(dst.Int32) + if string(jsonInt32) == "{}" { // empty struct + dst.Int32 = nil + } else { + return nil // data stored in dst.Int32, return on the first match + } + } else { + dst.Int32 = nil + } + + // try to unmarshal JSON data into String + err = json.Unmarshal(data, &dst.String); + if err == nil { + jsonString, _ := json.Marshal(dst.String) + if string(jsonString) == "{}" { // empty struct + dst.String = nil + } else { + return nil // data stored in dst.String, return on the first match + } + } else { + dst.String = nil + } + + return fmt.Errorf("data failed to match schemas in anyOf(ValidationErrorLocInner)") +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src *ValidationErrorLocInner) MarshalJSON() ([]byte, error) { + if src.Int32 != nil { + return json.Marshal(&src.Int32) + } + + if src.String != nil { + return json.Marshal(&src.String) + } + + return nil, nil // no data in anyOf schemas +} + + +type NullableValidationErrorLocInner struct { + value *ValidationErrorLocInner + isSet bool +} + +func (v NullableValidationErrorLocInner) Get() *ValidationErrorLocInner { + return v.value +} + +func (v *NullableValidationErrorLocInner) Set(val *ValidationErrorLocInner) { + v.value = val + v.isSet = true +} + +func (v NullableValidationErrorLocInner) IsSet() bool { + return v.isSet +} + +func (v *NullableValidationErrorLocInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableValidationErrorLocInner(val *ValidationErrorLocInner) *NullableValidationErrorLocInner { + return &NullableValidationErrorLocInner{value: val, isSet: true} +} + +func (v NullableValidationErrorLocInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableValidationErrorLocInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/model_version_response.go b/hindsight-clients/go/model_version_response.go new file mode 100644 index 00000000..a8a0f684 --- /dev/null +++ b/hindsight-clients/go/model_version_response.go @@ -0,0 +1,188 @@ +/* +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 VersionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &VersionResponse{} + +// VersionResponse Response model for the version/info endpoint. +type VersionResponse struct { + // API version string + ApiVersion string `json:"api_version"` + // Enabled feature flags + Features FeaturesInfo `json:"features"` +} + +type _VersionResponse VersionResponse + +// NewVersionResponse instantiates a new VersionResponse 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 NewVersionResponse(apiVersion string, features FeaturesInfo) *VersionResponse { + this := VersionResponse{} + this.ApiVersion = apiVersion + this.Features = features + return &this +} + +// NewVersionResponseWithDefaults instantiates a new VersionResponse 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 NewVersionResponseWithDefaults() *VersionResponse { + this := VersionResponse{} + return &this +} + +// GetApiVersion returns the ApiVersion field value +func (o *VersionResponse) GetApiVersion() string { + if o == nil { + var ret string + return ret + } + + return o.ApiVersion +} + +// GetApiVersionOk returns a tuple with the ApiVersion field value +// and a boolean to check if the value has been set. +func (o *VersionResponse) GetApiVersionOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ApiVersion, true +} + +// SetApiVersion sets field value +func (o *VersionResponse) SetApiVersion(v string) { + o.ApiVersion = v +} + +// GetFeatures returns the Features field value +func (o *VersionResponse) GetFeatures() FeaturesInfo { + if o == nil { + var ret FeaturesInfo + return ret + } + + return o.Features +} + +// GetFeaturesOk returns a tuple with the Features field value +// and a boolean to check if the value has been set. +func (o *VersionResponse) GetFeaturesOk() (*FeaturesInfo, bool) { + if o == nil { + return nil, false + } + return &o.Features, true +} + +// SetFeatures sets field value +func (o *VersionResponse) SetFeatures(v FeaturesInfo) { + o.Features = v +} + +func (o VersionResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o VersionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["api_version"] = o.ApiVersion + toSerialize["features"] = o.Features + return toSerialize, nil +} + +func (o *VersionResponse) 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{ + "api_version", + "features", + } + + 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) + } + } + + varVersionResponse := _VersionResponse{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varVersionResponse) + + if err != nil { + return err + } + + *o = VersionResponse(varVersionResponse) + + return err +} + +type NullableVersionResponse struct { + value *VersionResponse + isSet bool +} + +func (v NullableVersionResponse) Get() *VersionResponse { + return v.value +} + +func (v *NullableVersionResponse) Set(val *VersionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableVersionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableVersionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableVersionResponse(val *VersionResponse) *NullableVersionResponse { + return &NullableVersionResponse{value: val, isSet: true} +} + +func (v NullableVersionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableVersionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/hindsight-clients/go/null_test.go b/hindsight-clients/go/null_test.go new file mode 100644 index 00000000..e40b3200 --- /dev/null +++ b/hindsight-clients/go/null_test.go @@ -0,0 +1,49 @@ +package hindsight + +import ( + "context" + "os" + "testing" +) + +// Test that the client can handle null values in responses +func TestNullHandling(t *testing.T) { + apiURL := os.Getenv("HINDSIGHT_API_URL") + if apiURL == "" { + apiURL = "http://localhost:8888" + } + + cfg := NewConfiguration() + cfg.Servers = ServerConfigurations{ + {URL: apiURL}, + } + + client := NewAPIClient(cfg) + ctx := context.Background() + + // Test retain which returns operation_id as null + req := RetainRequest{ + Items: []MemoryItem{ + {Content: "Test content for null handling"}, + }, + } + + resp, httpResp, err := client.MemoryAPI.RetainMemories(ctx, "test_null_bank").RetainRequest(req).Execute() + if err != nil { + t.Fatalf("Retain failed: %v", err) + } + defer httpResp.Body.Close() + + if !resp.GetSuccess() { + t.Error("Expected success=true") + } + + // Check that operation_id can be accessed even if null + if resp.HasOperationId() { + t.Logf("OperationId is set: %s", resp.GetOperationId()) + } else { + t.Log("OperationId is not set (null or omitted) - this is OK!") + } + + t.Logf("✅ Successfully handled response with nullable fields") +} diff --git a/hindsight-clients/go/ogen.yml b/hindsight-clients/go/ogen.yml deleted file mode 100644 index a8bfa3f0..00000000 --- a/hindsight-clients/go/ogen.yml +++ /dev/null @@ -1,9 +0,0 @@ -generator: - ignore_not_implemented: ["all"] - features: - disable: - - paths/server - - webhooks/server - - webhooks/client - - ogen/otel - - ogen/unimplemented diff --git a/hindsight-clients/go/openapi-generator-cli.jar b/hindsight-clients/go/openapi-generator-cli.jar new file mode 100644 index 00000000..1369f97f Binary files /dev/null and b/hindsight-clients/go/openapi-generator-cli.jar differ diff --git a/hindsight-clients/go/openapi-generator-config.yaml b/hindsight-clients/go/openapi-generator-config.yaml new file mode 100644 index 00000000..b0b864f6 --- /dev/null +++ b/hindsight-clients/go/openapi-generator-config.yaml @@ -0,0 +1,10 @@ +generatorName: go +outputDir: ./ +inputSpec: ../../hindsight-docs/static/openapi.json +packageName: hindsight +gitUserId: vectorize-io +gitRepoId: hindsight-client-go +isGoSubmodule: false +enumClassPrefix: true +structPrefix: true +generateInterfaces: true diff --git a/hindsight-clients/go/options.go b/hindsight-clients/go/options.go deleted file mode 100644 index 94e6ebfa..00000000 --- a/hindsight-clients/go/options.go +++ /dev/null @@ -1,321 +0,0 @@ -package hindsight - -import ( - "net/http" - "time" - - "github.com/vectorize-io/hindsight-client-go/internal/ogenapi" -) - -// --- Client options --- - -type clientConfig struct { - apiKey string - httpClient *http.Client -} - -// Option configures a [Client]. -type Option func(*clientConfig) - -// WithAPIKey sets the Bearer token used for authentication. -func WithAPIKey(key string) Option { - return func(c *clientConfig) { c.apiKey = key } -} - -// WithHTTPClient sets a custom [http.Client] for all requests. -// If combined with [WithAPIKey], the API key transport wraps this client's transport. -func WithHTTPClient(hc *http.Client) Option { - return func(c *clientConfig) { c.httpClient = hc } -} - -// --- Re-exported types --- - -// Budget controls the computation budget for recall and reflect operations. -type Budget = ogenapi.Budget - -const ( - BudgetLow = ogenapi.BudgetLow - BudgetMid = ogenapi.BudgetMid - BudgetHigh = ogenapi.BudgetHigh -) - -// TagsMatch controls how tag filtering works. -type TagsMatch string - -const ( - TagsMatchAny TagsMatch = "any" - TagsMatchAll TagsMatch = "all" - TagsMatchAnyStrict TagsMatch = "any_strict" - TagsMatchAllStrict TagsMatch = "all_strict" -) - -type ( - // RetainResponse is the response from a retain operation. - RetainResponse = ogenapi.RetainResponse - - // RecallResponse is the response from a recall operation. - RecallResponse = ogenapi.RecallResponse - - // RecallResult is a single memory result from recall. - RecallResult = ogenapi.RecallResult - - // ReflectResponse is the response from a reflect operation. - ReflectResponse = ogenapi.ReflectResponse - - // MemoryItem is a single memory item for retain operations. - MemoryItem = ogenapi.MemoryItem - - // EntityInput provides entity hints for retain. - EntityInput = ogenapi.EntityInput - - // BankProfileResponse is the response for bank profile operations. - BankProfileResponse = ogenapi.BankProfileResponse - - // BankListResponse is the response for listing banks. - BankListResponse = ogenapi.BankListResponse - - // DispositionTraits configures personality traits for a bank. - DispositionTraits = ogenapi.DispositionTraits - - // TokenUsage reports LLM token consumption. - TokenUsage = ogenapi.TokenUsage - - // ReflectBasedOn contains the evidence used for a reflect response. - ReflectBasedOn = ogenapi.ReflectBasedOn - - // IncludeOptions controls what extra data is returned from recall. - IncludeOptions = ogenapi.IncludeOptions - - // ReflectIncludeOptions controls what extra data is returned from reflect. - ReflectIncludeOptions = ogenapi.ReflectIncludeOptions -) - -// --- Retain options --- - -// RetainOption configures a [Client.Retain] call. -type RetainOption func(*retainConfig) - -type retainConfig struct { - timestamp *time.Time - context *string - documentID *string - metadata map[string]string - entities []EntityInput - tags []string -} - -// WithTimestamp sets the timestamp for a retained memory. -func WithTimestamp(t time.Time) RetainOption { - return func(c *retainConfig) { c.timestamp = &t } -} - -// WithContext sets additional context for a retained memory. -func WithContext(ctx string) RetainOption { - return func(c *retainConfig) { c.context = &ctx } -} - -// WithDocumentID groups retained memories under a document. -func WithDocumentID(id string) RetainOption { - return func(c *retainConfig) { c.documentID = &id } -} - -// WithMetadata attaches key-value metadata to a retained memory. -func WithMetadata(m map[string]string) RetainOption { - return func(c *retainConfig) { c.metadata = m } -} - -// WithEntities provides entity hints for a retained memory. -func WithEntities(e []EntityInput) RetainOption { - return func(c *retainConfig) { c.entities = e } -} - -// WithTags attaches tags to a retained memory for filtering. -func WithTags(tags []string) RetainOption { - return func(c *retainConfig) { c.tags = tags } -} - -// RetainBatchOption configures a [Client.RetainBatch] call. -type RetainBatchOption func(*retainBatchConfig) - -type retainBatchConfig struct { - documentTags []string - async bool -} - -// WithDocumentTags sets tags applied to all items in a batch retain. -func WithDocumentTags(tags []string) RetainBatchOption { - return func(c *retainBatchConfig) { c.documentTags = tags } -} - -// WithAsync processes the retain batch asynchronously. -func WithAsync(async bool) RetainBatchOption { - return func(c *retainBatchConfig) { c.async = async } -} - -// --- Recall options --- - -// RecallOption configures a [Client.Recall] call. -type RecallOption func(*recallConfig) - -type recallConfig struct { - types []string - maxTokens *int - budget *Budget - trace *bool - queryTimestamp *string - includeOpts *IncludeOptions - tags []string - tagsMatch *TagsMatch -} - -// WithTypes filters recalled memories by type (e.g., "world", "experience"). -func WithTypes(types []string) RecallOption { - return func(c *recallConfig) { c.types = types } -} - -// WithMaxTokens sets the maximum tokens for recall results. -func WithMaxTokens(n int) RecallOption { - return func(c *recallConfig) { c.maxTokens = &n } -} - -// WithBudget sets the computation budget for recall. -func WithBudget(b Budget) RecallOption { - return func(c *recallConfig) { c.budget = &b } -} - -// WithTrace enables the execution trace in recall results. -func WithTrace(enabled bool) RecallOption { - return func(c *recallConfig) { c.trace = &enabled } -} - -// WithQueryTimestamp sets the temporal context for recall (ISO 8601 format). -func WithQueryTimestamp(ts string) RecallOption { - return func(c *recallConfig) { c.queryTimestamp = &ts } -} - -// WithInclude configures which additional data to include in recall results. -func WithInclude(opts IncludeOptions) RecallOption { - return func(c *recallConfig) { c.includeOpts = &opts } -} - -// WithRecallTags filters recalled memories by tags. -func WithRecallTags(tags []string) RecallOption { - return func(c *recallConfig) { c.tags = tags } -} - -// WithRecallTagsMatch sets how tags are matched during recall. -func WithRecallTagsMatch(m TagsMatch) RecallOption { - return func(c *recallConfig) { c.tagsMatch = &m } -} - -// --- Reflect options --- - -// ReflectOption configures a [Client.Reflect] call. -type ReflectOption func(*reflectConfig) - -type reflectConfig struct { - budget *Budget - maxTokens *int - includeOpts *ReflectIncludeOptions - responseSchema map[string]any - tags []string - tagsMatch *TagsMatch -} - -// WithReflectBudget sets the computation budget for reflect. -func WithReflectBudget(b Budget) ReflectOption { - return func(c *reflectConfig) { c.budget = &b } -} - -// WithReflectMaxTokens sets the maximum tokens for the reflect response. -func WithReflectMaxTokens(n int) ReflectOption { - return func(c *reflectConfig) { c.maxTokens = &n } -} - -// WithReflectInclude configures which additional data to include in reflect results. -func WithReflectInclude(opts ReflectIncludeOptions) ReflectOption { - return func(c *reflectConfig) { c.includeOpts = &opts } -} - -// WithResponseSchema sets a JSON Schema for structured output from reflect. -func WithResponseSchema(schema map[string]any) ReflectOption { - return func(c *reflectConfig) { c.responseSchema = schema } -} - -// WithReflectTags filters memories by tags during reflect. -func WithReflectTags(tags []string) ReflectOption { - return func(c *reflectConfig) { c.tags = tags } -} - -// WithReflectTagsMatch sets how tags are matched during reflect. -func WithReflectTagsMatch(m TagsMatch) ReflectOption { - return func(c *reflectConfig) { c.tagsMatch = &m } -} - -// --- Bank options --- - -// CreateBankOption configures a [Client.CreateBank] call. -type CreateBankOption func(*createBankConfig) - -type createBankConfig struct { - name *string - mission *string - disposition *DispositionTraits -} - -// WithBankName sets the display name for a bank. -func WithBankName(name string) CreateBankOption { - return func(c *createBankConfig) { c.name = &name } -} - -// WithMission sets the mission for a bank. -func WithMission(mission string) CreateBankOption { - return func(c *createBankConfig) { c.mission = &mission } -} - -// WithDisposition sets the personality traits for a bank. -func WithDisposition(d DispositionTraits) CreateBankOption { - return func(c *createBankConfig) { c.disposition = &d } -} - -// --- helpers --- - -func optString(s string) ogenapi.OptString { - return ogenapi.NewOptString(s) -} - -func optStringPtr(s *string) ogenapi.OptString { - if s == nil { - return ogenapi.OptString{} - } - return ogenapi.NewOptString(*s) -} - -func optInt(n int) ogenapi.OptInt { - return ogenapi.NewOptInt(n) -} - -func optIntPtr(n *int) ogenapi.OptInt { - if n == nil { - return ogenapi.OptInt{} - } - return ogenapi.NewOptInt(*n) -} - -func optBool(b bool) ogenapi.OptBool { - return ogenapi.NewOptBool(b) -} - -func optBoolPtr(b *bool) ogenapi.OptBool { - if b == nil { - return ogenapi.OptBool{} - } - return ogenapi.NewOptBool(*b) -} - -func optBudget(b *Budget) ogenapi.OptBudget { - if b == nil { - return ogenapi.OptBudget{} - } - return ogenapi.NewOptBudget(*b) -} diff --git a/hindsight-clients/go/recall.go b/hindsight-clients/go/recall.go deleted file mode 100644 index 7528e45f..00000000 --- a/hindsight-clients/go/recall.go +++ /dev/null @@ -1,59 +0,0 @@ -package hindsight - -import ( - "context" - "fmt" - - "github.com/vectorize-io/hindsight-client-go/internal/ogenapi" -) - -// Recall retrieves memories from the given bank that match the query. -func (c *Client) Recall(ctx context.Context, bankID, query string, opts ...RecallOption) (*RecallResponse, error) { - var cfg recallConfig - for _, o := range opts { - o(&cfg) - } - - req := &ogenapi.RecallRequest{ - Query: query, - } - if cfg.budget != nil { - req.Budget = ogenapi.NewOptBudget(*cfg.budget) - } - if cfg.maxTokens != nil { - req.MaxTokens = ogenapi.NewOptInt(*cfg.maxTokens) - } - if cfg.trace != nil { - req.Trace = ogenapi.NewOptBool(*cfg.trace) - } - if cfg.queryTimestamp != nil { - req.QueryTimestamp = ogenapi.NewOptString(*cfg.queryTimestamp) - } - if cfg.types != nil { - req.Types = cfg.types - } - if cfg.includeOpts != nil { - req.Include = ogenapi.NewOptIncludeOptions(*cfg.includeOpts) - } - if cfg.tags != nil { - req.Tags = cfg.tags - } - if cfg.tagsMatch != nil { - req.TagsMatch = ogenapi.NewOptRecallRequestTagsMatch( - ogenapi.RecallRequestTagsMatch(*cfg.tagsMatch), - ) - } - - res, err := c.api.RecallMemories(ctx, req, ogenapi.RecallMemoriesParams{ - BankID: bankID, - }) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.RecallResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} diff --git a/hindsight-clients/go/reflect.go b/hindsight-clients/go/reflect.go deleted file mode 100644 index 8f2276d7..00000000 --- a/hindsight-clients/go/reflect.go +++ /dev/null @@ -1,74 +0,0 @@ -package hindsight - -import ( - "context" - "encoding/json" - "fmt" - - "github.com/go-faster/jx" - - "github.com/vectorize-io/hindsight-client-go/internal/ogenapi" -) - -// Reflect performs disposition-aware reasoning using the bank's memories and -// mental models. Returns a markdown-formatted response. -func (c *Client) Reflect(ctx context.Context, bankID, query string, opts ...ReflectOption) (*ReflectResponse, error) { - var cfg reflectConfig - for _, o := range opts { - o(&cfg) - } - - req := &ogenapi.ReflectRequest{ - Query: query, - } - if cfg.budget != nil { - req.Budget = ogenapi.NewOptBudget(*cfg.budget) - } - if cfg.maxTokens != nil { - req.MaxTokens = ogenapi.NewOptInt(*cfg.maxTokens) - } - if cfg.includeOpts != nil { - req.Include = ogenapi.NewOptReflectIncludeOptions(*cfg.includeOpts) - } - if cfg.responseSchema != nil { - schema, err := toResponseSchema(cfg.responseSchema) - if err != nil { - return nil, fmt.Errorf("hindsight: marshal response_schema: %w", err) - } - req.ResponseSchema = ogenapi.NewOptReflectRequestResponseSchema(schema) - } - if cfg.tags != nil { - req.Tags = cfg.tags - } - if cfg.tagsMatch != nil { - req.TagsMatch = ogenapi.NewOptReflectRequestTagsMatch( - ogenapi.ReflectRequestTagsMatch(*cfg.tagsMatch), - ) - } - - res, err := c.api.Reflect(ctx, req, ogenapi.ReflectParams{ - BankID: bankID, - }) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.ReflectResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} - -// toResponseSchema converts a map[string]any JSON schema to the ogen type. -func toResponseSchema(schema map[string]any) (ogenapi.ReflectRequestResponseSchema, error) { - out := make(ogenapi.ReflectRequestResponseSchema, len(schema)) - for k, v := range schema { - data, err := json.Marshal(v) - if err != nil { - return nil, err - } - out[k] = jx.Raw(data) - } - return out, nil -} diff --git a/hindsight-clients/go/response.go b/hindsight-clients/go/response.go new file mode 100644 index 00000000..789350fe --- /dev/null +++ b/hindsight-clients/go/response.go @@ -0,0 +1,47 @@ +/* +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 ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/hindsight-clients/go/retain.go b/hindsight-clients/go/retain.go deleted file mode 100644 index cf82c326..00000000 --- a/hindsight-clients/go/retain.go +++ /dev/null @@ -1,73 +0,0 @@ -package hindsight - -import ( - "context" - "fmt" - - "github.com/vectorize-io/hindsight-client-go/internal/ogenapi" -) - -// Retain stores a single memory in the given bank. -// It wraps [Client.RetainBatch] for convenience. -func (c *Client) Retain(ctx context.Context, bankID, content string, opts ...RetainOption) (*RetainResponse, error) { - var cfg retainConfig - for _, o := range opts { - o(&cfg) - } - - item := ogenapi.MemoryItem{ - Content: content, - } - if cfg.timestamp != nil { - item.Timestamp = ogenapi.NewOptDateTime(*cfg.timestamp) - } - if cfg.context != nil { - item.Context = ogenapi.NewOptString(*cfg.context) - } - if cfg.documentID != nil { - item.DocumentID = ogenapi.NewOptString(*cfg.documentID) - } - if cfg.metadata != nil { - m := ogenapi.MemoryItemMetadata(cfg.metadata) - item.Metadata = ogenapi.NewOptMemoryItemMetadata(m) - } - if cfg.entities != nil { - item.Entities = cfg.entities - } - if cfg.tags != nil { - item.Tags = cfg.tags - } - - return c.RetainBatch(ctx, bankID, []MemoryItem{item}) -} - -// RetainBatch stores multiple memories in the given bank. -func (c *Client) RetainBatch(ctx context.Context, bankID string, items []MemoryItem, opts ...RetainBatchOption) (*RetainResponse, error) { - var cfg retainBatchConfig - for _, o := range opts { - o(&cfg) - } - - req := &ogenapi.RetainRequest{ - Items: items, - } - if cfg.async { - req.Async = ogenapi.NewOptBool(true) - } - if cfg.documentTags != nil { - req.DocumentTags = cfg.documentTags - } - - res, err := c.api.RetainMemories(ctx, req, ogenapi.RetainMemoriesParams{ - BankID: bankID, - }) - if err != nil { - return nil, err - } - - resp, ok := res.(*ogenapi.RetainResponse) - if !ok { - return nil, fmt.Errorf("hindsight: unexpected response type %T", res) - } - return resp, nil -} diff --git a/hindsight-clients/go/test/api_banks_test.go b/hindsight-clients/go/test/api_banks_test.go new file mode 100644 index 00000000..0f0d10d3 --- /dev/null +++ b/hindsight-clients/go/test/api_banks_test.go @@ -0,0 +1,205 @@ +/* +Hindsight HTTP API + +Testing BanksAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_BanksAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test BanksAPIService AddBankBackground", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.AddBankBackground(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService ClearObservations", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.ClearObservations(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService CreateOrUpdateBank", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.CreateOrUpdateBank(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService DeleteBank", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.DeleteBank(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService GetAgentStats", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.GetAgentStats(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService GetBankConfig", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.GetBankConfig(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService GetBankProfile", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.GetBankProfile(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService ListBanks", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.BanksAPI.ListBanks(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService ResetBankConfig", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.ResetBankConfig(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService TriggerConsolidation", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.TriggerConsolidation(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService UpdateBank", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.UpdateBank(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService UpdateBankConfig", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.UpdateBankConfig(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test BanksAPIService UpdateBankDisposition", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.BanksAPI.UpdateBankDisposition(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/test/api_directives_test.go b/hindsight-clients/go/test/api_directives_test.go new file mode 100644 index 00000000..730f8de8 --- /dev/null +++ b/hindsight-clients/go/test/api_directives_test.go @@ -0,0 +1,98 @@ +/* +Hindsight HTTP API + +Testing DirectivesAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_DirectivesAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test DirectivesAPIService CreateDirective", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.DirectivesAPI.CreateDirective(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DirectivesAPIService DeleteDirective", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var directiveId string + + resp, httpRes, err := apiClient.DirectivesAPI.DeleteDirective(context.Background(), bankId, directiveId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DirectivesAPIService GetDirective", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var directiveId string + + resp, httpRes, err := apiClient.DirectivesAPI.GetDirective(context.Background(), bankId, directiveId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DirectivesAPIService ListDirectives", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.DirectivesAPI.ListDirectives(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DirectivesAPIService UpdateDirective", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var directiveId string + + resp, httpRes, err := apiClient.DirectivesAPI.UpdateDirective(context.Background(), bankId, directiveId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/test/api_documents_test.go b/hindsight-clients/go/test/api_documents_test.go new file mode 100644 index 00000000..d9c4efbd --- /dev/null +++ b/hindsight-clients/go/test/api_documents_test.go @@ -0,0 +1,83 @@ +/* +Hindsight HTTP API + +Testing DocumentsAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_DocumentsAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test DocumentsAPIService DeleteDocument", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var documentId string + + resp, httpRes, err := apiClient.DocumentsAPI.DeleteDocument(context.Background(), bankId, documentId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DocumentsAPIService GetChunk", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var chunkId string + + resp, httpRes, err := apiClient.DocumentsAPI.GetChunk(context.Background(), chunkId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DocumentsAPIService GetDocument", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var documentId string + + resp, httpRes, err := apiClient.DocumentsAPI.GetDocument(context.Background(), bankId, documentId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test DocumentsAPIService ListDocuments", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.DocumentsAPI.ListDocuments(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/test/api_entities_test.go b/hindsight-clients/go/test/api_entities_test.go new file mode 100644 index 00000000..d214b8b8 --- /dev/null +++ b/hindsight-clients/go/test/api_entities_test.go @@ -0,0 +1,69 @@ +/* +Hindsight HTTP API + +Testing EntitiesAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_EntitiesAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test EntitiesAPIService GetEntity", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var entityId string + + resp, httpRes, err := apiClient.EntitiesAPI.GetEntity(context.Background(), bankId, entityId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test EntitiesAPIService ListEntities", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.EntitiesAPI.ListEntities(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test EntitiesAPIService RegenerateEntityObservations", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var entityId string + + resp, httpRes, err := apiClient.EntitiesAPI.RegenerateEntityObservations(context.Background(), bankId, entityId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/test/api_memory_test.go b/hindsight-clients/go/test/api_memory_test.go new file mode 100644 index 00000000..acb326a5 --- /dev/null +++ b/hindsight-clients/go/test/api_memory_test.go @@ -0,0 +1,138 @@ +/* +Hindsight HTTP API + +Testing MemoryAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_MemoryAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test MemoryAPIService ClearBankMemories", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MemoryAPI.ClearBankMemories(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MemoryAPIService GetGraph", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MemoryAPI.GetGraph(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MemoryAPIService GetMemory", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var memoryId string + + resp, httpRes, err := apiClient.MemoryAPI.GetMemory(context.Background(), bankId, memoryId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MemoryAPIService ListMemories", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MemoryAPI.ListMemories(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MemoryAPIService ListTags", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MemoryAPI.ListTags(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MemoryAPIService RecallMemories", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MemoryAPI.RecallMemories(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MemoryAPIService Reflect", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MemoryAPI.Reflect(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MemoryAPIService RetainMemories", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MemoryAPI.RetainMemories(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/test/api_mental_models_test.go b/hindsight-clients/go/test/api_mental_models_test.go new file mode 100644 index 00000000..901cbf77 --- /dev/null +++ b/hindsight-clients/go/test/api_mental_models_test.go @@ -0,0 +1,113 @@ +/* +Hindsight HTTP API + +Testing MentalModelsAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_MentalModelsAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test MentalModelsAPIService CreateMentalModel", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MentalModelsAPI.CreateMentalModel(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MentalModelsAPIService DeleteMentalModel", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var mentalModelId string + + resp, httpRes, err := apiClient.MentalModelsAPI.DeleteMentalModel(context.Background(), bankId, mentalModelId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MentalModelsAPIService GetMentalModel", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var mentalModelId string + + resp, httpRes, err := apiClient.MentalModelsAPI.GetMentalModel(context.Background(), bankId, mentalModelId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MentalModelsAPIService ListMentalModels", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.MentalModelsAPI.ListMentalModels(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MentalModelsAPIService RefreshMentalModel", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var mentalModelId string + + resp, httpRes, err := apiClient.MentalModelsAPI.RefreshMentalModel(context.Background(), bankId, mentalModelId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MentalModelsAPIService UpdateMentalModel", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var mentalModelId string + + resp, httpRes, err := apiClient.MentalModelsAPI.UpdateMentalModel(context.Background(), bankId, mentalModelId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/test/api_monitoring_test.go b/hindsight-clients/go/test/api_monitoring_test.go new file mode 100644 index 00000000..55a135f2 --- /dev/null +++ b/hindsight-clients/go/test/api_monitoring_test.go @@ -0,0 +1,61 @@ +/* +Hindsight HTTP API + +Testing MonitoringAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_MonitoringAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test MonitoringAPIService GetVersion", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.MonitoringAPI.GetVersion(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MonitoringAPIService HealthEndpointHealthGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.MonitoringAPI.HealthEndpointHealthGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test MonitoringAPIService MetricsEndpointMetricsGet", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.MonitoringAPI.MetricsEndpointMetricsGet(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/test/api_operations_test.go b/hindsight-clients/go/test/api_operations_test.go new file mode 100644 index 00000000..3f07288b --- /dev/null +++ b/hindsight-clients/go/test/api_operations_test.go @@ -0,0 +1,69 @@ +/* +Hindsight HTTP API + +Testing OperationsAPIService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package hindsight + +import ( + "context" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + openapiclient "github.com/vectorize-io/hindsight-client-go" +) + +func Test_hindsight_OperationsAPIService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test OperationsAPIService CancelOperation", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var operationId string + + resp, httpRes, err := apiClient.OperationsAPI.CancelOperation(context.Background(), bankId, operationId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test OperationsAPIService GetOperationStatus", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + var operationId string + + resp, httpRes, err := apiClient.OperationsAPI.GetOperationStatus(context.Background(), bankId, operationId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test OperationsAPIService ListOperations", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var bankId string + + resp, httpRes, err := apiClient.OperationsAPI.ListOperations(context.Background(), bankId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/hindsight-clients/go/trace_test.go b/hindsight-clients/go/trace_test.go new file mode 100644 index 00000000..8096b82a --- /dev/null +++ b/hindsight-clients/go/trace_test.go @@ -0,0 +1,59 @@ +package hindsight + +import ( + "context" + "os" + "testing" +) + +// Test that the client can handle large responses with trace +func TestTraceResponse(t *testing.T) { + apiURL := os.Getenv("HINDSIGHT_API_URL") + if apiURL == "" { + apiURL = "http://localhost:8888" + } + + cfg := NewConfiguration() + cfg.Servers = ServerConfigurations{ + {URL: apiURL}, + } + + client := NewAPIClient(cfg) + ctx := context.Background() + + // First retain some data + retainReq := RetainRequest{ + Items: []MemoryItem{ + {Content: "The sky is blue"}, + }, + } + _, _, err := client.MemoryAPI.RetainMemories(ctx, "test_trace_bank").RetainRequest(retainReq).Execute() + if err != nil { + t.Fatalf("Retain failed: %v", err) + } + + // Now recall with trace enabled + recallReq := RecallRequest{ + Query: "What color is the sky?", + MaxTokens: PtrInt32(2048), + Trace: PtrBool(true), // This was failing with ogen + Types: []string{"world"}, + } + + resp, httpResp, err := client.MemoryAPI.RecallMemories(ctx, "test_trace_bank"). + RecallRequest(recallReq). + Execute() + + if err != nil { + t.Fatalf("Recall with trace failed: %v (this was the bug!)", err) + } + defer httpResp.Body.Close() + + if resp.Trace != nil && len(resp.Trace) > 0 { + t.Logf("✅ Successfully received trace data with %d keys!", len(resp.Trace)) + } else { + t.Log("No trace data in response") + } + + t.Logf("✅ Large trace response handled successfully (this was failing before!)") +} diff --git a/hindsight-clients/go/utils.go b/hindsight-clients/go/utils.go new file mode 100644 index 00000000..39c6d5f6 --- /dev/null +++ b/hindsight-clients/go/utils.go @@ -0,0 +1,361 @@ +/* +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 ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} \ No newline at end of file diff --git a/hindsight-docs/docs/cookbook/applications/go-memory-service.md b/hindsight-docs/docs/cookbook/applications/go-memory-service.md deleted file mode 100644 index b49a6297..00000000 --- a/hindsight-docs/docs/cookbook/applications/go-memory-service.md +++ /dev/null @@ -1,345 +0,0 @@ ---- -sidebar_position: 10 ---- - -# Go Memory-Augmented API - -:::info Complete Application -This is a complete, runnable Go application demonstrating Hindsight integration. -::: - -A Go HTTP microservice that combines a domain API with Hindsight memory. Each API user gets a personal memory bank. The service remembers past interactions and uses them to provide personalized responses. - -## Use Case - -A **developer knowledge assistant** that remembers what technologies each user works with, what problems they've solved, and provides personalized recommendations. - -## Features - -- Per-user memory banks (created on first interaction) -- Conversation history stored via retain -- Context-aware responses via recall + reflect -- Structured output for programmatic consumption -- Health check and bank stats endpoints - -## Project Structure - -``` -go-memory-service/ -├── main.go # HTTP server, routes, handlers -├── go.mod -└── go.sum -``` - -## The Code - -```go -package main - -import ( - "context" - "encoding/json" - "fmt" - "log" - "net/http" - "os" - "strings" - "time" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -var client *hindsight.Client - -func main() { - apiURL := envOr("HINDSIGHT_API_URL", "http://localhost:8888") - - var err error - client, err = hindsight.New(apiURL) - if err != nil { - log.Fatal(err) - } - - mux := http.NewServeMux() - mux.HandleFunc("POST /ask", handleAsk) - mux.HandleFunc("POST /learn", handleLearn) - mux.HandleFunc("GET /recall/{userID}", handleRecall) - mux.HandleFunc("GET /health", handleHealth) - - addr := envOr("ADDR", ":8080") - log.Printf("listening on %s (hindsight: %s)", addr, apiURL) - log.Fatal(http.ListenAndServe(addr, mux)) -} - -// --- Request/Response types --- - -type AskRequest struct { - UserID string `json:"user_id"` - Query string `json:"query"` -} - -type AskResponse struct { - Answer string `json:"answer"` - Facts []string `json:"facts,omitempty"` -} - -type LearnRequest struct { - UserID string `json:"user_id"` - Content string `json:"content"` - Tags []string `json:"tags,omitempty"` -} - -type RecallResponse struct { - Results []RecallFact `json:"results"` -} - -type RecallFact struct { - Text string `json:"text"` - Type string `json:"type"` -} - -// --- Handlers --- - -// handleLearn stores new information for a user. -func handleLearn(w http.ResponseWriter, r *http.Request) { - var req LearnRequest - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - http.Error(w, "invalid JSON", http.StatusBadRequest) - return - } - - ctx := r.Context() - bankID := bankFor(req.UserID) - - // Ensure bank exists - ensureBank(ctx, bankID, req.UserID) - - // Store the memory - var opts []hindsight.RetainOption - if len(req.Tags) > 0 { - opts = append(opts, hindsight.WithTags(req.Tags)) - } - - resp, err := client.Retain(ctx, bankID, req.Content, opts...) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - writeJSON(w, map[string]any{ - "success": resp.Success, - "bank_id": bankID, - }) -} - -// handleAsk answers a question using the user's memories. -func handleAsk(w http.ResponseWriter, r *http.Request) { - var req AskRequest - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - http.Error(w, "invalid JSON", http.StatusBadRequest) - return - } - - ctx := r.Context() - bankID := bankFor(req.UserID) - - // Ensure bank exists - ensureBank(ctx, bankID, req.UserID) - - // Recall relevant facts - recallResp, err := client.Recall(ctx, bankID, req.Query, - hindsight.WithBudget(hindsight.BudgetMid), - hindsight.WithMaxTokens(2048), - ) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - var facts []string - for _, result := range recallResp.Results { - facts = append(facts, result.Text) - } - - // Reflect to generate an answer - reflectResp, err := client.Reflect(ctx, bankID, req.Query, - hindsight.WithReflectBudget(hindsight.BudgetMid), - ) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - // Store this interaction as a new memory - interaction := fmt.Sprintf("User asked: %q\nAssistant answered: %s", req.Query, reflectResp.Text) - go func() { - bgCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - client.Retain(bgCtx, bankID, interaction, - hindsight.WithContext("Q&A interaction"), - ) - }() - - writeJSON(w, AskResponse{ - Answer: reflectResp.Text, - Facts: facts, - }) -} - -// handleRecall returns raw memories for a user. -func handleRecall(w http.ResponseWriter, r *http.Request) { - userID := r.PathValue("userID") - query := r.URL.Query().Get("q") - if query == "" { - query = "What do you know?" - } - - ctx := r.Context() - bankID := bankFor(userID) - - resp, err := client.Recall(ctx, bankID, query, - hindsight.WithBudget(hindsight.BudgetHigh), - ) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - var results []RecallFact - for _, result := range resp.Results { - results = append(results, RecallFact{ - Text: result.Text, - Type: result.Type.Or("unknown"), - }) - } - - writeJSON(w, RecallResponse{Results: results}) -} - -func handleHealth(w http.ResponseWriter, _ *http.Request) { - writeJSON(w, map[string]string{"status": "ok"}) -} - -// --- Helpers --- - -func bankFor(userID string) string { - return "user-" + strings.ToLower(userID) -} - -func ensureBank(ctx context.Context, bankID, userID string) { - client.CreateBank(ctx, bankID, - hindsight.WithBankName(fmt.Sprintf("Memory for %s", userID)), - hindsight.WithMission("Developer knowledge assistant. Remember technologies, problems solved, and preferences."), - ) -} - -func writeJSON(w http.ResponseWriter, v any) { - w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(v) -} - -func envOr(key, fallback string) string { - if v := os.Getenv(key); v != "" { - return v - } - return fallback -} -``` - -## Running - -### 1. Start Hindsight - -```bash -export OPENAI_API_KEY=your-key - -docker run --rm -it --pull always -p 8888:8888 -p 9999:9999 \ - -e HINDSIGHT_API_LLM_API_KEY=$OPENAI_API_KEY \ - -e HINDSIGHT_API_LLM_MODEL=o3-mini \ - -v $HOME/.hindsight-docker:/home/hindsight/.pg0 \ - ghcr.io/vectorize-io/hindsight:latest -``` - -### 2. Start the service - -```bash -go run main.go -``` - -### 3. Try it out - -```bash -# Teach it something -curl -s localhost:8080/learn -d '{ - "user_id": "alice", - "content": "I am building a Go microservice that uses gRPC and PostgreSQL", - "tags": ["project"] -}' | jq . - -# Teach it more -curl -s localhost:8080/learn -d '{ - "user_id": "alice", - "content": "I solved a connection pooling issue by switching from pgx to pgxpool", - "tags": ["debugging"] -}' - -curl -s localhost:8080/learn -d '{ - "user_id": "alice", - "content": "I prefer structured logging with slog over zerolog", - "tags": ["preferences"] -}' - -# Ask a question (uses recall + reflect) -curl -s localhost:8080/ask -d '{ - "user_id": "alice", - "query": "What tech stack am I using?" -}' | jq . - -# Raw recall -curl -s "localhost:8080/recall/alice?q=database" | jq . -``` - -## How It Works - -1. **`/learn`** - Stores information using `Retain`. Each piece of info becomes searchable facts, entities, and relationships. - -2. **`/ask`** - Two-phase retrieval: - - **Recall**: Finds relevant facts from the user's memory bank - - **Reflect**: Synthesizes a response using those facts plus disposition-aware reasoning - - The Q&A interaction itself is stored as a new memory (fire-and-forget goroutine) - -3. **`/recall/{userID}`** - Direct access to raw recalled facts for debugging or building custom UIs. - -## Key Patterns - -### Per-User Isolation - -Each user gets their own bank (`user-alice`, `user-bob`). Banks are created lazily on first interaction via `CreateBank` (idempotent - safe to call repeatedly). - -### Fire-and-Forget Memory - -The `/ask` handler stores the interaction in a background goroutine so the response isn't delayed by the retain call: - -```go -go func() { - bgCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - client.Retain(bgCtx, bankID, interaction) -}() -``` - -### Tag-Based Scoping - -Tags partition memories within a bank. Query only `debugging` memories, or only `preferences`: - -```bash -# The /recall endpoint could be extended to support tag filtering: -curl "localhost:8080/recall/alice?q=issues&tags=debugging" -``` - -## Next Steps - -- [Go Quickstart](/cookbook/recipes/go-quickstart) - Core operations walkthrough -- [Go Concurrent Pipeline](/cookbook/recipes/go-concurrent-pipeline) - Bulk data ingestion -- [Per-User Memory](/cookbook/recipes/per-user-memory) - The pattern in depth -- [Go SDK Reference](/sdks/go) - Full API documentation diff --git a/hindsight-docs/docs/cookbook/index.mdx b/hindsight-docs/docs/cookbook/index.mdx index c3d20351..cb22bd4d 100644 --- a/hindsight-docs/docs/cookbook/index.mdx +++ b/hindsight-docs/docs/cookbook/index.mdx @@ -86,18 +86,6 @@ Learn how to build with Hindsight through practical examples: href: "/cookbook/recipes/study_buddy", description: "Track study sessions, identify knowledge gaps, and get personalized review suggestions", tags: { sdk: "hindsight-client", topic: "Learning" } - }, - { - title: "Go Quickstart", - href: "/cookbook/recipes/go-quickstart", - description: "Get started with the Go client: retain, recall, and reflect", - tags: { sdk: "hindsight-go", topic: "Quick Start" } - }, - { - title: "Go Concurrent Pipeline", - href: "/cookbook/recipes/go-concurrent-pipeline", - description: "Build a concurrent memory ingestion pipeline with goroutines", - tags: { sdk: "hindsight-go", topic: "Learning" } } ]} /> @@ -152,12 +140,6 @@ Learn how to build with Hindsight through practical examples: href: "/cookbook/applications/taste-ai", description: "Personal food assistant with AI SDK v6 showcasing recall, mental models, and directives", tags: { sdk: "@vectorize-io/hindsight-ai-sdk", topic: "Recommendation" } - }, - { - title: "Go Memory-Augmented API", - href: "/cookbook/applications/go-memory-service", - description: "Go HTTP microservice with per-user memory banks for a developer knowledge assistant", - tags: { sdk: "hindsight-go", topic: "Learning" } } ]} /> diff --git a/hindsight-docs/docs/cookbook/recipes/go-concurrent-pipeline.md b/hindsight-docs/docs/cookbook/recipes/go-concurrent-pipeline.md deleted file mode 100644 index 158627b7..00000000 --- a/hindsight-docs/docs/cookbook/recipes/go-concurrent-pipeline.md +++ /dev/null @@ -1,272 +0,0 @@ ---- -sidebar_position: 13 ---- - -# Go Concurrent Pipeline - -Build a concurrent memory ingestion pipeline in Go. This recipe demonstrates how to use Go's concurrency primitives with the Hindsight client to ingest large datasets efficiently, then query them with recall and reflect. - -## The Problem - -You have a large dataset (log files, chat transcripts, documents) that needs to be ingested into Hindsight. Sequential ingestion is slow. Go's goroutines make it straightforward to parallelize. - -## Architecture - -``` - ┌──────────┐ - │ Source │ - │ (files, │ - │ API, DB) │ - └────┬─────┘ - │ - ┌────▼─────┐ - │ Producer │ reads data, sends to channel - └────┬─────┘ - │ - ┌──────────┼──────────┐ - │ │ │ - ┌────▼───┐ ┌───▼────┐ ┌──▼─────┐ - │Worker 1│ │Worker 2│ │Worker N│ concurrent RetainBatch - └────┬───┘ └───┬────┘ └──┬─────┘ - │ │ │ - └─────────┼─────────┘ - │ - ┌─────▼─────┐ - │ Hindsight │ - │ API │ - └───────────┘ -``` - -## Prerequisites - -Hindsight server running (see [Go Quickstart](/cookbook/recipes/go-quickstart) for setup). - -## The Pipeline - -```go -package main - -import ( - "bufio" - "context" - "fmt" - "log" - "os" - "sync" - "sync/atomic" - "time" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -const ( - batchSize = 10 // memories per batch - numWorkers = 4 // concurrent workers -) - -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - bankID := "pipeline-demo" - - // Create the bank - client.CreateBank(ctx, bankID, - hindsight.WithBankName("Pipeline Demo"), - hindsight.WithMission("Knowledge base ingested from documents"), - ) - - // Ingest from a file (one line = one memory) - if len(os.Args) < 2 { - fmt.Println("usage: pipeline ") - os.Exit(1) - } - - start := time.Now() - count := ingest(ctx, client, bankID, os.Args[1]) - elapsed := time.Since(start) - - fmt.Printf("\nIngested %d memories in %s (%.1f/sec)\n", - count, elapsed, float64(count)/elapsed.Seconds()) - - // Query the ingested data - fmt.Println("\n--- Recall ---") - resp, _ := client.Recall(ctx, bankID, "What are the key topics?", - hindsight.WithBudget(hindsight.BudgetHigh), - ) - for _, r := range resp.Results { - fmt.Printf(" - %s\n", r.Text) - } - - fmt.Println("\n--- Reflect ---") - answer, _ := client.Reflect(ctx, bankID, "Summarize everything you know") - fmt.Println(answer.Text) -} - -func ingest(ctx context.Context, client *hindsight.Client, bankID, filename string) int64 { - f, err := os.Open(filename) - if err != nil { - log.Fatal(err) - } - defer f.Close() - - // Channel for batches - batches := make(chan []hindsight.MemoryItem, numWorkers*2) - var ingested atomic.Int64 - - // Start workers - var wg sync.WaitGroup - for i := range numWorkers { - wg.Add(1) - go func(id int) { - defer wg.Done() - for batch := range batches { - _, err := client.RetainBatch(ctx, bankID, batch) - if err != nil { - log.Printf("worker %d: batch failed: %v", id, err) - continue - } - n := ingested.Add(int64(len(batch))) - if n%100 == 0 { - fmt.Printf(" ingested %d memories...\n", n) - } - } - }(i) - } - - // Producer: read lines and batch them - scanner := bufio.NewScanner(f) - var batch []hindsight.MemoryItem - - for scanner.Scan() { - line := scanner.Text() - if line == "" { - continue - } - batch = append(batch, hindsight.MemoryItem{Content: line}) - - if len(batch) >= batchSize { - batches <- batch - batch = nil - } - } - - // Flush remaining - if len(batch) > 0 { - batches <- batch - } - - close(batches) - wg.Wait() - - return ingested.Load() -} -``` - -## Running It - -Create a sample data file: - -```bash -cat > sample_data.txt << 'EOF' -The Go programming language was created at Google in 2007 -Go's concurrency model is based on CSP (Communicating Sequential Processes) -Goroutines are lightweight threads managed by the Go runtime -Channels provide typed conduits for communication between goroutines -The sync package provides mutexes, wait groups, and other synchronization primitives -Go modules were introduced in Go 1.11 for dependency management -The context package provides cancellation and deadline propagation -Go compiles to a single static binary with no external dependencies -The standard library includes an HTTP server, JSON parser, and crypto packages -Go 1.18 introduced generics with type parameters -EOF -``` - -```bash -go run . sample_data.txt -``` - -## Adding Tags for Partitioning - -For larger datasets, use tags to partition memories by source or topic: - -```go -func ingestWithTags(ctx context.Context, client *hindsight.Client, bankID, source string, lines []string) { - var items []hindsight.MemoryItem - for _, line := range lines { - items = append(items, hindsight.MemoryItem{ - Content: line, - Tags: []string{source}, - }) - } - - _, err := client.RetainBatch(ctx, bankID, items, - hindsight.WithDocumentTags([]string{"bulk-import", source}), - ) - if err != nil { - log.Printf("ingest %s failed: %v", source, err) - } -} - -// Later, recall only from a specific source -resp, _ := client.Recall(ctx, bankID, "What are the key concepts?", - hindsight.WithRecallTags([]string{"go-docs"}), - hindsight.WithRecallTagsMatch(hindsight.TagsMatchAnyStrict), -) -``` - -## Async Ingestion - -For very large datasets, use async mode to avoid waiting for fact extraction: - -```go -// Async retain returns immediately; processing happens in background -_, err := client.RetainBatch(ctx, bankID, items, - hindsight.WithAsync(true), -) - -// Check operation status via the ogen client -ogen := client.OgenClient() -ops, _ := ogen.ListOperations(ctx, ogenapi.ListOperationsParams{ - BankID: bankID, -}) -``` - -## Graceful Shutdown - -Use `context.WithCancel` for clean cancellation: - -```go -ctx, cancel := context.WithCancel(context.Background()) -defer cancel() - -// In a signal handler: -sigCh := make(chan os.Signal, 1) -signal.Notify(sigCh, os.Interrupt) -go func() { - <-sigCh - fmt.Println("\nShutting down gracefully...") - cancel() -}() - -// Workers will stop when ctx is cancelled -``` - -## Performance Tips - -| Tip | Why | -|-----|-----| -| Use `RetainBatch` over individual `Retain` | Fewer HTTP round trips | -| Set `batchSize` to 10-50 | Balances throughput vs. memory | -| Use 4-8 workers | Matches typical API concurrency limits | -| Use `WithAsync(true)` for bulk imports | Returns immediately, processes in background | -| Tag your data | Enables scoped recall without reingesting | - -## Next Steps - -- [Go Quickstart](/cookbook/recipes/go-quickstart) - Basic retain, recall, reflect -- [Per-User Memory](/cookbook/recipes/per-user-memory) - One bank per user pattern -- [Go SDK Reference](/sdks/go) - Full API reference diff --git a/hindsight-docs/docs/cookbook/recipes/go-quickstart.md b/hindsight-docs/docs/cookbook/recipes/go-quickstart.md deleted file mode 100644 index acc21e2e..00000000 --- a/hindsight-docs/docs/cookbook/recipes/go-quickstart.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -sidebar_position: 12 ---- - -# Go Quickstart - -Get started with the Hindsight Go client in under 5 minutes. This recipe covers the three core operations: **retain**, **recall**, and **reflect**. - -## Prerequisites - -Make sure you have Hindsight running. The easiest way is via Docker: - -```bash -export OPENAI_API_KEY=your-key - -docker run --rm -it --pull always -p 8888:8888 -p 9999:9999 \ - -e HINDSIGHT_API_LLM_API_KEY=$OPENAI_API_KEY \ - -e HINDSIGHT_API_LLM_MODEL=o3-mini \ - -v $HOME/.hindsight-docker:/home/hindsight/.pg0 \ - ghcr.io/vectorize-io/hindsight:latest -``` - -- API: http://localhost:8888 -- UI: http://localhost:9999 - -## Installation - -```bash -go get github.com/vectorize-io/hindsight-client-go -``` - -## Connect to Hindsight - -```go -package main - -import ( - "context" - "fmt" - "log" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - bankID := "go-quickstart" -``` - -## Retain: Store Information - -The `Retain` operation pushes new memories into Hindsight. Behind the scenes, an LLM extracts key facts, temporal data, entities, and relationships. - -```go - // Simple retain - _, err = client.Retain(ctx, bankID, - "Alice works at Google as a software engineer", - ) - if err != nil { - log.Fatal(err) - } - fmt.Println("Stored memory about Alice's job") - - // Retain with context and timestamp - _, err = client.Retain(ctx, bankID, - "Alice got promoted to senior engineer", - hindsight.WithContext("career update"), - hindsight.WithTimestamp(time.Date(2025, 6, 15, 10, 0, 0, 0, time.UTC)), - ) - if err != nil { - log.Fatal(err) - } - fmt.Println("Stored memory about Alice's promotion") -``` - -## Retain Batch: Store Multiple Memories - -```go - items := []hindsight.MemoryItem{ - {Content: "Bob is a data scientist who works with Alice"}, - {Content: "Charlie manages the team and reports to the VP of Engineering"}, - {Content: "The team is working on a recommendation engine using Go"}, - } - - resp, err := client.RetainBatch(ctx, bankID, items) - if err != nil { - log.Fatal(err) - } - fmt.Printf("Stored %d memories\n", resp.ItemsCount) -``` - -## Recall: Retrieve Memories - -`Recall` retrieves memories matching a query using four parallel strategies: semantic similarity, keyword matching, entity/relationship graph traversal, and temporal filtering. - -```go - // Simple recall - results, err := client.Recall(ctx, bankID, "What does Alice do?") - if err != nil { - log.Fatal(err) - } - - fmt.Println("\nMemories about Alice:") - for _, r := range results.Results { - fmt.Printf(" - %s\n", r.Text) - } -``` - -```go - // Recall with options - results, err = client.Recall(ctx, bankID, "Who works on the team?", - hindsight.WithBudget(hindsight.BudgetHigh), - hindsight.WithMaxTokens(2048), - hindsight.WithTypes([]string{"world"}), - ) - if err != nil { - log.Fatal(err) - } - - fmt.Println("\nTeam memories (world facts only):") - for _, r := range results.Results { - fmt.Printf(" - [%s] %s\n", r.Type.Or("?"), r.Text) - } -``` - -## Reflect: Generate Insights - -`Reflect` performs disposition-aware reasoning over stored memories. It retrieves relevant context, then uses an LLM to synthesize a response. Great for summarization, analysis, and Q&A. - -```go - answer, err := client.Reflect(ctx, bankID, - "What should I know about this team?", - ) - if err != nil { - log.Fatal(err) - } - - fmt.Println("\nReflection:") - fmt.Println(answer.Text) -``` - -## Full Program - -Here's the complete program: - -```go -package main - -import ( - "context" - "fmt" - "log" - "time" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - bankID := "go-quickstart" - - // 1. Store memories - client.Retain(ctx, bankID, "Alice works at Google as a software engineer") - client.Retain(ctx, bankID, "Alice got promoted to senior engineer", - hindsight.WithContext("career update"), - hindsight.WithTimestamp(time.Date(2025, 6, 15, 10, 0, 0, 0, time.UTC)), - ) - - items := []hindsight.MemoryItem{ - {Content: "Bob is a data scientist who works with Alice"}, - {Content: "Charlie manages the team and reports to the VP of Engineering"}, - {Content: "The team is working on a recommendation engine using Go"}, - } - client.RetainBatch(ctx, bankID, items) - - // 2. Recall memories - results, _ := client.Recall(ctx, bankID, "What does Alice do?") - fmt.Println("Memories about Alice:") - for _, r := range results.Results { - fmt.Printf(" - %s\n", r.Text) - } - - // 3. Reflect - answer, _ := client.Reflect(ctx, bankID, "What should I know about this team?") - fmt.Printf("\nReflection:\n%s\n", answer.Text) - - // 4. Cleanup - client.DeleteBank(ctx, bankID) -} -``` - -## Memory Types - -Hindsight organizes memory into distinct networks: - -| Type | Description | Example | -|------|-------------|---------| -| **World** | Facts about the world | "Alice works at Google" | -| **Experience** | Agent's own experiences | "I helped Alice debug her code" | -| **Observation** | Complex models from reflection | "Alice is a senior IC focused on ML" | - -## Next Steps - -- [Go Concurrent Pipeline](/cookbook/recipes/go-concurrent-pipeline) - Build a concurrent ingestion pipeline -- [Per-User Memory](/cookbook/recipes/per-user-memory) - One bank per user pattern -- [Go SDK Reference](/sdks/go) - Full API reference diff --git a/hindsight-docs/docs/sdks/go.md b/hindsight-docs/docs/sdks/go.md index 8b60a1db..e97468ae 100644 --- a/hindsight-docs/docs/sdks/go.md +++ b/hindsight-docs/docs/sdks/go.md @@ -4,7 +4,10 @@ sidebar_position: 3 # Go Client -Official Go client for the Hindsight API, built on [ogen](https://github.com/ogen-go/ogen) for strongly-typed code generation from the OpenAPI 3.1 spec. +Official Go client for the Hindsight API, generated from the OpenAPI 3.1 spec using [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +import CodeSnippet from '@site/src/components/CodeSnippet'; +import quickstartGo from '!!raw-loader!@site/examples/api/quickstart.go'; ## Installation @@ -12,283 +15,37 @@ Official Go client for the Hindsight API, built on [ogen](https://github.com/oge go get github.com/vectorize-io/hindsight-client-go ``` -Requires Go 1.25+. +Requires Go 1.23+. ## Quick Start -```go -package main + -import ( - "context" - "fmt" - "log" +## API Structure - hindsight "github.com/vectorize-io/hindsight-client-go" -) +The Go client provides access to all Hindsight API operations through structured namespaces: -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } +- **`client.MemoryAPI`** - Retain, recall, reflect operations +- **`client.BanksAPI`** - Bank management +- **`client.DirectivesAPI`** - Directive management +- **`client.MentalModelsAPI`** - Mental model management +- **`client.DocumentsAPI`** - Document operations +- **`client.EntitiesAPI`** - Entity operations +- **`client.OperationsAPI`** - Async operation monitoring - ctx := context.Background() +## Working with Nullable Fields - // Retain a memory - client.Retain(ctx, "my-bank", "Alice works at Google") +The Go client uses `NullableString`, `NullableTime`, and similar types for optional fields: - // Recall memories - resp, _ := client.Recall(ctx, "my-bank", "What does Alice do?") - for _, r := range resp.Results { - fmt.Println(r.Text) - } - - // Reflect - generate response with disposition - answer, _ := client.Reflect(ctx, "my-bank", "Tell me about Alice") - fmt.Println(answer.Text) -} -``` - -## Client Initialization - -```go -import hindsight "github.com/vectorize-io/hindsight-client-go" - -// Default client -client, err := hindsight.New("http://localhost:8888") - -// With API key authentication -client, err := hindsight.New("http://localhost:8888", - hindsight.WithAPIKey("your-api-key"), -) - -// With custom HTTP client -client, err := hindsight.New("http://localhost:8888", - hindsight.WithHTTPClient(&http.Client{Timeout: 30 * time.Second}), -) -``` - -## Core Operations - -### Retain (Store Memory) - -```go -// Simple -_, err := client.Retain(ctx, "my-bank", "Alice works at Google as a software engineer") - -// With options -_, err := client.Retain(ctx, "my-bank", "Alice got promoted", - hindsight.WithContext("career update"), - hindsight.WithTimestamp(time.Date(2024, 1, 15, 10, 0, 0, 0, time.UTC)), - hindsight.WithDocumentID("conversation_001"), - hindsight.WithMetadata(map[string]string{"source": "slack"}), - hindsight.WithTags([]string{"career", "updates"}), -) -``` - -### Retain Batch - -```go -items := []hindsight.MemoryItem{ - {Content: "Alice works at Google"}, - {Content: "Bob is a data scientist"}, -} - -_, err := client.RetainBatch(ctx, "my-bank", items, - hindsight.WithDocumentTags([]string{"team-info"}), - hindsight.WithAsync(false), // Set true for background processing -) -``` - -### Recall (Search) - -```go -// Simple -resp, err := client.Recall(ctx, "my-bank", "What does Alice do?") - -for _, r := range resp.Results { - fmt.Printf(" %s (type: %s)\n", r.Text, r.Type.Or("unknown")) -} - -// With options -resp, err := client.Recall(ctx, "my-bank", "What does Alice do?", - hindsight.WithTypes([]string{"world", "experience"}), // Filter by fact type - hindsight.WithMaxTokens(4096), - hindsight.WithBudget(hindsight.BudgetHigh), // BudgetLow, BudgetMid, BudgetHigh - hindsight.WithTrace(true), // Include execution trace - hindsight.WithRecallTags([]string{"career"}), - hindsight.WithRecallTagsMatch(hindsight.TagsMatchAnyStrict), -) -``` - -### Reflect (Generate Response) - -```go -resp, err := client.Reflect(ctx, "my-bank", "What should I know about Alice?", - hindsight.WithReflectBudget(hindsight.BudgetMid), - hindsight.WithReflectMaxTokens(2048), -) - -fmt.Println(resp.Text) // Generated markdown response -``` - -### Reflect with Structured Output - -```go -resp, err := client.Reflect(ctx, "my-bank", - "What programming language should I learn for data science?", - hindsight.WithResponseSchema(map[string]any{ - "type": "object", - "properties": map[string]any{ - "recommendation": map[string]any{"type": "string"}, - "reasons": map[string]any{"type": "array", "items": map[string]any{"type": "string"}}, - "confidence": map[string]any{"type": "string"}, - }, - "required": []any{"recommendation", "reasons"}, - }), - hindsight.WithReflectMaxTokens(4096), -) - -// resp.StructuredOutput contains the parsed JSON schema result -``` - -## Bank Management - -### Create Bank - -```go -_, err := client.CreateBank(ctx, "my-bank", - hindsight.WithBankName("Assistant"), - hindsight.WithMission("Helpful AI assistant tracking user preferences."), - hindsight.WithDisposition(hindsight.DispositionTraits{ - Skepticism: 3, // 1-5: trusting to skeptical - Literalism: 3, // 1-5: flexible to literal - Empathy: 3, // 1-5: detached to empathetic - }), -) -``` - -### Other Bank Operations - -```go -// Get bank profile -profile, err := client.GetBankProfile(ctx, "my-bank") -fmt.Println(profile.Mission) - -// List all banks -banks, err := client.ListBanks(ctx) -for _, b := range banks.Banks { - fmt.Println(b.BankID) -} - -// Update mission -_, err = client.SetMission(ctx, "my-bank", "New mission statement") - -// Update disposition -_, err = client.UpdateDisposition(ctx, "my-bank", hindsight.DispositionTraits{ - Skepticism: 4, - Literalism: 2, - Empathy: 5, -}) - -// Delete bank (destructive, cannot be undone) -err = client.DeleteBank(ctx, "my-bank") -``` - -## Tag Filtering - -Tags provide visibility scoping for memories. Use them to partition memories within a bank. - -```go -// Store tagged memories -client.Retain(ctx, "my-bank", "Project X meeting notes", - hindsight.WithTags([]string{"project_x", "meetings"}), -) - -// Recall only project_x memories (strict - excludes untagged) -resp, _ := client.Recall(ctx, "my-bank", "What happened in meetings?", - hindsight.WithRecallTags([]string{"project_x"}), - hindsight.WithRecallTagsMatch(hindsight.TagsMatchAnyStrict), -) - -// Reflect scoped to tags -resp, _ := client.Reflect(ctx, "my-bank", "Summarize project X", - hindsight.WithReflectTags([]string{"project_x"}), - hindsight.WithReflectTagsMatch(hindsight.TagsMatchAnyStrict), -) -``` - -| Match Mode | Behavior | -|-----------|----------| -| `TagsMatchAny` | OR matching, includes untagged memories | -| `TagsMatchAll` | AND matching, includes untagged memories | -| `TagsMatchAnyStrict` | OR matching, excludes untagged memories | -| `TagsMatchAllStrict` | AND matching, excludes untagged memories | - -## Advanced Usage (ogen Client) - -For operations not covered by the high-level wrapper (documents, entities, mental models, directives, operations), access the generated ogen client directly: - -```go -import "github.com/vectorize-io/hindsight-client-go/internal/ogenapi" - -ogen := client.OgenClient() - -// List entities -entities, err := ogen.ListEntities(ctx, ogenapi.ListEntitiesParams{ - BankID: "my-bank", -}) - -// Create a mental model -model, err := ogen.CreateMentalModel(ctx, - &ogenapi.CreateMentalModelRequest{ - Name: ogenapi.NewOptString("User Preferences"), - SourceQuery: "What are this user's preferences and habits?", - }, - ogenapi.CreateMentalModelParams{BankID: "my-bank"}, -) - -// Create a directive -directive, err := ogen.CreateDirective(ctx, - &ogenapi.CreateDirectiveRequest{ - Name: "Response Style", - Content: "Always respond in a friendly, concise manner", - }, - ogenapi.CreateDirectiveParams{BankID: "my-bank"}, -) - -// List operations (async tasks) -ops, err := ogen.ListOperations(ctx, ogenapi.ListOperationsParams{ - BankID: "my-bank", -}) - -// Get bank stats -stats, err := ogen.GetAgentStats(ctx, ogenapi.GetAgentStatsParams{ - BankID: "my-bank", -}) -``` + ## Error Handling -The client returns standard Go errors. HTTP errors from the API are returned as ogen error types: + -```go -resp, err := client.Recall(ctx, "nonexistent-bank", "query") -if err != nil { - // Handle error - could be network, HTTP 4xx/5xx, etc. - log.Printf("recall failed: %v", err) -} -``` +## More Examples -## Code Generation - -The Go client is built on [ogen](https://github.com/ogen-go/ogen). The generated code lives in `internal/ogenapi/` and provides full type safety with no `interface{}` or reflection. - -To regenerate after API changes: - -```bash -cd hindsight-clients/go -go generate ./... -go build ./... -``` +For detailed examples of all operations, see: +- [Python SDK documentation](./python.md) - API concepts are the same +- [Node.js SDK documentation](./nodejs.md) - API concepts are the same +- [OpenAPI specification](https://hindsight.dev/openapi.json) - Complete API reference diff --git a/hindsight-docs/examples/api/quickstart.go b/hindsight-docs/examples/api/quickstart.go new file mode 100644 index 00000000..69ed9ed6 --- /dev/null +++ b/hindsight-docs/examples/api/quickstart.go @@ -0,0 +1,90 @@ +package main + +import ( + "context" + "fmt" + "log" + "net/http" + "os" + "time" + + hindsight "github.com/vectorize-io/hindsight-client-go" +) + +func main() { + apiURL := os.Getenv("HINDSIGHT_API_URL") + if apiURL == "" { + apiURL = "http://localhost:8888" + } + + // [docs:quickstart-full] + cfg := hindsight.NewConfiguration() + cfg.Servers = hindsight.ServerConfigurations{ + {URL: "http://localhost:8888"}, + } + client := hindsight.NewAPIClient(cfg) + ctx := context.Background() + + // Retain a memory + retainReq := hindsight.RetainRequest{ + Items: []hindsight.MemoryItem{ + {Content: "Alice works at Google"}, + }, + } + client.MemoryAPI.RetainMemories(ctx, "my-bank").RetainRequest(retainReq).Execute() + + // Recall memories + recallReq := hindsight.RecallRequest{ + Query: "What does Alice do?", + } + resp, _, _ := client.MemoryAPI.RecallMemories(ctx, "my-bank").RecallRequest(recallReq).Execute() + for _, r := range resp.Results { + fmt.Println(r.Text) + } + + // Reflect - generate response + reflectReq := hindsight.ReflectRequest{ + Query: "Tell me about Alice", + } + answer, _, _ := client.MemoryAPI.Reflect(ctx, "my-bank").ReflectRequest(reflectReq).Execute() + fmt.Println(answer.GetText()) + // [/docs:quickstart-full] + + // Cleanup (not shown in docs) + req, _ := http.NewRequest("DELETE", fmt.Sprintf("%s/v1/default/banks/my-bank", apiURL), nil) + http.DefaultClient.Do(req) + + // [docs:nullable-fields] + // Creating nullable values + timestamp := time.Date(2024, 1, 15, 10, 0, 0, 0, time.UTC) + retainReq2 := hindsight.RetainRequest{ + Items: []hindsight.MemoryItem{ + { + Content: "Alice got promoted", + Context: *hindsight.NewNullableString(hindsight.PtrString("career update")), + Timestamp: *hindsight.NewNullableTime(hindsight.PtrTime(timestamp)), + Tags: []string{"career"}, + }, + }, + } + retainResp, _, _ := client.MemoryAPI.RetainMemories(ctx, "my-bank").RetainRequest(retainReq2).Execute() + + // Checking if a value is set + if retainResp.HasOperationId() { + fmt.Println("OperationId:", retainResp.GetOperationId()) + } + // [/docs:nullable-fields] + + // [docs:error-handling] + _, httpResp2, err := client.MemoryAPI.RecallMemories(ctx, "my-bank"). + RecallRequest(recallReq). + Execute() + + if err != nil { + log.Fatalf("Recall failed: %v", err) + } + defer httpResp2.Body.Close() + // [/docs:error-handling] + + fmt.Println("quickstart.go: All examples passed") +} diff --git a/hindsight-docs/versioned_docs/version-0.4/cookbook/applications/go-memory-service.md b/hindsight-docs/versioned_docs/version-0.4/cookbook/applications/go-memory-service.md deleted file mode 100644 index b49a6297..00000000 --- a/hindsight-docs/versioned_docs/version-0.4/cookbook/applications/go-memory-service.md +++ /dev/null @@ -1,345 +0,0 @@ ---- -sidebar_position: 10 ---- - -# Go Memory-Augmented API - -:::info Complete Application -This is a complete, runnable Go application demonstrating Hindsight integration. -::: - -A Go HTTP microservice that combines a domain API with Hindsight memory. Each API user gets a personal memory bank. The service remembers past interactions and uses them to provide personalized responses. - -## Use Case - -A **developer knowledge assistant** that remembers what technologies each user works with, what problems they've solved, and provides personalized recommendations. - -## Features - -- Per-user memory banks (created on first interaction) -- Conversation history stored via retain -- Context-aware responses via recall + reflect -- Structured output for programmatic consumption -- Health check and bank stats endpoints - -## Project Structure - -``` -go-memory-service/ -├── main.go # HTTP server, routes, handlers -├── go.mod -└── go.sum -``` - -## The Code - -```go -package main - -import ( - "context" - "encoding/json" - "fmt" - "log" - "net/http" - "os" - "strings" - "time" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -var client *hindsight.Client - -func main() { - apiURL := envOr("HINDSIGHT_API_URL", "http://localhost:8888") - - var err error - client, err = hindsight.New(apiURL) - if err != nil { - log.Fatal(err) - } - - mux := http.NewServeMux() - mux.HandleFunc("POST /ask", handleAsk) - mux.HandleFunc("POST /learn", handleLearn) - mux.HandleFunc("GET /recall/{userID}", handleRecall) - mux.HandleFunc("GET /health", handleHealth) - - addr := envOr("ADDR", ":8080") - log.Printf("listening on %s (hindsight: %s)", addr, apiURL) - log.Fatal(http.ListenAndServe(addr, mux)) -} - -// --- Request/Response types --- - -type AskRequest struct { - UserID string `json:"user_id"` - Query string `json:"query"` -} - -type AskResponse struct { - Answer string `json:"answer"` - Facts []string `json:"facts,omitempty"` -} - -type LearnRequest struct { - UserID string `json:"user_id"` - Content string `json:"content"` - Tags []string `json:"tags,omitempty"` -} - -type RecallResponse struct { - Results []RecallFact `json:"results"` -} - -type RecallFact struct { - Text string `json:"text"` - Type string `json:"type"` -} - -// --- Handlers --- - -// handleLearn stores new information for a user. -func handleLearn(w http.ResponseWriter, r *http.Request) { - var req LearnRequest - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - http.Error(w, "invalid JSON", http.StatusBadRequest) - return - } - - ctx := r.Context() - bankID := bankFor(req.UserID) - - // Ensure bank exists - ensureBank(ctx, bankID, req.UserID) - - // Store the memory - var opts []hindsight.RetainOption - if len(req.Tags) > 0 { - opts = append(opts, hindsight.WithTags(req.Tags)) - } - - resp, err := client.Retain(ctx, bankID, req.Content, opts...) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - writeJSON(w, map[string]any{ - "success": resp.Success, - "bank_id": bankID, - }) -} - -// handleAsk answers a question using the user's memories. -func handleAsk(w http.ResponseWriter, r *http.Request) { - var req AskRequest - if err := json.NewDecoder(r.Body).Decode(&req); err != nil { - http.Error(w, "invalid JSON", http.StatusBadRequest) - return - } - - ctx := r.Context() - bankID := bankFor(req.UserID) - - // Ensure bank exists - ensureBank(ctx, bankID, req.UserID) - - // Recall relevant facts - recallResp, err := client.Recall(ctx, bankID, req.Query, - hindsight.WithBudget(hindsight.BudgetMid), - hindsight.WithMaxTokens(2048), - ) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - var facts []string - for _, result := range recallResp.Results { - facts = append(facts, result.Text) - } - - // Reflect to generate an answer - reflectResp, err := client.Reflect(ctx, bankID, req.Query, - hindsight.WithReflectBudget(hindsight.BudgetMid), - ) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - // Store this interaction as a new memory - interaction := fmt.Sprintf("User asked: %q\nAssistant answered: %s", req.Query, reflectResp.Text) - go func() { - bgCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - client.Retain(bgCtx, bankID, interaction, - hindsight.WithContext("Q&A interaction"), - ) - }() - - writeJSON(w, AskResponse{ - Answer: reflectResp.Text, - Facts: facts, - }) -} - -// handleRecall returns raw memories for a user. -func handleRecall(w http.ResponseWriter, r *http.Request) { - userID := r.PathValue("userID") - query := r.URL.Query().Get("q") - if query == "" { - query = "What do you know?" - } - - ctx := r.Context() - bankID := bankFor(userID) - - resp, err := client.Recall(ctx, bankID, query, - hindsight.WithBudget(hindsight.BudgetHigh), - ) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } - - var results []RecallFact - for _, result := range resp.Results { - results = append(results, RecallFact{ - Text: result.Text, - Type: result.Type.Or("unknown"), - }) - } - - writeJSON(w, RecallResponse{Results: results}) -} - -func handleHealth(w http.ResponseWriter, _ *http.Request) { - writeJSON(w, map[string]string{"status": "ok"}) -} - -// --- Helpers --- - -func bankFor(userID string) string { - return "user-" + strings.ToLower(userID) -} - -func ensureBank(ctx context.Context, bankID, userID string) { - client.CreateBank(ctx, bankID, - hindsight.WithBankName(fmt.Sprintf("Memory for %s", userID)), - hindsight.WithMission("Developer knowledge assistant. Remember technologies, problems solved, and preferences."), - ) -} - -func writeJSON(w http.ResponseWriter, v any) { - w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(v) -} - -func envOr(key, fallback string) string { - if v := os.Getenv(key); v != "" { - return v - } - return fallback -} -``` - -## Running - -### 1. Start Hindsight - -```bash -export OPENAI_API_KEY=your-key - -docker run --rm -it --pull always -p 8888:8888 -p 9999:9999 \ - -e HINDSIGHT_API_LLM_API_KEY=$OPENAI_API_KEY \ - -e HINDSIGHT_API_LLM_MODEL=o3-mini \ - -v $HOME/.hindsight-docker:/home/hindsight/.pg0 \ - ghcr.io/vectorize-io/hindsight:latest -``` - -### 2. Start the service - -```bash -go run main.go -``` - -### 3. Try it out - -```bash -# Teach it something -curl -s localhost:8080/learn -d '{ - "user_id": "alice", - "content": "I am building a Go microservice that uses gRPC and PostgreSQL", - "tags": ["project"] -}' | jq . - -# Teach it more -curl -s localhost:8080/learn -d '{ - "user_id": "alice", - "content": "I solved a connection pooling issue by switching from pgx to pgxpool", - "tags": ["debugging"] -}' - -curl -s localhost:8080/learn -d '{ - "user_id": "alice", - "content": "I prefer structured logging with slog over zerolog", - "tags": ["preferences"] -}' - -# Ask a question (uses recall + reflect) -curl -s localhost:8080/ask -d '{ - "user_id": "alice", - "query": "What tech stack am I using?" -}' | jq . - -# Raw recall -curl -s "localhost:8080/recall/alice?q=database" | jq . -``` - -## How It Works - -1. **`/learn`** - Stores information using `Retain`. Each piece of info becomes searchable facts, entities, and relationships. - -2. **`/ask`** - Two-phase retrieval: - - **Recall**: Finds relevant facts from the user's memory bank - - **Reflect**: Synthesizes a response using those facts plus disposition-aware reasoning - - The Q&A interaction itself is stored as a new memory (fire-and-forget goroutine) - -3. **`/recall/{userID}`** - Direct access to raw recalled facts for debugging or building custom UIs. - -## Key Patterns - -### Per-User Isolation - -Each user gets their own bank (`user-alice`, `user-bob`). Banks are created lazily on first interaction via `CreateBank` (idempotent - safe to call repeatedly). - -### Fire-and-Forget Memory - -The `/ask` handler stores the interaction in a background goroutine so the response isn't delayed by the retain call: - -```go -go func() { - bgCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() - client.Retain(bgCtx, bankID, interaction) -}() -``` - -### Tag-Based Scoping - -Tags partition memories within a bank. Query only `debugging` memories, or only `preferences`: - -```bash -# The /recall endpoint could be extended to support tag filtering: -curl "localhost:8080/recall/alice?q=issues&tags=debugging" -``` - -## Next Steps - -- [Go Quickstart](/cookbook/recipes/go-quickstart) - Core operations walkthrough -- [Go Concurrent Pipeline](/cookbook/recipes/go-concurrent-pipeline) - Bulk data ingestion -- [Per-User Memory](/cookbook/recipes/per-user-memory) - The pattern in depth -- [Go SDK Reference](/sdks/go) - Full API documentation diff --git a/hindsight-docs/versioned_docs/version-0.4/cookbook/index.mdx b/hindsight-docs/versioned_docs/version-0.4/cookbook/index.mdx index c3d20351..cb22bd4d 100644 --- a/hindsight-docs/versioned_docs/version-0.4/cookbook/index.mdx +++ b/hindsight-docs/versioned_docs/version-0.4/cookbook/index.mdx @@ -86,18 +86,6 @@ Learn how to build with Hindsight through practical examples: href: "/cookbook/recipes/study_buddy", description: "Track study sessions, identify knowledge gaps, and get personalized review suggestions", tags: { sdk: "hindsight-client", topic: "Learning" } - }, - { - title: "Go Quickstart", - href: "/cookbook/recipes/go-quickstart", - description: "Get started with the Go client: retain, recall, and reflect", - tags: { sdk: "hindsight-go", topic: "Quick Start" } - }, - { - title: "Go Concurrent Pipeline", - href: "/cookbook/recipes/go-concurrent-pipeline", - description: "Build a concurrent memory ingestion pipeline with goroutines", - tags: { sdk: "hindsight-go", topic: "Learning" } } ]} /> @@ -152,12 +140,6 @@ Learn how to build with Hindsight through practical examples: href: "/cookbook/applications/taste-ai", description: "Personal food assistant with AI SDK v6 showcasing recall, mental models, and directives", tags: { sdk: "@vectorize-io/hindsight-ai-sdk", topic: "Recommendation" } - }, - { - title: "Go Memory-Augmented API", - href: "/cookbook/applications/go-memory-service", - description: "Go HTTP microservice with per-user memory banks for a developer knowledge assistant", - tags: { sdk: "hindsight-go", topic: "Learning" } } ]} /> diff --git a/hindsight-docs/versioned_docs/version-0.4/cookbook/recipes/go-concurrent-pipeline.md b/hindsight-docs/versioned_docs/version-0.4/cookbook/recipes/go-concurrent-pipeline.md deleted file mode 100644 index 158627b7..00000000 --- a/hindsight-docs/versioned_docs/version-0.4/cookbook/recipes/go-concurrent-pipeline.md +++ /dev/null @@ -1,272 +0,0 @@ ---- -sidebar_position: 13 ---- - -# Go Concurrent Pipeline - -Build a concurrent memory ingestion pipeline in Go. This recipe demonstrates how to use Go's concurrency primitives with the Hindsight client to ingest large datasets efficiently, then query them with recall and reflect. - -## The Problem - -You have a large dataset (log files, chat transcripts, documents) that needs to be ingested into Hindsight. Sequential ingestion is slow. Go's goroutines make it straightforward to parallelize. - -## Architecture - -``` - ┌──────────┐ - │ Source │ - │ (files, │ - │ API, DB) │ - └────┬─────┘ - │ - ┌────▼─────┐ - │ Producer │ reads data, sends to channel - └────┬─────┘ - │ - ┌──────────┼──────────┐ - │ │ │ - ┌────▼───┐ ┌───▼────┐ ┌──▼─────┐ - │Worker 1│ │Worker 2│ │Worker N│ concurrent RetainBatch - └────┬───┘ └───┬────┘ └──┬─────┘ - │ │ │ - └─────────┼─────────┘ - │ - ┌─────▼─────┐ - │ Hindsight │ - │ API │ - └───────────┘ -``` - -## Prerequisites - -Hindsight server running (see [Go Quickstart](/cookbook/recipes/go-quickstart) for setup). - -## The Pipeline - -```go -package main - -import ( - "bufio" - "context" - "fmt" - "log" - "os" - "sync" - "sync/atomic" - "time" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -const ( - batchSize = 10 // memories per batch - numWorkers = 4 // concurrent workers -) - -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - bankID := "pipeline-demo" - - // Create the bank - client.CreateBank(ctx, bankID, - hindsight.WithBankName("Pipeline Demo"), - hindsight.WithMission("Knowledge base ingested from documents"), - ) - - // Ingest from a file (one line = one memory) - if len(os.Args) < 2 { - fmt.Println("usage: pipeline ") - os.Exit(1) - } - - start := time.Now() - count := ingest(ctx, client, bankID, os.Args[1]) - elapsed := time.Since(start) - - fmt.Printf("\nIngested %d memories in %s (%.1f/sec)\n", - count, elapsed, float64(count)/elapsed.Seconds()) - - // Query the ingested data - fmt.Println("\n--- Recall ---") - resp, _ := client.Recall(ctx, bankID, "What are the key topics?", - hindsight.WithBudget(hindsight.BudgetHigh), - ) - for _, r := range resp.Results { - fmt.Printf(" - %s\n", r.Text) - } - - fmt.Println("\n--- Reflect ---") - answer, _ := client.Reflect(ctx, bankID, "Summarize everything you know") - fmt.Println(answer.Text) -} - -func ingest(ctx context.Context, client *hindsight.Client, bankID, filename string) int64 { - f, err := os.Open(filename) - if err != nil { - log.Fatal(err) - } - defer f.Close() - - // Channel for batches - batches := make(chan []hindsight.MemoryItem, numWorkers*2) - var ingested atomic.Int64 - - // Start workers - var wg sync.WaitGroup - for i := range numWorkers { - wg.Add(1) - go func(id int) { - defer wg.Done() - for batch := range batches { - _, err := client.RetainBatch(ctx, bankID, batch) - if err != nil { - log.Printf("worker %d: batch failed: %v", id, err) - continue - } - n := ingested.Add(int64(len(batch))) - if n%100 == 0 { - fmt.Printf(" ingested %d memories...\n", n) - } - } - }(i) - } - - // Producer: read lines and batch them - scanner := bufio.NewScanner(f) - var batch []hindsight.MemoryItem - - for scanner.Scan() { - line := scanner.Text() - if line == "" { - continue - } - batch = append(batch, hindsight.MemoryItem{Content: line}) - - if len(batch) >= batchSize { - batches <- batch - batch = nil - } - } - - // Flush remaining - if len(batch) > 0 { - batches <- batch - } - - close(batches) - wg.Wait() - - return ingested.Load() -} -``` - -## Running It - -Create a sample data file: - -```bash -cat > sample_data.txt << 'EOF' -The Go programming language was created at Google in 2007 -Go's concurrency model is based on CSP (Communicating Sequential Processes) -Goroutines are lightweight threads managed by the Go runtime -Channels provide typed conduits for communication between goroutines -The sync package provides mutexes, wait groups, and other synchronization primitives -Go modules were introduced in Go 1.11 for dependency management -The context package provides cancellation and deadline propagation -Go compiles to a single static binary with no external dependencies -The standard library includes an HTTP server, JSON parser, and crypto packages -Go 1.18 introduced generics with type parameters -EOF -``` - -```bash -go run . sample_data.txt -``` - -## Adding Tags for Partitioning - -For larger datasets, use tags to partition memories by source or topic: - -```go -func ingestWithTags(ctx context.Context, client *hindsight.Client, bankID, source string, lines []string) { - var items []hindsight.MemoryItem - for _, line := range lines { - items = append(items, hindsight.MemoryItem{ - Content: line, - Tags: []string{source}, - }) - } - - _, err := client.RetainBatch(ctx, bankID, items, - hindsight.WithDocumentTags([]string{"bulk-import", source}), - ) - if err != nil { - log.Printf("ingest %s failed: %v", source, err) - } -} - -// Later, recall only from a specific source -resp, _ := client.Recall(ctx, bankID, "What are the key concepts?", - hindsight.WithRecallTags([]string{"go-docs"}), - hindsight.WithRecallTagsMatch(hindsight.TagsMatchAnyStrict), -) -``` - -## Async Ingestion - -For very large datasets, use async mode to avoid waiting for fact extraction: - -```go -// Async retain returns immediately; processing happens in background -_, err := client.RetainBatch(ctx, bankID, items, - hindsight.WithAsync(true), -) - -// Check operation status via the ogen client -ogen := client.OgenClient() -ops, _ := ogen.ListOperations(ctx, ogenapi.ListOperationsParams{ - BankID: bankID, -}) -``` - -## Graceful Shutdown - -Use `context.WithCancel` for clean cancellation: - -```go -ctx, cancel := context.WithCancel(context.Background()) -defer cancel() - -// In a signal handler: -sigCh := make(chan os.Signal, 1) -signal.Notify(sigCh, os.Interrupt) -go func() { - <-sigCh - fmt.Println("\nShutting down gracefully...") - cancel() -}() - -// Workers will stop when ctx is cancelled -``` - -## Performance Tips - -| Tip | Why | -|-----|-----| -| Use `RetainBatch` over individual `Retain` | Fewer HTTP round trips | -| Set `batchSize` to 10-50 | Balances throughput vs. memory | -| Use 4-8 workers | Matches typical API concurrency limits | -| Use `WithAsync(true)` for bulk imports | Returns immediately, processes in background | -| Tag your data | Enables scoped recall without reingesting | - -## Next Steps - -- [Go Quickstart](/cookbook/recipes/go-quickstart) - Basic retain, recall, reflect -- [Per-User Memory](/cookbook/recipes/per-user-memory) - One bank per user pattern -- [Go SDK Reference](/sdks/go) - Full API reference diff --git a/hindsight-docs/versioned_docs/version-0.4/cookbook/recipes/go-quickstart.md b/hindsight-docs/versioned_docs/version-0.4/cookbook/recipes/go-quickstart.md deleted file mode 100644 index acc21e2e..00000000 --- a/hindsight-docs/versioned_docs/version-0.4/cookbook/recipes/go-quickstart.md +++ /dev/null @@ -1,216 +0,0 @@ ---- -sidebar_position: 12 ---- - -# Go Quickstart - -Get started with the Hindsight Go client in under 5 minutes. This recipe covers the three core operations: **retain**, **recall**, and **reflect**. - -## Prerequisites - -Make sure you have Hindsight running. The easiest way is via Docker: - -```bash -export OPENAI_API_KEY=your-key - -docker run --rm -it --pull always -p 8888:8888 -p 9999:9999 \ - -e HINDSIGHT_API_LLM_API_KEY=$OPENAI_API_KEY \ - -e HINDSIGHT_API_LLM_MODEL=o3-mini \ - -v $HOME/.hindsight-docker:/home/hindsight/.pg0 \ - ghcr.io/vectorize-io/hindsight:latest -``` - -- API: http://localhost:8888 -- UI: http://localhost:9999 - -## Installation - -```bash -go get github.com/vectorize-io/hindsight-client-go -``` - -## Connect to Hindsight - -```go -package main - -import ( - "context" - "fmt" - "log" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - bankID := "go-quickstart" -``` - -## Retain: Store Information - -The `Retain` operation pushes new memories into Hindsight. Behind the scenes, an LLM extracts key facts, temporal data, entities, and relationships. - -```go - // Simple retain - _, err = client.Retain(ctx, bankID, - "Alice works at Google as a software engineer", - ) - if err != nil { - log.Fatal(err) - } - fmt.Println("Stored memory about Alice's job") - - // Retain with context and timestamp - _, err = client.Retain(ctx, bankID, - "Alice got promoted to senior engineer", - hindsight.WithContext("career update"), - hindsight.WithTimestamp(time.Date(2025, 6, 15, 10, 0, 0, 0, time.UTC)), - ) - if err != nil { - log.Fatal(err) - } - fmt.Println("Stored memory about Alice's promotion") -``` - -## Retain Batch: Store Multiple Memories - -```go - items := []hindsight.MemoryItem{ - {Content: "Bob is a data scientist who works with Alice"}, - {Content: "Charlie manages the team and reports to the VP of Engineering"}, - {Content: "The team is working on a recommendation engine using Go"}, - } - - resp, err := client.RetainBatch(ctx, bankID, items) - if err != nil { - log.Fatal(err) - } - fmt.Printf("Stored %d memories\n", resp.ItemsCount) -``` - -## Recall: Retrieve Memories - -`Recall` retrieves memories matching a query using four parallel strategies: semantic similarity, keyword matching, entity/relationship graph traversal, and temporal filtering. - -```go - // Simple recall - results, err := client.Recall(ctx, bankID, "What does Alice do?") - if err != nil { - log.Fatal(err) - } - - fmt.Println("\nMemories about Alice:") - for _, r := range results.Results { - fmt.Printf(" - %s\n", r.Text) - } -``` - -```go - // Recall with options - results, err = client.Recall(ctx, bankID, "Who works on the team?", - hindsight.WithBudget(hindsight.BudgetHigh), - hindsight.WithMaxTokens(2048), - hindsight.WithTypes([]string{"world"}), - ) - if err != nil { - log.Fatal(err) - } - - fmt.Println("\nTeam memories (world facts only):") - for _, r := range results.Results { - fmt.Printf(" - [%s] %s\n", r.Type.Or("?"), r.Text) - } -``` - -## Reflect: Generate Insights - -`Reflect` performs disposition-aware reasoning over stored memories. It retrieves relevant context, then uses an LLM to synthesize a response. Great for summarization, analysis, and Q&A. - -```go - answer, err := client.Reflect(ctx, bankID, - "What should I know about this team?", - ) - if err != nil { - log.Fatal(err) - } - - fmt.Println("\nReflection:") - fmt.Println(answer.Text) -``` - -## Full Program - -Here's the complete program: - -```go -package main - -import ( - "context" - "fmt" - "log" - "time" - - hindsight "github.com/vectorize-io/hindsight-client-go" -) - -func main() { - client, err := hindsight.New("http://localhost:8888") - if err != nil { - log.Fatal(err) - } - - ctx := context.Background() - bankID := "go-quickstart" - - // 1. Store memories - client.Retain(ctx, bankID, "Alice works at Google as a software engineer") - client.Retain(ctx, bankID, "Alice got promoted to senior engineer", - hindsight.WithContext("career update"), - hindsight.WithTimestamp(time.Date(2025, 6, 15, 10, 0, 0, 0, time.UTC)), - ) - - items := []hindsight.MemoryItem{ - {Content: "Bob is a data scientist who works with Alice"}, - {Content: "Charlie manages the team and reports to the VP of Engineering"}, - {Content: "The team is working on a recommendation engine using Go"}, - } - client.RetainBatch(ctx, bankID, items) - - // 2. Recall memories - results, _ := client.Recall(ctx, bankID, "What does Alice do?") - fmt.Println("Memories about Alice:") - for _, r := range results.Results { - fmt.Printf(" - %s\n", r.Text) - } - - // 3. Reflect - answer, _ := client.Reflect(ctx, bankID, "What should I know about this team?") - fmt.Printf("\nReflection:\n%s\n", answer.Text) - - // 4. Cleanup - client.DeleteBank(ctx, bankID) -} -``` - -## Memory Types - -Hindsight organizes memory into distinct networks: - -| Type | Description | Example | -|------|-------------|---------| -| **World** | Facts about the world | "Alice works at Google" | -| **Experience** | Agent's own experiences | "I helped Alice debug her code" | -| **Observation** | Complex models from reflection | "Alice is a senior IC focused on ML" | - -## Next Steps - -- [Go Concurrent Pipeline](/cookbook/recipes/go-concurrent-pipeline) - Build a concurrent ingestion pipeline -- [Per-User Memory](/cookbook/recipes/per-user-memory) - One bank per user pattern -- [Go SDK Reference](/sdks/go) - Full API reference diff --git a/scripts/generate-clients.sh b/scripts/generate-clients.sh index 7fa4bf27..8c23d4f5 100755 --- a/scripts/generate-clients.sh +++ b/scripts/generate-clients.sh @@ -344,11 +344,63 @@ GO_CLIENT_DIR="$CLIENTS_DIR/go" if ! command -v go &> /dev/null; then echo "⚠ Go not found, skipping Go client generation" echo " Install Go 1.25+ from https://go.dev/dl/" +elif ! command -v java &> /dev/null; then + echo "⚠ Java not found, skipping Go client generation" + echo " Install Java 11+ from https://adoptium.net/" else - echo "Regenerating Go client (via ogen)..." + echo "Regenerating Go client (via OpenAPI Generator)..." cd "$GO_CLIENT_DIR" - go generate ./... + + # Download OpenAPI Generator if not present + OPENAPI_GEN_VERSION="7.10.0" + OPENAPI_GEN_JAR="openapi-generator-cli.jar" + if [ ! -f "$OPENAPI_GEN_JAR" ]; then + echo "Downloading OpenAPI Generator ${OPENAPI_GEN_VERSION}..." + curl -L "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/${OPENAPI_GEN_VERSION}/openapi-generator-cli-${OPENAPI_GEN_VERSION}.jar" -o "$OPENAPI_GEN_JAR" + fi + + # Save maintained files to temp + TEMP_DIR=$(mktemp -d) + echo "Preserving maintained files..." + [ -f "README.md" ] && cp README.md "$TEMP_DIR/" + [ -f "integration_test.go" ] && cp integration_test.go "$TEMP_DIR/" + [ -f "null_test.go" ] && cp null_test.go "$TEMP_DIR/" + [ -f "trace_test.go" ] && cp trace_test.go "$TEMP_DIR/" + + # Remove old generated files + echo "Removing old generated code..." + rm -f api_*.go model_*.go client.go configuration.go response.go utils.go + rm -rf docs/ .openapi-generator/ + rm -f go.mod go.sum + + # Generate new client + echo "Generating client from OpenAPI spec..." + java -jar "$OPENAPI_GEN_JAR" generate \ + -i "$OPENAPI_SPEC" \ + -g go \ + -o . \ + --package-name hindsight \ + --git-user-id vectorize-io \ + --git-repo-id hindsight-client-go \ + --global-property apiDocs=false,apiTests=false,modelDocs=false,modelTests=false + + # Remove OpenAPI Generator boilerplate files + echo "Removing boilerplate files..." + rm -rf docs/ git_push.sh .travis.yml .gitlab-ci.yml .openapi-generator-ignore .openapi-generator/ + + # Restore maintained files from temp + echo "Restoring maintained files..." + [ -f "$TEMP_DIR/README.md" ] && mv "$TEMP_DIR/README.md" . + [ -f "$TEMP_DIR/integration_test.go" ] && mv "$TEMP_DIR/integration_test.go" . + [ -f "$TEMP_DIR/null_test.go" ] && mv "$TEMP_DIR/null_test.go" . + [ -f "$TEMP_DIR/trace_test.go" ] && mv "$TEMP_DIR/trace_test.go" . + rm -rf "$TEMP_DIR" + + # Initialize module and build + echo "Building Go client..." + go mod tidy go build ./... + echo "✓ Go client generated at $GO_CLIENT_DIR" fi echo "" diff --git a/scripts/test-doc-examples.sh b/scripts/test-doc-examples.sh index 89044122..6c767f85 100755 --- a/scripts/test-doc-examples.sh +++ b/scripts/test-doc-examples.sh @@ -18,8 +18,27 @@ TOTAL_PASSED=0 TOTAL_FAILED=0 FAILED_EXAMPLES=() +# Parse language filter from command line +LANGUAGE_FILTER="" +while [[ $# -gt 0 ]]; do + case $1 in + --lang) + LANGUAGE_FILTER="$2" + shift 2 + ;; + *) + echo "Unknown option: $1" + echo "Usage: $0 [--lang ]" + exit 1 + ;; + esac +done + echo "======================================" echo "Running Documentation Examples" +if [ -n "$LANGUAGE_FILTER" ]; then + echo "Language filter: $LANGUAGE_FILTER" +fi echo "======================================" echo "" @@ -51,37 +70,56 @@ run_example() { } # Run Python examples -echo "======================================" -echo "Python Examples" -echo "======================================" -cd "$PROJECT_ROOT/hindsight-clients/python" -for f in "$EXAMPLES_DIR"/*.py; do - [ -e "$f" ] || continue # Skip if no files match - run_example "$f" "uv run python" "$PROJECT_ROOT/hindsight-clients/python" -done -echo "" +if [ -z "$LANGUAGE_FILTER" ] || [ "$LANGUAGE_FILTER" = "python" ]; then + echo "======================================" + echo "Python Examples" + echo "======================================" + cd "$PROJECT_ROOT/hindsight-clients/python" + for f in "$EXAMPLES_DIR"/*.py; do + [ -e "$f" ] || continue # Skip if no files match + run_example "$f" "uv run python" "$PROJECT_ROOT/hindsight-clients/python" + done + echo "" +fi # Run Node.js examples -echo "======================================" -echo "Node.js Examples" -echo "======================================" -cd "$PROJECT_ROOT" -for f in "$EXAMPLES_DIR"/*.mjs; do - [ -e "$f" ] || continue # Skip if no files match - run_example "$f" "node" "$PROJECT_ROOT" -done -echo "" +if [ -z "$LANGUAGE_FILTER" ] || [ "$LANGUAGE_FILTER" = "node" ]; then + echo "======================================" + echo "Node.js Examples" + echo "======================================" + cd "$PROJECT_ROOT" + for f in "$EXAMPLES_DIR"/*.mjs; do + [ -e "$f" ] || continue # Skip if no files match + run_example "$f" "node" "$PROJECT_ROOT" + done + echo "" +fi # Run CLI examples -echo "======================================" -echo "CLI Examples" -echo "======================================" -cd "$PROJECT_ROOT" -for f in "$EXAMPLES_DIR"/*.sh; do - [ -e "$f" ] || continue # Skip if no files match - run_example "$f" "bash" "$PROJECT_ROOT" -done -echo "" +if [ -z "$LANGUAGE_FILTER" ] || [ "$LANGUAGE_FILTER" = "cli" ]; then + echo "======================================" + echo "CLI Examples" + echo "======================================" + cd "$PROJECT_ROOT" + for f in "$EXAMPLES_DIR"/*.sh; do + [ -e "$f" ] || continue # Skip if no files match + run_example "$f" "bash" "$PROJECT_ROOT" + done + echo "" +fi + +# Run Go examples +if [ -z "$LANGUAGE_FILTER" ] || [ "$LANGUAGE_FILTER" = "go" ]; then + echo "======================================" + echo "Go Examples" + echo "======================================" + cd "$PROJECT_ROOT/hindsight-clients/go" + for f in "$EXAMPLES_DIR"/*.go; do + [ -e "$f" ] || continue # Skip if no files match + run_example "$f" "go run" "$PROJECT_ROOT/hindsight-clients/go" + done + echo "" +fi # Print summary echo "======================================"