Skip to content

[Feature]: Go Client Example for PowerMem HTTP API Server #179

@Teingi

Description

@Teingi

Describe your use case

Go developers need a simple, lightweight client example to integrate PowerMem's intelligent memory capabilities into their Go applications. This example will demonstrate how to interact with the PowerMem HTTP API Server using Go's standard library or popular HTTP clients, enabling Go applications to leverage PowerMem's memory management features.

Describe the solution you'd like

Create a simple Go client example that demonstrates:

  1. Basic HTTP client setup:

    • Configuration for API base URL and API key
    • HTTP client initialization with proper timeout settings
    • Request/response handling
  2. Core memory operations:

    • Create memory (POST /api/v1/memories)
    • Search memories (POST /api/v1/memories/search)
    • List memories (GET /api/v1/memories)
    • Update memory (PUT /api/v1/memories/{memory_id})
    • Delete memory (DELETE /api/v1/memories/{memory_id})
  3. Project structure:

    • Simple Go module (go.mod)
    • Main package with example usage
    • Helper functions for API calls
    • Error handling examples
    • Configuration via environment variables or config file
  4. Deliverables:

    • examples/go/ directory with:
      • main.go - Main example demonstrating all operations
      • client.go - PowerMem client wrapper
      • models.go - Request/response structs
      • README.md - Usage instructions and examples
      • go.mod - Go module file
    • Basic error handling
    • Example output showing successful operations

The solution should:

  • Use Go standard library or minimal dependencies (e.g., only net/http and encoding/json)
  • Follow Go best practices and conventions
  • Include clear comments and documentation
  • Handle 64-bit integer IDs properly (memory_id as string to avoid precision loss)
  • Support both JSON request/response handling
  • Include example usage in README

Describe alternatives you've considered

  • Using a full-featured HTTP client library - but we want to keep it simple and demonstrate core concepts
  • Creating a complete SDK - but that's too complex for a 2-hour coding session

Additional context

  • The PowerMem HTTP API Server is already available and documented at docs/api/0005-api_server.md
  • Base URL: http://localhost:8000/api/v1
  • API Key authentication via X-API-Key header
  • All endpoints return JSON responses
  • Memory IDs are 64-bit integers that should be handled as strings in JSON to avoid precision loss

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions