Skip to content

Commit

Permalink
Merge pull request #6 from ForcuraCo/upgrade
Browse files Browse the repository at this point in the history
Upgrade target frameworks & better `HttpClient` usage
  • Loading branch information
ghost1face authored Dec 3, 2021
2 parents 0f27058 + d289c97 commit 0fa0b23
Show file tree
Hide file tree
Showing 30 changed files with 548 additions and 206 deletions.
117 changes: 117 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# editorconfig dotnet
root = true

# Default settings:
[*]
insert_final_newline = false
indent_style = space
indent_size = 2

###############################
# .NET Coding Conventions #
###############################

[*.cs]
indent_style = space
indent_size = 4
end_of_line = crlf

# organize usings
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false

# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent

# language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent

# parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent

# modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion

# expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent

###############################
# Naming Conventions #
###############################

# style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const

# new line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# prefer variable inlining
csharp_style_inlined_variable_declaration = true:suggestion

# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent

# wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

# indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left

# space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_square_brackets = false
28 changes: 22 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
bin
obj
# ignore build files
[Bb]in/
[Dd]ebug/
[Oo]bj/
[Rr]elease/

# ignore user specific files
*.user
*.suo

# misc
*.nupkg
*.orig
*.dll
Output
TestResults
packages

# cache/configuration directories
.vscode
.vs
.vs

# test results/ code coverage
coverage.*.xml
[Cc]overage-[Rr]eport/
[Tt]est-[Rr]esults/
[Tt]est[Rr]esults/
packages

# nuget configuration
[Nn]u[Gg]et.config
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2019 Forcura
Copyright 2022 Forcura

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion NPPESAPI.net/Core/AddressPurposeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Forcura.NPPES.Core
{
class AddressPurposeConverter : JsonConverter
internal class AddressPurposeConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
Expand Down
2 changes: 1 addition & 1 deletion NPPESAPI.net/Core/AddressTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Forcura.NPPES.Core
{
class AddressTypeConverter : JsonConverter
internal class AddressTypeConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
Expand Down
2 changes: 1 addition & 1 deletion NPPESAPI.net/Core/CustomDateTimeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Forcura.NPPES.Core
{
class CustomDateTimeConverter : IsoDateTimeConverter
internal class CustomDateTimeConverter : IsoDateTimeConverter
{
private static readonly DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
Expand Down
4 changes: 2 additions & 2 deletions NPPESAPI.net/Core/NPPESContractResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Forcura.NPPES.Core
{
public class NPPESContractResolver : DefaultContractResolver
internal class NPPESContractResolver : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
Expand All @@ -18,7 +18,7 @@ protected override JsonProperty CreateProperty(MemberInfo member, MemberSerializ
return property;
}

private void ChangePropertyName(Type type, JsonProperty property)
private static void ChangePropertyName(Type type, JsonProperty property)
{
if (typePropertyLookup.TryGetValue(type, out Dictionary<string, string> propertyNameLookup) && propertyNameLookup.TryGetValue(property.PropertyName, out string newFieldName))
property.PropertyName = newFieldName;
Expand Down
2 changes: 1 addition & 1 deletion NPPESAPI.net/Core/NPPESTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Forcura.NPPES.Core
{
class NPPESTypeConverter : JsonConverter
internal class NPPESTypeConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
Expand Down
26 changes: 26 additions & 0 deletions NPPESAPI.net/DependencyInjection/ServiceCollectionExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#if NETCOREAPP2_1_OR_GREATER

using Microsoft.Extensions.DependencyInjection;

namespace Forcura.NPPES.DependencyInjection
{
/// <summary>
/// Extensions for registering the <see cref="NPPESApiClient"/> with the <see cref="IServiceCollection"/>.
/// </summary>
public static class ServiceCollectionExtensions
{
/// <summary>
/// Registers the <see cref="NPPESApiClient"/> with the <see cref="IServiceCollection"/>.
/// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
/// <returns>The configured <see cref="IServiceCollection"/>.</returns>
public static IServiceCollection AddNPPESApi(this IServiceCollection serviceCollection)
{
serviceCollection.AddHttpClient<NPPESApiClient>();

return serviceCollection;
}
}
}

#endif
6 changes: 6 additions & 0 deletions NPPESAPI.net/Models/AddressPurpose.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
namespace Forcura.NPPES.Models
{
/// <summary>
/// Refers to whether the address information entered pertains to the provider's Mailing Address or the provider's Practice Location Address.
/// When not specified, the results will contain the providers where either the Mailing Address or any of Practice Location Addresses match the
/// entered address information. PRIMARY will only search against Primary Location Address. While Secondary will only search against Secondary
/// Location Addresses.
/// </summary>
public enum AddressPurpose
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions NPPESAPI.net/Models/AddressType.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Forcura.NPPES.Models
{
/// <summary>
/// The type of address being described.
/// </summary>
public enum AddressType
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions NPPESAPI.net/Models/NPPESAddress.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Forcura.NPPES.Models
{
/// <summary>
/// The NPPES Address.
/// </summary>
public class NPPESAddress
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions NPPESAPI.net/Models/NPPESBasic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Forcura.NPPES.Models
{
/// <summary>
/// Basic information regarding the NPPES entry.
/// </summary>
public class NPPESBasic
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions NPPESAPI.net/Models/NPPESError.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
namespace Forcura.NPPES.Models
{
/// <summary>
/// NPPES Error returned from the API.
/// </summary>
public class NPPESError
{
/// <summary>
Expand Down
22 changes: 22 additions & 0 deletions NPPESAPI.net/Models/NPPESIdentifier.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
namespace Forcura.NPPES.Models
{
/// <summary>
/// Describes an identifier of the NPI entry.
/// </summary>
public class NPPESIdentifier
{
/// <summary>
/// The identifier.
/// </summary>
public string Identifier { get; set; }

/// <summary>
/// The code.
/// </summary>
public string Code { get; set; }

/// <summary>
/// The state.
/// </summary>
public string State { get; set; }

/// <summary>
/// The issuer.
/// </summary>
public string Issuer { get; set; }

/// <summary>
/// The description.
/// </summary>
public string Description { get; set; }
}
}
34 changes: 34 additions & 0 deletions NPPESAPI.net/Models/NPPESOtherName.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,48 @@
namespace Forcura.NPPES.Models
{
/// <summary>
/// Other names associated to the NPI.
/// </summary>
public class NPPESOtherName
{
/// <summary>
/// The organization name.
/// </summary>
public string OrganizationName { get; set; }

/// <summary>
/// The code.
/// </summary>
public string Code { get; set; }

/// <summary>
/// The last name.
/// </summary>
public string LastName { get; set; }

/// <summary>
/// The first name.
/// </summary>
public string FirstName { get; set; }

/// <summary>
/// The middle name.
/// </summary>
public string MiddleName { get; set; }

/// <summary>
/// The name prefix.
/// </summary>
public string Prefix { get; set; }

/// <summary>
/// The name suffix.
/// </summary>
public string Suffix { get; set; }

/// <summary>
/// The credentials.
/// </summary>
public string Credential { get; set; }
}
}
3 changes: 3 additions & 0 deletions NPPESAPI.net/Models/NPPESResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace Forcura.NPPES.Models
{
/// <summary>
/// A search result returned from the NPPES API.
/// </summary>
public class NPPESResult
{
/// <summary>
Expand Down
Loading

0 comments on commit 0fa0b23

Please sign in to comment.