@@ -22,15 +22,22 @@ export const provisioners: TypesGen.ProvisionerDaemon[] = [
22
22
} ,
23
23
]
24
24
25
- export const login = async ( email : string , password : string ) : Promise < TypesGen . LoginWithPasswordResponse > => {
25
+ export const login = async (
26
+ email : string ,
27
+ password : string ,
28
+ ) : Promise < TypesGen . LoginWithPasswordResponse > => {
26
29
const payload = JSON . stringify ( {
27
30
email,
28
31
password,
29
32
} )
30
33
31
- const response = await axios . post < TypesGen . LoginWithPasswordResponse > ( "/api/v2/users/login" , payload , {
32
- headers : { ...CONTENT_TYPE_JSON } ,
33
- } )
34
+ const response = await axios . post < TypesGen . LoginWithPasswordResponse > (
35
+ "/api/v2/users/login" ,
36
+ payload ,
37
+ {
38
+ headers : { ...CONTENT_TYPE_JSON } ,
39
+ } ,
40
+ )
34
41
35
42
return response . data
36
43
}
@@ -53,7 +60,10 @@ export const checkUserPermissions = async (
53
60
userId : string ,
54
61
params : TypesGen . UserAuthorizationRequest ,
55
62
) : Promise < TypesGen . UserAuthorizationResponse > => {
56
- const response = await axios . post < TypesGen . UserAuthorizationResponse > ( `/api/v2/users/${ userId } /authorization` , params )
63
+ const response = await axios . post < TypesGen . UserAuthorizationResponse > (
64
+ `/api/v2/users/${ userId } /authorization` ,
65
+ params ,
66
+ )
57
67
return response . data
58
68
}
59
69
@@ -83,35 +93,54 @@ export const getTemplate = async (templateId: string): Promise<TypesGen.Template
83
93
}
84
94
85
95
export const getTemplates = async ( organizationId : string ) : Promise < TypesGen . Template [ ] > => {
86
- const response = await axios . get < TypesGen . Template [ ] > ( `/api/v2/organizations/${ organizationId } /templates` )
96
+ const response = await axios . get < TypesGen . Template [ ] > (
97
+ `/api/v2/organizations/${ organizationId } /templates` ,
98
+ )
87
99
return response . data
88
100
}
89
101
90
- export const getTemplateByName = async ( organizationId : string , name : string ) : Promise < TypesGen . Template > => {
91
- const response = await axios . get < TypesGen . Template > ( `/api/v2/organizations/${ organizationId } /templates/${ name } ` )
102
+ export const getTemplateByName = async (
103
+ organizationId : string ,
104
+ name : string ,
105
+ ) : Promise < TypesGen . Template > => {
106
+ const response = await axios . get < TypesGen . Template > (
107
+ `/api/v2/organizations/${ organizationId } /templates/${ name } ` ,
108
+ )
92
109
return response . data
93
110
}
94
111
95
112
export const getTemplateVersion = async ( versionId : string ) : Promise < TypesGen . TemplateVersion > => {
96
- const response = await axios . get < TypesGen . TemplateVersion > ( `/api/v2/templateversions/${ versionId } ` )
113
+ const response = await axios . get < TypesGen . TemplateVersion > (
114
+ `/api/v2/templateversions/${ versionId } ` ,
115
+ )
97
116
return response . data
98
117
}
99
118
100
- export const getTemplateVersionSchema = async ( versionId : string ) : Promise < TypesGen . ParameterSchema [ ] > => {
101
- const response = await axios . get < TypesGen . ParameterSchema [ ] > ( `/api/v2/templateversions/${ versionId } /schema` )
119
+ export const getTemplateVersionSchema = async (
120
+ versionId : string ,
121
+ ) : Promise < TypesGen . ParameterSchema [ ] > => {
122
+ const response = await axios . get < TypesGen . ParameterSchema [ ] > (
123
+ `/api/v2/templateversions/${ versionId } /schema` ,
124
+ )
102
125
return response . data
103
126
}
104
127
105
- export const getTemplateVersionResources = async ( versionId : string ) : Promise < TypesGen . WorkspaceResource [ ] > => {
106
- const response = await axios . get < TypesGen . WorkspaceResource [ ] > ( `/api/v2/templateversions/${ versionId } /resources` )
128
+ export const getTemplateVersionResources = async (
129
+ versionId : string ,
130
+ ) : Promise < TypesGen . WorkspaceResource [ ] > => {
131
+ const response = await axios . get < TypesGen . WorkspaceResource [ ] > (
132
+ `/api/v2/templateversions/${ versionId } /resources` ,
133
+ )
107
134
return response . data
108
135
}
109
136
110
137
export const getWorkspace = async (
111
138
workspaceId : string ,
112
139
params ?: TypesGen . WorkspaceOptions ,
113
140
) : Promise < TypesGen . Workspace > => {
114
- const response = await axios . get < TypesGen . Workspace > ( `/api/v2/workspaces/${ workspaceId } ` , { params } )
141
+ const response = await axios . get < TypesGen . Workspace > ( `/api/v2/workspaces/${ workspaceId } ` , {
142
+ params,
143
+ } )
115
144
return response . data
116
145
}
117
146
@@ -128,7 +157,9 @@ export const getWorkspacesURL = (filter?: TypesGen.WorkspaceFilter): string => {
128
157
return searchString ? `${ basePath } ?${ searchString } ` : basePath
129
158
}
130
159
131
- export const getWorkspaces = async ( filter ?: TypesGen . WorkspaceFilter ) : Promise < TypesGen . Workspace [ ] > => {
160
+ export const getWorkspaces = async (
161
+ filter ?: TypesGen . WorkspaceFilter ,
162
+ ) : Promise < TypesGen . Workspace [ ] > => {
132
163
const url = getWorkspacesURL ( filter )
133
164
const response = await axios . get < TypesGen . Workspace [ ] > ( url )
134
165
return response . data
@@ -139,13 +170,18 @@ export const getWorkspaceByOwnerAndName = async (
139
170
workspaceName : string ,
140
171
params ?: TypesGen . WorkspaceOptions ,
141
172
) : Promise < TypesGen . Workspace > => {
142
- const response = await axios . get < TypesGen . Workspace > ( `/api/v2/users/${ username } /workspace/${ workspaceName } ` , {
143
- params,
144
- } )
173
+ const response = await axios . get < TypesGen . Workspace > (
174
+ `/api/v2/users/${ username } /workspace/${ workspaceName } ` ,
175
+ {
176
+ params,
177
+ } ,
178
+ )
145
179
return response . data
146
180
}
147
181
148
- export const getWorkspaceResources = async ( workspaceBuildID : string ) : Promise < TypesGen . WorkspaceResource [ ] > => {
182
+ export const getWorkspaceResources = async (
183
+ workspaceBuildID : string ,
184
+ ) : Promise < TypesGen . WorkspaceResource [ ] > => {
149
185
const response = await axios . get < TypesGen . WorkspaceResource [ ] > (
150
186
`/api/v2/workspacebuilds/${ workspaceBuildID } /resources` ,
151
187
)
@@ -167,7 +203,9 @@ export const startWorkspace = postWorkspaceBuild("start")
167
203
export const stopWorkspace = postWorkspaceBuild ( "stop" )
168
204
export const deleteWorkspace = postWorkspaceBuild ( "delete" )
169
205
170
- export const cancelWorkspaceBuild = async ( workspaceBuildId : TypesGen . WorkspaceBuild [ "id" ] ) : Promise < Types . Message > => {
206
+ export const cancelWorkspaceBuild = async (
207
+ workspaceBuildId : TypesGen . WorkspaceBuild [ "id" ] ,
208
+ ) : Promise < Types . Message > => {
171
209
const response = await axios . patch ( `/api/v2/workspacebuilds/${ workspaceBuildId } /cancel` )
172
210
return response . data
173
211
}
@@ -181,7 +219,10 @@ export const createWorkspace = async (
181
219
organizationId : string ,
182
220
workspace : TypesGen . CreateWorkspaceRequest ,
183
221
) : Promise < TypesGen . Workspace > => {
184
- const response = await axios . post < TypesGen . Workspace > ( `/api/v2/organizations/${ organizationId } /workspaces` , workspace )
222
+ const response = await axios . post < TypesGen . Workspace > (
223
+ `/api/v2/organizations/${ organizationId } /workspaces` ,
224
+ workspace ,
225
+ )
185
226
return response . data
186
227
}
187
228
@@ -263,8 +304,12 @@ export const regenerateUserSSHKey = async (userId = "me"): Promise<TypesGen.GitS
263
304
return response . data
264
305
}
265
306
266
- export const getWorkspaceBuilds = async ( workspaceId : string ) : Promise < TypesGen . WorkspaceBuild [ ] > => {
267
- const response = await axios . get < TypesGen . WorkspaceBuild [ ] > ( `/api/v2/workspaces/${ workspaceId } /builds` )
307
+ export const getWorkspaceBuilds = async (
308
+ workspaceId : string ,
309
+ ) : Promise < TypesGen . WorkspaceBuild [ ] > => {
310
+ const response = await axios . get < TypesGen . WorkspaceBuild [ ] > (
311
+ `/api/v2/workspaces/${ workspaceId } /builds` ,
312
+ )
268
313
return response . data
269
314
}
270
315
@@ -279,7 +324,10 @@ export const getWorkspaceBuildByNumber = async (
279
324
return response . data
280
325
}
281
326
282
- export const getWorkspaceBuildLogs = async ( buildname : string , before : Date ) : Promise < TypesGen . ProvisionerJobLog [ ] > => {
327
+ export const getWorkspaceBuildLogs = async (
328
+ buildname : string ,
329
+ before : Date ,
330
+ ) : Promise < TypesGen . ProvisionerJobLog [ ] > => {
283
331
const response = await axios . get < TypesGen . ProvisionerJobLog [ ] > (
284
332
`/api/v2/workspacebuilds/${ buildname } /logs?before=${ before . getTime ( ) } ` ,
285
333
)
0 commit comments