diff --git a/Local.testsettings b/Local.testsettings
deleted file mode 100644
index 6dff9e4..0000000
--- a/Local.testsettings
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
- These are default test settings for a local test run.
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/StacMan.Tests/Properties/AssemblyInfo.cs b/StacMan.Tests/Properties/AssemblyInfo.cs
deleted file mode 100644
index 2975109..0000000
--- a/StacMan.Tests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("StacMan.Tests")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("StacMan.Tests")]
-[assembly: AssemblyCopyright("Copyright © 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("7feba5f4-b16a-435b-96fb-0367cbbb23b7")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/StacMan.Tests/StacMan.Tests.csproj b/StacMan.Tests/StacMan.Tests.csproj
index cd08ee8..c189480 100644
--- a/StacMan.Tests/StacMan.Tests.csproj
+++ b/StacMan.Tests/StacMan.Tests.csproj
@@ -1,82 +1,21 @@
-
-
+
+
- Debug
- AnyCPU
-
-
- 2.0
- {5FBD3A5B-93AE-43B7-9566-C7D08A71C8E9}
- Library
- Properties
+ net472;netcoreapp3.1;net6.0
+ 9.0
+ false
StackExchange.StacMan.Tests
- StacMan.Tests
- v4.5
- 512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
-
-
-
-
- ..\packages\Moq.4.0.10827\lib\NET40\Moq.dll
-
-
-
-
-
- False
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
- {3C310AC6-6229-41FB-B33F-8381CF4FECBF}
- StacMan
-
+
+
+
+
+
-
+
-
-
-
\ No newline at end of file
+
+
diff --git a/StacMan.Tests/packages.config b/StacMan.Tests/packages.config
deleted file mode 100644
index 6ec355e..0000000
--- a/StacMan.Tests/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/StacMan.sln b/StacMan.sln
index eb5894f..cd1def8 100644
--- a/StacMan.sln
+++ b/StacMan.sln
@@ -5,13 +5,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StacMan", "StacMan\StacMan.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StacMan.Tests", "StacMan.Tests\StacMan.Tests.csproj", "{5FBD3A5B-93AE-43B7-9566-C7D08A71C8E9}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{940A5141-7F86-40E6-BB3D-046EE0A79FB7}"
- ProjectSection(SolutionItems) = preProject
- Local.testsettings = Local.testsettings
- StacMan.vsmdi = StacMan.vsmdi
- TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
- EndProjectSection
-EndProject
Global
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = StacMan.vsmdi
diff --git a/StacMan.vsmdi b/StacMan.vsmdi
deleted file mode 100644
index 4920828..0000000
--- a/StacMan.vsmdi
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/StacMan/Badges/BadgeType.cs b/StacMan/Badges/BadgeType.cs
index 476ec38..640334b 100644
--- a/StacMan/Badges/BadgeType.cs
+++ b/StacMan/Badges/BadgeType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Badges
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Badges
{
///
/// badge_type
@@ -8,11 +10,13 @@ public enum BadgeType
///
/// name
///
+ [JsonPropertyName("name")]
Named,
///
/// tag_based
///
+ [JsonPropertyName("tag_based")]
TagBased
}
}
diff --git a/StacMan/Badges/Rank.cs b/StacMan/Badges/Rank.cs
index 7890b13..7d2173b 100644
--- a/StacMan/Badges/Rank.cs
+++ b/StacMan/Badges/Rank.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Badges
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Badges
{
///
/// rank
@@ -8,16 +10,19 @@ public enum Rank
///
/// gold
///
+ [JsonPropertyName("gold")]
Gold,
///
/// silver
///
+ [JsonPropertyName("silver")]
Silver,
///
/// bronze
///
+ [JsonPropertyName("bronze")]
Bronze
}
}
diff --git a/StacMan/Codegen/AccessToken.cs b/StacMan/Codegen/AccessToken.cs
index af1a04d..506897b 100644
--- a/StacMan/Codegen/AccessToken.cs
+++ b/StacMan/Codegen/AccessToken.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,26 +18,26 @@ public partial class AccessToken : StacManType
///
/// access_token
///
- [Field("access_token")]
- public string AccessTokenName { get; internal set; }
+ [JsonPropertyName("access_token")]
+ public string AccessTokenName { get; init; }
///
/// account_id
///
- [Field("account_id")]
- public int AccountId { get; internal set; }
+ [JsonPropertyName("account_id")]
+ public int AccountId { get; init; }
///
/// expires_on_date
///
- [Field("expires_on_date")]
- public DateTime? ExpiresOnDate { get; internal set; }
+ [JsonPropertyName("expires_on_date")]
+ public DateTime? ExpiresOnDate { get; init; }
///
/// scope
///
- [Field("scope")]
- public string[] Scope { get; internal set; }
+ [JsonPropertyName("scope")]
+ public string[] Scope { get; init; }
}
}
diff --git a/StacMan/Codegen/AccountMerge.cs b/StacMan/Codegen/AccountMerge.cs
index 21144be..03dd602 100644
--- a/StacMan/Codegen/AccountMerge.cs
+++ b/StacMan/Codegen/AccountMerge.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class AccountMerge : StacManType
///
/// merge_date -- introduced in API version 2.1
///
- [Field("merge_date")]
- public DateTime MergeDate { get; internal set; }
+ [JsonPropertyName("merge_date")]
+ public DateTime MergeDate { get; init; }
///
/// new_account_id -- introduced in API version 2.1
///
- [Field("new_account_id")]
- public int NewAccountId { get; internal set; }
+ [JsonPropertyName("new_account_id")]
+ public int NewAccountId { get; init; }
///
/// old_account_id -- introduced in API version 2.1
///
- [Field("old_account_id")]
- public int OldAccountId { get; internal set; }
+ [JsonPropertyName("old_account_id")]
+ public int OldAccountId { get; init; }
}
}
diff --git a/StacMan/Codegen/Answer.cs b/StacMan/Codegen/Answer.cs
index c2912d7..04e2180 100644
--- a/StacMan/Codegen/Answer.cs
+++ b/StacMan/Codegen/Answer.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,104 +18,104 @@ public partial class Answer : StacManType
///
/// answer_id
///
- [Field("answer_id")]
- public int AnswerId { get; internal set; }
+ [JsonPropertyName("answer_id")]
+ public int AnswerId { get; init; }
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// comments
///
- [Field("comments")]
- public Comment[] Comments { get; internal set; }
+ [JsonPropertyName("comments")]
+ public Comment[] Comments { get; init; }
///
/// community_owned_date
///
- [Field("community_owned_date")]
- public DateTime? CommunityOwnedDate { get; internal set; }
+ [JsonPropertyName("community_owned_date")]
+ public DateTime? CommunityOwnedDate { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// down_vote_count
///
- [Field("down_vote_count")]
- public int DownVoteCount { get; internal set; }
+ [JsonPropertyName("down_vote_count")]
+ public int DownVoteCount { get; init; }
///
/// is_accepted
///
- [Field("is_accepted")]
- public bool IsAccepted { get; internal set; }
+ [JsonPropertyName("is_accepted")]
+ public bool IsAccepted { get; init; }
///
/// last_activity_date
///
- [Field("last_activity_date")]
- public DateTime LastActivityDate { get; internal set; }
+ [JsonPropertyName("last_activity_date")]
+ public DateTime LastActivityDate { get; init; }
///
/// last_edit_date
///
- [Field("last_edit_date")]
- public DateTime? LastEditDate { get; internal set; }
+ [JsonPropertyName("last_edit_date")]
+ public DateTime? LastEditDate { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// locked_date
///
- [Field("locked_date")]
- public DateTime? LockedDate { get; internal set; }
+ [JsonPropertyName("locked_date")]
+ public DateTime? LockedDate { get; init; }
///
/// owner
///
- [Field("owner")]
- public ShallowUser Owner { get; internal set; }
+ [JsonPropertyName("owner")]
+ public ShallowUser Owner { get; init; }
///
/// question_id
///
- [Field("question_id")]
- public int QuestionId { get; internal set; }
+ [JsonPropertyName("question_id")]
+ public int QuestionId { get; init; }
///
/// score
///
- [Field("score")]
- public int Score { get; internal set; }
+ [JsonPropertyName("score")]
+ public int Score { get; init; }
///
/// tags -- introduced in API version 2.1
///
- [Field("tags")]
- public string[] Tags { get; internal set; }
+ [JsonPropertyName("tags")]
+ public string[] Tags { get; init; }
///
/// title
///
- [Field("title")]
- public string Title { get; internal set; }
+ [JsonPropertyName("title")]
+ public string Title { get; init; }
///
/// up_vote_count
///
- [Field("up_vote_count")]
- public int UpVoteCount { get; internal set; }
+ [JsonPropertyName("up_vote_count")]
+ public int UpVoteCount { get; init; }
}
}
diff --git a/StacMan/Codegen/Badge.cs b/StacMan/Codegen/Badge.cs
index 82bbc29..b5c5142 100644
--- a/StacMan/Codegen/Badge.cs
+++ b/StacMan/Codegen/Badge.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,50 +18,50 @@ public partial class Badge : StacManType
///
/// award_count
///
- [Field("award_count")]
- public int AwardCount { get; internal set; }
+ [JsonPropertyName("award_count")]
+ public int AwardCount { get; init; }
///
/// badge_id
///
- [Field("badge_id")]
- public int BadgeId { get; internal set; }
+ [JsonPropertyName("badge_id")]
+ public int BadgeId { get; init; }
///
/// badge_type
///
- [Field("badge_type")]
- public Badges.BadgeType BadgeType { get; internal set; }
+ [JsonPropertyName("badge_type")]
+ public Badges.BadgeType BadgeType { get; init; }
///
/// description
///
- [Field("description")]
- public string Description { get; internal set; }
+ [JsonPropertyName("description")]
+ public string Description { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// name
///
- [Field("name")]
- public string Name { get; internal set; }
+ [JsonPropertyName("name")]
+ public string Name { get; init; }
///
/// rank
///
- [Field("rank")]
- public Badges.Rank Rank { get; internal set; }
+ [JsonPropertyName("rank")]
+ public Badges.Rank Rank { get; init; }
///
/// user
///
- [Field("user")]
- public ShallowUser User { get; internal set; }
+ [JsonPropertyName("user")]
+ public ShallowUser User { get; init; }
}
}
diff --git a/StacMan/Codegen/BadgeCount.cs b/StacMan/Codegen/BadgeCount.cs
index f14c68e..01c46bd 100644
--- a/StacMan/Codegen/BadgeCount.cs
+++ b/StacMan/Codegen/BadgeCount.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class BadgeCount : StacManType
///
/// bronze
///
- [Field("bronze")]
- public int Bronze { get; internal set; }
+ [JsonPropertyName("bronze")]
+ public int Bronze { get; init; }
///
/// gold
///
- [Field("gold")]
- public int Gold { get; internal set; }
+ [JsonPropertyName("gold")]
+ public int Gold { get; init; }
///
/// silver
///
- [Field("silver")]
- public int Silver { get; internal set; }
+ [JsonPropertyName("silver")]
+ public int Silver { get; init; }
}
}
diff --git a/StacMan/Codegen/Comment.cs b/StacMan/Codegen/Comment.cs
index df320cc..0c58d8c 100644
--- a/StacMan/Codegen/Comment.cs
+++ b/StacMan/Codegen/Comment.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,68 +18,68 @@ public partial class Comment : StacManType
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// body_markdown -- introduced in API version 2.1
///
- [Field("body_markdown")]
- public string BodyMarkdown { get; internal set; }
+ [JsonPropertyName("body_markdown")]
+ public string BodyMarkdown { get; init; }
///
/// comment_id
///
- [Field("comment_id")]
- public int CommentId { get; internal set; }
+ [JsonPropertyName("comment_id")]
+ public int CommentId { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// edited
///
- [Field("edited")]
- public bool Edited { get; internal set; }
+ [JsonPropertyName("edited")]
+ public bool Edited { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// owner
///
- [Field("owner")]
- public ShallowUser Owner { get; internal set; }
+ [JsonPropertyName("owner")]
+ public ShallowUser Owner { get; init; }
///
/// post_id
///
- [Field("post_id")]
- public int PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int PostId { get; init; }
///
/// post_type
///
- [Field("post_type")]
- public Posts.PostType PostType { get; internal set; }
+ [JsonPropertyName("post_type")]
+ public Posts.PostType PostType { get; init; }
///
/// reply_to_user
///
- [Field("reply_to_user")]
- public ShallowUser ReplyToUser { get; internal set; }
+ [JsonPropertyName("reply_to_user")]
+ public ShallowUser ReplyToUser { get; init; }
///
/// score
///
- [Field("score")]
- public int Score { get; internal set; }
+ [JsonPropertyName("score")]
+ public int Score { get; init; }
}
}
diff --git a/StacMan/Codegen/Error.cs b/StacMan/Codegen/Error.cs
index a672250..44e213e 100644
--- a/StacMan/Codegen/Error.cs
+++ b/StacMan/Codegen/Error.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class Error : StacManType
///
/// description
///
- [Field("description")]
- public string Description { get; internal set; }
+ [JsonPropertyName("description")]
+ public string Description { get; init; }
///
/// error_id
///
- [Field("error_id")]
- public int ErrorId { get; internal set; }
+ [JsonPropertyName("error_id")]
+ public int ErrorId { get; init; }
///
/// error_name
///
- [Field("error_name")]
- public string ErrorName { get; internal set; }
+ [JsonPropertyName("error_name")]
+ public string ErrorName { get; init; }
}
}
diff --git a/StacMan/Codegen/Event.cs b/StacMan/Codegen/Event.cs
index 8ae3658..b952c13 100644
--- a/StacMan/Codegen/Event.cs
+++ b/StacMan/Codegen/Event.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,32 +18,32 @@ public partial class Event : StacManType
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// event_id
///
- [Field("event_id")]
- public int EventId { get; internal set; }
+ [JsonPropertyName("event_id")]
+ public int EventId { get; init; }
///
/// event_type
///
- [Field("event_type")]
- public Events.EventType EventType { get; internal set; }
+ [JsonPropertyName("event_type")]
+ public Events.EventType EventType { get; init; }
///
/// excerpt
///
- [Field("excerpt")]
- public string Excerpt { get; internal set; }
+ [JsonPropertyName("excerpt")]
+ public string Excerpt { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
}
}
diff --git a/StacMan/Codegen/Filter.cs b/StacMan/Codegen/Filter.cs
index a713cbe..ce700a3 100644
--- a/StacMan/Codegen/Filter.cs
+++ b/StacMan/Codegen/Filter.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class Filter : StacManType
///
/// filter
///
- [Field("filter")]
- public string FilterName { get; internal set; }
+ [JsonPropertyName("filter")]
+ public string FilterName { get; init; }
///
/// filter_type
///
- [Field("filter_type")]
- public Filters.FilterType FilterType { get; internal set; }
+ [JsonPropertyName("filter_type")]
+ public Filters.FilterType FilterType { get; init; }
///
/// included_fields
///
- [Field("included_fields")]
- public string[] IncludedFields { get; internal set; }
+ [JsonPropertyName("included_fields")]
+ public string[] IncludedFields { get; init; }
}
}
diff --git a/StacMan/Codegen/InboxItem.cs b/StacMan/Codegen/InboxItem.cs
index 4db8e1b..5e4fae8 100644
--- a/StacMan/Codegen/InboxItem.cs
+++ b/StacMan/Codegen/InboxItem.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,62 +18,62 @@ public partial class InboxItem : StacManType
///
/// answer_id
///
- [Field("answer_id")]
- public int? AnswerId { get; internal set; }
+ [JsonPropertyName("answer_id")]
+ public int? AnswerId { get; init; }
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// comment_id
///
- [Field("comment_id")]
- public int? CommentId { get; internal set; }
+ [JsonPropertyName("comment_id")]
+ public int? CommentId { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// is_unread
///
- [Field("is_unread")]
- public bool IsUnread { get; internal set; }
+ [JsonPropertyName("is_unread")]
+ public bool IsUnread { get; init; }
///
/// item_type
///
- [Field("item_type")]
- public InboxItems.ItemType ItemType { get; internal set; }
+ [JsonPropertyName("item_type")]
+ public InboxItems.ItemType ItemType { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// question_id
///
- [Field("question_id")]
- public int? QuestionId { get; internal set; }
+ [JsonPropertyName("question_id")]
+ public int? QuestionId { get; init; }
///
/// site
///
- [Field("site")]
- public Site Site { get; internal set; }
+ [JsonPropertyName("site")]
+ public Site Site { get; init; }
///
/// title
///
- [Field("title")]
- public string Title { get; internal set; }
+ [JsonPropertyName("title")]
+ public string Title { get; init; }
}
}
diff --git a/StacMan/Codegen/Info.cs b/StacMan/Codegen/Info.cs
index bce56f9..f89f9fc 100644
--- a/StacMan/Codegen/Info.cs
+++ b/StacMan/Codegen/Info.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,86 +18,86 @@ public partial class Info : StacManType
///
/// answers_per_minute
///
- [Field("answers_per_minute")]
- public decimal AnswersPerMinute { get; internal set; }
+ [JsonPropertyName("answers_per_minute")]
+ public decimal AnswersPerMinute { get; init; }
///
/// api_revision
///
- [Field("api_revision")]
- public string ApiRevision { get; internal set; }
+ [JsonPropertyName("api_revision")]
+ public string ApiRevision { get; init; }
///
/// badges_per_minute
///
- [Field("badges_per_minute")]
- public decimal BadgesPerMinute { get; internal set; }
+ [JsonPropertyName("badges_per_minute")]
+ public decimal BadgesPerMinute { get; init; }
///
/// new_active_users
///
- [Field("new_active_users")]
- public int NewActiveUsers { get; internal set; }
+ [JsonPropertyName("new_active_users")]
+ public int NewActiveUsers { get; init; }
///
/// questions_per_minute
///
- [Field("questions_per_minute")]
- public decimal QuestionsPerMinute { get; internal set; }
+ [JsonPropertyName("questions_per_minute")]
+ public decimal QuestionsPerMinute { get; init; }
///
/// site
///
- [Field("site")]
- public Site Site { get; internal set; }
+ [JsonPropertyName("site")]
+ public Site Site { get; init; }
///
/// total_accepted
///
- [Field("total_accepted")]
- public int TotalAccepted { get; internal set; }
+ [JsonPropertyName("total_accepted")]
+ public int TotalAccepted { get; init; }
///
/// total_answers
///
- [Field("total_answers")]
- public int TotalAnswers { get; internal set; }
+ [JsonPropertyName("total_answers")]
+ public int TotalAnswers { get; init; }
///
/// total_badges
///
- [Field("total_badges")]
- public int TotalBadges { get; internal set; }
+ [JsonPropertyName("total_badges")]
+ public int TotalBadges { get; init; }
///
/// total_comments
///
- [Field("total_comments")]
- public int TotalComments { get; internal set; }
+ [JsonPropertyName("total_comments")]
+ public int TotalComments { get; init; }
///
/// total_questions
///
- [Field("total_questions")]
- public int TotalQuestions { get; internal set; }
+ [JsonPropertyName("total_questions")]
+ public int TotalQuestions { get; init; }
///
/// total_unanswered
///
- [Field("total_unanswered")]
- public int TotalUnanswered { get; internal set; }
+ [JsonPropertyName("total_unanswered")]
+ public int TotalUnanswered { get; init; }
///
/// total_users
///
- [Field("total_users")]
- public int TotalUsers { get; internal set; }
+ [JsonPropertyName("total_users")]
+ public int TotalUsers { get; init; }
///
/// total_votes
///
- [Field("total_votes")]
- public int TotalVotes { get; internal set; }
+ [JsonPropertyName("total_votes")]
+ public int TotalVotes { get; init; }
}
}
diff --git a/StacMan/Codegen/Manager.ttinclude b/StacMan/Codegen/Manager.ttinclude
index b057f20..190cb12 100644
--- a/StacMan/Codegen/Manager.ttinclude
+++ b/StacMan/Codegen/Manager.ttinclude
@@ -3,24 +3,21 @@ Manager by Damien Guard
http://damieng.com/blog/2009/11/06/multiple-outputs-from-t4-made-easy-revisited
*/ #>
-<#@ assembly name="System.Core"
-#><#@ assembly name="System.Data.Linq"
-#><#@ assembly name="EnvDTE"
-#><#@ assembly name="System.Xml"
-#><#@ assembly name="System.Xml.Linq"
-#><#@ import namespace="System"
-#><#@ import namespace="System.CodeDom"
-#><#@ import namespace="System.CodeDom.Compiler"
-#><#@ import namespace="System.Collections.Generic"
-#><#@ import namespace="System.Data.Linq"
-#><#@ import namespace="System.Data.Linq.Mapping"
-#><#@ import namespace="System.IO"
-#><#@ import namespace="System.Linq"
-#><#@ import namespace="System.Reflection"
-#><#@ import namespace="System.Text"
-#><#@ import namespace="System.Xml.Linq"
-#><#@ import namespace="Microsoft.VisualStudio.TextTemplating"
-#><#+
+<#@ assembly name="System.Collections"#>
+<#@ assembly name="System.Core"#>
+<#@ assembly name="System.Data.Linq"#>
+<#@ assembly name="System.Linq"#>
+<#@ assembly name="System.Xml"#>
+<#@ assembly name="System.Xml.Linq"#>
+<#@ assembly name="EnvDTE"#>
+<#@ import namespace="System"#>
+<#@ import namespace="System.Collections.Generic"#>
+<#@ import namespace="System.IO"#>
+<#@ import namespace="System.Linq"#>
+<#@ import namespace="System.Text"#>
+<#@ import namespace="EnvDTE"#>
+<#@ import namespace="Microsoft.VisualStudio.TextTemplating"#>
+<#+
// Manager class records the various blocks so it can split them up
class Manager {
@@ -160,9 +157,9 @@ class Manager {
private static void ProjectSync(EnvDTE.ProjectItem templateProjectItem, IEnumerable keepFileNames) {
var keepFileNameSet = new HashSet(keepFileNames);
var projectFiles = new Dictionary();
- var originalFilePrefix = Path.GetFileNameWithoutExtension(templateProjectItem.get_FileNames(0)) + ".";
+ var originalFilePrefix = Path.GetFileNameWithoutExtension(templateProjectItem.FileNames[0]) + ".";
foreach(EnvDTE.ProjectItem projectItem in templateProjectItem.ProjectItems)
- projectFiles.Add(projectItem.get_FileNames(0), projectItem);
+ projectFiles.Add(projectItem.FileNames[0], projectItem);
// Remove unused items from the project
foreach(var pair in projectFiles)
diff --git a/StacMan/Codegen/Methods.ignore b/StacMan/Codegen/Methods.ignore
index a91d157..ad59949 100644
--- a/StacMan/Codegen/Methods.ignore
+++ b/StacMan/Codegen/Methods.ignore
@@ -1,4 +1,5 @@
+
//
// This file was generated by a T4 template.
// Don't change it directly as your change would get overwritten. Instead, make changes
diff --git a/StacMan/Codegen/Methods.tt b/StacMan/Codegen/Methods.tt
index 212e7f5..01d8196 100644
--- a/StacMan/Codegen/Methods.tt
+++ b/StacMan/Codegen/Methods.tt
@@ -1,18 +1,12 @@
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ include file="Manager.ttinclude" #>
-<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web.Extensions" #>
<#@ assembly name="Microsoft.VisualStudio.Shell.Interop.8.0" #>
-<#@ assembly name="EnvDTE" #>
<#@ assembly name="EnvDTE80" #>
<#@ output extension=".ignore" #>
-<#@ import namespace="System.Collections.Generic" #>
-<#@ import namespace="System.IO" #>
-<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="System.Web.Script.Serialization" #>
<#@ import namespace="Microsoft.VisualStudio.Shell.Interop" #>
-<#@ import namespace="EnvDTE" #>
<#@ import namespace="EnvDTE80" #>
<# // To debug, uncomment the next two lines
// System.Diagnostics.Debugger.Launch();
@@ -326,7 +320,7 @@ IEnumerable GetSortParameters(string sortName)
sortTypeNames.Add(sortTypeArg.Value);
}
}
-
+
return sortTypeNames.SelectMany(n => new Parameter[]
{
new Parameter(GetSortMinParameterName(n), GetSortParameterType(n)),
diff --git a/StacMan/Codegen/MigrationInfo.cs b/StacMan/Codegen/MigrationInfo.cs
index ededced..6683f1c 100644
--- a/StacMan/Codegen/MigrationInfo.cs
+++ b/StacMan/Codegen/MigrationInfo.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class MigrationInfo : StacManType
///
/// on_date
///
- [Field("on_date")]
- public DateTime OnDate { get; internal set; }
+ [JsonPropertyName("on_date")]
+ public DateTime OnDate { get; init; }
///
/// other_site
///
- [Field("other_site")]
- public Site OtherSite { get; internal set; }
+ [JsonPropertyName("other_site")]
+ public Site OtherSite { get; init; }
///
/// question_id
///
- [Field("question_id")]
- public int QuestionId { get; internal set; }
+ [JsonPropertyName("question_id")]
+ public int QuestionId { get; init; }
}
}
diff --git a/StacMan/Codegen/NetworkUser.cs b/StacMan/Codegen/NetworkUser.cs
index e0206e8..35a3572 100644
--- a/StacMan/Codegen/NetworkUser.cs
+++ b/StacMan/Codegen/NetworkUser.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,68 +18,68 @@ public partial class NetworkUser : StacManType
///
/// account_id
///
- [Field("account_id")]
- public int AccountId { get; internal set; }
+ [JsonPropertyName("account_id")]
+ public int AccountId { get; init; }
///
/// answer_count
///
- [Field("answer_count")]
- public int AnswerCount { get; internal set; }
+ [JsonPropertyName("answer_count")]
+ public int AnswerCount { get; init; }
///
/// badge_counts
///
- [Field("badge_counts")]
- public BadgeCount BadgeCounts { get; internal set; }
+ [JsonPropertyName("badge_counts")]
+ public BadgeCount BadgeCounts { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// last_access_date
///
- [Field("last_access_date")]
- public DateTime LastAccessDate { get; internal set; }
+ [JsonPropertyName("last_access_date")]
+ public DateTime LastAccessDate { get; init; }
///
/// question_count
///
- [Field("question_count")]
- public int QuestionCount { get; internal set; }
+ [JsonPropertyName("question_count")]
+ public int QuestionCount { get; init; }
///
/// reputation
///
- [Field("reputation")]
- public int Reputation { get; internal set; }
+ [JsonPropertyName("reputation")]
+ public int Reputation { get; init; }
///
/// site_name
///
- [Field("site_name")]
- public string SiteName { get; internal set; }
+ [JsonPropertyName("site_name")]
+ public string SiteName { get; init; }
///
/// site_url
///
- [Field("site_url")]
- public string SiteUrl { get; internal set; }
+ [JsonPropertyName("site_url")]
+ public string SiteUrl { get; init; }
///
/// user_id
///
- [Field("user_id")]
- public int UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int UserId { get; init; }
///
/// user_type
///
- [Field("user_type")]
- public Users.UserType UserType { get; internal set; }
+ [JsonPropertyName("user_type")]
+ public Users.UserType UserType { get; init; }
}
}
diff --git a/StacMan/Codegen/Notice.cs b/StacMan/Codegen/Notice.cs
index 791c3a2..a8bbe14 100644
--- a/StacMan/Codegen/Notice.cs
+++ b/StacMan/Codegen/Notice.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class Notice : StacManType
///
/// body -- introduced in API version 2.1
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// creation_date -- introduced in API version 2.1
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// owner_user_id -- introduced in API version 2.1
///
- [Field("owner_user_id")]
- public int OwnerUserId { get; internal set; }
+ [JsonPropertyName("owner_user_id")]
+ public int OwnerUserId { get; init; }
}
}
diff --git a/StacMan/Codegen/Notification.cs b/StacMan/Codegen/Notification.cs
index ddf828f..d8ce666 100644
--- a/StacMan/Codegen/Notification.cs
+++ b/StacMan/Codegen/Notification.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,38 +18,38 @@ public partial class Notification : StacManType
///
/// body -- introduced in API version 2.1
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// creation_date -- introduced in API version 2.1
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// is_unread -- introduced in API version 2.1
///
- [Field("is_unread")]
- public bool IsUnread { get; internal set; }
+ [JsonPropertyName("is_unread")]
+ public bool IsUnread { get; init; }
///
/// notification_type -- introduced in API version 2.1
///
- [Field("notification_type")]
- public Notifications.NotificationType NotificationType { get; internal set; }
+ [JsonPropertyName("notification_type")]
+ public Notifications.NotificationType NotificationType { get; init; }
///
/// post_id -- introduced in API version 2.1
///
- [Field("post_id")]
- public int? PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int? PostId { get; init; }
///
/// site -- introduced in API version 2.1
///
- [Field("site")]
- public Site Site { get; internal set; }
+ [JsonPropertyName("site")]
+ public Site Site { get; init; }
}
}
diff --git a/StacMan/Codegen/Post.cs b/StacMan/Codegen/Post.cs
index 6edec02..65ebfe8 100644
--- a/StacMan/Codegen/Post.cs
+++ b/StacMan/Codegen/Post.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,74 +18,74 @@ public partial class Post : StacManType
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// comments
///
- [Field("comments")]
- public Comment[] Comments { get; internal set; }
+ [JsonPropertyName("comments")]
+ public Comment[] Comments { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// down_vote_count
///
- [Field("down_vote_count")]
- public int DownVoteCount { get; internal set; }
+ [JsonPropertyName("down_vote_count")]
+ public int DownVoteCount { get; init; }
///
/// last_activity_date
///
- [Field("last_activity_date")]
- public DateTime LastActivityDate { get; internal set; }
+ [JsonPropertyName("last_activity_date")]
+ public DateTime LastActivityDate { get; init; }
///
/// last_edit_date
///
- [Field("last_edit_date")]
- public DateTime? LastEditDate { get; internal set; }
+ [JsonPropertyName("last_edit_date")]
+ public DateTime? LastEditDate { get; init; }
///
/// link -- introduced in API version 2.1
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// owner
///
- [Field("owner")]
- public ShallowUser Owner { get; internal set; }
+ [JsonPropertyName("owner")]
+ public ShallowUser Owner { get; init; }
///
/// post_id
///
- [Field("post_id")]
- public int PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int PostId { get; init; }
///
/// post_type
///
- [Field("post_type")]
- public Posts.PostType PostType { get; internal set; }
+ [JsonPropertyName("post_type")]
+ public Posts.PostType PostType { get; init; }
///
/// score
///
- [Field("score")]
- public int Score { get; internal set; }
+ [JsonPropertyName("score")]
+ public int Score { get; init; }
///
/// up_vote_count
///
- [Field("up_vote_count")]
- public int UpVoteCount { get; internal set; }
+ [JsonPropertyName("up_vote_count")]
+ public int UpVoteCount { get; init; }
}
}
diff --git a/StacMan/Codegen/Privilege.cs b/StacMan/Codegen/Privilege.cs
index 87fd455..4a2198b 100644
--- a/StacMan/Codegen/Privilege.cs
+++ b/StacMan/Codegen/Privilege.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class Privilege : StacManType
///
/// description
///
- [Field("description")]
- public string Description { get; internal set; }
+ [JsonPropertyName("description")]
+ public string Description { get; init; }
///
/// reputation
///
- [Field("reputation")]
- public int Reputation { get; internal set; }
+ [JsonPropertyName("reputation")]
+ public int Reputation { get; init; }
///
/// short_description
///
- [Field("short_description")]
- public string ShortDescription { get; internal set; }
+ [JsonPropertyName("short_description")]
+ public string ShortDescription { get; init; }
}
}
diff --git a/StacMan/Codegen/Question.cs b/StacMan/Codegen/Question.cs
index ae54436..314778d 100644
--- a/StacMan/Codegen/Question.cs
+++ b/StacMan/Codegen/Question.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,194 +18,194 @@ public partial class Question : StacManType
///
/// accepted_answer_id
///
- [Field("accepted_answer_id")]
- public int? AcceptedAnswerId { get; internal set; }
+ [JsonPropertyName("accepted_answer_id")]
+ public int? AcceptedAnswerId { get; init; }
///
/// answer_count
///
- [Field("answer_count")]
- public int AnswerCount { get; internal set; }
+ [JsonPropertyName("answer_count")]
+ public int AnswerCount { get; init; }
///
/// answers
///
- [Field("answers")]
- public Answer[] Answers { get; internal set; }
+ [JsonPropertyName("answers")]
+ public Answer[] Answers { get; init; }
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// bounty_amount
///
- [Field("bounty_amount")]
- public int? BountyAmount { get; internal set; }
+ [JsonPropertyName("bounty_amount")]
+ public int? BountyAmount { get; init; }
///
/// bounty_closes_date
///
- [Field("bounty_closes_date")]
- public DateTime? BountyClosesDate { get; internal set; }
+ [JsonPropertyName("bounty_closes_date")]
+ public DateTime? BountyClosesDate { get; init; }
///
/// close_vote_count -- introduced in API version 2.1
///
- [Field("close_vote_count")]
- public int CloseVoteCount { get; internal set; }
+ [JsonPropertyName("close_vote_count")]
+ public int CloseVoteCount { get; init; }
///
/// closed_date
///
- [Field("closed_date")]
- public DateTime? ClosedDate { get; internal set; }
+ [JsonPropertyName("closed_date")]
+ public DateTime? ClosedDate { get; init; }
///
/// closed_reason
///
- [Field("closed_reason")]
- public string ClosedReason { get; internal set; }
+ [JsonPropertyName("closed_reason")]
+ public string ClosedReason { get; init; }
///
/// comments
///
- [Field("comments")]
- public Comment[] Comments { get; internal set; }
+ [JsonPropertyName("comments")]
+ public Comment[] Comments { get; init; }
///
/// community_owned_date
///
- [Field("community_owned_date")]
- public DateTime? CommunityOwnedDate { get; internal set; }
+ [JsonPropertyName("community_owned_date")]
+ public DateTime? CommunityOwnedDate { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// delete_vote_count -- introduced in API version 2.1
///
- [Field("delete_vote_count")]
- public int DeleteVoteCount { get; internal set; }
+ [JsonPropertyName("delete_vote_count")]
+ public int DeleteVoteCount { get; init; }
///
/// down_vote_count
///
- [Field("down_vote_count")]
- public int DownVoteCount { get; internal set; }
+ [JsonPropertyName("down_vote_count")]
+ public int DownVoteCount { get; init; }
///
/// favorite_count
///
- [Field("favorite_count")]
- public int FavoriteCount { get; internal set; }
+ [JsonPropertyName("favorite_count")]
+ public int FavoriteCount { get; init; }
///
/// is_answered
///
- [Field("is_answered")]
- public bool IsAnswered { get; internal set; }
+ [JsonPropertyName("is_answered")]
+ public bool IsAnswered { get; init; }
///
/// last_activity_date
///
- [Field("last_activity_date")]
- public DateTime LastActivityDate { get; internal set; }
+ [JsonPropertyName("last_activity_date")]
+ public DateTime LastActivityDate { get; init; }
///
/// last_edit_date
///
- [Field("last_edit_date")]
- public DateTime? LastEditDate { get; internal set; }
+ [JsonPropertyName("last_edit_date")]
+ public DateTime? LastEditDate { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// locked_date
///
- [Field("locked_date")]
- public DateTime? LockedDate { get; internal set; }
+ [JsonPropertyName("locked_date")]
+ public DateTime? LockedDate { get; init; }
///
/// migrated_from
///
- [Field("migrated_from")]
- public MigrationInfo MigratedFrom { get; internal set; }
+ [JsonPropertyName("migrated_from")]
+ public MigrationInfo MigratedFrom { get; init; }
///
/// migrated_to
///
- [Field("migrated_to")]
- public MigrationInfo MigratedTo { get; internal set; }
+ [JsonPropertyName("migrated_to")]
+ public MigrationInfo MigratedTo { get; init; }
///
/// notice -- introduced in API version 2.1
///
- [Field("notice")]
- public Notice Notice { get; internal set; }
+ [JsonPropertyName("notice")]
+ public Notice Notice { get; init; }
///
/// owner
///
- [Field("owner")]
- public ShallowUser Owner { get; internal set; }
+ [JsonPropertyName("owner")]
+ public ShallowUser Owner { get; init; }
///
/// protected_date
///
- [Field("protected_date")]
- public DateTime? ProtectedDate { get; internal set; }
+ [JsonPropertyName("protected_date")]
+ public DateTime? ProtectedDate { get; init; }
///
/// question_id
///
- [Field("question_id")]
- public int QuestionId { get; internal set; }
+ [JsonPropertyName("question_id")]
+ public int QuestionId { get; init; }
///
/// reopen_vote_count -- introduced in API version 2.1
///
- [Field("reopen_vote_count")]
- public int ReopenVoteCount { get; internal set; }
+ [JsonPropertyName("reopen_vote_count")]
+ public int ReopenVoteCount { get; init; }
///
/// score
///
- [Field("score")]
- public int Score { get; internal set; }
+ [JsonPropertyName("score")]
+ public int Score { get; init; }
///
/// tags
///
- [Field("tags")]
- public string[] Tags { get; internal set; }
+ [JsonPropertyName("tags")]
+ public string[] Tags { get; init; }
///
/// title
///
- [Field("title")]
- public string Title { get; internal set; }
+ [JsonPropertyName("title")]
+ public string Title { get; init; }
///
/// up_vote_count
///
- [Field("up_vote_count")]
- public int UpVoteCount { get; internal set; }
+ [JsonPropertyName("up_vote_count")]
+ public int UpVoteCount { get; init; }
///
/// view_count
///
- [Field("view_count")]
- public int ViewCount { get; internal set; }
+ [JsonPropertyName("view_count")]
+ public int ViewCount { get; init; }
}
}
diff --git a/StacMan/Codegen/QuestionTimeline.cs b/StacMan/Codegen/QuestionTimeline.cs
index 1fbc338..1d9de6f 100644
--- a/StacMan/Codegen/QuestionTimeline.cs
+++ b/StacMan/Codegen/QuestionTimeline.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,62 +18,62 @@ public partial class QuestionTimeline : StacManType
///
/// comment_id
///
- [Field("comment_id")]
- public int? CommentId { get; internal set; }
+ [JsonPropertyName("comment_id")]
+ public int? CommentId { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// down_vote_count
///
- [Field("down_vote_count")]
- public int? DownVoteCount { get; internal set; }
+ [JsonPropertyName("down_vote_count")]
+ public int? DownVoteCount { get; init; }
///
/// owner
///
- [Field("owner")]
- public ShallowUser Owner { get; internal set; }
+ [JsonPropertyName("owner")]
+ public ShallowUser Owner { get; init; }
///
/// post_id
///
- [Field("post_id")]
- public int? PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int? PostId { get; init; }
///
/// question_id
///
- [Field("question_id")]
- public int QuestionId { get; internal set; }
+ [JsonPropertyName("question_id")]
+ public int QuestionId { get; init; }
///
/// revision_guid
///
- [Field("revision_guid")]
- public Guid? RevisionGuid { get; internal set; }
+ [JsonPropertyName("revision_guid")]
+ public Guid? RevisionGuid { get; init; }
///
/// timeline_type
///
- [Field("timeline_type")]
- public QuestionTimelines.TimelineType TimelineType { get; internal set; }
+ [JsonPropertyName("timeline_type")]
+ public QuestionTimelines.TimelineType TimelineType { get; init; }
///
/// up_vote_count
///
- [Field("up_vote_count")]
- public int? UpVoteCount { get; internal set; }
+ [JsonPropertyName("up_vote_count")]
+ public int? UpVoteCount { get; init; }
///
/// user
///
- [Field("user")]
- public ShallowUser User { get; internal set; }
+ [JsonPropertyName("user")]
+ public ShallowUser User { get; init; }
}
}
diff --git a/StacMan/Codegen/RelatedSite.cs b/StacMan/Codegen/RelatedSite.cs
index 2d20d97..a3bccbd 100644
--- a/StacMan/Codegen/RelatedSite.cs
+++ b/StacMan/Codegen/RelatedSite.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,26 +18,26 @@ public partial class RelatedSite : StacManType
///
/// api_site_parameter
///
- [Field("api_site_parameter")]
- public string ApiSiteParameter { get; internal set; }
+ [JsonPropertyName("api_site_parameter")]
+ public string ApiSiteParameter { get; init; }
///
/// name
///
- [Field("name")]
- public string Name { get; internal set; }
+ [JsonPropertyName("name")]
+ public string Name { get; init; }
///
/// relation
///
- [Field("relation")]
- public string Relation { get; internal set; }
+ [JsonPropertyName("relation")]
+ public string Relation { get; init; }
///
/// site_url
///
- [Field("site_url")]
- public string SiteUrl { get; internal set; }
+ [JsonPropertyName("site_url")]
+ public string SiteUrl { get; init; }
}
}
diff --git a/StacMan/Codegen/Reputation.cs b/StacMan/Codegen/Reputation.cs
index 609338d..6394540 100644
--- a/StacMan/Codegen/Reputation.cs
+++ b/StacMan/Codegen/Reputation.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,50 +18,50 @@ public partial class Reputation : StacManType
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// on_date
///
- [Field("on_date")]
- public DateTime OnDate { get; internal set; }
+ [JsonPropertyName("on_date")]
+ public DateTime OnDate { get; init; }
///
/// post_id
///
- [Field("post_id")]
- public int PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int PostId { get; init; }
///
/// post_type
///
- [Field("post_type")]
- public Posts.PostType PostType { get; internal set; }
+ [JsonPropertyName("post_type")]
+ public Posts.PostType PostType { get; init; }
///
/// reputation_change
///
- [Field("reputation_change")]
- public int ReputationChange { get; internal set; }
+ [JsonPropertyName("reputation_change")]
+ public int ReputationChange { get; init; }
///
/// title
///
- [Field("title")]
- public string Title { get; internal set; }
+ [JsonPropertyName("title")]
+ public string Title { get; init; }
///
/// user_id
///
- [Field("user_id")]
- public int UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int UserId { get; init; }
///
/// vote_type
///
- [Field("vote_type")]
- public Reputations.VoteType VoteType { get; internal set; }
+ [JsonPropertyName("vote_type")]
+ public Reputations.VoteType VoteType { get; init; }
}
}
diff --git a/StacMan/Codegen/ReputationHistory.cs b/StacMan/Codegen/ReputationHistory.cs
index c0004e1..ec2a1e2 100644
--- a/StacMan/Codegen/ReputationHistory.cs
+++ b/StacMan/Codegen/ReputationHistory.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,32 +18,32 @@ public partial class ReputationHistory : StacManType
///
/// creation_date -- introduced in API version 2.1
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// post_id -- introduced in API version 2.1
///
- [Field("post_id")]
- public int? PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int? PostId { get; init; }
///
/// reputation_change -- introduced in API version 2.1
///
- [Field("reputation_change")]
- public int ReputationChange { get; internal set; }
+ [JsonPropertyName("reputation_change")]
+ public int ReputationChange { get; init; }
///
/// reputation_history_type -- introduced in API version 2.1
///
- [Field("reputation_history_type")]
- public ReputationHistories.ReputationHistoryType ReputationHistoryType { get; internal set; }
+ [JsonPropertyName("reputation_history_type")]
+ public ReputationHistories.ReputationHistoryType ReputationHistoryType { get; init; }
///
/// user_id -- introduced in API version 2.1
///
- [Field("user_id")]
- public int UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int UserId { get; init; }
}
}
diff --git a/StacMan/Codegen/Revision.cs b/StacMan/Codegen/Revision.cs
index 2716c74..d14bf25 100644
--- a/StacMan/Codegen/Revision.cs
+++ b/StacMan/Codegen/Revision.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,98 +18,98 @@ public partial class Revision : StacManType
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// comment
///
- [Field("comment")]
- public string Comment { get; internal set; }
+ [JsonPropertyName("comment")]
+ public string Comment { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// is_rollback
///
- [Field("is_rollback")]
- public bool IsRollback { get; internal set; }
+ [JsonPropertyName("is_rollback")]
+ public bool IsRollback { get; init; }
///
/// last_body
///
- [Field("last_body")]
- public string LastBody { get; internal set; }
+ [JsonPropertyName("last_body")]
+ public string LastBody { get; init; }
///
/// last_tags
///
- [Field("last_tags")]
- public string[] LastTags { get; internal set; }
+ [JsonPropertyName("last_tags")]
+ public string[] LastTags { get; init; }
///
/// last_title
///
- [Field("last_title")]
- public string LastTitle { get; internal set; }
+ [JsonPropertyName("last_title")]
+ public string LastTitle { get; init; }
///
/// post_id
///
- [Field("post_id")]
- public int PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int PostId { get; init; }
///
/// post_type
///
- [Field("post_type")]
- public Posts.PostType PostType { get; internal set; }
+ [JsonPropertyName("post_type")]
+ public Posts.PostType PostType { get; init; }
///
/// revision_guid
///
- [Field("revision_guid")]
- public Guid RevisionGuid { get; internal set; }
+ [JsonPropertyName("revision_guid")]
+ public Guid RevisionGuid { get; init; }
///
/// revision_number
///
- [Field("revision_number")]
- public int RevisionNumber { get; internal set; }
+ [JsonPropertyName("revision_number")]
+ public int RevisionNumber { get; init; }
///
/// revision_type
///
- [Field("revision_type")]
- public Revisions.RevisionType RevisionType { get; internal set; }
+ [JsonPropertyName("revision_type")]
+ public Revisions.RevisionType RevisionType { get; init; }
///
/// set_community_wiki
///
- [Field("set_community_wiki")]
- public bool SetCommunityWiki { get; internal set; }
+ [JsonPropertyName("set_community_wiki")]
+ public bool SetCommunityWiki { get; init; }
///
/// tags
///
- [Field("tags")]
- public string[] Tags { get; internal set; }
+ [JsonPropertyName("tags")]
+ public string[] Tags { get; init; }
///
/// title
///
- [Field("title")]
- public string Title { get; internal set; }
+ [JsonPropertyName("title")]
+ public string Title { get; init; }
///
/// user
///
- [Field("user")]
- public ShallowUser User { get; internal set; }
+ [JsonPropertyName("user")]
+ public ShallowUser User { get; init; }
}
}
diff --git a/StacMan/Codegen/ShallowUser.cs b/StacMan/Codegen/ShallowUser.cs
index c6f3ac9..8a1e47d 100644
--- a/StacMan/Codegen/ShallowUser.cs
+++ b/StacMan/Codegen/ShallowUser.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,44 +18,44 @@ public partial class ShallowUser : StacManType
///
/// accept_rate
///
- [Field("accept_rate")]
- public int? AcceptRate { get; internal set; }
+ [JsonPropertyName("accept_rate")]
+ public int? AcceptRate { get; init; }
///
/// display_name
///
- [Field("display_name")]
- public string DisplayName { get; internal set; }
+ [JsonPropertyName("display_name")]
+ public string DisplayName { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// profile_image
///
- [Field("profile_image")]
- public string ProfileImage { get; internal set; }
+ [JsonPropertyName("profile_image")]
+ public string ProfileImage { get; init; }
///
/// reputation
///
- [Field("reputation")]
- public int? Reputation { get; internal set; }
+ [JsonPropertyName("reputation")]
+ public int? Reputation { get; init; }
///
/// user_id
///
- [Field("user_id")]
- public int? UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int? UserId { get; init; }
///
/// user_type
///
- [Field("user_type")]
- public Users.UserType UserType { get; internal set; }
+ [JsonPropertyName("user_type")]
+ public Users.UserType UserType { get; init; }
}
}
diff --git a/StacMan/Codegen/Site.cs b/StacMan/Codegen/Site.cs
index bdd5e51..39b50ce 100644
--- a/StacMan/Codegen/Site.cs
+++ b/StacMan/Codegen/Site.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,110 +18,110 @@ public partial class Site : StacManType
///
/// aliases
///
- [Field("aliases")]
- public string[] Aliases { get; internal set; }
+ [JsonPropertyName("aliases")]
+ public string[] Aliases { get; init; }
///
/// api_site_parameter
///
- [Field("api_site_parameter")]
- public string ApiSiteParameter { get; internal set; }
+ [JsonPropertyName("api_site_parameter")]
+ public string ApiSiteParameter { get; init; }
///
/// audience
///
- [Field("audience")]
- public string Audience { get; internal set; }
+ [JsonPropertyName("audience")]
+ public string Audience { get; init; }
///
/// closed_beta_date
///
- [Field("closed_beta_date")]
- public DateTime? ClosedBetaDate { get; internal set; }
+ [JsonPropertyName("closed_beta_date")]
+ public DateTime? ClosedBetaDate { get; init; }
///
/// favicon_url
///
- [Field("favicon_url")]
- public string FaviconUrl { get; internal set; }
+ [JsonPropertyName("favicon_url")]
+ public string FaviconUrl { get; init; }
///
/// high_resolution_icon_url -- introduced in API version 2.1
///
- [Field("high_resolution_icon_url")]
- public string HighResolutionIconUrl { get; internal set; }
+ [JsonPropertyName("high_resolution_icon_url")]
+ public string HighResolutionIconUrl { get; init; }
///
/// icon_url
///
- [Field("icon_url")]
- public string IconUrl { get; internal set; }
+ [JsonPropertyName("icon_url")]
+ public string IconUrl { get; init; }
///
/// launch_date
///
- [Field("launch_date")]
- public DateTime LaunchDate { get; internal set; }
+ [JsonPropertyName("launch_date")]
+ public DateTime LaunchDate { get; init; }
///
/// logo_url
///
- [Field("logo_url")]
- public string LogoUrl { get; internal set; }
+ [JsonPropertyName("logo_url")]
+ public string LogoUrl { get; init; }
///
/// markdown_extensions
///
- [Field("markdown_extensions")]
- public string[] MarkdownExtensions { get; internal set; }
+ [JsonPropertyName("markdown_extensions")]
+ public string[] MarkdownExtensions { get; init; }
///
/// name
///
- [Field("name")]
- public string Name { get; internal set; }
+ [JsonPropertyName("name")]
+ public string Name { get; init; }
///
/// open_beta_date
///
- [Field("open_beta_date")]
- public DateTime? OpenBetaDate { get; internal set; }
+ [JsonPropertyName("open_beta_date")]
+ public DateTime? OpenBetaDate { get; init; }
///
/// related_sites
///
- [Field("related_sites")]
- public RelatedSite[] RelatedSites { get; internal set; }
+ [JsonPropertyName("related_sites")]
+ public RelatedSite[] RelatedSites { get; init; }
///
/// site_state
///
- [Field("site_state")]
- public Sites.SiteState SiteState { get; internal set; }
+ [JsonPropertyName("site_state")]
+ public Sites.SiteState SiteState { get; init; }
///
/// site_type
///
- [Field("site_type")]
- public string SiteType { get; internal set; }
+ [JsonPropertyName("site_type")]
+ public string SiteType { get; init; }
///
/// site_url
///
- [Field("site_url")]
- public string SiteUrl { get; internal set; }
+ [JsonPropertyName("site_url")]
+ public string SiteUrl { get; init; }
///
/// styling
///
- [Field("styling")]
- public Styling Styling { get; internal set; }
+ [JsonPropertyName("styling")]
+ public Styling Styling { get; init; }
///
/// twitter_account
///
- [Field("twitter_account")]
- public string TwitterAccount { get; internal set; }
+ [JsonPropertyName("twitter_account")]
+ public string TwitterAccount { get; init; }
}
}
diff --git a/StacMan/Codegen/Styling.cs b/StacMan/Codegen/Styling.cs
index 894d54e..d1588cb 100644
--- a/StacMan/Codegen/Styling.cs
+++ b/StacMan/Codegen/Styling.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class Styling : StacManType
///
/// link_color
///
- [Field("link_color")]
- public string LinkColor { get; internal set; }
+ [JsonPropertyName("link_color")]
+ public string LinkColor { get; init; }
///
/// tag_background_color
///
- [Field("tag_background_color")]
- public string TagBackgroundColor { get; internal set; }
+ [JsonPropertyName("tag_background_color")]
+ public string TagBackgroundColor { get; init; }
///
/// tag_foreground_color
///
- [Field("tag_foreground_color")]
- public string TagForegroundColor { get; internal set; }
+ [JsonPropertyName("tag_foreground_color")]
+ public string TagForegroundColor { get; init; }
}
}
diff --git a/StacMan/Codegen/SuggestedEdit.cs b/StacMan/Codegen/SuggestedEdit.cs
index 531bff1..ff1eac3 100644
--- a/StacMan/Codegen/SuggestedEdit.cs
+++ b/StacMan/Codegen/SuggestedEdit.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,68 +18,68 @@ public partial class SuggestedEdit : StacManType
///
/// approval_date
///
- [Field("approval_date")]
- public DateTime? ApprovalDate { get; internal set; }
+ [JsonPropertyName("approval_date")]
+ public DateTime? ApprovalDate { get; init; }
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// comment
///
- [Field("comment")]
- public string Comment { get; internal set; }
+ [JsonPropertyName("comment")]
+ public string Comment { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// post_id
///
- [Field("post_id")]
- public int PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int PostId { get; init; }
///
/// post_type
///
- [Field("post_type")]
- public Posts.PostType PostType { get; internal set; }
+ [JsonPropertyName("post_type")]
+ public Posts.PostType PostType { get; init; }
///
/// proposing_user
///
- [Field("proposing_user")]
- public ShallowUser ProposingUser { get; internal set; }
+ [JsonPropertyName("proposing_user")]
+ public ShallowUser ProposingUser { get; init; }
///
/// rejection_date
///
- [Field("rejection_date")]
- public DateTime? RejectionDate { get; internal set; }
+ [JsonPropertyName("rejection_date")]
+ public DateTime? RejectionDate { get; init; }
///
/// suggested_edit_id
///
- [Field("suggested_edit_id")]
- public int SuggestedEditId { get; internal set; }
+ [JsonPropertyName("suggested_edit_id")]
+ public int SuggestedEditId { get; init; }
///
/// tags
///
- [Field("tags")]
- public string[] Tags { get; internal set; }
+ [JsonPropertyName("tags")]
+ public string[] Tags { get; init; }
///
/// title
///
- [Field("title")]
- public string Title { get; internal set; }
+ [JsonPropertyName("title")]
+ public string Title { get; init; }
}
}
diff --git a/StacMan/Codegen/Tag.cs b/StacMan/Codegen/Tag.cs
index bf4599b..3e386b7 100644
--- a/StacMan/Codegen/Tag.cs
+++ b/StacMan/Codegen/Tag.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,44 +18,44 @@ public partial class Tag : StacManType
///
/// count
///
- [Field("count")]
- public int Count { get; internal set; }
+ [JsonPropertyName("count")]
+ public int Count { get; init; }
///
/// has_synonyms
///
- [Field("has_synonyms")]
- public bool HasSynonyms { get; internal set; }
+ [JsonPropertyName("has_synonyms")]
+ public bool HasSynonyms { get; init; }
///
/// is_moderator_only
///
- [Field("is_moderator_only")]
- public bool IsModeratorOnly { get; internal set; }
+ [JsonPropertyName("is_moderator_only")]
+ public bool IsModeratorOnly { get; init; }
///
/// is_required
///
- [Field("is_required")]
- public bool IsRequired { get; internal set; }
+ [JsonPropertyName("is_required")]
+ public bool IsRequired { get; init; }
///
/// last_activity_date
///
- [Field("last_activity_date")]
- public DateTime? LastActivityDate { get; internal set; }
+ [JsonPropertyName("last_activity_date")]
+ public DateTime? LastActivityDate { get; init; }
///
/// name
///
- [Field("name")]
- public string Name { get; internal set; }
+ [JsonPropertyName("name")]
+ public string Name { get; init; }
///
/// user_id
///
- [Field("user_id")]
- public int? UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int? UserId { get; init; }
}
}
diff --git a/StacMan/Codegen/TagScore.cs b/StacMan/Codegen/TagScore.cs
index 5ac7eed..9dee87d 100644
--- a/StacMan/Codegen/TagScore.cs
+++ b/StacMan/Codegen/TagScore.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,20 +18,20 @@ public partial class TagScore : StacManType
///
/// post_count
///
- [Field("post_count")]
- public int PostCount { get; internal set; }
+ [JsonPropertyName("post_count")]
+ public int PostCount { get; init; }
///
/// score
///
- [Field("score")]
- public int Score { get; internal set; }
+ [JsonPropertyName("score")]
+ public int Score { get; init; }
///
/// user
///
- [Field("user")]
- public ShallowUser User { get; internal set; }
+ [JsonPropertyName("user")]
+ public ShallowUser User { get; init; }
}
}
diff --git a/StacMan/Codegen/TagSynonym.cs b/StacMan/Codegen/TagSynonym.cs
index 616ae19..bcb2acf 100644
--- a/StacMan/Codegen/TagSynonym.cs
+++ b/StacMan/Codegen/TagSynonym.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,32 +18,32 @@ public partial class TagSynonym : StacManType
///
/// applied_count
///
- [Field("applied_count")]
- public int AppliedCount { get; internal set; }
+ [JsonPropertyName("applied_count")]
+ public int AppliedCount { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// from_tag
///
- [Field("from_tag")]
- public string FromTag { get; internal set; }
+ [JsonPropertyName("from_tag")]
+ public string FromTag { get; init; }
///
/// last_applied_date
///
- [Field("last_applied_date")]
- public DateTime? LastAppliedDate { get; internal set; }
+ [JsonPropertyName("last_applied_date")]
+ public DateTime? LastAppliedDate { get; init; }
///
/// to_tag
///
- [Field("to_tag")]
- public string ToTag { get; internal set; }
+ [JsonPropertyName("to_tag")]
+ public string ToTag { get; init; }
}
}
diff --git a/StacMan/Codegen/TagWiki.cs b/StacMan/Codegen/TagWiki.cs
index dcc657d..85d6efe 100644
--- a/StacMan/Codegen/TagWiki.cs
+++ b/StacMan/Codegen/TagWiki.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,44 +18,44 @@ public partial class TagWiki : StacManType
///
/// body
///
- [Field("body")]
- public string Body { get; internal set; }
+ [JsonPropertyName("body")]
+ public string Body { get; init; }
///
/// body_last_edit_date
///
- [Field("body_last_edit_date")]
- public DateTime? BodyLastEditDate { get; internal set; }
+ [JsonPropertyName("body_last_edit_date")]
+ public DateTime? BodyLastEditDate { get; init; }
///
/// excerpt
///
- [Field("excerpt")]
- public string Excerpt { get; internal set; }
+ [JsonPropertyName("excerpt")]
+ public string Excerpt { get; init; }
///
/// excerpt_last_edit_date
///
- [Field("excerpt_last_edit_date")]
- public DateTime? ExcerptLastEditDate { get; internal set; }
+ [JsonPropertyName("excerpt_last_edit_date")]
+ public DateTime? ExcerptLastEditDate { get; init; }
///
/// last_body_editor
///
- [Field("last_body_editor")]
- public ShallowUser LastBodyEditor { get; internal set; }
+ [JsonPropertyName("last_body_editor")]
+ public ShallowUser LastBodyEditor { get; init; }
///
/// last_excerpt_editor
///
- [Field("last_excerpt_editor")]
- public ShallowUser LastExcerptEditor { get; internal set; }
+ [JsonPropertyName("last_excerpt_editor")]
+ public ShallowUser LastExcerptEditor { get; init; }
///
/// tag_name
///
- [Field("tag_name")]
- public string TagName { get; internal set; }
+ [JsonPropertyName("tag_name")]
+ public string TagName { get; init; }
}
}
diff --git a/StacMan/Codegen/TopTag.cs b/StacMan/Codegen/TopTag.cs
index 439e027..3d7f98d 100644
--- a/StacMan/Codegen/TopTag.cs
+++ b/StacMan/Codegen/TopTag.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,38 +18,38 @@ public partial class TopTag : StacManType
///
/// answer_count
///
- [Field("answer_count")]
- public int AnswerCount { get; internal set; }
+ [JsonPropertyName("answer_count")]
+ public int AnswerCount { get; init; }
///
/// answer_score
///
- [Field("answer_score")]
- public int AnswerScore { get; internal set; }
+ [JsonPropertyName("answer_score")]
+ public int AnswerScore { get; init; }
///
/// question_count
///
- [Field("question_count")]
- public int QuestionCount { get; internal set; }
+ [JsonPropertyName("question_count")]
+ public int QuestionCount { get; init; }
///
/// question_score
///
- [Field("question_score")]
- public int QuestionScore { get; internal set; }
+ [JsonPropertyName("question_score")]
+ public int QuestionScore { get; init; }
///
/// tag_name
///
- [Field("tag_name")]
- public string TagName { get; internal set; }
+ [JsonPropertyName("tag_name")]
+ public string TagName { get; init; }
///
/// user_id -- introduced in API version 2.1
///
- [Field("user_id")]
- public int UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int UserId { get; init; }
}
}
diff --git a/StacMan/Codegen/Types.ignore b/StacMan/Codegen/Types.ignore
index bfaaff9..73e90d2 100644
--- a/StacMan/Codegen/Types.ignore
+++ b/StacMan/Codegen/Types.ignore
@@ -1,4 +1,5 @@
-
+
+
//
// This file was generated by a T4 template.
// Don't change it directly as your change would get overwritten. Instead, make changes
diff --git a/StacMan/Codegen/Types.tt b/StacMan/Codegen/Types.tt
index a41ac28..9f02737 100644
--- a/StacMan/Codegen/Types.tt
+++ b/StacMan/Codegen/Types.tt
@@ -1,9 +1,7 @@
-<#@ template debug="true" hostspecific="true" language="C#" #>
+<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ include file="Manager.ttinclude" #>
<#@ assembly name="System.Web.Extensions" #>
<#@ output extension=".ignore" #>
-<#@ import namespace="System.IO" #>
-<#@ import namespace="System.Text" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="System.Web.Script.Serialization" #>
<# // To debug, uncomment the next two lines
@@ -33,6 +31,7 @@ foreach (var typeName in typesObj.Keys)
#>
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -68,8 +67,8 @@ namespace StackExchange.StacMan
///
/// <#= fieldName #><#= fieldMinApiVersion != "2.0" ? String.Format(" -- introduced in API version {0}", fieldMinApiVersion) : "" #>
///
- [Field("<#= fieldName #>")]
- public <#= propertyTypeName #> <#= propertyName #> { get; internal set; }
+ [JsonPropertyName("<#= fieldName #>")]
+ public <#= propertyTypeName #> <#= propertyName #> { get; init; }
<#
}
diff --git a/StacMan/Codegen/User.cs b/StacMan/Codegen/User.cs
index 409b004..2077007 100644
--- a/StacMan/Codegen/User.cs
+++ b/StacMan/Codegen/User.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,170 +18,170 @@ public partial class User : StacManType
///
/// about_me
///
- [Field("about_me")]
- public string AboutMe { get; internal set; }
+ [JsonPropertyName("about_me")]
+ public string AboutMe { get; init; }
///
/// accept_rate
///
- [Field("accept_rate")]
- public int? AcceptRate { get; internal set; }
+ [JsonPropertyName("accept_rate")]
+ public int? AcceptRate { get; init; }
///
/// account_id
///
- [Field("account_id")]
- public int AccountId { get; internal set; }
+ [JsonPropertyName("account_id")]
+ public int AccountId { get; init; }
///
/// age
///
- [Field("age")]
- public int? Age { get; internal set; }
+ [JsonPropertyName("age")]
+ public int? Age { get; init; }
///
/// answer_count
///
- [Field("answer_count")]
- public int AnswerCount { get; internal set; }
+ [JsonPropertyName("answer_count")]
+ public int AnswerCount { get; init; }
///
/// badge_counts
///
- [Field("badge_counts")]
- public BadgeCount BadgeCounts { get; internal set; }
+ [JsonPropertyName("badge_counts")]
+ public BadgeCount BadgeCounts { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// display_name
///
- [Field("display_name")]
- public string DisplayName { get; internal set; }
+ [JsonPropertyName("display_name")]
+ public string DisplayName { get; init; }
///
/// down_vote_count
///
- [Field("down_vote_count")]
- public int DownVoteCount { get; internal set; }
+ [JsonPropertyName("down_vote_count")]
+ public int DownVoteCount { get; init; }
///
/// is_employee
///
- [Field("is_employee")]
- public bool IsEmployee { get; internal set; }
+ [JsonPropertyName("is_employee")]
+ public bool IsEmployee { get; init; }
///
/// last_access_date
///
- [Field("last_access_date")]
- public DateTime LastAccessDate { get; internal set; }
+ [JsonPropertyName("last_access_date")]
+ public DateTime LastAccessDate { get; init; }
///
/// last_modified_date
///
- [Field("last_modified_date")]
- public DateTime? LastModifiedDate { get; internal set; }
+ [JsonPropertyName("last_modified_date")]
+ public DateTime? LastModifiedDate { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// location
///
- [Field("location")]
- public string Location { get; internal set; }
+ [JsonPropertyName("location")]
+ public string Location { get; init; }
///
/// profile_image
///
- [Field("profile_image")]
- public string ProfileImage { get; internal set; }
+ [JsonPropertyName("profile_image")]
+ public string ProfileImage { get; init; }
///
/// question_count
///
- [Field("question_count")]
- public int QuestionCount { get; internal set; }
+ [JsonPropertyName("question_count")]
+ public int QuestionCount { get; init; }
///
/// reputation
///
- [Field("reputation")]
- public int Reputation { get; internal set; }
+ [JsonPropertyName("reputation")]
+ public int Reputation { get; init; }
///
/// reputation_change_day
///
- [Field("reputation_change_day")]
- public int ReputationChangeDay { get; internal set; }
+ [JsonPropertyName("reputation_change_day")]
+ public int ReputationChangeDay { get; init; }
///
/// reputation_change_month
///
- [Field("reputation_change_month")]
- public int ReputationChangeMonth { get; internal set; }
+ [JsonPropertyName("reputation_change_month")]
+ public int ReputationChangeMonth { get; init; }
///
/// reputation_change_quarter
///
- [Field("reputation_change_quarter")]
- public int ReputationChangeQuarter { get; internal set; }
+ [JsonPropertyName("reputation_change_quarter")]
+ public int ReputationChangeQuarter { get; init; }
///
/// reputation_change_week
///
- [Field("reputation_change_week")]
- public int ReputationChangeWeek { get; internal set; }
+ [JsonPropertyName("reputation_change_week")]
+ public int ReputationChangeWeek { get; init; }
///
/// reputation_change_year
///
- [Field("reputation_change_year")]
- public int ReputationChangeYear { get; internal set; }
+ [JsonPropertyName("reputation_change_year")]
+ public int ReputationChangeYear { get; init; }
///
/// timed_penalty_date
///
- [Field("timed_penalty_date")]
- public DateTime? TimedPenaltyDate { get; internal set; }
+ [JsonPropertyName("timed_penalty_date")]
+ public DateTime? TimedPenaltyDate { get; init; }
///
/// up_vote_count
///
- [Field("up_vote_count")]
- public int UpVoteCount { get; internal set; }
+ [JsonPropertyName("up_vote_count")]
+ public int UpVoteCount { get; init; }
///
/// user_id
///
- [Field("user_id")]
- public int UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int UserId { get; init; }
///
/// user_type
///
- [Field("user_type")]
- public Users.UserType UserType { get; internal set; }
+ [JsonPropertyName("user_type")]
+ public Users.UserType UserType { get; init; }
///
/// view_count
///
- [Field("view_count")]
- public int ViewCount { get; internal set; }
+ [JsonPropertyName("view_count")]
+ public int ViewCount { get; init; }
///
/// website_url
///
- [Field("website_url")]
- public string WebsiteUrl { get; internal set; }
+ [JsonPropertyName("website_url")]
+ public string WebsiteUrl { get; init; }
}
}
diff --git a/StacMan/Codegen/UserTimeline.cs b/StacMan/Codegen/UserTimeline.cs
index fa23a87..9f7d2d1 100644
--- a/StacMan/Codegen/UserTimeline.cs
+++ b/StacMan/Codegen/UserTimeline.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,68 +18,68 @@ public partial class UserTimeline : StacManType
///
/// badge_id
///
- [Field("badge_id")]
- public int? BadgeId { get; internal set; }
+ [JsonPropertyName("badge_id")]
+ public int? BadgeId { get; init; }
///
/// comment_id
///
- [Field("comment_id")]
- public int? CommentId { get; internal set; }
+ [JsonPropertyName("comment_id")]
+ public int? CommentId { get; init; }
///
/// creation_date
///
- [Field("creation_date")]
- public DateTime CreationDate { get; internal set; }
+ [JsonPropertyName("creation_date")]
+ public DateTime CreationDate { get; init; }
///
/// detail
///
- [Field("detail")]
- public string Detail { get; internal set; }
+ [JsonPropertyName("detail")]
+ public string Detail { get; init; }
///
/// link
///
- [Field("link")]
- public string Link { get; internal set; }
+ [JsonPropertyName("link")]
+ public string Link { get; init; }
///
/// post_id
///
- [Field("post_id")]
- public int? PostId { get; internal set; }
+ [JsonPropertyName("post_id")]
+ public int? PostId { get; init; }
///
/// post_type
///
- [Field("post_type")]
- public Posts.PostType PostType { get; internal set; }
+ [JsonPropertyName("post_type")]
+ public Posts.PostType PostType { get; init; }
///
/// suggested_edit_id
///
- [Field("suggested_edit_id")]
- public int? SuggestedEditId { get; internal set; }
+ [JsonPropertyName("suggested_edit_id")]
+ public int? SuggestedEditId { get; init; }
///
/// timeline_type
///
- [Field("timeline_type")]
- public UserTimelines.TimelineType TimelineType { get; internal set; }
+ [JsonPropertyName("timeline_type")]
+ public UserTimelines.TimelineType TimelineType { get; init; }
///
/// title
///
- [Field("title")]
- public string Title { get; internal set; }
+ [JsonPropertyName("title")]
+ public string Title { get; init; }
///
/// user_id
///
- [Field("user_id")]
- public int UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int UserId { get; init; }
}
}
diff --git a/StacMan/Codegen/Wrapper.cs b/StacMan/Codegen/Wrapper.cs
index f58491b..5faf762 100644
--- a/StacMan/Codegen/Wrapper.cs
+++ b/StacMan/Codegen/Wrapper.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,74 +18,74 @@ public partial class Wrapper : StacManType
///
/// backoff
///
- [Field("backoff")]
- public int? Backoff { get; internal set; }
+ [JsonPropertyName("backoff")]
+ public int? Backoff { get; init; }
///
/// error_id
///
- [Field("error_id")]
- public int? ErrorId { get; internal set; }
+ [JsonPropertyName("error_id")]
+ public int? ErrorId { get; init; }
///
/// error_message
///
- [Field("error_message")]
- public string ErrorMessage { get; internal set; }
+ [JsonPropertyName("error_message")]
+ public string ErrorMessage { get; init; }
///
/// error_name
///
- [Field("error_name")]
- public string ErrorName { get; internal set; }
+ [JsonPropertyName("error_name")]
+ public string ErrorName { get; init; }
///
/// has_more
///
- [Field("has_more")]
- public bool HasMore { get; internal set; }
+ [JsonPropertyName("has_more")]
+ public bool HasMore { get; init; }
///
/// items
///
- [Field("items")]
- public T[] Items { get; internal set; }
+ [JsonPropertyName("items")]
+ public T[] Items { get; init; }
///
/// page
///
- [Field("page")]
- public int Page { get; internal set; }
+ [JsonPropertyName("page")]
+ public int Page { get; init; }
///
/// page_size
///
- [Field("page_size")]
- public int PageSize { get; internal set; }
+ [JsonPropertyName("page_size")]
+ public int PageSize { get; init; }
///
/// quota_max
///
- [Field("quota_max")]
- public int QuotaMax { get; internal set; }
+ [JsonPropertyName("quota_max")]
+ public int QuotaMax { get; init; }
///
/// quota_remaining
///
- [Field("quota_remaining")]
- public int QuotaRemaining { get; internal set; }
+ [JsonPropertyName("quota_remaining")]
+ public int QuotaRemaining { get; init; }
///
/// total
///
- [Field("total")]
- public int Total { get; internal set; }
+ [JsonPropertyName("total")]
+ public int Total { get; init; }
///
/// type
///
- [Field("type")]
- public string Type { get; internal set; }
+ [JsonPropertyName("type")]
+ public string Type { get; init; }
}
}
diff --git a/StacMan/Codegen/WritePermission.cs b/StacMan/Codegen/WritePermission.cs
index fded41c..ecd8b4b 100644
--- a/StacMan/Codegen/WritePermission.cs
+++ b/StacMan/Codegen/WritePermission.cs
@@ -5,6 +5,7 @@
//
using System;
+using System.Text.Json.Serialization;
namespace StackExchange.StacMan
{
@@ -17,44 +18,44 @@ public partial class WritePermission : StacManType
///
/// can_add -- introduced in API version 2.1
///
- [Field("can_add")]
- public bool CanAdd { get; internal set; }
+ [JsonPropertyName("can_add")]
+ public bool CanAdd { get; init; }
///
/// can_delete -- introduced in API version 2.1
///
- [Field("can_delete")]
- public bool CanDelete { get; internal set; }
+ [JsonPropertyName("can_delete")]
+ public bool CanDelete { get; init; }
///
/// can_edit -- introduced in API version 2.1
///
- [Field("can_edit")]
- public bool CanEdit { get; internal set; }
+ [JsonPropertyName("can_edit")]
+ public bool CanEdit { get; init; }
///
/// max_daily_actions -- introduced in API version 2.1
///
- [Field("max_daily_actions")]
- public int MaxDailyActions { get; internal set; }
+ [JsonPropertyName("max_daily_actions")]
+ public int MaxDailyActions { get; init; }
///
/// min_seconds_between_actions -- introduced in API version 2.1
///
- [Field("min_seconds_between_actions")]
- public int MinSecondsBetweenActions { get; internal set; }
+ [JsonPropertyName("min_seconds_between_actions")]
+ public int MinSecondsBetweenActions { get; init; }
///
/// object_type -- introduced in API version 2.1
///
- [Field("object_type")]
- public string ObjectType { get; internal set; }
+ [JsonPropertyName("object_type")]
+ public string ObjectType { get; init; }
///
/// user_id -- introduced in API version 2.1
///
- [Field("user_id")]
- public int UserId { get; internal set; }
+ [JsonPropertyName("user_id")]
+ public int UserId { get; init; }
}
}
diff --git a/StacMan/Events/EventType.cs b/StacMan/Events/EventType.cs
index afc90ee..4b8119a 100644
--- a/StacMan/Events/EventType.cs
+++ b/StacMan/Events/EventType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Events
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Events
{
///
/// event_type
@@ -8,26 +10,31 @@ public enum EventType
///
/// question_posted
///
+ [JsonPropertyName("question_posted")]
QuestionPosted,
///
/// answer_posted
///
+ [JsonPropertyName("answer_posted")]
AnswerPosted,
///
/// comment_posted
///
+ [JsonPropertyName("comment_posted")]
CommentPosted,
///
/// post_edited
///
+ [JsonPropertyName("post_edited")]
PostEdited,
///
/// user_created
///
+ [JsonPropertyName("user_created")]
UserCreated
}
}
diff --git a/StacMan/FieldAttribute.cs b/StacMan/FieldAttribute.cs
deleted file mode 100644
index 6b7bb01..0000000
--- a/StacMan/FieldAttribute.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-
-namespace StackExchange.StacMan
-{
- [AttributeUsage(AttributeTargets.Property)]
- internal class FieldAttribute : Attribute
- {
- public FieldAttribute(string fieldName)
- {
- FieldName = fieldName;
- }
-
- public readonly string FieldName;
- }
-}
diff --git a/StacMan/InboxItems/ItemType.cs b/StacMan/InboxItems/ItemType.cs
index b704316..613f7fa 100644
--- a/StacMan/InboxItems/ItemType.cs
+++ b/StacMan/InboxItems/ItemType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.InboxItems
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.InboxItems
{
///
/// item_type
@@ -8,41 +10,49 @@ public enum ItemType
///
/// comment
///
+ [JsonPropertyName("comment")]
Comment,
///
/// chat_message
///
+ [JsonPropertyName("chat_message")]
ChatMessage,
///
/// new_answer
///
+ [JsonPropertyName("new_answer")]
NewAnswer,
///
/// careers_message
///
+ [JsonPropertyName("careers_message")]
CareersMessage,
///
/// careers_invitations
///
+ [JsonPropertyName("careers_invitations")]
CareersInvitations,
///
/// meta_question
///
+ [JsonPropertyName("meta_question")]
MetaQuestion,
///
/// post_notice
///
+ [JsonPropertyName("post_notice")]
PostNotice,
///
/// moderator_message
///
+ [JsonPropertyName("moderator_message")]
ModeratorMessage
}
}
diff --git a/StacMan/Notifications/NotificationType.cs b/StacMan/Notifications/NotificationType.cs
index 7313275..a8fe7a3 100644
--- a/StacMan/Notifications/NotificationType.cs
+++ b/StacMan/Notifications/NotificationType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Notifications
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Notifications
{
///
/// notification_type
@@ -8,71 +10,85 @@ public enum NotificationType
///
/// generic
///
+ [JsonPropertyName("generic")]
Generic,
///
/// profile_activity
///
+ [JsonPropertyName("profile_activity")]
ProfileActivity,
///
/// bounty_expired
///
+ [JsonPropertyName("bounty_expired")]
BountyExpired,
///
/// bounty_expires_in_one_day
///
+ [JsonPropertyName("bounty_expires_in_one_day")]
BountyExpiresInOneDay,
///
/// bounty_expires_in_three_days
///
+ [JsonPropertyName("bounty_expires_in_three_days")]
BountyExpiresInThreeDays,
///
/// badge_earned
///
+ [JsonPropertyName("badge_earned")]
BadgeEarned,
///
/// reputation_bonus
///
+ [JsonPropertyName("reputation_bonus")]
ReputationBonus,
///
/// accounts_associated
///
+ [JsonPropertyName("accounts_associated")]
AccountsAssociated,
///
- /// new privilege
+ /// new_privilege
///
+ [JsonPropertyName("new_privilege")]
NewPrivilege,
///
- /// post migrated
+ /// post_migrated
///
+ [JsonPropertyName("post_migrated")]
PostMigrated,
///
/// moderator_message
///
+ [JsonPropertyName("moderator_message")]
ModeratorMessage,
///
/// registration_reminder
///
+ [JsonPropertyName("registration_reminder")]
RegistrationReminder,
///
/// edit_suggested
///
+ [JsonPropertyName("edit_suggested")]
EditSuggested,
///
/// substantive_edit
///
+ [JsonPropertyName("substantive_edit")]
SubstantiveEdit
}
}
diff --git a/StacMan/Posts/PostType.cs b/StacMan/Posts/PostType.cs
index 760c759..0a4c2a7 100644
--- a/StacMan/Posts/PostType.cs
+++ b/StacMan/Posts/PostType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Posts
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Posts
{
///
/// post_type
@@ -8,11 +10,13 @@ public enum PostType
///
/// question
///
+ [JsonPropertyName("question")]
Question,
///
/// answer
///
+ [JsonPropertyName("answer")]
Answer
}
}
\ No newline at end of file
diff --git a/StacMan/Properties/AssemblyInfo.cs b/StacMan/Properties/AssemblyInfo.cs
deleted file mode 100644
index 3885701..0000000
--- a/StacMan/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("StacMan")]
-[assembly: AssemblyDescription("Stack Exchange APIv2 .NET client")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Stack Exchange")]
-[assembly: AssemblyProduct("StacMan")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("659d604b-88ad-470a-b855-1b44617498fc")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0.0")]
-//[assembly: AssemblyFileVersion("1.0.0.0")]
-
-[assembly: InternalsVisibleTo("StacMan.Tests")]
\ No newline at end of file
diff --git a/StacMan/QuestionTimelines/TimelineType.cs b/StacMan/QuestionTimelines/TimelineType.cs
index 4a2c7b5..f0bcc6a 100644
--- a/StacMan/QuestionTimelines/TimelineType.cs
+++ b/StacMan/QuestionTimelines/TimelineType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.QuestionTimelines
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.QuestionTimelines
{
///
/// timeline_type
@@ -8,41 +10,49 @@ public enum TimelineType
///
/// question
///
+ [JsonPropertyName("question")]
Question,
///
/// answer
///
+ [JsonPropertyName("answer")]
Answer,
///
/// comment
///
+ [JsonPropertyName("comment")]
Comment,
///
/// unaccepted_answer
///
+ [JsonPropertyName("unaccepted_answer")]
UnacceptedAnswer,
///
/// accepted_answer
///
+ [JsonPropertyName("accepted_answer")]
AcceptedAnswer,
///
/// vote_aggregate
///
+ [JsonPropertyName("vote_aggregate")]
VoteAggregate,
///
/// revision
///
+ [JsonPropertyName("revision")]
Revision,
///
/// post_state_changed
///
+ [JsonPropertyName("post_state_changed")]
PostStateChanged
}
}
\ No newline at end of file
diff --git a/StacMan/ReflectionCache.cs b/StacMan/ReflectionCache.cs
index 9225070..b86f3a1 100644
--- a/StacMan/ReflectionCache.cs
+++ b/StacMan/ReflectionCache.cs
@@ -1,28 +1,10 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
-using System.Reflection;
namespace StackExchange.StacMan
{
internal static class ReflectionCache
{
- public static readonly MethodInfo StacManClientParseApiResponse = typeof(StacManClient).GetMethod("ParseApiResponse", BindingFlags.NonPublic | BindingFlags.Instance);
-
- public static class ApiFieldsByName where T : StacManType
- {
- static ApiFieldsByName()
- {
- Value = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance)
- .Where(pi => pi.GetCustomAttributes(typeof(FieldAttribute), false).Length == 1)
- .ToDictionary(
- pi => ((FieldAttribute)pi.GetCustomAttributes(typeof(FieldAttribute), false)[0]).FieldName,
- pi => pi);
- }
-
- public static readonly IDictionary Value;
- }
-
public static class SortsBySortType where TSort : struct // proxy for "where TSort: enum"
{
static SortsBySortType()
diff --git a/StacMan/ReputationHistories/ReputationHistoryType.cs b/StacMan/ReputationHistories/ReputationHistoryType.cs
index 9688e81..2df7951 100644
--- a/StacMan/ReputationHistories/ReputationHistoryType.cs
+++ b/StacMan/ReputationHistories/ReputationHistoryType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.ReputationHistories
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.ReputationHistories
{
///
/// reputation_history_type
@@ -8,116 +10,139 @@ public enum ReputationHistoryType
///
/// asker_accepts_answer
///
+ [JsonPropertyName("asker_accepts_answer")]
AskerAcceptsAnswer,
///
/// askwer_unaccept_answer
///
+ [JsonPropertyName("asker_unaccept_answer")]
AskerUnacceptAnswer,
///
/// answer_accepted
///
+ [JsonPropertyName("answer_accepted")]
AnswerAccepted,
///
/// answer_unaccepted
///
+ [JsonPropertyName("answer_unaccepted")]
AnswerUnaccepted,
///
/// voter_downvotes
///
+ [JsonPropertyName("voter_downvotes")]
VoterDownvotes,
///
/// voter_undownvotes
///
+ [JsonPropertyName("voter_undownvotes")]
VoterUndownvotes,
///
/// post_downvoted
///
+ [JsonPropertyName("post_downvoted")]
PostDownvoted,
///
/// post_undownvoted
///
+ [JsonPropertyName("post_undownvoted")]
PostUndownvoted,
///
/// post_upvoted
///
+ [JsonPropertyName("post_upvoted")]
PostUpvoted,
///
/// post_unupvoted
///
+ [JsonPropertyName("post_unupvoted")]
PostUnupvoted,
///
/// suggested_edit_approval_received
///
+ [JsonPropertyName("suggested_edit_approval_received")]
SuggestedEditApprovalReceived,
///
/// post_flagged_as_spam
///
+ [JsonPropertyName("post_flagged_as_spam")]
PostFlaggedAsSpam,
///
/// post_flagged_as_offensive
///
+ [JsonPropertyName("post_flagged_as_offensive")]
PostFlaggedAsOffensive,
///
/// bounty_given
///
+ [JsonPropertyName("bounty_given")]
BountyGiven,
///
/// bounty_earned
///
+ [JsonPropertyName("bounty_earned")]
BountyEarned,
///
/// bounty_cancelled
///
+ [JsonPropertyName("bounty_cancelled")]
BountyCancelled,
///
/// post_deleted
///
+ [JsonPropertyName("post_deleted")]
PostDeleted,
///
/// post_undeleted
///
+ [JsonPropertyName("post_undeleted")]
PostUndeleted,
///
/// association_bonus
///
+ [JsonPropertyName("association_bonus")]
AssociationBonus,
///
/// arbitrary_reputation_change
///
+ [JsonPropertyName("arbitrary_reputation_change")]
ArbitraryReputationChange,
///
/// vote_fraud_reversal
///
+ [JsonPropertyName("vote_fraud_reversal")]
VoteFraudReversal,
///
/// post_migrated
///
+ [JsonPropertyName("post_migrated")]
PostMigrated,
///
/// user_deleted
///
+ [JsonPropertyName("user_deleted")]
UserDeleted
}
}
diff --git a/StacMan/Reputations/VoteType.cs b/StacMan/Reputations/VoteType.cs
index 598ea74..36f62af 100644
--- a/StacMan/Reputations/VoteType.cs
+++ b/StacMan/Reputations/VoteType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Reputations
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Reputations
{
///
/// vote_type
@@ -8,36 +10,43 @@ public enum VoteType
///
/// accepts
///
+ [JsonPropertyName("accepts")]
Accepts,
///
/// up_votes
///
+ [JsonPropertyName("up_votes")]
UpVotes,
///
/// down_votes
///
+ [JsonPropertyName("down_votes")]
DownVotes,
///
/// bounties_offered
///
+ [JsonPropertyName("bounties_offered")]
BountiesOffered,
///
/// bounties_won
///
+ [JsonPropertyName("bounties_won")]
BountiesWon,
///
/// spam
///
+ [JsonPropertyName("spam")]
Spam,
///
/// suggested_edits
///
+ [JsonPropertyName("suggested_edits")]
SuggestedEdits
}
}
\ No newline at end of file
diff --git a/StacMan/Revisions/RevisionType.cs b/StacMan/Revisions/RevisionType.cs
index ebcdfaf..bf81dc0 100644
--- a/StacMan/Revisions/RevisionType.cs
+++ b/StacMan/Revisions/RevisionType.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Revisions
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Revisions
{
///
/// revision_type
@@ -8,11 +10,13 @@ public enum RevisionType
///
/// single_user
///
+ [JsonPropertyName("single_user")]
SingleUser,
///
/// vote_based
///
+ [JsonPropertyName("vote_based")]
VoteBased
}
}
\ No newline at end of file
diff --git a/StacMan/Sites/SiteState.cs b/StacMan/Sites/SiteState.cs
index 909111a..729c73a 100644
--- a/StacMan/Sites/SiteState.cs
+++ b/StacMan/Sites/SiteState.cs
@@ -1,4 +1,6 @@
-namespace StackExchange.StacMan.Sites
+using System.Text.Json.Serialization;
+
+namespace StackExchange.StacMan.Sites
{
///
/// site_state
@@ -8,21 +10,25 @@ public enum SiteState
///
/// normal
///
+ [JsonPropertyName("normal")]
Normal,
///
/// closed_beta
///
+ [JsonPropertyName("closed_beta")]
ClosedBeta,
///
/// open_beta
///
+ [JsonPropertyName("open_beta")]
OpenBeta,
///
/// linked_meta
///
+ [JsonPropertyName("linked_meta")]
LinkedMeta
}
}
\ No newline at end of file
diff --git a/StacMan/StacMan.csproj b/StacMan/StacMan.csproj
index d02a1b2..b15c500 100644
--- a/StacMan/StacMan.csproj
+++ b/StacMan/StacMan.csproj
@@ -1,294 +1,57 @@
-
-
+
+
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {3C310AC6-6229-41FB-B33F-8381CF4FECBF}
- Library
- Properties
- StackExchange.StacMan
- StacMan
- v4.5
- 512
-
-
-
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
+ netstandard2.0
+ 9.0
-
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- bin\Release\StacMan.xml
- false
+
+
+ Stack Exchange
+ Stack Exchange APIv2 .NET client
+ StackExchange.StacMan
+ 1.1.0.0
+
-
-
-
-
-
-
-
-
-
-
-
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Methods.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
- Types.tt
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
StacManClient.cs
-
- StacManClient.cs
+
+ Methods.tt
+ Types.tt
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- True
- True
+
Methods.tt
+ True
+ True
-
-
+
TextTemplatingFileGenerator
Methods.ignore
-
-
- True
- True
+
Types.tt
+ True
+ True
-
-
+
TextTemplatingFileGenerator
Types.ignore
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
\ No newline at end of file
diff --git a/StacMan/StacManClient.cs b/StacMan/StacManClient.cs
index b74ef45..c117b8e 100644
--- a/StacMan/StacManClient.cs
+++ b/StacMan/StacManClient.cs
@@ -1,13 +1,11 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.IO;
-using System.Linq;
using System.Net;
-using System.Reflection;
+using System.Text.Json;
+using System.Text.Json.Serialization;
using System.Threading;
using System.Threading.Tasks;
-using System.Web.Script.Serialization;
namespace StackExchange.StacMan
{
@@ -57,7 +55,14 @@ public StacManClient(string key = null, string version = "2.0")
///
public bool RespectBackoffs { get; set; }
- private readonly JavaScriptSerializer Serializer = new JavaScriptSerializer();
+ private readonly JsonSerializerOptions JsonSerializerOptions = new()
+ {
+ Converters =
+ {
+ new JsonStringEnumMemberConverter(namingPolicy: null, allowIntegerValues: false),
+ new UnixEpochDateConverter(),
+ }
+ };
private Task> CreateApiTask(ApiUrlBuilder ub, HttpMethod httpMethod, string backoffKey) where T : StacManType
{
@@ -152,7 +157,19 @@ private void GetApiResponse(ApiUrlBuilder ub, HttpMethod httpMethod, string b
try
{
response.RawData = rawData;
- response.Data = ParseApiResponse>(Serializer.Deserialize>(response.RawData), backoffKey);
+ response.Data = JsonSerializer.Deserialize>(rawData, JsonSerializerOptions);
+ if (response.Data is null)
+ {
+ throw new JsonException($"Failed to deserialize response from {ub} as {typeof(Wrapper).Name}.");
+ }
+ var backoff = response.Data.Backoff;
+ if (backoff.HasValue)
+ {
+ lock (BackoffUntil)
+ {
+ BackoffUntil[backoffKey] = DateTime.Now.AddSeconds(backoff.Value);
+ }
+ }
if (response.Data.ErrorId.HasValue)
throw new Exceptions.StackExchangeApiException(response.Data.ErrorId.Value, response.Data.ErrorName, response.Data.ErrorMessage);
@@ -310,69 +327,6 @@ internal protected virtual void FetchApiResponseWithPOST(string url, string data
request);
}
- private T ParseApiResponse(Dictionary jsonObject, string backoffKey) where T : StacManType
- {
- var ret = (T)Activator.CreateInstance(typeof(T));
- var apiFieldsByName = ReflectionCache.ApiFieldsByName.Value;
-
- foreach (var fieldName in jsonObject.Keys)
- {
- if (!apiFieldsByName.ContainsKey(fieldName))
- throw new Exception(String.Format("\"{0}\" field is unrecognized", fieldName));
-
- var property = apiFieldsByName[fieldName];
- object value;
-
- if (property.PropertyType == typeof(DateTime) || Nullable.GetUnderlyingType(property.PropertyType) == typeof(DateTime))
- {
- value = Convert.ToInt64(jsonObject[fieldName]).ToDateTime();
- }
- else if (property.PropertyType == typeof(Guid) || Nullable.GetUnderlyingType(property.PropertyType) == typeof(Guid))
- {
- value = Guid.Parse((string)jsonObject[fieldName]);
- }
- else if (property.PropertyType.IsEnum)
- {
- value = Enum.Parse(property.PropertyType, ((string)jsonObject[fieldName]).Replace("_", String.Empty), true);
- }
- else if (property.PropertyType.BaseType == typeof(StacManType))
- {
- value = ReflectionCache.StacManClientParseApiResponse
- .MakeGenericMethod(property.PropertyType)
- .Invoke(this, new object[] { (Dictionary)jsonObject[fieldName], backoffKey });
- }
- else if (property.PropertyType.IsArray)
- {
- var elementType = property.PropertyType.GetElementType();
-
- Func