diff --git a/kvstore.go b/kvstore.go index 0d15522..7f8eaf2 100644 --- a/kvstore.go +++ b/kvstore.go @@ -62,3 +62,23 @@ func (kv KV) Keys(namespace string) (KVAPI, error) { } return r, nil } + +// Get returns an entry +func (kv KV) Get(namespace string, key string) (KVAPI, error) { + m := KVAPI{ + Params: &kvParams{}, + } + m.Params.Options = kvOptions{ + Team: kv.Team, + Namespace: namespace, + EntryKey: key, + } + + m.Method = "get" + + r, err := kvAPIOut(kv.keybase, m) + if err != nil { + return r, err + } + return r, nil +} diff --git a/types.go b/types.go index af01c2a..c65aa99 100644 --- a/types.go +++ b/types.go @@ -676,6 +676,9 @@ type kvResult struct { TeamName string `json:"teamName"` Namespaces []string `json:"namespaces"` EntryKeys []entryKey `json:"entryKeys"` + EntryKey string `json:"entryKey"` + EntryValue string `json:"entryValue"` + Revision int `json:"revision"` } // UserAPI holds information received from the user/lookup api @@ -889,6 +892,7 @@ type KV struct { type kvInterface interface { Namespaces() (KVAPI, error) Keys(namespace string) (KVAPI, error) + Get(namespace string, key string) (KVAPI, error) } type keybase interface {