/
auto.go
828 lines (663 loc) · 25.3 KB
/
auto.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
// Code generated by "./generator ./session/org.freedesktop.secrets"; DO NOT EDIT.
// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
package secrets
import "errors"
import "fmt"
import "github.com/godbus/dbus/v5"
import "github.com/linuxdeepin/go-lib/dbusutil"
import "github.com/linuxdeepin/go-lib/dbusutil/proxy"
import "unsafe"
type Service interface {
service // interface org.freedesktop.Secret.Service
proxy.Object
}
type objectService struct {
interfaceService // interface org.freedesktop.Secret.Service
proxy.ImplObject
}
func NewService(conn *dbus.Conn) Service {
obj := new(objectService)
obj.ImplObject.Init_(conn, "org.freedesktop.secrets", "/org/freedesktop/secrets")
return obj
}
type service interface {
GoOpenSession(flags dbus.Flags, ch chan *dbus.Call, algorithm string, input dbus.Variant) *dbus.Call
OpenSession(flags dbus.Flags, algorithm string, input dbus.Variant) (dbus.Variant, dbus.ObjectPath, error)
GoCreateCollection(flags dbus.Flags, ch chan *dbus.Call, properties map[string]dbus.Variant, alias string) *dbus.Call
CreateCollection(flags dbus.Flags, properties map[string]dbus.Variant, alias string) (dbus.ObjectPath, dbus.ObjectPath, error)
GoSearchItems(flags dbus.Flags, ch chan *dbus.Call, attributes map[string]string) *dbus.Call
SearchItems(flags dbus.Flags, attributes map[string]string) ([]dbus.ObjectPath, []dbus.ObjectPath, error)
GoUnlock(flags dbus.Flags, ch chan *dbus.Call, objects []dbus.ObjectPath) *dbus.Call
Unlock(flags dbus.Flags, objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, error)
GoLock(flags dbus.Flags, ch chan *dbus.Call, objects []dbus.ObjectPath) *dbus.Call
Lock(flags dbus.Flags, objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, error)
GoLockService(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
LockService(flags dbus.Flags) error
GoChangeLock(flags dbus.Flags, ch chan *dbus.Call, collection dbus.ObjectPath) *dbus.Call
ChangeLock(flags dbus.Flags, collection dbus.ObjectPath) (dbus.ObjectPath, error)
GoGetSecrets(flags dbus.Flags, ch chan *dbus.Call, items []dbus.ObjectPath, session dbus.ObjectPath) *dbus.Call
GetSecrets(flags dbus.Flags, items []dbus.ObjectPath, session dbus.ObjectPath) (map[dbus.ObjectPath]Secret, error)
GoReadAlias(flags dbus.Flags, ch chan *dbus.Call, name string) *dbus.Call
ReadAlias(flags dbus.Flags, name string) (dbus.ObjectPath, error)
GoSetAlias(flags dbus.Flags, ch chan *dbus.Call, name string, collection dbus.ObjectPath) *dbus.Call
SetAlias(flags dbus.Flags, name string, collection dbus.ObjectPath) error
ConnectCollectionCreated(cb func(collection dbus.ObjectPath)) (dbusutil.SignalHandlerId, error)
ConnectCollectionDeleted(cb func(collection dbus.ObjectPath)) (dbusutil.SignalHandlerId, error)
ConnectCollectionChanged(cb func(collection dbus.ObjectPath)) (dbusutil.SignalHandlerId, error)
Collections() proxy.PropObjectPathArray
}
type interfaceService struct{}
func (v *interfaceService) GetObject_() *proxy.ImplObject {
return (*proxy.ImplObject)(unsafe.Pointer(v))
}
func (*interfaceService) GetInterfaceName_() string {
return "org.freedesktop.Secret.Service"
}
// method OpenSession
func (v *interfaceService) GoOpenSession(flags dbus.Flags, ch chan *dbus.Call, algorithm string, input dbus.Variant) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".OpenSession", flags, ch, algorithm, input)
}
func (*interfaceService) StoreOpenSession(call *dbus.Call) (output dbus.Variant, result dbus.ObjectPath, err error) {
err = call.Store(&output, &result)
return
}
func (v *interfaceService) OpenSession(flags dbus.Flags, algorithm string, input dbus.Variant) (dbus.Variant, dbus.ObjectPath, error) {
return v.StoreOpenSession(
<-v.GoOpenSession(flags, make(chan *dbus.Call, 1), algorithm, input).Done)
}
// method CreateCollection
func (v *interfaceService) GoCreateCollection(flags dbus.Flags, ch chan *dbus.Call, properties map[string]dbus.Variant, alias string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".CreateCollection", flags, ch, properties, alias)
}
func (*interfaceService) StoreCreateCollection(call *dbus.Call) (collection dbus.ObjectPath, prompt dbus.ObjectPath, err error) {
err = call.Store(&collection, &prompt)
return
}
func (v *interfaceService) CreateCollection(flags dbus.Flags, properties map[string]dbus.Variant, alias string) (dbus.ObjectPath, dbus.ObjectPath, error) {
return v.StoreCreateCollection(
<-v.GoCreateCollection(flags, make(chan *dbus.Call, 1), properties, alias).Done)
}
// method SearchItems
func (v *interfaceService) GoSearchItems(flags dbus.Flags, ch chan *dbus.Call, attributes map[string]string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".SearchItems", flags, ch, attributes)
}
func (*interfaceService) StoreSearchItems(call *dbus.Call) (unlocked []dbus.ObjectPath, locked []dbus.ObjectPath, err error) {
err = call.Store(&unlocked, &locked)
return
}
func (v *interfaceService) SearchItems(flags dbus.Flags, attributes map[string]string) ([]dbus.ObjectPath, []dbus.ObjectPath, error) {
return v.StoreSearchItems(
<-v.GoSearchItems(flags, make(chan *dbus.Call, 1), attributes).Done)
}
// method Unlock
func (v *interfaceService) GoUnlock(flags dbus.Flags, ch chan *dbus.Call, objects []dbus.ObjectPath) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Unlock", flags, ch, objects)
}
func (*interfaceService) StoreUnlock(call *dbus.Call) (unlocked []dbus.ObjectPath, prompt dbus.ObjectPath, err error) {
err = call.Store(&unlocked, &prompt)
return
}
func (v *interfaceService) Unlock(flags dbus.Flags, objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, error) {
return v.StoreUnlock(
<-v.GoUnlock(flags, make(chan *dbus.Call, 1), objects).Done)
}
// method Lock
func (v *interfaceService) GoLock(flags dbus.Flags, ch chan *dbus.Call, objects []dbus.ObjectPath) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Lock", flags, ch, objects)
}
func (*interfaceService) StoreLock(call *dbus.Call) (locked []dbus.ObjectPath, Prompt dbus.ObjectPath, err error) {
err = call.Store(&locked, &Prompt)
return
}
func (v *interfaceService) Lock(flags dbus.Flags, objects []dbus.ObjectPath) ([]dbus.ObjectPath, dbus.ObjectPath, error) {
return v.StoreLock(
<-v.GoLock(flags, make(chan *dbus.Call, 1), objects).Done)
}
// method LockService
func (v *interfaceService) GoLockService(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".LockService", flags, ch)
}
func (v *interfaceService) LockService(flags dbus.Flags) error {
return (<-v.GoLockService(flags, make(chan *dbus.Call, 1)).Done).Err
}
// method ChangeLock
func (v *interfaceService) GoChangeLock(flags dbus.Flags, ch chan *dbus.Call, collection dbus.ObjectPath) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".ChangeLock", flags, ch, collection)
}
func (*interfaceService) StoreChangeLock(call *dbus.Call) (prompt dbus.ObjectPath, err error) {
err = call.Store(&prompt)
return
}
func (v *interfaceService) ChangeLock(flags dbus.Flags, collection dbus.ObjectPath) (dbus.ObjectPath, error) {
return v.StoreChangeLock(
<-v.GoChangeLock(flags, make(chan *dbus.Call, 1), collection).Done)
}
// method GetSecrets
func (v *interfaceService) GoGetSecrets(flags dbus.Flags, ch chan *dbus.Call, items []dbus.ObjectPath, session dbus.ObjectPath) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".GetSecrets", flags, ch, items, session)
}
func (*interfaceService) StoreGetSecrets(call *dbus.Call) (secrets map[dbus.ObjectPath]Secret, err error) {
err = call.Store(&secrets)
return
}
func (v *interfaceService) GetSecrets(flags dbus.Flags, items []dbus.ObjectPath, session dbus.ObjectPath) (map[dbus.ObjectPath]Secret, error) {
return v.StoreGetSecrets(
<-v.GoGetSecrets(flags, make(chan *dbus.Call, 1), items, session).Done)
}
// method ReadAlias
func (v *interfaceService) GoReadAlias(flags dbus.Flags, ch chan *dbus.Call, name string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".ReadAlias", flags, ch, name)
}
func (*interfaceService) StoreReadAlias(call *dbus.Call) (collection dbus.ObjectPath, err error) {
err = call.Store(&collection)
return
}
func (v *interfaceService) ReadAlias(flags dbus.Flags, name string) (dbus.ObjectPath, error) {
return v.StoreReadAlias(
<-v.GoReadAlias(flags, make(chan *dbus.Call, 1), name).Done)
}
// method SetAlias
func (v *interfaceService) GoSetAlias(flags dbus.Flags, ch chan *dbus.Call, name string, collection dbus.ObjectPath) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".SetAlias", flags, ch, name, collection)
}
func (v *interfaceService) SetAlias(flags dbus.Flags, name string, collection dbus.ObjectPath) error {
return (<-v.GoSetAlias(flags, make(chan *dbus.Call, 1), name, collection).Done).Err
}
// signal CollectionCreated
func (v *interfaceService) ConnectCollectionCreated(cb func(collection dbus.ObjectPath)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "CollectionCreated", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".CollectionCreated",
}
handlerFunc := func(sig *dbus.Signal) {
var collection dbus.ObjectPath
err := dbus.Store(sig.Body, &collection)
if err == nil {
cb(collection)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}
// signal CollectionDeleted
func (v *interfaceService) ConnectCollectionDeleted(cb func(collection dbus.ObjectPath)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "CollectionDeleted", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".CollectionDeleted",
}
handlerFunc := func(sig *dbus.Signal) {
var collection dbus.ObjectPath
err := dbus.Store(sig.Body, &collection)
if err == nil {
cb(collection)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}
// signal CollectionChanged
func (v *interfaceService) ConnectCollectionChanged(cb func(collection dbus.ObjectPath)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "CollectionChanged", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".CollectionChanged",
}
handlerFunc := func(sig *dbus.Signal) {
var collection dbus.ObjectPath
err := dbus.Store(sig.Body, &collection)
if err == nil {
cb(collection)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}
// property Collections ao
func (v *interfaceService) Collections() proxy.PropObjectPathArray {
return &proxy.ImplPropObjectPathArray{
Impl: v,
Name: "Collections",
}
}
type Collection interface {
collection // interface org.freedesktop.Secret.Collection
proxy.Object
}
type objectCollection struct {
interfaceCollection // interface org.freedesktop.Secret.Collection
proxy.ImplObject
}
func NewCollection(conn *dbus.Conn, path dbus.ObjectPath) (Collection, error) {
if !path.IsValid() {
return nil, errors.New("path is invalid")
}
obj := new(objectCollection)
obj.ImplObject.Init_(conn, "org.freedesktop.secrets", path)
return obj, nil
}
type collection interface {
GoDelete(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
Delete(flags dbus.Flags) (dbus.ObjectPath, error)
GoSearchItems(flags dbus.Flags, ch chan *dbus.Call, attributes map[string]string) *dbus.Call
SearchItems(flags dbus.Flags, attributes map[string]string) ([]dbus.ObjectPath, error)
GoCreateItem(flags dbus.Flags, ch chan *dbus.Call, properties map[string]dbus.Variant, secret Secret, replace bool) *dbus.Call
CreateItem(flags dbus.Flags, properties map[string]dbus.Variant, secret Secret, replace bool) (dbus.ObjectPath, dbus.ObjectPath, error)
ConnectItemCreated(cb func(item dbus.ObjectPath)) (dbusutil.SignalHandlerId, error)
ConnectItemDeleted(cb func(item dbus.ObjectPath)) (dbusutil.SignalHandlerId, error)
ConnectItemChanged(cb func(item dbus.ObjectPath)) (dbusutil.SignalHandlerId, error)
Items() proxy.PropObjectPathArray
Label() proxy.PropString
Locked() proxy.PropBool
Created() proxy.PropUint64
Modified() proxy.PropUint64
}
type interfaceCollection struct{}
func (v *interfaceCollection) GetObject_() *proxy.ImplObject {
return (*proxy.ImplObject)(unsafe.Pointer(v))
}
func (*interfaceCollection) GetInterfaceName_() string {
return "org.freedesktop.Secret.Collection"
}
// method Delete
func (v *interfaceCollection) GoDelete(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Delete", flags, ch)
}
func (*interfaceCollection) StoreDelete(call *dbus.Call) (prompt dbus.ObjectPath, err error) {
err = call.Store(&prompt)
return
}
func (v *interfaceCollection) Delete(flags dbus.Flags) (dbus.ObjectPath, error) {
return v.StoreDelete(
<-v.GoDelete(flags, make(chan *dbus.Call, 1)).Done)
}
// method SearchItems
func (v *interfaceCollection) GoSearchItems(flags dbus.Flags, ch chan *dbus.Call, attributes map[string]string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".SearchItems", flags, ch, attributes)
}
func (*interfaceCollection) StoreSearchItems(call *dbus.Call) (results []dbus.ObjectPath, err error) {
err = call.Store(&results)
return
}
func (v *interfaceCollection) SearchItems(flags dbus.Flags, attributes map[string]string) ([]dbus.ObjectPath, error) {
return v.StoreSearchItems(
<-v.GoSearchItems(flags, make(chan *dbus.Call, 1), attributes).Done)
}
// method CreateItem
func (v *interfaceCollection) GoCreateItem(flags dbus.Flags, ch chan *dbus.Call, properties map[string]dbus.Variant, secret Secret, replace bool) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".CreateItem", flags, ch, properties, secret, replace)
}
func (*interfaceCollection) StoreCreateItem(call *dbus.Call) (item dbus.ObjectPath, prompt dbus.ObjectPath, err error) {
err = call.Store(&item, &prompt)
return
}
func (v *interfaceCollection) CreateItem(flags dbus.Flags, properties map[string]dbus.Variant, secret Secret, replace bool) (dbus.ObjectPath, dbus.ObjectPath, error) {
return v.StoreCreateItem(
<-v.GoCreateItem(flags, make(chan *dbus.Call, 1), properties, secret, replace).Done)
}
// signal ItemCreated
func (v *interfaceCollection) ConnectItemCreated(cb func(item dbus.ObjectPath)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "ItemCreated", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".ItemCreated",
}
handlerFunc := func(sig *dbus.Signal) {
var item dbus.ObjectPath
err := dbus.Store(sig.Body, &item)
if err == nil {
cb(item)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}
// signal ItemDeleted
func (v *interfaceCollection) ConnectItemDeleted(cb func(item dbus.ObjectPath)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "ItemDeleted", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".ItemDeleted",
}
handlerFunc := func(sig *dbus.Signal) {
var item dbus.ObjectPath
err := dbus.Store(sig.Body, &item)
if err == nil {
cb(item)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}
// signal ItemChanged
func (v *interfaceCollection) ConnectItemChanged(cb func(item dbus.ObjectPath)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "ItemChanged", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".ItemChanged",
}
handlerFunc := func(sig *dbus.Signal) {
var item dbus.ObjectPath
err := dbus.Store(sig.Body, &item)
if err == nil {
cb(item)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}
// property Items ao
func (v *interfaceCollection) Items() proxy.PropObjectPathArray {
return &proxy.ImplPropObjectPathArray{
Impl: v,
Name: "Items",
}
}
// property Label s
func (v *interfaceCollection) Label() proxy.PropString {
return &proxy.ImplPropString{
Impl: v,
Name: "Label",
}
}
// property Locked b
func (v *interfaceCollection) Locked() proxy.PropBool {
return &proxy.ImplPropBool{
Impl: v,
Name: "Locked",
}
}
// property Created t
func (v *interfaceCollection) Created() proxy.PropUint64 {
return &proxy.ImplPropUint64{
Impl: v,
Name: "Created",
}
}
// property Modified t
func (v *interfaceCollection) Modified() proxy.PropUint64 {
return &proxy.ImplPropUint64{
Impl: v,
Name: "Modified",
}
}
type Item interface {
item // interface org.freedesktop.Secret.Item
proxy.Object
}
type objectItem struct {
interfaceItem // interface org.freedesktop.Secret.Item
proxy.ImplObject
}
func NewItem(conn *dbus.Conn, path dbus.ObjectPath) (Item, error) {
if !path.IsValid() {
return nil, errors.New("path is invalid")
}
obj := new(objectItem)
obj.ImplObject.Init_(conn, "org.freedesktop.secrets", path)
return obj, nil
}
type item interface {
GoDelete(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
Delete(flags dbus.Flags) (dbus.ObjectPath, error)
GoGetSecret(flags dbus.Flags, ch chan *dbus.Call, session dbus.ObjectPath) *dbus.Call
GetSecret(flags dbus.Flags, session dbus.ObjectPath) (Secret, error)
GoSetSecret(flags dbus.Flags, ch chan *dbus.Call, secret Secret) *dbus.Call
SetSecret(flags dbus.Flags, secret Secret) error
Locked() proxy.PropBool
Attributes() PropItemAttributes
Label() proxy.PropString
Type() proxy.PropString
Created() proxy.PropUint64
Modified() proxy.PropUint64
}
type interfaceItem struct{}
func (v *interfaceItem) GetObject_() *proxy.ImplObject {
return (*proxy.ImplObject)(unsafe.Pointer(v))
}
func (*interfaceItem) GetInterfaceName_() string {
return "org.freedesktop.Secret.Item"
}
// method Delete
func (v *interfaceItem) GoDelete(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Delete", flags, ch)
}
func (*interfaceItem) StoreDelete(call *dbus.Call) (Prompt dbus.ObjectPath, err error) {
err = call.Store(&Prompt)
return
}
func (v *interfaceItem) Delete(flags dbus.Flags) (dbus.ObjectPath, error) {
return v.StoreDelete(
<-v.GoDelete(flags, make(chan *dbus.Call, 1)).Done)
}
// method GetSecret
func (v *interfaceItem) GoGetSecret(flags dbus.Flags, ch chan *dbus.Call, session dbus.ObjectPath) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".GetSecret", flags, ch, session)
}
func (*interfaceItem) StoreGetSecret(call *dbus.Call) (secret Secret, err error) {
err = call.Store(&secret)
return
}
func (v *interfaceItem) GetSecret(flags dbus.Flags, session dbus.ObjectPath) (Secret, error) {
return v.StoreGetSecret(
<-v.GoGetSecret(flags, make(chan *dbus.Call, 1), session).Done)
}
// method SetSecret
func (v *interfaceItem) GoSetSecret(flags dbus.Flags, ch chan *dbus.Call, secret Secret) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".SetSecret", flags, ch, secret)
}
func (v *interfaceItem) SetSecret(flags dbus.Flags, secret Secret) error {
return (<-v.GoSetSecret(flags, make(chan *dbus.Call, 1), secret).Done).Err
}
// property Locked b
func (v *interfaceItem) Locked() proxy.PropBool {
return &proxy.ImplPropBool{
Impl: v,
Name: "Locked",
}
}
type PropItemAttributes interface {
Get(flags dbus.Flags) (value map[string]string, err error)
Set(flags dbus.Flags, value map[string]string) error
ConnectChanged(cb func(hasValue bool, value map[string]string)) error
}
type implPropItemAttributes struct {
Impl proxy.Implementer
Name string
}
func (p implPropItemAttributes) Get(flags dbus.Flags) (value map[string]string, err error) {
err = p.Impl.GetObject_().GetProperty_(flags, p.Impl.GetInterfaceName_(),
p.Name, &value)
return
}
func (p implPropItemAttributes) Set(flags dbus.Flags, value map[string]string) error {
return p.Impl.GetObject_().SetProperty_(flags, p.Impl.GetInterfaceName_(), p.Name, value)
}
func (p implPropItemAttributes) ConnectChanged(cb func(hasValue bool, value map[string]string)) error {
if cb == nil {
return errors.New("nil callback")
}
cb0 := func(hasValue bool, value interface{}) {
if hasValue {
var v map[string]string
err := dbus.Store([]interface{}{value}, &v)
if err != nil {
return
}
cb(true, v)
} else {
cb(false, nil)
}
}
return p.Impl.GetObject_().ConnectPropertyChanged_(p.Impl.GetInterfaceName_(),
p.Name, cb0)
}
// property Attributes a{ss}
func (v *interfaceItem) Attributes() PropItemAttributes {
return &implPropItemAttributes{
Impl: v,
Name: "Attributes",
}
}
// property Label s
func (v *interfaceItem) Label() proxy.PropString {
return &proxy.ImplPropString{
Impl: v,
Name: "Label",
}
}
// property Type s
func (v *interfaceItem) Type() proxy.PropString {
return &proxy.ImplPropString{
Impl: v,
Name: "Type",
}
}
// property Created t
func (v *interfaceItem) Created() proxy.PropUint64 {
return &proxy.ImplPropUint64{
Impl: v,
Name: "Created",
}
}
// property Modified t
func (v *interfaceItem) Modified() proxy.PropUint64 {
return &proxy.ImplPropUint64{
Impl: v,
Name: "Modified",
}
}
type Session interface {
session // interface org.freedesktop.Secret.Session
proxy.Object
}
type objectSession struct {
interfaceSession // interface org.freedesktop.Secret.Session
proxy.ImplObject
}
func NewSession(conn *dbus.Conn, path dbus.ObjectPath) (Session, error) {
if !path.IsValid() {
return nil, errors.New("path is invalid")
}
obj := new(objectSession)
obj.ImplObject.Init_(conn, "org.freedesktop.secrets", path)
return obj, nil
}
type session interface {
GoClose(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
Close(flags dbus.Flags) error
}
type interfaceSession struct{}
func (v *interfaceSession) GetObject_() *proxy.ImplObject {
return (*proxy.ImplObject)(unsafe.Pointer(v))
}
func (*interfaceSession) GetInterfaceName_() string {
return "org.freedesktop.Secret.Session"
}
// method Close
func (v *interfaceSession) GoClose(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Close", flags, ch)
}
func (v *interfaceSession) Close(flags dbus.Flags) error {
return (<-v.GoClose(flags, make(chan *dbus.Call, 1)).Done).Err
}
type Prompt interface {
prompt // interface org.freedesktop.Secret.Prompt
proxy.Object
}
type objectPrompt struct {
interfacePrompt // interface org.freedesktop.Secret.Prompt
proxy.ImplObject
}
func NewPrompt(conn *dbus.Conn, path dbus.ObjectPath) (Prompt, error) {
if !path.IsValid() {
return nil, errors.New("path is invalid")
}
obj := new(objectPrompt)
obj.ImplObject.Init_(conn, "org.freedesktop.secrets", path)
return obj, nil
}
type prompt interface {
GoPrompt(flags dbus.Flags, ch chan *dbus.Call, window_id string) *dbus.Call
Prompt(flags dbus.Flags, window_id string) error
GoDismiss(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
Dismiss(flags dbus.Flags) error
ConnectCompleted(cb func(dismissed bool, result dbus.Variant)) (dbusutil.SignalHandlerId, error)
}
type interfacePrompt struct{}
func (v *interfacePrompt) GetObject_() *proxy.ImplObject {
return (*proxy.ImplObject)(unsafe.Pointer(v))
}
func (*interfacePrompt) GetInterfaceName_() string {
return "org.freedesktop.Secret.Prompt"
}
// method Prompt
func (v *interfacePrompt) GoPrompt(flags dbus.Flags, ch chan *dbus.Call, window_id string) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Prompt", flags, ch, window_id)
}
func (v *interfacePrompt) Prompt(flags dbus.Flags, window_id string) error {
return (<-v.GoPrompt(flags, make(chan *dbus.Call, 1), window_id).Done).Err
}
// method Dismiss
func (v *interfacePrompt) GoDismiss(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
return v.GetObject_().Go_(v.GetInterfaceName_()+".Dismiss", flags, ch)
}
func (v *interfacePrompt) Dismiss(flags dbus.Flags) error {
return (<-v.GoDismiss(flags, make(chan *dbus.Call, 1)).Done).Err
}
// signal Completed
func (v *interfacePrompt) ConnectCompleted(cb func(dismissed bool, result dbus.Variant)) (dbusutil.SignalHandlerId, error) {
if cb == nil {
return 0, errors.New("nil callback")
}
obj := v.GetObject_()
rule := fmt.Sprintf(
"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
v.GetInterfaceName_(), "Completed", obj.Path_(), obj.ServiceName_())
sigRule := &dbusutil.SignalRule{
Path: obj.Path_(),
Name: v.GetInterfaceName_() + ".Completed",
}
handlerFunc := func(sig *dbus.Signal) {
var dismissed bool
var result dbus.Variant
err := dbus.Store(sig.Body, &dismissed, &result)
if err == nil {
cb(dismissed, result)
}
}
return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}