You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4816 lines
155 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package mirror provides access to the Google Mirror API.
  6. //
  7. // For product documentation, see: https://developers.google.com/glass
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/mirror/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // mirrorService, err := mirror.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // mirrorService, err := mirror.NewService(ctx, option.WithScopes(mirror.GlassTimelineScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // mirrorService, err := mirror.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // mirrorService, err := mirror.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package mirror // import "google.golang.org/api/mirror/v1"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "mirror:v1"
  71. const apiName = "mirror"
  72. const apiVersion = "v1"
  73. const basePath = "https://www.googleapis.com/mirror/v1/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View your location
  77. GlassLocationScope = "https://www.googleapis.com/auth/glass.location"
  78. // View and manage your Glass timeline
  79. GlassTimelineScope = "https://www.googleapis.com/auth/glass.timeline"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/glass.location",
  85. "https://www.googleapis.com/auth/glass.timeline",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Accounts = NewAccountsService(s)
  113. s.Contacts = NewContactsService(s)
  114. s.Locations = NewLocationsService(s)
  115. s.Settings = NewSettingsService(s)
  116. s.Subscriptions = NewSubscriptionsService(s)
  117. s.Timeline = NewTimelineService(s)
  118. return s, nil
  119. }
  120. type Service struct {
  121. client *http.Client
  122. BasePath string // API endpoint base URL
  123. UserAgent string // optional additional User-Agent fragment
  124. Accounts *AccountsService
  125. Contacts *ContactsService
  126. Locations *LocationsService
  127. Settings *SettingsService
  128. Subscriptions *SubscriptionsService
  129. Timeline *TimelineService
  130. }
  131. func (s *Service) userAgent() string {
  132. if s.UserAgent == "" {
  133. return googleapi.UserAgent
  134. }
  135. return googleapi.UserAgent + " " + s.UserAgent
  136. }
  137. func NewAccountsService(s *Service) *AccountsService {
  138. rs := &AccountsService{s: s}
  139. return rs
  140. }
  141. type AccountsService struct {
  142. s *Service
  143. }
  144. func NewContactsService(s *Service) *ContactsService {
  145. rs := &ContactsService{s: s}
  146. return rs
  147. }
  148. type ContactsService struct {
  149. s *Service
  150. }
  151. func NewLocationsService(s *Service) *LocationsService {
  152. rs := &LocationsService{s: s}
  153. return rs
  154. }
  155. type LocationsService struct {
  156. s *Service
  157. }
  158. func NewSettingsService(s *Service) *SettingsService {
  159. rs := &SettingsService{s: s}
  160. return rs
  161. }
  162. type SettingsService struct {
  163. s *Service
  164. }
  165. func NewSubscriptionsService(s *Service) *SubscriptionsService {
  166. rs := &SubscriptionsService{s: s}
  167. return rs
  168. }
  169. type SubscriptionsService struct {
  170. s *Service
  171. }
  172. func NewTimelineService(s *Service) *TimelineService {
  173. rs := &TimelineService{s: s}
  174. rs.Attachments = NewTimelineAttachmentsService(s)
  175. return rs
  176. }
  177. type TimelineService struct {
  178. s *Service
  179. Attachments *TimelineAttachmentsService
  180. }
  181. func NewTimelineAttachmentsService(s *Service) *TimelineAttachmentsService {
  182. rs := &TimelineAttachmentsService{s: s}
  183. return rs
  184. }
  185. type TimelineAttachmentsService struct {
  186. s *Service
  187. }
  188. // Account: Represents an account passed into the Account Manager on
  189. // Glass.
  190. type Account struct {
  191. AuthTokens []*AuthToken `json:"authTokens,omitempty"`
  192. Features []string `json:"features,omitempty"`
  193. Password string `json:"password,omitempty"`
  194. UserData []*UserData `json:"userData,omitempty"`
  195. // ServerResponse contains the HTTP response code and headers from the
  196. // server.
  197. googleapi.ServerResponse `json:"-"`
  198. // ForceSendFields is a list of field names (e.g. "AuthTokens") to
  199. // unconditionally include in API requests. By default, fields with
  200. // empty values are omitted from API requests. However, any non-pointer,
  201. // non-interface field appearing in ForceSendFields will be sent to the
  202. // server regardless of whether the field is empty or not. This may be
  203. // used to include empty fields in Patch requests.
  204. ForceSendFields []string `json:"-"`
  205. // NullFields is a list of field names (e.g. "AuthTokens") to include in
  206. // API requests with the JSON null value. By default, fields with empty
  207. // values are omitted from API requests. However, any field with an
  208. // empty value appearing in NullFields will be sent to the server as
  209. // null. It is an error if a field in this list has a non-empty value.
  210. // This may be used to include null fields in Patch requests.
  211. NullFields []string `json:"-"`
  212. }
  213. func (s *Account) MarshalJSON() ([]byte, error) {
  214. type NoMethod Account
  215. raw := NoMethod(*s)
  216. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  217. }
  218. // Attachment: Represents media content, such as a photo, that can be
  219. // attached to a timeline item.
  220. type Attachment struct {
  221. // ContentType: The MIME type of the attachment.
  222. ContentType string `json:"contentType,omitempty"`
  223. // ContentUrl: The URL for the content.
  224. ContentUrl string `json:"contentUrl,omitempty"`
  225. // Id: The ID of the attachment.
  226. Id string `json:"id,omitempty"`
  227. // IsProcessingContent: Indicates that the contentUrl is not available
  228. // because the attachment content is still being processed. If the
  229. // caller wishes to retrieve the content, it should try again later.
  230. IsProcessingContent bool `json:"isProcessingContent,omitempty"`
  231. // ServerResponse contains the HTTP response code and headers from the
  232. // server.
  233. googleapi.ServerResponse `json:"-"`
  234. // ForceSendFields is a list of field names (e.g. "ContentType") to
  235. // unconditionally include in API requests. By default, fields with
  236. // empty values are omitted from API requests. However, any non-pointer,
  237. // non-interface field appearing in ForceSendFields will be sent to the
  238. // server regardless of whether the field is empty or not. This may be
  239. // used to include empty fields in Patch requests.
  240. ForceSendFields []string `json:"-"`
  241. // NullFields is a list of field names (e.g. "ContentType") to include
  242. // in API requests with the JSON null value. By default, fields with
  243. // empty values are omitted from API requests. However, any field with
  244. // an empty value appearing in NullFields will be sent to the server as
  245. // null. It is an error if a field in this list has a non-empty value.
  246. // This may be used to include null fields in Patch requests.
  247. NullFields []string `json:"-"`
  248. }
  249. func (s *Attachment) MarshalJSON() ([]byte, error) {
  250. type NoMethod Attachment
  251. raw := NoMethod(*s)
  252. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  253. }
  254. // AttachmentsListResponse: A list of Attachments. This is the response
  255. // from the server to GET requests on the attachments collection.
  256. type AttachmentsListResponse struct {
  257. // Items: The list of attachments.
  258. Items []*Attachment `json:"items,omitempty"`
  259. // Kind: The type of resource. This is always mirror#attachmentsList.
  260. Kind string `json:"kind,omitempty"`
  261. // ServerResponse contains the HTTP response code and headers from the
  262. // server.
  263. googleapi.ServerResponse `json:"-"`
  264. // ForceSendFields is a list of field names (e.g. "Items") to
  265. // unconditionally include in API requests. By default, fields with
  266. // empty values are omitted from API requests. However, any non-pointer,
  267. // non-interface field appearing in ForceSendFields will be sent to the
  268. // server regardless of whether the field is empty or not. This may be
  269. // used to include empty fields in Patch requests.
  270. ForceSendFields []string `json:"-"`
  271. // NullFields is a list of field names (e.g. "Items") to include in API
  272. // requests with the JSON null value. By default, fields with empty
  273. // values are omitted from API requests. However, any field with an
  274. // empty value appearing in NullFields will be sent to the server as
  275. // null. It is an error if a field in this list has a non-empty value.
  276. // This may be used to include null fields in Patch requests.
  277. NullFields []string `json:"-"`
  278. }
  279. func (s *AttachmentsListResponse) MarshalJSON() ([]byte, error) {
  280. type NoMethod AttachmentsListResponse
  281. raw := NoMethod(*s)
  282. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  283. }
  284. type AuthToken struct {
  285. AuthToken string `json:"authToken,omitempty"`
  286. Type string `json:"type,omitempty"`
  287. // ForceSendFields is a list of field names (e.g. "AuthToken") to
  288. // unconditionally include in API requests. By default, fields with
  289. // empty values are omitted from API requests. However, any non-pointer,
  290. // non-interface field appearing in ForceSendFields will be sent to the
  291. // server regardless of whether the field is empty or not. This may be
  292. // used to include empty fields in Patch requests.
  293. ForceSendFields []string `json:"-"`
  294. // NullFields is a list of field names (e.g. "AuthToken") to include in
  295. // API requests with the JSON null value. By default, fields with empty
  296. // values are omitted from API requests. However, any field with an
  297. // empty value appearing in NullFields will be sent to the server as
  298. // null. It is an error if a field in this list has a non-empty value.
  299. // This may be used to include null fields in Patch requests.
  300. NullFields []string `json:"-"`
  301. }
  302. func (s *AuthToken) MarshalJSON() ([]byte, error) {
  303. type NoMethod AuthToken
  304. raw := NoMethod(*s)
  305. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  306. }
  307. // Command: A single menu command that is part of a Contact.
  308. type Command struct {
  309. // Type: The type of operation this command corresponds to. Allowed
  310. // values are:
  311. // - TAKE_A_NOTE - Shares a timeline item with the transcription of user
  312. // speech from the "Take a note" voice menu command.
  313. // - POST_AN_UPDATE - Shares a timeline item with the transcription of
  314. // user speech from the "Post an update" voice menu command.
  315. Type string `json:"type,omitempty"`
  316. // ForceSendFields is a list of field names (e.g. "Type") to
  317. // unconditionally include in API requests. By default, fields with
  318. // empty values are omitted from API requests. However, any non-pointer,
  319. // non-interface field appearing in ForceSendFields will be sent to the
  320. // server regardless of whether the field is empty or not. This may be
  321. // used to include empty fields in Patch requests.
  322. ForceSendFields []string `json:"-"`
  323. // NullFields is a list of field names (e.g. "Type") to include in API
  324. // requests with the JSON null value. By default, fields with empty
  325. // values are omitted from API requests. However, any field with an
  326. // empty value appearing in NullFields will be sent to the server as
  327. // null. It is an error if a field in this list has a non-empty value.
  328. // This may be used to include null fields in Patch requests.
  329. NullFields []string `json:"-"`
  330. }
  331. func (s *Command) MarshalJSON() ([]byte, error) {
  332. type NoMethod Command
  333. raw := NoMethod(*s)
  334. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  335. }
  336. // Contact: A person or group that can be used as a creator or a
  337. // contact.
  338. type Contact struct {
  339. // AcceptCommands: A list of voice menu commands that a contact can
  340. // handle. Glass shows up to three contacts for each voice menu command.
  341. // If there are more than that, the three contacts with the highest
  342. // priority are shown for that particular command.
  343. AcceptCommands []*Command `json:"acceptCommands,omitempty"`
  344. // AcceptTypes: A list of MIME types that a contact supports. The
  345. // contact will be shown to the user if any of its acceptTypes matches
  346. // any of the types of the attachments on the item. If no acceptTypes
  347. // are given, the contact will be shown for all items.
  348. AcceptTypes []string `json:"acceptTypes,omitempty"`
  349. // DisplayName: The name to display for this contact.
  350. DisplayName string `json:"displayName,omitempty"`
  351. // Id: An ID for this contact. This is generated by the application and
  352. // is treated as an opaque token.
  353. Id string `json:"id,omitempty"`
  354. // ImageUrls: Set of image URLs to display for a contact. Most contacts
  355. // will have a single image, but a "group" contact may include up to 8
  356. // image URLs and they will be resized and cropped into a mosaic on the
  357. // client.
  358. ImageUrls []string `json:"imageUrls,omitempty"`
  359. // Kind: The type of resource. This is always mirror#contact.
  360. Kind string `json:"kind,omitempty"`
  361. // PhoneNumber: Primary phone number for the contact. This can be a
  362. // fully-qualified number, with country calling code and area code, or a
  363. // local number.
  364. PhoneNumber string `json:"phoneNumber,omitempty"`
  365. // Priority: Priority for the contact to determine ordering in a list of
  366. // contacts. Contacts with higher priorities will be shown before ones
  367. // with lower priorities.
  368. Priority int64 `json:"priority,omitempty"`
  369. // SharingFeatures: A list of sharing features that a contact can
  370. // handle. Allowed values are:
  371. // - ADD_CAPTION
  372. SharingFeatures []string `json:"sharingFeatures,omitempty"`
  373. // Source: The ID of the application that created this contact. This is
  374. // populated by the API
  375. Source string `json:"source,omitempty"`
  376. // SpeakableName: Name of this contact as it should be pronounced. If
  377. // this contact's name must be spoken as part of a voice disambiguation
  378. // menu, this name is used as the expected pronunciation. This is useful
  379. // for contact names with unpronounceable characters or whose display
  380. // spelling is otherwise not phonetic.
  381. SpeakableName string `json:"speakableName,omitempty"`
  382. // Type: The type for this contact. This is used for sorting in UIs.
  383. // Allowed values are:
  384. // - INDIVIDUAL - Represents a single person. This is the default.
  385. // - GROUP - Represents more than a single person.
  386. Type string `json:"type,omitempty"`
  387. // ServerResponse contains the HTTP response code and headers from the
  388. // server.
  389. googleapi.ServerResponse `json:"-"`
  390. // ForceSendFields is a list of field names (e.g. "AcceptCommands") to
  391. // unconditionally include in API requests. By default, fields with
  392. // empty values are omitted from API requests. However, any non-pointer,
  393. // non-interface field appearing in ForceSendFields will be sent to the
  394. // server regardless of whether the field is empty or not. This may be
  395. // used to include empty fields in Patch requests.
  396. ForceSendFields []string `json:"-"`
  397. // NullFields is a list of field names (e.g. "AcceptCommands") to
  398. // include in API requests with the JSON null value. By default, fields
  399. // with empty values are omitted from API requests. However, any field
  400. // with an empty value appearing in NullFields will be sent to the
  401. // server as null. It is an error if a field in this list has a
  402. // non-empty value. This may be used to include null fields in Patch
  403. // requests.
  404. NullFields []string `json:"-"`
  405. }
  406. func (s *Contact) MarshalJSON() ([]byte, error) {
  407. type NoMethod Contact
  408. raw := NoMethod(*s)
  409. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  410. }
  411. // ContactsListResponse: A list of Contacts representing contacts. This
  412. // is the response from the server to GET requests on the contacts
  413. // collection.
  414. type ContactsListResponse struct {
  415. // Items: Contact list.
  416. Items []*Contact `json:"items,omitempty"`
  417. // Kind: The type of resource. This is always mirror#contacts.
  418. Kind string `json:"kind,omitempty"`
  419. // ServerResponse contains the HTTP response code and headers from the
  420. // server.
  421. googleapi.ServerResponse `json:"-"`
  422. // ForceSendFields is a list of field names (e.g. "Items") to
  423. // unconditionally include in API requests. By default, fields with
  424. // empty values are omitted from API requests. However, any non-pointer,
  425. // non-interface field appearing in ForceSendFields will be sent to the
  426. // server regardless of whether the field is empty or not. This may be
  427. // used to include empty fields in Patch requests.
  428. ForceSendFields []string `json:"-"`
  429. // NullFields is a list of field names (e.g. "Items") to include in API
  430. // requests with the JSON null value. By default, fields with empty
  431. // values are omitted from API requests. However, any field with an
  432. // empty value appearing in NullFields will be sent to the server as
  433. // null. It is an error if a field in this list has a non-empty value.
  434. // This may be used to include null fields in Patch requests.
  435. NullFields []string `json:"-"`
  436. }
  437. func (s *ContactsListResponse) MarshalJSON() ([]byte, error) {
  438. type NoMethod ContactsListResponse
  439. raw := NoMethod(*s)
  440. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  441. }
  442. // Location: A geographic location that can be associated with a
  443. // timeline item.
  444. type Location struct {
  445. // Accuracy: The accuracy of the location fix in meters.
  446. Accuracy float64 `json:"accuracy,omitempty"`
  447. // Address: The full address of the location.
  448. Address string `json:"address,omitempty"`
  449. // DisplayName: The name to be displayed. This may be a business name or
  450. // a user-defined place, such as "Home".
  451. DisplayName string `json:"displayName,omitempty"`
  452. // Id: The ID of the location.
  453. Id string `json:"id,omitempty"`
  454. // Kind: The type of resource. This is always mirror#location.
  455. Kind string `json:"kind,omitempty"`
  456. // Latitude: The latitude, in degrees.
  457. Latitude float64 `json:"latitude,omitempty"`
  458. // Longitude: The longitude, in degrees.
  459. Longitude float64 `json:"longitude,omitempty"`
  460. // Timestamp: The time at which this location was captured, formatted
  461. // according to RFC 3339.
  462. Timestamp string `json:"timestamp,omitempty"`
  463. // ServerResponse contains the HTTP response code and headers from the
  464. // server.
  465. googleapi.ServerResponse `json:"-"`
  466. // ForceSendFields is a list of field names (e.g. "Accuracy") to
  467. // unconditionally include in API requests. By default, fields with
  468. // empty values are omitted from API requests. However, any non-pointer,
  469. // non-interface field appearing in ForceSendFields will be sent to the
  470. // server regardless of whether the field is empty or not. This may be
  471. // used to include empty fields in Patch requests.
  472. ForceSendFields []string `json:"-"`
  473. // NullFields is a list of field names (e.g. "Accuracy") to include in
  474. // API requests with the JSON null value. By default, fields with empty
  475. // values are omitted from API requests. However, any field with an
  476. // empty value appearing in NullFields will be sent to the server as
  477. // null. It is an error if a field in this list has a non-empty value.
  478. // This may be used to include null fields in Patch requests.
  479. NullFields []string `json:"-"`
  480. }
  481. func (s *Location) MarshalJSON() ([]byte, error) {
  482. type NoMethod Location
  483. raw := NoMethod(*s)
  484. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  485. }
  486. func (s *Location) UnmarshalJSON(data []byte) error {
  487. type NoMethod Location
  488. var s1 struct {
  489. Accuracy gensupport.JSONFloat64 `json:"accuracy"`
  490. Latitude gensupport.JSONFloat64 `json:"latitude"`
  491. Longitude gensupport.JSONFloat64 `json:"longitude"`
  492. *NoMethod
  493. }
  494. s1.NoMethod = (*NoMethod)(s)
  495. if err := json.Unmarshal(data, &s1); err != nil {
  496. return err
  497. }
  498. s.Accuracy = float64(s1.Accuracy)
  499. s.Latitude = float64(s1.Latitude)
  500. s.Longitude = float64(s1.Longitude)
  501. return nil
  502. }
  503. // LocationsListResponse: A list of Locations. This is the response from
  504. // the server to GET requests on the locations collection.
  505. type LocationsListResponse struct {
  506. // Items: The list of locations.
  507. Items []*Location `json:"items,omitempty"`
  508. // Kind: The type of resource. This is always mirror#locationsList.
  509. Kind string `json:"kind,omitempty"`
  510. // ServerResponse contains the HTTP response code and headers from the
  511. // server.
  512. googleapi.ServerResponse `json:"-"`
  513. // ForceSendFields is a list of field names (e.g. "Items") to
  514. // unconditionally include in API requests. By default, fields with
  515. // empty values are omitted from API requests. However, any non-pointer,
  516. // non-interface field appearing in ForceSendFields will be sent to the
  517. // server regardless of whether the field is empty or not. This may be
  518. // used to include empty fields in Patch requests.
  519. ForceSendFields []string `json:"-"`
  520. // NullFields is a list of field names (e.g. "Items") to include in API
  521. // requests with the JSON null value. By default, fields with empty
  522. // values are omitted from API requests. However, any field with an
  523. // empty value appearing in NullFields will be sent to the server as
  524. // null. It is an error if a field in this list has a non-empty value.
  525. // This may be used to include null fields in Patch requests.
  526. NullFields []string `json:"-"`
  527. }
  528. func (s *LocationsListResponse) MarshalJSON() ([]byte, error) {
  529. type NoMethod LocationsListResponse
  530. raw := NoMethod(*s)
  531. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  532. }
  533. // MenuItem: A custom menu item that can be presented to the user by a
  534. // timeline item.
  535. type MenuItem struct {
  536. // Action: Controls the behavior when the user picks the menu option.
  537. // Allowed values are:
  538. // - CUSTOM - Custom action set by the service. When the user selects
  539. // this menuItem, the API triggers a notification to your callbackUrl
  540. // with the userActions.type set to CUSTOM and the userActions.payload
  541. // set to the ID of this menu item. This is the default value.
  542. // - Built-in actions:
  543. // - REPLY - Initiate a reply to the timeline item using the voice
  544. // recording UI. The creator attribute must be set in the timeline item
  545. // for this menu to be available.
  546. // - REPLY_ALL - Same behavior as REPLY. The original timeline item's
  547. // recipients will be added to the reply item.
  548. // - DELETE - Delete the timeline item.
  549. // - SHARE - Share the timeline item with the available contacts.
  550. // - READ_ALOUD - Read the timeline item's speakableText aloud; if this
  551. // field is not set, read the text field; if none of those fields are
  552. // set, this menu item is ignored.
  553. // - GET_MEDIA_INPUT - Allow users to provide media payloads to
  554. // Glassware from a menu item (currently, only transcribed text from
  555. // voice input is supported). Subscribe to notifications when users
  556. // invoke this menu item to receive the timeline item ID. Retrieve the
  557. // media from the timeline item in the payload property.
  558. // - VOICE_CALL - Initiate a phone call using the timeline item's
  559. // creator.phoneNumber attribute as recipient.
  560. // - NAVIGATE - Navigate to the timeline item's location.
  561. // - TOGGLE_PINNED - Toggle the isPinned state of the timeline item.
  562. // - OPEN_URI - Open the payload of the menu item in the browser.
  563. // - PLAY_VIDEO - Open the payload of the menu item in the Glass video
  564. // player.
  565. // - SEND_MESSAGE - Initiate sending a message to the timeline item's
  566. // creator:
  567. // - If the creator.phoneNumber is set and Glass is connected to an
  568. // Android phone, the message is an SMS.
  569. // - Otherwise, if the creator.email is set, the message is an email.
  570. Action string `json:"action,omitempty"`
  571. // ContextualCommand: The ContextualMenus.Command associated with this
  572. // MenuItem (e.g. READ_ALOUD). The voice label for this command will be
  573. // displayed in the voice menu and the touch label will be displayed in
  574. // the touch menu. Note that the default menu value's display name will
  575. // be overriden if you specify this property. Values that do not
  576. // correspond to a ContextualMenus.Command name will be ignored.
  577. ContextualCommand string `json:"contextual_command,omitempty"`
  578. // Id: The ID for this menu item. This is generated by the application
  579. // and is treated as an opaque token.
  580. Id string `json:"id,omitempty"`
  581. // Payload: A generic payload whose meaning changes depending on this
  582. // MenuItem's action.
  583. // - When the action is OPEN_URI, the payload is the URL of the website
  584. // to view.
  585. // - When the action is PLAY_VIDEO, the payload is the streaming URL of
  586. // the video
  587. // - When the action is GET_MEDIA_INPUT, the payload is the text
  588. // transcription of a user's speech input
  589. Payload string `json:"payload,omitempty"`
  590. // RemoveWhenSelected: If set to true on a CUSTOM menu item, that item
  591. // will be removed from the menu after it is selected.
  592. RemoveWhenSelected bool `json:"removeWhenSelected,omitempty"`
  593. // Values: For CUSTOM items, a list of values controlling the appearance
  594. // of the menu item in each of its states. A value for the DEFAULT state
  595. // must be provided. If the PENDING or CONFIRMED states are missing,
  596. // they will not be shown.
  597. Values []*MenuValue `json:"values,omitempty"`
  598. // ForceSendFields is a list of field names (e.g. "Action") to
  599. // unconditionally include in API requests. By default, fields with
  600. // empty values are omitted from API requests. However, any non-pointer,
  601. // non-interface field appearing in ForceSendFields will be sent to the
  602. // server regardless of whether the field is empty or not. This may be
  603. // used to include empty fields in Patch requests.
  604. ForceSendFields []string `json:"-"`
  605. // NullFields is a list of field names (e.g. "Action") to include in API
  606. // requests with the JSON null value. By default, fields with empty
  607. // values are omitted from API requests. However, any field with an
  608. // empty value appearing in NullFields will be sent to the server as
  609. // null. It is an error if a field in this list has a non-empty value.
  610. // This may be used to include null fields in Patch requests.
  611. NullFields []string `json:"-"`
  612. }
  613. func (s *MenuItem) MarshalJSON() ([]byte, error) {
  614. type NoMethod MenuItem
  615. raw := NoMethod(*s)
  616. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  617. }
  618. // MenuValue: A single value that is part of a MenuItem.
  619. type MenuValue struct {
  620. // DisplayName: The name to display for the menu item. If you specify
  621. // this property for a built-in menu item, the default contextual voice
  622. // command for that menu item is not shown.
  623. DisplayName string `json:"displayName,omitempty"`
  624. // IconUrl: URL of an icon to display with the menu item.
  625. IconUrl string `json:"iconUrl,omitempty"`
  626. // State: The state that this value applies to. Allowed values are:
  627. // - DEFAULT - Default value shown when displayed in the menuItems list.
  628. //
  629. // - PENDING - Value shown when the menuItem has been selected by the
  630. // user but can still be cancelled.
  631. // - CONFIRMED - Value shown when the menuItem has been selected by the
  632. // user and can no longer be cancelled.
  633. State string `json:"state,omitempty"`
  634. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  635. // unconditionally include in API requests. By default, fields with
  636. // empty values are omitted from API requests. However, any non-pointer,
  637. // non-interface field appearing in ForceSendFields will be sent to the
  638. // server regardless of whether the field is empty or not. This may be
  639. // used to include empty fields in Patch requests.
  640. ForceSendFields []string `json:"-"`
  641. // NullFields is a list of field names (e.g. "DisplayName") to include
  642. // in API requests with the JSON null value. By default, fields with
  643. // empty values are omitted from API requests. However, any field with
  644. // an empty value appearing in NullFields will be sent to the server as
  645. // null. It is an error if a field in this list has a non-empty value.
  646. // This may be used to include null fields in Patch requests.
  647. NullFields []string `json:"-"`
  648. }
  649. func (s *MenuValue) MarshalJSON() ([]byte, error) {
  650. type NoMethod MenuValue
  651. raw := NoMethod(*s)
  652. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  653. }
  654. // Notification: A notification delivered by the API.
  655. type Notification struct {
  656. // Collection: The collection that generated the notification.
  657. Collection string `json:"collection,omitempty"`
  658. // ItemId: The ID of the item that generated the notification.
  659. ItemId string `json:"itemId,omitempty"`
  660. // Operation: The type of operation that generated the notification.
  661. Operation string `json:"operation,omitempty"`
  662. // UserActions: A list of actions taken by the user that triggered the
  663. // notification.
  664. UserActions []*UserAction `json:"userActions,omitempty"`
  665. // UserToken: The user token provided by the service when it subscribed
  666. // for notifications.
  667. UserToken string `json:"userToken,omitempty"`
  668. // VerifyToken: The secret verify token provided by the service when it
  669. // subscribed for notifications.
  670. VerifyToken string `json:"verifyToken,omitempty"`
  671. // ForceSendFields is a list of field names (e.g. "Collection") to
  672. // unconditionally include in API requests. By default, fields with
  673. // empty values are omitted from API requests. However, any non-pointer,
  674. // non-interface field appearing in ForceSendFields will be sent to the
  675. // server regardless of whether the field is empty or not. This may be
  676. // used to include empty fields in Patch requests.
  677. ForceSendFields []string `json:"-"`
  678. // NullFields is a list of field names (e.g. "Collection") to include in
  679. // API requests with the JSON null value. By default, fields with empty
  680. // values are omitted from API requests. However, any field with an
  681. // empty value appearing in NullFields will be sent to the server as
  682. // null. It is an error if a field in this list has a non-empty value.
  683. // This may be used to include null fields in Patch requests.
  684. NullFields []string `json:"-"`
  685. }
  686. func (s *Notification) MarshalJSON() ([]byte, error) {
  687. type NoMethod Notification
  688. raw := NoMethod(*s)
  689. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  690. }
  691. // NotificationConfig: Controls how notifications for a timeline item
  692. // are presented to the user.
  693. type NotificationConfig struct {
  694. // DeliveryTime: The time at which the notification should be delivered.
  695. DeliveryTime string `json:"deliveryTime,omitempty"`
  696. // Level: Describes how important the notification is. Allowed values
  697. // are:
  698. // - DEFAULT - Notifications of default importance. A chime will be
  699. // played to alert users.
  700. Level string `json:"level,omitempty"`
  701. // ForceSendFields is a list of field names (e.g. "DeliveryTime") to
  702. // unconditionally include in API requests. By default, fields with
  703. // empty values are omitted from API requests. However, any non-pointer,
  704. // non-interface field appearing in ForceSendFields will be sent to the
  705. // server regardless of whether the field is empty or not. This may be
  706. // used to include empty fields in Patch requests.
  707. ForceSendFields []string `json:"-"`
  708. // NullFields is a list of field names (e.g. "DeliveryTime") to include
  709. // in API requests with the JSON null value. By default, fields with
  710. // empty values are omitted from API requests. However, any field with
  711. // an empty value appearing in NullFields will be sent to the server as
  712. // null. It is an error if a field in this list has a non-empty value.
  713. // This may be used to include null fields in Patch requests.
  714. NullFields []string `json:"-"`
  715. }
  716. func (s *NotificationConfig) MarshalJSON() ([]byte, error) {
  717. type NoMethod NotificationConfig
  718. raw := NoMethod(*s)
  719. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  720. }
  721. // Setting: A setting for Glass.
  722. type Setting struct {
  723. // Id: The setting's ID. The following IDs are valid:
  724. // - locale - The key to the user’s language/locale (BCP 47
  725. // identifier) that Glassware should use to render localized content.
  726. //
  727. // - timezone - The key to the user’s current time zone region as
  728. // defined in the tz database. Example: America/Los_Angeles.
  729. Id string `json:"id,omitempty"`
  730. // Kind: The type of resource. This is always mirror#setting.
  731. Kind string `json:"kind,omitempty"`
  732. // Value: The setting value, as a string.
  733. Value string `json:"value,omitempty"`
  734. // ServerResponse contains the HTTP response code and headers from the
  735. // server.
  736. googleapi.ServerResponse `json:"-"`
  737. // ForceSendFields is a list of field names (e.g. "Id") to
  738. // unconditionally include in API requests. By default, fields with
  739. // empty values are omitted from API requests. However, any non-pointer,
  740. // non-interface field appearing in ForceSendFields will be sent to the
  741. // server regardless of whether the field is empty or not. This may be
  742. // used to include empty fields in Patch requests.
  743. ForceSendFields []string `json:"-"`
  744. // NullFields is a list of field names (e.g. "Id") to include in API
  745. // requests with the JSON null value. By default, fields with empty
  746. // values are omitted from API requests. However, any field with an
  747. // empty value appearing in NullFields will be sent to the server as
  748. // null. It is an error if a field in this list has a non-empty value.
  749. // This may be used to include null fields in Patch requests.
  750. NullFields []string `json:"-"`
  751. }
  752. func (s *Setting) MarshalJSON() ([]byte, error) {
  753. type NoMethod Setting
  754. raw := NoMethod(*s)
  755. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  756. }
  757. // Subscription: A subscription to events on a collection.
  758. type Subscription struct {
  759. // CallbackUrl: The URL where notifications should be delivered (must
  760. // start with https://).
  761. CallbackUrl string `json:"callbackUrl,omitempty"`
  762. // Collection: The collection to subscribe to. Allowed values are:
  763. // - timeline - Changes in the timeline including insertion, deletion,
  764. // and updates.
  765. // - locations - Location updates.
  766. // - settings - Settings updates.
  767. Collection string `json:"collection,omitempty"`
  768. // Id: The ID of the subscription.
  769. Id string `json:"id,omitempty"`
  770. // Kind: The type of resource. This is always mirror#subscription.
  771. Kind string `json:"kind,omitempty"`
  772. // Notification: Container object for notifications. This is not
  773. // populated in the Subscription resource.
  774. Notification *Notification `json:"notification,omitempty"`
  775. // Operation: A list of operations that should be subscribed to. An
  776. // empty list indicates that all operations on the collection should be
  777. // subscribed to. Allowed values are:
  778. // - UPDATE - The item has been updated.
  779. // - INSERT - A new item has been inserted.
  780. // - DELETE - The item has been deleted.
  781. // - MENU_ACTION - A custom menu item has been triggered by the user.
  782. Operation []string `json:"operation,omitempty"`
  783. // Updated: The time at which this subscription was last modified,
  784. // formatted according to RFC 3339.
  785. Updated string `json:"updated,omitempty"`
  786. // UserToken: An opaque token sent to the subscriber in notifications so
  787. // that it can determine the ID of the user.
  788. UserToken string `json:"userToken,omitempty"`
  789. // VerifyToken: A secret token sent to the subscriber in notifications
  790. // so that it can verify that the notification was generated by Google.
  791. VerifyToken string `json:"verifyToken,omitempty"`
  792. // ServerResponse contains the HTTP response code and headers from the
  793. // server.
  794. googleapi.ServerResponse `json:"-"`
  795. // ForceSendFields is a list of field names (e.g. "CallbackUrl") to
  796. // unconditionally include in API requests. By default, fields with
  797. // empty values are omitted from API requests. However, any non-pointer,
  798. // non-interface field appearing in ForceSendFields will be sent to the
  799. // server regardless of whether the field is empty or not. This may be
  800. // used to include empty fields in Patch requests.
  801. ForceSendFields []string `json:"-"`
  802. // NullFields is a list of field names (e.g. "CallbackUrl") to include
  803. // in API requests with the JSON null value. By default, fields with
  804. // empty values are omitted from API requests. However, any field with
  805. // an empty value appearing in NullFields will be sent to the server as
  806. // null. It is an error if a field in this list has a non-empty value.
  807. // This may be used to include null fields in Patch requests.
  808. NullFields []string `json:"-"`
  809. }
  810. func (s *Subscription) MarshalJSON() ([]byte, error) {
  811. type NoMethod Subscription
  812. raw := NoMethod(*s)
  813. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  814. }
  815. // SubscriptionsListResponse: A list of Subscriptions. This is the
  816. // response from the server to GET requests on the subscription
  817. // collection.
  818. type SubscriptionsListResponse struct {
  819. // Items: The list of subscriptions.
  820. Items []*Subscription `json:"items,omitempty"`
  821. // Kind: The type of resource. This is always mirror#subscriptionsList.
  822. Kind string `json:"kind,omitempty"`
  823. // ServerResponse contains the HTTP response code and headers from the
  824. // server.
  825. googleapi.ServerResponse `json:"-"`
  826. // ForceSendFields is a list of field names (e.g. "Items") to
  827. // unconditionally include in API requests. By default, fields with
  828. // empty values are omitted from API requests. However, any non-pointer,
  829. // non-interface field appearing in ForceSendFields will be sent to the
  830. // server regardless of whether the field is empty or not. This may be
  831. // used to include empty fields in Patch requests.
  832. ForceSendFields []string `json:"-"`
  833. // NullFields is a list of field names (e.g. "Items") to include in API
  834. // requests with the JSON null value. By default, fields with empty
  835. // values are omitted from API requests. However, any field with an
  836. // empty value appearing in NullFields will be sent to the server as
  837. // null. It is an error if a field in this list has a non-empty value.
  838. // This may be used to include null fields in Patch requests.
  839. NullFields []string `json:"-"`
  840. }
  841. func (s *SubscriptionsListResponse) MarshalJSON() ([]byte, error) {
  842. type NoMethod SubscriptionsListResponse
  843. raw := NoMethod(*s)
  844. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  845. }
  846. // TimelineItem: Each item in the user's timeline is represented as a
  847. // TimelineItem JSON structure, described below.
  848. type TimelineItem struct {
  849. // Attachments: A list of media attachments associated with this item.
  850. // As a convenience, you can refer to attachments in your HTML payloads
  851. // with the attachment or cid scheme. For example:
  852. // - attachment: <img src="attachment:attachment_index"> where
  853. // attachment_index is the 0-based index of this array.
  854. // - cid: <img src="cid:attachment_id"> where attachment_id is the ID of
  855. // the attachment.
  856. Attachments []*Attachment `json:"attachments,omitempty"`
  857. // BundleId: The bundle ID for this item. Services can specify a
  858. // bundleId to group many items together. They appear under a single
  859. // top-level item on the device.
  860. BundleId string `json:"bundleId,omitempty"`
  861. // CanonicalUrl: A canonical URL pointing to the canonical/high quality
  862. // version of the data represented by the timeline item.
  863. CanonicalUrl string `json:"canonicalUrl,omitempty"`
  864. // Created: The time at which this item was created, formatted according
  865. // to RFC 3339.
  866. Created string `json:"created,omitempty"`
  867. // Creator: The user or group that created this item.
  868. Creator *Contact `json:"creator,omitempty"`
  869. // DisplayTime: The time that should be displayed when this item is
  870. // viewed in the timeline, formatted according to RFC 3339. This user's
  871. // timeline is sorted chronologically on display time, so this will also
  872. // determine where the item is displayed in the timeline. If not set by
  873. // the service, the display time defaults to the updated time.
  874. DisplayTime string `json:"displayTime,omitempty"`
  875. // Etag: ETag for this item.
  876. Etag string `json:"etag,omitempty"`
  877. // Html: HTML content for this item. If both text and html are provided
  878. // for an item, the html will be rendered in the timeline.
  879. // Allowed HTML elements - You can use these elements in your timeline
  880. // cards.
  881. //
  882. // - Headers: h1, h2, h3, h4, h5, h6
  883. // - Images: img
  884. // - Lists: li, ol, ul
  885. // - HTML5 semantics: article, aside, details, figure, figcaption,
  886. // footer, header, nav, section, summary, time
  887. // - Structural: blockquote, br, div, hr, p, span
  888. // - Style: b, big, center, em, i, u, s, small, strike, strong, style,
  889. // sub, sup
  890. // - Tables: table, tbody, td, tfoot, th, thead, tr
  891. // Blocked HTML elements: These elements and their contents are removed
  892. // from HTML payloads.
  893. //
  894. // - Document headers: head, title
  895. // - Embeds: audio, embed, object, source, video
  896. // - Frames: frame, frameset
  897. // - Scripting: applet, script
  898. // Other elements: Any elements that aren't listed are removed, but
  899. // their contents are preserved.
  900. Html string `json:"html,omitempty"`
  901. // Id: The ID of the timeline item. This is unique within a user's
  902. // timeline.
  903. Id string `json:"id,omitempty"`
  904. // InReplyTo: If this item was generated as a reply to another item,
  905. // this field will be set to the ID of the item being replied to. This
  906. // can be used to attach a reply to the appropriate conversation or
  907. // post.
  908. InReplyTo string `json:"inReplyTo,omitempty"`
  909. // IsBundleCover: Whether this item is a bundle cover.
  910. //
  911. // If an item is marked as a bundle cover, it will be the entry point to
  912. // the bundle of items that have the same bundleId as that item. It will
  913. // be shown only on the main timeline — not within the opened
  914. // bundle.
  915. //
  916. // On the main timeline, items that are shown are:
  917. // - Items that have isBundleCover set to true
  918. // - Items that do not have a bundleId In a bundle sub-timeline, items
  919. // that are shown are:
  920. // - Items that have the bundleId in question AND isBundleCover set to
  921. // false
  922. IsBundleCover bool `json:"isBundleCover,omitempty"`
  923. // IsDeleted: When true, indicates this item is deleted, and only the ID
  924. // property is set.
  925. IsDeleted bool `json:"isDeleted,omitempty"`
  926. // IsPinned: When true, indicates this item is pinned, which means it's
  927. // grouped alongside "active" items like navigation and hangouts, on the
  928. // opposite side of the home screen from historical (non-pinned)
  929. // timeline items. You can allow the user to toggle the value of this
  930. // property with the TOGGLE_PINNED built-in menu item.
  931. IsPinned bool `json:"isPinned,omitempty"`
  932. // Kind: The type of resource. This is always mirror#timelineItem.
  933. Kind string `json:"kind,omitempty"`
  934. // Location: The geographic location associated with this item.
  935. Location *Location `json:"location,omitempty"`
  936. // MenuItems: A list of menu items that will be presented to the user
  937. // when this item is selected in the timeline.
  938. MenuItems []*MenuItem `json:"menuItems,omitempty"`
  939. // Notification: Controls how notifications for this item are presented
  940. // on the device. If this is missing, no notification will be generated.
  941. Notification *NotificationConfig `json:"notification,omitempty"`
  942. // PinScore: For pinned items, this determines the order in which the
  943. // item is displayed in the timeline, with a higher score appearing
  944. // closer to the clock. Note: setting this field is currently not
  945. // supported.
  946. PinScore int64 `json:"pinScore,omitempty"`
  947. // Recipients: A list of users or groups that this item has been shared
  948. // with.
  949. Recipients []*Contact `json:"recipients,omitempty"`
  950. // SelfLink: A URL that can be used to retrieve this item.
  951. SelfLink string `json:"selfLink,omitempty"`
  952. // SourceItemId: Opaque string you can use to map a timeline item to
  953. // data in your own service.
  954. SourceItemId string `json:"sourceItemId,omitempty"`
  955. // SpeakableText: The speakable version of the content of this item.
  956. // Along with the READ_ALOUD menu item, use this field to provide text
  957. // that would be clearer when read aloud, or to provide extended
  958. // information to what is displayed visually on Glass.
  959. //
  960. // Glassware should also specify the speakableType field, which will be
  961. // spoken before this text in cases where the additional context is
  962. // useful, for example when the user requests that the item be read
  963. // aloud following a notification.
  964. SpeakableText string `json:"speakableText,omitempty"`
  965. // SpeakableType: A speakable description of the type of this item. This
  966. // will be announced to the user prior to reading the content of the
  967. // item in cases where the additional context is useful, for example
  968. // when the user requests that the item be read aloud following a
  969. // notification.
  970. //
  971. // This should be a short, simple noun phrase such as "Email", "Text
  972. // message", or "Daily Planet News Update".
  973. //
  974. // Glassware are encouraged to populate this field for every timeline
  975. // item, even if the item does not contain speakableText or text so that
  976. // the user can learn the type of the item without looking at the
  977. // screen.
  978. SpeakableType string `json:"speakableType,omitempty"`
  979. // Text: Text content of this item.
  980. Text string `json:"text,omitempty"`
  981. // Title: The title of this item.
  982. Title string `json:"title,omitempty"`
  983. // Updated: The time at which this item was last modified, formatted
  984. // according to RFC 3339.
  985. Updated string `json:"updated,omitempty"`
  986. // ServerResponse contains the HTTP response code and headers from the
  987. // server.
  988. googleapi.ServerResponse `json:"-"`
  989. // ForceSendFields is a list of field names (e.g. "Attachments") to
  990. // unconditionally include in API requests. By default, fields with
  991. // empty values are omitted from API requests. However, any non-pointer,
  992. // non-interface field appearing in ForceSendFields will be sent to the
  993. // server regardless of whether the field is empty or not. This may be
  994. // used to include empty fields in Patch requests.
  995. ForceSendFields []string `json:"-"`
  996. // NullFields is a list of field names (e.g. "Attachments") to include
  997. // in API requests with the JSON null value. By default, fields with
  998. // empty values are omitted from API requests. However, any field with
  999. // an empty value appearing in NullFields will be sent to the server as
  1000. // null. It is an error if a field in this list has a non-empty value.
  1001. // This may be used to include null fields in Patch requests.
  1002. NullFields []string `json:"-"`
  1003. }
  1004. func (s *TimelineItem) MarshalJSON() ([]byte, error) {
  1005. type NoMethod TimelineItem
  1006. raw := NoMethod(*s)
  1007. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1008. }
  1009. // TimelineListResponse: A list of timeline items. This is the response
  1010. // from the server to GET requests on the timeline collection.
  1011. type TimelineListResponse struct {
  1012. // Items: Items in the timeline.
  1013. Items []*TimelineItem `json:"items,omitempty"`
  1014. // Kind: The type of resource. This is always mirror#timeline.
  1015. Kind string `json:"kind,omitempty"`
  1016. // NextPageToken: The next page token. Provide this as the pageToken
  1017. // parameter in the request to retrieve the next page of results.
  1018. NextPageToken string `json:"nextPageToken,omitempty"`
  1019. // ServerResponse contains the HTTP response code and headers from the
  1020. // server.
  1021. googleapi.ServerResponse `json:"-"`
  1022. // ForceSendFields is a list of field names (e.g. "Items") to
  1023. // unconditionally include in API requests. By default, fields with
  1024. // empty values are omitted from API requests. However, any non-pointer,
  1025. // non-interface field appearing in ForceSendFields will be sent to the
  1026. // server regardless of whether the field is empty or not. This may be
  1027. // used to include empty fields in Patch requests.
  1028. ForceSendFields []string `json:"-"`
  1029. // NullFields is a list of field names (e.g. "Items") to include in API
  1030. // requests with the JSON null value. By default, fields with empty
  1031. // values are omitted from API requests. However, any field with an
  1032. // empty value appearing in NullFields will be sent to the server as
  1033. // null. It is an error if a field in this list has a non-empty value.
  1034. // This may be used to include null fields in Patch requests.
  1035. NullFields []string `json:"-"`
  1036. }
  1037. func (s *TimelineListResponse) MarshalJSON() ([]byte, error) {
  1038. type NoMethod TimelineListResponse
  1039. raw := NoMethod(*s)
  1040. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1041. }
  1042. // UserAction: Represents an action taken by the user that triggered a
  1043. // notification.
  1044. type UserAction struct {
  1045. // Payload: An optional payload for the action.
  1046. //
  1047. // For actions of type CUSTOM, this is the ID of the custom menu item
  1048. // that was selected.
  1049. Payload string `json:"payload,omitempty"`
  1050. // Type: The type of action. The value of this can be:
  1051. // - SHARE - the user shared an item.
  1052. // - REPLY - the user replied to an item.
  1053. // - REPLY_ALL - the user replied to all recipients of an item.
  1054. // - CUSTOM - the user selected a custom menu item on the timeline item.
  1055. //
  1056. // - DELETE - the user deleted the item.
  1057. // - PIN - the user pinned the item.
  1058. // - UNPIN - the user unpinned the item.
  1059. // - LAUNCH - the user initiated a voice command. In the future,
  1060. // additional types may be added. UserActions with unrecognized types
  1061. // should be ignored.
  1062. Type string `json:"type,omitempty"`
  1063. // ForceSendFields is a list of field names (e.g. "Payload") to
  1064. // unconditionally include in API requests. By default, fields with
  1065. // empty values are omitted from API requests. However, any non-pointer,
  1066. // non-interface field appearing in ForceSendFields will be sent to the
  1067. // server regardless of whether the field is empty or not. This may be
  1068. // used to include empty fields in Patch requests.
  1069. ForceSendFields []string `json:"-"`
  1070. // NullFields is a list of field names (e.g. "Payload") to include in
  1071. // API requests with the JSON null value. By default, fields with empty
  1072. // values are omitted from API requests. However, any field with an
  1073. // empty value appearing in NullFields will be sent to the server as
  1074. // null. It is an error if a field in this list has a non-empty value.
  1075. // This may be used to include null fields in Patch requests.
  1076. NullFields []string `json:"-"`
  1077. }
  1078. func (s *UserAction) MarshalJSON() ([]byte, error) {
  1079. type NoMethod UserAction
  1080. raw := NoMethod(*s)
  1081. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1082. }
  1083. type UserData struct {
  1084. Key string `json:"key,omitempty"`
  1085. Value string `json:"value,omitempty"`
  1086. // ForceSendFields is a list of field names (e.g. "Key") to
  1087. // unconditionally include in API requests. By default, fields with
  1088. // empty values are omitted from API requests. However, any non-pointer,
  1089. // non-interface field appearing in ForceSendFields will be sent to the
  1090. // server regardless of whether the field is empty or not. This may be
  1091. // used to include empty fields in Patch requests.
  1092. ForceSendFields []string `json:"-"`
  1093. // NullFields is a list of field names (e.g. "Key") to include in API
  1094. // requests with the JSON null value. By default, fields with empty
  1095. // values are omitted from API requests. However, any field with an
  1096. // empty value appearing in NullFields will be sent to the server as
  1097. // null. It is an error if a field in this list has a non-empty value.
  1098. // This may be used to include null fields in Patch requests.
  1099. NullFields []string `json:"-"`
  1100. }
  1101. func (s *UserData) MarshalJSON() ([]byte, error) {
  1102. type NoMethod UserData
  1103. raw := NoMethod(*s)
  1104. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1105. }
  1106. // method id "mirror.accounts.insert":
  1107. type AccountsInsertCall struct {
  1108. s *Service
  1109. userToken string
  1110. accountType string
  1111. accountName string
  1112. account *Account
  1113. urlParams_ gensupport.URLParams
  1114. ctx_ context.Context
  1115. header_ http.Header
  1116. }
  1117. // Insert: Inserts a new account for a user
  1118. func (r *AccountsService) Insert(userToken string, accountType string, accountName string, account *Account) *AccountsInsertCall {
  1119. c := &AccountsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1120. c.userToken = userToken
  1121. c.accountType = accountType
  1122. c.accountName = accountName
  1123. c.account = account
  1124. return c
  1125. }
  1126. // Fields allows partial responses to be retrieved. See
  1127. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1128. // for more information.
  1129. func (c *AccountsInsertCall) Fields(s ...googleapi.Field) *AccountsInsertCall {
  1130. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1131. return c
  1132. }
  1133. // Context sets the context to be used in this call's Do method. Any
  1134. // pending HTTP request will be aborted if the provided context is
  1135. // canceled.
  1136. func (c *AccountsInsertCall) Context(ctx context.Context) *AccountsInsertCall {
  1137. c.ctx_ = ctx
  1138. return c
  1139. }
  1140. // Header returns an http.Header that can be modified by the caller to
  1141. // add HTTP headers to the request.
  1142. func (c *AccountsInsertCall) Header() http.Header {
  1143. if c.header_ == nil {
  1144. c.header_ = make(http.Header)
  1145. }
  1146. return c.header_
  1147. }
  1148. func (c *AccountsInsertCall) doRequest(alt string) (*http.Response, error) {
  1149. reqHeaders := make(http.Header)
  1150. for k, v := range c.header_ {
  1151. reqHeaders[k] = v
  1152. }
  1153. reqHeaders.Set("User-Agent", c.s.userAgent())
  1154. var body io.Reader = nil
  1155. body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
  1156. if err != nil {
  1157. return nil, err
  1158. }
  1159. reqHeaders.Set("Content-Type", "application/json")
  1160. c.urlParams_.Set("alt", alt)
  1161. c.urlParams_.Set("prettyPrint", "false")
  1162. urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{userToken}/{accountType}/{accountName}")
  1163. urls += "?" + c.urlParams_.Encode()
  1164. req, err := http.NewRequest("POST", urls, body)
  1165. if err != nil {
  1166. return nil, err
  1167. }
  1168. req.Header = reqHeaders
  1169. googleapi.Expand(req.URL, map[string]string{
  1170. "userToken": c.userToken,
  1171. "accountType": c.accountType,
  1172. "accountName": c.accountName,
  1173. })
  1174. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1175. }
  1176. // Do executes the "mirror.accounts.insert" call.
  1177. // Exactly one of *Account or error will be non-nil. Any non-2xx status
  1178. // code is an error. Response headers are in either
  1179. // *Account.ServerResponse.Header or (if a response was returned at all)
  1180. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1181. // check whether the returned error was because http.StatusNotModified
  1182. // was returned.
  1183. func (c *AccountsInsertCall) Do(opts ...googleapi.CallOption) (*Account, error) {
  1184. gensupport.SetOptions(c.urlParams_, opts...)
  1185. res, err := c.doRequest("json")
  1186. if res != nil && res.StatusCode == http.StatusNotModified {
  1187. if res.Body != nil {
  1188. res.Body.Close()
  1189. }
  1190. return nil, &googleapi.Error{
  1191. Code: res.StatusCode,
  1192. Header: res.Header,
  1193. }
  1194. }
  1195. if err != nil {
  1196. return nil, err
  1197. }
  1198. defer googleapi.CloseBody(res)
  1199. if err := googleapi.CheckResponse(res); err != nil {
  1200. return nil, err
  1201. }
  1202. ret := &Account{
  1203. ServerResponse: googleapi.ServerResponse{
  1204. Header: res.Header,
  1205. HTTPStatusCode: res.StatusCode,
  1206. },
  1207. }
  1208. target := &ret
  1209. if err := gensupport.DecodeResponse(target, res); err != nil {
  1210. return nil, err
  1211. }
  1212. return ret, nil
  1213. // {
  1214. // "description": "Inserts a new account for a user",
  1215. // "httpMethod": "POST",
  1216. // "id": "mirror.accounts.insert",
  1217. // "parameterOrder": [
  1218. // "userToken",
  1219. // "accountType",
  1220. // "accountName"
  1221. // ],
  1222. // "parameters": {
  1223. // "accountName": {
  1224. // "description": "The name of the account to be passed to the Android Account Manager.",
  1225. // "location": "path",
  1226. // "required": true,
  1227. // "type": "string"
  1228. // },
  1229. // "accountType": {
  1230. // "description": "Account type to be passed to Android Account Manager.",
  1231. // "location": "path",
  1232. // "required": true,
  1233. // "type": "string"
  1234. // },
  1235. // "userToken": {
  1236. // "description": "The ID for the user.",
  1237. // "location": "path",
  1238. // "required": true,
  1239. // "type": "string"
  1240. // }
  1241. // },
  1242. // "path": "accounts/{userToken}/{accountType}/{accountName}",
  1243. // "request": {
  1244. // "$ref": "Account"
  1245. // },
  1246. // "response": {
  1247. // "$ref": "Account"
  1248. // }
  1249. // }
  1250. }
  1251. // method id "mirror.contacts.delete":
  1252. type ContactsDeleteCall struct {
  1253. s *Service
  1254. id string
  1255. urlParams_ gensupport.URLParams
  1256. ctx_ context.Context
  1257. header_ http.Header
  1258. }
  1259. // Delete: Deletes a contact.
  1260. func (r *ContactsService) Delete(id string) *ContactsDeleteCall {
  1261. c := &ContactsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1262. c.id = id
  1263. return c
  1264. }
  1265. // Fields allows partial responses to be retrieved. See
  1266. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1267. // for more information.
  1268. func (c *ContactsDeleteCall) Fields(s ...googleapi.Field) *ContactsDeleteCall {
  1269. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1270. return c
  1271. }
  1272. // Context sets the context to be used in this call's Do method. Any
  1273. // pending HTTP request will be aborted if the provided context is
  1274. // canceled.
  1275. func (c *ContactsDeleteCall) Context(ctx context.Context) *ContactsDeleteCall {
  1276. c.ctx_ = ctx
  1277. return c
  1278. }
  1279. // Header returns an http.Header that can be modified by the caller to
  1280. // add HTTP headers to the request.
  1281. func (c *ContactsDeleteCall) Header() http.Header {
  1282. if c.header_ == nil {
  1283. c.header_ = make(http.Header)
  1284. }
  1285. return c.header_
  1286. }
  1287. func (c *ContactsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1288. reqHeaders := make(http.Header)
  1289. for k, v := range c.header_ {
  1290. reqHeaders[k] = v
  1291. }
  1292. reqHeaders.Set("User-Agent", c.s.userAgent())
  1293. var body io.Reader = nil
  1294. c.urlParams_.Set("alt", alt)
  1295. c.urlParams_.Set("prettyPrint", "false")
  1296. urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
  1297. urls += "?" + c.urlParams_.Encode()
  1298. req, err := http.NewRequest("DELETE", urls, body)
  1299. if err != nil {
  1300. return nil, err
  1301. }
  1302. req.Header = reqHeaders
  1303. googleapi.Expand(req.URL, map[string]string{
  1304. "id": c.id,
  1305. })
  1306. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1307. }
  1308. // Do executes the "mirror.contacts.delete" call.
  1309. func (c *ContactsDeleteCall) Do(opts ...googleapi.CallOption) error {
  1310. gensupport.SetOptions(c.urlParams_, opts...)
  1311. res, err := c.doRequest("json")
  1312. if err != nil {
  1313. return err
  1314. }
  1315. defer googleapi.CloseBody(res)
  1316. if err := googleapi.CheckResponse(res); err != nil {
  1317. return err
  1318. }
  1319. return nil
  1320. // {
  1321. // "description": "Deletes a contact.",
  1322. // "httpMethod": "DELETE",
  1323. // "id": "mirror.contacts.delete",
  1324. // "parameterOrder": [
  1325. // "id"
  1326. // ],
  1327. // "parameters": {
  1328. // "id": {
  1329. // "description": "The ID of the contact.",
  1330. // "location": "path",
  1331. // "required": true,
  1332. // "type": "string"
  1333. // }
  1334. // },
  1335. // "path": "contacts/{id}",
  1336. // "scopes": [
  1337. // "https://www.googleapis.com/auth/glass.timeline"
  1338. // ]
  1339. // }
  1340. }
  1341. // method id "mirror.contacts.get":
  1342. type ContactsGetCall struct {
  1343. s *Service
  1344. id string
  1345. urlParams_ gensupport.URLParams
  1346. ifNoneMatch_ string
  1347. ctx_ context.Context
  1348. header_ http.Header
  1349. }
  1350. // Get: Gets a single contact by ID.
  1351. func (r *ContactsService) Get(id string) *ContactsGetCall {
  1352. c := &ContactsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1353. c.id = id
  1354. return c
  1355. }
  1356. // Fields allows partial responses to be retrieved. See
  1357. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1358. // for more information.
  1359. func (c *ContactsGetCall) Fields(s ...googleapi.Field) *ContactsGetCall {
  1360. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1361. return c
  1362. }
  1363. // IfNoneMatch sets the optional parameter which makes the operation
  1364. // fail if the object's ETag matches the given value. This is useful for
  1365. // getting updates only after the object has changed since the last
  1366. // request. Use googleapi.IsNotModified to check whether the response
  1367. // error from Do is the result of In-None-Match.
  1368. func (c *ContactsGetCall) IfNoneMatch(entityTag string) *ContactsGetCall {
  1369. c.ifNoneMatch_ = entityTag
  1370. return c
  1371. }
  1372. // Context sets the context to be used in this call's Do method. Any
  1373. // pending HTTP request will be aborted if the provided context is
  1374. // canceled.
  1375. func (c *ContactsGetCall) Context(ctx context.Context) *ContactsGetCall {
  1376. c.ctx_ = ctx
  1377. return c
  1378. }
  1379. // Header returns an http.Header that can be modified by the caller to
  1380. // add HTTP headers to the request.
  1381. func (c *ContactsGetCall) Header() http.Header {
  1382. if c.header_ == nil {
  1383. c.header_ = make(http.Header)
  1384. }
  1385. return c.header_
  1386. }
  1387. func (c *ContactsGetCall) doRequest(alt string) (*http.Response, error) {
  1388. reqHeaders := make(http.Header)
  1389. for k, v := range c.header_ {
  1390. reqHeaders[k] = v
  1391. }
  1392. reqHeaders.Set("User-Agent", c.s.userAgent())
  1393. if c.ifNoneMatch_ != "" {
  1394. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1395. }
  1396. var body io.Reader = nil
  1397. c.urlParams_.Set("alt", alt)
  1398. c.urlParams_.Set("prettyPrint", "false")
  1399. urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
  1400. urls += "?" + c.urlParams_.Encode()
  1401. req, err := http.NewRequest("GET", urls, body)
  1402. if err != nil {
  1403. return nil, err
  1404. }
  1405. req.Header = reqHeaders
  1406. googleapi.Expand(req.URL, map[string]string{
  1407. "id": c.id,
  1408. })
  1409. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1410. }
  1411. // Do executes the "mirror.contacts.get" call.
  1412. // Exactly one of *Contact or error will be non-nil. Any non-2xx status
  1413. // code is an error. Response headers are in either
  1414. // *Contact.ServerResponse.Header or (if a response was returned at all)
  1415. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1416. // check whether the returned error was because http.StatusNotModified
  1417. // was returned.
  1418. func (c *ContactsGetCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
  1419. gensupport.SetOptions(c.urlParams_, opts...)
  1420. res, err := c.doRequest("json")
  1421. if res != nil && res.StatusCode == http.StatusNotModified {
  1422. if res.Body != nil {
  1423. res.Body.Close()
  1424. }
  1425. return nil, &googleapi.Error{
  1426. Code: res.StatusCode,
  1427. Header: res.Header,
  1428. }
  1429. }
  1430. if err != nil {
  1431. return nil, err
  1432. }
  1433. defer googleapi.CloseBody(res)
  1434. if err := googleapi.CheckResponse(res); err != nil {
  1435. return nil, err
  1436. }
  1437. ret := &Contact{
  1438. ServerResponse: googleapi.ServerResponse{
  1439. Header: res.Header,
  1440. HTTPStatusCode: res.StatusCode,
  1441. },
  1442. }
  1443. target := &ret
  1444. if err := gensupport.DecodeResponse(target, res); err != nil {
  1445. return nil, err
  1446. }
  1447. return ret, nil
  1448. // {
  1449. // "description": "Gets a single contact by ID.",
  1450. // "httpMethod": "GET",
  1451. // "id": "mirror.contacts.get",
  1452. // "parameterOrder": [
  1453. // "id"
  1454. // ],
  1455. // "parameters": {
  1456. // "id": {
  1457. // "description": "The ID of the contact.",
  1458. // "location": "path",
  1459. // "required": true,
  1460. // "type": "string"
  1461. // }
  1462. // },
  1463. // "path": "contacts/{id}",
  1464. // "response": {
  1465. // "$ref": "Contact"
  1466. // },
  1467. // "scopes": [
  1468. // "https://www.googleapis.com/auth/glass.timeline"
  1469. // ]
  1470. // }
  1471. }
  1472. // method id "mirror.contacts.insert":
  1473. type ContactsInsertCall struct {
  1474. s *Service
  1475. contact *Contact
  1476. urlParams_ gensupport.URLParams
  1477. ctx_ context.Context
  1478. header_ http.Header
  1479. }
  1480. // Insert: Inserts a new contact.
  1481. func (r *ContactsService) Insert(contact *Contact) *ContactsInsertCall {
  1482. c := &ContactsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1483. c.contact = contact
  1484. return c
  1485. }
  1486. // Fields allows partial responses to be retrieved. See
  1487. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1488. // for more information.
  1489. func (c *ContactsInsertCall) Fields(s ...googleapi.Field) *ContactsInsertCall {
  1490. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1491. return c
  1492. }
  1493. // Context sets the context to be used in this call's Do method. Any
  1494. // pending HTTP request will be aborted if the provided context is
  1495. // canceled.
  1496. func (c *ContactsInsertCall) Context(ctx context.Context) *ContactsInsertCall {
  1497. c.ctx_ = ctx
  1498. return c
  1499. }
  1500. // Header returns an http.Header that can be modified by the caller to
  1501. // add HTTP headers to the request.
  1502. func (c *ContactsInsertCall) Header() http.Header {
  1503. if c.header_ == nil {
  1504. c.header_ = make(http.Header)
  1505. }
  1506. return c.header_
  1507. }
  1508. func (c *ContactsInsertCall) doRequest(alt string) (*http.Response, error) {
  1509. reqHeaders := make(http.Header)
  1510. for k, v := range c.header_ {
  1511. reqHeaders[k] = v
  1512. }
  1513. reqHeaders.Set("User-Agent", c.s.userAgent())
  1514. var body io.Reader = nil
  1515. body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
  1516. if err != nil {
  1517. return nil, err
  1518. }
  1519. reqHeaders.Set("Content-Type", "application/json")
  1520. c.urlParams_.Set("alt", alt)
  1521. c.urlParams_.Set("prettyPrint", "false")
  1522. urls := googleapi.ResolveRelative(c.s.BasePath, "contacts")
  1523. urls += "?" + c.urlParams_.Encode()
  1524. req, err := http.NewRequest("POST", urls, body)
  1525. if err != nil {
  1526. return nil, err
  1527. }
  1528. req.Header = reqHeaders
  1529. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1530. }
  1531. // Do executes the "mirror.contacts.insert" call.
  1532. // Exactly one of *Contact or error will be non-nil. Any non-2xx status
  1533. // code is an error. Response headers are in either
  1534. // *Contact.ServerResponse.Header or (if a response was returned at all)
  1535. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1536. // check whether the returned error was because http.StatusNotModified
  1537. // was returned.
  1538. func (c *ContactsInsertCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
  1539. gensupport.SetOptions(c.urlParams_, opts...)
  1540. res, err := c.doRequest("json")
  1541. if res != nil && res.StatusCode == http.StatusNotModified {
  1542. if res.Body != nil {
  1543. res.Body.Close()
  1544. }
  1545. return nil, &googleapi.Error{
  1546. Code: res.StatusCode,
  1547. Header: res.Header,
  1548. }
  1549. }
  1550. if err != nil {
  1551. return nil, err
  1552. }
  1553. defer googleapi.CloseBody(res)
  1554. if err := googleapi.CheckResponse(res); err != nil {
  1555. return nil, err
  1556. }
  1557. ret := &Contact{
  1558. ServerResponse: googleapi.ServerResponse{
  1559. Header: res.Header,
  1560. HTTPStatusCode: res.StatusCode,
  1561. },
  1562. }
  1563. target := &ret
  1564. if err := gensupport.DecodeResponse(target, res); err != nil {
  1565. return nil, err
  1566. }
  1567. return ret, nil
  1568. // {
  1569. // "description": "Inserts a new contact.",
  1570. // "httpMethod": "POST",
  1571. // "id": "mirror.contacts.insert",
  1572. // "path": "contacts",
  1573. // "request": {
  1574. // "$ref": "Contact"
  1575. // },
  1576. // "response": {
  1577. // "$ref": "Contact"
  1578. // },
  1579. // "scopes": [
  1580. // "https://www.googleapis.com/auth/glass.timeline"
  1581. // ]
  1582. // }
  1583. }
  1584. // method id "mirror.contacts.list":
  1585. type ContactsListCall struct {
  1586. s *Service
  1587. urlParams_ gensupport.URLParams
  1588. ifNoneMatch_ string
  1589. ctx_ context.Context
  1590. header_ http.Header
  1591. }
  1592. // List: Retrieves a list of contacts for the authenticated user.
  1593. func (r *ContactsService) List() *ContactsListCall {
  1594. c := &ContactsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1595. return c
  1596. }
  1597. // Fields allows partial responses to be retrieved. See
  1598. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1599. // for more information.
  1600. func (c *ContactsListCall) Fields(s ...googleapi.Field) *ContactsListCall {
  1601. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1602. return c
  1603. }
  1604. // IfNoneMatch sets the optional parameter which makes the operation
  1605. // fail if the object's ETag matches the given value. This is useful for
  1606. // getting updates only after the object has changed since the last
  1607. // request. Use googleapi.IsNotModified to check whether the response
  1608. // error from Do is the result of In-None-Match.
  1609. func (c *ContactsListCall) IfNoneMatch(entityTag string) *ContactsListCall {
  1610. c.ifNoneMatch_ = entityTag
  1611. return c
  1612. }
  1613. // Context sets the context to be used in this call's Do method. Any
  1614. // pending HTTP request will be aborted if the provided context is
  1615. // canceled.
  1616. func (c *ContactsListCall) Context(ctx context.Context) *ContactsListCall {
  1617. c.ctx_ = ctx
  1618. return c
  1619. }
  1620. // Header returns an http.Header that can be modified by the caller to
  1621. // add HTTP headers to the request.
  1622. func (c *ContactsListCall) Header() http.Header {
  1623. if c.header_ == nil {
  1624. c.header_ = make(http.Header)
  1625. }
  1626. return c.header_
  1627. }
  1628. func (c *ContactsListCall) doRequest(alt string) (*http.Response, error) {
  1629. reqHeaders := make(http.Header)
  1630. for k, v := range c.header_ {
  1631. reqHeaders[k] = v
  1632. }
  1633. reqHeaders.Set("User-Agent", c.s.userAgent())
  1634. if c.ifNoneMatch_ != "" {
  1635. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1636. }
  1637. var body io.Reader = nil
  1638. c.urlParams_.Set("alt", alt)
  1639. c.urlParams_.Set("prettyPrint", "false")
  1640. urls := googleapi.ResolveRelative(c.s.BasePath, "contacts")
  1641. urls += "?" + c.urlParams_.Encode()
  1642. req, err := http.NewRequest("GET", urls, body)
  1643. if err != nil {
  1644. return nil, err
  1645. }
  1646. req.Header = reqHeaders
  1647. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1648. }
  1649. // Do executes the "mirror.contacts.list" call.
  1650. // Exactly one of *ContactsListResponse or error will be non-nil. Any
  1651. // non-2xx status code is an error. Response headers are in either
  1652. // *ContactsListResponse.ServerResponse.Header or (if a response was
  1653. // returned at all) in error.(*googleapi.Error).Header. Use
  1654. // googleapi.IsNotModified to check whether the returned error was
  1655. // because http.StatusNotModified was returned.
  1656. func (c *ContactsListCall) Do(opts ...googleapi.CallOption) (*ContactsListResponse, error) {
  1657. gensupport.SetOptions(c.urlParams_, opts...)
  1658. res, err := c.doRequest("json")
  1659. if res != nil && res.StatusCode == http.StatusNotModified {
  1660. if res.Body != nil {
  1661. res.Body.Close()
  1662. }
  1663. return nil, &googleapi.Error{
  1664. Code: res.StatusCode,
  1665. Header: res.Header,
  1666. }
  1667. }
  1668. if err != nil {
  1669. return nil, err
  1670. }
  1671. defer googleapi.CloseBody(res)
  1672. if err := googleapi.CheckResponse(res); err != nil {
  1673. return nil, err
  1674. }
  1675. ret := &ContactsListResponse{
  1676. ServerResponse: googleapi.ServerResponse{
  1677. Header: res.Header,
  1678. HTTPStatusCode: res.StatusCode,
  1679. },
  1680. }
  1681. target := &ret
  1682. if err := gensupport.DecodeResponse(target, res); err != nil {
  1683. return nil, err
  1684. }
  1685. return ret, nil
  1686. // {
  1687. // "description": "Retrieves a list of contacts for the authenticated user.",
  1688. // "httpMethod": "GET",
  1689. // "id": "mirror.contacts.list",
  1690. // "path": "contacts",
  1691. // "response": {
  1692. // "$ref": "ContactsListResponse"
  1693. // },
  1694. // "scopes": [
  1695. // "https://www.googleapis.com/auth/glass.timeline"
  1696. // ]
  1697. // }
  1698. }
  1699. // method id "mirror.contacts.patch":
  1700. type ContactsPatchCall struct {
  1701. s *Service
  1702. id string
  1703. contact *Contact
  1704. urlParams_ gensupport.URLParams
  1705. ctx_ context.Context
  1706. header_ http.Header
  1707. }
  1708. // Patch: Updates a contact in place. This method supports patch
  1709. // semantics.
  1710. func (r *ContactsService) Patch(id string, contact *Contact) *ContactsPatchCall {
  1711. c := &ContactsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1712. c.id = id
  1713. c.contact = contact
  1714. return c
  1715. }
  1716. // Fields allows partial responses to be retrieved. See
  1717. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1718. // for more information.
  1719. func (c *ContactsPatchCall) Fields(s ...googleapi.Field) *ContactsPatchCall {
  1720. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1721. return c
  1722. }
  1723. // Context sets the context to be used in this call's Do method. Any
  1724. // pending HTTP request will be aborted if the provided context is
  1725. // canceled.
  1726. func (c *ContactsPatchCall) Context(ctx context.Context) *ContactsPatchCall {
  1727. c.ctx_ = ctx
  1728. return c
  1729. }
  1730. // Header returns an http.Header that can be modified by the caller to
  1731. // add HTTP headers to the request.
  1732. func (c *ContactsPatchCall) Header() http.Header {
  1733. if c.header_ == nil {
  1734. c.header_ = make(http.Header)
  1735. }
  1736. return c.header_
  1737. }
  1738. func (c *ContactsPatchCall) doRequest(alt string) (*http.Response, error) {
  1739. reqHeaders := make(http.Header)
  1740. for k, v := range c.header_ {
  1741. reqHeaders[k] = v
  1742. }
  1743. reqHeaders.Set("User-Agent", c.s.userAgent())
  1744. var body io.Reader = nil
  1745. body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
  1746. if err != nil {
  1747. return nil, err
  1748. }
  1749. reqHeaders.Set("Content-Type", "application/json")
  1750. c.urlParams_.Set("alt", alt)
  1751. c.urlParams_.Set("prettyPrint", "false")
  1752. urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
  1753. urls += "?" + c.urlParams_.Encode()
  1754. req, err := http.NewRequest("PATCH", urls, body)
  1755. if err != nil {
  1756. return nil, err
  1757. }
  1758. req.Header = reqHeaders
  1759. googleapi.Expand(req.URL, map[string]string{
  1760. "id": c.id,
  1761. })
  1762. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1763. }
  1764. // Do executes the "mirror.contacts.patch" call.
  1765. // Exactly one of *Contact or error will be non-nil. Any non-2xx status
  1766. // code is an error. Response headers are in either
  1767. // *Contact.ServerResponse.Header or (if a response was returned at all)
  1768. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1769. // check whether the returned error was because http.StatusNotModified
  1770. // was returned.
  1771. func (c *ContactsPatchCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
  1772. gensupport.SetOptions(c.urlParams_, opts...)
  1773. res, err := c.doRequest("json")
  1774. if res != nil && res.StatusCode == http.StatusNotModified {
  1775. if res.Body != nil {
  1776. res.Body.Close()
  1777. }
  1778. return nil, &googleapi.Error{
  1779. Code: res.StatusCode,
  1780. Header: res.Header,
  1781. }
  1782. }
  1783. if err != nil {
  1784. return nil, err
  1785. }
  1786. defer googleapi.CloseBody(res)
  1787. if err := googleapi.CheckResponse(res); err != nil {
  1788. return nil, err
  1789. }
  1790. ret := &Contact{
  1791. ServerResponse: googleapi.ServerResponse{
  1792. Header: res.Header,
  1793. HTTPStatusCode: res.StatusCode,
  1794. },
  1795. }
  1796. target := &ret
  1797. if err := gensupport.DecodeResponse(target, res); err != nil {
  1798. return nil, err
  1799. }
  1800. return ret, nil
  1801. // {
  1802. // "description": "Updates a contact in place. This method supports patch semantics.",
  1803. // "httpMethod": "PATCH",
  1804. // "id": "mirror.contacts.patch",
  1805. // "parameterOrder": [
  1806. // "id"
  1807. // ],
  1808. // "parameters": {
  1809. // "id": {
  1810. // "description": "The ID of the contact.",
  1811. // "location": "path",
  1812. // "required": true,
  1813. // "type": "string"
  1814. // }
  1815. // },
  1816. // "path": "contacts/{id}",
  1817. // "request": {
  1818. // "$ref": "Contact"
  1819. // },
  1820. // "response": {
  1821. // "$ref": "Contact"
  1822. // },
  1823. // "scopes": [
  1824. // "https://www.googleapis.com/auth/glass.timeline"
  1825. // ]
  1826. // }
  1827. }
  1828. // method id "mirror.contacts.update":
  1829. type ContactsUpdateCall struct {
  1830. s *Service
  1831. id string
  1832. contact *Contact
  1833. urlParams_ gensupport.URLParams
  1834. ctx_ context.Context
  1835. header_ http.Header
  1836. }
  1837. // Update: Updates a contact in place.
  1838. func (r *ContactsService) Update(id string, contact *Contact) *ContactsUpdateCall {
  1839. c := &ContactsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1840. c.id = id
  1841. c.contact = contact
  1842. return c
  1843. }
  1844. // Fields allows partial responses to be retrieved. See
  1845. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1846. // for more information.
  1847. func (c *ContactsUpdateCall) Fields(s ...googleapi.Field) *ContactsUpdateCall {
  1848. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1849. return c
  1850. }
  1851. // Context sets the context to be used in this call's Do method. Any
  1852. // pending HTTP request will be aborted if the provided context is
  1853. // canceled.
  1854. func (c *ContactsUpdateCall) Context(ctx context.Context) *ContactsUpdateCall {
  1855. c.ctx_ = ctx
  1856. return c
  1857. }
  1858. // Header returns an http.Header that can be modified by the caller to
  1859. // add HTTP headers to the request.
  1860. func (c *ContactsUpdateCall) Header() http.Header {
  1861. if c.header_ == nil {
  1862. c.header_ = make(http.Header)
  1863. }
  1864. return c.header_
  1865. }
  1866. func (c *ContactsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1867. reqHeaders := make(http.Header)
  1868. for k, v := range c.header_ {
  1869. reqHeaders[k] = v
  1870. }
  1871. reqHeaders.Set("User-Agent", c.s.userAgent())
  1872. var body io.Reader = nil
  1873. body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
  1874. if err != nil {
  1875. return nil, err
  1876. }
  1877. reqHeaders.Set("Content-Type", "application/json")
  1878. c.urlParams_.Set("alt", alt)
  1879. c.urlParams_.Set("prettyPrint", "false")
  1880. urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
  1881. urls += "?" + c.urlParams_.Encode()
  1882. req, err := http.NewRequest("PUT", urls, body)
  1883. if err != nil {
  1884. return nil, err
  1885. }
  1886. req.Header = reqHeaders
  1887. googleapi.Expand(req.URL, map[string]string{
  1888. "id": c.id,
  1889. })
  1890. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1891. }
  1892. // Do executes the "mirror.contacts.update" call.
  1893. // Exactly one of *Contact or error will be non-nil. Any non-2xx status
  1894. // code is an error. Response headers are in either
  1895. // *Contact.ServerResponse.Header or (if a response was returned at all)
  1896. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1897. // check whether the returned error was because http.StatusNotModified
  1898. // was returned.
  1899. func (c *ContactsUpdateCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
  1900. gensupport.SetOptions(c.urlParams_, opts...)
  1901. res, err := c.doRequest("json")
  1902. if res != nil && res.StatusCode == http.StatusNotModified {
  1903. if res.Body != nil {
  1904. res.Body.Close()
  1905. }
  1906. return nil, &googleapi.Error{
  1907. Code: res.StatusCode,
  1908. Header: res.Header,
  1909. }
  1910. }
  1911. if err != nil {
  1912. return nil, err
  1913. }
  1914. defer googleapi.CloseBody(res)
  1915. if err := googleapi.CheckResponse(res); err != nil {
  1916. return nil, err
  1917. }
  1918. ret := &Contact{
  1919. ServerResponse: googleapi.ServerResponse{
  1920. Header: res.Header,
  1921. HTTPStatusCode: res.StatusCode,
  1922. },
  1923. }
  1924. target := &ret
  1925. if err := gensupport.DecodeResponse(target, res); err != nil {
  1926. return nil, err
  1927. }
  1928. return ret, nil
  1929. // {
  1930. // "description": "Updates a contact in place.",
  1931. // "httpMethod": "PUT",
  1932. // "id": "mirror.contacts.update",
  1933. // "parameterOrder": [
  1934. // "id"
  1935. // ],
  1936. // "parameters": {
  1937. // "id": {
  1938. // "description": "The ID of the contact.",
  1939. // "location": "path",
  1940. // "required": true,
  1941. // "type": "string"
  1942. // }
  1943. // },
  1944. // "path": "contacts/{id}",
  1945. // "request": {
  1946. // "$ref": "Contact"
  1947. // },
  1948. // "response": {
  1949. // "$ref": "Contact"
  1950. // },
  1951. // "scopes": [
  1952. // "https://www.googleapis.com/auth/glass.timeline"
  1953. // ]
  1954. // }
  1955. }
  1956. // method id "mirror.locations.get":
  1957. type LocationsGetCall struct {
  1958. s *Service
  1959. id string
  1960. urlParams_ gensupport.URLParams
  1961. ifNoneMatch_ string
  1962. ctx_ context.Context
  1963. header_ http.Header
  1964. }
  1965. // Get: Gets a single location by ID.
  1966. func (r *LocationsService) Get(id string) *LocationsGetCall {
  1967. c := &LocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1968. c.id = id
  1969. return c
  1970. }
  1971. // Fields allows partial responses to be retrieved. See
  1972. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1973. // for more information.
  1974. func (c *LocationsGetCall) Fields(s ...googleapi.Field) *LocationsGetCall {
  1975. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1976. return c
  1977. }
  1978. // IfNoneMatch sets the optional parameter which makes the operation
  1979. // fail if the object's ETag matches the given value. This is useful for
  1980. // getting updates only after the object has changed since the last
  1981. // request. Use googleapi.IsNotModified to check whether the response
  1982. // error from Do is the result of In-None-Match.
  1983. func (c *LocationsGetCall) IfNoneMatch(entityTag string) *LocationsGetCall {
  1984. c.ifNoneMatch_ = entityTag
  1985. return c
  1986. }
  1987. // Context sets the context to be used in this call's Do method. Any
  1988. // pending HTTP request will be aborted if the provided context is
  1989. // canceled.
  1990. func (c *LocationsGetCall) Context(ctx context.Context) *LocationsGetCall {
  1991. c.ctx_ = ctx
  1992. return c
  1993. }
  1994. // Header returns an http.Header that can be modified by the caller to
  1995. // add HTTP headers to the request.
  1996. func (c *LocationsGetCall) Header() http.Header {
  1997. if c.header_ == nil {
  1998. c.header_ = make(http.Header)
  1999. }
  2000. return c.header_
  2001. }
  2002. func (c *LocationsGetCall) doRequest(alt string) (*http.Response, error) {
  2003. reqHeaders := make(http.Header)
  2004. for k, v := range c.header_ {
  2005. reqHeaders[k] = v
  2006. }
  2007. reqHeaders.Set("User-Agent", c.s.userAgent())
  2008. if c.ifNoneMatch_ != "" {
  2009. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2010. }
  2011. var body io.Reader = nil
  2012. c.urlParams_.Set("alt", alt)
  2013. c.urlParams_.Set("prettyPrint", "false")
  2014. urls := googleapi.ResolveRelative(c.s.BasePath, "locations/{id}")
  2015. urls += "?" + c.urlParams_.Encode()
  2016. req, err := http.NewRequest("GET", urls, body)
  2017. if err != nil {
  2018. return nil, err
  2019. }
  2020. req.Header = reqHeaders
  2021. googleapi.Expand(req.URL, map[string]string{
  2022. "id": c.id,
  2023. })
  2024. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2025. }
  2026. // Do executes the "mirror.locations.get" call.
  2027. // Exactly one of *Location or error will be non-nil. Any non-2xx status
  2028. // code is an error. Response headers are in either
  2029. // *Location.ServerResponse.Header or (if a response was returned at
  2030. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2031. // to check whether the returned error was because
  2032. // http.StatusNotModified was returned.
  2033. func (c *LocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
  2034. gensupport.SetOptions(c.urlParams_, opts...)
  2035. res, err := c.doRequest("json")
  2036. if res != nil && res.StatusCode == http.StatusNotModified {
  2037. if res.Body != nil {
  2038. res.Body.Close()
  2039. }
  2040. return nil, &googleapi.Error{
  2041. Code: res.StatusCode,
  2042. Header: res.Header,
  2043. }
  2044. }
  2045. if err != nil {
  2046. return nil, err
  2047. }
  2048. defer googleapi.CloseBody(res)
  2049. if err := googleapi.CheckResponse(res); err != nil {
  2050. return nil, err
  2051. }
  2052. ret := &Location{
  2053. ServerResponse: googleapi.ServerResponse{
  2054. Header: res.Header,
  2055. HTTPStatusCode: res.StatusCode,
  2056. },
  2057. }
  2058. target := &ret
  2059. if err := gensupport.DecodeResponse(target, res); err != nil {
  2060. return nil, err
  2061. }
  2062. return ret, nil
  2063. // {
  2064. // "description": "Gets a single location by ID.",
  2065. // "httpMethod": "GET",
  2066. // "id": "mirror.locations.get",
  2067. // "parameterOrder": [
  2068. // "id"
  2069. // ],
  2070. // "parameters": {
  2071. // "id": {
  2072. // "description": "The ID of the location or latest for the last known location.",
  2073. // "location": "path",
  2074. // "required": true,
  2075. // "type": "string"
  2076. // }
  2077. // },
  2078. // "path": "locations/{id}",
  2079. // "response": {
  2080. // "$ref": "Location"
  2081. // },
  2082. // "scopes": [
  2083. // "https://www.googleapis.com/auth/glass.location",
  2084. // "https://www.googleapis.com/auth/glass.timeline"
  2085. // ]
  2086. // }
  2087. }
  2088. // method id "mirror.locations.list":
  2089. type LocationsListCall struct {
  2090. s *Service
  2091. urlParams_ gensupport.URLParams
  2092. ifNoneMatch_ string
  2093. ctx_ context.Context
  2094. header_ http.Header
  2095. }
  2096. // List: Retrieves a list of locations for the user.
  2097. func (r *LocationsService) List() *LocationsListCall {
  2098. c := &LocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2099. return c
  2100. }
  2101. // Fields allows partial responses to be retrieved. See
  2102. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2103. // for more information.
  2104. func (c *LocationsListCall) Fields(s ...googleapi.Field) *LocationsListCall {
  2105. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2106. return c
  2107. }
  2108. // IfNoneMatch sets the optional parameter which makes the operation
  2109. // fail if the object's ETag matches the given value. This is useful for
  2110. // getting updates only after the object has changed since the last
  2111. // request. Use googleapi.IsNotModified to check whether the response
  2112. // error from Do is the result of In-None-Match.
  2113. func (c *LocationsListCall) IfNoneMatch(entityTag string) *LocationsListCall {
  2114. c.ifNoneMatch_ = entityTag
  2115. return c
  2116. }
  2117. // Context sets the context to be used in this call's Do method. Any
  2118. // pending HTTP request will be aborted if the provided context is
  2119. // canceled.
  2120. func (c *LocationsListCall) Context(ctx context.Context) *LocationsListCall {
  2121. c.ctx_ = ctx
  2122. return c
  2123. }
  2124. // Header returns an http.Header that can be modified by the caller to
  2125. // add HTTP headers to the request.
  2126. func (c *LocationsListCall) Header() http.Header {
  2127. if c.header_ == nil {
  2128. c.header_ = make(http.Header)
  2129. }
  2130. return c.header_
  2131. }
  2132. func (c *LocationsListCall) doRequest(alt string) (*http.Response, error) {
  2133. reqHeaders := make(http.Header)
  2134. for k, v := range c.header_ {
  2135. reqHeaders[k] = v
  2136. }
  2137. reqHeaders.Set("User-Agent", c.s.userAgent())
  2138. if c.ifNoneMatch_ != "" {
  2139. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2140. }
  2141. var body io.Reader = nil
  2142. c.urlParams_.Set("alt", alt)
  2143. c.urlParams_.Set("prettyPrint", "false")
  2144. urls := googleapi.ResolveRelative(c.s.BasePath, "locations")
  2145. urls += "?" + c.urlParams_.Encode()
  2146. req, err := http.NewRequest("GET", urls, body)
  2147. if err != nil {
  2148. return nil, err
  2149. }
  2150. req.Header = reqHeaders
  2151. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2152. }
  2153. // Do executes the "mirror.locations.list" call.
  2154. // Exactly one of *LocationsListResponse or error will be non-nil. Any
  2155. // non-2xx status code is an error. Response headers are in either
  2156. // *LocationsListResponse.ServerResponse.Header or (if a response was
  2157. // returned at all) in error.(*googleapi.Error).Header. Use
  2158. // googleapi.IsNotModified to check whether the returned error was
  2159. // because http.StatusNotModified was returned.
  2160. func (c *LocationsListCall) Do(opts ...googleapi.CallOption) (*LocationsListResponse, error) {
  2161. gensupport.SetOptions(c.urlParams_, opts...)
  2162. res, err := c.doRequest("json")
  2163. if res != nil && res.StatusCode == http.StatusNotModified {
  2164. if res.Body != nil {
  2165. res.Body.Close()
  2166. }
  2167. return nil, &googleapi.Error{
  2168. Code: res.StatusCode,
  2169. Header: res.Header,
  2170. }
  2171. }
  2172. if err != nil {
  2173. return nil, err
  2174. }
  2175. defer googleapi.CloseBody(res)
  2176. if err := googleapi.CheckResponse(res); err != nil {
  2177. return nil, err
  2178. }
  2179. ret := &LocationsListResponse{
  2180. ServerResponse: googleapi.ServerResponse{
  2181. Header: res.Header,
  2182. HTTPStatusCode: res.StatusCode,
  2183. },
  2184. }
  2185. target := &ret
  2186. if err := gensupport.DecodeResponse(target, res); err != nil {
  2187. return nil, err
  2188. }
  2189. return ret, nil
  2190. // {
  2191. // "description": "Retrieves a list of locations for the user.",
  2192. // "httpMethod": "GET",
  2193. // "id": "mirror.locations.list",
  2194. // "path": "locations",
  2195. // "response": {
  2196. // "$ref": "LocationsListResponse"
  2197. // },
  2198. // "scopes": [
  2199. // "https://www.googleapis.com/auth/glass.location",
  2200. // "https://www.googleapis.com/auth/glass.timeline"
  2201. // ]
  2202. // }
  2203. }
  2204. // method id "mirror.settings.get":
  2205. type SettingsGetCall struct {
  2206. s *Service
  2207. id string
  2208. urlParams_ gensupport.URLParams
  2209. ifNoneMatch_ string
  2210. ctx_ context.Context
  2211. header_ http.Header
  2212. }
  2213. // Get: Gets a single setting by ID.
  2214. func (r *SettingsService) Get(id string) *SettingsGetCall {
  2215. c := &SettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2216. c.id = id
  2217. return c
  2218. }
  2219. // Fields allows partial responses to be retrieved. See
  2220. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2221. // for more information.
  2222. func (c *SettingsGetCall) Fields(s ...googleapi.Field) *SettingsGetCall {
  2223. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2224. return c
  2225. }
  2226. // IfNoneMatch sets the optional parameter which makes the operation
  2227. // fail if the object's ETag matches the given value. This is useful for
  2228. // getting updates only after the object has changed since the last
  2229. // request. Use googleapi.IsNotModified to check whether the response
  2230. // error from Do is the result of In-None-Match.
  2231. func (c *SettingsGetCall) IfNoneMatch(entityTag string) *SettingsGetCall {
  2232. c.ifNoneMatch_ = entityTag
  2233. return c
  2234. }
  2235. // Context sets the context to be used in this call's Do method. Any
  2236. // pending HTTP request will be aborted if the provided context is
  2237. // canceled.
  2238. func (c *SettingsGetCall) Context(ctx context.Context) *SettingsGetCall {
  2239. c.ctx_ = ctx
  2240. return c
  2241. }
  2242. // Header returns an http.Header that can be modified by the caller to
  2243. // add HTTP headers to the request.
  2244. func (c *SettingsGetCall) Header() http.Header {
  2245. if c.header_ == nil {
  2246. c.header_ = make(http.Header)
  2247. }
  2248. return c.header_
  2249. }
  2250. func (c *SettingsGetCall) doRequest(alt string) (*http.Response, error) {
  2251. reqHeaders := make(http.Header)
  2252. for k, v := range c.header_ {
  2253. reqHeaders[k] = v
  2254. }
  2255. reqHeaders.Set("User-Agent", c.s.userAgent())
  2256. if c.ifNoneMatch_ != "" {
  2257. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2258. }
  2259. var body io.Reader = nil
  2260. c.urlParams_.Set("alt", alt)
  2261. c.urlParams_.Set("prettyPrint", "false")
  2262. urls := googleapi.ResolveRelative(c.s.BasePath, "settings/{id}")
  2263. urls += "?" + c.urlParams_.Encode()
  2264. req, err := http.NewRequest("GET", urls, body)
  2265. if err != nil {
  2266. return nil, err
  2267. }
  2268. req.Header = reqHeaders
  2269. googleapi.Expand(req.URL, map[string]string{
  2270. "id": c.id,
  2271. })
  2272. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2273. }
  2274. // Do executes the "mirror.settings.get" call.
  2275. // Exactly one of *Setting or error will be non-nil. Any non-2xx status
  2276. // code is an error. Response headers are in either
  2277. // *Setting.ServerResponse.Header or (if a response was returned at all)
  2278. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2279. // check whether the returned error was because http.StatusNotModified
  2280. // was returned.
  2281. func (c *SettingsGetCall) Do(opts ...googleapi.CallOption) (*Setting, error) {
  2282. gensupport.SetOptions(c.urlParams_, opts...)
  2283. res, err := c.doRequest("json")
  2284. if res != nil && res.StatusCode == http.StatusNotModified {
  2285. if res.Body != nil {
  2286. res.Body.Close()
  2287. }
  2288. return nil, &googleapi.Error{
  2289. Code: res.StatusCode,
  2290. Header: res.Header,
  2291. }
  2292. }
  2293. if err != nil {
  2294. return nil, err
  2295. }
  2296. defer googleapi.CloseBody(res)
  2297. if err := googleapi.CheckResponse(res); err != nil {
  2298. return nil, err
  2299. }
  2300. ret := &Setting{
  2301. ServerResponse: googleapi.ServerResponse{
  2302. Header: res.Header,
  2303. HTTPStatusCode: res.StatusCode,
  2304. },
  2305. }
  2306. target := &ret
  2307. if err := gensupport.DecodeResponse(target, res); err != nil {
  2308. return nil, err
  2309. }
  2310. return ret, nil
  2311. // {
  2312. // "description": "Gets a single setting by ID.",
  2313. // "httpMethod": "GET",
  2314. // "id": "mirror.settings.get",
  2315. // "parameterOrder": [
  2316. // "id"
  2317. // ],
  2318. // "parameters": {
  2319. // "id": {
  2320. // "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.",
  2321. // "location": "path",
  2322. // "required": true,
  2323. // "type": "string"
  2324. // }
  2325. // },
  2326. // "path": "settings/{id}",
  2327. // "response": {
  2328. // "$ref": "Setting"
  2329. // },
  2330. // "scopes": [
  2331. // "https://www.googleapis.com/auth/glass.timeline"
  2332. // ]
  2333. // }
  2334. }
  2335. // method id "mirror.subscriptions.delete":
  2336. type SubscriptionsDeleteCall struct {
  2337. s *Service
  2338. id string
  2339. urlParams_ gensupport.URLParams
  2340. ctx_ context.Context
  2341. header_ http.Header
  2342. }
  2343. // Delete: Deletes a subscription.
  2344. func (r *SubscriptionsService) Delete(id string) *SubscriptionsDeleteCall {
  2345. c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2346. c.id = id
  2347. return c
  2348. }
  2349. // Fields allows partial responses to be retrieved. See
  2350. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2351. // for more information.
  2352. func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
  2353. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2354. return c
  2355. }
  2356. // Context sets the context to be used in this call's Do method. Any
  2357. // pending HTTP request will be aborted if the provided context is
  2358. // canceled.
  2359. func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
  2360. c.ctx_ = ctx
  2361. return c
  2362. }
  2363. // Header returns an http.Header that can be modified by the caller to
  2364. // add HTTP headers to the request.
  2365. func (c *SubscriptionsDeleteCall) Header() http.Header {
  2366. if c.header_ == nil {
  2367. c.header_ = make(http.Header)
  2368. }
  2369. return c.header_
  2370. }
  2371. func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2372. reqHeaders := make(http.Header)
  2373. for k, v := range c.header_ {
  2374. reqHeaders[k] = v
  2375. }
  2376. reqHeaders.Set("User-Agent", c.s.userAgent())
  2377. var body io.Reader = nil
  2378. c.urlParams_.Set("alt", alt)
  2379. c.urlParams_.Set("prettyPrint", "false")
  2380. urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{id}")
  2381. urls += "?" + c.urlParams_.Encode()
  2382. req, err := http.NewRequest("DELETE", urls, body)
  2383. if err != nil {
  2384. return nil, err
  2385. }
  2386. req.Header = reqHeaders
  2387. googleapi.Expand(req.URL, map[string]string{
  2388. "id": c.id,
  2389. })
  2390. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2391. }
  2392. // Do executes the "mirror.subscriptions.delete" call.
  2393. func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2394. gensupport.SetOptions(c.urlParams_, opts...)
  2395. res, err := c.doRequest("json")
  2396. if err != nil {
  2397. return err
  2398. }
  2399. defer googleapi.CloseBody(res)
  2400. if err := googleapi.CheckResponse(res); err != nil {
  2401. return err
  2402. }
  2403. return nil
  2404. // {
  2405. // "description": "Deletes a subscription.",
  2406. // "httpMethod": "DELETE",
  2407. // "id": "mirror.subscriptions.delete",
  2408. // "parameterOrder": [
  2409. // "id"
  2410. // ],
  2411. // "parameters": {
  2412. // "id": {
  2413. // "description": "The ID of the subscription.",
  2414. // "location": "path",
  2415. // "required": true,
  2416. // "type": "string"
  2417. // }
  2418. // },
  2419. // "path": "subscriptions/{id}",
  2420. // "scopes": [
  2421. // "https://www.googleapis.com/auth/glass.timeline"
  2422. // ]
  2423. // }
  2424. }
  2425. // method id "mirror.subscriptions.insert":
  2426. type SubscriptionsInsertCall struct {
  2427. s *Service
  2428. subscription *Subscription
  2429. urlParams_ gensupport.URLParams
  2430. ctx_ context.Context
  2431. header_ http.Header
  2432. }
  2433. // Insert: Creates a new subscription.
  2434. func (r *SubscriptionsService) Insert(subscription *Subscription) *SubscriptionsInsertCall {
  2435. c := &SubscriptionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2436. c.subscription = subscription
  2437. return c
  2438. }
  2439. // Fields allows partial responses to be retrieved. See
  2440. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2441. // for more information.
  2442. func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
  2443. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2444. return c
  2445. }
  2446. // Context sets the context to be used in this call's Do method. Any
  2447. // pending HTTP request will be aborted if the provided context is
  2448. // canceled.
  2449. func (c *SubscriptionsInsertCall) Context(ctx context.Context) *SubscriptionsInsertCall {
  2450. c.ctx_ = ctx
  2451. return c
  2452. }
  2453. // Header returns an http.Header that can be modified by the caller to
  2454. // add HTTP headers to the request.
  2455. func (c *SubscriptionsInsertCall) Header() http.Header {
  2456. if c.header_ == nil {
  2457. c.header_ = make(http.Header)
  2458. }
  2459. return c.header_
  2460. }
  2461. func (c *SubscriptionsInsertCall) doRequest(alt string) (*http.Response, error) {
  2462. reqHeaders := make(http.Header)
  2463. for k, v := range c.header_ {
  2464. reqHeaders[k] = v
  2465. }
  2466. reqHeaders.Set("User-Agent", c.s.userAgent())
  2467. var body io.Reader = nil
  2468. body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
  2469. if err != nil {
  2470. return nil, err
  2471. }
  2472. reqHeaders.Set("Content-Type", "application/json")
  2473. c.urlParams_.Set("alt", alt)
  2474. c.urlParams_.Set("prettyPrint", "false")
  2475. urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
  2476. urls += "?" + c.urlParams_.Encode()
  2477. req, err := http.NewRequest("POST", urls, body)
  2478. if err != nil {
  2479. return nil, err
  2480. }
  2481. req.Header = reqHeaders
  2482. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2483. }
  2484. // Do executes the "mirror.subscriptions.insert" call.
  2485. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2486. // status code is an error. Response headers are in either
  2487. // *Subscription.ServerResponse.Header or (if a response was returned at
  2488. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2489. // to check whether the returned error was because
  2490. // http.StatusNotModified was returned.
  2491. func (c *SubscriptionsInsertCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2492. gensupport.SetOptions(c.urlParams_, opts...)
  2493. res, err := c.doRequest("json")
  2494. if res != nil && res.StatusCode == http.StatusNotModified {
  2495. if res.Body != nil {
  2496. res.Body.Close()
  2497. }
  2498. return nil, &googleapi.Error{
  2499. Code: res.StatusCode,
  2500. Header: res.Header,
  2501. }
  2502. }
  2503. if err != nil {
  2504. return nil, err
  2505. }
  2506. defer googleapi.CloseBody(res)
  2507. if err := googleapi.CheckResponse(res); err != nil {
  2508. return nil, err
  2509. }
  2510. ret := &Subscription{
  2511. ServerResponse: googleapi.ServerResponse{
  2512. Header: res.Header,
  2513. HTTPStatusCode: res.StatusCode,
  2514. },
  2515. }
  2516. target := &ret
  2517. if err := gensupport.DecodeResponse(target, res); err != nil {
  2518. return nil, err
  2519. }
  2520. return ret, nil
  2521. // {
  2522. // "description": "Creates a new subscription.",
  2523. // "httpMethod": "POST",
  2524. // "id": "mirror.subscriptions.insert",
  2525. // "path": "subscriptions",
  2526. // "request": {
  2527. // "$ref": "Subscription"
  2528. // },
  2529. // "response": {
  2530. // "$ref": "Subscription"
  2531. // },
  2532. // "scopes": [
  2533. // "https://www.googleapis.com/auth/glass.timeline"
  2534. // ]
  2535. // }
  2536. }
  2537. // method id "mirror.subscriptions.list":
  2538. type SubscriptionsListCall struct {
  2539. s *Service
  2540. urlParams_ gensupport.URLParams
  2541. ifNoneMatch_ string
  2542. ctx_ context.Context
  2543. header_ http.Header
  2544. }
  2545. // List: Retrieves a list of subscriptions for the authenticated user
  2546. // and service.
  2547. func (r *SubscriptionsService) List() *SubscriptionsListCall {
  2548. c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2549. return c
  2550. }
  2551. // Fields allows partial responses to be retrieved. See
  2552. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2553. // for more information.
  2554. func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
  2555. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2556. return c
  2557. }
  2558. // IfNoneMatch sets the optional parameter which makes the operation
  2559. // fail if the object's ETag matches the given value. This is useful for
  2560. // getting updates only after the object has changed since the last
  2561. // request. Use googleapi.IsNotModified to check whether the response
  2562. // error from Do is the result of In-None-Match.
  2563. func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
  2564. c.ifNoneMatch_ = entityTag
  2565. return c
  2566. }
  2567. // Context sets the context to be used in this call's Do method. Any
  2568. // pending HTTP request will be aborted if the provided context is
  2569. // canceled.
  2570. func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
  2571. c.ctx_ = ctx
  2572. return c
  2573. }
  2574. // Header returns an http.Header that can be modified by the caller to
  2575. // add HTTP headers to the request.
  2576. func (c *SubscriptionsListCall) Header() http.Header {
  2577. if c.header_ == nil {
  2578. c.header_ = make(http.Header)
  2579. }
  2580. return c.header_
  2581. }
  2582. func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  2583. reqHeaders := make(http.Header)
  2584. for k, v := range c.header_ {
  2585. reqHeaders[k] = v
  2586. }
  2587. reqHeaders.Set("User-Agent", c.s.userAgent())
  2588. if c.ifNoneMatch_ != "" {
  2589. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2590. }
  2591. var body io.Reader = nil
  2592. c.urlParams_.Set("alt", alt)
  2593. c.urlParams_.Set("prettyPrint", "false")
  2594. urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
  2595. urls += "?" + c.urlParams_.Encode()
  2596. req, err := http.NewRequest("GET", urls, body)
  2597. if err != nil {
  2598. return nil, err
  2599. }
  2600. req.Header = reqHeaders
  2601. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2602. }
  2603. // Do executes the "mirror.subscriptions.list" call.
  2604. // Exactly one of *SubscriptionsListResponse or error will be non-nil.
  2605. // Any non-2xx status code is an error. Response headers are in either
  2606. // *SubscriptionsListResponse.ServerResponse.Header or (if a response
  2607. // was returned at all) in error.(*googleapi.Error).Header. Use
  2608. // googleapi.IsNotModified to check whether the returned error was
  2609. // because http.StatusNotModified was returned.
  2610. func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*SubscriptionsListResponse, error) {
  2611. gensupport.SetOptions(c.urlParams_, opts...)
  2612. res, err := c.doRequest("json")
  2613. if res != nil && res.StatusCode == http.StatusNotModified {
  2614. if res.Body != nil {
  2615. res.Body.Close()
  2616. }
  2617. return nil, &googleapi.Error{
  2618. Code: res.StatusCode,
  2619. Header: res.Header,
  2620. }
  2621. }
  2622. if err != nil {
  2623. return nil, err
  2624. }
  2625. defer googleapi.CloseBody(res)
  2626. if err := googleapi.CheckResponse(res); err != nil {
  2627. return nil, err
  2628. }
  2629. ret := &SubscriptionsListResponse{
  2630. ServerResponse: googleapi.ServerResponse{
  2631. Header: res.Header,
  2632. HTTPStatusCode: res.StatusCode,
  2633. },
  2634. }
  2635. target := &ret
  2636. if err := gensupport.DecodeResponse(target, res); err != nil {
  2637. return nil, err
  2638. }
  2639. return ret, nil
  2640. // {
  2641. // "description": "Retrieves a list of subscriptions for the authenticated user and service.",
  2642. // "httpMethod": "GET",
  2643. // "id": "mirror.subscriptions.list",
  2644. // "path": "subscriptions",
  2645. // "response": {
  2646. // "$ref": "SubscriptionsListResponse"
  2647. // },
  2648. // "scopes": [
  2649. // "https://www.googleapis.com/auth/glass.timeline"
  2650. // ]
  2651. // }
  2652. }
  2653. // method id "mirror.subscriptions.update":
  2654. type SubscriptionsUpdateCall struct {
  2655. s *Service
  2656. id string
  2657. subscription *Subscription
  2658. urlParams_ gensupport.URLParams
  2659. ctx_ context.Context
  2660. header_ http.Header
  2661. }
  2662. // Update: Updates an existing subscription in place.
  2663. func (r *SubscriptionsService) Update(id string, subscription *Subscription) *SubscriptionsUpdateCall {
  2664. c := &SubscriptionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2665. c.id = id
  2666. c.subscription = subscription
  2667. return c
  2668. }
  2669. // Fields allows partial responses to be retrieved. See
  2670. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2671. // for more information.
  2672. func (c *SubscriptionsUpdateCall) Fields(s ...googleapi.Field) *SubscriptionsUpdateCall {
  2673. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2674. return c
  2675. }
  2676. // Context sets the context to be used in this call's Do method. Any
  2677. // pending HTTP request will be aborted if the provided context is
  2678. // canceled.
  2679. func (c *SubscriptionsUpdateCall) Context(ctx context.Context) *SubscriptionsUpdateCall {
  2680. c.ctx_ = ctx
  2681. return c
  2682. }
  2683. // Header returns an http.Header that can be modified by the caller to
  2684. // add HTTP headers to the request.
  2685. func (c *SubscriptionsUpdateCall) Header() http.Header {
  2686. if c.header_ == nil {
  2687. c.header_ = make(http.Header)
  2688. }
  2689. return c.header_
  2690. }
  2691. func (c *SubscriptionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2692. reqHeaders := make(http.Header)
  2693. for k, v := range c.header_ {
  2694. reqHeaders[k] = v
  2695. }
  2696. reqHeaders.Set("User-Agent", c.s.userAgent())
  2697. var body io.Reader = nil
  2698. body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
  2699. if err != nil {
  2700. return nil, err
  2701. }
  2702. reqHeaders.Set("Content-Type", "application/json")
  2703. c.urlParams_.Set("alt", alt)
  2704. c.urlParams_.Set("prettyPrint", "false")
  2705. urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{id}")
  2706. urls += "?" + c.urlParams_.Encode()
  2707. req, err := http.NewRequest("PUT", urls, body)
  2708. if err != nil {
  2709. return nil, err
  2710. }
  2711. req.Header = reqHeaders
  2712. googleapi.Expand(req.URL, map[string]string{
  2713. "id": c.id,
  2714. })
  2715. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2716. }
  2717. // Do executes the "mirror.subscriptions.update" call.
  2718. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2719. // status code is an error. Response headers are in either
  2720. // *Subscription.ServerResponse.Header or (if a response was returned at
  2721. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2722. // to check whether the returned error was because
  2723. // http.StatusNotModified was returned.
  2724. func (c *SubscriptionsUpdateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2725. gensupport.SetOptions(c.urlParams_, opts...)
  2726. res, err := c.doRequest("json")
  2727. if res != nil && res.StatusCode == http.StatusNotModified {
  2728. if res.Body != nil {
  2729. res.Body.Close()
  2730. }
  2731. return nil, &googleapi.Error{
  2732. Code: res.StatusCode,
  2733. Header: res.Header,
  2734. }
  2735. }
  2736. if err != nil {
  2737. return nil, err
  2738. }
  2739. defer googleapi.CloseBody(res)
  2740. if err := googleapi.CheckResponse(res); err != nil {
  2741. return nil, err
  2742. }
  2743. ret := &Subscription{
  2744. ServerResponse: googleapi.ServerResponse{
  2745. Header: res.Header,
  2746. HTTPStatusCode: res.StatusCode,
  2747. },
  2748. }
  2749. target := &ret
  2750. if err := gensupport.DecodeResponse(target, res); err != nil {
  2751. return nil, err
  2752. }
  2753. return ret, nil
  2754. // {
  2755. // "description": "Updates an existing subscription in place.",
  2756. // "httpMethod": "PUT",
  2757. // "id": "mirror.subscriptions.update",
  2758. // "parameterOrder": [
  2759. // "id"
  2760. // ],
  2761. // "parameters": {
  2762. // "id": {
  2763. // "description": "The ID of the subscription.",
  2764. // "location": "path",
  2765. // "required": true,
  2766. // "type": "string"
  2767. // }
  2768. // },
  2769. // "path": "subscriptions/{id}",
  2770. // "request": {
  2771. // "$ref": "Subscription"
  2772. // },
  2773. // "response": {
  2774. // "$ref": "Subscription"
  2775. // },
  2776. // "scopes": [
  2777. // "https://www.googleapis.com/auth/glass.timeline"
  2778. // ]
  2779. // }
  2780. }
  2781. // method id "mirror.timeline.delete":
  2782. type TimelineDeleteCall struct {
  2783. s *Service
  2784. id string
  2785. urlParams_ gensupport.URLParams
  2786. ctx_ context.Context
  2787. header_ http.Header
  2788. }
  2789. // Delete: Deletes a timeline item.
  2790. func (r *TimelineService) Delete(id string) *TimelineDeleteCall {
  2791. c := &TimelineDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2792. c.id = id
  2793. return c
  2794. }
  2795. // Fields allows partial responses to be retrieved. See
  2796. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2797. // for more information.
  2798. func (c *TimelineDeleteCall) Fields(s ...googleapi.Field) *TimelineDeleteCall {
  2799. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2800. return c
  2801. }
  2802. // Context sets the context to be used in this call's Do method. Any
  2803. // pending HTTP request will be aborted if the provided context is
  2804. // canceled.
  2805. func (c *TimelineDeleteCall) Context(ctx context.Context) *TimelineDeleteCall {
  2806. c.ctx_ = ctx
  2807. return c
  2808. }
  2809. // Header returns an http.Header that can be modified by the caller to
  2810. // add HTTP headers to the request.
  2811. func (c *TimelineDeleteCall) Header() http.Header {
  2812. if c.header_ == nil {
  2813. c.header_ = make(http.Header)
  2814. }
  2815. return c.header_
  2816. }
  2817. func (c *TimelineDeleteCall) doRequest(alt string) (*http.Response, error) {
  2818. reqHeaders := make(http.Header)
  2819. for k, v := range c.header_ {
  2820. reqHeaders[k] = v
  2821. }
  2822. reqHeaders.Set("User-Agent", c.s.userAgent())
  2823. var body io.Reader = nil
  2824. c.urlParams_.Set("alt", alt)
  2825. c.urlParams_.Set("prettyPrint", "false")
  2826. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
  2827. urls += "?" + c.urlParams_.Encode()
  2828. req, err := http.NewRequest("DELETE", urls, body)
  2829. if err != nil {
  2830. return nil, err
  2831. }
  2832. req.Header = reqHeaders
  2833. googleapi.Expand(req.URL, map[string]string{
  2834. "id": c.id,
  2835. })
  2836. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2837. }
  2838. // Do executes the "mirror.timeline.delete" call.
  2839. func (c *TimelineDeleteCall) Do(opts ...googleapi.CallOption) error {
  2840. gensupport.SetOptions(c.urlParams_, opts...)
  2841. res, err := c.doRequest("json")
  2842. if err != nil {
  2843. return err
  2844. }
  2845. defer googleapi.CloseBody(res)
  2846. if err := googleapi.CheckResponse(res); err != nil {
  2847. return err
  2848. }
  2849. return nil
  2850. // {
  2851. // "description": "Deletes a timeline item.",
  2852. // "httpMethod": "DELETE",
  2853. // "id": "mirror.timeline.delete",
  2854. // "parameterOrder": [
  2855. // "id"
  2856. // ],
  2857. // "parameters": {
  2858. // "id": {
  2859. // "description": "The ID of the timeline item.",
  2860. // "location": "path",
  2861. // "required": true,
  2862. // "type": "string"
  2863. // }
  2864. // },
  2865. // "path": "timeline/{id}",
  2866. // "scopes": [
  2867. // "https://www.googleapis.com/auth/glass.location",
  2868. // "https://www.googleapis.com/auth/glass.timeline"
  2869. // ]
  2870. // }
  2871. }
  2872. // method id "mirror.timeline.get":
  2873. type TimelineGetCall struct {
  2874. s *Service
  2875. id string
  2876. urlParams_ gensupport.URLParams
  2877. ifNoneMatch_ string
  2878. ctx_ context.Context
  2879. header_ http.Header
  2880. }
  2881. // Get: Gets a single timeline item by ID.
  2882. func (r *TimelineService) Get(id string) *TimelineGetCall {
  2883. c := &TimelineGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2884. c.id = id
  2885. return c
  2886. }
  2887. // Fields allows partial responses to be retrieved. See
  2888. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2889. // for more information.
  2890. func (c *TimelineGetCall) Fields(s ...googleapi.Field) *TimelineGetCall {
  2891. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2892. return c
  2893. }
  2894. // IfNoneMatch sets the optional parameter which makes the operation
  2895. // fail if the object's ETag matches the given value. This is useful for
  2896. // getting updates only after the object has changed since the last
  2897. // request. Use googleapi.IsNotModified to check whether the response
  2898. // error from Do is the result of In-None-Match.
  2899. func (c *TimelineGetCall) IfNoneMatch(entityTag string) *TimelineGetCall {
  2900. c.ifNoneMatch_ = entityTag
  2901. return c
  2902. }
  2903. // Context sets the context to be used in this call's Do method. Any
  2904. // pending HTTP request will be aborted if the provided context is
  2905. // canceled.
  2906. func (c *TimelineGetCall) Context(ctx context.Context) *TimelineGetCall {
  2907. c.ctx_ = ctx
  2908. return c
  2909. }
  2910. // Header returns an http.Header that can be modified by the caller to
  2911. // add HTTP headers to the request.
  2912. func (c *TimelineGetCall) Header() http.Header {
  2913. if c.header_ == nil {
  2914. c.header_ = make(http.Header)
  2915. }
  2916. return c.header_
  2917. }
  2918. func (c *TimelineGetCall) doRequest(alt string) (*http.Response, error) {
  2919. reqHeaders := make(http.Header)
  2920. for k, v := range c.header_ {
  2921. reqHeaders[k] = v
  2922. }
  2923. reqHeaders.Set("User-Agent", c.s.userAgent())
  2924. if c.ifNoneMatch_ != "" {
  2925. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2926. }
  2927. var body io.Reader = nil
  2928. c.urlParams_.Set("alt", alt)
  2929. c.urlParams_.Set("prettyPrint", "false")
  2930. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
  2931. urls += "?" + c.urlParams_.Encode()
  2932. req, err := http.NewRequest("GET", urls, body)
  2933. if err != nil {
  2934. return nil, err
  2935. }
  2936. req.Header = reqHeaders
  2937. googleapi.Expand(req.URL, map[string]string{
  2938. "id": c.id,
  2939. })
  2940. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2941. }
  2942. // Do executes the "mirror.timeline.get" call.
  2943. // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
  2944. // status code is an error. Response headers are in either
  2945. // *TimelineItem.ServerResponse.Header or (if a response was returned at
  2946. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2947. // to check whether the returned error was because
  2948. // http.StatusNotModified was returned.
  2949. func (c *TimelineGetCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
  2950. gensupport.SetOptions(c.urlParams_, opts...)
  2951. res, err := c.doRequest("json")
  2952. if res != nil && res.StatusCode == http.StatusNotModified {
  2953. if res.Body != nil {
  2954. res.Body.Close()
  2955. }
  2956. return nil, &googleapi.Error{
  2957. Code: res.StatusCode,
  2958. Header: res.Header,
  2959. }
  2960. }
  2961. if err != nil {
  2962. return nil, err
  2963. }
  2964. defer googleapi.CloseBody(res)
  2965. if err := googleapi.CheckResponse(res); err != nil {
  2966. return nil, err
  2967. }
  2968. ret := &TimelineItem{
  2969. ServerResponse: googleapi.ServerResponse{
  2970. Header: res.Header,
  2971. HTTPStatusCode: res.StatusCode,
  2972. },
  2973. }
  2974. target := &ret
  2975. if err := gensupport.DecodeResponse(target, res); err != nil {
  2976. return nil, err
  2977. }
  2978. return ret, nil
  2979. // {
  2980. // "description": "Gets a single timeline item by ID.",
  2981. // "httpMethod": "GET",
  2982. // "id": "mirror.timeline.get",
  2983. // "parameterOrder": [
  2984. // "id"
  2985. // ],
  2986. // "parameters": {
  2987. // "id": {
  2988. // "description": "The ID of the timeline item.",
  2989. // "location": "path",
  2990. // "required": true,
  2991. // "type": "string"
  2992. // }
  2993. // },
  2994. // "path": "timeline/{id}",
  2995. // "response": {
  2996. // "$ref": "TimelineItem"
  2997. // },
  2998. // "scopes": [
  2999. // "https://www.googleapis.com/auth/glass.location",
  3000. // "https://www.googleapis.com/auth/glass.timeline"
  3001. // ]
  3002. // }
  3003. }
  3004. // method id "mirror.timeline.insert":
  3005. type TimelineInsertCall struct {
  3006. s *Service
  3007. timelineitem *TimelineItem
  3008. urlParams_ gensupport.URLParams
  3009. mediaInfo_ *gensupport.MediaInfo
  3010. ctx_ context.Context
  3011. header_ http.Header
  3012. }
  3013. // Insert: Inserts a new item into the timeline.
  3014. func (r *TimelineService) Insert(timelineitem *TimelineItem) *TimelineInsertCall {
  3015. c := &TimelineInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3016. c.timelineitem = timelineitem
  3017. return c
  3018. }
  3019. // Media specifies the media to upload in one or more chunks. The chunk
  3020. // size may be controlled by supplying a MediaOption generated by
  3021. // googleapi.ChunkSize. The chunk size defaults to
  3022. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  3023. // upload request will be determined by sniffing the contents of r,
  3024. // unless a MediaOption generated by googleapi.ContentType is
  3025. // supplied.
  3026. // At most one of Media and ResumableMedia may be set.
  3027. func (c *TimelineInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *TimelineInsertCall {
  3028. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  3029. return c
  3030. }
  3031. // ResumableMedia specifies the media to upload in chunks and can be
  3032. // canceled with ctx.
  3033. //
  3034. // Deprecated: use Media instead.
  3035. //
  3036. // At most one of Media and ResumableMedia may be set. mediaType
  3037. // identifies the MIME media type of the upload, such as "image/png". If
  3038. // mediaType is "", it will be auto-detected. The provided ctx will
  3039. // supersede any context previously provided to the Context method.
  3040. func (c *TimelineInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TimelineInsertCall {
  3041. c.ctx_ = ctx
  3042. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  3043. return c
  3044. }
  3045. // ProgressUpdater provides a callback function that will be called
  3046. // after every chunk. It should be a low-latency function in order to
  3047. // not slow down the upload operation. This should only be called when
  3048. // using ResumableMedia (as opposed to Media).
  3049. func (c *TimelineInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TimelineInsertCall {
  3050. c.mediaInfo_.SetProgressUpdater(pu)
  3051. return c
  3052. }
  3053. // Fields allows partial responses to be retrieved. See
  3054. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3055. // for more information.
  3056. func (c *TimelineInsertCall) Fields(s ...googleapi.Field) *TimelineInsertCall {
  3057. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3058. return c
  3059. }
  3060. // Context sets the context to be used in this call's Do method. Any
  3061. // pending HTTP request will be aborted if the provided context is
  3062. // canceled.
  3063. // This context will supersede any context previously provided to the
  3064. // ResumableMedia method.
  3065. func (c *TimelineInsertCall) Context(ctx context.Context) *TimelineInsertCall {
  3066. c.ctx_ = ctx
  3067. return c
  3068. }
  3069. // Header returns an http.Header that can be modified by the caller to
  3070. // add HTTP headers to the request.
  3071. func (c *TimelineInsertCall) Header() http.Header {
  3072. if c.header_ == nil {
  3073. c.header_ = make(http.Header)
  3074. }
  3075. return c.header_
  3076. }
  3077. func (c *TimelineInsertCall) doRequest(alt string) (*http.Response, error) {
  3078. reqHeaders := make(http.Header)
  3079. for k, v := range c.header_ {
  3080. reqHeaders[k] = v
  3081. }
  3082. reqHeaders.Set("User-Agent", c.s.userAgent())
  3083. var body io.Reader = nil
  3084. body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
  3085. if err != nil {
  3086. return nil, err
  3087. }
  3088. reqHeaders.Set("Content-Type", "application/json")
  3089. c.urlParams_.Set("alt", alt)
  3090. c.urlParams_.Set("prettyPrint", "false")
  3091. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline")
  3092. if c.mediaInfo_ != nil {
  3093. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  3094. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  3095. }
  3096. if body == nil {
  3097. body = new(bytes.Buffer)
  3098. reqHeaders.Set("Content-Type", "application/json")
  3099. }
  3100. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  3101. defer cleanup()
  3102. urls += "?" + c.urlParams_.Encode()
  3103. req, err := http.NewRequest("POST", urls, body)
  3104. if err != nil {
  3105. return nil, err
  3106. }
  3107. req.Header = reqHeaders
  3108. req.GetBody = getBody
  3109. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3110. }
  3111. // Do executes the "mirror.timeline.insert" call.
  3112. // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
  3113. // status code is an error. Response headers are in either
  3114. // *TimelineItem.ServerResponse.Header or (if a response was returned at
  3115. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3116. // to check whether the returned error was because
  3117. // http.StatusNotModified was returned.
  3118. func (c *TimelineInsertCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
  3119. gensupport.SetOptions(c.urlParams_, opts...)
  3120. res, err := c.doRequest("json")
  3121. if res != nil && res.StatusCode == http.StatusNotModified {
  3122. if res.Body != nil {
  3123. res.Body.Close()
  3124. }
  3125. return nil, &googleapi.Error{
  3126. Code: res.StatusCode,
  3127. Header: res.Header,
  3128. }
  3129. }
  3130. if err != nil {
  3131. return nil, err
  3132. }
  3133. defer googleapi.CloseBody(res)
  3134. if err := googleapi.CheckResponse(res); err != nil {
  3135. return nil, err
  3136. }
  3137. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  3138. if rx != nil {
  3139. rx.Client = c.s.client
  3140. rx.UserAgent = c.s.userAgent()
  3141. ctx := c.ctx_
  3142. if ctx == nil {
  3143. ctx = context.TODO()
  3144. }
  3145. res, err = rx.Upload(ctx)
  3146. if err != nil {
  3147. return nil, err
  3148. }
  3149. defer res.Body.Close()
  3150. if err := googleapi.CheckResponse(res); err != nil {
  3151. return nil, err
  3152. }
  3153. }
  3154. ret := &TimelineItem{
  3155. ServerResponse: googleapi.ServerResponse{
  3156. Header: res.Header,
  3157. HTTPStatusCode: res.StatusCode,
  3158. },
  3159. }
  3160. target := &ret
  3161. if err := gensupport.DecodeResponse(target, res); err != nil {
  3162. return nil, err
  3163. }
  3164. return ret, nil
  3165. // {
  3166. // "description": "Inserts a new item into the timeline.",
  3167. // "httpMethod": "POST",
  3168. // "id": "mirror.timeline.insert",
  3169. // "mediaUpload": {
  3170. // "accept": [
  3171. // "audio/*",
  3172. // "image/*",
  3173. // "video/*"
  3174. // ],
  3175. // "maxSize": "10MB",
  3176. // "protocols": {
  3177. // "resumable": {
  3178. // "multipart": true,
  3179. // "path": "/resumable/upload/mirror/v1/timeline"
  3180. // },
  3181. // "simple": {
  3182. // "multipart": true,
  3183. // "path": "/upload/mirror/v1/timeline"
  3184. // }
  3185. // }
  3186. // },
  3187. // "path": "timeline",
  3188. // "request": {
  3189. // "$ref": "TimelineItem"
  3190. // },
  3191. // "response": {
  3192. // "$ref": "TimelineItem"
  3193. // },
  3194. // "scopes": [
  3195. // "https://www.googleapis.com/auth/glass.location",
  3196. // "https://www.googleapis.com/auth/glass.timeline"
  3197. // ],
  3198. // "supportsMediaUpload": true
  3199. // }
  3200. }
  3201. // method id "mirror.timeline.list":
  3202. type TimelineListCall struct {
  3203. s *Service
  3204. urlParams_ gensupport.URLParams
  3205. ifNoneMatch_ string
  3206. ctx_ context.Context
  3207. header_ http.Header
  3208. }
  3209. // List: Retrieves a list of timeline items for the authenticated user.
  3210. func (r *TimelineService) List() *TimelineListCall {
  3211. c := &TimelineListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3212. return c
  3213. }
  3214. // BundleId sets the optional parameter "bundleId": If provided, only
  3215. // items with the given bundleId will be returned.
  3216. func (c *TimelineListCall) BundleId(bundleId string) *TimelineListCall {
  3217. c.urlParams_.Set("bundleId", bundleId)
  3218. return c
  3219. }
  3220. // IncludeDeleted sets the optional parameter "includeDeleted": If true,
  3221. // tombstone records for deleted items will be returned.
  3222. func (c *TimelineListCall) IncludeDeleted(includeDeleted bool) *TimelineListCall {
  3223. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3224. return c
  3225. }
  3226. // MaxResults sets the optional parameter "maxResults": The maximum
  3227. // number of items to include in the response, used for paging.
  3228. func (c *TimelineListCall) MaxResults(maxResults int64) *TimelineListCall {
  3229. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3230. return c
  3231. }
  3232. // OrderBy sets the optional parameter "orderBy": Controls the order in
  3233. // which timeline items are returned.
  3234. //
  3235. // Possible values:
  3236. // "displayTime" - Results will be ordered by displayTime (default).
  3237. // This is the same ordering as is used in the timeline on the device.
  3238. // "writeTime" - Results will be ordered by the time at which they
  3239. // were last written to the data store.
  3240. func (c *TimelineListCall) OrderBy(orderBy string) *TimelineListCall {
  3241. c.urlParams_.Set("orderBy", orderBy)
  3242. return c
  3243. }
  3244. // PageToken sets the optional parameter "pageToken": Token for the page
  3245. // of results to return.
  3246. func (c *TimelineListCall) PageToken(pageToken string) *TimelineListCall {
  3247. c.urlParams_.Set("pageToken", pageToken)
  3248. return c
  3249. }
  3250. // PinnedOnly sets the optional parameter "pinnedOnly": If true, only
  3251. // pinned items will be returned.
  3252. func (c *TimelineListCall) PinnedOnly(pinnedOnly bool) *TimelineListCall {
  3253. c.urlParams_.Set("pinnedOnly", fmt.Sprint(pinnedOnly))
  3254. return c
  3255. }
  3256. // SourceItemId sets the optional parameter "sourceItemId": If provided,
  3257. // only items with the given sourceItemId will be returned.
  3258. func (c *TimelineListCall) SourceItemId(sourceItemId string) *TimelineListCall {
  3259. c.urlParams_.Set("sourceItemId", sourceItemId)
  3260. return c
  3261. }
  3262. // Fields allows partial responses to be retrieved. See
  3263. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3264. // for more information.
  3265. func (c *TimelineListCall) Fields(s ...googleapi.Field) *TimelineListCall {
  3266. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3267. return c
  3268. }
  3269. // IfNoneMatch sets the optional parameter which makes the operation
  3270. // fail if the object's ETag matches the given value. This is useful for
  3271. // getting updates only after the object has changed since the last
  3272. // request. Use googleapi.IsNotModified to check whether the response
  3273. // error from Do is the result of In-None-Match.
  3274. func (c *TimelineListCall) IfNoneMatch(entityTag string) *TimelineListCall {
  3275. c.ifNoneMatch_ = entityTag
  3276. return c
  3277. }
  3278. // Context sets the context to be used in this call's Do method. Any
  3279. // pending HTTP request will be aborted if the provided context is
  3280. // canceled.
  3281. func (c *TimelineListCall) Context(ctx context.Context) *TimelineListCall {
  3282. c.ctx_ = ctx
  3283. return c
  3284. }
  3285. // Header returns an http.Header that can be modified by the caller to
  3286. // add HTTP headers to the request.
  3287. func (c *TimelineListCall) Header() http.Header {
  3288. if c.header_ == nil {
  3289. c.header_ = make(http.Header)
  3290. }
  3291. return c.header_
  3292. }
  3293. func (c *TimelineListCall) doRequest(alt string) (*http.Response, error) {
  3294. reqHeaders := make(http.Header)
  3295. for k, v := range c.header_ {
  3296. reqHeaders[k] = v
  3297. }
  3298. reqHeaders.Set("User-Agent", c.s.userAgent())
  3299. if c.ifNoneMatch_ != "" {
  3300. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3301. }
  3302. var body io.Reader = nil
  3303. c.urlParams_.Set("alt", alt)
  3304. c.urlParams_.Set("prettyPrint", "false")
  3305. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline")
  3306. urls += "?" + c.urlParams_.Encode()
  3307. req, err := http.NewRequest("GET", urls, body)
  3308. if err != nil {
  3309. return nil, err
  3310. }
  3311. req.Header = reqHeaders
  3312. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3313. }
  3314. // Do executes the "mirror.timeline.list" call.
  3315. // Exactly one of *TimelineListResponse or error will be non-nil. Any
  3316. // non-2xx status code is an error. Response headers are in either
  3317. // *TimelineListResponse.ServerResponse.Header or (if a response was
  3318. // returned at all) in error.(*googleapi.Error).Header. Use
  3319. // googleapi.IsNotModified to check whether the returned error was
  3320. // because http.StatusNotModified was returned.
  3321. func (c *TimelineListCall) Do(opts ...googleapi.CallOption) (*TimelineListResponse, error) {
  3322. gensupport.SetOptions(c.urlParams_, opts...)
  3323. res, err := c.doRequest("json")
  3324. if res != nil && res.StatusCode == http.StatusNotModified {
  3325. if res.Body != nil {
  3326. res.Body.Close()
  3327. }
  3328. return nil, &googleapi.Error{
  3329. Code: res.StatusCode,
  3330. Header: res.Header,
  3331. }
  3332. }
  3333. if err != nil {
  3334. return nil, err
  3335. }
  3336. defer googleapi.CloseBody(res)
  3337. if err := googleapi.CheckResponse(res); err != nil {
  3338. return nil, err
  3339. }
  3340. ret := &TimelineListResponse{
  3341. ServerResponse: googleapi.ServerResponse{
  3342. Header: res.Header,
  3343. HTTPStatusCode: res.StatusCode,
  3344. },
  3345. }
  3346. target := &ret
  3347. if err := gensupport.DecodeResponse(target, res); err != nil {
  3348. return nil, err
  3349. }
  3350. return ret, nil
  3351. // {
  3352. // "description": "Retrieves a list of timeline items for the authenticated user.",
  3353. // "httpMethod": "GET",
  3354. // "id": "mirror.timeline.list",
  3355. // "parameters": {
  3356. // "bundleId": {
  3357. // "description": "If provided, only items with the given bundleId will be returned.",
  3358. // "location": "query",
  3359. // "type": "string"
  3360. // },
  3361. // "includeDeleted": {
  3362. // "description": "If true, tombstone records for deleted items will be returned.",
  3363. // "location": "query",
  3364. // "type": "boolean"
  3365. // },
  3366. // "maxResults": {
  3367. // "description": "The maximum number of items to include in the response, used for paging.",
  3368. // "format": "uint32",
  3369. // "location": "query",
  3370. // "type": "integer"
  3371. // },
  3372. // "orderBy": {
  3373. // "description": "Controls the order in which timeline items are returned.",
  3374. // "enum": [
  3375. // "displayTime",
  3376. // "writeTime"
  3377. // ],
  3378. // "enumDescriptions": [
  3379. // "Results will be ordered by displayTime (default). This is the same ordering as is used in the timeline on the device.",
  3380. // "Results will be ordered by the time at which they were last written to the data store."
  3381. // ],
  3382. // "location": "query",
  3383. // "type": "string"
  3384. // },
  3385. // "pageToken": {
  3386. // "description": "Token for the page of results to return.",
  3387. // "location": "query",
  3388. // "type": "string"
  3389. // },
  3390. // "pinnedOnly": {
  3391. // "description": "If true, only pinned items will be returned.",
  3392. // "location": "query",
  3393. // "type": "boolean"
  3394. // },
  3395. // "sourceItemId": {
  3396. // "description": "If provided, only items with the given sourceItemId will be returned.",
  3397. // "location": "query",
  3398. // "type": "string"
  3399. // }
  3400. // },
  3401. // "path": "timeline",
  3402. // "response": {
  3403. // "$ref": "TimelineListResponse"
  3404. // },
  3405. // "scopes": [
  3406. // "https://www.googleapis.com/auth/glass.location",
  3407. // "https://www.googleapis.com/auth/glass.timeline"
  3408. // ]
  3409. // }
  3410. }
  3411. // Pages invokes f for each page of results.
  3412. // A non-nil error returned from f will halt the iteration.
  3413. // The provided context supersedes any context provided to the Context method.
  3414. func (c *TimelineListCall) Pages(ctx context.Context, f func(*TimelineListResponse) error) error {
  3415. c.ctx_ = ctx
  3416. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3417. for {
  3418. x, err := c.Do()
  3419. if err != nil {
  3420. return err
  3421. }
  3422. if err := f(x); err != nil {
  3423. return err
  3424. }
  3425. if x.NextPageToken == "" {
  3426. return nil
  3427. }
  3428. c.PageToken(x.NextPageToken)
  3429. }
  3430. }
  3431. // method id "mirror.timeline.patch":
  3432. type TimelinePatchCall struct {
  3433. s *Service
  3434. id string
  3435. timelineitem *TimelineItem
  3436. urlParams_ gensupport.URLParams
  3437. ctx_ context.Context
  3438. header_ http.Header
  3439. }
  3440. // Patch: Updates a timeline item in place. This method supports patch
  3441. // semantics.
  3442. func (r *TimelineService) Patch(id string, timelineitem *TimelineItem) *TimelinePatchCall {
  3443. c := &TimelinePatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3444. c.id = id
  3445. c.timelineitem = timelineitem
  3446. return c
  3447. }
  3448. // Fields allows partial responses to be retrieved. See
  3449. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3450. // for more information.
  3451. func (c *TimelinePatchCall) Fields(s ...googleapi.Field) *TimelinePatchCall {
  3452. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3453. return c
  3454. }
  3455. // Context sets the context to be used in this call's Do method. Any
  3456. // pending HTTP request will be aborted if the provided context is
  3457. // canceled.
  3458. func (c *TimelinePatchCall) Context(ctx context.Context) *TimelinePatchCall {
  3459. c.ctx_ = ctx
  3460. return c
  3461. }
  3462. // Header returns an http.Header that can be modified by the caller to
  3463. // add HTTP headers to the request.
  3464. func (c *TimelinePatchCall) Header() http.Header {
  3465. if c.header_ == nil {
  3466. c.header_ = make(http.Header)
  3467. }
  3468. return c.header_
  3469. }
  3470. func (c *TimelinePatchCall) doRequest(alt string) (*http.Response, error) {
  3471. reqHeaders := make(http.Header)
  3472. for k, v := range c.header_ {
  3473. reqHeaders[k] = v
  3474. }
  3475. reqHeaders.Set("User-Agent", c.s.userAgent())
  3476. var body io.Reader = nil
  3477. body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
  3478. if err != nil {
  3479. return nil, err
  3480. }
  3481. reqHeaders.Set("Content-Type", "application/json")
  3482. c.urlParams_.Set("alt", alt)
  3483. c.urlParams_.Set("prettyPrint", "false")
  3484. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
  3485. urls += "?" + c.urlParams_.Encode()
  3486. req, err := http.NewRequest("PATCH", urls, body)
  3487. if err != nil {
  3488. return nil, err
  3489. }
  3490. req.Header = reqHeaders
  3491. googleapi.Expand(req.URL, map[string]string{
  3492. "id": c.id,
  3493. })
  3494. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3495. }
  3496. // Do executes the "mirror.timeline.patch" call.
  3497. // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
  3498. // status code is an error. Response headers are in either
  3499. // *TimelineItem.ServerResponse.Header or (if a response was returned at
  3500. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3501. // to check whether the returned error was because
  3502. // http.StatusNotModified was returned.
  3503. func (c *TimelinePatchCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
  3504. gensupport.SetOptions(c.urlParams_, opts...)
  3505. res, err := c.doRequest("json")
  3506. if res != nil && res.StatusCode == http.StatusNotModified {
  3507. if res.Body != nil {
  3508. res.Body.Close()
  3509. }
  3510. return nil, &googleapi.Error{
  3511. Code: res.StatusCode,
  3512. Header: res.Header,
  3513. }
  3514. }
  3515. if err != nil {
  3516. return nil, err
  3517. }
  3518. defer googleapi.CloseBody(res)
  3519. if err := googleapi.CheckResponse(res); err != nil {
  3520. return nil, err
  3521. }
  3522. ret := &TimelineItem{
  3523. ServerResponse: googleapi.ServerResponse{
  3524. Header: res.Header,
  3525. HTTPStatusCode: res.StatusCode,
  3526. },
  3527. }
  3528. target := &ret
  3529. if err := gensupport.DecodeResponse(target, res); err != nil {
  3530. return nil, err
  3531. }
  3532. return ret, nil
  3533. // {
  3534. // "description": "Updates a timeline item in place. This method supports patch semantics.",
  3535. // "httpMethod": "PATCH",
  3536. // "id": "mirror.timeline.patch",
  3537. // "parameterOrder": [
  3538. // "id"
  3539. // ],
  3540. // "parameters": {
  3541. // "id": {
  3542. // "description": "The ID of the timeline item.",
  3543. // "location": "path",
  3544. // "required": true,
  3545. // "type": "string"
  3546. // }
  3547. // },
  3548. // "path": "timeline/{id}",
  3549. // "request": {
  3550. // "$ref": "TimelineItem"
  3551. // },
  3552. // "response": {
  3553. // "$ref": "TimelineItem"
  3554. // },
  3555. // "scopes": [
  3556. // "https://www.googleapis.com/auth/glass.location",
  3557. // "https://www.googleapis.com/auth/glass.timeline"
  3558. // ]
  3559. // }
  3560. }
  3561. // method id "mirror.timeline.update":
  3562. type TimelineUpdateCall struct {
  3563. s *Service
  3564. id string
  3565. timelineitem *TimelineItem
  3566. urlParams_ gensupport.URLParams
  3567. mediaInfo_ *gensupport.MediaInfo
  3568. ctx_ context.Context
  3569. header_ http.Header
  3570. }
  3571. // Update: Updates a timeline item in place.
  3572. func (r *TimelineService) Update(id string, timelineitem *TimelineItem) *TimelineUpdateCall {
  3573. c := &TimelineUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3574. c.id = id
  3575. c.timelineitem = timelineitem
  3576. return c
  3577. }
  3578. // Media specifies the media to upload in one or more chunks. The chunk
  3579. // size may be controlled by supplying a MediaOption generated by
  3580. // googleapi.ChunkSize. The chunk size defaults to
  3581. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  3582. // upload request will be determined by sniffing the contents of r,
  3583. // unless a MediaOption generated by googleapi.ContentType is
  3584. // supplied.
  3585. // At most one of Media and ResumableMedia may be set.
  3586. func (c *TimelineUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *TimelineUpdateCall {
  3587. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  3588. return c
  3589. }
  3590. // ResumableMedia specifies the media to upload in chunks and can be
  3591. // canceled with ctx.
  3592. //
  3593. // Deprecated: use Media instead.
  3594. //
  3595. // At most one of Media and ResumableMedia may be set. mediaType
  3596. // identifies the MIME media type of the upload, such as "image/png". If
  3597. // mediaType is "", it will be auto-detected. The provided ctx will
  3598. // supersede any context previously provided to the Context method.
  3599. func (c *TimelineUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TimelineUpdateCall {
  3600. c.ctx_ = ctx
  3601. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  3602. return c
  3603. }
  3604. // ProgressUpdater provides a callback function that will be called
  3605. // after every chunk. It should be a low-latency function in order to
  3606. // not slow down the upload operation. This should only be called when
  3607. // using ResumableMedia (as opposed to Media).
  3608. func (c *TimelineUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TimelineUpdateCall {
  3609. c.mediaInfo_.SetProgressUpdater(pu)
  3610. return c
  3611. }
  3612. // Fields allows partial responses to be retrieved. See
  3613. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3614. // for more information.
  3615. func (c *TimelineUpdateCall) Fields(s ...googleapi.Field) *TimelineUpdateCall {
  3616. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3617. return c
  3618. }
  3619. // Context sets the context to be used in this call's Do method. Any
  3620. // pending HTTP request will be aborted if the provided context is
  3621. // canceled.
  3622. // This context will supersede any context previously provided to the
  3623. // ResumableMedia method.
  3624. func (c *TimelineUpdateCall) Context(ctx context.Context) *TimelineUpdateCall {
  3625. c.ctx_ = ctx
  3626. return c
  3627. }
  3628. // Header returns an http.Header that can be modified by the caller to
  3629. // add HTTP headers to the request.
  3630. func (c *TimelineUpdateCall) Header() http.Header {
  3631. if c.header_ == nil {
  3632. c.header_ = make(http.Header)
  3633. }
  3634. return c.header_
  3635. }
  3636. func (c *TimelineUpdateCall) doRequest(alt string) (*http.Response, error) {
  3637. reqHeaders := make(http.Header)
  3638. for k, v := range c.header_ {
  3639. reqHeaders[k] = v
  3640. }
  3641. reqHeaders.Set("User-Agent", c.s.userAgent())
  3642. var body io.Reader = nil
  3643. body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
  3644. if err != nil {
  3645. return nil, err
  3646. }
  3647. reqHeaders.Set("Content-Type", "application/json")
  3648. c.urlParams_.Set("alt", alt)
  3649. c.urlParams_.Set("prettyPrint", "false")
  3650. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
  3651. if c.mediaInfo_ != nil {
  3652. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  3653. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  3654. }
  3655. if body == nil {
  3656. body = new(bytes.Buffer)
  3657. reqHeaders.Set("Content-Type", "application/json")
  3658. }
  3659. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  3660. defer cleanup()
  3661. urls += "?" + c.urlParams_.Encode()
  3662. req, err := http.NewRequest("PUT", urls, body)
  3663. if err != nil {
  3664. return nil, err
  3665. }
  3666. req.Header = reqHeaders
  3667. req.GetBody = getBody
  3668. googleapi.Expand(req.URL, map[string]string{
  3669. "id": c.id,
  3670. })
  3671. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3672. }
  3673. // Do executes the "mirror.timeline.update" call.
  3674. // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
  3675. // status code is an error. Response headers are in either
  3676. // *TimelineItem.ServerResponse.Header or (if a response was returned at
  3677. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3678. // to check whether the returned error was because
  3679. // http.StatusNotModified was returned.
  3680. func (c *TimelineUpdateCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
  3681. gensupport.SetOptions(c.urlParams_, opts...)
  3682. res, err := c.doRequest("json")
  3683. if res != nil && res.StatusCode == http.StatusNotModified {
  3684. if res.Body != nil {
  3685. res.Body.Close()
  3686. }
  3687. return nil, &googleapi.Error{
  3688. Code: res.StatusCode,
  3689. Header: res.Header,
  3690. }
  3691. }
  3692. if err != nil {
  3693. return nil, err
  3694. }
  3695. defer googleapi.CloseBody(res)
  3696. if err := googleapi.CheckResponse(res); err != nil {
  3697. return nil, err
  3698. }
  3699. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  3700. if rx != nil {
  3701. rx.Client = c.s.client
  3702. rx.UserAgent = c.s.userAgent()
  3703. ctx := c.ctx_
  3704. if ctx == nil {
  3705. ctx = context.TODO()
  3706. }
  3707. res, err = rx.Upload(ctx)
  3708. if err != nil {
  3709. return nil, err
  3710. }
  3711. defer res.Body.Close()
  3712. if err := googleapi.CheckResponse(res); err != nil {
  3713. return nil, err
  3714. }
  3715. }
  3716. ret := &TimelineItem{
  3717. ServerResponse: googleapi.ServerResponse{
  3718. Header: res.Header,
  3719. HTTPStatusCode: res.StatusCode,
  3720. },
  3721. }
  3722. target := &ret
  3723. if err := gensupport.DecodeResponse(target, res); err != nil {
  3724. return nil, err
  3725. }
  3726. return ret, nil
  3727. // {
  3728. // "description": "Updates a timeline item in place.",
  3729. // "httpMethod": "PUT",
  3730. // "id": "mirror.timeline.update",
  3731. // "mediaUpload": {
  3732. // "accept": [
  3733. // "audio/*",
  3734. // "image/*",
  3735. // "video/*"
  3736. // ],
  3737. // "maxSize": "10MB",
  3738. // "protocols": {
  3739. // "resumable": {
  3740. // "multipart": true,
  3741. // "path": "/resumable/upload/mirror/v1/timeline/{id}"
  3742. // },
  3743. // "simple": {
  3744. // "multipart": true,
  3745. // "path": "/upload/mirror/v1/timeline/{id}"
  3746. // }
  3747. // }
  3748. // },
  3749. // "parameterOrder": [
  3750. // "id"
  3751. // ],
  3752. // "parameters": {
  3753. // "id": {
  3754. // "description": "The ID of the timeline item.",
  3755. // "location": "path",
  3756. // "required": true,
  3757. // "type": "string"
  3758. // }
  3759. // },
  3760. // "path": "timeline/{id}",
  3761. // "request": {
  3762. // "$ref": "TimelineItem"
  3763. // },
  3764. // "response": {
  3765. // "$ref": "TimelineItem"
  3766. // },
  3767. // "scopes": [
  3768. // "https://www.googleapis.com/auth/glass.location",
  3769. // "https://www.googleapis.com/auth/glass.timeline"
  3770. // ],
  3771. // "supportsMediaUpload": true
  3772. // }
  3773. }
  3774. // method id "mirror.timeline.attachments.delete":
  3775. type TimelineAttachmentsDeleteCall struct {
  3776. s *Service
  3777. itemId string
  3778. attachmentId string
  3779. urlParams_ gensupport.URLParams
  3780. ctx_ context.Context
  3781. header_ http.Header
  3782. }
  3783. // Delete: Deletes an attachment from a timeline item.
  3784. func (r *TimelineAttachmentsService) Delete(itemId string, attachmentId string) *TimelineAttachmentsDeleteCall {
  3785. c := &TimelineAttachmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3786. c.itemId = itemId
  3787. c.attachmentId = attachmentId
  3788. return c
  3789. }
  3790. // Fields allows partial responses to be retrieved. See
  3791. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3792. // for more information.
  3793. func (c *TimelineAttachmentsDeleteCall) Fields(s ...googleapi.Field) *TimelineAttachmentsDeleteCall {
  3794. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3795. return c
  3796. }
  3797. // Context sets the context to be used in this call's Do method. Any
  3798. // pending HTTP request will be aborted if the provided context is
  3799. // canceled.
  3800. func (c *TimelineAttachmentsDeleteCall) Context(ctx context.Context) *TimelineAttachmentsDeleteCall {
  3801. c.ctx_ = ctx
  3802. return c
  3803. }
  3804. // Header returns an http.Header that can be modified by the caller to
  3805. // add HTTP headers to the request.
  3806. func (c *TimelineAttachmentsDeleteCall) Header() http.Header {
  3807. if c.header_ == nil {
  3808. c.header_ = make(http.Header)
  3809. }
  3810. return c.header_
  3811. }
  3812. func (c *TimelineAttachmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3813. reqHeaders := make(http.Header)
  3814. for k, v := range c.header_ {
  3815. reqHeaders[k] = v
  3816. }
  3817. reqHeaders.Set("User-Agent", c.s.userAgent())
  3818. var body io.Reader = nil
  3819. c.urlParams_.Set("alt", alt)
  3820. c.urlParams_.Set("prettyPrint", "false")
  3821. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments/{attachmentId}")
  3822. urls += "?" + c.urlParams_.Encode()
  3823. req, err := http.NewRequest("DELETE", urls, body)
  3824. if err != nil {
  3825. return nil, err
  3826. }
  3827. req.Header = reqHeaders
  3828. googleapi.Expand(req.URL, map[string]string{
  3829. "itemId": c.itemId,
  3830. "attachmentId": c.attachmentId,
  3831. })
  3832. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3833. }
  3834. // Do executes the "mirror.timeline.attachments.delete" call.
  3835. func (c *TimelineAttachmentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3836. gensupport.SetOptions(c.urlParams_, opts...)
  3837. res, err := c.doRequest("json")
  3838. if err != nil {
  3839. return err
  3840. }
  3841. defer googleapi.CloseBody(res)
  3842. if err := googleapi.CheckResponse(res); err != nil {
  3843. return err
  3844. }
  3845. return nil
  3846. // {
  3847. // "description": "Deletes an attachment from a timeline item.",
  3848. // "httpMethod": "DELETE",
  3849. // "id": "mirror.timeline.attachments.delete",
  3850. // "parameterOrder": [
  3851. // "itemId",
  3852. // "attachmentId"
  3853. // ],
  3854. // "parameters": {
  3855. // "attachmentId": {
  3856. // "description": "The ID of the attachment.",
  3857. // "location": "path",
  3858. // "required": true,
  3859. // "type": "string"
  3860. // },
  3861. // "itemId": {
  3862. // "description": "The ID of the timeline item the attachment belongs to.",
  3863. // "location": "path",
  3864. // "required": true,
  3865. // "type": "string"
  3866. // }
  3867. // },
  3868. // "path": "timeline/{itemId}/attachments/{attachmentId}",
  3869. // "scopes": [
  3870. // "https://www.googleapis.com/auth/glass.timeline"
  3871. // ]
  3872. // }
  3873. }
  3874. // method id "mirror.timeline.attachments.get":
  3875. type TimelineAttachmentsGetCall struct {
  3876. s *Service
  3877. itemId string
  3878. attachmentId string
  3879. urlParams_ gensupport.URLParams
  3880. ifNoneMatch_ string
  3881. ctx_ context.Context
  3882. header_ http.Header
  3883. }
  3884. // Get: Retrieves an attachment on a timeline item by item ID and
  3885. // attachment ID.
  3886. func (r *TimelineAttachmentsService) Get(itemId string, attachmentId string) *TimelineAttachmentsGetCall {
  3887. c := &TimelineAttachmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3888. c.itemId = itemId
  3889. c.attachmentId = attachmentId
  3890. return c
  3891. }
  3892. // Fields allows partial responses to be retrieved. See
  3893. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3894. // for more information.
  3895. func (c *TimelineAttachmentsGetCall) Fields(s ...googleapi.Field) *TimelineAttachmentsGetCall {
  3896. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3897. return c
  3898. }
  3899. // IfNoneMatch sets the optional parameter which makes the operation
  3900. // fail if the object's ETag matches the given value. This is useful for
  3901. // getting updates only after the object has changed since the last
  3902. // request. Use googleapi.IsNotModified to check whether the response
  3903. // error from Do is the result of In-None-Match.
  3904. func (c *TimelineAttachmentsGetCall) IfNoneMatch(entityTag string) *TimelineAttachmentsGetCall {
  3905. c.ifNoneMatch_ = entityTag
  3906. return c
  3907. }
  3908. // Context sets the context to be used in this call's Do and Download
  3909. // methods. Any pending HTTP request will be aborted if the provided
  3910. // context is canceled.
  3911. func (c *TimelineAttachmentsGetCall) Context(ctx context.Context) *TimelineAttachmentsGetCall {
  3912. c.ctx_ = ctx
  3913. return c
  3914. }
  3915. // Header returns an http.Header that can be modified by the caller to
  3916. // add HTTP headers to the request.
  3917. func (c *TimelineAttachmentsGetCall) Header() http.Header {
  3918. if c.header_ == nil {
  3919. c.header_ = make(http.Header)
  3920. }
  3921. return c.header_
  3922. }
  3923. func (c *TimelineAttachmentsGetCall) doRequest(alt string) (*http.Response, error) {
  3924. reqHeaders := make(http.Header)
  3925. for k, v := range c.header_ {
  3926. reqHeaders[k] = v
  3927. }
  3928. reqHeaders.Set("User-Agent", c.s.userAgent())
  3929. if c.ifNoneMatch_ != "" {
  3930. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3931. }
  3932. var body io.Reader = nil
  3933. c.urlParams_.Set("alt", alt)
  3934. c.urlParams_.Set("prettyPrint", "false")
  3935. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments/{attachmentId}")
  3936. urls += "?" + c.urlParams_.Encode()
  3937. req, err := http.NewRequest("GET", urls, body)
  3938. if err != nil {
  3939. return nil, err
  3940. }
  3941. req.Header = reqHeaders
  3942. googleapi.Expand(req.URL, map[string]string{
  3943. "itemId": c.itemId,
  3944. "attachmentId": c.attachmentId,
  3945. })
  3946. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3947. }
  3948. // Download fetches the API endpoint's "media" value, instead of the normal
  3949. // API response value. If the returned error is nil, the Response is guaranteed to
  3950. // have a 2xx status code. Callers must close the Response.Body as usual.
  3951. func (c *TimelineAttachmentsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  3952. gensupport.SetOptions(c.urlParams_, opts...)
  3953. res, err := c.doRequest("media")
  3954. if err != nil {
  3955. return nil, err
  3956. }
  3957. if err := googleapi.CheckMediaResponse(res); err != nil {
  3958. res.Body.Close()
  3959. return nil, err
  3960. }
  3961. return res, nil
  3962. }
  3963. // Do executes the "mirror.timeline.attachments.get" call.
  3964. // Exactly one of *Attachment or error will be non-nil. Any non-2xx
  3965. // status code is an error. Response headers are in either
  3966. // *Attachment.ServerResponse.Header or (if a response was returned at
  3967. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3968. // to check whether the returned error was because
  3969. // http.StatusNotModified was returned.
  3970. func (c *TimelineAttachmentsGetCall) Do(opts ...googleapi.CallOption) (*Attachment, error) {
  3971. gensupport.SetOptions(c.urlParams_, opts...)
  3972. res, err := c.doRequest("json")
  3973. if res != nil && res.StatusCode == http.StatusNotModified {
  3974. if res.Body != nil {
  3975. res.Body.Close()
  3976. }
  3977. return nil, &googleapi.Error{
  3978. Code: res.StatusCode,
  3979. Header: res.Header,
  3980. }
  3981. }
  3982. if err != nil {
  3983. return nil, err
  3984. }
  3985. defer googleapi.CloseBody(res)
  3986. if err := googleapi.CheckResponse(res); err != nil {
  3987. return nil, err
  3988. }
  3989. ret := &Attachment{
  3990. ServerResponse: googleapi.ServerResponse{
  3991. Header: res.Header,
  3992. HTTPStatusCode: res.StatusCode,
  3993. },
  3994. }
  3995. target := &ret
  3996. if err := gensupport.DecodeResponse(target, res); err != nil {
  3997. return nil, err
  3998. }
  3999. return ret, nil
  4000. // {
  4001. // "description": "Retrieves an attachment on a timeline item by item ID and attachment ID.",
  4002. // "httpMethod": "GET",
  4003. // "id": "mirror.timeline.attachments.get",
  4004. // "parameterOrder": [
  4005. // "itemId",
  4006. // "attachmentId"
  4007. // ],
  4008. // "parameters": {
  4009. // "attachmentId": {
  4010. // "description": "The ID of the attachment.",
  4011. // "location": "path",
  4012. // "required": true,
  4013. // "type": "string"
  4014. // },
  4015. // "itemId": {
  4016. // "description": "The ID of the timeline item the attachment belongs to.",
  4017. // "location": "path",
  4018. // "required": true,
  4019. // "type": "string"
  4020. // }
  4021. // },
  4022. // "path": "timeline/{itemId}/attachments/{attachmentId}",
  4023. // "response": {
  4024. // "$ref": "Attachment"
  4025. // },
  4026. // "scopes": [
  4027. // "https://www.googleapis.com/auth/glass.timeline"
  4028. // ],
  4029. // "supportsMediaDownload": true
  4030. // }
  4031. }
  4032. // method id "mirror.timeline.attachments.insert":
  4033. type TimelineAttachmentsInsertCall struct {
  4034. s *Service
  4035. itemId string
  4036. urlParams_ gensupport.URLParams
  4037. mediaInfo_ *gensupport.MediaInfo
  4038. ctx_ context.Context
  4039. header_ http.Header
  4040. }
  4041. // Insert: Adds a new attachment to a timeline item.
  4042. func (r *TimelineAttachmentsService) Insert(itemId string) *TimelineAttachmentsInsertCall {
  4043. c := &TimelineAttachmentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4044. c.itemId = itemId
  4045. return c
  4046. }
  4047. // Media specifies the media to upload in one or more chunks. The chunk
  4048. // size may be controlled by supplying a MediaOption generated by
  4049. // googleapi.ChunkSize. The chunk size defaults to
  4050. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  4051. // upload request will be determined by sniffing the contents of r,
  4052. // unless a MediaOption generated by googleapi.ContentType is
  4053. // supplied.
  4054. // At most one of Media and ResumableMedia may be set.
  4055. func (c *TimelineAttachmentsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *TimelineAttachmentsInsertCall {
  4056. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  4057. return c
  4058. }
  4059. // ResumableMedia specifies the media to upload in chunks and can be
  4060. // canceled with ctx.
  4061. //
  4062. // Deprecated: use Media instead.
  4063. //
  4064. // At most one of Media and ResumableMedia may be set. mediaType
  4065. // identifies the MIME media type of the upload, such as "image/png". If
  4066. // mediaType is "", it will be auto-detected. The provided ctx will
  4067. // supersede any context previously provided to the Context method.
  4068. func (c *TimelineAttachmentsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TimelineAttachmentsInsertCall {
  4069. c.ctx_ = ctx
  4070. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  4071. return c
  4072. }
  4073. // ProgressUpdater provides a callback function that will be called
  4074. // after every chunk. It should be a low-latency function in order to
  4075. // not slow down the upload operation. This should only be called when
  4076. // using ResumableMedia (as opposed to Media).
  4077. func (c *TimelineAttachmentsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TimelineAttachmentsInsertCall {
  4078. c.mediaInfo_.SetProgressUpdater(pu)
  4079. return c
  4080. }
  4081. // Fields allows partial responses to be retrieved. See
  4082. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4083. // for more information.
  4084. func (c *TimelineAttachmentsInsertCall) Fields(s ...googleapi.Field) *TimelineAttachmentsInsertCall {
  4085. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4086. return c
  4087. }
  4088. // Context sets the context to be used in this call's Do method. Any
  4089. // pending HTTP request will be aborted if the provided context is
  4090. // canceled.
  4091. // This context will supersede any context previously provided to the
  4092. // ResumableMedia method.
  4093. func (c *TimelineAttachmentsInsertCall) Context(ctx context.Context) *TimelineAttachmentsInsertCall {
  4094. c.ctx_ = ctx
  4095. return c
  4096. }
  4097. // Header returns an http.Header that can be modified by the caller to
  4098. // add HTTP headers to the request.
  4099. func (c *TimelineAttachmentsInsertCall) Header() http.Header {
  4100. if c.header_ == nil {
  4101. c.header_ = make(http.Header)
  4102. }
  4103. return c.header_
  4104. }
  4105. func (c *TimelineAttachmentsInsertCall) doRequest(alt string) (*http.Response, error) {
  4106. reqHeaders := make(http.Header)
  4107. for k, v := range c.header_ {
  4108. reqHeaders[k] = v
  4109. }
  4110. reqHeaders.Set("User-Agent", c.s.userAgent())
  4111. var body io.Reader = nil
  4112. c.urlParams_.Set("alt", alt)
  4113. c.urlParams_.Set("prettyPrint", "false")
  4114. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments")
  4115. if c.mediaInfo_ != nil {
  4116. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  4117. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  4118. }
  4119. if body == nil {
  4120. body = new(bytes.Buffer)
  4121. reqHeaders.Set("Content-Type", "application/json")
  4122. }
  4123. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  4124. defer cleanup()
  4125. urls += "?" + c.urlParams_.Encode()
  4126. req, err := http.NewRequest("POST", urls, body)
  4127. if err != nil {
  4128. return nil, err
  4129. }
  4130. req.Header = reqHeaders
  4131. req.GetBody = getBody
  4132. googleapi.Expand(req.URL, map[string]string{
  4133. "itemId": c.itemId,
  4134. })
  4135. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4136. }
  4137. // Do executes the "mirror.timeline.attachments.insert" call.
  4138. // Exactly one of *Attachment or error will be non-nil. Any non-2xx
  4139. // status code is an error. Response headers are in either
  4140. // *Attachment.ServerResponse.Header or (if a response was returned at
  4141. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4142. // to check whether the returned error was because
  4143. // http.StatusNotModified was returned.
  4144. func (c *TimelineAttachmentsInsertCall) Do(opts ...googleapi.CallOption) (*Attachment, error) {
  4145. gensupport.SetOptions(c.urlParams_, opts...)
  4146. res, err := c.doRequest("json")
  4147. if res != nil && res.StatusCode == http.StatusNotModified {
  4148. if res.Body != nil {
  4149. res.Body.Close()
  4150. }
  4151. return nil, &googleapi.Error{
  4152. Code: res.StatusCode,
  4153. Header: res.Header,
  4154. }
  4155. }
  4156. if err != nil {
  4157. return nil, err
  4158. }
  4159. defer googleapi.CloseBody(res)
  4160. if err := googleapi.CheckResponse(res); err != nil {
  4161. return nil, err
  4162. }
  4163. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  4164. if rx != nil {
  4165. rx.Client = c.s.client
  4166. rx.UserAgent = c.s.userAgent()
  4167. ctx := c.ctx_
  4168. if ctx == nil {
  4169. ctx = context.TODO()
  4170. }
  4171. res, err = rx.Upload(ctx)
  4172. if err != nil {
  4173. return nil, err
  4174. }
  4175. defer res.Body.Close()
  4176. if err := googleapi.CheckResponse(res); err != nil {
  4177. return nil, err
  4178. }
  4179. }
  4180. ret := &Attachment{
  4181. ServerResponse: googleapi.ServerResponse{
  4182. Header: res.Header,
  4183. HTTPStatusCode: res.StatusCode,
  4184. },
  4185. }
  4186. target := &ret
  4187. if err := gensupport.DecodeResponse(target, res); err != nil {
  4188. return nil, err
  4189. }
  4190. return ret, nil
  4191. // {
  4192. // "description": "Adds a new attachment to a timeline item.",
  4193. // "httpMethod": "POST",
  4194. // "id": "mirror.timeline.attachments.insert",
  4195. // "mediaUpload": {
  4196. // "accept": [
  4197. // "audio/*",
  4198. // "image/*",
  4199. // "video/*"
  4200. // ],
  4201. // "maxSize": "10MB",
  4202. // "protocols": {
  4203. // "resumable": {
  4204. // "multipart": true,
  4205. // "path": "/resumable/upload/mirror/v1/timeline/{itemId}/attachments"
  4206. // },
  4207. // "simple": {
  4208. // "multipart": true,
  4209. // "path": "/upload/mirror/v1/timeline/{itemId}/attachments"
  4210. // }
  4211. // }
  4212. // },
  4213. // "parameterOrder": [
  4214. // "itemId"
  4215. // ],
  4216. // "parameters": {
  4217. // "itemId": {
  4218. // "description": "The ID of the timeline item the attachment belongs to.",
  4219. // "location": "path",
  4220. // "required": true,
  4221. // "type": "string"
  4222. // }
  4223. // },
  4224. // "path": "timeline/{itemId}/attachments",
  4225. // "response": {
  4226. // "$ref": "Attachment"
  4227. // },
  4228. // "scopes": [
  4229. // "https://www.googleapis.com/auth/glass.timeline"
  4230. // ],
  4231. // "supportsMediaUpload": true
  4232. // }
  4233. }
  4234. // method id "mirror.timeline.attachments.list":
  4235. type TimelineAttachmentsListCall struct {
  4236. s *Service
  4237. itemId string
  4238. urlParams_ gensupport.URLParams
  4239. ifNoneMatch_ string
  4240. ctx_ context.Context
  4241. header_ http.Header
  4242. }
  4243. // List: Returns a list of attachments for a timeline item.
  4244. func (r *TimelineAttachmentsService) List(itemId string) *TimelineAttachmentsListCall {
  4245. c := &TimelineAttachmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4246. c.itemId = itemId
  4247. return c
  4248. }
  4249. // Fields allows partial responses to be retrieved. See
  4250. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4251. // for more information.
  4252. func (c *TimelineAttachmentsListCall) Fields(s ...googleapi.Field) *TimelineAttachmentsListCall {
  4253. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4254. return c
  4255. }
  4256. // IfNoneMatch sets the optional parameter which makes the operation
  4257. // fail if the object's ETag matches the given value. This is useful for
  4258. // getting updates only after the object has changed since the last
  4259. // request. Use googleapi.IsNotModified to check whether the response
  4260. // error from Do is the result of In-None-Match.
  4261. func (c *TimelineAttachmentsListCall) IfNoneMatch(entityTag string) *TimelineAttachmentsListCall {
  4262. c.ifNoneMatch_ = entityTag
  4263. return c
  4264. }
  4265. // Context sets the context to be used in this call's Do method. Any
  4266. // pending HTTP request will be aborted if the provided context is
  4267. // canceled.
  4268. func (c *TimelineAttachmentsListCall) Context(ctx context.Context) *TimelineAttachmentsListCall {
  4269. c.ctx_ = ctx
  4270. return c
  4271. }
  4272. // Header returns an http.Header that can be modified by the caller to
  4273. // add HTTP headers to the request.
  4274. func (c *TimelineAttachmentsListCall) Header() http.Header {
  4275. if c.header_ == nil {
  4276. c.header_ = make(http.Header)
  4277. }
  4278. return c.header_
  4279. }
  4280. func (c *TimelineAttachmentsListCall) doRequest(alt string) (*http.Response, error) {
  4281. reqHeaders := make(http.Header)
  4282. for k, v := range c.header_ {
  4283. reqHeaders[k] = v
  4284. }
  4285. reqHeaders.Set("User-Agent", c.s.userAgent())
  4286. if c.ifNoneMatch_ != "" {
  4287. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4288. }
  4289. var body io.Reader = nil
  4290. c.urlParams_.Set("alt", alt)
  4291. c.urlParams_.Set("prettyPrint", "false")
  4292. urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments")
  4293. urls += "?" + c.urlParams_.Encode()
  4294. req, err := http.NewRequest("GET", urls, body)
  4295. if err != nil {
  4296. return nil, err
  4297. }
  4298. req.Header = reqHeaders
  4299. googleapi.Expand(req.URL, map[string]string{
  4300. "itemId": c.itemId,
  4301. })
  4302. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4303. }
  4304. // Do executes the "mirror.timeline.attachments.list" call.
  4305. // Exactly one of *AttachmentsListResponse or error will be non-nil. Any
  4306. // non-2xx status code is an error. Response headers are in either
  4307. // *AttachmentsListResponse.ServerResponse.Header or (if a response was
  4308. // returned at all) in error.(*googleapi.Error).Header. Use
  4309. // googleapi.IsNotModified to check whether the returned error was
  4310. // because http.StatusNotModified was returned.
  4311. func (c *TimelineAttachmentsListCall) Do(opts ...googleapi.CallOption) (*AttachmentsListResponse, error) {
  4312. gensupport.SetOptions(c.urlParams_, opts...)
  4313. res, err := c.doRequest("json")
  4314. if res != nil && res.StatusCode == http.StatusNotModified {
  4315. if res.Body != nil {
  4316. res.Body.Close()
  4317. }
  4318. return nil, &googleapi.Error{
  4319. Code: res.StatusCode,
  4320. Header: res.Header,
  4321. }
  4322. }
  4323. if err != nil {
  4324. return nil, err
  4325. }
  4326. defer googleapi.CloseBody(res)
  4327. if err := googleapi.CheckResponse(res); err != nil {
  4328. return nil, err
  4329. }
  4330. ret := &AttachmentsListResponse{
  4331. ServerResponse: googleapi.ServerResponse{
  4332. Header: res.Header,
  4333. HTTPStatusCode: res.StatusCode,
  4334. },
  4335. }
  4336. target := &ret
  4337. if err := gensupport.DecodeResponse(target, res); err != nil {
  4338. return nil, err
  4339. }
  4340. return ret, nil
  4341. // {
  4342. // "description": "Returns a list of attachments for a timeline item.",
  4343. // "httpMethod": "GET",
  4344. // "id": "mirror.timeline.attachments.list",
  4345. // "parameterOrder": [
  4346. // "itemId"
  4347. // ],
  4348. // "parameters": {
  4349. // "itemId": {
  4350. // "description": "The ID of the timeline item whose attachments should be listed.",
  4351. // "location": "path",
  4352. // "required": true,
  4353. // "type": "string"
  4354. // }
  4355. // },
  4356. // "path": "timeline/{itemId}/attachments",
  4357. // "response": {
  4358. // "$ref": "AttachmentsListResponse"
  4359. // },
  4360. // "scopes": [
  4361. // "https://www.googleapis.com/auth/glass.timeline"
  4362. // ]
  4363. // }
  4364. }