{"_id":"@andaleeb/aws-api-gateway-client","_rev":"1-c99306e145ba22e084ea4d27fb44e028","name":"@andaleeb/aws-api-gateway-client","dist-tags":{"latest":"0.2.17"},"versions":{"0.2.17":{"name":"@andaleeb/aws-api-gateway-client","version":"0.2.17","description":"A module for AWS API Gateway client","repository":{"type":"git","url":"git+https://github.com/andaleeb/aws-api-gateway-client.git"},"keywords":["aws","apigateway"],"author":{"name":"andaleeb"},"license":"MIT","bugs":{"url":"https://github.com/andaleeb/aws-api-gateway-client/issues"},"homepage":"https://github.com/andaleeb/aws-api-gateway-client#readme","main":"dist/apigClient.js","scripts":{"transpile":"babel src -d dist/","prepublish":"npm run lint && npm run transpile","lint":"node node_modules/eslint/bin/eslint.js src lib *.js","test":"npm run lint && nyc --reporter=text ava","test:watch":"ava --watch"},"ava":{"require":["babel-register","babel-polyfill"],"babel":"inherit","files":["test/**/*.test.js"]},"babel":{"presets":["@ava/stage-4","es2017","es2016","es2015","stage-0"],"plugins":["transform-es5-property-mutators"]},"eslintConfig":{"parser":"babel-eslint","extends":["eslint:recommended","google"],"rules":{"max-len":["error",100],"require-jsdoc":"off","no-undef":"off","import/extensions":"off","import/no-extraneous-dependencies":"off","comma-dangle":"off","no-useless-escape":"off"}},"dependencies":{"axios":"^0.18.0","axios-retry":"^3.0.1","crypto-js":"^3.1.9-1","url":"^0.11.0","url-template":"^2.0.8"},"devDependencies":{"@ava/babel-preset-stage-4":"^1.0.0","ava":"^0.25.0","babel-cli":"^6.24.1","babel-core":"^6.24.1","babel-eslint":"^8.2.2","babel-plugin-transform-es5-property-mutators":"^6.24.1","babel-polyfill":"^6.23.0","babel-preset-es2015":"^6.24.1","babel-preset-es2016":"^6.24.1","babel-preset-es2017":"^6.24.1","babel-preset-stage-0":"^6.24.1","babel-register":"^6.24.1","eslint":"^4.3.0","eslint-config-google":"^0.9.1","eslint-loader":"^2.0.0","eslint-plugin-import":"^2.2.0","eslint-plugin-jsx-a11y":"^6.0.2","nyc":"^11.1.0"},"gitHead":"a25c2a43a3ba526c65ec2f56817a9e385a6c46e4","_id":"@andaleeb/aws-api-gateway-client@0.2.17","_npmVersion":"6.1.0","_nodeVersion":"10.5.0","_npmUser":{"name":"andaleeb","email":"andaleebcse@gmail.com"},"dist":{"integrity":"sha512-4npGf3dTYVDfQrVV2q/GHFgHbtM5hcHrqU9eD+O6csmE3/YdNTzLLWjxW/XKjcWoe0MQvmiiv+0Lin06bfk7yw==","shasum":"abb0370d7bdc3c4e3a48c445feae43b453a08b85","tarball":"https://registry.npmjs.org/@andaleeb/aws-api-gateway-client/-/aws-api-gateway-client-0.2.17.tgz","fileCount":8,"unpackedSize":37782,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcYVB6CRA9TVsSAnZWagAA7DQP/3Qbmi6fBxDxx33Qr6Pn\nNAb4PUOBZmMByrVNS3ZonN0uKgC1P7KmhKN5spyk1HO1t/+o0YFm4xHgnPDb\nvGdWrkNfzxpIDXUuUq2kFNua+YpoXNjN98LqBgkUpTcBG+tDL5txI4529+jG\nHxvulBc9VlUradlSrrPa2ni1xmStwLKrEuPxYe9QVSqMecrCZX+4EHj3vnbs\nubEYwoc/ItAwzhLw35hxJYnNwkJ5sWL3ugAO567AGUXPjZS+66L0bdSNRKKy\nnBvhBgqqpNK4JwgT6TcUkF60sdxLa0+gpPhS7C82MFIWRih1lLH0+p+9c93r\nmjOjj9bvvuWqq74FkiREPBxa3uLPGbGu3sRNR2059nvxOiFuThXbrLAtM6uS\n7VF3km/V3h3ntaV6u3bDXZq83R38pmK/nMXIh4V4gTS2muZ4J5IhvgVFDmoP\nZCmtoU5vupayif51N0uSg0QU/1XNXScOjY2jHMJSkwfQKi+r4NyxngtF/BU2\nlHG/NBJaaWWiGPdI4xmsJZTjrDskzkSvk6c8fDDtPEQGzVdSXoEArrv9YuTX\nZu/x031RRMjTTCs5xvpnixg8SOFMfuoZoX15zE1MaaN2iQaqCxiK3seuZAvP\n3TsrTexacT93kfqqAKh/afBr+lCLLfiK2FO3BWwOIB0yUtmvZ6+Up1f85Foy\n8s7s\r\n=UXN+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAt9FMau1xVBdZUU1vJImGw2/QhBC4jKawAv0tE7jYJkAiBq6eWiOYMYt+Lj9e7y78EHc2p+Gb2vr/dmcozgtBUO0Q=="}]},"maintainers":[{"name":"andaleeb","email":"andaleebcse@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/aws-api-gateway-client_0.2.17_1549881466283_0.4618740624945996"},"_hasShrinkwrap":false}},"time":{"created":"2019-02-11T10:37:46.028Z","0.2.17":"2019-02-11T10:37:46.454Z","modified":"2022-04-04T13:57:21.827Z"},"maintainers":[{"name":"andaleeb","email":"andaleebcse@gmail.com"}],"description":"A module for AWS API Gateway client","homepage":"https://github.com/andaleeb/aws-api-gateway-client#readme","keywords":["aws","apigateway"],"repository":{"type":"git","url":"git+https://github.com/andaleeb/aws-api-gateway-client.git"},"author":{"name":"andaleeb"},"bugs":{"url":"https://github.com/andaleeb/aws-api-gateway-client/issues"},"license":"MIT","readme":"[![dependencies Status](https://david-dm.org/kndt84/aws-api-gateway-client/status.svg)](https://david-dm.org/kndt84/aws-api-gateway-client)\r\n[![Build Status](https://travis-ci.org/kndt84/aws-api-gateway-client.svg?branch=master)](https://travis-ci.org/kndt84/aws-api-gateway-client)\r\n[![npm](https://img.shields.io/npm/dm/aws-api-gateway-client.svg)](https://www.npmjs.com/package/aws-api-gateway-client)\r\n\r\n\r\n# Overview\r\nA module for AWS API gateway client based on auto-generated JavaScript SDK. This module can be used not only for Node.js but for front-end. In addition, it generalizes original SDK's endpoint specific methods.\r\n\r\nReference:  \r\nhttps://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-generate-sdk.html\r\n\r\n# Prerequisites\r\nFor the JavaScript SDK to work your APIs need to support CORS. The Amazon API Gateway developer guide explains how to [setup CORS for an endpoint](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html).\r\n\r\n# Install\r\n```\r\nnpm install aws-api-gateway-client\r\n```\r\n\r\n# Use the SDK in your project\r\n\r\nRequire module\r\n```\r\nvar apigClientFactory = require('aws-api-gateway-client').default;\r\n```\r\n\r\nSet invokeUrl to config and create a client. For authorization, additional information is required as explained below.\r\n```\r\nconfig = {invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com'}\r\nvar apigClient = apigClientFactory.newClient(config);\r\n```\r\n\r\nCalls to an API take the form outlined below. Each API call returns a promise, that invokes either a success and failure callback\r\n\r\n```\r\nvar pathParams = {\r\n    //This is where path request params go. \r\n    userId: '1234',\r\n};\r\n// Template syntax follows url-template https://www.npmjs.com/package/url-template\r\nvar pathTemplate = '/users/{userID}/profile'\r\nvar method = 'GET';\r\nvar additionalParams = {\r\n    //If there are query parameters or headers that need to be sent with the request you can add them here\r\n    headers: {\r\n        param0: '',\r\n        param1: ''\r\n    },\r\n    queryParams: {\r\n        param0: '',\r\n        param1: ''\r\n    }\r\n};\r\nvar body = {\r\n    //This is where you define the body of the request\r\n};\r\n\r\napigClient.invokeApi(pathParams, pathTemplate, method, additionalParams, body)\r\n    .then(function(result){\r\n        //This is where you would put a success callback\r\n    }).catch( function(result){\r\n        //This is where you would put an error callback\r\n    });\r\n```\r\n\r\n# Using AWS IAM for authorization\r\nTo initialize the SDK with AWS Credentials use the code below. Note, if you use credentials all requests to the API will be signed. This means you will have to set the appropiate CORS accept-* headers for each request.\r\n\r\n```\r\nvar apigClient = apigClientFactory.newClient({\r\n    invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com', // REQUIRED\r\n    accessKey: 'ACCESS_KEY', // REQUIRED\r\n    secretKey: 'SECRET_KEY', // REQUIRED\r\n    sessionToken: 'SESSION_TOKEN', //OPTIONAL: If you are using temporary credentials you must include the session token\r\n    region: 'eu-west-1', // REQUIRED: The region where the API is deployed.\r\n    systemClockOffset: 0, // OPTIONAL: An offset value in milliseconds to apply to signing time\r\n    retries: 4, // OPTIONAL: Number of times to retry before failing. Uses axon-retry plugin.\r\n    retryCondition: (err) => { // OPTIONAL: Callback to further control if request should be retried.  Uses axon-retry plugin.\r\n      return err.response && err.response.status === 500;\r\n    }\r\n});\r\n```\r\n\r\n# Using API Keys\r\nTo use an API Key with the client SDK you can pass the key as a parameter to the Factory object. Note, if you use an apiKey it will be attached as the header 'x-api-key' to all requests to the API will be signed. This means you will have to set the appropiate CORS accept-* headers for each request.\r\n\r\n```\r\nvar apigClient = apigClientFactory.newClient({\r\n    invokeUrl:'https://xxxxx.execute-api.us-east-1.amazonaws.com', // REQUIRED\r\n    apiKey: 'API_KEY', // REQUIRED\r\n    region: 'eu-west-1' // REQUIRED\r\n});\r\n```\r\n","readmeFilename":"README.md"}