Skip to content

Commit 2705424

Browse files
authored
Merge pull request #710 from postmanlabs/IMPORT-815-github-postman-app-support-10521-postman-code-dart-dio-library
[FEATURE] Codegen Dart Dio Support
2 parents b0a6746 + 076d007 commit 2705424

14 files changed

+979
-4
lines changed

codegens/dart-dio/.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.DS_Store
2+
3+
#Obj-c files
4+
*.m
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
12+
# Coverage directory used by tools like istanbul
13+
.coverage
14+
15+
# node-waf configuration
16+
.lock-wscript
17+
18+
19+
# Dependency directories
20+
node_modules/
21+
jspm_packages/
22+
23+
# Typescript v1 declaration files
24+
typings/
25+
26+
# Optional npm cache directory
27+
.npm
28+
29+
# Optional eslint cache
30+
.eslintcache
31+
32+
# Optional REPL history
33+
.node_repl_history
34+
35+
# Output of 'npm pack'
36+
*.tgz
37+
38+
# Yarn Integrity file
39+
.yarn-integrity
40+
41+
# dotenv environment variables file
42+
.env
43+
44+
out/
45+
/.idea/
46+
pubspec.lock
47+
pubspec.yaml
48+
.packages
49+
snippet.dart
50+
.dart_tool/

codegens/dart-dio/.npmignore

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
### NPM Specific: Disregard recursive project files
2+
### ===============================================
3+
/.editorconfig
4+
/.gitmodules
5+
/test
6+
7+
### Borrowed from .gitignore
8+
### ========================
9+
10+
# Logs
11+
logs
12+
*.log
13+
npm-debug.log*
14+
yarn-debug.log*
15+
yarn-error.log*
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Prevent IDE stuff
24+
.idea
25+
.vscode
26+
*.sublime-*
27+
28+
# Directory for instrumented libs generated by jscoverage/JSCover
29+
lib-cov
30+
31+
# Coverage directory used by tools like istanbul
32+
.coverage
33+
34+
# nyc test coverage
35+
.nyc_output
36+
37+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
38+
.grunt
39+
40+
# Bower dependency directory (https://bower.io/)
41+
bower_components
42+
43+
# node-waf configuration
44+
.lock-wscript
45+
46+
# Compiled binary addons (http://nodejs.org/api/addons.html)
47+
build/Release
48+
49+
# Dependency directories
50+
node_modules/
51+
jspm_packages/
52+
53+
# Typescript v1 declaration files
54+
typings/
55+
56+
# Optional npm cache directory
57+
.npm
58+
59+
# Optional eslint cache
60+
.eslintcache
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
74+
snippet.swift
75+
76+
out/

codegens/dart-dio/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
> Converts Postman-SDK Request into code snippet for Dart dio.
3+
4+
#### Prerequisites
5+
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.
6+
7+
## Using the Module
8+
The module will expose an object which will have property `convert` which is the function for converting the Postman-SDK request to swift code snippet.
9+
10+
### convert function
11+
Convert function takes three parameters
12+
13+
* `request` - Postman-SDK Request Object
14+
15+
* `options` - options is an object which hsa following properties
16+
* `indentType` - String denoting type of indentation for code snippet. eg: 'Space', 'Tab'
17+
* `indentCount` - The number of indentation characters to add per code level
18+
* `trimRequestBody` - Whether or not request body fields should be trimmed
19+
20+
* `callback` - callback function with first parameter as error and second parameter as string for code snippet
21+
22+
##### Example:
23+
```js
24+
var request = new sdk.Request('www.google.com'), //using postman sdk to create request
25+
options = {
26+
indentCount: 3,
27+
indentType: 'Space',
28+
requestTimeout: 200,
29+
trimRequestBody: true
30+
};
31+
convert(request, options, function(error, snippet) {
32+
if (error) {
33+
// handle error
34+
}
35+
// handle snippet
36+
});
37+
```
38+
### Guidelines for using generated snippet
39+
40+
* 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.
41+
42+
* This module doesn't support cookies.

codegens/dart-dio/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib');

0 commit comments

Comments
 (0)