feat(sdk/go): add Relations API (Relations/Link/Unlink) to client#2780
Closed
r266-tech wants to merge 1 commit into
Closed
feat(sdk/go): add Relations API (Relations/Link/Unlink) to client#2780r266-tech wants to merge 1 commit into
r266-tech wants to merge 1 commit into
Conversation
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.
Collaborator
|
Thanks, but it's unnecessary to support this function. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Go SDK exposes
Find/Search/Grep/Globbut had no relations methods, even though the/api/v1/relationsserver 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:Relations(ctx, uri)GET /api/v1/relations?uri=Link(ctx, fromURI, toURIs []string, reason)POST /api/v1/relations/linkUnlink(ctx, fromURI, toURI)DELETE /api/v1/relations/linkIt mirrors the Python client + server
LinkRequest/UnlinkRequestexactly: snake_case JSON keys (from_uri/to_uris/to_uri/reason),viking://URI normalization on every URI, theDELETE-with-JSON-body shape, and the standard response envelope via the existingdoJSONtransport. The server acceptsto_urisasUnion[str, List[str]]; the Go client always sends a list (idiomatic + always valid), so a single link isLink(ctx, from, []string{to}, reason).Strictly additive — no change to existing methods or transport.
client_test.gocovers method/path/body for all three calls (includingDELETE-with-body through the SDK transport). Continues the recent Go-SDK parity work (#2703 date/level filters, #2758 agent selectors).