Skip to content

Commit

Permalink
MAK-57 IJ: Add button to start flow mode for task (#101)
Browse files Browse the repository at this point in the history
* MAK-57 IJ: Add button to start flow mode for task

* Upgrading intellij platform
  • Loading branch information
bcosynot committed Jul 3, 2023
1 parent 5cbe658 commit 2f1f112
Show file tree
Hide file tree
Showing 18 changed files with 432 additions and 180 deletions.
2 changes: 1 addition & 1 deletion .run/Run Plugin.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
</component>
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="false" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" />
</ENTRIES>
</extension>
<EXTENSION ID="com.intellij.execution.ExternalSystemRunConfigurationJavaExtension">
<extension name="net.ashald.envfile">
<option name="IS_ENABLED" value="false" />
<option name="IS_SUBST" value="false" />
<option name="IS_PATH_MACRO_SUPPORTED" value="false" />
<option name="IS_IGNORE_MISSING_FILES" value="false" />
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" />
<ENTRIES>
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" />
</ENTRIES>
</extension>
</EXTENSION>
<DebugAllEnabled>false</DebugAllEnabled>
<method v="2">
<option name="Gradle.BeforeRunTask" enabled="true" tasks="clean" externalProjectPath="$PROJECT_DIR$" vmOptions="" scriptParameters="" />
</method>
<ForceTestExec>false</ForceTestExec>
<method v="2" />
</configuration>
</component>
22 changes: 13 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ plugins {
kotlin("jvm") version "1.8.20"
kotlin("plugin.serialization") version "1.8.20"
// Gradle IntelliJ Plugin
id("org.jetbrains.intellij") version "1.14.1"
id("org.jetbrains.intellij") version "1.14.2"
// Gradle Changelog Plugin
id("org.jetbrains.changelog") version "2.1.0"
// Gradle Qodana Plugin
id("org.jetbrains.qodana") version "0.1.13"
// Dokka
id("org.jetbrains.dokka") version "1.8.10"
id("org.jetbrains.dokka") version "1.8.20"
// IDEA support
id("idea")
}
Expand All @@ -31,7 +31,7 @@ repositories {
mavenCentral()
}

val ktorVersion = "2.1.3"
val ktorVersion = "2.3.2"
dependencies {
implementation("com.github.kittinunf.fuel:fuel:2.3.1")
implementation("com.github.kittinunf.fuel:fuel-jackson:2.3.1")
Expand All @@ -42,13 +42,17 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:4.9.3")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.3")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3")
implementation("io.ktor:ktor-client-core:$ktorVersion")
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
implementation("io.ktor:ktor-client-jackson:$ktorVersion")
implementation("io.ktor:ktor-client-java:$ktorVersion")
implementation("io.ktor:ktor-serialization-jackson:$ktorVersion")
val excludeFromKtor: (ExternalModuleDependency).() -> Unit = {
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-core")
exclude(group = "org.jetbrains.kotlinx", module = "kotlinx-coroutines-jdk8")
exclude(group = "org.slf4j", module = "slf4j-api")
}
implementation("io.ktor:ktor-client-core:$ktorVersion", excludeFromKtor)
implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion", excludeFromKtor)
implementation("io.ktor:ktor-client-jackson:$ktorVersion", excludeFromKtor)
implementation("io.ktor:ktor-client-cio:$ktorVersion", excludeFromKtor)
implementation("io.ktor:ktor-serialization-jackson:$ktorVersion", excludeFromKtor)
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
}

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ pluginVersion = 0.0.1

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild = 222
pluginSinceBuild = 231
pluginUntilBuild = 232.*

# IntelliJ Platform Properties -> https://github.com/JetBrains/gradle-intellij-plugin#intellij-platform-properties
platformType = IC
platformVersion = 2022.2.5
platformVersion = 2023.1.1

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
159 changes: 83 additions & 76 deletions src/main/kotlin/co/makerflow/client/apis/FlowModeApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,123 +26,130 @@ import io.ktor.client.engine.HttpClientEngine
import io.ktor.http.ParametersBuilder
import com.fasterxml.jackson.databind.ObjectMapper

