{"library":"mappersmith","title":"Mappersmith REST Client","description":"Mappersmith is a lightweight, isomorphic REST client designed for both Node.js and browser environments, currently stable at version 2.47.1. It streamlines API integration by providing a centralized configuration for all HTTP requests, abstracting away complex network configurations. The library emphasizes a clean, declarative approach to defining API resources and their methods, allowing developers to focus on business logic rather than boilerplate. It supports a robust middleware system for extending client capabilities with features like authentication, retry mechanisms, logging, and error handling. While its release cadence isn't explicitly stated, the high patch version suggests continuous, active development with frequent smaller updates. Its key differentiators include its lightweight nature, isomorphic compatibility, and highly configurable middleware architecture, offering a powerful alternative to more opinionated or heavier HTTP clients.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install mappersmith"],"cli":null},"imports":["import forge from 'mappersmith';","import { configs } from 'mappersmith';","import Fetch from 'mappersmith/gateway/fetch';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import forge, { configs } from 'mappersmith';\nimport Fetch from 'mappersmith/gateway/fetch';\n\n// Configure the Fetch gateway globally\nconfigs.gateway = Fetch;\n\n// Define your API client with resources and methods\nconst githubStatusClient = forge({\n  clientId: 'github-status-api',\n  host: 'https://www.githubstatus.com',\n  resources: {\n    Status: {\n      current: { path: '/api/v2/status.json' },\n      summary: { path: '/api/v2/summary.json' },\n      components: { path: '/api/v2/components.json' }\n    },\n  },\n});\n\n// Make an API call and handle the response\ngithubStatusClient.Status.current()\n  .then((response) => {\n    // response.data() contains the parsed JSON body\n    console.log('Current GitHub Status Summary:', response.data().status.description);\n    console.log('API Request successful.');\n  })\n  .catch((error) => {\n    console.error('Failed to fetch GitHub status:', error);\n    if (error.response) {\n        console.error('Response status:', error.response.status());\n        console.error('Response data:', error.response.data());\n    }\n  });\n","lang":"typescript","description":"Demonstrates how to create a Mappersmith client with the Fetch gateway, define a resource, and make a simple API call to retrieve status data, including error handling.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}