mirror-gen.go 136 KB

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