-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new using directives in
ExtensionMethods.cs
for improved func…
…tionality and clarity. Modified webhook handling logic to deserialize the request body into an `OttWebhook` object and check if the topic is in the `attribute.Topics`, invoking the method if it matches, or returning a 400 Bad Request status otherwise.
- Loading branch information
Showing
2 changed files
with
20 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,14 @@ | ||
// Copyright 2025 Aiko IT Systems. See https://github.com/Aiko-IT-Systems/AITSYS.Vimeo.OTT/blob/main/LICENSE.md for the license. | ||
|
||
namespace AITSYS.Vimeo.Ott.Attributes; | ||
|
||
/// <summary> | ||
/// Marks a method to handle a topic for incoming ott webhooks. | ||
/// Marks a method to handle one or more topics for incoming OTT webhooks. | ||
/// </summary> | ||
/// <param name="topics">The topics to handle.</param> | ||
[AttributeUsage(AttributeTargets.Method)] | ||
public sealed class VimeoOttWebhookAttribute : Attribute | ||
public sealed class VimeoOttWebhookAttribute(params string[] topics) : Attribute | ||
{ | ||
/// <summary> | ||
/// Marks a method to handle a topic for incoming ott webhooks. | ||
/// </summary> | ||
/// <param name="topic">The topic to handle.</param> | ||
public VimeoOttWebhookAttribute(string topic) | ||
{ | ||
this.Topic = topic; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the webhooks topic. | ||
/// Gets the webhooks topics. | ||
/// </summary> | ||
public string Topic { get; } | ||
public IEnumerable<string> Topics { get; } = topics; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters