Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on:
push:
tags:
- "*"

permissions:
actions: read
pages: write
id-token: write
Comment on lines +6 to +9

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Grant contents permission for checkout

The workflow overrides the GITHUB_TOKEN scopes to only actions/pages/id-token, so the default contents: read scope is removed. actions/checkout@v3 needs contents: read to pull the repo; with these permissions the checkout step will fail on every tag push and docs will never build. Add contents: read under permissions to allow the publish-docs job to run.

Useful? React with 👍 / 👎.


# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
publish-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Dotnet Setup
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.x

- run: dotnet tool update -g docfx
- run: docfx docs/docfx.json

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/_site'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -555,3 +555,6 @@ coverage.json
coverage.cobertura.xml

# End of https://www.gitignore.io/api/aspnetcore,visualstudio,visualstudiocode,openframeworks+visualstudio

docs/_site
docs/api
3 changes: 0 additions & 3 deletions CoreZipCode/Interfaces/PostCodeBaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@

namespace CoreZipCode.Interfaces
{
/// <inheritdoc />
/// <summary>
/// Postcode base service abstract class.
/// </summary>
public abstract class PostcodeBaseService : ApiHandler
{
/// <inheritdoc />
/// <summary>
/// postalcode base service protected constructor.
/// </summary>
protected PostcodeBaseService() { }

/// <inheritdoc />
/// <summary>
/// postalcode base service protected constructor.
/// </summary>
Expand Down
3 changes: 0 additions & 3 deletions CoreZipCode/Interfaces/ZipCodeBaseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,16 @@

namespace CoreZipCode.Interfaces
{
/// <inheritdoc />
/// <summary>
/// Zip code base service abstract class
/// </summary>
public abstract class ZipCodeBaseService : ApiHandler
{
/// <inheritdoc />
/// <summary>
/// Zip Code Base Service protected constructor.
/// </summary>
protected ZipCodeBaseService() { }

/// <inheritdoc />
/// <summary>
/// Zip Code Base Service protected constructor.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

namespace CoreZipCode.Services.Postcode.PostalpincodeInApi
{
/// <summary>
/// Provides access to the Postalpincode.in API for retrieving postal code information.
/// </summary>
/// <remarks>This class extends <see cref="PostcodeBaseService"/> to implement API-specific behavior for
/// Postalpincode.in. Use this class to construct requests and obtain data related to Indian postal pincodes.
/// Instances can be initialized with an <see cref="HttpClient"/> to customize HTTP request handling.
/// For more information about the Postal Pin Code API, see http://www.postalpincode.in/.</remarks>
public class PostalpincodeIn : PostcodeBaseService
{
public PostalpincodeIn() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

namespace CoreZipCode.Services.Postcode.PostalpincodeInApi
{
/// <summary>
/// Represents the response model for postal pincode queries, containing status information, a message, and a
/// collection of post office details.
/// </summary>
/// <remarks>This class is typically used to deserialize responses from postal pincode APIs. The
/// properties correspond to the expected fields in the API response, allowing access to the status, message, and
/// associated post office data.</remarks>
[Serializable]
public class PostalpincodeInModel
{
Expand All @@ -17,6 +24,14 @@ public class PostalpincodeInModel
public List<PostOffice> PostOffice { get; set; }
}

/// <summary>
/// Represents a postal office location and its associated details, including name, branch type, delivery status,
/// and geographic information.
/// </summary>
/// <remarks>This class is typically used to model information about a post office for address validation,
/// postal lookup, or geographic categorization scenarios. All properties are read-write and correspond to standard
/// attributes found in postal systems. Instances of this class can be serialized for data exchange or storage
/// purposes.</remarks>
[Serializable]
public class PostOffice
{
Expand Down
7 changes: 7 additions & 0 deletions CoreZipCode/Services/Postcode/PostcodesIoApi/PostcodesIo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

namespace CoreZipCode.Services.Postcode.PostcodesIoApi
{
/// <summary>
/// Provides access to postcode lookup services using the Postcodes.io API.
/// </summary>
/// <remarks>This class extends <see cref="PostcodeBaseService"/>. Use this class to construct requests for postcode
/// information via the postcodes.io endpoint. Inherit from this class to extend or customize postcode-related operations.
/// This class is intended for use with UK postcodes and relies on an HTTP client for making API requests. For more
/// information about the Postcodes API, see https://postcodes.io.</remarks>
public class PostcodesIo : PostcodeBaseService
{
public PostcodesIo() { }
Expand Down
23 changes: 23 additions & 0 deletions CoreZipCode/Services/Postcode/PostcodesIoApi/PostcodesIoModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@

namespace CoreZipCode.Services.Postcode.PostcodesIoApi
{
/// <summary>
/// Represents the response model for the Postcodes.io API, containing the status code and a collection of postcode
/// results.
/// </summary>
/// <remarks>This class is typically used to deserialize JSON responses from the Postcodes.io service. The
/// structure matches the standard response format returned by the API for postcode queries.</remarks>
[Serializable]
public class PostcodesIoModel
{
Expand All @@ -14,6 +20,15 @@ public class PostcodesIoModel
public List<Result> Result { get; set; }
}

/// <summary>
/// Represents detailed information about a UK postcode, including geographic, administrative, and electoral data as
/// returned by postcode lookup services.
/// </summary>
/// <remarks>This class provides structured access to various attributes associated with a postcode, such
/// as location coordinates, administrative regions, and health authorities. It is typically used to deserialize
/// responses from postcode APIs and may contain null or default values for properties where data is unavailable.
/// Thread safety is not guaranteed; if multiple threads access an instance concurrently, external synchronization
/// is required.</remarks>
[Serializable]
public class Result
{
Expand Down Expand Up @@ -90,6 +105,14 @@ public class Result
public Codes Codes { get; set; }
}

/// <summary>
/// Represents a collection of administrative and geographic codes associated with a location, such as district,
/// county, ward, parish, and constituency identifiers.
/// </summary>
/// <remarks>This class is typically used to provide standardized codes for various administrative
/// divisions in the United Kingdom. The codes correspond to specific government or statistical regions and can be
/// used for data integration, analysis, or mapping purposes. All properties are optional and may be null if the
/// corresponding code is not available.</remarks>
[Serializable]
public class Codes
{
Expand Down
8 changes: 8 additions & 0 deletions CoreZipCode/Services/ZipCode/SmartyApi/Smarty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@

namespace CoreZipCode.Services.ZipCode.SmartyApi
{
/// <summary>
/// Provides access to Smarty ZIP code and street address lookup services using authenticated API requests.
/// </summary>
/// <remarks>Use this class to construct authenticated requests to the Smarty US ZIP code and
/// street address APIs. The class requires valid authentication credentials, which are used to authorize each
/// request. Inherit from <see cref="ZipCodeBaseService"/> to enable integration with other ZIP code service implementations. This
/// class is not thread-safe; create a separate instance for each concurrent operation if needed. For more information about the Smarty API, see
/// https://www.smarty.com/.</remarks>
public class Smarty : ZipCodeBaseService
{
private const string ZipCodeSizeErrorMessage = "Invalid ZipCode Size";
Expand Down
6 changes: 6 additions & 0 deletions CoreZipCode/Services/ZipCode/SmartyApi/SmartyException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

namespace CoreZipCode.Services.ZipCode.SmartyApi
{
/// <summary>
/// Represents errors that occur during Smarty operations.
/// </summary>
/// <remarks>Use this exception to indicate failures specific to Smarty functionality. This exception is
/// typically thrown when an operation cannot be completed due to invalid input, configuration issues, or other
/// conditions unique to Smarty. For general exceptions, use the base <see cref="Exception"/> class.</remarks>
public class SmartyException : Exception
{
public SmartyException(string message) : base(message)
Expand Down
20 changes: 20 additions & 0 deletions CoreZipCode/Services/ZipCode/SmartyApi/SmartyModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

namespace CoreZipCode.Services.ZipCode.SmartyApi
{
/// <summary>
/// Represents the result of a Smarty address lookup, including input index and associated city-state and ZIP code
/// data.
/// </summary>
/// <remarks>This model is typically used to deserialize responses from Smarty APIs. It contains
/// collections of city-state and ZIP code information corresponding to the input address. The class is serializable
/// and designed for use with JSON serialization frameworks.</remarks>
[Serializable]
public class SmartyModel
{
Expand All @@ -17,6 +24,12 @@ public class SmartyModel
public List<Zipcode> Zipcodes { get; set; }
}

/// <summary>
/// Represents a city and its associated state information, including mailing eligibility.
/// </summary>
/// <remarks>This class is typically used to model address components for postal or location-based
/// operations. The properties provide both the full state name and its abbreviation, as well as an indicator of
/// whether the city is recognized for mailing purposes.</remarks>
public class CityState
{
[JsonProperty("city")]
Expand All @@ -32,6 +45,13 @@ public class CityState
public bool MailableCity { get; set; }
}

/// <summary>
/// Represents a United States postal ZIP code and its associated geographic and administrative information.
/// </summary>
/// <remarks>This class provides properties for common ZIP code attributes, including location
/// coordinates, city, county, and state details. It is typically used to model ZIP code data retrieved from
/// external sources or APIs. All properties are read-write and correspond to standard ZIP code metadata
/// fields.</remarks>
public class Zipcode
{
[JsonProperty("zipcode")]
Expand Down
30 changes: 30 additions & 0 deletions CoreZipCode/Services/ZipCode/SmartyApi/SmartyParamsModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

namespace CoreZipCode.Services.ZipCode.SmartyApi
{
/// <summary>
/// Represents the address candidate parameters returned by the Smarty address validation API.
/// </summary>
/// <remarks>This model contains detailed information about a validated address, including its components,
/// metadata, and analysis results. It is typically used to access parsed address fields and related data after a
/// Smarty address lookup operation.</remarks>
public class SmartyParamsModel
{
[JsonProperty("input_index")]
Expand Down Expand Up @@ -29,6 +35,13 @@ public class SmartyParamsModel
public Analysis Analysis { get; set; }
}

/// <summary>
/// Represents the results of address analysis, including DPV (Delivery Point Validation) codes and related status
/// indicators.
/// </summary>
/// <remarks>This class provides properties for various USPS DPV analysis codes and flags, which can be
/// used to interpret the deliverability and status of an address. The property values correspond to codes returned
/// by address validation services and may require reference to USPS documentation for detailed meaning.</remarks>
public class Analysis
{
[JsonProperty("dpv_match_code")]
Expand All @@ -47,6 +60,14 @@ public class Analysis
public string Active { get; set; }
}

/// <summary>
/// Represents the individual address components for a United States postal address, including street, city, state,
/// and ZIP code information.
/// </summary>
/// <remarks>This class provides structured properties for each part of an address, which can be used for
/// address parsing, validation, or formatting. All properties correspond to standard USPS address fields and are
/// mapped to their respective JSON keys for serialization and deserialization. Property values may be null or empty
/// if the corresponding address component is not available.</remarks>
public class Components
{
[JsonProperty("primary_number")]
Expand Down Expand Up @@ -80,6 +101,15 @@ public class Components
public string DeliveryPointCheckDigit { get; set; }
}

/// <summary>
/// Represents supplemental metadata information for a geographic or postal record, including location,
/// administrative, and delivery details.
/// </summary>
/// <remarks>The properties of this class provide access to various attributes such as record type, ZIP
/// code type, county information, carrier route, congressional district, residential delivery indicator (RDI),
/// enhanced line of travel (eLOT) data, geographic coordinates, time zone, and daylight saving time status. This
/// class is typically used to enrich address or location data with additional context for validation, analysis, or
/// delivery optimization scenarios.</remarks>
public class Metadata
{
[JsonProperty("record_type")]
Expand Down
7 changes: 7 additions & 0 deletions CoreZipCode/Services/ZipCode/ViaCepApi/ViaCep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@

namespace CoreZipCode.Services.ZipCode.ViaCepApi
{
/// <summary>
/// Provides an implementation of a zip code lookup service using the ViaCep API for Brazilian addresses.
/// </summary>
/// <remarks>ViaCep enables retrieval of address information based on zip code, state, city, and street
/// parameters. This class extends <see cref="ZipCodeBaseService"/> to construct ViaCep-specific request URLs. Use this service to
/// integrate Brazilian postal code queries into your application. For more information about the ViaCep API, see
/// https://viacep.com.br.</remarks>
public class ViaCep : ZipCodeBaseService
{
private const string ZipCodeSizeErrorMessage = "Invalid ZipCode Size";
Expand Down
7 changes: 7 additions & 0 deletions CoreZipCode/Services/ZipCode/ViaCepApi/ViaCepAddressModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

namespace CoreZipCode.Services.ZipCode.ViaCepApi
{
/// <summary>
/// Represents an address as returned by the ViaCep API, including postal code, street information, and regional
/// identifiers.
/// </summary>
/// <remarks>This model is typically used to deserialize address data from the ViaCep web service, which
/// provides postal code lookup for Brazilian addresses. All properties correspond to fields in the ViaCep API
/// response. This class is serializable and suitable for use in data transfer scenarios.</remarks>
[Serializable]
public class ViaCepAddressModel
{
Expand Down
6 changes: 6 additions & 0 deletions CoreZipCode/Services/ZipCode/ViaCepApi/ViaCepException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

namespace CoreZipCode.Services.ZipCode.ViaCepApi
{
/// <summary>
/// Represents errors that occur when interacting with the ViaCep API.
/// </summary>
/// <remarks>Use this exception to identify and handle failures specific to ViaCep operations, such as
/// invalid responses or connectivity issues. This exception is typically thrown when the ViaCep service returns an
/// error or cannot be reached. For general exceptions, use the base <see cref="Exception"/> class.</remarks>
public class ViaCepException : Exception
{
public ViaCepException(string message) : base(message)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ![CoreZipCode](./corezipcode.png)
# ![CoreZipCode](./docs/images/corezipcode.png)

[![Build](https://github.com/danilolutz/CoreZipCode/actions/workflows/main.yml/badge.svg)](https://github.com/danilolutz/CoreZipCode/actions/workflows/main.yml)
[![Coverage Status](https://coveralls.io/repos/github/danilolutz/CoreZipCode/badge.svg?branch=master)](https://coveralls.io/github/danilolutz/CoreZipCode?branch=master)
Expand All @@ -10,7 +10,7 @@

Normaly we must implement ZipCode or Postcode services every time in each new software we create. Well this package is for keep you [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) and eliminate the necessity to implement ZipCode or Postcode services over and over.

Also this package could be used for easily implements address services to yours [Microsoft .Net Core](https://dotnet.github.io/) based software.
Also this package could be used for easily implements address services to yours [Microsoft .NET](https://dotnet.github.io/) based software.

And the **CoreZipCode** was designed to be easily extensible, and if you want, implement your own address services, you only must override the API calls methods.

Expand Down
Loading