Skip to content

Commit 5a7b527

Browse files
Add detailed instructions for running API Dash-generated code in Kotlin using okhttp3
Add detailed instructions for running API Dash-generated code in Kotlin using okhttp3, including steps for installing Kotlin, adding dependencies, and executing the code on macOS, Windows, and Linux.
1 parent 7c451e1 commit 5a7b527

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

doc/user_guide/instructions_to_run_generated_code.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,46 @@ TODO
9898
TODO
9999

100100
## Kotlin (okhttp3)
101+
Here are the detailed instructions for running the generated API Dash code in Kotlin (using okhttp3) for macOS, Windows, and Linux:
102+
103+
### 1. Install Kotlin:
104+
To run Kotlin code, you need to install Kotlin first. You can install Kotlin from the official Kotlin website:
105+
106+
- Go to [Kotlin Installation Guide](https://kotlinlang.org/docs/getting-started.html#install-kotlin) for detailed steps.
107+
- Remember: `Kotlin is included in each IntelliJ IDEA and Android Studio release. Download and install one of these IDEs to start using Kotlin`.
108+
109+
Once Kotlin is installed, proceed with adding `okhttp` and running the generated code.
110+
111+
### 2. Add `okhttp` library:
112+
To use `okhttp3` in your Kotlin project, you need to include it as a dependency. If you're using **Gradle**, follow these steps:
113+
114+
- Open the `build.gradle` file in your project.
115+
- Add the following dependency in the `dependencies` section:
116+
117+
```gradle
118+
implementation("com.squareup.okhttp3:okhttp:4.12.0")
119+
```
120+
121+
- Sync your project to apply the dependency.
122+
123+
### 3. Execute the generated code:
124+
After setting up Kotlin and `okhttp3`, follow these steps to run the generated code:
125+
126+
1. **Open your IDE** ✍️ (like Android Studio).
127+
2. **Create a new Kotlin file** 📝 (or use an existing one).
128+
3. **Copy the generated code** 📋 from API Dash.
129+
4. **Paste the code** into the Kotlin file 🔄.
130+
5. **Run the Kotlin file** by clicking the "Run" button in your IDE or by using the command line.
131+
132+
#### If you're running from the command line:
133+
1. **Navigate to the project directory** using the terminal or command prompt.
134+
2. **Compile and run the Kotlin file** with these commands:
135+
136+
```bash
137+
kotlinc api_test.kt -include-runtime -d api_test.jar
138+
java -jar api_test.jar
139+
```
101140

102-
TODO
103141

104142
## PHP (curl)
105143

0 commit comments

Comments
 (0)