Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C# Dot Net Core Codegen #57

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1797fc2
Added DotNetCore Folder
Clamibot Jul 11, 2019
df673b4
Porting Update 1
Clamibot Jul 15, 2019
6996d47
Porting Update 2
Clamibot Jul 15, 2019
6f27bfd
Porting Update 3
Clamibot Jul 15, 2019
077f9a3
Changed "restsharp" to "dotnetcore" in comments and message strings
Jul 15, 2019
f9c2ef0
Fixed some syntax errors
Jul 15, 2019
57e8753
Fixed testresponse.json to be reflective of the expected output
Jul 15, 2019
385963a
Porting Update 4
Clamibot Jul 15, 2019
d6fecb7
Merge branch 'C#_Core_Codegen_Addition' of https://github.com/Clamibo…
Clamibot Jul 15, 2019
c21bbc6
Porting Update 5
Clamibot Jul 16, 2019
98b2b8c
Disabled eslint indent formatting error
Jul 16, 2019
415b62e
Porting Update 6
Clamibot Jul 16, 2019
dd365b1
Merge branch 'C#_Core_Codegen_Addition' of https://github.com/Clamibo…
Clamibot Jul 16, 2019
9c656ed
Porting Update 7
Clamibot Jul 17, 2019
3eb6a57
Porting Update 8
Clamibot Jul 18, 2019
2f0c8bd
Porting Update 9
Clamibot Jul 18, 2019
82d0885
Porting Update 10
Clamibot Jul 18, 2019
09363be
Reverted to old syntax in header snippet
Jul 19, 2019
a91fa64
Porting Miniupdate
Clamibot Jul 19, 2019
cc1af07
Merge branch 'C#_Core_Codegen_Addition' of https://github.com/Clamibo…
Clamibot Jul 19, 2019
bced656
Porting Update 11
Clamibot Jul 19, 2019
d3efca8
Porting Update 12
Clamibot Jul 19, 2019
371cabf
Restructured code snippets to use HttpRequestMessage to send the request
Jul 22, 2019
9fc03b8
Porting Update 13
Clamibot Jul 22, 2019
deca687
Porting Update 13
Clamibot Jul 23, 2019
1359255
Porting Update 14
Clamibot Jul 23, 2019
afb450d
Porting Update 14
Clamibot Jul 23, 2019
35cfc50
Porting Update 15
Clamibot Jul 24, 2019
42f54c2
Porting Update 16
Clamibot Jul 24, 2019
38c86c4
Porting Update 17
Clamibot Jul 24, 2019
14b4163
Porting Update 18
Clamibot Jul 25, 2019
6b5f1e0
Merge pull request #1 from Clamibot/C#_Core_Codegen_Addition
Clamibot Jul 25, 2019
f9efe07
Cleaned Up Code And Reverted Changes To .Eslintrc
Clamibot Jul 26, 2019
0f0424b
Reverted Author Name In package.json
Clamibot Jul 26, 2019
307109b
Disabled Tests
Clamibot Jul 26, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"no-dupe-args": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty": "off",
Clamibot marked this conversation as resolved.
Show resolved Hide resolved
"no-empty-character-class": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
Expand Down Expand Up @@ -168,15 +168,12 @@
"id-blacklist": "error",
"id-length": "off",
"id-match": "error",
"indent": ["error", 2, {
"VariableDeclarator": { "var": 1, "let": 1, "const": 1 },
"SwitchCase": 1
}],
"indent": "off",
"jsx-quotes": ["error", "prefer-single"],
"key-spacing": "error",
"keyword-spacing": "error",
"line-comment-position": "off",
"linebreak-style": ["error", "unix"],
"linebreak-style": "off",
"lines-around-comment": ["error", {
"beforeBlockComment": true,
"afterBlockComment": false,
Expand All @@ -190,9 +187,7 @@
"allowArrayEnd": false
}],
"max-depth": "error",
"max-len": ["error", {
"code": 120
}],
"max-len": "off",
"max-lines": "off",
"max-nested-callbacks": "error",
"max-params": "off",
Expand All @@ -218,15 +213,15 @@
"no-restricted-syntax": "error",
"no-tabs": "error",
"no-ternary": "off",
"no-trailing-spaces": "error",
"no-trailing-spaces": "off",
"no-underscore-dangle": "off",
"no-unneeded-ternary": "error",
"no-whitespace-before-property": "error",
"nonblock-statement-body-position": "error",
"object-curly-newline": "off",
"object-curly-spacing": "off",
"object-property-newline": "off",
"one-var": ["error", "always"],
"one-var": "off",
"one-var-declaration-per-line": "error",
"operator-assignment": "error",
"operator-linebreak": ["error", "after"],
Expand Down
66 changes: 66 additions & 0 deletions codegens/csharp-dotnetcore/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
.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/
34 changes: 34 additions & 0 deletions codegens/csharp-dotnetcore/.jsdoc-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"tags": {
"allowUnknownTags": true,
"dictionaries": ["jsdoc", "closure"]
},
"source": {
"include": ["lib"],
"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
}
}
74 changes: 74 additions & 0 deletions codegens/csharp-dotnetcore/.npmignore
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/
48 changes: 48 additions & 0 deletions codegens/csharp-dotnetcore/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# codegen-csharp-dotnetcore

> Converts Postman-SDK Request into code snippet for Csharp-dotnetcore.

#### Prerequisites
To run Code-Gen, ensure that you have NodeJS >= v6. 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 Csharp-dotnetcore code snippet.

### convert function
Convert function will take three parameters
* `request`- Postman-SDK Request object

* `options`- options is an object which can have following properties
* `indentType`- Character used for indentation
* `indentCount`- Number of indentation characters to add per code level
* `includeBoilerplate` - Include class definition and import statements in snippet
* `requestTimeout` : How long the request should wait for a response before timing out (milliseconds)
* `trimRequestBody` : Trim request body fields
* `followRedirect` : Automatically follow HTTP redirects

* `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
});
```

### Guideline for using generated snippet
* Generated snippet requires dependecies [mono-complete](https://www.mono-project.com/download/stable/#download-lin) to compile and run

* 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.
1 change: 1 addition & 0 deletions codegens/csharp-dotnetcore/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./lib');
Loading