1
// Package mirror provides access to the Google Mirror API.
3
// See https://developers.google.com/glass
7
// import "google.golang.org/api/mirror/v1"
9
// mirrorService, err := mirror.New(oauthHttpClient)
17
"google.golang.org/api/googleapi"
25
// Always reference these packages, just in case the auto-generated code
27
var _ = bytes.NewBuffer
30
var _ = json.NewDecoder
33
var _ = googleapi.Version
35
var _ = strings.Replace
37
const apiId = "mirror:v1"
38
const apiName = "mirror"
39
const apiVersion = "v1"
40
const basePath = "https://www.googleapis.com/mirror/v1/"
42
// OAuth2 scopes used by this API.
45
GlassLocationScope = "https://www.googleapis.com/auth/glass.location"
47
// View and manage your Glass timeline
48
GlassTimelineScope = "https://www.googleapis.com/auth/glass.timeline"
51
func New(client *http.Client) (*Service, error) {
53
return nil, errors.New("client is nil")
55
s := &Service{client: client, BasePath: basePath}
56
s.Accounts = NewAccountsService(s)
57
s.Contacts = NewContactsService(s)
58
s.Locations = NewLocationsService(s)
59
s.Settings = NewSettingsService(s)
60
s.Subscriptions = NewSubscriptionsService(s)
61
s.Timeline = NewTimelineService(s)
67
BasePath string // API endpoint base URL
69
Accounts *AccountsService
71
Contacts *ContactsService
73
Locations *LocationsService
75
Settings *SettingsService
77
Subscriptions *SubscriptionsService
79
Timeline *TimelineService
82
func NewAccountsService(s *Service) *AccountsService {
83
rs := &AccountsService{s: s}
87
type AccountsService struct {
91
func NewContactsService(s *Service) *ContactsService {
92
rs := &ContactsService{s: s}
96
type ContactsService struct {
100
func NewLocationsService(s *Service) *LocationsService {
101
rs := &LocationsService{s: s}
105
type LocationsService struct {
109
func NewSettingsService(s *Service) *SettingsService {
110
rs := &SettingsService{s: s}
114
type SettingsService struct {
118
func NewSubscriptionsService(s *Service) *SubscriptionsService {
119
rs := &SubscriptionsService{s: s}
123
type SubscriptionsService struct {
127
func NewTimelineService(s *Service) *TimelineService {
128
rs := &TimelineService{s: s}
129
rs.Attachments = NewTimelineAttachmentsService(s)
133
type TimelineService struct {
136
Attachments *TimelineAttachmentsService
139
func NewTimelineAttachmentsService(s *Service) *TimelineAttachmentsService {
140
rs := &TimelineAttachmentsService{s: s}
144
type TimelineAttachmentsService struct {
148
type Account struct {
149
AuthTokens []*AuthToken `json:"authTokens,omitempty"`
151
Features []string `json:"features,omitempty"`
153
Password string `json:"password,omitempty"`
155
UserData []*UserData `json:"userData,omitempty"`
158
type Attachment struct {
159
// ContentType: The MIME type of the attachment.
160
ContentType string `json:"contentType,omitempty"`
162
// ContentUrl: The URL for the content.
163
ContentUrl string `json:"contentUrl,omitempty"`
165
// Id: The ID of the attachment.
166
Id string `json:"id,omitempty"`
168
// IsProcessingContent: Indicates that the contentUrl is not available
169
// because the attachment content is still being processed. If the
170
// caller wishes to retrieve the content, it should try again later.
171
IsProcessingContent bool `json:"isProcessingContent,omitempty"`
174
type AttachmentsListResponse struct {
175
// Items: The list of attachments.
176
Items []*Attachment `json:"items,omitempty"`
178
// Kind: The type of resource. This is always mirror#attachmentsList.
179
Kind string `json:"kind,omitempty"`
182
type AuthToken struct {
183
AuthToken string `json:"authToken,omitempty"`
185
Type string `json:"type,omitempty"`
188
type Command struct {
189
// Type: The type of operation this command corresponds to. Allowed
191
// - TAKE_A_NOTE - Shares a timeline item with the
192
// transcription of user speech from the "Take a note" voice menu
194
// - POST_AN_UPDATE - Shares a timeline item with the
195
// transcription of user speech from the "Post an update" voice menu
197
Type string `json:"type,omitempty"`
200
type Contact struct {
201
// AcceptCommands: A list of voice menu commands that a contact can
202
// handle. Glass shows up to three contacts for each voice menu command.
203
// If there are more than that, the three contacts with the highest
204
// priority are shown for that particular command.
205
AcceptCommands []*Command `json:"acceptCommands,omitempty"`
207
// AcceptTypes: A list of MIME types that a contact supports. The
208
// contact will be shown to the user if any of its acceptTypes matches
209
// any of the types of the attachments on the item. If no acceptTypes
210
// are given, the contact will be shown for all items.
211
AcceptTypes []string `json:"acceptTypes,omitempty"`
213
// DisplayName: The name to display for this contact.
214
DisplayName string `json:"displayName,omitempty"`
216
// Id: An ID for this contact. This is generated by the application and
217
// is treated as an opaque token.
218
Id string `json:"id,omitempty"`
220
// ImageUrls: Set of image URLs to display for a contact. Most contacts
221
// will have a single image, but a "group" contact may include up to 8
222
// image URLs and they will be resized and cropped into a mosaic on the
224
ImageUrls []string `json:"imageUrls,omitempty"`
226
// Kind: The type of resource. This is always mirror#contact.
227
Kind string `json:"kind,omitempty"`
229
// PhoneNumber: Primary phone number for the contact. This can be a
230
// fully-qualified number, with country calling code and area code, or a
232
PhoneNumber string `json:"phoneNumber,omitempty"`
234
// Priority: Priority for the contact to determine ordering in a list of
235
// contacts. Contacts with higher priorities will be shown before ones
236
// with lower priorities.
237
Priority int64 `json:"priority,omitempty"`
239
// SharingFeatures: A list of sharing features that a contact can
240
// handle. Allowed values are:
242
SharingFeatures []string `json:"sharingFeatures,omitempty"`
244
// Source: The ID of the application that created this contact. This is
245
// populated by the API
246
Source string `json:"source,omitempty"`
248
// SpeakableName: Name of this contact as it should be pronounced. If
249
// this contact's name must be spoken as part of a voice disambiguation
250
// menu, this name is used as the expected pronunciation. This is useful
251
// for contact names with unpronounceable characters or whose display
252
// spelling is otherwise not phonetic.
253
SpeakableName string `json:"speakableName,omitempty"`
255
// Type: The type for this contact. This is used for sorting in UIs.
256
// Allowed values are:
257
// - INDIVIDUAL - Represents a single person. This
259
// - GROUP - Represents more than a single person.
260
Type string `json:"type,omitempty"`
263
type ContactsListResponse struct {
264
// Items: Contact list.
265
Items []*Contact `json:"items,omitempty"`
267
// Kind: The type of resource. This is always mirror#contacts.
268
Kind string `json:"kind,omitempty"`
271
type Location struct {
272
// Accuracy: The accuracy of the location fix in meters.
273
Accuracy float64 `json:"accuracy,omitempty"`
275
// Address: The full address of the location.
276
Address string `json:"address,omitempty"`
278
// DisplayName: The name to be displayed. This may be a business name or
279
// a user-defined place, such as "Home".
280
DisplayName string `json:"displayName,omitempty"`
282
// Id: The ID of the location.
283
Id string `json:"id,omitempty"`
285
// Kind: The type of resource. This is always mirror#location.
286
Kind string `json:"kind,omitempty"`
288
// Latitude: The latitude, in degrees.
289
Latitude float64 `json:"latitude,omitempty"`
291
// Longitude: The longitude, in degrees.
292
Longitude float64 `json:"longitude,omitempty"`
294
// Timestamp: The time at which this location was captured, formatted
295
// according to RFC 3339.
296
Timestamp string `json:"timestamp,omitempty"`
299
type LocationsListResponse struct {
300
// Items: The list of locations.
301
Items []*Location `json:"items,omitempty"`
303
// Kind: The type of resource. This is always mirror#locationsList.
304
Kind string `json:"kind,omitempty"`
307
type MenuItem struct {
308
// Action: Controls the behavior when the user picks the menu option.
309
// Allowed values are:
310
// - CUSTOM - Custom action set by the service.
311
// When the user selects this menuItem, the API triggers a notification
312
// to your callbackUrl with the userActions.type set to CUSTOM and the
313
// userActions.payload set to the ID of this menu item. This is the
315
// - Built-in actions:
316
// - REPLY - Initiate a reply to
317
// the timeline item using the voice recording UI. The creator attribute
318
// must be set in the timeline item for this menu to be available.
320
// REPLY_ALL - Same behavior as REPLY. The original timeline item's
321
// recipients will be added to the reply item.
322
// - DELETE - Delete the
324
// - SHARE - Share the timeline item with the available
326
// - READ_ALOUD - Read the timeline item's speakableText
327
// aloud; if this field is not set, read the text field; if none of
328
// those fields are set, this menu item is ignored.
329
// - GET_MEDIA_INPUT -
330
// Allow users to provide media payloads to Glassware from a menu item
331
// (currently, only transcribed text from voice input is supported).
332
// Subscribe to notifications when users invoke this menu item to
333
// receive the timeline item ID. Retrieve the media from the timeline
334
// item in the payload property.
335
// - VOICE_CALL - Initiate a phone call
336
// using the timeline item's creator.phoneNumber attribute as recipient.
338
// - NAVIGATE - Navigate to the timeline item's location.
340
// TOGGLE_PINNED - Toggle the isPinned state of the timeline item.
342
// OPEN_URI - Open the payload of the menu item in the browser.
344
// PLAY_VIDEO - Open the payload of the menu item in the Glass video
346
// - SEND_MESSAGE - Initiate sending a message to the timeline
348
// - If the creator.phoneNumber is set and Glass is
349
// connected to an Android phone, the message is an SMS.
351
// if the creator.email is set, the message is an email.
352
Action string `json:"action,omitempty"`
354
// Contextual_command: The ContextualMenus.Command associated with this
355
// MenuItem (e.g. READ_ALOUD). The voice label for this command will be
356
// displayed in the voice menu and the touch label will be displayed in
357
// the touch menu. Note that the default menu value's display name will
358
// be overriden if you specify this property. Values that do not
359
// correspond to a ContextualMenus.Command name will be ignored.
360
Contextual_command string `json:"contextual_command,omitempty"`
362
// Id: The ID for this menu item. This is generated by the application
363
// and is treated as an opaque token.
364
Id string `json:"id,omitempty"`
366
// Payload: A generic payload whose meaning changes depending on this
367
// MenuItem's action.
368
// - When the action is OPEN_URI, the payload is
369
// the URL of the website to view.
370
// - When the action is PLAY_VIDEO, the
371
// payload is the streaming URL of the video
372
// - When the action is
373
// GET_MEDIA_INPUT, the payload is the text transcription of a user's
375
Payload string `json:"payload,omitempty"`
377
// RemoveWhenSelected: If set to true on a CUSTOM menu item, that item
378
// will be removed from the menu after it is selected.
379
RemoveWhenSelected bool `json:"removeWhenSelected,omitempty"`
381
// Values: For CUSTOM items, a list of values controlling the appearance
382
// of the menu item in each of its states. A value for the DEFAULT state
383
// must be provided. If the PENDING or CONFIRMED states are missing,
384
// they will not be shown.
385
Values []*MenuValue `json:"values,omitempty"`
388
type MenuValue struct {
389
// DisplayName: The name to display for the menu item. If you specify
390
// this property for a built-in menu item, the default contextual voice
391
// command for that menu item is not shown.
392
DisplayName string `json:"displayName,omitempty"`
394
// IconUrl: URL of an icon to display with the menu item.
395
IconUrl string `json:"iconUrl,omitempty"`
397
// State: The state that this value applies to. Allowed values are:
399
// DEFAULT - Default value shown when displayed in the menuItems list.
401
// - PENDING - Value shown when the menuItem has been selected by the
402
// user but can still be cancelled.
403
// - CONFIRMED - Value shown when the
404
// menuItem has been selected by the user and can no longer be
406
State string `json:"state,omitempty"`
409
type Notification struct {
410
// Collection: The collection that generated the notification.
411
Collection string `json:"collection,omitempty"`
413
// ItemId: The ID of the item that generated the notification.
414
ItemId string `json:"itemId,omitempty"`
416
// Operation: The type of operation that generated the notification.
417
Operation string `json:"operation,omitempty"`
419
// UserActions: A list of actions taken by the user that triggered the
421
UserActions []*UserAction `json:"userActions,omitempty"`
423
// UserToken: The user token provided by the service when it subscribed
424
// for notifications.
425
UserToken string `json:"userToken,omitempty"`
427
// VerifyToken: The secret verify token provided by the service when it
428
// subscribed for notifications.
429
VerifyToken string `json:"verifyToken,omitempty"`
432
type NotificationConfig struct {
433
// DeliveryTime: The time at which the notification should be delivered.
434
DeliveryTime string `json:"deliveryTime,omitempty"`
436
// Level: Describes how important the notification is. Allowed values
438
// - DEFAULT - Notifications of default importance. A chime will
439
// be played to alert users.
440
Level string `json:"level,omitempty"`
443
type Setting struct {
444
// Id: The setting's ID. The following IDs are valid:
446
// key to the user’s language/locale (BCP 47 identifier) that
447
// Glassware should use to render localized content.
449
// key to the user’s current time zone region as defined in the tz
450
// database. Example: America/Los_Angeles.
451
Id string `json:"id,omitempty"`
453
// Kind: The type of resource. This is always mirror#setting.
454
Kind string `json:"kind,omitempty"`
456
// Value: The setting value, as a string.
457
Value string `json:"value,omitempty"`
460
type Subscription struct {
461
// CallbackUrl: The URL where notifications should be delivered (must
462
// start with https://).
463
CallbackUrl string `json:"callbackUrl,omitempty"`
465
// Collection: The collection to subscribe to. Allowed values are:
467
// timeline - Changes in the timeline including insertion, deletion, and
469
// - locations - Location updates.
470
// - settings - Settings
472
Collection string `json:"collection,omitempty"`
474
// Id: The ID of the subscription.
475
Id string `json:"id,omitempty"`
477
// Kind: The type of resource. This is always mirror#subscription.
478
Kind string `json:"kind,omitempty"`
480
// Notification: Container object for notifications. This is not
481
// populated in the Subscription resource.
482
Notification *Notification `json:"notification,omitempty"`
484
// Operation: A list of operations that should be subscribed to. An
485
// empty list indicates that all operations on the collection should be
486
// subscribed to. Allowed values are:
487
// - UPDATE - The item has been
489
// - INSERT - A new item has been inserted.
491
// item has been deleted.
492
// - MENU_ACTION - A custom menu item has been
493
// triggered by the user.
494
Operation []string `json:"operation,omitempty"`
496
// Updated: The time at which this subscription was last modified,
497
// formatted according to RFC 3339.
498
Updated string `json:"updated,omitempty"`
500
// UserToken: An opaque token sent to the subscriber in notifications so
501
// that it can determine the ID of the user.
502
UserToken string `json:"userToken,omitempty"`
504
// VerifyToken: A secret token sent to the subscriber in notifications
505
// so that it can verify that the notification was generated by Google.
506
VerifyToken string `json:"verifyToken,omitempty"`
509
type SubscriptionsListResponse struct {
510
// Items: The list of subscriptions.
511
Items []*Subscription `json:"items,omitempty"`
513
// Kind: The type of resource. This is always mirror#subscriptionsList.
514
Kind string `json:"kind,omitempty"`
517
type TimelineItem struct {
518
// Attachments: A list of media attachments associated with this item.
519
// As a convenience, you can refer to attachments in your HTML payloads
520
// with the attachment or cid scheme. For example:
521
// - attachment: <img
522
// src="attachment:attachment_index"> where attachment_index is the
523
// 0-based index of this array.
524
// - cid: <img src="cid:attachment_id">
525
// where attachment_id is the ID of the attachment.
526
Attachments []*Attachment `json:"attachments,omitempty"`
528
// BundleId: The bundle ID for this item. Services can specify a
529
// bundleId to group many items together. They appear under a single
530
// top-level item on the device.
531
BundleId string `json:"bundleId,omitempty"`
533
// CanonicalUrl: A canonical URL pointing to the canonical/high quality
534
// version of the data represented by the timeline item.
535
CanonicalUrl string `json:"canonicalUrl,omitempty"`
537
// Created: The time at which this item was created, formatted according
539
Created string `json:"created,omitempty"`
541
// Creator: The user or group that created this item.
542
Creator *Contact `json:"creator,omitempty"`
544
// DisplayTime: The time that should be displayed when this item is
545
// viewed in the timeline, formatted according to RFC 3339. This user's
546
// timeline is sorted chronologically on display time, so this will also
547
// determine where the item is displayed in the timeline. If not set by
548
// the service, the display time defaults to the updated time.
549
DisplayTime string `json:"displayTime,omitempty"`
551
// Etag: ETag for this item.
552
Etag string `json:"etag,omitempty"`
554
// Html: HTML content for this item. If both text and html are provided
555
// for an item, the html will be rendered in the timeline.
557
// elements - You can use these elements in your timeline cards.
560
// Headers: h1, h2, h3, h4, h5, h6
562
// - Lists: li, ol, ul
564
// - HTML5 semantics: article, aside, details, figure, figcaption,
565
// footer, header, nav, section, summary, time
567
// blockquote, br, div, hr, p, span
568
// - Style: b, big, center, em, i, u,
569
// s, small, strike, strong, style, sub, sup
570
// - Tables: table, tbody,
571
// td, tfoot, th, thead, tr
572
// Blocked HTML elements: These elements and
573
// their contents are removed from HTML payloads.
575
// - Document headers:
577
// - Embeds: audio, embed, object, source, video
580
// - Scripting: applet, script
581
// Other elements: Any
582
// elements that aren't listed are removed, but their contents are
584
Html string `json:"html,omitempty"`
586
// Id: The ID of the timeline item. This is unique within a user's
588
Id string `json:"id,omitempty"`
590
// InReplyTo: If this item was generated as a reply to another item,
591
// this field will be set to the ID of the item being replied to. This
592
// can be used to attach a reply to the appropriate conversation or
594
InReplyTo string `json:"inReplyTo,omitempty"`
596
// IsBundleCover: Whether this item is a bundle cover.
599
// marked as a bundle cover, it will be the entry point to the bundle of
600
// items that have the same bundleId as that item. It will be shown only
601
// on the main timeline — not within the opened bundle.
604
// timeline, items that are shown are:
605
// - Items that have isBundleCover
607
// - Items that do not have a bundleId In a bundle
608
// sub-timeline, items that are shown are:
609
// - Items that have the
610
// bundleId in question AND isBundleCover set to false
611
IsBundleCover bool `json:"isBundleCover,omitempty"`
613
// IsDeleted: When true, indicates this item is deleted, and only the ID
615
IsDeleted bool `json:"isDeleted,omitempty"`
617
// IsPinned: When true, indicates this item is pinned, which means it's
618
// grouped alongside "active" items like navigation and hangouts, on the
619
// opposite side of the home screen from historical (non-pinned)
620
// timeline items. You can allow the user to toggle the value of this
621
// property with the TOGGLE_PINNED built-in menu item.
622
IsPinned bool `json:"isPinned,omitempty"`
624
// Kind: The type of resource. This is always mirror#timelineItem.
625
Kind string `json:"kind,omitempty"`
627
// Location: The geographic location associated with this item.
628
Location *Location `json:"location,omitempty"`
630
// MenuItems: A list of menu items that will be presented to the user
631
// when this item is selected in the timeline.
632
MenuItems []*MenuItem `json:"menuItems,omitempty"`
634
// Notification: Controls how notifications for this item are presented
635
// on the device. If this is missing, no notification will be generated.
636
Notification *NotificationConfig `json:"notification,omitempty"`
638
// PinScore: For pinned items, this determines the order in which the
639
// item is displayed in the timeline, with a higher score appearing
640
// closer to the clock. Note: setting this field is currently not
642
PinScore int64 `json:"pinScore,omitempty"`
644
// Recipients: A list of users or groups that this item has been shared
646
Recipients []*Contact `json:"recipients,omitempty"`
648
// SelfLink: A URL that can be used to retrieve this item.
649
SelfLink string `json:"selfLink,omitempty"`
651
// SourceItemId: Opaque string you can use to map a timeline item to
652
// data in your own service.
653
SourceItemId string `json:"sourceItemId,omitempty"`
655
// SpeakableText: The speakable version of the content of this item.
656
// Along with the READ_ALOUD menu item, use this field to provide text
657
// that would be clearer when read aloud, or to provide extended
658
// information to what is displayed visually on Glass.
661
// also specify the speakableType field, which will be spoken before
662
// this text in cases where the additional context is useful, for
663
// example when the user requests that the item be read aloud following
665
SpeakableText string `json:"speakableText,omitempty"`
667
// SpeakableType: A speakable description of the type of this item. This
668
// will be announced to the user prior to reading the content of the
669
// item in cases where the additional context is useful, for example
670
// when the user requests that the item be read aloud following a
673
// This should be a short, simple noun phrase such as
674
// "Email", "Text message", or "Daily Planet News Update".
677
// are encouraged to populate this field for every timeline item, even
678
// if the item does not contain speakableText or text so that the user
679
// can learn the type of the item without looking at the screen.
680
SpeakableType string `json:"speakableType,omitempty"`
682
// Text: Text content of this item.
683
Text string `json:"text,omitempty"`
685
// Title: The title of this item.
686
Title string `json:"title,omitempty"`
688
// Updated: The time at which this item was last modified, formatted
689
// according to RFC 3339.
690
Updated string `json:"updated,omitempty"`
693
type TimelineListResponse struct {
694
// Items: Items in the timeline.
695
Items []*TimelineItem `json:"items,omitempty"`
697
// Kind: The type of resource. This is always mirror#timeline.
698
Kind string `json:"kind,omitempty"`
700
// NextPageToken: The next page token. Provide this as the pageToken
701
// parameter in the request to retrieve the next page of results.
702
NextPageToken string `json:"nextPageToken,omitempty"`
705
type UserAction struct {
706
// Payload: An optional payload for the action.
708
// For actions of type
709
// CUSTOM, this is the ID of the custom menu item that was selected.
710
Payload string `json:"payload,omitempty"`
712
// Type: The type of action. The value of this can be:
714
// user shared an item.
715
// - REPLY - the user replied to an item.
717
// REPLY_ALL - the user replied to all recipients of an item.
719
// - the user selected a custom menu item on the timeline item.
721
// DELETE - the user deleted the item.
722
// - PIN - the user pinned the
724
// - UNPIN - the user unpinned the item.
725
// - LAUNCH - the user
726
// initiated a voice command. In the future, additional types may be
727
// added. UserActions with unrecognized types should be ignored.
728
Type string `json:"type,omitempty"`
731
type UserData struct {
732
Key string `json:"key,omitempty"`
734
Value string `json:"value,omitempty"`
737
// method id "mirror.accounts.insert":
739
type AccountsInsertCall struct {
745
opt_ map[string]interface{}
748
// Insert: Inserts a new account for a user
749
func (r *AccountsService) Insert(userToken string, accountType string, accountName string, account *Account) *AccountsInsertCall {
750
c := &AccountsInsertCall{s: r.s, opt_: make(map[string]interface{})}
751
c.userToken = userToken
752
c.accountType = accountType
753
c.accountName = accountName
758
// Fields allows partial responses to be retrieved.
759
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
760
// for more information.
761
func (c *AccountsInsertCall) Fields(s ...googleapi.Field) *AccountsInsertCall {
762
c.opt_["fields"] = googleapi.CombineFields(s)
766
func (c *AccountsInsertCall) Do() (*Account, error) {
767
var body io.Reader = nil
768
body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
772
ctype := "application/json"
773
params := make(url.Values)
774
params.Set("alt", "json")
775
if v, ok := c.opt_["fields"]; ok {
776
params.Set("fields", fmt.Sprintf("%v", v))
778
urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{userToken}/{accountType}/{accountName}")
779
urls += "?" + params.Encode()
780
req, _ := http.NewRequest("POST", urls, body)
781
googleapi.Expand(req.URL, map[string]string{
782
"userToken": c.userToken,
783
"accountType": c.accountType,
784
"accountName": c.accountName,
786
req.Header.Set("Content-Type", ctype)
787
req.Header.Set("User-Agent", "google-api-go-client/0.5")
788
res, err := c.s.client.Do(req)
792
defer googleapi.CloseBody(res)
793
if err := googleapi.CheckResponse(res); err != nil {
797
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
802
// "description": "Inserts a new account for a user",
803
// "httpMethod": "POST",
804
// "id": "mirror.accounts.insert",
805
// "parameterOrder": [
812
// "description": "The name of the account to be passed to the Android Account Manager.",
813
// "location": "path",
818
// "description": "Account type to be passed to Android Account Manager.",
819
// "location": "path",
824
// "description": "The ID for the user.",
825
// "location": "path",
830
// "path": "accounts/{userToken}/{accountType}/{accountName}",
841
// method id "mirror.contacts.delete":
843
type ContactsDeleteCall struct {
846
opt_ map[string]interface{}
849
// Delete: Deletes a contact.
850
func (r *ContactsService) Delete(id string) *ContactsDeleteCall {
851
c := &ContactsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
856
// Fields allows partial responses to be retrieved.
857
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
858
// for more information.
859
func (c *ContactsDeleteCall) Fields(s ...googleapi.Field) *ContactsDeleteCall {
860
c.opt_["fields"] = googleapi.CombineFields(s)
864
func (c *ContactsDeleteCall) Do() error {
865
var body io.Reader = nil
866
params := make(url.Values)
867
params.Set("alt", "json")
868
if v, ok := c.opt_["fields"]; ok {
869
params.Set("fields", fmt.Sprintf("%v", v))
871
urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
872
urls += "?" + params.Encode()
873
req, _ := http.NewRequest("DELETE", urls, body)
874
googleapi.Expand(req.URL, map[string]string{
877
req.Header.Set("User-Agent", "google-api-go-client/0.5")
878
res, err := c.s.client.Do(req)
882
defer googleapi.CloseBody(res)
883
if err := googleapi.CheckResponse(res); err != nil {
888
// "description": "Deletes a contact.",
889
// "httpMethod": "DELETE",
890
// "id": "mirror.contacts.delete",
891
// "parameterOrder": [
896
// "description": "The ID of the contact.",
897
// "location": "path",
902
// "path": "contacts/{id}",
904
// "https://www.googleapis.com/auth/glass.timeline"
910
// method id "mirror.contacts.get":
912
type ContactsGetCall struct {
915
opt_ map[string]interface{}
918
// Get: Gets a single contact by ID.
919
func (r *ContactsService) Get(id string) *ContactsGetCall {
920
c := &ContactsGetCall{s: r.s, opt_: make(map[string]interface{})}
925
// Fields allows partial responses to be retrieved.
926
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
927
// for more information.
928
func (c *ContactsGetCall) Fields(s ...googleapi.Field) *ContactsGetCall {
929
c.opt_["fields"] = googleapi.CombineFields(s)
933
func (c *ContactsGetCall) Do() (*Contact, error) {
934
var body io.Reader = nil
935
params := make(url.Values)
936
params.Set("alt", "json")
937
if v, ok := c.opt_["fields"]; ok {
938
params.Set("fields", fmt.Sprintf("%v", v))
940
urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
941
urls += "?" + params.Encode()
942
req, _ := http.NewRequest("GET", urls, body)
943
googleapi.Expand(req.URL, map[string]string{
946
req.Header.Set("User-Agent", "google-api-go-client/0.5")
947
res, err := c.s.client.Do(req)
951
defer googleapi.CloseBody(res)
952
if err := googleapi.CheckResponse(res); err != nil {
956
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
961
// "description": "Gets a single contact by ID.",
962
// "httpMethod": "GET",
963
// "id": "mirror.contacts.get",
964
// "parameterOrder": [
969
// "description": "The ID of the contact.",
970
// "location": "path",
975
// "path": "contacts/{id}",
980
// "https://www.googleapis.com/auth/glass.timeline"
986
// method id "mirror.contacts.insert":
988
type ContactsInsertCall struct {
991
opt_ map[string]interface{}
994
// Insert: Inserts a new contact.
995
func (r *ContactsService) Insert(contact *Contact) *ContactsInsertCall {
996
c := &ContactsInsertCall{s: r.s, opt_: make(map[string]interface{})}
1001
// Fields allows partial responses to be retrieved.
1002
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1003
// for more information.
1004
func (c *ContactsInsertCall) Fields(s ...googleapi.Field) *ContactsInsertCall {
1005
c.opt_["fields"] = googleapi.CombineFields(s)
1009
func (c *ContactsInsertCall) Do() (*Contact, error) {
1010
var body io.Reader = nil
1011
body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
1015
ctype := "application/json"
1016
params := make(url.Values)
1017
params.Set("alt", "json")
1018
if v, ok := c.opt_["fields"]; ok {
1019
params.Set("fields", fmt.Sprintf("%v", v))
1021
urls := googleapi.ResolveRelative(c.s.BasePath, "contacts")
1022
urls += "?" + params.Encode()
1023
req, _ := http.NewRequest("POST", urls, body)
1024
googleapi.SetOpaque(req.URL)
1025
req.Header.Set("Content-Type", ctype)
1026
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1027
res, err := c.s.client.Do(req)
1031
defer googleapi.CloseBody(res)
1032
if err := googleapi.CheckResponse(res); err != nil {
1036
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1041
// "description": "Inserts a new contact.",
1042
// "httpMethod": "POST",
1043
// "id": "mirror.contacts.insert",
1044
// "path": "contacts",
1046
// "$ref": "Contact"
1049
// "$ref": "Contact"
1052
// "https://www.googleapis.com/auth/glass.timeline"
1058
// method id "mirror.contacts.list":
1060
type ContactsListCall struct {
1062
opt_ map[string]interface{}
1065
// List: Retrieves a list of contacts for the authenticated user.
1066
func (r *ContactsService) List() *ContactsListCall {
1067
c := &ContactsListCall{s: r.s, opt_: make(map[string]interface{})}
1071
// Fields allows partial responses to be retrieved.
1072
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1073
// for more information.
1074
func (c *ContactsListCall) Fields(s ...googleapi.Field) *ContactsListCall {
1075
c.opt_["fields"] = googleapi.CombineFields(s)
1079
func (c *ContactsListCall) Do() (*ContactsListResponse, error) {
1080
var body io.Reader = nil
1081
params := make(url.Values)
1082
params.Set("alt", "json")
1083
if v, ok := c.opt_["fields"]; ok {
1084
params.Set("fields", fmt.Sprintf("%v", v))
1086
urls := googleapi.ResolveRelative(c.s.BasePath, "contacts")
1087
urls += "?" + params.Encode()
1088
req, _ := http.NewRequest("GET", urls, body)
1089
googleapi.SetOpaque(req.URL)
1090
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1091
res, err := c.s.client.Do(req)
1095
defer googleapi.CloseBody(res)
1096
if err := googleapi.CheckResponse(res); err != nil {
1099
var ret *ContactsListResponse
1100
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1105
// "description": "Retrieves a list of contacts for the authenticated user.",
1106
// "httpMethod": "GET",
1107
// "id": "mirror.contacts.list",
1108
// "path": "contacts",
1110
// "$ref": "ContactsListResponse"
1113
// "https://www.googleapis.com/auth/glass.timeline"
1119
// method id "mirror.contacts.patch":
1121
type ContactsPatchCall struct {
1125
opt_ map[string]interface{}
1128
// Patch: Updates a contact in place. This method supports patch
1130
func (r *ContactsService) Patch(id string, contact *Contact) *ContactsPatchCall {
1131
c := &ContactsPatchCall{s: r.s, opt_: make(map[string]interface{})}
1137
// Fields allows partial responses to be retrieved.
1138
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1139
// for more information.
1140
func (c *ContactsPatchCall) Fields(s ...googleapi.Field) *ContactsPatchCall {
1141
c.opt_["fields"] = googleapi.CombineFields(s)
1145
func (c *ContactsPatchCall) Do() (*Contact, error) {
1146
var body io.Reader = nil
1147
body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
1151
ctype := "application/json"
1152
params := make(url.Values)
1153
params.Set("alt", "json")
1154
if v, ok := c.opt_["fields"]; ok {
1155
params.Set("fields", fmt.Sprintf("%v", v))
1157
urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
1158
urls += "?" + params.Encode()
1159
req, _ := http.NewRequest("PATCH", urls, body)
1160
googleapi.Expand(req.URL, map[string]string{
1163
req.Header.Set("Content-Type", ctype)
1164
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1165
res, err := c.s.client.Do(req)
1169
defer googleapi.CloseBody(res)
1170
if err := googleapi.CheckResponse(res); err != nil {
1174
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1179
// "description": "Updates a contact in place. This method supports patch semantics.",
1180
// "httpMethod": "PATCH",
1181
// "id": "mirror.contacts.patch",
1182
// "parameterOrder": [
1187
// "description": "The ID of the contact.",
1188
// "location": "path",
1189
// "required": true,
1193
// "path": "contacts/{id}",
1195
// "$ref": "Contact"
1198
// "$ref": "Contact"
1201
// "https://www.googleapis.com/auth/glass.timeline"
1207
// method id "mirror.contacts.update":
1209
type ContactsUpdateCall struct {
1213
opt_ map[string]interface{}
1216
// Update: Updates a contact in place.
1217
func (r *ContactsService) Update(id string, contact *Contact) *ContactsUpdateCall {
1218
c := &ContactsUpdateCall{s: r.s, opt_: make(map[string]interface{})}
1224
// Fields allows partial responses to be retrieved.
1225
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1226
// for more information.
1227
func (c *ContactsUpdateCall) Fields(s ...googleapi.Field) *ContactsUpdateCall {
1228
c.opt_["fields"] = googleapi.CombineFields(s)
1232
func (c *ContactsUpdateCall) Do() (*Contact, error) {
1233
var body io.Reader = nil
1234
body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
1238
ctype := "application/json"
1239
params := make(url.Values)
1240
params.Set("alt", "json")
1241
if v, ok := c.opt_["fields"]; ok {
1242
params.Set("fields", fmt.Sprintf("%v", v))
1244
urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
1245
urls += "?" + params.Encode()
1246
req, _ := http.NewRequest("PUT", urls, body)
1247
googleapi.Expand(req.URL, map[string]string{
1250
req.Header.Set("Content-Type", ctype)
1251
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1252
res, err := c.s.client.Do(req)
1256
defer googleapi.CloseBody(res)
1257
if err := googleapi.CheckResponse(res); err != nil {
1261
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1266
// "description": "Updates a contact in place.",
1267
// "httpMethod": "PUT",
1268
// "id": "mirror.contacts.update",
1269
// "parameterOrder": [
1274
// "description": "The ID of the contact.",
1275
// "location": "path",
1276
// "required": true,
1280
// "path": "contacts/{id}",
1282
// "$ref": "Contact"
1285
// "$ref": "Contact"
1288
// "https://www.googleapis.com/auth/glass.timeline"
1294
// method id "mirror.locations.get":
1296
type LocationsGetCall struct {
1299
opt_ map[string]interface{}
1302
// Get: Gets a single location by ID.
1303
func (r *LocationsService) Get(id string) *LocationsGetCall {
1304
c := &LocationsGetCall{s: r.s, opt_: make(map[string]interface{})}
1309
// Fields allows partial responses to be retrieved.
1310
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1311
// for more information.
1312
func (c *LocationsGetCall) Fields(s ...googleapi.Field) *LocationsGetCall {
1313
c.opt_["fields"] = googleapi.CombineFields(s)
1317
func (c *LocationsGetCall) Do() (*Location, error) {
1318
var body io.Reader = nil
1319
params := make(url.Values)
1320
params.Set("alt", "json")
1321
if v, ok := c.opt_["fields"]; ok {
1322
params.Set("fields", fmt.Sprintf("%v", v))
1324
urls := googleapi.ResolveRelative(c.s.BasePath, "locations/{id}")
1325
urls += "?" + params.Encode()
1326
req, _ := http.NewRequest("GET", urls, body)
1327
googleapi.Expand(req.URL, map[string]string{
1330
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1331
res, err := c.s.client.Do(req)
1335
defer googleapi.CloseBody(res)
1336
if err := googleapi.CheckResponse(res); err != nil {
1340
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1345
// "description": "Gets a single location by ID.",
1346
// "httpMethod": "GET",
1347
// "id": "mirror.locations.get",
1348
// "parameterOrder": [
1353
// "description": "The ID of the location or latest for the last known location.",
1354
// "location": "path",
1355
// "required": true,
1359
// "path": "locations/{id}",
1361
// "$ref": "Location"
1364
// "https://www.googleapis.com/auth/glass.location",
1365
// "https://www.googleapis.com/auth/glass.timeline"
1371
// method id "mirror.locations.list":
1373
type LocationsListCall struct {
1375
opt_ map[string]interface{}
1378
// List: Retrieves a list of locations for the user.
1379
func (r *LocationsService) List() *LocationsListCall {
1380
c := &LocationsListCall{s: r.s, opt_: make(map[string]interface{})}
1384
// Fields allows partial responses to be retrieved.
1385
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1386
// for more information.
1387
func (c *LocationsListCall) Fields(s ...googleapi.Field) *LocationsListCall {
1388
c.opt_["fields"] = googleapi.CombineFields(s)
1392
func (c *LocationsListCall) Do() (*LocationsListResponse, error) {
1393
var body io.Reader = nil
1394
params := make(url.Values)
1395
params.Set("alt", "json")
1396
if v, ok := c.opt_["fields"]; ok {
1397
params.Set("fields", fmt.Sprintf("%v", v))
1399
urls := googleapi.ResolveRelative(c.s.BasePath, "locations")
1400
urls += "?" + params.Encode()
1401
req, _ := http.NewRequest("GET", urls, body)
1402
googleapi.SetOpaque(req.URL)
1403
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1404
res, err := c.s.client.Do(req)
1408
defer googleapi.CloseBody(res)
1409
if err := googleapi.CheckResponse(res); err != nil {
1412
var ret *LocationsListResponse
1413
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1418
// "description": "Retrieves a list of locations for the user.",
1419
// "httpMethod": "GET",
1420
// "id": "mirror.locations.list",
1421
// "path": "locations",
1423
// "$ref": "LocationsListResponse"
1426
// "https://www.googleapis.com/auth/glass.location",
1427
// "https://www.googleapis.com/auth/glass.timeline"
1433
// method id "mirror.settings.get":
1435
type SettingsGetCall struct {
1438
opt_ map[string]interface{}
1441
// Get: Gets a single setting by ID.
1442
func (r *SettingsService) Get(id string) *SettingsGetCall {
1443
c := &SettingsGetCall{s: r.s, opt_: make(map[string]interface{})}
1448
// Fields allows partial responses to be retrieved.
1449
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1450
// for more information.
1451
func (c *SettingsGetCall) Fields(s ...googleapi.Field) *SettingsGetCall {
1452
c.opt_["fields"] = googleapi.CombineFields(s)
1456
func (c *SettingsGetCall) Do() (*Setting, error) {
1457
var body io.Reader = nil
1458
params := make(url.Values)
1459
params.Set("alt", "json")
1460
if v, ok := c.opt_["fields"]; ok {
1461
params.Set("fields", fmt.Sprintf("%v", v))
1463
urls := googleapi.ResolveRelative(c.s.BasePath, "settings/{id}")
1464
urls += "?" + params.Encode()
1465
req, _ := http.NewRequest("GET", urls, body)
1466
googleapi.Expand(req.URL, map[string]string{
1469
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1470
res, err := c.s.client.Do(req)
1474
defer googleapi.CloseBody(res)
1475
if err := googleapi.CheckResponse(res); err != nil {
1479
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1484
// "description": "Gets a single setting by ID.",
1485
// "httpMethod": "GET",
1486
// "id": "mirror.settings.get",
1487
// "parameterOrder": [
1492
// "description": "The ID of the setting. The following IDs are valid: \n- locale - The key to the user’s language/locale (BCP 47 identifier) that Glassware should use to render localized content. \n- timezone - The key to the user’s current time zone region as defined in the tz database. Example: America/Los_Angeles.",
1493
// "location": "path",
1494
// "required": true,
1498
// "path": "settings/{id}",
1500
// "$ref": "Setting"
1503
// "https://www.googleapis.com/auth/glass.timeline"
1509
// method id "mirror.subscriptions.delete":
1511
type SubscriptionsDeleteCall struct {
1514
opt_ map[string]interface{}
1517
// Delete: Deletes a subscription.
1518
func (r *SubscriptionsService) Delete(id string) *SubscriptionsDeleteCall {
1519
c := &SubscriptionsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
1524
// Fields allows partial responses to be retrieved.
1525
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1526
// for more information.
1527
func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
1528
c.opt_["fields"] = googleapi.CombineFields(s)
1532
func (c *SubscriptionsDeleteCall) Do() error {
1533
var body io.Reader = nil
1534
params := make(url.Values)
1535
params.Set("alt", "json")
1536
if v, ok := c.opt_["fields"]; ok {
1537
params.Set("fields", fmt.Sprintf("%v", v))
1539
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{id}")
1540
urls += "?" + params.Encode()
1541
req, _ := http.NewRequest("DELETE", urls, body)
1542
googleapi.Expand(req.URL, map[string]string{
1545
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1546
res, err := c.s.client.Do(req)
1550
defer googleapi.CloseBody(res)
1551
if err := googleapi.CheckResponse(res); err != nil {
1556
// "description": "Deletes a subscription.",
1557
// "httpMethod": "DELETE",
1558
// "id": "mirror.subscriptions.delete",
1559
// "parameterOrder": [
1564
// "description": "The ID of the subscription.",
1565
// "location": "path",
1566
// "required": true,
1570
// "path": "subscriptions/{id}",
1572
// "https://www.googleapis.com/auth/glass.timeline"
1578
// method id "mirror.subscriptions.insert":
1580
type SubscriptionsInsertCall struct {
1582
subscription *Subscription
1583
opt_ map[string]interface{}
1586
// Insert: Creates a new subscription.
1587
func (r *SubscriptionsService) Insert(subscription *Subscription) *SubscriptionsInsertCall {
1588
c := &SubscriptionsInsertCall{s: r.s, opt_: make(map[string]interface{})}
1589
c.subscription = subscription
1593
// Fields allows partial responses to be retrieved.
1594
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1595
// for more information.
1596
func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
1597
c.opt_["fields"] = googleapi.CombineFields(s)
1601
func (c *SubscriptionsInsertCall) Do() (*Subscription, error) {
1602
var body io.Reader = nil
1603
body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
1607
ctype := "application/json"
1608
params := make(url.Values)
1609
params.Set("alt", "json")
1610
if v, ok := c.opt_["fields"]; ok {
1611
params.Set("fields", fmt.Sprintf("%v", v))
1613
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
1614
urls += "?" + params.Encode()
1615
req, _ := http.NewRequest("POST", urls, body)
1616
googleapi.SetOpaque(req.URL)
1617
req.Header.Set("Content-Type", ctype)
1618
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1619
res, err := c.s.client.Do(req)
1623
defer googleapi.CloseBody(res)
1624
if err := googleapi.CheckResponse(res); err != nil {
1627
var ret *Subscription
1628
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1633
// "description": "Creates a new subscription.",
1634
// "httpMethod": "POST",
1635
// "id": "mirror.subscriptions.insert",
1636
// "path": "subscriptions",
1638
// "$ref": "Subscription"
1641
// "$ref": "Subscription"
1644
// "https://www.googleapis.com/auth/glass.timeline"
1650
// method id "mirror.subscriptions.list":
1652
type SubscriptionsListCall struct {
1654
opt_ map[string]interface{}
1657
// List: Retrieves a list of subscriptions for the authenticated user
1659
func (r *SubscriptionsService) List() *SubscriptionsListCall {
1660
c := &SubscriptionsListCall{s: r.s, opt_: make(map[string]interface{})}
1664
// Fields allows partial responses to be retrieved.
1665
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1666
// for more information.
1667
func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
1668
c.opt_["fields"] = googleapi.CombineFields(s)
1672
func (c *SubscriptionsListCall) Do() (*SubscriptionsListResponse, error) {
1673
var body io.Reader = nil
1674
params := make(url.Values)
1675
params.Set("alt", "json")
1676
if v, ok := c.opt_["fields"]; ok {
1677
params.Set("fields", fmt.Sprintf("%v", v))
1679
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
1680
urls += "?" + params.Encode()
1681
req, _ := http.NewRequest("GET", urls, body)
1682
googleapi.SetOpaque(req.URL)
1683
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1684
res, err := c.s.client.Do(req)
1688
defer googleapi.CloseBody(res)
1689
if err := googleapi.CheckResponse(res); err != nil {
1692
var ret *SubscriptionsListResponse
1693
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1698
// "description": "Retrieves a list of subscriptions for the authenticated user and service.",
1699
// "httpMethod": "GET",
1700
// "id": "mirror.subscriptions.list",
1701
// "path": "subscriptions",
1703
// "$ref": "SubscriptionsListResponse"
1706
// "https://www.googleapis.com/auth/glass.timeline"
1712
// method id "mirror.subscriptions.update":
1714
type SubscriptionsUpdateCall struct {
1717
subscription *Subscription
1718
opt_ map[string]interface{}
1721
// Update: Updates an existing subscription in place.
1722
func (r *SubscriptionsService) Update(id string, subscription *Subscription) *SubscriptionsUpdateCall {
1723
c := &SubscriptionsUpdateCall{s: r.s, opt_: make(map[string]interface{})}
1725
c.subscription = subscription
1729
// Fields allows partial responses to be retrieved.
1730
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1731
// for more information.
1732
func (c *SubscriptionsUpdateCall) Fields(s ...googleapi.Field) *SubscriptionsUpdateCall {
1733
c.opt_["fields"] = googleapi.CombineFields(s)
1737
func (c *SubscriptionsUpdateCall) Do() (*Subscription, error) {
1738
var body io.Reader = nil
1739
body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
1743
ctype := "application/json"
1744
params := make(url.Values)
1745
params.Set("alt", "json")
1746
if v, ok := c.opt_["fields"]; ok {
1747
params.Set("fields", fmt.Sprintf("%v", v))
1749
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{id}")
1750
urls += "?" + params.Encode()
1751
req, _ := http.NewRequest("PUT", urls, body)
1752
googleapi.Expand(req.URL, map[string]string{
1755
req.Header.Set("Content-Type", ctype)
1756
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1757
res, err := c.s.client.Do(req)
1761
defer googleapi.CloseBody(res)
1762
if err := googleapi.CheckResponse(res); err != nil {
1765
var ret *Subscription
1766
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1771
// "description": "Updates an existing subscription in place.",
1772
// "httpMethod": "PUT",
1773
// "id": "mirror.subscriptions.update",
1774
// "parameterOrder": [
1779
// "description": "The ID of the subscription.",
1780
// "location": "path",
1781
// "required": true,
1785
// "path": "subscriptions/{id}",
1787
// "$ref": "Subscription"
1790
// "$ref": "Subscription"
1793
// "https://www.googleapis.com/auth/glass.timeline"
1799
// method id "mirror.timeline.delete":
1801
type TimelineDeleteCall struct {
1804
opt_ map[string]interface{}
1807
// Delete: Deletes a timeline item.
1808
func (r *TimelineService) Delete(id string) *TimelineDeleteCall {
1809
c := &TimelineDeleteCall{s: r.s, opt_: make(map[string]interface{})}
1814
// Fields allows partial responses to be retrieved.
1815
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1816
// for more information.
1817
func (c *TimelineDeleteCall) Fields(s ...googleapi.Field) *TimelineDeleteCall {
1818
c.opt_["fields"] = googleapi.CombineFields(s)
1822
func (c *TimelineDeleteCall) Do() error {
1823
var body io.Reader = nil
1824
params := make(url.Values)
1825
params.Set("alt", "json")
1826
if v, ok := c.opt_["fields"]; ok {
1827
params.Set("fields", fmt.Sprintf("%v", v))
1829
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
1830
urls += "?" + params.Encode()
1831
req, _ := http.NewRequest("DELETE", urls, body)
1832
googleapi.Expand(req.URL, map[string]string{
1835
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1836
res, err := c.s.client.Do(req)
1840
defer googleapi.CloseBody(res)
1841
if err := googleapi.CheckResponse(res); err != nil {
1846
// "description": "Deletes a timeline item.",
1847
// "httpMethod": "DELETE",
1848
// "id": "mirror.timeline.delete",
1849
// "parameterOrder": [
1854
// "description": "The ID of the timeline item.",
1855
// "location": "path",
1856
// "required": true,
1860
// "path": "timeline/{id}",
1862
// "https://www.googleapis.com/auth/glass.location",
1863
// "https://www.googleapis.com/auth/glass.timeline"
1869
// method id "mirror.timeline.get":
1871
type TimelineGetCall struct {
1874
opt_ map[string]interface{}
1877
// Get: Gets a single timeline item by ID.
1878
func (r *TimelineService) Get(id string) *TimelineGetCall {
1879
c := &TimelineGetCall{s: r.s, opt_: make(map[string]interface{})}
1884
// Fields allows partial responses to be retrieved.
1885
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1886
// for more information.
1887
func (c *TimelineGetCall) Fields(s ...googleapi.Field) *TimelineGetCall {
1888
c.opt_["fields"] = googleapi.CombineFields(s)
1892
func (c *TimelineGetCall) Do() (*TimelineItem, error) {
1893
var body io.Reader = nil
1894
params := make(url.Values)
1895
params.Set("alt", "json")
1896
if v, ok := c.opt_["fields"]; ok {
1897
params.Set("fields", fmt.Sprintf("%v", v))
1899
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
1900
urls += "?" + params.Encode()
1901
req, _ := http.NewRequest("GET", urls, body)
1902
googleapi.Expand(req.URL, map[string]string{
1905
req.Header.Set("User-Agent", "google-api-go-client/0.5")
1906
res, err := c.s.client.Do(req)
1910
defer googleapi.CloseBody(res)
1911
if err := googleapi.CheckResponse(res); err != nil {
1914
var ret *TimelineItem
1915
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
1920
// "description": "Gets a single timeline item by ID.",
1921
// "httpMethod": "GET",
1922
// "id": "mirror.timeline.get",
1923
// "parameterOrder": [
1928
// "description": "The ID of the timeline item.",
1929
// "location": "path",
1930
// "required": true,
1934
// "path": "timeline/{id}",
1936
// "$ref": "TimelineItem"
1939
// "https://www.googleapis.com/auth/glass.location",
1940
// "https://www.googleapis.com/auth/glass.timeline"
1946
// method id "mirror.timeline.insert":
1948
type TimelineInsertCall struct {
1950
timelineitem *TimelineItem
1951
opt_ map[string]interface{}
1955
// Insert: Inserts a new item into the timeline.
1956
func (r *TimelineService) Insert(timelineitem *TimelineItem) *TimelineInsertCall {
1957
c := &TimelineInsertCall{s: r.s, opt_: make(map[string]interface{})}
1958
c.timelineitem = timelineitem
1961
func (c *TimelineInsertCall) Media(r io.Reader) *TimelineInsertCall {
1966
// Fields allows partial responses to be retrieved.
1967
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1968
// for more information.
1969
func (c *TimelineInsertCall) Fields(s ...googleapi.Field) *TimelineInsertCall {
1970
c.opt_["fields"] = googleapi.CombineFields(s)
1974
func (c *TimelineInsertCall) Do() (*TimelineItem, error) {
1975
var body io.Reader = nil
1976
body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
1980
ctype := "application/json"
1981
params := make(url.Values)
1982
params.Set("alt", "json")
1983
if v, ok := c.opt_["fields"]; ok {
1984
params.Set("fields", fmt.Sprintf("%v", v))
1986
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline")
1987
if c.media_ != nil {
1988
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
1989
params.Set("uploadType", "multipart")
1991
urls += "?" + params.Encode()
1992
contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
1993
req, _ := http.NewRequest("POST", urls, body)
1994
googleapi.SetOpaque(req.URL)
1996
req.ContentLength = contentLength_
1998
req.Header.Set("Content-Type", ctype)
1999
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2000
res, err := c.s.client.Do(req)
2004
defer googleapi.CloseBody(res)
2005
if err := googleapi.CheckResponse(res); err != nil {
2008
var ret *TimelineItem
2009
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
2014
// "description": "Inserts a new item into the timeline.",
2015
// "httpMethod": "POST",
2016
// "id": "mirror.timeline.insert",
2023
// "maxSize": "10MB",
2026
// "multipart": true,
2027
// "path": "/resumable/upload/mirror/v1/timeline"
2030
// "multipart": true,
2031
// "path": "/upload/mirror/v1/timeline"
2035
// "path": "timeline",
2037
// "$ref": "TimelineItem"
2040
// "$ref": "TimelineItem"
2043
// "https://www.googleapis.com/auth/glass.location",
2044
// "https://www.googleapis.com/auth/glass.timeline"
2046
// "supportsMediaUpload": true
2051
// method id "mirror.timeline.list":
2053
type TimelineListCall struct {
2055
opt_ map[string]interface{}
2058
// List: Retrieves a list of timeline items for the authenticated user.
2059
func (r *TimelineService) List() *TimelineListCall {
2060
c := &TimelineListCall{s: r.s, opt_: make(map[string]interface{})}
2064
// BundleId sets the optional parameter "bundleId": If provided, only
2065
// items with the given bundleId will be returned.
2066
func (c *TimelineListCall) BundleId(bundleId string) *TimelineListCall {
2067
c.opt_["bundleId"] = bundleId
2071
// IncludeDeleted sets the optional parameter "includeDeleted": If true,
2072
// tombstone records for deleted items will be returned.
2073
func (c *TimelineListCall) IncludeDeleted(includeDeleted bool) *TimelineListCall {
2074
c.opt_["includeDeleted"] = includeDeleted
2078
// MaxResults sets the optional parameter "maxResults": The maximum
2079
// number of items to include in the response, used for paging.
2080
func (c *TimelineListCall) MaxResults(maxResults int64) *TimelineListCall {
2081
c.opt_["maxResults"] = maxResults
2085
// OrderBy sets the optional parameter "orderBy": Controls the order in
2086
// which timeline items are returned.
2087
func (c *TimelineListCall) OrderBy(orderBy string) *TimelineListCall {
2088
c.opt_["orderBy"] = orderBy
2092
// PageToken sets the optional parameter "pageToken": Token for the page
2093
// of results to return.
2094
func (c *TimelineListCall) PageToken(pageToken string) *TimelineListCall {
2095
c.opt_["pageToken"] = pageToken
2099
// PinnedOnly sets the optional parameter "pinnedOnly": If true, only
2100
// pinned items will be returned.
2101
func (c *TimelineListCall) PinnedOnly(pinnedOnly bool) *TimelineListCall {
2102
c.opt_["pinnedOnly"] = pinnedOnly
2106
// SourceItemId sets the optional parameter "sourceItemId": If provided,
2107
// only items with the given sourceItemId will be returned.
2108
func (c *TimelineListCall) SourceItemId(sourceItemId string) *TimelineListCall {
2109
c.opt_["sourceItemId"] = sourceItemId
2113
// Fields allows partial responses to be retrieved.
2114
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2115
// for more information.
2116
func (c *TimelineListCall) Fields(s ...googleapi.Field) *TimelineListCall {
2117
c.opt_["fields"] = googleapi.CombineFields(s)
2121
func (c *TimelineListCall) Do() (*TimelineListResponse, error) {
2122
var body io.Reader = nil
2123
params := make(url.Values)
2124
params.Set("alt", "json")
2125
if v, ok := c.opt_["bundleId"]; ok {
2126
params.Set("bundleId", fmt.Sprintf("%v", v))
2128
if v, ok := c.opt_["includeDeleted"]; ok {
2129
params.Set("includeDeleted", fmt.Sprintf("%v", v))
2131
if v, ok := c.opt_["maxResults"]; ok {
2132
params.Set("maxResults", fmt.Sprintf("%v", v))
2134
if v, ok := c.opt_["orderBy"]; ok {
2135
params.Set("orderBy", fmt.Sprintf("%v", v))
2137
if v, ok := c.opt_["pageToken"]; ok {
2138
params.Set("pageToken", fmt.Sprintf("%v", v))
2140
if v, ok := c.opt_["pinnedOnly"]; ok {
2141
params.Set("pinnedOnly", fmt.Sprintf("%v", v))
2143
if v, ok := c.opt_["sourceItemId"]; ok {
2144
params.Set("sourceItemId", fmt.Sprintf("%v", v))
2146
if v, ok := c.opt_["fields"]; ok {
2147
params.Set("fields", fmt.Sprintf("%v", v))
2149
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline")
2150
urls += "?" + params.Encode()
2151
req, _ := http.NewRequest("GET", urls, body)
2152
googleapi.SetOpaque(req.URL)
2153
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2154
res, err := c.s.client.Do(req)
2158
defer googleapi.CloseBody(res)
2159
if err := googleapi.CheckResponse(res); err != nil {
2162
var ret *TimelineListResponse
2163
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
2168
// "description": "Retrieves a list of timeline items for the authenticated user.",
2169
// "httpMethod": "GET",
2170
// "id": "mirror.timeline.list",
2173
// "description": "If provided, only items with the given bundleId will be returned.",
2174
// "location": "query",
2177
// "includeDeleted": {
2178
// "description": "If true, tombstone records for deleted items will be returned.",
2179
// "location": "query",
2180
// "type": "boolean"
2183
// "description": "The maximum number of items to include in the response, used for paging.",
2184
// "format": "uint32",
2185
// "location": "query",
2186
// "type": "integer"
2189
// "description": "Controls the order in which timeline items are returned.",
2194
// "enumDescriptions": [
2195
// "Results will be ordered by displayTime (default). This is the same ordering as is used in the timeline on the device.",
2196
// "Results will be ordered by the time at which they were last written to the data store."
2198
// "location": "query",
2202
// "description": "Token for the page of results to return.",
2203
// "location": "query",
2207
// "description": "If true, only pinned items will be returned.",
2208
// "location": "query",
2209
// "type": "boolean"
2211
// "sourceItemId": {
2212
// "description": "If provided, only items with the given sourceItemId will be returned.",
2213
// "location": "query",
2217
// "path": "timeline",
2219
// "$ref": "TimelineListResponse"
2222
// "https://www.googleapis.com/auth/glass.location",
2223
// "https://www.googleapis.com/auth/glass.timeline"
2229
// method id "mirror.timeline.patch":
2231
type TimelinePatchCall struct {
2234
timelineitem *TimelineItem
2235
opt_ map[string]interface{}
2238
// Patch: Updates a timeline item in place. This method supports patch
2240
func (r *TimelineService) Patch(id string, timelineitem *TimelineItem) *TimelinePatchCall {
2241
c := &TimelinePatchCall{s: r.s, opt_: make(map[string]interface{})}
2243
c.timelineitem = timelineitem
2247
// Fields allows partial responses to be retrieved.
2248
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2249
// for more information.
2250
func (c *TimelinePatchCall) Fields(s ...googleapi.Field) *TimelinePatchCall {
2251
c.opt_["fields"] = googleapi.CombineFields(s)
2255
func (c *TimelinePatchCall) Do() (*TimelineItem, error) {
2256
var body io.Reader = nil
2257
body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
2261
ctype := "application/json"
2262
params := make(url.Values)
2263
params.Set("alt", "json")
2264
if v, ok := c.opt_["fields"]; ok {
2265
params.Set("fields", fmt.Sprintf("%v", v))
2267
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
2268
urls += "?" + params.Encode()
2269
req, _ := http.NewRequest("PATCH", urls, body)
2270
googleapi.Expand(req.URL, map[string]string{
2273
req.Header.Set("Content-Type", ctype)
2274
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2275
res, err := c.s.client.Do(req)
2279
defer googleapi.CloseBody(res)
2280
if err := googleapi.CheckResponse(res); err != nil {
2283
var ret *TimelineItem
2284
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
2289
// "description": "Updates a timeline item in place. This method supports patch semantics.",
2290
// "httpMethod": "PATCH",
2291
// "id": "mirror.timeline.patch",
2292
// "parameterOrder": [
2297
// "description": "The ID of the timeline item.",
2298
// "location": "path",
2299
// "required": true,
2303
// "path": "timeline/{id}",
2305
// "$ref": "TimelineItem"
2308
// "$ref": "TimelineItem"
2311
// "https://www.googleapis.com/auth/glass.location",
2312
// "https://www.googleapis.com/auth/glass.timeline"
2318
// method id "mirror.timeline.update":
2320
type TimelineUpdateCall struct {
2323
timelineitem *TimelineItem
2324
opt_ map[string]interface{}
2328
// Update: Updates a timeline item in place.
2329
func (r *TimelineService) Update(id string, timelineitem *TimelineItem) *TimelineUpdateCall {
2330
c := &TimelineUpdateCall{s: r.s, opt_: make(map[string]interface{})}
2332
c.timelineitem = timelineitem
2335
func (c *TimelineUpdateCall) Media(r io.Reader) *TimelineUpdateCall {
2340
// Fields allows partial responses to be retrieved.
2341
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2342
// for more information.
2343
func (c *TimelineUpdateCall) Fields(s ...googleapi.Field) *TimelineUpdateCall {
2344
c.opt_["fields"] = googleapi.CombineFields(s)
2348
func (c *TimelineUpdateCall) Do() (*TimelineItem, error) {
2349
var body io.Reader = nil
2350
body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
2354
ctype := "application/json"
2355
params := make(url.Values)
2356
params.Set("alt", "json")
2357
if v, ok := c.opt_["fields"]; ok {
2358
params.Set("fields", fmt.Sprintf("%v", v))
2360
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
2361
if c.media_ != nil {
2362
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
2363
params.Set("uploadType", "multipart")
2365
urls += "?" + params.Encode()
2366
contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
2367
req, _ := http.NewRequest("PUT", urls, body)
2368
googleapi.Expand(req.URL, map[string]string{
2372
req.ContentLength = contentLength_
2374
req.Header.Set("Content-Type", ctype)
2375
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2376
res, err := c.s.client.Do(req)
2380
defer googleapi.CloseBody(res)
2381
if err := googleapi.CheckResponse(res); err != nil {
2384
var ret *TimelineItem
2385
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
2390
// "description": "Updates a timeline item in place.",
2391
// "httpMethod": "PUT",
2392
// "id": "mirror.timeline.update",
2399
// "maxSize": "10MB",
2402
// "multipart": true,
2403
// "path": "/resumable/upload/mirror/v1/timeline/{id}"
2406
// "multipart": true,
2407
// "path": "/upload/mirror/v1/timeline/{id}"
2411
// "parameterOrder": [
2416
// "description": "The ID of the timeline item.",
2417
// "location": "path",
2418
// "required": true,
2422
// "path": "timeline/{id}",
2424
// "$ref": "TimelineItem"
2427
// "$ref": "TimelineItem"
2430
// "https://www.googleapis.com/auth/glass.location",
2431
// "https://www.googleapis.com/auth/glass.timeline"
2433
// "supportsMediaUpload": true
2438
// method id "mirror.timeline.attachments.delete":
2440
type TimelineAttachmentsDeleteCall struct {
2444
opt_ map[string]interface{}
2447
// Delete: Deletes an attachment from a timeline item.
2448
func (r *TimelineAttachmentsService) Delete(itemId string, attachmentId string) *TimelineAttachmentsDeleteCall {
2449
c := &TimelineAttachmentsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
2451
c.attachmentId = attachmentId
2455
// Fields allows partial responses to be retrieved.
2456
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2457
// for more information.
2458
func (c *TimelineAttachmentsDeleteCall) Fields(s ...googleapi.Field) *TimelineAttachmentsDeleteCall {
2459
c.opt_["fields"] = googleapi.CombineFields(s)
2463
func (c *TimelineAttachmentsDeleteCall) Do() error {
2464
var body io.Reader = nil
2465
params := make(url.Values)
2466
params.Set("alt", "json")
2467
if v, ok := c.opt_["fields"]; ok {
2468
params.Set("fields", fmt.Sprintf("%v", v))
2470
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments/{attachmentId}")
2471
urls += "?" + params.Encode()
2472
req, _ := http.NewRequest("DELETE", urls, body)
2473
googleapi.Expand(req.URL, map[string]string{
2475
"attachmentId": c.attachmentId,
2477
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2478
res, err := c.s.client.Do(req)
2482
defer googleapi.CloseBody(res)
2483
if err := googleapi.CheckResponse(res); err != nil {
2488
// "description": "Deletes an attachment from a timeline item.",
2489
// "httpMethod": "DELETE",
2490
// "id": "mirror.timeline.attachments.delete",
2491
// "parameterOrder": [
2496
// "attachmentId": {
2497
// "description": "The ID of the attachment.",
2498
// "location": "path",
2499
// "required": true,
2503
// "description": "The ID of the timeline item the attachment belongs to.",
2504
// "location": "path",
2505
// "required": true,
2509
// "path": "timeline/{itemId}/attachments/{attachmentId}",
2511
// "https://www.googleapis.com/auth/glass.timeline"
2517
// method id "mirror.timeline.attachments.get":
2519
type TimelineAttachmentsGetCall struct {
2523
opt_ map[string]interface{}
2526
// Get: Retrieves an attachment on a timeline item by item ID and
2528
func (r *TimelineAttachmentsService) Get(itemId string, attachmentId string) *TimelineAttachmentsGetCall {
2529
c := &TimelineAttachmentsGetCall{s: r.s, opt_: make(map[string]interface{})}
2531
c.attachmentId = attachmentId
2535
// Fields allows partial responses to be retrieved.
2536
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2537
// for more information.
2538
func (c *TimelineAttachmentsGetCall) Fields(s ...googleapi.Field) *TimelineAttachmentsGetCall {
2539
c.opt_["fields"] = googleapi.CombineFields(s)
2543
func (c *TimelineAttachmentsGetCall) Do() (*Attachment, error) {
2544
var body io.Reader = nil
2545
params := make(url.Values)
2546
params.Set("alt", "json")
2547
if v, ok := c.opt_["fields"]; ok {
2548
params.Set("fields", fmt.Sprintf("%v", v))
2550
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments/{attachmentId}")
2551
urls += "?" + params.Encode()
2552
req, _ := http.NewRequest("GET", urls, body)
2553
googleapi.Expand(req.URL, map[string]string{
2555
"attachmentId": c.attachmentId,
2557
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2558
res, err := c.s.client.Do(req)
2562
defer googleapi.CloseBody(res)
2563
if err := googleapi.CheckResponse(res); err != nil {
2567
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
2572
// "description": "Retrieves an attachment on a timeline item by item ID and attachment ID.",
2573
// "httpMethod": "GET",
2574
// "id": "mirror.timeline.attachments.get",
2575
// "parameterOrder": [
2580
// "attachmentId": {
2581
// "description": "The ID of the attachment.",
2582
// "location": "path",
2583
// "required": true,
2587
// "description": "The ID of the timeline item the attachment belongs to.",
2588
// "location": "path",
2589
// "required": true,
2593
// "path": "timeline/{itemId}/attachments/{attachmentId}",
2595
// "$ref": "Attachment"
2598
// "https://www.googleapis.com/auth/glass.timeline"
2600
// "supportsMediaDownload": true
2605
// method id "mirror.timeline.attachments.insert":
2607
type TimelineAttachmentsInsertCall struct {
2610
opt_ map[string]interface{}
2614
// Insert: Adds a new attachment to a timeline item.
2615
func (r *TimelineAttachmentsService) Insert(itemId string) *TimelineAttachmentsInsertCall {
2616
c := &TimelineAttachmentsInsertCall{s: r.s, opt_: make(map[string]interface{})}
2620
func (c *TimelineAttachmentsInsertCall) Media(r io.Reader) *TimelineAttachmentsInsertCall {
2625
// Fields allows partial responses to be retrieved.
2626
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2627
// for more information.
2628
func (c *TimelineAttachmentsInsertCall) Fields(s ...googleapi.Field) *TimelineAttachmentsInsertCall {
2629
c.opt_["fields"] = googleapi.CombineFields(s)
2633
func (c *TimelineAttachmentsInsertCall) Do() (*Attachment, error) {
2634
var body io.Reader = nil
2635
params := make(url.Values)
2636
params.Set("alt", "json")
2637
if v, ok := c.opt_["fields"]; ok {
2638
params.Set("fields", fmt.Sprintf("%v", v))
2640
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments")
2641
if c.media_ != nil {
2642
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
2643
params.Set("uploadType", "multipart")
2645
urls += "?" + params.Encode()
2646
body = new(bytes.Buffer)
2647
ctype := "application/json"
2648
contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
2649
req, _ := http.NewRequest("POST", urls, body)
2650
googleapi.Expand(req.URL, map[string]string{
2654
req.ContentLength = contentLength_
2656
req.Header.Set("Content-Type", ctype)
2657
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2658
res, err := c.s.client.Do(req)
2662
defer googleapi.CloseBody(res)
2663
if err := googleapi.CheckResponse(res); err != nil {
2667
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
2672
// "description": "Adds a new attachment to a timeline item.",
2673
// "httpMethod": "POST",
2674
// "id": "mirror.timeline.attachments.insert",
2681
// "maxSize": "10MB",
2684
// "multipart": true,
2685
// "path": "/resumable/upload/mirror/v1/timeline/{itemId}/attachments"
2688
// "multipart": true,
2689
// "path": "/upload/mirror/v1/timeline/{itemId}/attachments"
2693
// "parameterOrder": [
2698
// "description": "The ID of the timeline item the attachment belongs to.",
2699
// "location": "path",
2700
// "required": true,
2704
// "path": "timeline/{itemId}/attachments",
2706
// "$ref": "Attachment"
2709
// "https://www.googleapis.com/auth/glass.timeline"
2711
// "supportsMediaUpload": true
2716
// method id "mirror.timeline.attachments.list":
2718
type TimelineAttachmentsListCall struct {
2721
opt_ map[string]interface{}
2724
// List: Returns a list of attachments for a timeline item.
2725
func (r *TimelineAttachmentsService) List(itemId string) *TimelineAttachmentsListCall {
2726
c := &TimelineAttachmentsListCall{s: r.s, opt_: make(map[string]interface{})}
2731
// Fields allows partial responses to be retrieved.
2732
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2733
// for more information.
2734
func (c *TimelineAttachmentsListCall) Fields(s ...googleapi.Field) *TimelineAttachmentsListCall {
2735
c.opt_["fields"] = googleapi.CombineFields(s)
2739
func (c *TimelineAttachmentsListCall) Do() (*AttachmentsListResponse, error) {
2740
var body io.Reader = nil
2741
params := make(url.Values)
2742
params.Set("alt", "json")
2743
if v, ok := c.opt_["fields"]; ok {
2744
params.Set("fields", fmt.Sprintf("%v", v))
2746
urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments")
2747
urls += "?" + params.Encode()
2748
req, _ := http.NewRequest("GET", urls, body)
2749
googleapi.Expand(req.URL, map[string]string{
2752
req.Header.Set("User-Agent", "google-api-go-client/0.5")
2753
res, err := c.s.client.Do(req)
2757
defer googleapi.CloseBody(res)
2758
if err := googleapi.CheckResponse(res); err != nil {
2761
var ret *AttachmentsListResponse
2762
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
2767
// "description": "Returns a list of attachments for a timeline item.",
2768
// "httpMethod": "GET",
2769
// "id": "mirror.timeline.attachments.list",
2770
// "parameterOrder": [
2775
// "description": "The ID of the timeline item whose attachments should be listed.",
2776
// "location": "path",
2777
// "required": true,
2781
// "path": "timeline/{itemId}/attachments",
2783
// "$ref": "AttachmentsListResponse"
2786
// "https://www.googleapis.com/auth/glass.timeline"