From 6642a66a1df5db5f2f9780905e83ba2c412128f6 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 31 Jul 2023 00:31:43 +0200 Subject: Implemented identities datasource --- external/evcli/client.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'external/evcli/client.go') diff --git a/external/evcli/client.go b/external/evcli/client.go index b9d5032..ce3d4a0 100644 --- a/external/evcli/client.go +++ b/external/evcli/client.go @@ -181,6 +181,34 @@ func (c *Client) UpdateProject(project *eventline.Project) error { return c.SendRequest("PUT", uri, project, nil) } +func (c *Client) FetchIdentities() (Identities, error) { + var identities Identities + + cursor := eventline.Cursor{Size: 20} + + for { + var page IdentityPage + + uri := NewURL("identities") + uri.RawQuery = cursor.Query().Encode() + + err := c.SendRequest("GET", uri, nil, &page) + if err != nil { + return nil, err + } + + identities = append(identities, page.Elements...) + + if page.Next == nil { + break + } + + cursor = *page.Next + } + + return identities, nil +} + func (c *Client) ReplayEvent(id string) (*eventline.Event, error) { var event eventline.Event -- cgit v1.2.3