https://github.com/niradler/apigateway-export-tool
export apigateway docs.
https://github.com/niradler/apigateway-export-tool
Last synced: about 1 year ago
JSON representation
export apigateway docs.
- Host: GitHub
- URL: https://github.com/niradler/apigateway-export-tool
- Owner: niradler
- License: mit
- Created: 2019-04-23T00:16:53.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-10T20:26:59.000Z (about 3 years ago)
- Last Synced: 2025-03-09T01:47:00.918Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/apigateway-export-tool
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# apigateway-export-tool
## Usage CLI
```
Usage: apigateway-export-tool [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
docs [options] Download docs file for a given restApiId.
list [options] List all restApis.
stages [options] Get stages for a given restApiId.
sdk [options] Download sdk for a given restApiId.
```
```
npx apigateway-export-tool list
npx apigateway-export-tool docs -h
npx apigateway-export-tool docs -i 123123 -stageName prod
```
## Usage Nodejs
```
// checkout examples https://github.com/niradler/apigateway-export-tool/blob/master/test.js
const { getExportAndSave,
getExport,
setAwsConfig,
getRestApis,
getSdk,
getSdkAndSave,
getStages,
importDocumentation
} = require("apigateway-export-tool");
setAwsConfig({ region: "us-east-1" });
(async function() {
const params = {
exportType, // String ("oas30", "swagger")
restApiId, // String
stageName, // String
parameters: {
extensions // String ("postman", "integrations", "integrations", "authorizers")
}
};
const filePath = "./";
const apis = await getRestApis();
const apis = await getStages(params);
const apis = await importDocumentation(params);
const file = await getExportAndSave(params, filePath); //save the file in path.
const file = await getExport(params); // just returning the file.
})();
```
### AWS credentials
if you have aws cli configure on your machine you dont need to worry about that,
if not you can setup the credentials using one of this two options:
- Loaded from the shared credentials file (~/.aws/credentials)
- Loaded from environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)