-
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.
Custom Properties (
custom_property
and custom_property_values
eve…
…nts) (#500) * add test custom_property payloads * add test custom_property_values payload * custom_property custom_property_values app events * organization_custom_properties repository_custom_properties app permissions * add custom_properties to Repository * fix bug in (released) custom_property_values event * correct objects for custom_property_values events * correct objects for custom_property events * docs say values_editable_by can be null
- Loading branch information
1 parent
645eae2
commit 9fc75ba
Showing
19 changed files
with
395 additions
and
62 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
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
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
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,15 +1,6 @@ | ||
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!; | ||
} | ||
public abstract record CustomPropertyValuesEvent : WebhookEvent; |
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
28 changes: 28 additions & 0 deletions
28
src/Octokit.Webhooks/Models/CustomPropertyEvent/CustomProperty.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,28 @@ | ||
namespace Octokit.Webhooks.Models.CustomPropertyEvent; | ||
|
||
[PublicAPI] | ||
public sealed record CustomProperty | ||
{ | ||
[JsonPropertyName("property_name")] | ||
public string PropertyName { get; init; } = null!; | ||
|
||
[JsonPropertyName("value_type")] | ||
[JsonConverter(typeof(StringEnumConverter<CustomPropertyValueType>))] | ||
public StringEnum<CustomPropertyValueType> ValueType { get; init; } = null!; | ||
|
||
[JsonPropertyName("required")] | ||
public bool Required { get; init; } | ||
|
||
[JsonPropertyName("default_value")] | ||
public string? DefaultValue { get; init; } | ||
|
||
[JsonPropertyName("description")] | ||
public string? Description { get; init; } | ||
|
||
[JsonPropertyName("allowed_values")] | ||
public IEnumerable<string>? AllowedValues { get; init; } | ||
|
||
[JsonPropertyName("values_editable_by")] | ||
[JsonConverter(typeof(StringEnumConverter<CustomPropertyValuesEditableBy>))] | ||
public StringEnum<CustomPropertyValuesEditableBy>? ValuesEditableBy { get; init; } | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Octokit.Webhooks/Models/CustomPropertyEvent/CustomPropertyLite.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,8 @@ | ||
namespace Octokit.Webhooks.Models.CustomPropertyEvent; | ||
|
||
[PublicAPI] | ||
public sealed record CustomPropertyLite | ||
{ | ||
[JsonPropertyName("property_name")] | ||
public string PropertyName { get; init; } = null!; | ||
} |
2 changes: 1 addition & 1 deletion
2
...CustomProperty/CustomPropertyValueType.cs → ...mPropertyEvent/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
11 changes: 11 additions & 0 deletions
11
src/Octokit.Webhooks/Models/CustomPropertyEvent/CustomPropertyValuesEditableBy.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.CustomPropertyEvent; | ||
|
||
[PublicAPI] | ||
public enum CustomPropertyValuesEditableBy | ||
{ | ||
[EnumMember(Value = "org_actors")] | ||
OrgActors, | ||
|
||
[EnumMember(Value = "org_and_repo_actors")] | ||
OrgAndRepoActors, | ||
} |
11 changes: 0 additions & 11 deletions
11
src/Octokit.Webhooks/Models/CustomPropertyValues/CustomPropertyValue.cs
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/Octokit.Webhooks/Models/CustomPropertyValuesEvent/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.CustomPropertyValuesEvent; | ||
|
||
[PublicAPI] | ||
public sealed record CustomPropertyValue | ||
{ | ||
[JsonPropertyName("property_name")] | ||
public string PropertyName { get; init; } = null!; | ||
|
||
[JsonPropertyName("value")] | ||
public string? Value { 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
54 changes: 54 additions & 0 deletions
54
test/Octokit.Webhooks.Test/Resources/custom_property/created.payload.json
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,54 @@ | ||
{ | ||
"action": "created", | ||
"definition": { | ||
"property_name": "dev_platform_select", | ||
"value_type": "single_select", | ||
"required": true, | ||
"default_value": "option_default", | ||
"description": "select description", | ||
"allowed_values": [ | ||
"option_one", | ||
"option_two", | ||
"option_default" | ||
], | ||
"values_editable_by": "org_and_repo_actors" | ||
}, | ||
"organization": { | ||
"login": "Contoso-Inc", | ||
"id": 128636122, | ||
"node_id": "O_kgDOB6rU2g", | ||
"url": "https://api.github.com/orgs/Contoso-Inc", | ||
"repos_url": "https://api.github.com/orgs/Contoso-Inc/repos", | ||
"events_url": "https://api.github.com/orgs/Contoso-Inc/events", | ||
"hooks_url": "https://api.github.com/orgs/Contoso-Inc/hooks", | ||
"issues_url": "https://api.github.com/orgs/Contoso-Inc/issues", | ||
"members_url": "https://api.github.com/orgs/Contoso-Inc/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/Contoso-Inc/public_members{/member}", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/128636122?v=4", | ||
"description": "Contoso Inc brings you the best of everything. " | ||
}, | ||
"sender": { | ||
"login": "colbylwilliams", | ||
"id": 1829082, | ||
"node_id": "MDQ6VXNldfG4MjkwODI=", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/1829082?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/colbylwilliams", | ||
"html_url": "https://github.com/colbylwilliams", | ||
"followers_url": "https://api.github.com/users/colbylwilliams/followers", | ||
"following_url": "https://api.github.com/users/colbylwilliams/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/colbylwilliams/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/colbylwilliams/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/colbylwilliams/subscriptions", | ||
"organizations_url": "https://api.github.com/users/colbylwilliams/orgs", | ||
"repos_url": "https://api.github.com/users/colbylwilliams/repos", | ||
"events_url": "https://api.github.com/users/colbylwilliams/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/colbylwilliams/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"installation": { | ||
"id": 40989628, | ||
"node_id": "MDIzOkludGVncmF0aF32SW5zdGFsbGF0aW9uNDA5ODk2Mjg=" | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
test/Octokit.Webhooks.Test/Resources/custom_property/deleted.payload.json
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,44 @@ | ||
{ | ||
"action": "deleted", | ||
"definition": { | ||
"property_name": "dev_platform_test" | ||
}, | ||
"organization": { | ||
"login": "Contoso-Inc", | ||
"id": 128636122, | ||
"node_id": "O_kgDOB6rU2g", | ||
"url": "https://api.github.com/orgs/Contoso-Inc", | ||
"repos_url": "https://api.github.com/orgs/Contoso-Inc/repos", | ||
"events_url": "https://api.github.com/orgs/Contoso-Inc/events", | ||
"hooks_url": "https://api.github.com/orgs/Contoso-Inc/hooks", | ||
"issues_url": "https://api.github.com/orgs/Contoso-Inc/issues", | ||
"members_url": "https://api.github.com/orgs/Contoso-Inc/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/Contoso-Inc/public_members{/member}", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/128636122?v=4", | ||
"description": "Contoso Inc brings you the best of everything. " | ||
}, | ||
"sender": { | ||
"login": "colbylwilliams", | ||
"id": 1829082, | ||
"node_id": "MDQ6VXNldfG4MjkwODI=", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/1829082?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/colbylwilliams", | ||
"html_url": "https://github.com/colbylwilliams", | ||
"followers_url": "https://api.github.com/users/colbylwilliams/followers", | ||
"following_url": "https://api.github.com/users/colbylwilliams/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/colbylwilliams/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/colbylwilliams/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/colbylwilliams/subscriptions", | ||
"organizations_url": "https://api.github.com/users/colbylwilliams/orgs", | ||
"repos_url": "https://api.github.com/users/colbylwilliams/repos", | ||
"events_url": "https://api.github.com/users/colbylwilliams/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/colbylwilliams/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"installation": { | ||
"id": 40989628, | ||
"node_id": "MDIzOkludGVncmF0aF32SW5zdGFsbGF0aW9uNDA5ODk2Mjg=" | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
test/Octokit.Webhooks.Test/Resources/custom_property/updated.payload.json
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,51 @@ | ||
{ | ||
"action": "updated", | ||
"definition": { | ||
"property_name": "dev_platform_test", | ||
"value_type": "single_select", | ||
"required": false, | ||
"allowed_values": [ | ||
"option_one", | ||
"option_two" | ||
], | ||
"values_editable_by": "org_and_repo_actors" | ||
}, | ||
"organization": { | ||
"login": "Contoso-Inc", | ||
"id": 128636122, | ||
"node_id": "O_kgDOB6rU2g", | ||
"url": "https://api.github.com/orgs/Contoso-Inc", | ||
"repos_url": "https://api.github.com/orgs/Contoso-Inc/repos", | ||
"events_url": "https://api.github.com/orgs/Contoso-Inc/events", | ||
"hooks_url": "https://api.github.com/orgs/Contoso-Inc/hooks", | ||
"issues_url": "https://api.github.com/orgs/Contoso-Inc/issues", | ||
"members_url": "https://api.github.com/orgs/Contoso-Inc/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/Contoso-Inc/public_members{/member}", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/128636122?v=4", | ||
"description": "Contoso Inc brings you the best of everything. " | ||
}, | ||
"sender": { | ||
"login": "colbylwilliams", | ||
"id": 1829082, | ||
"node_id": "MDQ6VXNldfG4MjkwODI=", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/1829082?v=4", | ||
"gravatar_id": "", | ||
"url": "https://api.github.com/users/colbylwilliams", | ||
"html_url": "https://github.com/colbylwilliams", | ||
"followers_url": "https://api.github.com/users/colbylwilliams/followers", | ||
"following_url": "https://api.github.com/users/colbylwilliams/following{/other_user}", | ||
"gists_url": "https://api.github.com/users/colbylwilliams/gists{/gist_id}", | ||
"starred_url": "https://api.github.com/users/colbylwilliams/starred{/owner}{/repo}", | ||
"subscriptions_url": "https://api.github.com/users/colbylwilliams/subscriptions", | ||
"organizations_url": "https://api.github.com/users/colbylwilliams/orgs", | ||
"repos_url": "https://api.github.com/users/colbylwilliams/repos", | ||
"events_url": "https://api.github.com/users/colbylwilliams/events{/privacy}", | ||
"received_events_url": "https://api.github.com/users/colbylwilliams/received_events", | ||
"type": "User", | ||
"site_admin": false | ||
}, | ||
"installation": { | ||
"id": 40989628, | ||
"node_id": "MDIzOkludGVncmF0aF32SW5zdGFsbGF0aW9uNDA5ODk2Mjg=" | ||
} | ||
} |
Oops, something went wrong.