open class FlowModeApi(
open class FlowModeApi(
baseUrl: String = ApiClient.BASE_URL,
httpClientEngine: HttpClientEngine? = null,
httpClientConfig: ((HttpClientConfig<*>) -> Unit)? = null,
jsonBlock: ObjectMapper.() -> Unit = ApiClient.JSON_DEFAULT,
) : ApiClient(baseUrl, httpClientEngine, httpClientConfig, jsonBlock) {
) : ApiClient(baseUrl, httpClientEngine, httpClientConfig, jsonBlock) {

/**
*
*
* @param source To specify source of request (optional)
* @return FetchOngoingFlowMode200Response
*/
@Suppress("UNCHECKED_CAST")
open suspend fun fetchOngoingFlowMode(source: kotlin.String?): HttpResponse<FetchOngoingFlowMode200Response> {
/**
*
*
* @param source To specify source of request (optional)
* @return FetchOngoingFlowMode200Response
*/
@Suppress("UNCHECKED_CAST")
open suspend fun fetchOngoingFlowMode(source: kotlin.String?): HttpResponse<FetchOngoingFlowMode200Response> {

val localVariableAuthNames = listOf<String>("api_token")
val localVariableAuthNames = listOf<String>("api_token")

val localVariableBody =
io.ktor.client.utils.EmptyContent
val localVariableBody =
io.ktor.client.utils.EmptyContent

val localVariableQuery = mutableMapOf<String, List<String>>()
source?.apply { localVariableQuery["source"] = listOf("$source") }
val localVariableQuery = mutableMapOf<String, List<String>>()
source?.apply { localVariableQuery["source"] = listOf("$source") }

val localVariableHeaders = mutableMapOf<String, String>()
val localVariableHeaders = mutableMapOf<String, String>()

val localVariableConfig = RequestConfig<kotlin.Any?>(
val localVariableConfig = RequestConfig<kotlin.Any?>(
RequestMethod.GET,
"/flow-mode/ongoing",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
)
)

return request(
return request(
localVariableConfig,
localVariableBody,
localVariableAuthNames
).wrap()
}

/**
*
*
* @param source To specify source of request (optional)
* @param pairing (optional)
* @param duration (optional)
* @param taskIntegrationType (optional)
* @param taskIntegrationId (optional)
* @param taskId (optional)
* @return StartFlowMode200Response
*/
@Suppress("UNCHECKED_CAST")
open suspend fun startFlowMode(source: kotlin.String?, pairing: kotlin.Boolean?, duration: kotlin.Int?, taskIntegrationType: kotlin.String?, taskIntegrationId: kotlin.String?, taskId: kotlin.String?): HttpResponse<StartFlowMode200Response> {

val localVariableAuthNames = listOf<String>("api_token")

val localVariableBody =
io.ktor.client.utils.EmptyContent

val localVariableQuery = mutableMapOf<String, List<String>>()
source?.apply { localVariableQuery["source"] = listOf("$source") }
pairing?.apply { localVariableQuery["pairing"] = listOf("$pairing") }
duration?.apply { localVariableQuery["duration"] = listOf("$duration") }
taskIntegrationType?.apply { localVariableQuery["taskIntegrationType"] = listOf("$taskIntegrationType") }
taskIntegrationId?.apply { localVariableQuery["taskIntegrationId"] = listOf("$taskIntegrationId") }
taskId?.apply { localVariableQuery["taskId"] = listOf("$taskId") }

val localVariableHeaders = mutableMapOf<String, String>()

val localVariableConfig = RequestConfig<kotlin.Any?>(
).wrap()
}

/**
*
*
* @param source To specify source of request (optional)
* @param pairing (optional)
* @param duration (optional)
* @param taskIntegrationType (optional)
* @param taskIntegrationId (optional)
* @param taskId (optional)
* @return StartFlowMode200Response
*/
@Suppress("UNCHECKED_CAST")
open suspend fun startFlowMode(
source: kotlin.String?,
pairing: kotlin.Boolean?,
duration: kotlin.Int?,
taskIntegrationType: kotlin.String?,
taskType: kotlin.String?,
taskId: kotlin.String?
): HttpResponse<StartFlowMode200Response> {

val localVariableAuthNames = listOf<String>("api_token")

val localVariableBody =
io.ktor.client.utils.EmptyContent

val localVariableQuery = mutableMapOf<String, List<String>>()
source?.apply { localVariableQuery["source"] = listOf("$source") }
pairing?.apply { localVariableQuery["pairing"] = listOf("$pairing") }
duration?.apply { localVariableQuery["duration"] = listOf("$duration") }
taskIntegrationType?.apply { localVariableQuery["taskIntegrationType"] = listOf("$taskIntegrationType") }
taskType?.apply { localVariableQuery["taskType"] = listOf("$taskType") }
taskId?.apply { localVariableQuery["taskId"] = listOf("$taskId") }

val localVariableHeaders = mutableMapOf<String, String>()

val localVariableConfig = RequestConfig<kotlin.Any?>(
RequestMethod.POST,
"/flow-mode/start",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
)
)

return request(
return request(
localVariableConfig,
localVariableBody,
localVariableAuthNames
).wrap()
}
).wrap()
}

/**
*
*
* @param source To specify source of request (optional)
* @return StopOngoingFlowMode200Response
*/
@Suppress("UNCHECKED_CAST")
open suspend fun stopOngoingFlowMode(source: kotlin.String?): HttpResponse<StopOngoingFlowMode200Response> {
/**
*
*
* @param source To specify source of request (optional)
* @return StopOngoingFlowMode200Response
*/
@Suppress("UNCHECKED_CAST")
open suspend fun stopOngoingFlowMode(source: kotlin.String?): HttpResponse<StopOngoingFlowMode200Response> {

val localVariableAuthNames = listOf<String>("api_token")
val localVariableAuthNames = listOf<String>("api_token")

val localVariableBody =
io.ktor.client.utils.EmptyContent
val localVariableBody =
io.ktor.client.utils.EmptyContent

val localVariableQuery = mutableMapOf<String, List<String>>()
source?.apply { localVariableQuery["source"] = listOf("$source") }
val localVariableQuery = mutableMapOf<String, List<String>>()
source?.apply { localVariableQuery["source"] = listOf("$source") }

val localVariableHeaders = mutableMapOf<String, String>()
val localVariableHeaders = mutableMapOf<String, String>()

val localVariableConfig = RequestConfig<kotlin.Any?>(
val localVariableConfig = RequestConfig<kotlin.Any?>(
RequestMethod.POST,
"/flow-mode/stop",
query = localVariableQuery,
headers = localVariableHeaders,
requiresAuthentication = true,
)
)

return request(
return request(
localVariableConfig,
localVariableBody,
localVariableAuthNames
).wrap()
}
).wrap()
}

}
}
29 changes: 20 additions & 9 deletions src/main/kotlin/co/makerflow/client/infrastructure/ApiClient.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
package co.makerflow.client.infrastructure


