File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
src/main/kotlin/com/coder/toolbox/sdk Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import com.coder.toolbox.sdk.v2.models.User
1515import com.coder.toolbox.sdk.v2.models.Workspace
1616import com.coder.toolbox.sdk.v2.models.WorkspaceAgent
1717import com.coder.toolbox.sdk.v2.models.WorkspaceBuild
18+ import com.coder.toolbox.sdk.v2.models.WorkspaceBuildReason
1819import com.coder.toolbox.sdk.v2.models.WorkspaceResource
1920import com.coder.toolbox.sdk.v2.models.WorkspaceStatus
2021import com.coder.toolbox.sdk.v2.models.WorkspaceTransition
@@ -271,7 +272,12 @@ open class CoderRestClient(
271272 * @throws [APIResponseException].
272273 */
273274 suspend fun startWorkspace (workspace : Workspace ): WorkspaceBuild {
274- val buildRequest = CreateWorkspaceBuildRequest (null , WorkspaceTransition .START )
275+ val buildRequest = CreateWorkspaceBuildRequest (
276+ null ,
277+ WorkspaceTransition .START ,
278+ null ,
279+ WorkspaceBuildReason .JETBRAINS_CONNECTION
280+ )
275281 val buildResponse = retroRestClient.createWorkspaceBuild(workspace.id, buildRequest)
276282 if (buildResponse.code() != HttpURLConnection .HTTP_CREATED ) {
277283 throw APIResponseException (
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ data class CreateWorkspaceBuildRequest(
1010 @Json(name = " template_version_id" ) val templateVersionID : UUID ? ,
1111 // Use to start, stop and delete the workspace.
1212 @Json(name = " transition" ) val transition : WorkspaceTransition ,
13- @Json(name = " orphan" ) var orphan : Boolean? = null
13+ @Json(name = " orphan" ) var orphan : Boolean? = null ,
14+ @Json(name = " reason" ) var reason : WorkspaceBuildReason ? = null
1415) {
1516 override fun equals (other : Any? ): Boolean {
1617 if (this == = other) return true
@@ -21,13 +22,15 @@ data class CreateWorkspaceBuildRequest(
2122 if (templateVersionID != other.templateVersionID) return false
2223 if (transition != other.transition) return false
2324 if (orphan != other.orphan) return false
25+ if (reason != other.reason) return false
2426 return true
2527 }
2628
2729 override fun hashCode (): Int {
2830 var result = orphan?.hashCode() ? : 0
2931 result = 31 * result + (templateVersionID?.hashCode() ? : 0 )
3032 result = 31 * result + transition.hashCode()
33+ result = 31 * result + (reason?.hashCode() ? : 0 )
3134 return result
3235 }
3336}
Original file line number Diff line number Diff line change 1+ package com.coder.toolbox.sdk.v2.models
2+
3+ import com.squareup.moshi.Json
4+
5+ enum class WorkspaceBuildReason {
6+ @Json(name = " jetbrains_connection" ) JETBRAINS_CONNECTION ,
7+ }
You can’t perform that action at this time.
0 commit comments