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:
-
Basic HTTP client setup:
- Configuration for API base URL and API key
- HTTP client initialization with proper timeout settings
- Request/response handling
-
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})
-
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
-
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
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:
Basic HTTP client setup:
Core memory operations:
POST /api/v1/memories)POST /api/v1/memories/search)GET /api/v1/memories)PUT /api/v1/memories/{memory_id})DELETE /api/v1/memories/{memory_id})Project structure:
go.mod)Deliverables:
examples/go/directory with:main.go- Main example demonstrating all operationsclient.go- PowerMem client wrappermodels.go- Request/response structsREADME.md- Usage instructions and examplesgo.mod- Go module fileThe solution should:
net/httpandencoding/json)Describe alternatives you've considered
Additional context
docs/api/0005-api_server.mdhttp://localhost:8000/api/v1X-API-Keyheader