{"id":24418743,"url":"https://github.com/ronfflex/crypto-coins-price-lib","last_synced_at":"2026-02-02T00:35:17.770Z","repository":{"id":271283351,"uuid":"910092085","full_name":"Ronfflex/Crypto-coins-price-lib","owner":"Ronfflex","description":"Library made in re:script that fetches crypto coins price over many different providers.","archived":false,"fork":false,"pushed_at":"2025-01-08T14:52:01.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-21T09:06:46.604Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"ReScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ronfflex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-30T13:26:01.000Z","updated_at":"2025-01-08T14:52:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"061ec434-8a6e-4aba-bf1c-c6a93e02351c","html_url":"https://github.com/Ronfflex/Crypto-coins-price-lib","commit_stats":null,"previous_names":["ronfflex/crypto-coins-price-lib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ronfflex/Crypto-coins-price-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ronfflex%2FCrypto-coins-price-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ronfflex%2FCrypto-coins-price-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ronfflex%2FCrypto-coins-price-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ronfflex%2FCrypto-coins-price-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ronfflex","download_url":"https://codeload.github.com/Ronfflex/Crypto-coins-price-lib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ronfflex%2FCrypto-coins-price-lib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28997031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T23:10:54.274Z","status":"ssl_error","status_checked_at":"2026-02-01T23:10:47.298Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-20T09:13:20.576Z","updated_at":"2026-02-02T00:35:17.766Z","avatar_url":"https://github.com/Ronfflex.png","language":"ReScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crypto Coins Price Library\n\nUne bibliothèque simple pour récupérer les prix de cryptomonnaies en fonction de paires (ex. : BTC/USD) à l'aide de l'API de CoinGecko.\n\n---\n\n## 📦 Installation\n\n1. Clonez le projet depuis GitHub (ou téléchargez les fichiers) :\n   ```bash\n   git clone https://github.com/username/crypto-coins-price-lib.git\n   cd crypto-coins-price-lib\n   ```\n\n2. Installez les dépendances :\n   ```bash\n   npm install\n   ```\n\n3. Compilez la bibliothèque en JavaScript :\n   ```bash\n   npm run res:build\n   ```\n\n4. Votre bibliothèque est prête à être utilisée !\n\n---\n\n## 🛠️ Utilisation\n\n### Chargement de la bibliothèque\n\nDans votre projet JavaScript/TypeScript, importez la bibliothèque après l'installation.\n\nExemple d'importation dans un fichier JS/TS :\n```javascript\nconst { createClient, getPriceWithPromise, getPrice } = require(\"./path/to/compiled-lib\");\n```\n\n---\n\n### Exemples d'utilisation\n\n#### 1. Créer un client\n\nAvant de récupérer des prix, créez un client. Vous pouvez utiliser les paramètres par défaut ou fournir vos propres configurations.\n\n```javascript\nconst client = createClient();\n\n// Exemple avec configuration personnalisée\nconst customClient = createClient({\n  baseUrl: \"https://api.coingecko.com/api/v3\",\n  timeout: 10000, // 10 secondes\n  retryAttempts: 5, // 5 tentatives en cas d'échec\n});\n```\n\n---\n\n#### 2. Récupérer une paire avec des promesses\n\nRécupérez les prix d'une paire (ex. : `BTC/USD`) en utilisant `getPriceWithPromise`.\n\n```javascript\ngetPriceWithPromise(client, \"bitcoin\", \"usd\")\n  .then((result) =\u003e {\n    if (result.Ok) {\n      console.log(\"Success:\", result.Ok); // Affiche les détails de la paire\n    } else {\n      console.error(\"Error:\", result.Error); // Affiche l'erreur\n    }\n  })\n  .catch((err) =\u003e {\n    console.error(\"Unexpected Error:\", err);\n  });\n```\n\n---\n\n#### 3. Récupérer une paire avec des callbacks\n\nSi vous préférez utiliser des callbacks :\n\n```javascript\ngetPrice(client, \"bitcoin\", \"usd\", \n  (data) =\u003e {\n    console.log(\"Success:\", data);\n  },\n  (error) =\u003e {\n    console.error(\"Error:\", error);\n  });\n```\n\n---\n\n## ⚙️ Options de configuration\n\nLors de la création du client, vous pouvez personnaliser les paramètres suivants :\n\n| Option          | Type    | Par défaut                            | Description                              |\n|------------------|---------|---------------------------------------|------------------------------------------|\n| `baseUrl`        | string  | `https://api.coingecko.com/api/v3`    | URL de base pour les appels API.         |\n| `timeout`        | int     | `5000` (5 secondes)                  | Temps maximum pour attendre une réponse. |\n| `retryAttempts`  | int     | `3`                                  | Nombre de tentatives en cas d'échec.     |\n\n---\n\n## 🌟 Utilisation avec ReScript\n\nSi vous travaillez directement avec ReScript, voici un exemple d'utilisation dans un fichier `.res` :\n\n```rescript\nlet client = PriceLib.createClient()\n\nPriceLib.getPriceWithPromise(client, \"bitcoin\", \"usd\")\n-\u003ePromise.then(result =\u003e {\n  switch result {\n  | Ok(data) =\u003e Js.log({\"message\": \"Success\", \"data\": data})\n  | Error(error) =\u003e Js.log({\"message\": \"Error\", \"error\": error})\n  }\n  Promise.resolve()\n})\n```\n\n#### Installation et compilation\n\n1. Assurez-vous que les dépendances ReScript sont installées :\n   ```bash\n   npm install rescript @rescript/core rescript-webapi\n   ```\n\n2. Lancez la commande pour compiler :\n   ```bash\n   npm run res:build\n   ```\n\n---\n\n## 🚀 Fonctionnalités à venir\n\n- Support pour plusieurs paires en un seul appel.\n- Gestion avancée du cache.\n- Prise en charge de nouvelles API.\n\n---\n\n## 📄 Licence\n\nCe projet est sous licence [MIT](LICENSE).\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronfflex%2Fcrypto-coins-price-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fronfflex%2Fcrypto-coins-price-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fronfflex%2Fcrypto-coins-price-lib/lists"}