diff --git a/src/.editorconfig b/src/.editorconfig new file mode 100644 index 0000000..4628051 --- /dev/null +++ b/src/.editorconfig @@ -0,0 +1,7 @@ +[*.cs] + +# CS1591: Missing XML comment for publicly visible type or member +dotnet_diagnostic.CS1591.severity = none + +# S1075: URIs should not be hardcoded +dotnet_diagnostic.S1075.severity = none diff --git a/src/MtgApiManager.Lib.Test/Service/ServiceBaseObjectService.cs b/src/MtgApiManager.Lib.Test/Service/ServiceBaseObjectService.cs index 79d9d13..f2b8200 100644 --- a/src/MtgApiManager.Lib.Test/Service/ServiceBaseObjectService.cs +++ b/src/MtgApiManager.Lib.Test/Service/ServiceBaseObjectService.cs @@ -11,7 +11,7 @@ /// /// Object used to test the abstract class. /// - public class ServiceBaseObjectService : ServiceBase + public class ServiceBaseObjectService : ServiceBase { /// /// Initializes a new instance of the class. Defaults to version 1.0 of the API. diff --git a/src/MtgApiManager.Lib/MtgApiManager.Lib.csproj b/src/MtgApiManager.Lib/MtgApiManager.Lib.csproj index 42f6379..d3cfee0 100644 --- a/src/MtgApiManager.Lib/MtgApiManager.Lib.csproj +++ b/src/MtgApiManager.Lib/MtgApiManager.Lib.csproj @@ -48,6 +48,7 @@ True + diff --git a/src/MtgApiManager.Lib/MtgApiManager.Lib.xml b/src/MtgApiManager.Lib/MtgApiManager.Lib.xml index fe131a5..6c86cb7 100644 --- a/src/MtgApiManager.Lib/MtgApiManager.Lib.xml +++ b/src/MtgApiManager.Lib/MtgApiManager.Lib.xml @@ -923,14 +923,15 @@ Initializes a new instance of the class. The service adapter used to interact with the MTG API. + Used to map entity objects to models. The version of the API Turn the rate limit on or off. - Gets all the defined by the query parameters. + Gets all the defined by the query parameters. - A representing the result containing all the items. + A representing the result containing all the items. @@ -1026,53 +1027,48 @@ Base class for query parameters. - + Base class for a service. - The type of service. The type of model used by the service. - - - The base URL to the MTG API. - - - + - Initializes a new instance of the class. + Initializes a new instance of the class. The service adapter used to interact with the MTG API. + Used to map entity objects to models. The version of the API (currently only 1 version.) The end point of the service. Turn the rate limit on or off. - + Gets the list of where queries. - + - Gets all the defined by the query parameters. + Gets all the objects defined by the query parameters. - A representing the result containing all the items. + A representing the result containing all the items. - + Builds the URL to call the web service. The list of parameters to add to the query. The URL to make the call with. - + Builds the URL to call the web service. The parameter value to add. The URL to make the call with. - + Makes a GET call to the web service. @@ -1110,14 +1106,15 @@ Initializes a new instance of the class. The service adapter used to interact with the MTG API. + Used to map entity objects to models. The version of the API Turn the rate limit on or off. - Gets all the defined by the query parameters. + Gets all the defined by the query parameters. - A representing the result containing all the items. + A representing the result containing all the items. @@ -1131,7 +1128,7 @@ Generates a booster pack for a specific set asynchronously. The set code to generate a booster for. - A representing the result containing a or an exception. + A representing the result containing a or an exception. @@ -1165,7 +1162,7 @@ The type to look for the property in. The name of the property to get the query parameter for. - A representing the query name defined in the + A representing the query name defined in the JSON property diff --git a/src/MtgApiManager.Lib/Service/CardService.cs b/src/MtgApiManager.Lib/Service/CardService.cs index b7b96ec..248c7e3 100644 --- a/src/MtgApiManager.Lib/Service/CardService.cs +++ b/src/MtgApiManager.Lib/Service/CardService.cs @@ -14,7 +14,7 @@ namespace MtgApiManager.Lib.Service /// Object representing a MTG card. /// public class CardService - : ServiceBase, IMtgQueryable + : ServiceBase, IMtgQueryable { /// /// Initializes a new instance of the class. Defaults to version 1.0 of the API. @@ -28,6 +28,7 @@ public CardService() /// Initializes a new instance of the class. /// /// The service adapter used to interact with the MTG API. + /// Used to map entity objects to models. /// The version of the API /// Turn the rate limit on or off. public CardService( @@ -40,9 +41,9 @@ public CardService( } /// - /// Gets all the defined by the query parameters. + /// Gets all the defined by the query parameters. /// - /// A representing the result containing all the items. + /// A representing the result containing all the items. public async override Task>> AllAsync() { try diff --git a/src/MtgApiManager.Lib/Service/ServiceBase.cs b/src/MtgApiManager.Lib/Service/ServiceBase.cs index c082bdc..4ef859f 100644 --- a/src/MtgApiManager.Lib/Service/ServiceBase.cs +++ b/src/MtgApiManager.Lib/Service/ServiceBase.cs @@ -11,23 +11,19 @@ namespace MtgApiManager.Lib.Service /// /// Base class for a service. /// - /// The type of service. /// The type of model used by the service. - public abstract class ServiceBase - where TService : class + public abstract class ServiceBase where TModel : class { - /// - /// The base URL to the MTG API. - /// - protected const string BaseMtgUrl = "https://api.magicthegathering.io"; + private const string BASE_URL = "https://api.magicthegathering.io"; private readonly bool _isRateLimitOn; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The service adapter used to interact with the MTG API. + /// Used to map entity objects to models. /// The version of the API (currently only 1 version.) /// The end point of the service. /// Turn the rate limit on or off. @@ -47,7 +43,7 @@ protected ServiceBase( } protected IMtgApiServiceAdapter Adapter { get; } - + protected string BaseMtgUrl => BASE_URL; protected ApiEndPoint EndPoint { get; } protected IModelMapper ModelMapper { get; } @@ -60,9 +56,9 @@ protected ServiceBase( protected Dictionary WhereQueries { get; } /// - /// Gets all the defined by the query parameters. + /// Gets all the objects defined by the query parameters. /// - /// A representing the result containing all the items. + /// A representing the result containing all the items. public abstract Task>> AllAsync(); /// diff --git a/src/MtgApiManager.Lib/Service/SetService.cs b/src/MtgApiManager.Lib/Service/SetService.cs index c1faf39..dce3474 100644 --- a/src/MtgApiManager.Lib/Service/SetService.cs +++ b/src/MtgApiManager.Lib/Service/SetService.cs @@ -16,7 +16,7 @@ namespace MtgApiManager.Lib.Service /// Object representing a MTG set. /// public class SetService - : ServiceBase, IMtgQueryable + : ServiceBase, IMtgQueryable { /// /// Initializes a new instance of the class. Defaults to version 1.0 of the API. @@ -30,6 +30,7 @@ public SetService() /// Initializes a new instance of the class. /// /// The service adapter used to interact with the MTG API. + /// Used to map entity objects to models. /// The version of the API /// Turn the rate limit on or off. public SetService( @@ -42,9 +43,9 @@ public SetService( } /// - /// Gets all the defined by the query parameters. + /// Gets all the defined by the query parameters. /// - /// A representing the result containing all the items. + /// A representing the result containing all the items. public async override Task>> AllAsync() { try @@ -83,7 +84,7 @@ public async Task> FindAsync(string code) /// Generates a booster pack for a specific set asynchronously. /// /// The set code to generate a booster for. - /// A representing the result containing a or an exception. + /// A representing the result containing a or an exception. public async Task>> GenerateBoosterAsync(string code) { try diff --git a/src/MtgApiManager.Lib/Utility/QueryUtility.cs b/src/MtgApiManager.Lib/Utility/QueryUtility.cs index 4f32c9b..902dba2 100644 --- a/src/MtgApiManager.Lib/Utility/QueryUtility.cs +++ b/src/MtgApiManager.Lib/Utility/QueryUtility.cs @@ -14,7 +14,7 @@ public static class QueryUtility /// /// The type to look for the property in. /// The name of the property to get the query parameter for. - /// A representing the query name defined in the + /// A representing the query name defined in the JSON property public static string GetQueryPropertyName(string propertyName) { if (string.IsNullOrEmpty(propertyName)) diff --git a/src/MtgApiManager.sln b/src/MtgApiManager.sln index f627154..98d02de 100644 --- a/src/MtgApiManager.sln +++ b/src/MtgApiManager.sln @@ -11,14 +11,17 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MtgApiManager.Lib.TestApp", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "..\build\_build.csproj", "{E59A8693-3B65-4309-A1DB-36F8A1658876}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{71717EE0-3EB9-4509-8EA5-156B3CB7673D}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {E59A8693-3B65-4309-A1DB-36F8A1658876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E59A8693-3B65-4309-A1DB-36F8A1658876}.Release|Any CPU.ActiveCfg = Release|Any CPU {363A4B72-00F1-494C-9A0B-7BAFAC907C75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {363A4B72-00F1-494C-9A0B-7BAFAC907C75}.Debug|Any CPU.Build.0 = Debug|Any CPU {363A4B72-00F1-494C-9A0B-7BAFAC907C75}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -31,6 +34,8 @@ Global {6C5F645B-CB4E-4460-9862-94CCFE52CF64}.Debug|Any CPU.Build.0 = Debug|Any CPU {6C5F645B-CB4E-4460-9862-94CCFE52CF64}.Release|Any CPU.ActiveCfg = Release|Any CPU {6C5F645B-CB4E-4460-9862-94CCFE52CF64}.Release|Any CPU.Build.0 = Release|Any CPU + {E59A8693-3B65-4309-A1DB-36F8A1658876}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E59A8693-3B65-4309-A1DB-36F8A1658876}.Release|Any CPU.ActiveCfg = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE