Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/russkyc/philippine-address-provider
Offline/Embedded PSGC Address Info Provider for .NET
https://github.com/russkyc/philippine-address-provider
address address-provider csharp nuget philippines psgc statistics
Last synced: about 1 month ago
JSON representation
Offline/Embedded PSGC Address Info Provider for .NET
- Host: GitHub
- URL: https://github.com/russkyc/philippine-address-provider
- Owner: russkyc
- License: mit
- Created: 2023-12-30T11:12:54.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-12-30T14:36:36.000Z (about 1 year ago)
- Last Synced: 2024-04-26T16:21:05.293Z (9 months ago)
- Topics: address, address-provider, csharp, nuget, philippines, psgc, statistics
- Language: C#
- Homepage:
- Size: 469 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Russkyc.Addresses.Philippines - Address Information Provider from the Philippine Standard Geographic Code Async(PSGC)
## :arrow_down: Installation
Nuget package installation
```
dotnet add package Russkyc.Addressess.Philippines
```Imports
```csharp
using Russkyc.Addressess.Philippines;
using Russkyc.Addressess.Philippines.Entities;
```## :sparkles: Sample Usage
### I. Regions
Get All
```csharp
// Get all regions in the Philippines
IEnumerable allRegions = await AddressProvider.GetRegionsAsync();
```
Get by Region
```csharp
// Get a specific region by name
Region? specificRegion = await AddressProvider.GetRegionAsync("Region V");
```Get by Region Name
```csharp
// Get a specific region by region name
Region? specificRegionByName = await AddressProvider.GetRegionByNameAsync("Bicol Region");
```Find
```csharp
// Find regions whose names contain the specified string
IEnumerable matchingRegions = await AddressProvider.FindRegionAsync("V");
```Find by Name
```csharp
// Find regions whose region names contain the specified string
IEnumerable matchingRegionsByName = await AddressProvider.FindRegionByNameAsync("Bicol");
```### II. Provinces
Get All
```csharp
// Get all provinces in the Philippines
IEnumerable allProvinces = await AddressProvider.GetProvincesAsync();
```Get by Region
```csharp
// Get provinces in a specific region
Region? specificRegion = await AddressProvider.GetRegionByNameAsync("Bicol Region");
IEnumerable provincesInRegion = await AddressProvider.GetProvincesByRegionAsync(specificRegion);
```Get by Region code
```csharp
// Get provinces in the region with the specified region code
IEnumerable provincesInRegionCode = await AddressProvider.GetProvincesByRegionCodeAsync("050000000");
```Get by Name
```csharp
// Get a specific province by name
Province? specificProvince = await AddressProvider.GetProvinceByNameAsync("Albay");
```Find by Name
```csharp
// Find provinces whose names contain the specified string
IEnumerable matchingProvinces = await AddressProvider.FindProvinceByNameAsync("Albay");
```
### III. Cities and MunicipalitiesGet All
```csharp
// Get all cities and municipalities in the Philippines
IEnumerable allCitiesMunicipalities = await AddressProvider.GetCitiesMunicipalitiesAsync();
```Get by Region
```csharp
// Get cities and municipalities in a specific region
Region? specificRegion = await AddressProvider.GetRegionAsync("Region V");
IEnumerable citiesMunicipalitiesInRegion = await AddressProvider.GetCitiesMunicipalitiesByRegionAsync(specificRegion);
```Get by Region code
```csharp
// Get cities and municipalities in the region with the specified region code
IEnumerable citiesMunicipalitiesInRegionCode = await AddressProvider.GetCitiesMunicipalitiesByRegionCodeAsync("050000000");
```Get by Province
```csharp
// Get cities and municipalities in a specific province
Province? specificProvince = await AddressProvider.GetProvinceByNameAsync("Albay");
IEnumerable citiesMunicipalitiesInProvince = await AddressProvider.GetCitiesMunicipalitiesByProvinceAsync(specificProvince);
```Get by Province code
```csharp
// Get cities and municipalities in the province with the specified province code
IEnumerable citiesMunicipalitiesInProvinceCode = await AddressProvider.GetCitiesMunicipalitiesByProvinceCodeAsync("050500000");
```Get by Name
```csharp
// Get a specific city or municipality by name
CityMunicipality? specificCityMunicipality = await AddressProvider.GetCityMunicipalityByNameAsync("Legazpi");
```Find by Name
```csharp
// Find cities and municipalities whose names contain the specified string
IEnumerable matchingCitiesMunicipalities = await AddressProvider.FindCityMunicipalityByNameAsync("Quezon");
```### IV. Barangays
#### GetBarangays
Get All
```csharp
// Get all barangays in the Philippines
IEnumerable allBarangays = await AddressProvider.GetBarangaysAsync();
```Get by Region
```csharp
// Get barangays in a specific region
Region? specificRegion = await AddressProvider.GetRegionAsync("Region V");
IEnumerable barangaysInRegion = await AddressProvider.GetBarangaysByRegionAsync(specificRegion);
```Get by Region code
```csharp
// Get barangays in the region with the specified region code
IEnumerable barangaysInRegionCode = await AddressProvider.GetBarangaysByRegionCodeAsync("050000000");
```Get by Province
```csharp
// Get barangays in a specific province
Province? specificProvince = await AddressProvider.GetProvinceByNameAsync("Albay");
IEnumerable barangaysInProvince = await AddressProvider.GetBarangaysByProvinceAsync(specificProvince);
```Get by Province code
```csharp
// Get barangays in the province with the specified province code
IEnumerable barangaysInProvinceCode = await AddressProvider.GetBarangaysByProvinceCodeAsync("050500000");
```Get by City/Municipality
```csharp
// Get barangays in the specified city or municipality
CityMunicipality? specificCityMunicipality = await AddressProvider.GetCityMunicipalityByNameAsync("Legazpi");
IEnumerable barangaysInCityMunicipality = await AddressProvider.GetBarangaysByCityMunicipalityAsync(specificCityMunicipality);
```Get by City/Municipality code
```csharp
// Get barangays in the city or municipality with the specified city code
IEnumerable barangaysInCityCode = await AddressProvider.GetBarangaysByCityCodeAsync("050506000");
```Get by Name
```csharp
// Get a specific barangay by name
Barangay? specificBarangay = await AddressProvider.GetBarangayByNameAsync("Mandaragat");
```Find by Name
```csharp
// Find barangays whose names contain the specified string
IEnumerable matchingBarangays = await AddressProvider.FindBarangayByNameAsync("Banlas");
```### V. ZipCode
Get by City/Municipality
```csharp
// Get the zip code for the specified city or municipality
string zipCodeForCityMunicipality = await AddressProvider.GetZipCodeByCityMunicipalityAsync(specificCityForZipCode);
```Get by City/Municipality Name
```csharp
// Get the zip code for the specified city or municipality by name
string zipCodeForCityMunicipalityByName = await AddressProvider.GetZipCodeByCityMunicipalityNameAsync("Quezon City");
```## :notebook: API Documentation
### AddressProvider Class
The `AddressProvider` class is a static class that provides access to address information for regions, provinces, cities/municipalities, barangays, and zip codes in the Philippines.
| Method | Description |
|----------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| `GetRegionsAsync()` | Gets all regions in the Philippines. |
| `GetRegionAsync(string name)` | Gets a region by its name, case-insensitive. |
| `GetRegionByNameAsync(string regionName)` | Gets a region by its region name, case-insensitive. |
| `FindRegionAsync(string name)` | Finds regions whose names contain the specified string, case-insensitive. |
| `FindRegionByNameAsync(string regionName)` | Finds regions whose region names contain the specified string, case-insensitive. |
| `GetProvincesAsync()` | Gets all provinces in the Philippines. |
| `GetProvincesByRegionAsync(Region region)` | Gets provinces in the specified region. |
| `GetProvincesByRegionCodeAsync(string regionCode)` | Gets provinces in the region with the specified region code. |
| `GetProvinceByNameAsync(string provinceName)` | Gets a province by its name, case-insensitive. |
| `FindProvinceByNameAsync(string provinceName)` | Finds provinces whose names contain the specified string, case-insensitive. |
| `GetCitiesMunicipalitiesAsync()` | Gets all cities and municipalities in the Philippines. |
| `GetCitiesMunicipalitiesByRegionAsync(Region region)` | Gets cities and municipalities in the specified region. |
| `GetCitiesMunicipalitiesByRegionCodeAsync(string regionCode)` | Gets cities and municipalities in the region with the specified region code. |
| `GetCitiesMunicipalitiesByProvinceAsync(Province province)` | Gets cities and municipalities in the specified province. |
| `GetCitiesMunicipalitiesByProvinceCodeAsync(string provinceCode)` | Gets cities and municipalities in the province with the specified province code. |
| `GetCityMunicipalityByNameAsync(string cityMunicipalityName)` | Gets a city or municipality by its name, case-insensitive. |
| `FindCityMunicipalityByNameAsync(string cityMunicipalityName)` | Finds cities and municipalities whose names contain the specified string, case-insensitive. |
| `GetBarangaysAsync()` | Gets all barangays in the Philippines. |
| `GetBarangaysByRegionAsync(Region region)` | Gets barangays in the specified region. |
| `GetBarangaysByRegionCodeAsync(string regionCode)` | Gets barangays in the region with the specified region code. |
| `GetBarangaysByProvinceAsync(Province province)` | Gets barangays in the specified province. |
| `GetBarangaysByProvinceCodeAsync(string provinceCode)` | Gets barangays in the province with the specified province code. |
| `GetBarangaysByCityMunicipalityAsync(CityMunicipality cityMunicipality)` | Gets barangays in the specified city or municipality. |
| `GetBarangaysByCityCodeAsync(string cityCode)` | Gets barangays in the city or municipality with the specified city code. |
| `GetBarangayByNameAsync(string barangayName)` | Gets a barangay by its name, case-insensitive. |
| `FindBarangayByNameAsync(string barangayName)` | Finds barangays whose names contain the specified string, case-insensitive. |
| `GetZipCodeByCityMunicipalityAsync(CityMunicipality cityMunicipality)` | Gets the zip code for the specified city or municipality. |
| `GetZipCodeByCityMunicipalityNameAsync(string cityMunicipalityName)` | Gets the zip code for the specified city or municipality by name, case-insensitive. |## :heart: Donate
This is free and available for everyone to use, but still requires time for development
and maintenance. By choosing to donate, you are not only helping develop this project,
but you are also helping me dedicate more time for creating more tools that help the community :heart:## :tada: Special Thanks
This project is made easier to develop by Jetbrains! They have provided
Licenses to their IDE's to support development of this open-source project.