@@ -21,9 +21,11 @@ import type {
2121 ListServersResponse ,
2222 ListServerTypesResponse ,
2323 OS ,
24+ OSSupportedServerType ,
2425 PrivateNetworkApiAddServerPrivateNetworkRequest ,
2526 PrivateNetworkApiSetServerPrivateNetworksRequest ,
2627 ReinstallServerRequest ,
28+ RunnerConfiguration ,
2729 Server ,
2830 ServerPrivateNetwork ,
2931 ServerType ,
@@ -32,12 +34,28 @@ import type {
3234 ServerTypeGPU ,
3335 ServerTypeMemory ,
3436 ServerTypeNetwork ,
37+ ServerTypeNPU ,
3538 SetServerPrivateNetworksResponse ,
3639 StartConnectivityDiagnosticRequest ,
3740 StartConnectivityDiagnosticResponse ,
3841 UpdateServerRequest ,
3942} from './types.gen'
4043
44+ const unmarshalOSSupportedServerType = (
45+ data : unknown ,
46+ ) : OSSupportedServerType => {
47+ if ( ! isJSONObject ( data ) ) {
48+ throw new TypeError (
49+ `Unmarshalling the type 'OSSupportedServerType' failed as data isn't a dictionary.` ,
50+ )
51+ }
52+
53+ return {
54+ fastDeliveryAvailable : data . fast_delivery_available ,
55+ serverType : data . server_type ,
56+ } as OSSupportedServerType
57+ }
58+
4159export const unmarshalOS = ( data : unknown ) : OS => {
4260 if ( ! isJSONObject ( data ) ) {
4361 throw new TypeError (
@@ -46,13 +64,22 @@ export const unmarshalOS = (data: unknown): OS => {
4664 }
4765
4866 return {
49- compatibleServerTypes : data . compatible_server_types ,
67+ compatibleServerTypes : data . compatible_server_types
68+ ? data . compatible_server_types
69+ : undefined ,
70+ description : data . description ,
5071 family : data . family ,
5172 id : data . id ,
5273 imageUrl : data . image_url ,
5374 isBeta : data . is_beta ,
5475 label : data . label ,
5576 name : data . name ,
77+ releaseNotesUrl : data . release_notes_url ,
78+ supportedServerTypes : unmarshalArrayOfObject (
79+ data . supported_server_types ,
80+ unmarshalOSSupportedServerType ,
81+ ) ,
82+ tags : data . tags ,
5683 version : data . version ,
5784 xcodeVersion : data . xcode_version ,
5885 } as OS
@@ -71,6 +98,21 @@ const unmarshalCommitment = (data: unknown): Commitment => {
7198 } as Commitment
7299}
73100
101+ const unmarshalRunnerConfiguration = ( data : unknown ) : RunnerConfiguration => {
102+ if ( ! isJSONObject ( data ) ) {
103+ throw new TypeError (
104+ `Unmarshalling the type 'RunnerConfiguration' failed as data isn't a dictionary.` ,
105+ )
106+ }
107+
108+ return {
109+ name : data . name ,
110+ provider : data . provider ,
111+ token : data . token ,
112+ url : data . url ,
113+ } as RunnerConfiguration
114+ }
115+
74116export const unmarshalServer = ( data : unknown ) : Server => {
75117 if ( ! isJSONObject ( data ) ) {
76118 throw new TypeError (
@@ -93,9 +135,13 @@ export const unmarshalServer = (data: unknown): Server => {
93135 os : data . os ? unmarshalOS ( data . os ) : undefined ,
94136 projectId : data . project_id ,
95137 publicBandwidthBps : data . public_bandwidth_bps ,
138+ runnerConfiguration : data . runner_configuration
139+ ? unmarshalRunnerConfiguration ( data . runner_configuration )
140+ : undefined ,
96141 sshUsername : data . ssh_username ,
97142 status : data . status ,
98143 sudoPassword : data . sudo_password ,
144+ tags : data . tags ,
99145 type : data . type ,
100146 updatedAt : unmarshalDate ( data . updated_at ) ,
101147 vncPort : data . vnc_port ,
@@ -138,6 +184,8 @@ const unmarshalServerTypeCPU = (data: unknown): ServerTypeCPU => {
138184 coreCount : data . core_count ,
139185 frequency : data . frequency ,
140186 name : data . name ,
187+ sockets : data . sockets ,
188+ threadsPerCore : data . threads_per_core ,
141189 } as ServerTypeCPU
142190}
143191
@@ -179,6 +227,18 @@ const unmarshalServerTypeMemory = (data: unknown): ServerTypeMemory => {
179227 } as ServerTypeMemory
180228}
181229
230+ const unmarshalServerTypeNPU = ( data : unknown ) : ServerTypeNPU => {
231+ if ( ! isJSONObject ( data ) ) {
232+ throw new TypeError (
233+ `Unmarshalling the type 'ServerTypeNPU' failed as data isn't a dictionary.` ,
234+ )
235+ }
236+
237+ return {
238+ count : data . count ,
239+ } as ServerTypeNPU
240+ }
241+
182242const unmarshalServerTypeNetwork = ( data : unknown ) : ServerTypeNetwork => {
183243 if ( ! isJSONObject ( data ) ) {
184244 throw new TypeError (
@@ -187,6 +247,7 @@ const unmarshalServerTypeNetwork = (data: unknown): ServerTypeNetwork => {
187247 }
188248
189249 return {
250+ defaultPublicBandwidth : data . default_public_bandwidth ,
190251 publicBandwidthBps : data . public_bandwidth_bps ,
191252 supportedBandwidth : data . supported_bandwidth ,
192253 } as ServerTypeNetwork
@@ -210,6 +271,7 @@ export const unmarshalServerType = (data: unknown): ServerType => {
210271 network : data . network
211272 ? unmarshalServerTypeNetwork ( data . network )
212273 : undefined ,
274+ npu : data . npu ? unmarshalServerTypeNPU ( data . npu ) : undefined ,
213275 stock : data . stock ,
214276 } as ServerType
215277}
@@ -387,6 +449,16 @@ export const marshalBatchCreateServersRequest = (
387449 type : request . type ,
388450} )
389451
452+ const marshalRunnerConfiguration = (
453+ request : RunnerConfiguration ,
454+ defaults : DefaultValues ,
455+ ) : Record < string , unknown > => ( {
456+ name : request . name ,
457+ provider : request . provider ,
458+ token : request . token ,
459+ url : request . url ,
460+ } )
461+
390462export const marshalCreateServerRequest = (
391463 request : CreateServerRequest ,
392464 defaults : DefaultValues ,
@@ -397,6 +469,10 @@ export const marshalCreateServerRequest = (
397469 os_id : request . osId ,
398470 project_id : request . projectId ?? defaults . defaultProjectId ,
399471 public_bandwidth_bps : request . publicBandwidthBps ,
472+ runner_configuration :
473+ request . runnerConfiguration !== undefined
474+ ? marshalRunnerConfiguration ( request . runnerConfiguration , defaults )
475+ : undefined ,
400476 type : request . type ,
401477} )
402478
@@ -420,6 +496,10 @@ export const marshalReinstallServerRequest = (
420496 defaults : DefaultValues ,
421497) : Record < string , unknown > => ( {
422498 os_id : request . osId ,
499+ runner_configuration :
500+ request . runnerConfiguration !== undefined
501+ ? marshalRunnerConfiguration ( request . runnerConfiguration , defaults )
502+ : undefined ,
423503} )
424504
425505export const marshalStartConnectivityDiagnosticRequest = (
0 commit comments