Skip to content

Commit b2c61e9

Browse files
authored
Merge pull request #535 from AffanShaikhsurab/patch-5
Add detailed instructions for running API Dash-generated code in Kotlin using okhttp3
2 parents 7a48093 + 83464d3 commit b2c61e9

File tree

1 file changed

+44
-1
lines changed

1 file changed

+44
-1
lines changed

doc/user_guide/instructions_to_run_generated_code.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,50 @@ TODO
533533

534534
## Kotlin (okhttp3)
535535

536-
TODO
536+
Here are the detailed instructions for running the generated API Dash code in Kotlin (using okhttp3) for macOS, Windows, and Linux:
537+
538+
### 1. Install Kotlin
539+
540+
To run Kotlin code, you need to install Kotlin by following the below instructions:
541+
542+
- Go to [Kotlin Installation Guide](https://kotlinlang.org/docs/getting-started.html#install-kotlin) for detailed steps.
543+
- Kotlin is also included in IntelliJ IDEA and Android Studio. You can also download and install one of these IDEs to start using Kotlin.
544+
545+
### 2. Add `okhttp` library
546+
547+
To use `okhttp3` in your Kotlin project, you need to include it as a dependency. If you're using **Gradle**, follow these steps:
548+
549+
- Open the `build.gradle` file in your project.
550+
- Add the following dependency in the `dependencies` section:
551+
552+
```gradle
553+
implementation("com.squareup.okhttp3:okhttp:4.12.0")
554+
```
555+
556+
- Sync your project to apply the dependency.
557+
558+
### 3. Execute the generated code
559+
560+
After setting up Kotlin and `okhttp3`, follow these steps to run the generated code:
561+
562+
#### Using IDE
563+
564+
1. Open the installed IDE like Android Studio.
565+
2. Create a new Kotlin file.
566+
3. Copy the generated code from API Dash and paste it in the Kotlin file.
567+
4. Run the Kotlin file by clicking the `Run` button in the IDE or by using the command line.
568+
569+
#### Using command line
570+
571+
1. Create a new Kotlin file.
572+
2. Copy the generated code from API Dash and paste it in the Kotlin file (`api_test.kt`).
573+
3. Navigate to the project directory using the terminal or command prompt.
574+
4. Compile and run the Kotlin file by executing:
575+
576+
```bash
577+
kotlinc api_test.kt -include-runtime -d api_test.jar
578+
java -jar api_test.jar
579+
```
537580
538581
## PHP (curl)
539582

0 commit comments

Comments
 (0)