-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #684 from postmanlabs/release/1.6.0
Release v1.6.0.
- Loading branch information
Showing
31 changed files
with
2,339 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,4 @@ out/ | |
|
||
newmanResponses.json | ||
dummyFile*.txt | ||
dummyBinaryFile | ||
dummyBinaryFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
*.java | ||
*.class | ||
*.jar | ||
|
||
.DS_Store | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Prevent IDE stuff | ||
.idea | ||
.vscode | ||
*.sublime-* | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
.coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"tags": { | ||
"allowUnknownTags": true, | ||
"dictionaries": ["jsdoc", "closure"] | ||
}, | ||
"source": { | ||
"include": [ ], | ||
"includePattern": ".+\\.js(doc)?$", | ||
"excludePattern": "(^|\\/|\\\\)_" | ||
}, | ||
|
||
"plugins": [ | ||
"plugins/markdown" | ||
], | ||
|
||
"templates": { | ||
"cleverLinks": false, | ||
"monospaceLinks": false, | ||
"highlightTutorialCode" : true | ||
}, | ||
|
||
"opts": { | ||
"template": "./node_modules/postman-jsdoc-theme", | ||
"encoding": "utf8", | ||
"destination": "./out/docs", | ||
"recurse": true, | ||
"readme": "README.md" | ||
}, | ||
|
||
"markdown": { | ||
"parser": "gfm", | ||
"hardwrap": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
### NPM Specific: Disregard recursive project files | ||
### =============================================== | ||
/.editorconfig | ||
/.gitmodules | ||
/test | ||
|
||
### Borrowed from .gitignore | ||
### ======================== | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Prevent IDE stuff | ||
.idea | ||
.vscode | ||
*.sublime-* | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
.coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
out/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# codegen-kotlin-okhttp | ||
|
||
> Converts Postman-SDK Request into code snippet for kotlin-okhttp. | ||
#### Prerequisites | ||
To run Code-Gen, ensure that you have NodeJS >= v12. A copy of the NodeJS installable can be downloaded from https://nodejs.org/en/download/package-manager. | ||
|
||
## Using the Module | ||
The module will expose an object which will have property `convert` which is the function for converting the Postman-SDK request to kotlin-okhttp code snippet and `getOptions` function which returns an array of supported options. | ||
|
||
### convert function | ||
Convert function will take three parameters | ||
* `request`- Postman-SDK Request object | ||
|
||
* `options`- options is an object which can have following properties | ||
* `indentType`- string representing type of indentation for code snippet. eg: 'Space', 'Tab' | ||
* `indentCount`- positiveInteger representing count of indentation required. | ||
* `includeBoilerplate`- boolean representing whether to include class definition in code snippet | ||
* `requestTimeout` : Integer denoting time after which the request will bail out in milli-seconds | ||
* `trimRequestBody` : Trim request body fields | ||
* `followRedirect` : Boolean denoting whether to redirect a request | ||
|
||
* `callback`- callback function with first parameter as error and second parameter as string for code snippet | ||
|
||
##### Example: | ||
```js | ||
var request = new sdk.Request('www.google.com'), //using postman sdk to create request | ||
options = { | ||
indentType: 'Space', | ||
indentCount: 2, | ||
includeBoilerplate: false | ||
}; | ||
convert(request, options, function(error, snippet) { | ||
if (error) { | ||
// handle error | ||
} | ||
// handle snippet | ||
}); | ||
``` | ||
|
||
### getOptions function | ||
|
||
This function returns a list of options supported by this codegen. | ||
|
||
#### Example | ||
```js | ||
var options = getOptions(); | ||
|
||
console.log(options); | ||
// output | ||
// [ | ||
// { | ||
// name: 'Set indentation count', | ||
// id: 'indentCount', | ||
// type: 'positiveInteger', | ||
// default: 2, | ||
// description: 'Set the number of indentation characters to add per code level' | ||
// }, | ||
// ... | ||
// ] | ||
``` | ||
|
||
### Guideline for using generated snippet | ||
* Generated snippet requires dependencies [okhttp3](https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp/3.9.1) and [okio](https://mvnrepository.com/artifact/com.squareup.okio/okio/1.13.0) to compile and run | ||
|
||
* Generated snippet uses `.method(nameOfMethod, body)` from `Request` class to form HTTP request. If the `method` doesn't require body then the value of `body` will be `null`. | ||
|
||
* Generated snippet uses `MultipartBody.Builder()` when `multipart/formdata` is used otherwise it uses `RequestBody.create()` in order to add body to request. | ||
|
||
* Since Postman-SDK Request object doesn't provide complete path of the file, it needs to be manually inserted in case of uploading a file. | ||
|
||
* `content-type` needs to be specified in order to add body to the request. So if no `content-type` is specified then `text/plain` will be used as default. **In case of `multipart/formdata` `content-type` is generated by snippet itself**. | ||
|
||
* This module doesn't support cookies. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('./lib'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
convert: require('./okhttp').convert, | ||
getOptions: require('./okhttp').getOptions | ||
}; |
Oops, something went wrong.