File tree 3 files changed +21
-1
lines changed
arduino-ide-extension/src/browser
3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,14 @@ const properties: ArduinoPreferenceSchemaProperties = {
228
228
) ,
229
229
default : 'https://api2.arduino.cc/create' ,
230
230
} ,
231
+ 'arduino.cloud.sharedSpaceID' : {
232
+ type : 'string' ,
233
+ description : nls . localize (
234
+ 'arduino/preferences/cloud.sharedSpaceId' ,
235
+ "The Arduino Cloud shared space ID used to sync sketches from. If empty, user's private space is selected."
236
+ ) ,
237
+ default : '' ,
238
+ } ,
231
239
'arduino.auth.clientID' : {
232
240
type : 'string' ,
233
241
description : nls . localize (
@@ -329,6 +337,7 @@ export interface ArduinoConfiguration {
329
337
'arduino.cloud.push.warn' : boolean ;
330
338
'arduino.cloud.pushpublic.warn' : boolean ;
331
339
'arduino.cloud.sketchSyncEndpoint' : string ;
340
+ 'arduino.cloud.sharedSpaceID' : string ;
332
341
'arduino.auth.clientID' : string ;
333
342
'arduino.auth.domain' : string ;
334
343
'arduino.auth.audience' : string ;
Original file line number Diff line number Diff line change @@ -509,11 +509,19 @@ export class CreateApi {
509
509
510
510
private async headers ( ) : Promise < Record < string , string > > {
511
511
const token = await this . token ( ) ;
512
- return {
512
+ const headers : Record < string , string > = {
513
513
'content-type' : 'application/json' ,
514
514
accept : 'application/json' ,
515
515
authorization : `Bearer ${ token } ` ,
516
516
} ;
517
+
518
+ const sharedSpaceID =
519
+ this . arduinoPreferences [ 'arduino.cloud.sharedSpaceID' ] ;
520
+ if ( sharedSpaceID ) {
521
+ headers [ 'x-organization' ] = sharedSpaceID ;
522
+ }
523
+
524
+ return headers ;
517
525
}
518
526
519
527
private domain ( apiVersion = 'v2' ) : string {
Original file line number Diff line number Diff line change @@ -127,6 +127,9 @@ export class SketchbookTreeModel extends FileTreeModel {
127
127
if ( preferenceName === 'arduino.sketchbook.showAllFiles' ) {
128
128
this . updateRoot ( ) ;
129
129
}
130
+ if ( preferenceName === 'arduino.cloud.sharedSpaceID' ) {
131
+ this . updateRoot ( ) ;
132
+ }
130
133
} )
131
134
) ;
132
135
You can’t perform that action at this time.
0 commit comments