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

Add support to Kotlin-Retrofit2 #420

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dd776bf
Initial commit for Kotlin-Retrofit2 plugin
Husseinhj Nov 5, 2020
545f730
Add double quote in sanitize method
Husseinhj Nov 7, 2020
5d5d2b7
Parse body fo Kotlin Retrofit
Husseinhj Nov 7, 2020
5a26910
Add header generator for kotlin retrofit
Husseinhj Nov 7, 2020
4aed922
Add getInterfaceMethodParams method
Husseinhj Nov 7, 2020
6c234c6
Add getInterfaceFunctionName method
Husseinhj Nov 7, 2020
94e664b
Add getServiceInterfaceName method
Husseinhj Nov 7, 2020
f3c1710
Add generateRetrofitClientFactory method
Husseinhj Nov 7, 2020
871670f
Add generateInterface method
Husseinhj Nov 7, 2020
d6b59ef
Add getRetrofitImportByMethod method
Husseinhj Nov 7, 2020
9dc1ec7
Refactor kotlin-retrofit2 import modules
Husseinhj Nov 7, 2020
eced72f
Append body to snippet code
Husseinhj Nov 7, 2020
9457d32
Generate snippet code for kotlin-retrofit just for raw body and simpl…
Husseinhj Nov 7, 2020
cf3f6b7
Add double quote in sanitize method
Husseinhj Nov 7, 2020
f146c4a
Parse body fo Kotlin Retrofit
Husseinhj Nov 7, 2020
0768d26
Support for form-data format
Husseinhj Nov 7, 2020
d74f46f
Remove generate retrofit module import
Husseinhj Nov 7, 2020
097f91c
Complete form-data request
Husseinhj Nov 7, 2020
7b9dc94
Fix ESLint errors
Husseinhj Nov 7, 2020
a311db9
Support for raw body in kotlin-retrofit2
Husseinhj Nov 7, 2020
5142460
Fix bug forgotten double quote for raw data
Husseinhj Nov 7, 2020
d414a11
Support Graphql
Husseinhj Nov 7, 2020
14e4a41
Test for Kotlin-Retrofit2
Husseinhj Nov 7, 2020
5d91bee
Add Kotlin-Retrofit2 to readme
Husseinhj Nov 7, 2020
8707ad9
Add kotlin to language label
Husseinhj Nov 7, 2020
7a33ec8
Add kotlin snippet file
Husseinhj Nov 7, 2020
da82f65
Fix issue for run test URL is not defined
Husseinhj Nov 7, 2020
988ca32
Fix bug get function name of service interface
Husseinhj Nov 7, 2020
7c01b38
Fix bug in follow redirect
Husseinhj Nov 7, 2020
59e28ae
Add new test file
Husseinhj Nov 7, 2020
635aeec
Fix ESLint error
Husseinhj Nov 7, 2020
411af33
Add compile script to kotlin test
Husseinhj Nov 8, 2020
928c2a9
Fix show protocol in baseUrl of request
Husseinhj Nov 8, 2020
994fd1f
Build for sign commit
Husseinhj Nov 11, 2020
6e3b730
Merge branch 'develop' into feat/kotlin-retrofit2
Husseinhj Nov 15, 2023
b990461
Fixed issue regarding resolve conflicts languageLabels.json
Husseinhj Nov 15, 2023
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ List of supported code generators:
| JavaScript | Fetch |
| JavaScript | jQuery |
| JavaScript | XHR |
| Kotlin | Retrofit2 |
| NodeJs | Axios |
| NodeJs | Native |
| NodeJs | Request |
Expand Down
49 changes: 49 additions & 0 deletions codegens/kotlin-retrofit2/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.DS_Store

#Obj-c files
*.m
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage directory used by tools like istanbul
.coverage

# node-waf configuration
.lock-wscript


# 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/
/.idea/
pubspec.lock
pubspec.yaml
.packages
snippet.kt
76 changes: 76 additions & 0 deletions codegens/kotlin-retrofit2/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
### 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

snippet.swift

out/
42 changes: 42 additions & 0 deletions codegens/kotlin-retrofit2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

> Converts Postman-SDK Request into code snippet for kotlin retrofit2.

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

### convert function
Convert function takes three parameters

* `request` - Postman-SDK Request Object

* `options` - options is an object which hsa following properties
* `indentType` - String denoting type of indentation for code snippet. eg: 'Space', 'Tab'
* `indentCount` - The number of indentation characters to add per code level
* `trimRequestBody` - Whether or not request body fields should be trimmed
* `includeBoilerplate` - Include class definition and import statements in snippet
* `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 = {
indentCount: 3,
indentType: 'Space',
requestTimeout: 200,
trimRequestBody: true
};
convert(request, options, function(error, snippet) {
if (error) {
// handle error
}
// handle snippet
});
```
### Guidelines for using generated snippet

* This module doesn't support cookies.
1 change: 1 addition & 0 deletions codegens/kotlin-retrofit2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./lib');
Loading