Skip to content

Commit

Permalink
Latest code review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenka authored and Lenka committed Jan 3, 2024
1 parent f953aa8 commit 3f96dbe
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 20 deletions.
18 changes: 9 additions & 9 deletions Kontent.Ai.Management.Tests/CodeSamples/CmApiV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,9 +1418,9 @@ public async void PostWebhook()
Enabled = true,
Actions = new []
{
new ContentTypeActionModel { Action = ContentTypeActionEnum.Created },
new ContentTypeActionModel { Action = ContentTypeActionEnum.Changed },
new ContentTypeActionModel { Action = ContentTypeActionEnum.Deleted }
new ContentTypeActionModel { Action = ContentTypeAction.Created },
new ContentTypeActionModel { Action = ContentTypeAction.Changed },
new ContentTypeActionModel { Action = ContentTypeAction.Deleted }
}
},
ContentItem = new ContentItemTriggerModel
Expand All @@ -1430,7 +1430,7 @@ public async void PostWebhook()
{
new ContentItemActionModel
{
Action = ContentItemActionEnum.Deleted,
Action = ContentItemAction.Deleted,
TransitionTo = new []
{
new ContentItemWorkflowTransition {
Expand All @@ -1453,25 +1453,25 @@ public async void PostWebhook()
Enabled = true,
Actions = new []
{
new TaxonomyActionModel { Action = TaxonomyActionEnum.TermChanged },
new TaxonomyActionModel { Action = TaxonomyActionEnum.MetadataChanged }
new TaxonomyActionModel { Action = TaxonomyAction.TermChanged },
new TaxonomyActionModel { Action = TaxonomyAction.MetadataChanged }
}
},
Asset = new AssetTriggerModel
{
Enabled = true,
Actions = new []
{
new AssetActionModel { Action = AssetActionEnum.Created },
new AssetActionModel { Action = AssetActionEnum.Changed }
new AssetActionModel { Action = AssetAction.Created },
new AssetActionModel { Action = AssetAction.Changed }
}
},
Language = new LanguageTriggerModel
{
Enabled = true,
Actions = new []
{
new LanguageActionModel { Action = LanguageActionEnum.Created }
new LanguageActionModel { Action = LanguageAction.Created }
}
},
Slot = DeliverySlot.Published,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public async void CreateWebhookAsync_CreatesWebhook()
DeliveryTriggers = new DeliveryTriggersModel {
ContentType = new ContentTypeTriggerModel {
Enabled = true,
Actions = new[] { new ContentTypeActionModel { Action = ContentTypeActionEnum.Created } }
Actions = new[] { new ContentTypeActionModel { Action = ContentTypeAction.Created } }
}
}
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Runtime.Serialization;

namespace Kontent.Ai.Management.Models.LegacyWebhooks;

/// <summary>
/// Webhook health status.
/// </summary>
public enum LegacyWebhookHealthStatus
{
/// <summary>
/// Appears for newly created webhooks before any notification has been sent.
/// </summary>
[EnumMember(Value = "unknown")]
Unknown = 0,

/// <summary>
/// Appears for webhooks that have properly delivered notifications.
/// </summary>
[EnumMember(Value = "working")]
Working = 1,

/// <summary>
/// Appears for webhooks that have not been delivered properly.
/// </summary>
[EnumMember(Value = "failing")]
Failing = 2,

/// <summary>
/// Appears for webhooks where delivery has repeatedly failed, and no notifications have been accepted for 7 days.
/// </summary>
[EnumMember(Value = "dead")]
Dead = 3
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ public class LegacyWebhookModel
/// </summary>
[JsonProperty("last_modified")]
public DateTime? LastModified { get; set; }

/// <summary>
/// The webhook's health status tells you whether the webhook is operational.
/// </summary>
[JsonProperty("health_status")]
public LegacyWebhookHealthStatus HealthStatus { get; set; }

/// <summary>
/// Gets or sets the webhook's internal ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Kontent.Ai.Management.Models.Webhooks.Triggers.Asset;
/// <summary>
/// Represents asset actions.
/// </summary>
public enum AssetActionEnum
public enum AssetAction
{
/// <summary>
/// Asset created action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public class AssetActionModel
/// Asset action.
/// </summary>
[JsonProperty("action")]
public AssetActionEnum Action { get; set; }
public AssetAction Action { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Kontent.Ai.Management.Models.Webhooks.Triggers.ContentItem;
/// <summary>
/// Represents content item actions.
/// </summary>
public enum ContentItemActionEnum
public enum ContentItemAction
{
/// <summary>
/// Content item created action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ContentItemActionModel
/// The action performed on a content item.
/// </summary>
[JsonProperty("action")]
public ContentItemActionEnum Action { get; set; }
public ContentItemAction Action { get; set; }

/// <summary>
/// Specifies a workflow and its workflow step.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Kontent.Ai.Management.Models.Webhooks.Triggers.ContentType;
/// <summary>
/// Represents content type actions.
/// </summary>
public enum ContentTypeActionEnum
public enum ContentTypeAction
{
/// <summary>
/// Content type created action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public class ContentTypeActionModel
/// Content type action.
/// </summary>
[JsonProperty("action")]
public ContentTypeActionEnum Action { get; set; }
public ContentTypeAction Action { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Kontent.Ai.Management.Models.Webhooks.Triggers.Language;
/// <summary>
/// Represents language actions.
/// </summary>
public enum LanguageActionEnum
public enum LanguageAction
{
/// <summary>
/// Language created action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public class LanguageActionModel
/// Language action.
/// </summary>
[JsonProperty("action")]
public LanguageActionEnum Action { get; set; }
public LanguageAction Action { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Kontent.Ai.Management.Models.Webhooks.Triggers.Taxonomy;
/// <summary>
/// Represents taxonomy actions.
/// </summary>
public enum TaxonomyActionEnum
public enum TaxonomyAction
{
/// <summary>
/// Taxonomy created action.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ public class TaxonomyActionModel
/// Taxonomy action.
/// </summary>
[JsonProperty("action")]
public TaxonomyActionEnum Action { get; set; }
public TaxonomyAction Action { get; set; }
}

0 comments on commit 3f96dbe

Please sign in to comment.