From b390491b0f7a84d86ec607c5018702bcce103e60 Mon Sep 17 00:00:00 2001 From: Virgil Date: Wed, 1 Apr 2026 21:37:50 +0000 Subject: [PATCH] refactor(agentic): align api key naming Co-Authored-By: Virgil --- pkg/agentic/auth.go | 14 +++++++------- pkg/agentic/auth_example_test.go | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/agentic/auth.go b/pkg/agentic/auth.go index b301904..52adbf5 100644 --- a/pkg/agentic/auth.go +++ b/pkg/agentic/auth.go @@ -8,8 +8,8 @@ import ( core "dappco.re/go/core" ) -// key := agentic.AgentAPIKey{ID: 7, Name: "codex local", Prefix: "ak_abcd", RateLimit: 60} -type AgentAPIKey struct { +// key := agentic.AgentApiKey{ID: 7, Name: "codex local", Prefix: "ak_abcd", RateLimit: 60} +type AgentApiKey struct { ID int `json:"id"` WorkspaceID int `json:"workspace_id,omitempty"` Name string `json:"name,omitempty"` @@ -33,10 +33,10 @@ type AuthProvisionInput struct { ExpiresAt string `json:"expires_at,omitempty"` } -// out := agentic.AuthProvisionOutput{Success: true, Key: agentic.AgentAPIKey{Prefix: "ak_abcd"}} +// out := agentic.AuthProvisionOutput{Success: true, Key: agentic.AgentApiKey{Prefix: "ak_abcd"}} type AuthProvisionOutput struct { Success bool `json:"success"` - Key AgentAPIKey `json:"key"` + Key AgentApiKey `json:"key"` } // input := agentic.AuthRevokeInput{KeyID: "7"} @@ -92,7 +92,7 @@ func (s *PrepSubsystem) handleAuthProvision(ctx context.Context, options core.Op return core.Result{Value: AuthProvisionOutput{ Success: true, - Key: parseAgentAPIKey(payloadResourceMap(result.Value.(map[string]any), "key", "api_key", "agent_api_key")), + Key: parseAgentApiKey(payloadResourceMap(result.Value.(map[string]any), "key", "api_key", "agent_api_key")), }, OK: true} } @@ -143,8 +143,8 @@ func (s *PrepSubsystem) handleAuthRevoke(ctx context.Context, options core.Optio return core.Result{Value: output, OK: true} } -func parseAgentAPIKey(values map[string]any) AgentAPIKey { - return AgentAPIKey{ +func parseAgentApiKey(values map[string]any) AgentApiKey { + return AgentApiKey{ ID: intValue(values["id"]), WorkspaceID: intValue(values["workspace_id"]), Name: stringValue(values["name"]), diff --git a/pkg/agentic/auth_example_test.go b/pkg/agentic/auth_example_test.go index 36e3895..75a43c0 100644 --- a/pkg/agentic/auth_example_test.go +++ b/pkg/agentic/auth_example_test.go @@ -4,8 +4,8 @@ package agentic import "fmt" -func Example_parseAgentAPIKey() { - key := parseAgentAPIKey(map[string]any{ +func Example_parseAgentApiKey() { + key := parseAgentApiKey(map[string]any{ "id": 7, "name": "codex local", "prefix": "ak_live",