diff --git a/src/Models/AppSettings.cs b/src/Models/AppSettings.cs
index f8c467d..6d8e9f0 100644
--- a/src/Models/AppSettings.cs
+++ b/src/Models/AppSettings.cs
@@ -77,6 +77,30 @@ public enum AuthType
Resource,
}
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum Product
+ {
+ /// Stream Chat product
+ [EnumMember(Value = "chat")]
+ Chat,
+
+ /// Stream Video product
+ [EnumMember(Value = "video")]
+ Video,
+
+ /// Stream Moderation product
+ [EnumMember(Value = "moderation")]
+ Moderation,
+
+ /// Stream Feeds product
+ [EnumMember(Value = "feeds")]
+ Feeds,
+
+ /// All Stream products (default)
+ [EnumMember(Value = "all")]
+ All,
+ }
+
[JsonConverter(typeof(StringEnumConverter))]
public enum CallbackMode
{
@@ -109,6 +133,9 @@ public class EventHook
/// Whether this event hook is currently active
public bool Enabled { get; set; }
+ /// Product scope for this event hook
+ public Product? Product { get; set; }
+
/// List of event types this hook will respond to
public List EventTypes { get; set; }
diff --git a/tests/AppClientTests.cs b/tests/AppClientTests.cs
index 013e721..931aa89 100644
--- a/tests/AppClientTests.cs
+++ b/tests/AppClientTests.cs
@@ -164,15 +164,27 @@ public async Task TestEventHooksAsync()
Id = "95fa9371-38d8-4ddb-b099-d9ed86e7c9bc",
HookType = HookType.Webhook,
Enabled = true,
+ Product = Product.All,
EventTypes = new List { "message.new", "message.updated" },
WebhookUrl = "https://example.com/webhook",
};
+ var chatWebhookHook = new EventHook
+ {
+ Id = "c3eff852-1194-47c2-8e1c-42a0b1dc1151",
+ HookType = HookType.Webhook,
+ Enabled = true,
+ Product = Product.Chat,
+ EventTypes = new List { "message.new", "message.updated" },
+ WebhookUrl = "https://example.com/webhook-chat",
+ };
+
var sqsHook = new EventHook
{
Id = "4eaa795f-77d2-4b72-8f7e-11de0327121c",
HookType = HookType.SQS,
Enabled = true,
+ Product = Product.All,
EventTypes = new List { "user.updated" },
SqsQueueUrl = "https://sqs.region.amazonaws.com/123456789012/queue-name",
SqsRegion = "us-east-1",
@@ -184,19 +196,19 @@ public async Task TestEventHooksAsync()
Id = "7b2c6590-7b61-490a-8987-96c5f8a353ca",
HookType = HookType.SNS,
Enabled = true,
+ Product = Product.All,
EventTypes = new List { "channel.updated" },
SnsTopicArn = "arn:aws:sns:us-east-1:123456789012:topic-name",
SnsRegion = "us-east-1",
SnsAuthType = AuthType.Resource,
};
- var eventHooks = new List { webhookHook, sqsHook, snsHook };
-
- await _appClient.UpdateAppSettingsAsync(new AppSettingsRequest { EventHooks = eventHooks });
+ var eventHooks = new List { webhookHook, chatWebhookHook, sqsHook, snsHook };
+ var updateResponse = await _appClient.UpdateAppSettingsAsync(new AppSettingsRequest { EventHooks = eventHooks });
var getAppResponse = await _appClient.GetAppSettingsAsync();
getAppResponse.App.EventHooks.Should().NotBeNull();
- getAppResponse.App.EventHooks.Should().HaveCount(3);
+ getAppResponse.App.EventHooks.Should().HaveCount(4);
getAppResponse.App.EventHooks.Should().BeEquivalentTo(eventHooks, options => options.Excluding(e => e.CreatedAt).Excluding(e => e.UpdatedAt));
}
}