forked from distribution/distribution
/
mirror-gen.go
4282 lines (3881 loc) · 134 KB
/
mirror-gen.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
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Package mirror provides access to the Google Mirror API.
//
// See https://developers.google.com/glass
//
// Usage example:
//
// import "google.golang.org/api/mirror/v1"
// ...
// mirrorService, err := mirror.New(oauthHttpClient)
package mirror // import "google.golang.org/api/mirror/v1"
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"golang.org/x/net/context"
"golang.org/x/net/context/ctxhttp"
"google.golang.org/api/googleapi"
"google.golang.org/api/internal"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = internal.MarshalJSON
var _ = context.Canceled
var _ = ctxhttp.Do
const apiId = "mirror:v1"
const apiName = "mirror"
const apiVersion = "v1"
const basePath = "https://www.googleapis.com/mirror/v1/"
// OAuth2 scopes used by this API.
const (
// View your location
GlassLocationScope = "https://www.googleapis.com/auth/glass.location"
// View and manage your Glass timeline
GlassTimelineScope = "https://www.googleapis.com/auth/glass.timeline"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Accounts = NewAccountsService(s)
s.Contacts = NewContactsService(s)
s.Locations = NewLocationsService(s)
s.Settings = NewSettingsService(s)
s.Subscriptions = NewSubscriptionsService(s)
s.Timeline = NewTimelineService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
Accounts *AccountsService
Contacts *ContactsService
Locations *LocationsService
Settings *SettingsService
Subscriptions *SubscriptionsService
Timeline *TimelineService
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
func NewAccountsService(s *Service) *AccountsService {
rs := &AccountsService{s: s}
return rs
}
type AccountsService struct {
s *Service
}
func NewContactsService(s *Service) *ContactsService {
rs := &ContactsService{s: s}
return rs
}
type ContactsService struct {
s *Service
}
func NewLocationsService(s *Service) *LocationsService {
rs := &LocationsService{s: s}
return rs
}
type LocationsService struct {
s *Service
}
func NewSettingsService(s *Service) *SettingsService {
rs := &SettingsService{s: s}
return rs
}
type SettingsService struct {
s *Service
}
func NewSubscriptionsService(s *Service) *SubscriptionsService {
rs := &SubscriptionsService{s: s}
return rs
}
type SubscriptionsService struct {
s *Service
}
func NewTimelineService(s *Service) *TimelineService {
rs := &TimelineService{s: s}
rs.Attachments = NewTimelineAttachmentsService(s)
return rs
}
type TimelineService struct {
s *Service
Attachments *TimelineAttachmentsService
}
func NewTimelineAttachmentsService(s *Service) *TimelineAttachmentsService {
rs := &TimelineAttachmentsService{s: s}
return rs
}
type TimelineAttachmentsService struct {
s *Service
}
// Account: Represents an account passed into the Account Manager on
// Glass.
type Account struct {
AuthTokens []*AuthToken `json:"authTokens,omitempty"`
Features []string `json:"features,omitempty"`
Password string `json:"password,omitempty"`
UserData []*UserData `json:"userData,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "AuthTokens") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Account) MarshalJSON() ([]byte, error) {
type noMethod Account
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// Attachment: Represents media content, such as a photo, that can be
// attached to a timeline item.
type Attachment struct {
// ContentType: The MIME type of the attachment.
ContentType string `json:"contentType,omitempty"`
// ContentUrl: The URL for the content.
ContentUrl string `json:"contentUrl,omitempty"`
// Id: The ID of the attachment.
Id string `json:"id,omitempty"`
// IsProcessingContent: Indicates that the contentUrl is not available
// because the attachment content is still being processed. If the
// caller wishes to retrieve the content, it should try again later.
IsProcessingContent bool `json:"isProcessingContent,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "ContentType") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Attachment) MarshalJSON() ([]byte, error) {
type noMethod Attachment
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// AttachmentsListResponse: A list of Attachments. This is the response
// from the server to GET requests on the attachments collection.
type AttachmentsListResponse struct {
// Items: The list of attachments.
Items []*Attachment `json:"items,omitempty"`
// Kind: The type of resource. This is always mirror#attachmentsList.
Kind string `json:"kind,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Items") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *AttachmentsListResponse) MarshalJSON() ([]byte, error) {
type noMethod AttachmentsListResponse
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
type AuthToken struct {
AuthToken string `json:"authToken,omitempty"`
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "AuthToken") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *AuthToken) MarshalJSON() ([]byte, error) {
type noMethod AuthToken
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// Command: A single menu command that is part of a Contact.
type Command struct {
// Type: The type of operation this command corresponds to. Allowed
// values are:
// - TAKE_A_NOTE - Shares a timeline item with the transcription of user
// speech from the "Take a note" voice menu command.
// - POST_AN_UPDATE - Shares a timeline item with the transcription of
// user speech from the "Post an update" voice menu command.
Type string `json:"type,omitempty"`
// ForceSendFields is a list of field names (e.g. "Type") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Command) MarshalJSON() ([]byte, error) {
type noMethod Command
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// Contact: A person or group that can be used as a creator or a
// contact.
type Contact struct {
// AcceptCommands: A list of voice menu commands that a contact can
// handle. Glass shows up to three contacts for each voice menu command.
// If there are more than that, the three contacts with the highest
// priority are shown for that particular command.
AcceptCommands []*Command `json:"acceptCommands,omitempty"`
// AcceptTypes: A list of MIME types that a contact supports. The
// contact will be shown to the user if any of its acceptTypes matches
// any of the types of the attachments on the item. If no acceptTypes
// are given, the contact will be shown for all items.
AcceptTypes []string `json:"acceptTypes,omitempty"`
// DisplayName: The name to display for this contact.
DisplayName string `json:"displayName,omitempty"`
// Id: An ID for this contact. This is generated by the application and
// is treated as an opaque token.
Id string `json:"id,omitempty"`
// ImageUrls: Set of image URLs to display for a contact. Most contacts
// will have a single image, but a "group" contact may include up to 8
// image URLs and they will be resized and cropped into a mosaic on the
// client.
ImageUrls []string `json:"imageUrls,omitempty"`
// Kind: The type of resource. This is always mirror#contact.
Kind string `json:"kind,omitempty"`
// PhoneNumber: Primary phone number for the contact. This can be a
// fully-qualified number, with country calling code and area code, or a
// local number.
PhoneNumber string `json:"phoneNumber,omitempty"`
// Priority: Priority for the contact to determine ordering in a list of
// contacts. Contacts with higher priorities will be shown before ones
// with lower priorities.
Priority int64 `json:"priority,omitempty"`
// SharingFeatures: A list of sharing features that a contact can
// handle. Allowed values are:
// - ADD_CAPTION
SharingFeatures []string `json:"sharingFeatures,omitempty"`
// Source: The ID of the application that created this contact. This is
// populated by the API
Source string `json:"source,omitempty"`
// SpeakableName: Name of this contact as it should be pronounced. If
// this contact's name must be spoken as part of a voice disambiguation
// menu, this name is used as the expected pronunciation. This is useful
// for contact names with unpronounceable characters or whose display
// spelling is otherwise not phonetic.
SpeakableName string `json:"speakableName,omitempty"`
// Type: The type for this contact. This is used for sorting in UIs.
// Allowed values are:
// - INDIVIDUAL - Represents a single person. This is the default.
// - GROUP - Represents more than a single person.
Type string `json:"type,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "AcceptCommands") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Contact) MarshalJSON() ([]byte, error) {
type noMethod Contact
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// ContactsListResponse: A list of Contacts representing contacts. This
// is the response from the server to GET requests on the contacts
// collection.
type ContactsListResponse struct {
// Items: Contact list.
Items []*Contact `json:"items,omitempty"`
// Kind: The type of resource. This is always mirror#contacts.
Kind string `json:"kind,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Items") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *ContactsListResponse) MarshalJSON() ([]byte, error) {
type noMethod ContactsListResponse
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// Location: A geographic location that can be associated with a
// timeline item.
type Location struct {
// Accuracy: The accuracy of the location fix in meters.
Accuracy float64 `json:"accuracy,omitempty"`
// Address: The full address of the location.
Address string `json:"address,omitempty"`
// DisplayName: The name to be displayed. This may be a business name or
// a user-defined place, such as "Home".
DisplayName string `json:"displayName,omitempty"`
// Id: The ID of the location.
Id string `json:"id,omitempty"`
// Kind: The type of resource. This is always mirror#location.
Kind string `json:"kind,omitempty"`
// Latitude: The latitude, in degrees.
Latitude float64 `json:"latitude,omitempty"`
// Longitude: The longitude, in degrees.
Longitude float64 `json:"longitude,omitempty"`
// Timestamp: The time at which this location was captured, formatted
// according to RFC 3339.
Timestamp string `json:"timestamp,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Accuracy") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Location) MarshalJSON() ([]byte, error) {
type noMethod Location
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// LocationsListResponse: A list of Locations. This is the response from
// the server to GET requests on the locations collection.
type LocationsListResponse struct {
// Items: The list of locations.
Items []*Location `json:"items,omitempty"`
// Kind: The type of resource. This is always mirror#locationsList.
Kind string `json:"kind,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Items") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *LocationsListResponse) MarshalJSON() ([]byte, error) {
type noMethod LocationsListResponse
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// MenuItem: A custom menu item that can be presented to the user by a
// timeline item.
type MenuItem struct {
// Action: Controls the behavior when the user picks the menu option.
// Allowed values are:
// - CUSTOM - Custom action set by the service. When the user selects
// this menuItem, the API triggers a notification to your callbackUrl
// with the userActions.type set to CUSTOM and the userActions.payload
// set to the ID of this menu item. This is the default value.
// - Built-in actions:
// - REPLY - Initiate a reply to the timeline item using the voice
// recording UI. The creator attribute must be set in the timeline item
// for this menu to be available.
// - REPLY_ALL - Same behavior as REPLY. The original timeline item's
// recipients will be added to the reply item.
// - DELETE - Delete the timeline item.
// - SHARE - Share the timeline item with the available contacts.
// - READ_ALOUD - Read the timeline item's speakableText aloud; if this
// field is not set, read the text field; if none of those fields are
// set, this menu item is ignored.
// - GET_MEDIA_INPUT - Allow users to provide media payloads to
// Glassware from a menu item (currently, only transcribed text from
// voice input is supported). Subscribe to notifications when users
// invoke this menu item to receive the timeline item ID. Retrieve the
// media from the timeline item in the payload property.
// - VOICE_CALL - Initiate a phone call using the timeline item's
// creator.phoneNumber attribute as recipient.
// - NAVIGATE - Navigate to the timeline item's location.
// - TOGGLE_PINNED - Toggle the isPinned state of the timeline item.
// - OPEN_URI - Open the payload of the menu item in the browser.
// - PLAY_VIDEO - Open the payload of the menu item in the Glass video
// player.
// - SEND_MESSAGE - Initiate sending a message to the timeline item's
// creator:
// - If the creator.phoneNumber is set and Glass is connected to an
// Android phone, the message is an SMS.
// - Otherwise, if the creator.email is set, the message is an email.
Action string `json:"action,omitempty"`
// ContextualCommand: The ContextualMenus.Command associated with this
// MenuItem (e.g. READ_ALOUD). The voice label for this command will be
// displayed in the voice menu and the touch label will be displayed in
// the touch menu. Note that the default menu value's display name will
// be overriden if you specify this property. Values that do not
// correspond to a ContextualMenus.Command name will be ignored.
ContextualCommand string `json:"contextual_command,omitempty"`
// Id: The ID for this menu item. This is generated by the application
// and is treated as an opaque token.
Id string `json:"id,omitempty"`
// Payload: A generic payload whose meaning changes depending on this
// MenuItem's action.
// - When the action is OPEN_URI, the payload is the URL of the website
// to view.
// - When the action is PLAY_VIDEO, the payload is the streaming URL of
// the video
// - When the action is GET_MEDIA_INPUT, the payload is the text
// transcription of a user's speech input
Payload string `json:"payload,omitempty"`
// RemoveWhenSelected: If set to true on a CUSTOM menu item, that item
// will be removed from the menu after it is selected.
RemoveWhenSelected bool `json:"removeWhenSelected,omitempty"`
// Values: For CUSTOM items, a list of values controlling the appearance
// of the menu item in each of its states. A value for the DEFAULT state
// must be provided. If the PENDING or CONFIRMED states are missing,
// they will not be shown.
Values []*MenuValue `json:"values,omitempty"`
// ForceSendFields is a list of field names (e.g. "Action") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *MenuItem) MarshalJSON() ([]byte, error) {
type noMethod MenuItem
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// MenuValue: A single value that is part of a MenuItem.
type MenuValue struct {
// DisplayName: The name to display for the menu item. If you specify
// this property for a built-in menu item, the default contextual voice
// command for that menu item is not shown.
DisplayName string `json:"displayName,omitempty"`
// IconUrl: URL of an icon to display with the menu item.
IconUrl string `json:"iconUrl,omitempty"`
// State: The state that this value applies to. Allowed values are:
// - DEFAULT - Default value shown when displayed in the menuItems list.
//
// - PENDING - Value shown when the menuItem has been selected by the
// user but can still be cancelled.
// - CONFIRMED - Value shown when the menuItem has been selected by the
// user and can no longer be cancelled.
State string `json:"state,omitempty"`
// ForceSendFields is a list of field names (e.g. "DisplayName") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *MenuValue) MarshalJSON() ([]byte, error) {
type noMethod MenuValue
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// Notification: A notification delivered by the API.
type Notification struct {
// Collection: The collection that generated the notification.
Collection string `json:"collection,omitempty"`
// ItemId: The ID of the item that generated the notification.
ItemId string `json:"itemId,omitempty"`
// Operation: The type of operation that generated the notification.
Operation string `json:"operation,omitempty"`
// UserActions: A list of actions taken by the user that triggered the
// notification.
UserActions []*UserAction `json:"userActions,omitempty"`
// UserToken: The user token provided by the service when it subscribed
// for notifications.
UserToken string `json:"userToken,omitempty"`
// VerifyToken: The secret verify token provided by the service when it
// subscribed for notifications.
VerifyToken string `json:"verifyToken,omitempty"`
// ForceSendFields is a list of field names (e.g. "Collection") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Notification) MarshalJSON() ([]byte, error) {
type noMethod Notification
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// NotificationConfig: Controls how notifications for a timeline item
// are presented to the user.
type NotificationConfig struct {
// DeliveryTime: The time at which the notification should be delivered.
DeliveryTime string `json:"deliveryTime,omitempty"`
// Level: Describes how important the notification is. Allowed values
// are:
// - DEFAULT - Notifications of default importance. A chime will be
// played to alert users.
Level string `json:"level,omitempty"`
// ForceSendFields is a list of field names (e.g. "DeliveryTime") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *NotificationConfig) MarshalJSON() ([]byte, error) {
type noMethod NotificationConfig
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// Setting: A setting for Glass.
type Setting struct {
// Id: The setting's ID. The following IDs are valid:
// - locale - The key to the user’s language/locale (BCP 47
// identifier) that Glassware should use to render localized content.
//
// - timezone - The key to the user’s current time zone region as
// defined in the tz database. Example: America/Los_Angeles.
Id string `json:"id,omitempty"`
// Kind: The type of resource. This is always mirror#setting.
Kind string `json:"kind,omitempty"`
// Value: The setting value, as a string.
Value string `json:"value,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Id") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Setting) MarshalJSON() ([]byte, error) {
type noMethod Setting
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// Subscription: A subscription to events on a collection.
type Subscription struct {
// CallbackUrl: The URL where notifications should be delivered (must
// start with https://).
CallbackUrl string `json:"callbackUrl,omitempty"`
// Collection: The collection to subscribe to. Allowed values are:
// - timeline - Changes in the timeline including insertion, deletion,
// and updates.
// - locations - Location updates.
// - settings - Settings updates.
Collection string `json:"collection,omitempty"`
// Id: The ID of the subscription.
Id string `json:"id,omitempty"`
// Kind: The type of resource. This is always mirror#subscription.
Kind string `json:"kind,omitempty"`
// Notification: Container object for notifications. This is not
// populated in the Subscription resource.
Notification *Notification `json:"notification,omitempty"`
// Operation: A list of operations that should be subscribed to. An
// empty list indicates that all operations on the collection should be
// subscribed to. Allowed values are:
// - UPDATE - The item has been updated.
// - INSERT - A new item has been inserted.
// - DELETE - The item has been deleted.
// - MENU_ACTION - A custom menu item has been triggered by the user.
Operation []string `json:"operation,omitempty"`
// Updated: The time at which this subscription was last modified,
// formatted according to RFC 3339.
Updated string `json:"updated,omitempty"`
// UserToken: An opaque token sent to the subscriber in notifications so
// that it can determine the ID of the user.
UserToken string `json:"userToken,omitempty"`
// VerifyToken: A secret token sent to the subscriber in notifications
// so that it can verify that the notification was generated by Google.
VerifyToken string `json:"verifyToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "CallbackUrl") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *Subscription) MarshalJSON() ([]byte, error) {
type noMethod Subscription
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// SubscriptionsListResponse: A list of Subscriptions. This is the
// response from the server to GET requests on the subscription
// collection.
type SubscriptionsListResponse struct {
// Items: The list of subscriptions.
Items []*Subscription `json:"items,omitempty"`
// Kind: The type of resource. This is always mirror#subscriptionsList.
Kind string `json:"kind,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Items") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *SubscriptionsListResponse) MarshalJSON() ([]byte, error) {
type noMethod SubscriptionsListResponse
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// TimelineItem: Each item in the user's timeline is represented as a
// TimelineItem JSON structure, described below.
type TimelineItem struct {
// Attachments: A list of media attachments associated with this item.
// As a convenience, you can refer to attachments in your HTML payloads
// with the attachment or cid scheme. For example:
// - attachment: <img src="attachment:attachment_index"> where
// attachment_index is the 0-based index of this array.
// - cid: <img src="cid:attachment_id"> where attachment_id is the ID of
// the attachment.
Attachments []*Attachment `json:"attachments,omitempty"`
// BundleId: The bundle ID for this item. Services can specify a
// bundleId to group many items together. They appear under a single
// top-level item on the device.
BundleId string `json:"bundleId,omitempty"`
// CanonicalUrl: A canonical URL pointing to the canonical/high quality
// version of the data represented by the timeline item.
CanonicalUrl string `json:"canonicalUrl,omitempty"`
// Created: The time at which this item was created, formatted according
// to RFC 3339.
Created string `json:"created,omitempty"`
// Creator: The user or group that created this item.
Creator *Contact `json:"creator,omitempty"`
// DisplayTime: The time that should be displayed when this item is
// viewed in the timeline, formatted according to RFC 3339. This user's
// timeline is sorted chronologically on display time, so this will also
// determine where the item is displayed in the timeline. If not set by
// the service, the display time defaults to the updated time.
DisplayTime string `json:"displayTime,omitempty"`
// Etag: ETag for this item.
Etag string `json:"etag,omitempty"`
// Html: HTML content for this item. If both text and html are provided
// for an item, the html will be rendered in the timeline.
// Allowed HTML elements - You can use these elements in your timeline
// cards.
//
// - Headers: h1, h2, h3, h4, h5, h6
// - Images: img
// - Lists: li, ol, ul
// - HTML5 semantics: article, aside, details, figure, figcaption,
// footer, header, nav, section, summary, time
// - Structural: blockquote, br, div, hr, p, span
// - Style: b, big, center, em, i, u, s, small, strike, strong, style,
// sub, sup
// - Tables: table, tbody, td, tfoot, th, thead, tr
// Blocked HTML elements: These elements and their contents are removed
// from HTML payloads.
//
// - Document headers: head, title
// - Embeds: audio, embed, object, source, video
// - Frames: frame, frameset
// - Scripting: applet, script
// Other elements: Any elements that aren't listed are removed, but
// their contents are preserved.
Html string `json:"html,omitempty"`
// Id: The ID of the timeline item. This is unique within a user's
// timeline.
Id string `json:"id,omitempty"`
// InReplyTo: If this item was generated as a reply to another item,
// this field will be set to the ID of the item being replied to. This
// can be used to attach a reply to the appropriate conversation or
// post.
InReplyTo string `json:"inReplyTo,omitempty"`
// IsBundleCover: Whether this item is a bundle cover.
//
// If an item is marked as a bundle cover, it will be the entry point to
// the bundle of items that have the same bundleId as that item. It will
// be shown only on the main timeline — not within the opened
// bundle.
//
// On the main timeline, items that are shown are:
// - Items that have isBundleCover set to true
// - Items that do not have a bundleId In a bundle sub-timeline, items
// that are shown are:
// - Items that have the bundleId in question AND isBundleCover set to
// false
IsBundleCover bool `json:"isBundleCover,omitempty"`
// IsDeleted: When true, indicates this item is deleted, and only the ID
// property is set.
IsDeleted bool `json:"isDeleted,omitempty"`
// IsPinned: When true, indicates this item is pinned, which means it's
// grouped alongside "active" items like navigation and hangouts, on the
// opposite side of the home screen from historical (non-pinned)
// timeline items. You can allow the user to toggle the value of this
// property with the TOGGLE_PINNED built-in menu item.
IsPinned bool `json:"isPinned,omitempty"`
// Kind: The type of resource. This is always mirror#timelineItem.
Kind string `json:"kind,omitempty"`
// Location: The geographic location associated with this item.
Location *Location `json:"location,omitempty"`
// MenuItems: A list of menu items that will be presented to the user
// when this item is selected in the timeline.
MenuItems []*MenuItem `json:"menuItems,omitempty"`
// Notification: Controls how notifications for this item are presented
// on the device. If this is missing, no notification will be generated.
Notification *NotificationConfig `json:"notification,omitempty"`
// PinScore: For pinned items, this determines the order in which the
// item is displayed in the timeline, with a higher score appearing
// closer to the clock. Note: setting this field is currently not
// supported.
PinScore int64 `json:"pinScore,omitempty"`
// Recipients: A list of users or groups that this item has been shared
// with.
Recipients []*Contact `json:"recipients,omitempty"`
// SelfLink: A URL that can be used to retrieve this item.
SelfLink string `json:"selfLink,omitempty"`
// SourceItemId: Opaque string you can use to map a timeline item to
// data in your own service.
SourceItemId string `json:"sourceItemId,omitempty"`
// SpeakableText: The speakable version of the content of this item.
// Along with the READ_ALOUD menu item, use this field to provide text
// that would be clearer when read aloud, or to provide extended
// information to what is displayed visually on Glass.
//
// Glassware should also specify the speakableType field, which will be
// spoken before this text in cases where the additional context is
// useful, for example when the user requests that the item be read
// aloud following a notification.
SpeakableText string `json:"speakableText,omitempty"`
// SpeakableType: A speakable description of the type of this item. This
// will be announced to the user prior to reading the content of the
// item in cases where the additional context is useful, for example
// when the user requests that the item be read aloud following a
// notification.
//
// This should be a short, simple noun phrase such as "Email", "Text
// message", or "Daily Planet News Update".
//
// Glassware are encouraged to populate this field for every timeline
// item, even if the item does not contain speakableText or text so that
// the user can learn the type of the item without looking at the
// screen.
SpeakableType string `json:"speakableType,omitempty"`
// Text: Text content of this item.
Text string `json:"text,omitempty"`
// Title: The title of this item.
Title string `json:"title,omitempty"`
// Updated: The time at which this item was last modified, formatted
// according to RFC 3339.
Updated string `json:"updated,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`
// ForceSendFields is a list of field names (e.g. "Attachments") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
}
func (s *TimelineItem) MarshalJSON() ([]byte, error) {
type noMethod TimelineItem
raw := noMethod(*s)
return internal.MarshalJSON(raw, s.ForceSendFields)
}
// TimelineListResponse: A list of timeline items. This is the response
// from the server to GET requests on the timeline collection.
type TimelineListResponse struct {
// Items: Items in the timeline.
Items []*TimelineItem `json:"items,omitempty"`
// Kind: The type of resource. This is always mirror#timeline.
Kind string `json:"kind,omitempty"`
// NextPageToken: The next page token. Provide this as the pageToken
// parameter in the request to retrieve the next page of results.
NextPageToken string `json:"nextPageToken,omitempty"`
// ServerResponse contains the HTTP response code and headers from the
// server.
googleapi.ServerResponse `json:"-"`