From 4f77442eff59061ac5ab9f710fdb6fe998fedb5f Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Sun, 24 Sep 2023 01:23:50 +0200 Subject: Add identity resource --- external/evcli/client.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'external/evcli/client.go') diff --git a/external/evcli/client.go b/external/evcli/client.go index 769c19c..3720115 100644 --- a/external/evcli/client.go +++ b/external/evcli/client.go @@ -181,6 +181,12 @@ func (c *Client) UpdateProject(project *eventline.Project) error { return c.SendRequest("PUT", uri, project, nil) } +func (c *Client) CreateIdentity(identity *Identity) error { + uri := NewURL("identities") + + return c.SendRequest("POST", uri, identity, identity) +} + func (c *Client) FetchIdentities() (Identities, error) { var identities Identities @@ -209,6 +215,31 @@ func (c *Client) FetchIdentities() (Identities, error) { return identities, nil } +func (c *Client) FetchIdentityById(id eventline.Id) (*Identity, error) { + uri := NewURL("identities", "id", id.String()) + + var identity Identity + + err := c.SendRequest("GET", uri, nil, &identity) + if err != nil { + return nil, err + } + + return &identity, nil +} + +func (c *Client) UpdateIdentity(identity *Identity) error { + uri := NewURL("identities", "id", identity.Id.String()) + + return c.SendRequest("PUT", uri, identity, identity) +} + +func (c *Client) DeleteIdentity(id eventline.Id) error { + uri := NewURL("identities", "id", id.String()) + + return c.SendRequest("DELETE", uri, nil, nil) +} + func (c *Client) ReplayEvent(id string) (*eventline.Event, error) { var event eventline.Event -- cgit v1.2.3