@@ -90,6 +90,10 @@ func main() {
9090 log .Println ("calling GetValue(foo)" )
9191 callGetValue (settingsClient )
9292
93+ // List all the settings.
94+ log .Println ("calling GetAll()" )
95+ callGetAll (settingsClient )
96+
9397 // Write settings to file.
9498 log .Println ("calling Write()" )
9599 callWrite (settingsClient )
@@ -100,11 +104,19 @@ func main() {
100104 log .Println ("calling Init" )
101105 instance := initInstance (client )
102106
107+ // We set up the proxy and then run the update to verify that the proxy settings are currently used
108+ log .Println ("calling setProxy" )
109+ callSetProxy (settingsClient )
110+
103111 // With a brand new instance, the first operation should always be updating
104112 // the index.
105113 log .Println ("calling UpdateIndex" )
106114 callUpdateIndex (client , instance )
107115
116+ // And we run update again
117+ log .Println ("calling UpdateIndex" )
118+ callUpdateIndex (client , instance )
119+
108120 // Let's search for a platform (also known as 'core') called 'samd'.
109121 log .Println ("calling PlatformSearch(samd)" )
110122 callPlatformSearch (client , instance )
@@ -220,6 +232,31 @@ func callSetValue(client settings.SettingsClient) {
220232 JsonData : `{"data": "` + dataDir + `", "downloads": "` + path .Join (dataDir , "staging" ) + `", "user": "` + path .Join (dataDir , "sketchbook" ) + `"}` ,
221233 })
222234
235+ if err != nil {
236+ log .Fatalf ("Error setting settings value: %s" , err )
237+
238+ }
239+ }
240+
241+ func callSetProxy (client settings.SettingsClient ) {
242+ _ , err := client .SetValue (context .Background (),
243+ & settings.Value {
244+ Key : "network.proxy" ,
245+ JsonData : `"http://localhost:3128"` ,
246+ })
247+
248+ if err != nil {
249+ log .Fatalf ("Error setting settings value: %s" , err )
250+ }
251+ }
252+
253+ func callUnsetProxy (client settings.SettingsClient ) {
254+ _ , err := client .SetValue (context .Background (),
255+ & settings.Value {
256+ Key : "network.proxy" ,
257+ JsonData : `""` ,
258+ })
259+
223260 if err != nil {
224261 log .Fatalf ("Error setting settings value: %s" , err )
225262 }
0 commit comments