Skip to content

Commit 0a1a824

Browse files
authored
feat: add grants to channeltype (#166)
1 parent c05a8b6 commit 0a1a824

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

.github/workflows/go.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,3 @@ jobs:
3232
STREAM_CHAT_API_KEY: ${{ secrets.STREAM_CHAT_API_KEY }}
3333
STREAM_CHAT_API_SECRET: ${{ secrets.STREAM_CHAT_API_SECRET }}
3434
run: go test -v -race ./...
35-
36-
- name: Build on ${{ matrix.goVer }}
37-
run: go build ./...

app.go

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ import (
77
)
88

99
type AppSettings struct {
10-
DisableAuth *bool `json:"disable_auth_checks,omitempty"`
11-
DisablePermissions *bool `json:"disable_permissions_checks,omitempty"`
12-
APNConfig *APNConfig `json:"apn_config,omitempty"`
13-
FirebaseConfig *FirebaseConfig `json:"firebase_config,omitempty"`
14-
WebhookURL *string `json:"webhook_url,omitempty"`
15-
MultiTenantEnabled *bool `json:"multi_tenant_enabled,omitempty"`
16-
AsyncURLEnrichEnabled *bool `json:"async_url_enrich_enabled,omitempty"`
10+
DisableAuth *bool `json:"disable_auth_checks,omitempty"`
11+
DisablePermissions *bool `json:"disable_permissions_checks,omitempty"`
12+
APNConfig *APNConfig `json:"apn_config,omitempty"`
13+
FirebaseConfig *FirebaseConfig `json:"firebase_config,omitempty"`
14+
WebhookURL *string `json:"webhook_url,omitempty"`
15+
MultiTenantEnabled *bool `json:"multi_tenant_enabled,omitempty"`
16+
AsyncURLEnrichEnabled *bool `json:"async_url_enrich_enabled,omitempty"`
17+
Grants map[string][]string `json:"grants,omitempty"`
18+
MigratePermissionsToV2 *bool `json:"migrate_permissions_to_v2,omitempty"`
19+
PermissionVersion string `json:"permission_version,omitempty"`
1720
}
1821

1922
func (a *AppSettings) SetDisableAuth(b bool) *AppSettings {
@@ -46,6 +49,11 @@ func (a *AppSettings) SetMultiTenant(b bool) *AppSettings {
4649
return a
4750
}
4851

52+
func (a *AppSettings) SetGrants(g map[string][]string) *AppSettings {
53+
a.Grants = g
54+
return a
55+
}
56+
4957
func NewAppSettings() *AppSettings {
5058
return &AppSettings{}
5159
}
@@ -99,6 +107,8 @@ type AppConfig struct {
99107
MultiTenantEnabled bool `json:"multi_tenant_enabled"`
100108
RevokeTokensIssuedBefore *time.Time `json:"revoke_tokens_issued_before"`
101109
AsyncURLEnrichEnabled bool `json:"async_url_enrich_enabled"`
110+
Grants map[string][]string `json:"grants"`
111+
PermissionVersion string `json:"permission_version"`
102112
}
103113

104114
type AppResponse struct {

channel_type.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type ChannelType struct {
5353
// that can be found in permission_client.go.
5454
// See https://getstream.io/chat/docs/go-golang/migrating_from_legacy/?language=go
5555
Permissions []*ChannelTypePermission `json:"permissions"`
56+
Grants map[string][]string `json:"grants"`
5657

5758
CreatedAt time.Time `json:"created_at"`
5859
UpdatedAt time.Time `json:"updated_at"`

channel_type_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func TestClient_GetChannelType(t *testing.T) {
3434
assert.Equal(t, ct.Name, resp.ChannelType.Name)
3535
assert.Equal(t, len(ct.Commands), len(resp.ChannelType.Commands))
3636
assert.Equal(t, ct.Permissions, resp.ChannelType.Permissions)
37+
assert.NotEmpty(t, resp.Grants)
3738
}
3839

3940
func TestClient_ListChannelTypes(t *testing.T) {

0 commit comments

Comments
 (0)