25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4660 lines
151 KiB

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