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
15
15
import com.coder.toolbox.sdk.v2.models.Workspace
16
16
import com.coder.toolbox.sdk.v2.models.WorkspaceAgent
17
17
import com.coder.toolbox.sdk.v2.models.WorkspaceBuild
18
+ import com.coder.toolbox.sdk.v2.models.WorkspaceBuildReason
18
19
import com.coder.toolbox.sdk.v2.models.WorkspaceResource
19
20
import com.coder.toolbox.sdk.v2.models.WorkspaceStatus
20
21
import com.coder.toolbox.sdk.v2.models.WorkspaceTransition
@@ -268,7 +269,12 @@ open class CoderRestClient(
268
269
* @throws [APIResponseException].
269
270
*/
270
271
suspend fun startWorkspace (workspace : Workspace ): WorkspaceBuild {
271
- val buildRequest = CreateWorkspaceBuildRequest (null , WorkspaceTransition .START )
272
+ val buildRequest = CreateWorkspaceBuildRequest (
273
+ null ,
274
+ WorkspaceTransition .START ,
275
+ null ,
276
+ WorkspaceBuildReason .JETBRAINS_CONNECTION
277
+ )
272
278
val buildResponse = retroRestClient.createWorkspaceBuild(workspace.id, buildRequest)
273
279
if (buildResponse.code() != HttpURLConnection .HTTP_CREATED ) {
274
280
throw APIResponseException (
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ data class CreateWorkspaceBuildRequest(
10
10
@Json(name = " template_version_id" ) val templateVersionID : UUID ? ,
11
11
// Use to start, stop and delete the workspace.
12
12
@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
14
15
) {
15
16
override fun equals (other : Any? ): Boolean {
16
17
if (this == = other) return true
@@ -21,13 +22,15 @@ data class CreateWorkspaceBuildRequest(
21
22
if (templateVersionID != other.templateVersionID) return false
22
23
if (transition != other.transition) return false
23
24
if (orphan != other.orphan) return false
25
+ if (reason != other.reason) return false
24
26
return true
25
27
}
26
28
27
29
override fun hashCode (): Int {
28
30
var result = orphan?.hashCode() ? : 0
29
31
result = 31 * result + (templateVersionID?.hashCode() ? : 0 )
30
32
result = 31 * result + transition.hashCode()
33
+ result = 31 * result + (reason?.hashCode() ? : 0 )
31
34
return result
32
35
}
33
36
}
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