{"_id":"@davidsabine/myadmin-geotab-api","_rev":"1-b094b6d9b9e7d32a0eecac76816147dc","name":"@davidsabine/myadmin-geotab-api","dist-tags":{"latest":"2.0.2"},"versions":{"2.0.2":{"author":{"name":"David Sabine","email":"david.sabine@live.com","url":"https://github.com/davidsabine"},"dependencies":{"axios":"^0.24.0"},"description":"Forked from https://github.com/asaucedormz/myadmin-geotab-api, then modified to use axios instead of old version of node-fetch.","devDependencies":{"@babel/core":"^7.16.10","@babel/preset-env":"^7.16.10","babel-jest":"^27.4.6","dotenv":"^10.0.0","jest":"^27.4.7","msw":"^0.36.5"},"homepage":"https://github.com/DavidSabine/myadmin-geotab-api","jest":{"coveragePathIgnorePatterns":["/node_modules/","/test/__fixtures__/"],"testPathIgnorePatterns":["/node_modules/","/test/__fixtures__/"],"transform":{"\\.[jt]sx?$":"babel-jest"},"transformIgnorePatterns":["/node_modules/"]},"license":"MIT","main":"src/index.js","name":"@davidsabine/myadmin-geotab-api","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"scripts":{"test":"jest --coverage --setupFiles dotenv/config"},"version":"2.0.2","licenseText":"See https://rem.mit-license.org/\n","_id":"@davidsabine/myadmin-geotab-api@2.0.2","dist":{"shasum":"2c2b18bdef0b39659967f422072f6c7a2b787ac4","integrity":"sha512-i7oDJbHwpDYorXpBeGhzK6wBZLiYKTiQgoM/0x19DXK1YlVL92lZdqMcKAAyAYG5j+Er9FE/yF0Nq7hameLiLA==","tarball":"https://registry.npmjs.org/@davidsabine/myadmin-geotab-api/-/myadmin-geotab-api-2.0.2.tgz","fileCount":22,"unpackedSize":68207,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh6LJACRA9TVsSAnZWagAA9Z8P/RkyTkcxb04zgbu5jzWQ\nuVQkDK4/xClwksWeJFGEOUJG2uCwf2tj6wSI8QOHbo8M68eFGEnwKE/MT4+Q\nbKANJMV5zDdw9qqCxUSqKbz/H9br+jJmxM+hJ/j4ae94DExWuehIe/oA03gr\naRtGJwYXTH8amJNM+EQf69Sh1FFaXU16vYwUBiBdk/Fae1QeeoG1hj4o/3tH\nbwfbRGfZsP3ZDO2XrGnnOpn9YA1NoWsf3YOxSe69SmbFexa5Lfpk9F6Ju6d3\nBIjB8EnlQRS74tEAypvuBJcupjfVQQuO/WNL67p6YOq+E9vai4gAo4HX5Ook\nCugwMsU8njAH5Yn0ixX26Gx+tG0SOCjZl/7YJYJnt9NpjU69hJ5jT8QK4h8O\nocS7YlNyzC6+vf9H/ldqDdyUBl0JCrmN+GjySqXHh+akMNNRQwGssQq04fOy\n+dqhdWnKnBZy4uFmFW3E494dvhi1m581TB1B/Y+DEkr5kVwYd7H7BxZj/2I5\nqqGke5fjfdaxifUgZoQugy6R6iNO06npYUoF9TVDIKZF1TEMTwYsLQ6GJyaK\nywV/NbuUrM0duVn8bQXflwZyHZmqkcTTVf/MtDXArm8RsasjQZCUIVrL3MAU\nTYHNCOjS7gJlD2tKK3H+kmhWLsE0I6/MrLWgYLjR+qw58Y353SMI5M41XB+F\nURFr\r\n=tm44\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDunmfZzyLfKgFfmGSuHa62nIqL/K242gvmA3S7WafozAIgXjxmPiAgUNsGA4nJVc3h3F/uV2o+t/hXNI52eWj95Zo="}]},"_npmUser":{"name":"davidsabine","email":"david.sabine@live.com"},"directories":{},"maintainers":[{"name":"davidsabine","email":"david.sabine@live.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/myadmin-geotab-api_2.0.2_1642639936247_0.8657210620446596"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-20T00:52:16.190Z","2.0.2":"2022-01-20T00:52:16.413Z","modified":"2022-04-05T03:06:16.224Z"},"maintainers":[{"name":"davidsabine","email":"david.sabine@live.com"}],"description":"Forked from https://github.com/asaucedormz/myadmin-geotab-api, then modified to use axios instead of old version of node-fetch.","homepage":"https://github.com/DavidSabine/myadmin-geotab-api","author":{"name":"David Sabine","email":"david.sabine@live.com","url":"https://github.com/davidsabine"},"license":"MIT","readme":"# myadmin-geotab-api\n\nUnofficial nodejs client for myadmin.geotab.com.\n\n- https://myadmin.geotab.com/sdk#/api-reference\n\n\n## Installation\n\nUsing yarn:\n\n```shell\n$ yarn add @davidsabine/myadmin-geotab-api\n```\n\nUsing npm:\n\n```shell\n$ npm i @davidsabine/myadmin-geotab-api\n```\n\n\n## Getting Started\n\nThe order of operations is:\n\n1. Import `myadmin-geotab-api` in your code.\n```js\nimport MyAdminAPI from '@davidsabine/myadmin-geotab-api'\n```\n\n2. Create an instance of the class object:\n```js\nconst myAPI = new MyAdminAPI({<authentication parameters here>})\n```\n\n3. Tell that new instance to authenticate with GeoTab's server. This returns an object containing credentials, sessionId, apiKey, etc.\n```js\nmyAPI.authenticate()\n```\n\n4. Then use `myAPI.call()` to perform actions against GeoTab's service. The return values will vary depending which method name you send to GeoTab's service:\n```js\nmyAPI.call(<a method name>, {<parameters related to that method>})\n```\n\n\nExamples:\n\nUsing Async/Await Promises\n\n```js\nimport MyAdminAPI from '@davidsabine/myadmin-geotab-api'\n\n(async function main() {\n\tconst username = process.env.YOURUSERNAME\n\tconst password = process.env.YOURPASSWORD\n\ttry\t{\n\t\tconst api = new MyAdminAPI({\n\t\t\tusername,\n\t\t\tpassword,\n\t\t\turi: 'https://myadminapitest.geotab.com/v2/MyAdminApi.ashx'\n\t\t})\n\t\tconst authData = await api.authenticate()\n\t\tconst result = await api.call(`GetCountries`, {})\n\t\tif(result.error) {\n\t\t\tconsole.log(result, `geotab responded with an error message`)\n\t\t} else {\n\t\t\tconsole.log(result, `the call was successful`)\n\t\t}\n\t} catch (error) {\n\t\tconsole.log(error, `an error was thrown in your code`)\n\t}\n})()\n```\n\nUsing Promises then catch\n\n```js\nimport MyAdminAPI from '@davidsabine/myadmin-geotab-api'\n\n(async function main() {\n\tconst username = process.env.YOURUSERNAME\n\tconst password = process.env.YOURPASSWORD\n\tconst api = new MyAdminAPI({\n\t\tusername,\n\t\tpassword,\n\t\turi: 'https://myadminapitest.geotab.com/v2/MyAdminApi.ashx'\n\t})\n\tapi\n\t.authenticate()\n\t.then(() => {\n\t\tconsole.log(`You are authenticated!`)\n\t\tapi.call('GetCountries', {})\n\t\t.then((theListofCountries) => {\n\t\t\tconsole.log(theListofCountries, `the call was successful`)\n\t\t})\n\t\t.catch((err) => {\n\t\t\tconsole.log(err, `geotab responded with an error message`)\n\t\t})\n\t})\n\t.catch((err) => {\n\t\tconsole.log(err, `an error was thrown in your code`)\n\t})\n})()\n```\n\n# Notes for users of previous version: <=0.1.2\n\n\n## New method names are available, old method names still supported\n\nWe felt it redundant to use 'Async' in the function name. New method names are:\n\n```js\n.authenticate()\n.call()\n```\n\nThe old function names are still supported. You should not have to change any of your code.\n\n```js\n.authenticateAsync()\n.callAsync()\n```\n\n\n## Improved error handling for `post()` method\n\nThis *may* break your previous code. And note that `post()` is used by `callAsync()`.\n\nPreviously, if something went wrong during the HTTP call to GeoTab's service, `post()` (and thus `callAsync()`) would *throw* an exception.\n\nThe new implementation differentiates between *internal and intended exceptions*. (See notes on this page, https://mswjs.io/docs/recipes/mocking-error-responses.) As per general guidance, the new implementation treats an error response (from the fetch promise) as an actual response not an exception.\n\nIf you implement `call()` or `post()` incorrectly, an exception will occur. But if you implement those methods correctly and something goes wrong during the HTTP call to GeoTab's server, you should now expect a JSON response with an error *message*. The JSON response looks like this:\n\n```json\n{\n\tresult: {\n\t\terror: {\n\t\t\tcode: an error code,\n\t\t\tmessage: an error message,\n\t\t\tname: a name of error, example: 'MissingMethodException'\n\t\t}\n\t}\n}\n```\n\nSee error handling in examples above.\n","readmeFilename":"README.md"}