Skip to content

Commit 5b3c98d

Browse files
committed
Merge remote-tracking branch 'origin/main' into add-ui-tests
2 parents de19fc4 + 6bbbe9c commit 5b3c98d

File tree

84 files changed

+12916
-2631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+12916
-2631
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ _Add your description_
99

1010
### Checklist
1111
- [ ] I have gone through the [contributing guide](https://github.com/foss42/apidash/blob/main/CONTRIBUTING.md)
12+
- [ ] I have updated my branch and synced it with project `main` branch before making this PR
1213
- [ ] I have run the tests (`flutter test`) and all tests are passing
1314

1415
## Added/updated tests?

CONTRIBUTING.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,30 @@ flutter test test/widgets/codegen_previewer_test.dart
128128
### How to add a new package to pubspec.yaml?
129129

130130
Instead of copy pasting from pub.dev, it is recommended that you use `flutter pub add package_name` to add a new package to `pubspec.yaml`. You can read more [here](https://docs.flutter.dev/packages-and-plugins/using-packages#adding-a-package-dependency-to-an-app-using-flutter-pub-add).
131+
132+
## Platform-specific Additional Instructions
133+
134+
### macOS
135+
136+
Add below keys to `macos/Runner/DebugProfile.entitlements` and `macos/Runner/Release.entitlements`.
137+
138+
```
139+
<key>com.apple.security.network.server</key>
140+
<true/>
141+
<key>com.apple.security.network.client</key>
142+
<true/>
143+
<key>com.apple.security.files.downloads.read-write</key>
144+
<true/>
145+
<key>com.apple.security.files.user-selected.read-write</key>
146+
<true/>
147+
```
148+
149+
If not added, you can encounter a network connection error similar to the following while running your Flutter app on macOS:
150+
151+
```
152+
ClientException with SocketException: Connection failed (OS Error: Operation not permitted, errno = 1)
153+
```
154+
155+
You can read more [here](https://docs.flutter.dev/platform-integration/macos/building#setting-up-entitlements)
156+
157+

README.md

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,17 @@
22

33
[![Discord Server Invite](https://img.shields.io/badge/DISCORD-JOIN%20SERVER-5663F7?style=for-the-badge&logo=discord&logoColor=white)](https://bit.ly/heyfoss)
44

5-
We are participating in GSoC 2024 🎉 [More Details ...](https://summerofcode.withgoogle.com/programs/2024/organizations/api-dash)
5+
🚨 We are participating in GSoC 2024 🎉
6+
7+
<img src="https://github.com/foss42/apidash/assets/615622/493ce57f-06c3-4789-b7ae-9fa63bca8183" alt="GSoC" width="500">
8+
9+
| | Link |
10+
|--|--|
11+
| Learn about GSoC | [Link](https://summerofcode.withgoogle.com) |
12+
| Organization page on GSoC | [Link](https://summerofcode.withgoogle.com/programs/2024/organizations/api-dash) |
13+
| Project Ideas List | [Link](https://github.com/foss42/apidash/discussions/112) |
14+
| Application Guide | [Link](https://github.com/foss42/apidash/discussions/111) |
15+
| Discord Channel | [Link](https://discord.com/invite/2s49SCNfyJ) |
616

717
### Please support this initiative by giving this project a Star ⭐️
818

@@ -113,18 +123,28 @@ API Dash can be downloaded from the links below:
113123

114124
API Dash currently supports API integration code generation for the following languages/libraries.
115125

116-
| Language | Library |
117-
| ---------------------- | ------------- |
118-
| cURL | |
119-
| HAR | |
120-
| Dart | `http` |
121-
| JavaScript | `axios` |
122-
| JavaScript | `fetch` |
123-
| JavaScript (`node.js`) | `axios` |
124-
| JavaScript (`node.js`) | `fetch` |
125-
| Python | `http.client` |
126-
| Python | `requests` |
127-
| Kotlin | `okhttp3` |
126+
| Language | Library | Comment/Issues |
127+
| ---------------------- | ------------- | ------- |
128+
| cURL | | |
129+
| HAR | | |
130+
| Dart | `http` | |
131+
| Dart | `dio` | |
132+
| Go | `net/http` | |
133+
| JavaScript | `axios` | |
134+
| JavaScript | `fetch` | |
135+
| JavaScript (`node.js`) | `axios` | |
136+
| JavaScript (`node.js`) | `fetch` | |
137+
| Python | `requests` | |
138+
| Python | `http.client` | |
139+
| Kotlin | `okhttp3` | |
140+
| Rust | `reqwest` | |
141+
| Rust | `ureq` | |
142+
| Rust | `Actix Client` | |
143+
| Java | `asynchttpclient` | https://github.com/foss42/apidash/issues/136 |
144+
| Java | `HttpClient` | https://github.com/foss42/apidash/issues/137 |
145+
| Java | `okhttp3` | |
146+
| Julia | `HTTP` | https://github.com/foss42/apidash/issues/154 |
147+
| PHP | `guzzle` | https://github.com/foss42/apidash/issues/143 |
128148

129149
We welcome contributions to support other programming languages/libraries/frameworks. Please check out more details [here](https://github.com/foss42/apidash/discussions/80).
130150

assets/completed.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"v":"5.1.16","fr":29.9700012207031,"ip":0,"op":30.0000012219251,"w":500,"h":500,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0]],"v":[[-158,21],[-63,116],[162,-109]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0.129411764706,0.8,0.223529411765,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":36,"ix":5},"lc":1,"lj":1,"ml":4,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Shape 1","np":3,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":1},"e":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"n":["0p833_0p833_0p167_0p167"],"t":0,"s":[0],"e":[100]},{"t":20.0000008146167}],"ix":2},"o":{"a":0,"k":0,"ix":3},"m":1,"ix":2,"nm":"Trim Paths 1","mn":"ADBE Vector Filter - Trim","hd":false}],"ip":-149.000006068894,"op":40.0000016292334,"st":-149.000006068894,"bm":0}],"markers":[]}

assets/saving.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"v":"5.5.7","meta":{"g":"LottieFiles AE 0.1.20","a":"","k":"","d":"","tc":""},"fr":25,"ip":0,"op":31,"w":200,"h":200,"nm":"save","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Layer 4","parent":4,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[101.689,94.053,0],"ix":2},"a":{"a":0,"k":[101.689,94.053,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.25,0.25,0.25],"y":[1,1,1]},"o":{"x":[0.33,0.33,0.33],"y":[0,0,0]},"t":13,"s":[100,0,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":23,"s":[100,100,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.75,0.75,0.75],"y":[0,0,0]},"t":60,"s":[100,100,100]},{"t":68,"s":[100,0,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[0.5,0.985],[-0.5,0.985],[-0.5,-0.985],[0.5,-0.985]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.20000000298,0.192156866193,0.196078434587,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tr","p":{"a":0,"k":[101.689,95.038],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":1,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":75,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Layer 3","parent":4,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[100.213,92.217,0],"ix":2},"a":{"a":0,"k":[100.213,92.217,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.25,0.25,0.25],"y":[1,1,1]},"o":{"x":[0.33,0.33,0.33],"y":[0,0,0]},"t":7,"s":[0,0,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":21,"s":[100,100,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.75,0.75,0.75],"y":[0,0,0]},"t":61,"s":[100,100,100]},{"t":70,"s":[0,0,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0.276,0],[0,0],[0,0.276],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[-0.276,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0.276]],"v":[[3.623,3.021],[-3.623,3.021],[-4.123,2.521],[-4.123,-3.021],[-3.123,-3.021],[-3.123,2.021],[3.123,2.021],[3.123,-2.943],[4.123,-2.943],[4.123,2.521]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.20000000298,0.192156866193,0.196078434587,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tr","p":{"a":0,"k":[100.213,95.238],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":1,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":75,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Layer 2","parent":4,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[100.213,109.234,0],"ix":2},"a":{"a":0,"k":[100.213,109.234,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.25,0.25,0.25],"y":[1,1,1]},"o":{"x":[0.33,0.33,0.33],"y":[0,0,0]},"t":4,"s":[0,0,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.33,0.33,0.33],"y":[0,0,0]},"t":20,"s":[100,100,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.75,0.75,0.75],"y":[0,0,0]},"t":62,"s":[100,100,100]},{"t":72,"s":[0,0,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0.37,0],[0,0],[0,-0.37],[0,0],[0,0],[0,0],[-0.921,0],[0,0],[0,-0.921]],"o":[[0,0],[0,0],[0,-0.37],[0,0],[-0.37,0],[0,0],[0,0],[0,0],[0,-0.921],[0,0],[0.921,0],[0,0]],"v":[[5.744,3.929],[4.744,3.929],[4.744,-2.259],[4.074,-2.929],[-4.074,-2.929],[-4.744,-2.259],[-4.744,3.929],[-5.744,3.929],[-5.744,-2.259],[-4.074,-3.929],[4.074,-3.929],[5.744,-2.259]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.20000000298,0.192156866193,0.196078434587,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":2,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tr","p":{"a":0,"k":[100.213,105.305],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":1,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":75,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":4,"nm":"Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[100.739,174.33,0],"ix":2},"a":{"a":0,"k":[100.213,109.734,0],"ix":1},"s":{"a":1,"k":[{"i":{"x":[0.25,0.25,0.25],"y":[1,1,1]},"o":{"x":[0.33,0.33,0.33],"y":[0,0,0]},"t":0,"s":[0,0,100]},{"i":{"x":[0.25,0.25,0.25],"y":[1,1,1]},"o":{"x":[0.33,0.33,0.33],"y":[0,0,0]},"t":12,"s":[830,830,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.167,0.167,0.167],"y":[0,0,0]},"t":19,"s":[815,815,100]},{"i":{"x":[0.67,0.67,0.67],"y":[1,1,1]},"o":{"x":[0.75,0.75,0.75],"y":[0,0,0]},"t":63,"s":[815,815,100]},{"t":74,"s":[0,0,100]}],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0],[0,0]],"v":[[-8.522,8.036],[8.522,8.036],[8.522,-4.465],[5.185,-7.882],[-8.522,-8.03]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ind":1,"ty":"sh","ix":2,"ks":{"a":0,"k":{"i":[[0.276,0],[0,0],[0,0.276],[0,0],[-0.095,0.094],[-0.117,0.009],[0,0],[-0.093,-0.095],[0,0],[0,-0.13],[0,0]],"o":[[0,0],[-0.276,0],[0,0],[0,-0.134],[0.095,-0.094],[0,0],[0.133,0.001],[0,0],[0.091,0.093],[0,0],[0,0.276]],"v":[[9.022,9.036],[-9.022,9.036],[-9.522,8.536],[-9.522,-8.536],[-9.374,-8.891],[-9.017,-9.036],[5.403,-8.879],[5.756,-8.729],[9.38,-5.018],[9.522,-4.668],[9.522,8.536]],"c":true},"ix":2},"nm":"Path 2","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"fl","c":{"a":0,"k":[0.20000000298,0.192156866193,0.196078434587,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false},{"ty":"tr","p":{"a":0,"k":[100.213,100.698],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Group 1","np":1,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":75,"st":0,"bm":0}],"markers":[]}

lib/codegen/codegen.dart

Lines changed: 52 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,84 @@
11
import 'package:apidash/models/models.dart' show RequestModel;
22
import 'package:apidash/consts.dart';
3+
import 'package:apidash/utils/utils.dart' show getNewUuid;
34
import 'dart/http.dart';
45
import 'dart/dio.dart';
6+
import 'go/http.dart';
57
import 'kotlin/okhttp.dart';
8+
import 'php/guzzle.dart';
69
import 'python/http_client.dart';
710
import 'python/requests.dart';
11+
import 'rust/actix.dart';
12+
import 'rust/reqwest.dart';
13+
import 'rust/ureq.dart';
814
import 'js/axios.dart';
915
import 'js/fetch.dart';
1016
import 'others/har.dart';
1117
import 'others/curl.dart';
18+
import 'julia/http.dart';
19+
import 'java/okhttp.dart';
20+
import 'java/async_http_client.dart';
21+
import 'java/httpclient.dart';
1222

1323
class Codegen {
1424
String? getCode(
1525
CodegenLanguage codegenLanguage,
1626
RequestModel requestModel,
17-
String defaultUriScheme,
18-
) {
27+
String defaultUriScheme, {
28+
String? boundary,
29+
}) {
30+
String url = requestModel.url;
31+
32+
if (url.isEmpty) {
33+
url = kDefaultUri;
34+
}
35+
if (!url.contains("://") && url.isNotEmpty) {
36+
url = "$defaultUriScheme://$url";
37+
}
38+
var rM = requestModel.copyWith(url: url);
39+
1940
switch (codegenLanguage) {
2041
case CodegenLanguage.curl:
21-
return cURLCodeGen().getCode(requestModel, defaultUriScheme);
42+
return cURLCodeGen().getCode(rM);
2243
case CodegenLanguage.har:
23-
return HARCodeGen().getCode(requestModel, defaultUriScheme);
44+
return HARCodeGen().getCode(rM, defaultUriScheme, boundary: boundary);
2445
case CodegenLanguage.dartHttp:
25-
return DartHttpCodeGen().getCode(requestModel, defaultUriScheme);
46+
return DartHttpCodeGen().getCode(rM);
2647
case CodegenLanguage.dartDio:
27-
return DartDioCodeGen().getCode(requestModel, defaultUriScheme);
48+
return DartDioCodeGen().getCode(rM);
49+
case CodegenLanguage.goHttp:
50+
return GoHttpCodeGen().getCode(rM);
2851
case CodegenLanguage.jsAxios:
29-
return AxiosCodeGen().getCode(requestModel, defaultUriScheme);
52+
return AxiosCodeGen().getCode(rM);
3053
case CodegenLanguage.jsFetch:
31-
return FetchCodeGen().getCode(requestModel, defaultUriScheme);
54+
return FetchCodeGen().getCode(rM);
3255
case CodegenLanguage.nodejsAxios:
33-
return AxiosCodeGen(isNodeJs: true)
34-
.getCode(requestModel, defaultUriScheme);
56+
return AxiosCodeGen(isNodeJs: true).getCode(rM);
3557
case CodegenLanguage.nodejsFetch:
36-
return FetchCodeGen(isNodeJs: true)
37-
.getCode(requestModel, defaultUriScheme);
58+
return FetchCodeGen(isNodeJs: true).getCode(rM);
59+
case CodegenLanguage.javaAsyncHttpClient:
60+
return JavaAsyncHttpClientGen().getCode(rM);
61+
case CodegenLanguage.javaHttpClient:
62+
return JavaHttpClientCodeGen().getCode(rM);
63+
case CodegenLanguage.javaOkHttp:
64+
return JavaOkHttpCodeGen().getCode(rM);
65+
case CodegenLanguage.juliaHttp:
66+
return JuliaHttpClientCodeGen().getCode(rM);
3867
case CodegenLanguage.kotlinOkHttp:
39-
return KotlinOkHttpCodeGen().getCode(requestModel, defaultUriScheme);
68+
return KotlinOkHttpCodeGen().getCode(rM);
4069
case CodegenLanguage.pythonHttpClient:
4170
return PythonHttpClientCodeGen()
42-
.getCode(requestModel, defaultUriScheme);
71+
.getCode(rM, boundary: boundary ?? getNewUuid());
4372
case CodegenLanguage.pythonRequests:
44-
return PythonRequestsCodeGen().getCode(requestModel, defaultUriScheme);
73+
return PythonRequestsCodeGen().getCode(rM, boundary: boundary);
74+
case CodegenLanguage.rustActix:
75+
return RustActixCodeGen().getCode(rM, boundary: boundary);
76+
case CodegenLanguage.rustReqwest:
77+
return RustReqwestCodeGen().getCode(rM);
78+
case CodegenLanguage.rustUreq:
79+
return RustUreqCodeGen().getCode(rM, boundary: boundary);
80+
case CodegenLanguage.phpGuzzle:
81+
return PhpGuzzleCodeGen().getCode(rM);
4582
}
4683
}
4784
}

lib/codegen/codegen_utils.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
String jsonToPyDict(String jsonString) {
2+
Map<String, String> replaceWithMap = {
3+
"null": "None",
4+
"true": "True",
5+
"false": "False"
6+
};
7+
String pyDict = jsonString;
8+
for (var k in replaceWithMap.keys) {
9+
RegExp regExp = RegExp(k + r'(?=([^"]*"[^"]*")*[^"]*$)');
10+
pyDict = pyDict.replaceAllMapped(regExp, (match) {
11+
return replaceWithMap[match.group(0)] ?? match.group(0)!;
12+
});
13+
}
14+
return pyDict;
15+
}

0 commit comments

Comments
 (0)