Skip to content

feat(sdk/go): add Relations API (Relations/Link/Unlink) to client#2780

Closed
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:feat/sdk-go-relations-api
Closed

feat(sdk/go): add Relations API (Relations/Link/Unlink) to client#2780
r266-tech wants to merge 1 commit into
volcengine:mainfrom
r266-tech:feat/sdk-go-relations-api

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

The Go SDK exposes Find/Search/Grep/Glob but had no relations methods, even though the /api/v1/relations server router — and both Python clients (and the Rust CLI) — support querying and editing resource / memory-graph relations. A Go user wiring memory graphs had to hand-roll raw HTTP for a core OpenViking primitive.

This adds the complete, previously-unported endpoint group to sdk/go:

Method Server endpoint
Relations(ctx, uri) GET /api/v1/relations?uri=
Link(ctx, fromURI, toURIs []string, reason) POST /api/v1/relations/link
Unlink(ctx, fromURI, toURI) DELETE /api/v1/relations/link

It mirrors the Python client + server LinkRequest/UnlinkRequest exactly: snake_case JSON keys (from_uri / to_uris / to_uri / reason), viking:// URI normalization on every URI, the DELETE-with-JSON-body shape, and the standard response envelope via the existing doJSON transport. The server accepts to_uris as Union[str, List[str]]; the Go client always sends a list (idiomatic + always valid), so a single link is Link(ctx, from, []string{to}, reason).

Strictly additive — no change to existing methods or transport. client_test.go covers method/path/body for all three calls (including DELETE-with-body through the SDK transport). Continues the recent Go-SDK parity work (#2703 date/level filters, #2758 agent selectors).

The Go SDK exposed Find/Search/Grep/Glob but had no relations methods, even
though the /api/v1/relations server router (and both Python clients) support
querying and editing resource/memory-graph relations. Go users had to hand-roll
raw HTTP for a core graph primitive.

Add Relations(uri), Link(fromURI, toURIs, reason) and Unlink(fromURI, toURI),
mirroring the Python client and the server contract: GET /api/v1/relations,
POST /api/v1/relations/link, DELETE /api/v1/relations/link (with body), exact
snake_case JSON keys (from_uri/to_uris/to_uri/reason), URI normalization, and
the standard response envelope via the existing transport. Adds a client_test
covering method/path/body for all three calls.
@qin-ctx

qin-ctx commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Thanks, but it's unnecessary to support this function.

@qin-ctx qin-ctx closed this Jun 23, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants