diff --git a/acl_test.go b/acl_test.go index f949c75..bc3ac39 100644 --- a/acl_test.go +++ b/acl_test.go @@ -17,3 +17,13 @@ func TestRolesList(t *testing.T) { fmt.Printf("%#v\n", role) } } + +func TestPoliciesList(t *testing.T) { + policies, err := initClient(t).Policies.List(context.Background()) + require.NoError(t, err) + require.NotEmpty(t, policies) + + for _, policy := range policies { + fmt.Printf("%#v\n", policy) + } +} diff --git a/client.go b/client.go index 9abf700..415c969 100644 --- a/client.go +++ b/client.go @@ -14,21 +14,21 @@ import ( type Client struct { Collections *ResourceClient[Collection, string] CustomTranslations *ResourceClient[CustomTranslation, string] + Dashboards *ResourceClient[Dashboard, string] + Files *ResourceClient[File, string] + Flows *ResourceClient[Flow, string] Folders *ResourceClient[Folder, string] - Roles *ResourceClient[Role, string] - Users *ResourceClient[User, string] - Presets *ResourceClient[Preset, int64] Operations *ResourceClient[Operation, string] - Flows *ResourceClient[Flow, string] - Files *ResourceClient[File, string] - Permissions *ResourceClient[Permission, int64] - Dashboards *ResourceClient[Dashboard, string] Panels *ResourceClient[Panel, string] + Permissions *ResourceClient[Permission, int64] Policies *ResourceClient[Policy, string] - Relations *clientRelations + Presets *ResourceClient[Preset, int64] + Roles *ResourceClient[Role, string] + Users *ResourceClient[User, string] Fields *clientFields - Settings *clientSettings + Relations *clientRelations Server *clientServer + Settings *clientSettings instance, token string logger *slog.Logger @@ -65,20 +65,21 @@ func NewClient(instance string, token string, opts ...ClientOption) *Client { client.Collections = NewResourceClient[Collection, string](client, "collections") client.CustomTranslations = NewResourceClient[CustomTranslation, string](client, "translations") + client.Dashboards = NewResourceClient[Dashboard, string](client, "dashboards") + client.Files = NewResourceClient[File, string](client, "files") + client.Flows = NewResourceClient[Flow, string](client, "flows") client.Folders = NewResourceClient[Folder, string](client, "folders") - client.Roles = NewResourceClient[Role, string](client, "roles") - client.Users = NewResourceClient[User, string](client, "users") - client.Presets = NewResourceClient[Preset, int64](client, "presets") client.Operations = NewResourceClient[Operation, string](client, "operations") - client.Flows = NewResourceClient[Flow, string](client, "flows") - client.Files = NewResourceClient[File, string](client, "files") - client.Permissions = NewResourceClient[Permission, int64](client, "permissions") - client.Dashboards = NewResourceClient[Dashboard, string](client, "dashboards") client.Panels = NewResourceClient[Panel, string](client, "panels") + client.Permissions = NewResourceClient[Permission, int64](client, "permissions") + client.Policies = NewResourceClient[Policy, string](client, "policies") + client.Presets = NewResourceClient[Preset, int64](client, "presets") + client.Roles = NewResourceClient[Role, string](client, "roles") + client.Users = NewResourceClient[User, string](client, "users") client.Fields = &clientFields{client: client} client.Relations = &clientRelations{client: client} - client.Settings = &clientSettings{client: client} client.Server = &clientServer{client: client} + client.Settings = &clientSettings{client: client} return client }