-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add custom_property and custom_property_values (#417)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
- Loading branch information
1 parent
ed20ff8
commit df184d4
Showing
14 changed files
with
203 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/Octokit.Webhooks/Events/CustomProperty/CustomPropertyAction.cs
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Octokit.Webhooks.Events.CustomProperty; | ||
|
||
[PublicAPI] | ||
public sealed record CustomPropertyAction : WebhookEventAction | ||
{ | ||
public static readonly CustomPropertyAction Created = new(CustomPropertyActionValue.Created); | ||
|
||
public static readonly CustomPropertyAction Updated = new(CustomPropertyActionValue.Updated); | ||
|
||
public static readonly CustomPropertyAction Deleted = new(CustomPropertyActionValue.Deleted); | ||
|
||
private CustomPropertyAction(string value) | ||
: base(value) | ||
{ | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Octokit.Webhooks/Events/CustomProperty/CustomPropertyActionValue.cs
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Octokit.Webhooks.Events.CustomProperty; | ||
|
||
public static class CustomPropertyActionValue | ||
{ | ||
public const string Created = "created"; | ||
|
||
public const string Updated = "updated"; | ||
|
||
public const string Deleted = "deleted"; | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Octokit.Webhooks/Events/CustomProperty/CustomPropertyCreatedEvent.cs
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Octokit.Webhooks.Models.CustomProperty; | ||
|
||
namespace Octokit.Webhooks.Events.CustomProperty; | ||
|
||
[PublicAPI] | ||
[WebhookActionType(CustomPropertyActionValue.Created)] | ||
public sealed record CustomPropertyCreatedEvent : CustomPropertyEvent | ||
{ | ||
[JsonPropertyName("action")] | ||
public override string Action => CustomPropertyAction.Created; | ||
|
||
[JsonPropertyName("value_type")] | ||
[JsonConverter(typeof(StringEnumConverter<CustomPropertyValueType>))] | ||
public StringEnum<CustomPropertyValueType> ValueType { get; init; } = null!; | ||
|
||
[JsonPropertyName("default_value")] | ||
public string? DefaultValue { get; init; } | ||
|
||
[JsonPropertyName("required")] | ||
public bool Required { get; init; } | ||
|
||
[JsonPropertyName("description")] | ||
public string? Description { get; init; } | ||
|
||
[JsonPropertyName("allowed_values")] | ||
public IEnumerable<string>? AllowedValues { get; init; } | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Octokit.Webhooks/Events/CustomProperty/CustomPropertyDeletedEvent.cs
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Octokit.Webhooks.Events.CustomProperty; | ||
|
||
[PublicAPI] | ||
[WebhookActionType(CustomPropertyActionValue.Deleted)] | ||
public sealed record CustomPropertyDeletedEvent : CustomPropertyEvent | ||
{ | ||
[JsonPropertyName("action")] | ||
public override string Action => CustomPropertyAction.Deleted; | ||
} |
27 changes: 27 additions & 0 deletions
27
src/Octokit.Webhooks/Events/CustomProperty/CustomPropertyUpdatedEvent.cs
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Octokit.Webhooks.Models.CustomProperty; | ||
|
||
namespace Octokit.Webhooks.Events.CustomProperty; | ||
|
||
[PublicAPI] | ||
[WebhookActionType(CustomPropertyActionValue.Updated)] | ||
public sealed record CustomPropertyUpdatedEvent : CustomPropertyEvent | ||
{ | ||
[JsonPropertyName("action")] | ||
public override string Action => CustomPropertyAction.Updated; | ||
|
||
[JsonPropertyName("value_type")] | ||
[JsonConverter(typeof(StringEnumConverter<CustomPropertyValueType>))] | ||
public StringEnum<CustomPropertyValueType> ValueType { get; init; } = null!; | ||
|
||
[JsonPropertyName("default_value")] | ||
public string? DefaultValue { get; init; } | ||
|
||
[JsonPropertyName("required")] | ||
public bool Required { get; init; } | ||
|
||
[JsonPropertyName("description")] | ||
public string? Description { get; init; } | ||
|
||
[JsonPropertyName("allowed_values")] | ||
public IEnumerable<string>? AllowedValues { get; init; } | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Octokit.Webhooks.Events; | ||
|
||
[PublicAPI] | ||
[WebhookEventType(WebhookEventType.CustomProperty)] | ||
[JsonConverter(typeof(WebhookConverter<CustomPropertyEvent>))] | ||
public abstract record CustomPropertyEvent : WebhookEvent | ||
{ | ||
[JsonPropertyName("property_name")] | ||
public string PropertyName { get; init; } = null!; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Octokit.Webhooks/Events/CustomPropertyValues/CustomPropertyValuesAction.cs
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Octokit.Webhooks.Events.CustomPropertyValues; | ||
|
||
[PublicAPI] | ||
public sealed record CustomPropertyValuesAction : WebhookEventAction | ||
{ | ||
public static readonly CustomPropertyValuesAction Updated = new(CustomPropertyValuesActionValue.Updated); | ||
|
||
private CustomPropertyValuesAction(string value) | ||
: base(value) | ||
{ | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Octokit.Webhooks/Events/CustomPropertyValues/CustomPropertyValuesActionValue.cs
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Octokit.Webhooks.Events.CustomPropertyValues; | ||
|
||
public static class CustomPropertyValuesActionValue | ||
{ | ||
public const string Updated = "updated"; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Octokit.Webhooks/Events/CustomPropertyValues/CustomPropertyValuesUpdatedEvent.cs
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Octokit.Webhooks.Events.CustomPropertyValues; | ||
|
||
[PublicAPI] | ||
[WebhookActionType(CustomPropertyValuesActionValue.Updated)] | ||
public abstract record CustomPropertyValuesUpdatedEvent : CustomPropertyValuesEvent | ||
{ | ||
[JsonPropertyName("action")] | ||
public override string Action => CustomPropertyValuesAction.Updated; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Octokit.Webhooks.Models.CustomPropertyValues; | ||
|
||
namespace Octokit.Webhooks.Events; | ||
|
||
[PublicAPI] | ||
[WebhookEventType(WebhookEventType.CustomPropertyValues)] | ||
[JsonConverter(typeof(WebhookConverter<CustomPropertyValuesEvent>))] | ||
public abstract record CustomPropertyValuesEvent : WebhookEvent | ||
{ | ||
[JsonPropertyName("new_property_values")] | ||
public IEnumerable<CustomPropertyValue> NewPropertyValues { get; init; } = null!; | ||
|
||
[JsonPropertyName("old_property_values")] | ||
public IEnumerable<CustomPropertyValue> OldPropertyValues { get; init; } = null!; | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Octokit.Webhooks/Models/CustomProperty/CustomPropertyValueType.cs
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Octokit.Webhooks.Models.CustomProperty; | ||
|
||
[PublicAPI] | ||
public enum CustomPropertyValueType | ||
{ | ||
[EnumMember(Value = "string")] | ||
String, | ||
|
||
[EnumMember(Value = "single_select")] | ||
SingleSelect, | ||
} |
11 changes: 11 additions & 0 deletions
11
src/Octokit.Webhooks/Models/CustomPropertyValues/CustomPropertyValue.cs
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Octokit.Webhooks.Models.CustomPropertyValues; | ||
|
||
[PublicAPI] | ||
public record CustomPropertyValue | ||
{ | ||
[JsonPropertyName("property_name")] | ||
public string PropertyName { get; set; } = null!; | ||
|
||
[JsonPropertyName("value")] | ||
public string? Value { get; set; } | ||
} |
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
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