import co.makerflow.client.auth.ApiKeyAuth
import co.makerflow.client.auth.Authentication
import co.makerflow.client.auth.HttpBasicAuth
import co.makerflow.client.auth.HttpBearerAuth
import co.makerflow.client.auth.OAuth
import com.fasterxml.jackson.core.util.DefaultIndenter
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import io.ktor.client.HttpClient
import io.ktor.client.HttpClientConfig
import io.ktor.client.engine.HttpClientEngine
Expand All @@ -12,16 +22,17 @@ import io.ktor.client.request.parameter
import io.ktor.client.request.request
import io.ktor.client.request.setBody
import io.ktor.client.statement.HttpResponse
import io.ktor.http.ContentType
import io.ktor.http.HttpHeaders
import io.ktor.http.HttpMethod
import io.ktor.http.Parameters
import io.ktor.http.URLBuilder
import io.ktor.http.content.PartData
import io.ktor.serialization.jackson.*
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializationFeature
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
import com.fasterxml.jackson.core.util.DefaultIndenter
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter
import co.makerflow.client.auth.*
import io.ktor.http.*
import io.ktor.http.contentType
import io.ktor.http.encodeURLQueryComponent
import io.ktor.http.encodedPath
import io.ktor.http.takeFrom
import io.ktor.serialization.jackson.jackson

open class ApiClient(
private val baseUrl: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@

package co.makerflow.client.models

import co.makerflow.client.models.FetchOngoingFlowMode200ResponseAnyOf
import co.makerflow.client.models.FlowMode
import co.makerflow.client.models.TypedTodo

import com.fasterxml.jackson.annotation.JsonProperty

/**
*
*
*
* @param `data`
* @param `data`
* @param todo
*/


data class FetchOngoingFlowMode200Response (

@field:JsonProperty("data")
val `data`: FlowMode? = null
val `data`: FlowMode? = null,

@field:JsonProperty("todo")
val todo: TypedTodo? = null

)

Loading

0 comments on commit 2f1f112

Please sign in to comment.