{"_id":"@cncflora/iucn-redlist-api-wrapper","_rev":"4-5a356396863b6e2c272bf3a9ea09c3ae","name":"@cncflora/iucn-redlist-api-wrapper","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.0":{"name":"@cncflora/iucn-redlist-api-wrapper","version":"0.0.0","author":{"name":"Vicente Calfo"},"license":"MIT","_id":"@cncflora/iucn-redlist-api-wrapper@0.0.0","maintainers":[{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"}],"dist":{"shasum":"8834174a9bf22d1e6eda926070c64b7eff648f17","tarball":"https://registry.npmjs.org/@cncflora/iucn-redlist-api-wrapper/-/iucn-redlist-api-wrapper-0.0.0.tgz","fileCount":18,"integrity":"sha512-64Rcyv3rEGBgtprFgn4WQDPKb6k28Efjo9zZmrYmG+1d8SyqoLOAyrPJsCNh97HXAqjiDQw9617Y7swcz1VhMg==","signatures":[{"sig":"MEUCIQD1FjdxQLjb/L9L4l2KsMU0EBmIESyyjd5cBnpeNwX5jwIgcVXjqOStOY+FPIcf/6ERGSHiuDMgfQFS8c+9LwF0aXs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20271},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"ea137fd238b9d20cb5956be1fa736734780a24ca","private":false,"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"},"_npmVersion":"10.2.4","description":"This is test typescript project","directories":{},"_nodeVersion":"20.11.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","dotenv":"^16.4.5","ts-jest":"^29.2.5","typescript":"^4.0.5","@types/jest":"^29.5.12","@jest/globals":"^29.7.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/iucn-redlist-api-wrapper_0.0.0_1726169130782_0.9992693477952828","host":"s3://npm-registry-packages"}},"0.0.1":{"name":"@cncflora/iucn-redlist-api-wrapper","version":"0.0.1","author":{"name":"Vicente Calfo"},"license":"MIT","_id":"@cncflora/iucn-redlist-api-wrapper@0.0.1","maintainers":[{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"}],"dist":{"shasum":"5aacca4f69b21c7d1af34c1704e1d6e2436c1134","tarball":"https://registry.npmjs.org/@cncflora/iucn-redlist-api-wrapper/-/iucn-redlist-api-wrapper-0.0.1.tgz","fileCount":18,"integrity":"sha512-kE35NBUXyn25UVnGPdL1spm06+rEpiiAkJCkXuiucbitkSzpvxZl8KdsMcaq29F8rQHYNvtLg40ImXOTmNQT5A==","signatures":[{"sig":"MEQCIADRKpTc3gPvodjRAQSSmLHTyNgUi6gXPtt4g6FUuuEdAiBhQpAf4jzRxRyziySyhlDzasy9DDaf6aSmA85bzgS6dg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":19706},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"ea137fd238b9d20cb5956be1fa736734780a24ca","private":false,"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"},"_npmVersion":"10.2.4","description":"This is test typescript project","directories":{},"_nodeVersion":"20.11.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","dotenv":"^16.4.5","ts-jest":"^29.2.5","typescript":"^4.0.5","@types/jest":"^29.5.12","@jest/globals":"^29.7.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/iucn-redlist-api-wrapper_0.0.1_1726226609717_0.5635661689817766","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"@cncflora/iucn-redlist-api-wrapper","version":"0.0.2","author":{"name":"Vicente Calfo"},"license":"MIT","_id":"@cncflora/iucn-redlist-api-wrapper@0.0.2","maintainers":[{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"}],"dist":{"shasum":"439f0eb3bc24fa393e85017e3c296e47f4f1d533","tarball":"https://registry.npmjs.org/@cncflora/iucn-redlist-api-wrapper/-/iucn-redlist-api-wrapper-0.0.2.tgz","fileCount":18,"integrity":"sha512-OkScc5z/NIjTqzb46KnwklzVz8NOaa6Qmqpsgr1IWjKZYnDew97n/CnZIYZa4pVqPnADz4W7BwnOzUbQJ5p//A==","signatures":[{"sig":"MEUCIEeOFpjqws1SZEiTcoTYnQGsLs6cH1vwmP0XxKRvneWJAiEAy0RWts1obRe1JfW3Tl3wM6slTFlq7StnghajhDYchK0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21297},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"ea137fd238b9d20cb5956be1fa736734780a24ca","private":false,"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"},"_npmVersion":"10.2.4","description":"This is test typescript project","directories":{},"_nodeVersion":"20.11.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","dotenv":"^16.4.5","ts-jest":"^29.2.5","typescript":"^4.0.5","@types/jest":"^29.5.12","@jest/globals":"^29.7.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/iucn-redlist-api-wrapper_0.0.2_1726227798991_0.8955654006562996","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"@cncflora/iucn-redlist-api-wrapper","version":"0.0.3","author":{"name":"Vicente Calfo"},"license":"MIT","_id":"@cncflora/iucn-redlist-api-wrapper@0.0.3","maintainers":[{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"}],"dist":{"shasum":"11bef70f1705c44bed5474af888f39a914065b2d","tarball":"https://registry.npmjs.org/@cncflora/iucn-redlist-api-wrapper/-/iucn-redlist-api-wrapper-0.0.3.tgz","fileCount":18,"integrity":"sha512-96VIh47agmYhviqwnB05Ix9LAZpj4PZQ1J9Raj1rLJSL3rEoBuoATnP0qTFexADHiULt1xB0vNZ6Kl1kYNcfyw==","signatures":[{"sig":"MEYCIQCyHQrmVwDB6k7wPZfqO6aEiTdvF4QgPVF+C5fYlZqa0gIhAICH4DbrdMObsxB8a6wjnNAzw47s2oJGx0LKr4z0up3x","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21720},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"ea137fd238b9d20cb5956be1fa736734780a24ca","private":false,"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"},"_npmVersion":"10.2.4","description":"This is test typescript project","directories":{},"_nodeVersion":"20.11.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","dotenv":"^16.4.5","ts-jest":"^29.2.5","typescript":"^4.0.5","@types/jest":"^29.5.12","@jest/globals":"^29.7.0","@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7"},"_npmOperationalInternal":{"tmp":"tmp/iucn-redlist-api-wrapper_0.0.3_1726228037224_0.6428845258662246","host":"s3://npm-registry-packages"}},"0.0.4":{"name":"@cncflora/iucn-redlist-api-wrapper","version":"0.0.4","description":"The iucn-redlist-api-wrapper is a TypeScript package that provides a convenient interface for interacting with the IUCN Redlist API. This package allows you to fetch data about taxa, including details by SIS ID, scientific name, and more.","main":"dist/index.js","author":{"name":"Vicente Calfo","email":"vicentecalfo.dev@gmail.com"},"license":"MIT","private":false,"devDependencies":{"@babel/preset-env":"^7.25.4","@babel/preset-typescript":"^7.24.7","@jest/globals":"^29.7.0","@types/jest":"^29.5.12","dotenv":"^16.4.5","fs-extra":"^11.2.0","jest":"^29.7.0","ts-jest":"^29.2.5","typescript":"^4.0.5"},"scripts":{"build":"tsc","prepublishOnly":"npm run build"},"dependencies":{"json-2-csv":"^5.5.5","safe-flat":"^2.1.0"},"keywords":["IUCN","API","IUCN Red List","Conservation","Biodiversity"],"_id":"@cncflora/iucn-redlist-api-wrapper@0.0.4","gitHead":"870cdbcfcec41e35c25d81e45571e51f2abc131b","types":"./dist/index.d.ts","_nodeVersion":"20.11.0","_npmVersion":"10.2.4","dist":{"integrity":"sha512-WR/4LTLG7PUyMEu6Bmo0VBnAJoc3lib1P0hh7O0xOa7ZKDDj7eakK1JNAuIEJdiIeWbiKFlNXBy60Cx8HbnPjA==","shasum":"e93e89184d2e9cacd3b1753c978f8003a2ef0168","tarball":"https://registry.npmjs.org/@cncflora/iucn-redlist-api-wrapper/-/iucn-redlist-api-wrapper-0.0.4.tgz","fileCount":18,"unpackedSize":26261,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD25ED5eWbyy6tUWNyduU8n4mhH/zxRr3guDb0A1WSBeAIgKa8Lp5ls/iwzqq3wMCF3pvYJ5V8FyhLZUi1Qq3kZ1g0="}]},"_npmUser":{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"},"directories":{},"maintainers":[{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/iucn-redlist-api-wrapper_0.0.4_1726235417832_0.6388227136859761"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-12T19:25:30.636Z","modified":"2024-09-13T13:50:18.232Z","0.0.0":"2024-09-12T19:25:30.935Z","0.0.1":"2024-09-13T11:23:29.900Z","0.0.2":"2024-09-13T11:43:19.128Z","0.0.3":"2024-09-13T11:47:17.387Z","0.0.4":"2024-09-13T13:50:18.038Z"},"author":{"name":"Vicente Calfo","email":"vicentecalfo.dev@gmail.com"},"license":"MIT","description":"The iucn-redlist-api-wrapper is a TypeScript package that provides a convenient interface for interacting with the IUCN Redlist API. This package allows you to fetch data about taxa, including details by SIS ID, scientific name, and more.","maintainers":[{"name":"vicentecalfo.dev","email":"vicentecalfo.dev@gmail.com"}],"readme":"# IUCN Redlist API Wrapper\r\n\r\n## Overview\r\n\r\nThe `iucn-redlist-api-wrapper` is a TypeScript package that provides a convenient interface for interacting with the IUCN Redlist API. This package allows you to fetch data about taxa, including details by SIS ID, scientific name, and more.\r\n\r\n## Installation\r\n\r\nTo install the package, use npm:\r\n\r\n```bash\r\nnpm install iucn-redlist-api-wrapper\r\n```\r\n\r\n## Usage\r\n\r\n### Setup\r\n\r\nFirst, import the IUCNredlist class from the package:\r\n\r\n```typescript\r\nimport { IUCNredlist } from \"iucn-redlist-api-wrapper\";\r\n```\r\n\r\nCreate an instance of the IUCNredlist class with your API token:\r\n\r\n```typescript\r\nconst api = new IUCNredlist({ token: \"YOUR_API_TOKEN\" });\r\n```\r\n\r\n### Making Requests\r\n\r\nYou can use the taxa method to query various resources from the API. Below are some examples of how to use the package:\r\n\r\n#### 1. Query by SIS ID\r\n\r\nFetch data using a SIS ID:\r\n\r\n```typescript\r\nconst { taxon } = await api.get({\r\n  resource: \"taxa/sis\",\r\n  params: { sis_id: 172817975 },\r\n});\r\n```\r\n\r\n#### 2. Query by Scientific Name\r\n\r\nFetch data using scientific names:\r\n\r\n```typescript\r\nconst { taxon } = await api.get({\r\n  resource: \"taxa/scientific_name\",\r\n  params: {\r\n    genus_name: \"Aegis\",\r\n    species_name: \"luteocontexta\",\r\n  },\r\n});\r\n```\r\n\r\n#### 3. Fetch Kingdom Names\r\n\r\nRetrieve a list of kingdom names:\r\n\r\n```typescript\r\nconst { kingdom_names } = await api.get({\r\n  resource: \"taxa/kingdom\",\r\n});\r\n```\r\n\r\n#### 4. Query Kingdom by Name\r\n\r\nFetch data for a specific kingdom:\r\n\r\n```typescript\r\nconst { assessments } = await api.get({\r\n  resource: \"taxa/kingdom\",\r\n  params: {\r\n    kingdom_name: \"ANIMALIA\",\r\n    page: 1,\r\n    year_published: 2020,\r\n  },\r\n});\r\n```\r\n\r\n#### 5. Query Family by Name\r\n\r\nFetch data for a specific family:\r\n\r\n```typescript\r\nconst { assessments } = await api.get({\r\n  resource: \"taxa/family\",\r\n  params: {\r\n    family_name: \"ACANTHACEAE\",\r\n    year_published: 2020,\r\n  },\r\n});\r\n```\r\n\r\n#### 6. Biogeographical Realms\r\n\r\nFetch Biogeographical Realms:\r\n\r\n```typescript\r\nconst { biogeographical_realms } = await api.get({\r\n  resource: \"biogeographical_realms\",\r\n});\r\n```\r\n\r\n#### 7. Assessment by ID\r\n\r\nFetch Assessment by ID:\r\n\r\n```typescript\r\nconst assessment = await api.get({\r\n  resource: \"assessment\",\r\n  params: {\r\n    assessment_id: 172861292,\r\n  },\r\n});\r\n```\r\n\r\n## Output Formatting\r\n\r\nThe IUCN Redlist API allows you to customize the format of the response by using the `format` parameter. This can be particularly useful when you want to process or save the data in different formats. Below are the supported options:\r\n\r\n### Format Options\r\n\r\n#### 1. CSV\r\nBy setting the `format` parameter to `\"CSV\"`, the API response will be formatted as comma-separated values (CSV). This is useful when you intend to save the data directly to a CSV file for further processing or use in spreadsheet applications.\r\n\r\n```typescript\r\nconst { biogeographical_realms } = await api.get({\r\n  resource: \"biogeographical_realms\",\r\n  format: \"CSV\"\r\n});\r\n```\r\nIn this example, the response will be pre-formatted as CSV, making it easy to save the data to a file.\r\n\r\n#### 2. FLAT_JSON\r\nhe format parameter can also be set to \"FLAT_JSON\" to return the data in a flattened JSON structure. When using this option, all nested attributes will be concatenated using dots (.). This is helpful for simplifying nested data and using it in contexts where a flat structure is preferred.\r\n\r\n```typescript\r\nconst { biogeographical_realms } = await api.get({\r\n  resource: \"biogeographical_realms\",\r\n  format: \"FLAT_JSON\"\r\n});\r\n```\r\n\r\nIn this case, any nested attributes in the response will be flattened, and their keys will be joined with a dot (.).\r\n\r\n#### 3. JSON (Default)\r\nIf no format parameter is specified, the API response will default to a standard JSON structure. This is the default behavior and does not require explicit declaration. Nested attributes will be preserved in their original structure.\r\n\r\n```typescript\r\nconst { biogeographical_realms } = await api.get({\r\n  resource: \"biogeographical_realms\"\r\n});\r\n // or\r\nconst { biogeographical_realms } = await api.get({\r\n  resource: \"biogeographical_realms\",\r\n  format: \"JSON\"\r\n});\r\n```\r\nIn this case, the response will be returned as a standard JSON object without any additional formatting, exactly as provided by the API.\r\n\r\n\r\n## Resources and Parameters\r\n\r\nAll available resources and parameters for the IUCN Redlist API can be found in the official API documentation. For detailed information on how to use each endpoint and the parameters required, please refer to the following link:\r\n\r\n[API Documentation](https://api.iucnredlist.org/api-docs/index.html)\r\n\r\n## Important Notice\r\n\r\nThis package is not an official product of the International Union for Conservation of Nature (IUCN). It is an independent wrapper designed to simplify interactions with the IUCN Red List API.\r\n\r\nEven though you are using this package, it is crucial to give proper acknowledgment and citation to the IUCN Red List API. When using the API or any data obtained from it, please ensure to cite it correctly as follows:\r\n\r\n**Citation:** IUCN 2024. IUCN Red List of Threatened Species. Version 2024-1 <www.iucnredlist.org>.\r\n","readmeFilename":"readme.md","keywords":["IUCN","API","IUCN Red List","Conservation","Biodiversity"]}