Skip to content

Commit

Permalink
Merge pull request #10 from Aletheia-Data/feature/add-api-banks
Browse files Browse the repository at this point in the history
add api banks
  • Loading branch information
EnzoVezzaro authored Nov 29, 2023
2 parents 7640614 + acb8d5f commit a8f5a2f
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ The Aletheia SDK provides services from the following providers:

The Aletheia SDK provides open data from the following API endpoints:

OFFICIAL:

| Name | API URL | API Specs | Status | Authentication |
| -------------------------------------- | ------------------------------------------ | --------------------------------------------| ------------ | ---------------------- |
| Aletheia Data | https://aletheiadata.org/ | [API Specs](https://admin.aletheiadata.org/documentation/v1.0.0) | up-to-date | No |
Expand All @@ -82,6 +84,13 @@ The Aletheia SDK provides open data from the following API endpoints:
| Portal de API's Dominicano | https://developer.digital.gob.do/server/portal/environments/DEFAULT | [Not Available](#) | up-to-date | No |
| Ministerio de Medio Ambiente y Recursos Naturales | https://apisolicitudambiental.ambiente.gob.do/swagger/index.html | [API Specs](https://apisolicitudambiental.ambiente.gob.do/swagger/index.html) | up-to-date | Yes/No |

UNOFFICIAL:

| Name | API URL | API Specs | Status | Authentication |
| -------------------------------------- | ------------------------------------------ | --------------------------------------------| ------------ | ---------------------- |
| API Bancos republica dominicana | https://github.com/Erinxon/api-bancos-republica-dominicana | [API Specs](https://banks.fly.dev/swagger/index.html) | up-to-date | No |


## 🙏🏾 Special Thanks

We extend our sincere gratitude to all Dominican governments and private organizations that contribute to the public good by publishing their APIs and open data. Their commitment to transparency and accessibility empowers developers and enhances the capabilities of our development community.
Expand Down
9 changes: 8 additions & 1 deletion examples/basicUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,14 @@ async function getAmbiente(){
console.log('Ambiente:', ambiente.data);
}

getAmbiente();
// getAmbiente();

async function getBanks(){
const banks = await aletheiaSDK.opendata.getBanks();
console.log('Banks:', banks.data);
}

getBanks();


// Call the methods
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aletheia-data/aletheia-sdk",
"version": "0.4.1",
"version": "0.4.2",
"description": "Aletheia SDK",
"main": "AletheiaSDK.js",
"directories": {
Expand Down
52 changes: 52 additions & 0 deletions services/openData.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,58 @@ class OpenData extends FetchService {
return this.fetchData(endpoint);
}

/**
* UNOFFICIAL: Retrieves a list of banks from the API.
* REPO: https://github.com/Erinxon/api-bancos-republica-dominicana
* <br /><br />Full documentation: <a href="https://banks.fly.dev/swagger/index.html" target="_blank">https://banks.fly.dev/swagger/index.html</a>
*
* @async
* @returns {Promise<Object>} - A Promise that resolves to the list of banks.
* @throws {Error} - Throws an error if there is an issue with the API request.
* @example
* async function getDominicanBanks() {
* try {
* const banks = await aletheiaSDK.opendata.getBanks();
* console.log('Dominican Banks:', banks);
* } catch (error) {
* console.error('Error retrieving fuel prices:', error);
* }
* }
* getDominicanBanks();
*/
async getBanks() {
const endpoint = `https://banks.fly.dev/api/Banks`;

return this.fetchData(endpoint);
}

/**
* UNOFFICIAL: Retrieves detailed information about a bank based on the provided URL.
* REPO: https://github.com/Erinxon/api-bancos-republica-dominicana
* <br /><br />Full documentation: <a href="https://banks.fly.dev/swagger/index.html" target="_blank">https://banks.fly.dev/swagger/index.html</a>
*
* @async
* @param {string} linkDetail - The URL link of the bank's details.
* @returns {Promise<Object>} - A Promise that resolves to the detailed information about the bank.
* @throws {Error} - Throws an error if there is an issue with the API request.
* @example
* async function getDominicanBankDetails() {
* try {
* const linkDetail = 'https://sb.gob.do/supervisados/entidades-de-intermediacion-financiera/banreservas/';
* const bankDetails = await aletheiaSDK.opendata.getBankDetail(linkDetail);
* console.log('Dominican Bank:', bankDetails);
* } catch (error) {
* console.error('Error retrieving fuel prices:', error);
* }
* }
* getDominicanBankDetails();
*/
async getBankDetail(linkDetail) {
const endpoint = `https://banks.fly.dev/api/Banks/Detail?URL=${encodeURIComponent(linkDetail)}`;

return this.fetchData(endpoint);
}

gob(gob) {
switch (gob) {
case 'map':
Expand Down

0 comments on commit a8f5a2f

Please sign in to comment.