123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269 |
- // Package mirror provides access to the Google Mirror API.
- //
- // See https://developers.google.com/glass
- //
- // Usage example:
- //
- // import "google.golang.org/api/mirror/v1"
- // ...
- // mirrorService, err := mirror.New(oauthHttpClient)
- package mirror // import "google.golang.org/api/mirror/v1"
- import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- context "golang.org/x/net/context"
- ctxhttp "golang.org/x/net/context/ctxhttp"
- gensupport "google.golang.org/api/gensupport"
- googleapi "google.golang.org/api/googleapi"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- )
- // Always reference these packages, just in case the auto-generated code
- // below doesn't.
- var _ = bytes.NewBuffer
- var _ = strconv.Itoa
- var _ = fmt.Sprintf
- var _ = json.NewDecoder
- var _ = io.Copy
- var _ = url.Parse
- var _ = gensupport.MarshalJSON
- var _ = googleapi.Version
- var _ = errors.New
- var _ = strings.Replace
- var _ = context.Canceled
- var _ = ctxhttp.Do
- const apiId = "mirror:v1"
- const apiName = "mirror"
- const apiVersion = "v1"
- const basePath = "https://www.googleapis.com/mirror/v1/"
- // OAuth2 scopes used by this API.
- const (
- // View your location
- GlassLocationScope = "https://www.googleapis.com/auth/glass.location"
- // View and manage your Glass timeline
- GlassTimelineScope = "https://www.googleapis.com/auth/glass.timeline"
- )
- func New(client *http.Client) (*Service, error) {
- if client == nil {
- return nil, errors.New("client is nil")
- }
- s := &Service{client: client, BasePath: basePath}
- s.Accounts = NewAccountsService(s)
- s.Contacts = NewContactsService(s)
- s.Locations = NewLocationsService(s)
- s.Settings = NewSettingsService(s)
- s.Subscriptions = NewSubscriptionsService(s)
- s.Timeline = NewTimelineService(s)
- return s, nil
- }
- type Service struct {
- client *http.Client
- BasePath string // API endpoint base URL
- UserAgent string // optional additional User-Agent fragment
- Accounts *AccountsService
- Contacts *ContactsService
- Locations *LocationsService
- Settings *SettingsService
- Subscriptions *SubscriptionsService
- Timeline *TimelineService
- }
- func (s *Service) userAgent() string {
- if s.UserAgent == "" {
- return googleapi.UserAgent
- }
- return googleapi.UserAgent + " " + s.UserAgent
- }
- func NewAccountsService(s *Service) *AccountsService {
- rs := &AccountsService{s: s}
- return rs
- }
- type AccountsService struct {
- s *Service
- }
- func NewContactsService(s *Service) *ContactsService {
- rs := &ContactsService{s: s}
- return rs
- }
- type ContactsService struct {
- s *Service
- }
- func NewLocationsService(s *Service) *LocationsService {
- rs := &LocationsService{s: s}
- return rs
- }
- type LocationsService struct {
- s *Service
- }
- func NewSettingsService(s *Service) *SettingsService {
- rs := &SettingsService{s: s}
- return rs
- }
- type SettingsService struct {
- s *Service
- }
- func NewSubscriptionsService(s *Service) *SubscriptionsService {
- rs := &SubscriptionsService{s: s}
- return rs
- }
- type SubscriptionsService struct {
- s *Service
- }
- func NewTimelineService(s *Service) *TimelineService {
- rs := &TimelineService{s: s}
- rs.Attachments = NewTimelineAttachmentsService(s)
- return rs
- }
- type TimelineService struct {
- s *Service
- Attachments *TimelineAttachmentsService
- }
- func NewTimelineAttachmentsService(s *Service) *TimelineAttachmentsService {
- rs := &TimelineAttachmentsService{s: s}
- return rs
- }
- type TimelineAttachmentsService struct {
- s *Service
- }
- // Account: Represents an account passed into the Account Manager on
- // Glass.
- type Account struct {
- AuthTokens []*AuthToken `json:"authTokens,omitempty"`
- Features []string `json:"features,omitempty"`
- Password string `json:"password,omitempty"`
- UserData []*UserData `json:"userData,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "AuthTokens") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Account) MarshalJSON() ([]byte, error) {
- type noMethod Account
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Attachment: Represents media content, such as a photo, that can be
- // attached to a timeline item.
- type Attachment struct {
- // ContentType: The MIME type of the attachment.
- ContentType string `json:"contentType,omitempty"`
- // ContentUrl: The URL for the content.
- ContentUrl string `json:"contentUrl,omitempty"`
- // Id: The ID of the attachment.
- Id string `json:"id,omitempty"`
- // IsProcessingContent: Indicates that the contentUrl is not available
- // because the attachment content is still being processed. If the
- // caller wishes to retrieve the content, it should try again later.
- IsProcessingContent bool `json:"isProcessingContent,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "ContentType") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Attachment) MarshalJSON() ([]byte, error) {
- type noMethod Attachment
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // AttachmentsListResponse: A list of Attachments. This is the response
- // from the server to GET requests on the attachments collection.
- type AttachmentsListResponse struct {
- // Items: The list of attachments.
- Items []*Attachment `json:"items,omitempty"`
- // Kind: The type of resource. This is always mirror#attachmentsList.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *AttachmentsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod AttachmentsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- type AuthToken struct {
- AuthToken string `json:"authToken,omitempty"`
- Type string `json:"type,omitempty"`
- // ForceSendFields is a list of field names (e.g. "AuthToken") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *AuthToken) MarshalJSON() ([]byte, error) {
- type noMethod AuthToken
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Command: A single menu command that is part of a Contact.
- type Command struct {
- // Type: The type of operation this command corresponds to. Allowed
- // values are:
- // - TAKE_A_NOTE - Shares a timeline item with the transcription of user
- // speech from the "Take a note" voice menu command.
- // - POST_AN_UPDATE - Shares a timeline item with the transcription of
- // user speech from the "Post an update" voice menu command.
- Type string `json:"type,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Type") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Command) MarshalJSON() ([]byte, error) {
- type noMethod Command
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Contact: A person or group that can be used as a creator or a
- // contact.
- type Contact struct {
- // AcceptCommands: A list of voice menu commands that a contact can
- // handle. Glass shows up to three contacts for each voice menu command.
- // If there are more than that, the three contacts with the highest
- // priority are shown for that particular command.
- AcceptCommands []*Command `json:"acceptCommands,omitempty"`
- // AcceptTypes: A list of MIME types that a contact supports. The
- // contact will be shown to the user if any of its acceptTypes matches
- // any of the types of the attachments on the item. If no acceptTypes
- // are given, the contact will be shown for all items.
- AcceptTypes []string `json:"acceptTypes,omitempty"`
- // DisplayName: The name to display for this contact.
- DisplayName string `json:"displayName,omitempty"`
- // Id: An ID for this contact. This is generated by the application and
- // is treated as an opaque token.
- Id string `json:"id,omitempty"`
- // ImageUrls: Set of image URLs to display for a contact. Most contacts
- // will have a single image, but a "group" contact may include up to 8
- // image URLs and they will be resized and cropped into a mosaic on the
- // client.
- ImageUrls []string `json:"imageUrls,omitempty"`
- // Kind: The type of resource. This is always mirror#contact.
- Kind string `json:"kind,omitempty"`
- // PhoneNumber: Primary phone number for the contact. This can be a
- // fully-qualified number, with country calling code and area code, or a
- // local number.
- PhoneNumber string `json:"phoneNumber,omitempty"`
- // Priority: Priority for the contact to determine ordering in a list of
- // contacts. Contacts with higher priorities will be shown before ones
- // with lower priorities.
- Priority int64 `json:"priority,omitempty"`
- // SharingFeatures: A list of sharing features that a contact can
- // handle. Allowed values are:
- // - ADD_CAPTION
- SharingFeatures []string `json:"sharingFeatures,omitempty"`
- // Source: The ID of the application that created this contact. This is
- // populated by the API
- Source string `json:"source,omitempty"`
- // SpeakableName: Name of this contact as it should be pronounced. If
- // this contact's name must be spoken as part of a voice disambiguation
- // menu, this name is used as the expected pronunciation. This is useful
- // for contact names with unpronounceable characters or whose display
- // spelling is otherwise not phonetic.
- SpeakableName string `json:"speakableName,omitempty"`
- // Type: The type for this contact. This is used for sorting in UIs.
- // Allowed values are:
- // - INDIVIDUAL - Represents a single person. This is the default.
- // - GROUP - Represents more than a single person.
- Type string `json:"type,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "AcceptCommands") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Contact) MarshalJSON() ([]byte, error) {
- type noMethod Contact
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ContactsListResponse: A list of Contacts representing contacts. This
- // is the response from the server to GET requests on the contacts
- // collection.
- type ContactsListResponse struct {
- // Items: Contact list.
- Items []*Contact `json:"items,omitempty"`
- // Kind: The type of resource. This is always mirror#contacts.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ContactsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod ContactsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Location: A geographic location that can be associated with a
- // timeline item.
- type Location struct {
- // Accuracy: The accuracy of the location fix in meters.
- Accuracy float64 `json:"accuracy,omitempty"`
- // Address: The full address of the location.
- Address string `json:"address,omitempty"`
- // DisplayName: The name to be displayed. This may be a business name or
- // a user-defined place, such as "Home".
- DisplayName string `json:"displayName,omitempty"`
- // Id: The ID of the location.
- Id string `json:"id,omitempty"`
- // Kind: The type of resource. This is always mirror#location.
- Kind string `json:"kind,omitempty"`
- // Latitude: The latitude, in degrees.
- Latitude float64 `json:"latitude,omitempty"`
- // Longitude: The longitude, in degrees.
- Longitude float64 `json:"longitude,omitempty"`
- // Timestamp: The time at which this location was captured, formatted
- // according to RFC 3339.
- Timestamp string `json:"timestamp,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Accuracy") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Location) MarshalJSON() ([]byte, error) {
- type noMethod Location
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // LocationsListResponse: A list of Locations. This is the response from
- // the server to GET requests on the locations collection.
- type LocationsListResponse struct {
- // Items: The list of locations.
- Items []*Location `json:"items,omitempty"`
- // Kind: The type of resource. This is always mirror#locationsList.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *LocationsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod LocationsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // MenuItem: A custom menu item that can be presented to the user by a
- // timeline item.
- type MenuItem struct {
- // Action: Controls the behavior when the user picks the menu option.
- // Allowed values are:
- // - CUSTOM - Custom action set by the service. When the user selects
- // this menuItem, the API triggers a notification to your callbackUrl
- // with the userActions.type set to CUSTOM and the userActions.payload
- // set to the ID of this menu item. This is the default value.
- // - Built-in actions:
- // - REPLY - Initiate a reply to the timeline item using the voice
- // recording UI. The creator attribute must be set in the timeline item
- // for this menu to be available.
- // - REPLY_ALL - Same behavior as REPLY. The original timeline item's
- // recipients will be added to the reply item.
- // - DELETE - Delete the timeline item.
- // - SHARE - Share the timeline item with the available contacts.
- // - READ_ALOUD - Read the timeline item's speakableText aloud; if this
- // field is not set, read the text field; if none of those fields are
- // set, this menu item is ignored.
- // - GET_MEDIA_INPUT - Allow users to provide media payloads to
- // Glassware from a menu item (currently, only transcribed text from
- // voice input is supported). Subscribe to notifications when users
- // invoke this menu item to receive the timeline item ID. Retrieve the
- // media from the timeline item in the payload property.
- // - VOICE_CALL - Initiate a phone call using the timeline item's
- // creator.phoneNumber attribute as recipient.
- // - NAVIGATE - Navigate to the timeline item's location.
- // - TOGGLE_PINNED - Toggle the isPinned state of the timeline item.
- // - OPEN_URI - Open the payload of the menu item in the browser.
- // - PLAY_VIDEO - Open the payload of the menu item in the Glass video
- // player.
- // - SEND_MESSAGE - Initiate sending a message to the timeline item's
- // creator:
- // - If the creator.phoneNumber is set and Glass is connected to an
- // Android phone, the message is an SMS.
- // - Otherwise, if the creator.email is set, the message is an email.
- Action string `json:"action,omitempty"`
- // ContextualCommand: The ContextualMenus.Command associated with this
- // MenuItem (e.g. READ_ALOUD). The voice label for this command will be
- // displayed in the voice menu and the touch label will be displayed in
- // the touch menu. Note that the default menu value's display name will
- // be overriden if you specify this property. Values that do not
- // correspond to a ContextualMenus.Command name will be ignored.
- ContextualCommand string `json:"contextual_command,omitempty"`
- // Id: The ID for this menu item. This is generated by the application
- // and is treated as an opaque token.
- Id string `json:"id,omitempty"`
- // Payload: A generic payload whose meaning changes depending on this
- // MenuItem's action.
- // - When the action is OPEN_URI, the payload is the URL of the website
- // to view.
- // - When the action is PLAY_VIDEO, the payload is the streaming URL of
- // the video
- // - When the action is GET_MEDIA_INPUT, the payload is the text
- // transcription of a user's speech input
- Payload string `json:"payload,omitempty"`
- // RemoveWhenSelected: If set to true on a CUSTOM menu item, that item
- // will be removed from the menu after it is selected.
- RemoveWhenSelected bool `json:"removeWhenSelected,omitempty"`
- // Values: For CUSTOM items, a list of values controlling the appearance
- // of the menu item in each of its states. A value for the DEFAULT state
- // must be provided. If the PENDING or CONFIRMED states are missing,
- // they will not be shown.
- Values []*MenuValue `json:"values,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Action") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *MenuItem) MarshalJSON() ([]byte, error) {
- type noMethod MenuItem
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // MenuValue: A single value that is part of a MenuItem.
- type MenuValue struct {
- // DisplayName: The name to display for the menu item. If you specify
- // this property for a built-in menu item, the default contextual voice
- // command for that menu item is not shown.
- DisplayName string `json:"displayName,omitempty"`
- // IconUrl: URL of an icon to display with the menu item.
- IconUrl string `json:"iconUrl,omitempty"`
- // State: The state that this value applies to. Allowed values are:
- // - DEFAULT - Default value shown when displayed in the menuItems list.
- //
- // - PENDING - Value shown when the menuItem has been selected by the
- // user but can still be cancelled.
- // - CONFIRMED - Value shown when the menuItem has been selected by the
- // user and can no longer be cancelled.
- State string `json:"state,omitempty"`
- // ForceSendFields is a list of field names (e.g. "DisplayName") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *MenuValue) MarshalJSON() ([]byte, error) {
- type noMethod MenuValue
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Notification: A notification delivered by the API.
- type Notification struct {
- // Collection: The collection that generated the notification.
- Collection string `json:"collection,omitempty"`
- // ItemId: The ID of the item that generated the notification.
- ItemId string `json:"itemId,omitempty"`
- // Operation: The type of operation that generated the notification.
- Operation string `json:"operation,omitempty"`
- // UserActions: A list of actions taken by the user that triggered the
- // notification.
- UserActions []*UserAction `json:"userActions,omitempty"`
- // UserToken: The user token provided by the service when it subscribed
- // for notifications.
- UserToken string `json:"userToken,omitempty"`
- // VerifyToken: The secret verify token provided by the service when it
- // subscribed for notifications.
- VerifyToken string `json:"verifyToken,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Collection") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Notification) MarshalJSON() ([]byte, error) {
- type noMethod Notification
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // NotificationConfig: Controls how notifications for a timeline item
- // are presented to the user.
- type NotificationConfig struct {
- // DeliveryTime: The time at which the notification should be delivered.
- DeliveryTime string `json:"deliveryTime,omitempty"`
- // Level: Describes how important the notification is. Allowed values
- // are:
- // - DEFAULT - Notifications of default importance. A chime will be
- // played to alert users.
- Level string `json:"level,omitempty"`
- // ForceSendFields is a list of field names (e.g. "DeliveryTime") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *NotificationConfig) MarshalJSON() ([]byte, error) {
- type noMethod NotificationConfig
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Setting: A setting for Glass.
- type Setting struct {
- // Id: The setting's ID. The following IDs are valid:
- // - locale - The key to the user’s language/locale (BCP 47
- // identifier) that Glassware should use to render localized content.
- //
- // - timezone - The key to the user’s current time zone region as
- // defined in the tz database. Example: America/Los_Angeles.
- Id string `json:"id,omitempty"`
- // Kind: The type of resource. This is always mirror#setting.
- Kind string `json:"kind,omitempty"`
- // Value: The setting value, as a string.
- Value string `json:"value,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Id") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Setting) MarshalJSON() ([]byte, error) {
- type noMethod Setting
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Subscription: A subscription to events on a collection.
- type Subscription struct {
- // CallbackUrl: The URL where notifications should be delivered (must
- // start with https://).
- CallbackUrl string `json:"callbackUrl,omitempty"`
- // Collection: The collection to subscribe to. Allowed values are:
- // - timeline - Changes in the timeline including insertion, deletion,
- // and updates.
- // - locations - Location updates.
- // - settings - Settings updates.
- Collection string `json:"collection,omitempty"`
- // Id: The ID of the subscription.
- Id string `json:"id,omitempty"`
- // Kind: The type of resource. This is always mirror#subscription.
- Kind string `json:"kind,omitempty"`
- // Notification: Container object for notifications. This is not
- // populated in the Subscription resource.
- Notification *Notification `json:"notification,omitempty"`
- // Operation: A list of operations that should be subscribed to. An
- // empty list indicates that all operations on the collection should be
- // subscribed to. Allowed values are:
- // - UPDATE - The item has been updated.
- // - INSERT - A new item has been inserted.
- // - DELETE - The item has been deleted.
- // - MENU_ACTION - A custom menu item has been triggered by the user.
- Operation []string `json:"operation,omitempty"`
- // Updated: The time at which this subscription was last modified,
- // formatted according to RFC 3339.
- Updated string `json:"updated,omitempty"`
- // UserToken: An opaque token sent to the subscriber in notifications so
- // that it can determine the ID of the user.
- UserToken string `json:"userToken,omitempty"`
- // VerifyToken: A secret token sent to the subscriber in notifications
- // so that it can verify that the notification was generated by Google.
- VerifyToken string `json:"verifyToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "CallbackUrl") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Subscription) MarshalJSON() ([]byte, error) {
- type noMethod Subscription
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SubscriptionsListResponse: A list of Subscriptions. This is the
- // response from the server to GET requests on the subscription
- // collection.
- type SubscriptionsListResponse struct {
- // Items: The list of subscriptions.
- Items []*Subscription `json:"items,omitempty"`
- // Kind: The type of resource. This is always mirror#subscriptionsList.
- Kind string `json:"kind,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SubscriptionsListResponse) MarshalJSON() ([]byte, error) {
- type noMethod SubscriptionsListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // TimelineItem: Each item in the user's timeline is represented as a
- // TimelineItem JSON structure, described below.
- type TimelineItem struct {
- // Attachments: A list of media attachments associated with this item.
- // As a convenience, you can refer to attachments in your HTML payloads
- // with the attachment or cid scheme. For example:
- // - attachment: <img src="attachment:attachment_index"> where
- // attachment_index is the 0-based index of this array.
- // - cid: <img src="cid:attachment_id"> where attachment_id is the ID of
- // the attachment.
- Attachments []*Attachment `json:"attachments,omitempty"`
- // BundleId: The bundle ID for this item. Services can specify a
- // bundleId to group many items together. They appear under a single
- // top-level item on the device.
- BundleId string `json:"bundleId,omitempty"`
- // CanonicalUrl: A canonical URL pointing to the canonical/high quality
- // version of the data represented by the timeline item.
- CanonicalUrl string `json:"canonicalUrl,omitempty"`
- // Created: The time at which this item was created, formatted according
- // to RFC 3339.
- Created string `json:"created,omitempty"`
- // Creator: The user or group that created this item.
- Creator *Contact `json:"creator,omitempty"`
- // DisplayTime: The time that should be displayed when this item is
- // viewed in the timeline, formatted according to RFC 3339. This user's
- // timeline is sorted chronologically on display time, so this will also
- // determine where the item is displayed in the timeline. If not set by
- // the service, the display time defaults to the updated time.
- DisplayTime string `json:"displayTime,omitempty"`
- // Etag: ETag for this item.
- Etag string `json:"etag,omitempty"`
- // Html: HTML content for this item. If both text and html are provided
- // for an item, the html will be rendered in the timeline.
- // Allowed HTML elements - You can use these elements in your timeline
- // cards.
- //
- // - Headers: h1, h2, h3, h4, h5, h6
- // - Images: img
- // - Lists: li, ol, ul
- // - HTML5 semantics: article, aside, details, figure, figcaption,
- // footer, header, nav, section, summary, time
- // - Structural: blockquote, br, div, hr, p, span
- // - Style: b, big, center, em, i, u, s, small, strike, strong, style,
- // sub, sup
- // - Tables: table, tbody, td, tfoot, th, thead, tr
- // Blocked HTML elements: These elements and their contents are removed
- // from HTML payloads.
- //
- // - Document headers: head, title
- // - Embeds: audio, embed, object, source, video
- // - Frames: frame, frameset
- // - Scripting: applet, script
- // Other elements: Any elements that aren't listed are removed, but
- // their contents are preserved.
- Html string `json:"html,omitempty"`
- // Id: The ID of the timeline item. This is unique within a user's
- // timeline.
- Id string `json:"id,omitempty"`
- // InReplyTo: If this item was generated as a reply to another item,
- // this field will be set to the ID of the item being replied to. This
- // can be used to attach a reply to the appropriate conversation or
- // post.
- InReplyTo string `json:"inReplyTo,omitempty"`
- // IsBundleCover: Whether this item is a bundle cover.
- //
- // If an item is marked as a bundle cover, it will be the entry point to
- // the bundle of items that have the same bundleId as that item. It will
- // be shown only on the main timeline — not within the opened
- // bundle.
- //
- // On the main timeline, items that are shown are:
- // - Items that have isBundleCover set to true
- // - Items that do not have a bundleId In a bundle sub-timeline, items
- // that are shown are:
- // - Items that have the bundleId in question AND isBundleCover set to
- // false
- IsBundleCover bool `json:"isBundleCover,omitempty"`
- // IsDeleted: When true, indicates this item is deleted, and only the ID
- // property is set.
- IsDeleted bool `json:"isDeleted,omitempty"`
- // IsPinned: When true, indicates this item is pinned, which means it's
- // grouped alongside "active" items like navigation and hangouts, on the
- // opposite side of the home screen from historical (non-pinned)
- // timeline items. You can allow the user to toggle the value of this
- // property with the TOGGLE_PINNED built-in menu item.
- IsPinned bool `json:"isPinned,omitempty"`
- // Kind: The type of resource. This is always mirror#timelineItem.
- Kind string `json:"kind,omitempty"`
- // Location: The geographic location associated with this item.
- Location *Location `json:"location,omitempty"`
- // MenuItems: A list of menu items that will be presented to the user
- // when this item is selected in the timeline.
- MenuItems []*MenuItem `json:"menuItems,omitempty"`
- // Notification: Controls how notifications for this item are presented
- // on the device. If this is missing, no notification will be generated.
- Notification *NotificationConfig `json:"notification,omitempty"`
- // PinScore: For pinned items, this determines the order in which the
- // item is displayed in the timeline, with a higher score appearing
- // closer to the clock. Note: setting this field is currently not
- // supported.
- PinScore int64 `json:"pinScore,omitempty"`
- // Recipients: A list of users or groups that this item has been shared
- // with.
- Recipients []*Contact `json:"recipients,omitempty"`
- // SelfLink: A URL that can be used to retrieve this item.
- SelfLink string `json:"selfLink,omitempty"`
- // SourceItemId: Opaque string you can use to map a timeline item to
- // data in your own service.
- SourceItemId string `json:"sourceItemId,omitempty"`
- // SpeakableText: The speakable version of the content of this item.
- // Along with the READ_ALOUD menu item, use this field to provide text
- // that would be clearer when read aloud, or to provide extended
- // information to what is displayed visually on Glass.
- //
- // Glassware should also specify the speakableType field, which will be
- // spoken before this text in cases where the additional context is
- // useful, for example when the user requests that the item be read
- // aloud following a notification.
- SpeakableText string `json:"speakableText,omitempty"`
- // SpeakableType: A speakable description of the type of this item. This
- // will be announced to the user prior to reading the content of the
- // item in cases where the additional context is useful, for example
- // when the user requests that the item be read aloud following a
- // notification.
- //
- // This should be a short, simple noun phrase such as "Email", "Text
- // message", or "Daily Planet News Update".
- //
- // Glassware are encouraged to populate this field for every timeline
- // item, even if the item does not contain speakableText or text so that
- // the user can learn the type of the item without looking at the
- // screen.
- SpeakableType string `json:"speakableType,omitempty"`
- // Text: Text content of this item.
- Text string `json:"text,omitempty"`
- // Title: The title of this item.
- Title string `json:"title,omitempty"`
- // Updated: The time at which this item was last modified, formatted
- // according to RFC 3339.
- Updated string `json:"updated,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Attachments") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *TimelineItem) MarshalJSON() ([]byte, error) {
- type noMethod TimelineItem
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // TimelineListResponse: A list of timeline items. This is the response
- // from the server to GET requests on the timeline collection.
- type TimelineListResponse struct {
- // Items: Items in the timeline.
- Items []*TimelineItem `json:"items,omitempty"`
- // Kind: The type of resource. This is always mirror#timeline.
- Kind string `json:"kind,omitempty"`
- // NextPageToken: The next page token. Provide this as the pageToken
- // parameter in the request to retrieve the next page of results.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Items") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *TimelineListResponse) MarshalJSON() ([]byte, error) {
- type noMethod TimelineListResponse
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // UserAction: Represents an action taken by the user that triggered a
- // notification.
- type UserAction struct {
- // Payload: An optional payload for the action.
- //
- // For actions of type CUSTOM, this is the ID of the custom menu item
- // that was selected.
- Payload string `json:"payload,omitempty"`
- // Type: The type of action. The value of this can be:
- // - SHARE - the user shared an item.
- // - REPLY - the user replied to an item.
- // - REPLY_ALL - the user replied to all recipients of an item.
- // - CUSTOM - the user selected a custom menu item on the timeline item.
- //
- // - DELETE - the user deleted the item.
- // - PIN - the user pinned the item.
- // - UNPIN - the user unpinned the item.
- // - LAUNCH - the user initiated a voice command. In the future,
- // additional types may be added. UserActions with unrecognized types
- // should be ignored.
- Type string `json:"type,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Payload") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *UserAction) MarshalJSON() ([]byte, error) {
- type noMethod UserAction
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- type UserData struct {
- Key string `json:"key,omitempty"`
- Value string `json:"value,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Key") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *UserData) MarshalJSON() ([]byte, error) {
- type noMethod UserData
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // method id "mirror.accounts.insert":
- type AccountsInsertCall struct {
- s *Service
- userToken string
- accountType string
- accountName string
- account *Account
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Inserts a new account for a user
- func (r *AccountsService) Insert(userToken string, accountType string, accountName string, account *Account) *AccountsInsertCall {
- c := &AccountsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.userToken = userToken
- c.accountType = accountType
- c.accountName = accountName
- c.account = account
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *AccountsInsertCall) Fields(s ...googleapi.Field) *AccountsInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *AccountsInsertCall) Context(ctx context.Context) *AccountsInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *AccountsInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.account)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "accounts/{userToken}/{accountType}/{accountName}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "userToken": c.userToken,
- "accountType": c.accountType,
- "accountName": c.accountName,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.accounts.insert" call.
- // Exactly one of *Account or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Account.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *AccountsInsertCall) Do(opts ...googleapi.CallOption) (*Account, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Account{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Inserts a new account for a user",
- // "httpMethod": "POST",
- // "id": "mirror.accounts.insert",
- // "parameterOrder": [
- // "userToken",
- // "accountType",
- // "accountName"
- // ],
- // "parameters": {
- // "accountName": {
- // "description": "The name of the account to be passed to the Android Account Manager.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "accountType": {
- // "description": "Account type to be passed to Android Account Manager.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "userToken": {
- // "description": "The ID for the user.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "accounts/{userToken}/{accountType}/{accountName}",
- // "request": {
- // "$ref": "Account"
- // },
- // "response": {
- // "$ref": "Account"
- // }
- // }
- }
- // method id "mirror.contacts.delete":
- type ContactsDeleteCall struct {
- s *Service
- id string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a contact.
- func (r *ContactsService) Delete(id string) *ContactsDeleteCall {
- c := &ContactsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ContactsDeleteCall) Fields(s ...googleapi.Field) *ContactsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ContactsDeleteCall) Context(ctx context.Context) *ContactsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ContactsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.contacts.delete" call.
- func (c *ContactsDeleteCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "description": "Deletes a contact.",
- // "httpMethod": "DELETE",
- // "id": "mirror.contacts.delete",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the contact.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "contacts/{id}",
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.contacts.get":
- type ContactsGetCall struct {
- s *Service
- id string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a single contact by ID.
- func (r *ContactsService) Get(id string) *ContactsGetCall {
- c := &ContactsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ContactsGetCall) Fields(s ...googleapi.Field) *ContactsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *ContactsGetCall) IfNoneMatch(entityTag string) *ContactsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ContactsGetCall) Context(ctx context.Context) *ContactsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ContactsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.contacts.get" call.
- // Exactly one of *Contact or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Contact.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ContactsGetCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Contact{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a single contact by ID.",
- // "httpMethod": "GET",
- // "id": "mirror.contacts.get",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the contact.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "contacts/{id}",
- // "response": {
- // "$ref": "Contact"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.contacts.insert":
- type ContactsInsertCall struct {
- s *Service
- contact *Contact
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Inserts a new contact.
- func (r *ContactsService) Insert(contact *Contact) *ContactsInsertCall {
- c := &ContactsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.contact = contact
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ContactsInsertCall) Fields(s ...googleapi.Field) *ContactsInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ContactsInsertCall) Context(ctx context.Context) *ContactsInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ContactsInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "contacts")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.contacts.insert" call.
- // Exactly one of *Contact or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Contact.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ContactsInsertCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Contact{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Inserts a new contact.",
- // "httpMethod": "POST",
- // "id": "mirror.contacts.insert",
- // "path": "contacts",
- // "request": {
- // "$ref": "Contact"
- // },
- // "response": {
- // "$ref": "Contact"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.contacts.list":
- type ContactsListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Retrieves a list of contacts for the authenticated user.
- func (r *ContactsService) List() *ContactsListCall {
- c := &ContactsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ContactsListCall) Fields(s ...googleapi.Field) *ContactsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *ContactsListCall) IfNoneMatch(entityTag string) *ContactsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ContactsListCall) Context(ctx context.Context) *ContactsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ContactsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "contacts")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.contacts.list" call.
- // Exactly one of *ContactsListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *ContactsListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *ContactsListCall) Do(opts ...googleapi.CallOption) (*ContactsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &ContactsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves a list of contacts for the authenticated user.",
- // "httpMethod": "GET",
- // "id": "mirror.contacts.list",
- // "path": "contacts",
- // "response": {
- // "$ref": "ContactsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.contacts.patch":
- type ContactsPatchCall struct {
- s *Service
- id string
- contact *Contact
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Patch: Updates a contact in place. This method supports patch
- // semantics.
- func (r *ContactsService) Patch(id string, contact *Contact) *ContactsPatchCall {
- c := &ContactsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- c.contact = contact
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ContactsPatchCall) Fields(s ...googleapi.Field) *ContactsPatchCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ContactsPatchCall) Context(ctx context.Context) *ContactsPatchCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ContactsPatchCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PATCH", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.contacts.patch" call.
- // Exactly one of *Contact or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Contact.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ContactsPatchCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Contact{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates a contact in place. This method supports patch semantics.",
- // "httpMethod": "PATCH",
- // "id": "mirror.contacts.patch",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the contact.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "contacts/{id}",
- // "request": {
- // "$ref": "Contact"
- // },
- // "response": {
- // "$ref": "Contact"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.contacts.update":
- type ContactsUpdateCall struct {
- s *Service
- id string
- contact *Contact
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: Updates a contact in place.
- func (r *ContactsService) Update(id string, contact *Contact) *ContactsUpdateCall {
- c := &ContactsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- c.contact = contact
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *ContactsUpdateCall) Fields(s ...googleapi.Field) *ContactsUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *ContactsUpdateCall) Context(ctx context.Context) *ContactsUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *ContactsUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.contact)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "contacts/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.contacts.update" call.
- // Exactly one of *Contact or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Contact.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *ContactsUpdateCall) Do(opts ...googleapi.CallOption) (*Contact, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Contact{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates a contact in place.",
- // "httpMethod": "PUT",
- // "id": "mirror.contacts.update",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the contact.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "contacts/{id}",
- // "request": {
- // "$ref": "Contact"
- // },
- // "response": {
- // "$ref": "Contact"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.locations.get":
- type LocationsGetCall struct {
- s *Service
- id string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a single location by ID.
- func (r *LocationsService) Get(id string) *LocationsGetCall {
- c := &LocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *LocationsGetCall) Fields(s ...googleapi.Field) *LocationsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *LocationsGetCall) IfNoneMatch(entityTag string) *LocationsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *LocationsGetCall) Context(ctx context.Context) *LocationsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *LocationsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "locations/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.locations.get" call.
- // Exactly one of *Location or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Location.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *LocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Location{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a single location by ID.",
- // "httpMethod": "GET",
- // "id": "mirror.locations.get",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the location or latest for the last known location.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "locations/{id}",
- // "response": {
- // "$ref": "Location"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.locations.list":
- type LocationsListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Retrieves a list of locations for the user.
- func (r *LocationsService) List() *LocationsListCall {
- c := &LocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *LocationsListCall) Fields(s ...googleapi.Field) *LocationsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *LocationsListCall) IfNoneMatch(entityTag string) *LocationsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *LocationsListCall) Context(ctx context.Context) *LocationsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *LocationsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "locations")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.locations.list" call.
- // Exactly one of *LocationsListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *LocationsListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *LocationsListCall) Do(opts ...googleapi.CallOption) (*LocationsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &LocationsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves a list of locations for the user.",
- // "httpMethod": "GET",
- // "id": "mirror.locations.list",
- // "path": "locations",
- // "response": {
- // "$ref": "LocationsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.settings.get":
- type SettingsGetCall struct {
- s *Service
- id string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a single setting by ID.
- func (r *SettingsService) Get(id string) *SettingsGetCall {
- c := &SettingsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SettingsGetCall) Fields(s ...googleapi.Field) *SettingsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *SettingsGetCall) IfNoneMatch(entityTag string) *SettingsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SettingsGetCall) Context(ctx context.Context) *SettingsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SettingsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "settings/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.settings.get" call.
- // Exactly one of *Setting or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Setting.ServerResponse.Header or (if a response was returned at all)
- // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
- // check whether the returned error was because http.StatusNotModified
- // was returned.
- func (c *SettingsGetCall) Do(opts ...googleapi.CallOption) (*Setting, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Setting{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a single setting by ID.",
- // "httpMethod": "GET",
- // "id": "mirror.settings.get",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "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.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "settings/{id}",
- // "response": {
- // "$ref": "Setting"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.subscriptions.delete":
- type SubscriptionsDeleteCall struct {
- s *Service
- id string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a subscription.
- func (r *SubscriptionsService) Delete(id string) *SubscriptionsDeleteCall {
- c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.subscriptions.delete" call.
- func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "description": "Deletes a subscription.",
- // "httpMethod": "DELETE",
- // "id": "mirror.subscriptions.delete",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the subscription.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "subscriptions/{id}",
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.subscriptions.insert":
- type SubscriptionsInsertCall struct {
- s *Service
- subscription *Subscription
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Creates a new subscription.
- func (r *SubscriptionsService) Insert(subscription *Subscription) *SubscriptionsInsertCall {
- c := &SubscriptionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.subscription = subscription
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsInsertCall) Context(ctx context.Context) *SubscriptionsInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.subscriptions.insert" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsInsertCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a new subscription.",
- // "httpMethod": "POST",
- // "id": "mirror.subscriptions.insert",
- // "path": "subscriptions",
- // "request": {
- // "$ref": "Subscription"
- // },
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.subscriptions.list":
- type SubscriptionsListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Retrieves a list of subscriptions for the authenticated user
- // and service.
- func (r *SubscriptionsService) List() *SubscriptionsListCall {
- c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.subscriptions.list" call.
- // Exactly one of *SubscriptionsListResponse or error will be non-nil.
- // Any non-2xx status code is an error. Response headers are in either
- // *SubscriptionsListResponse.ServerResponse.Header or (if a response
- // was returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*SubscriptionsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &SubscriptionsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves a list of subscriptions for the authenticated user and service.",
- // "httpMethod": "GET",
- // "id": "mirror.subscriptions.list",
- // "path": "subscriptions",
- // "response": {
- // "$ref": "SubscriptionsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.subscriptions.update":
- type SubscriptionsUpdateCall struct {
- s *Service
- id string
- subscription *Subscription
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: Updates an existing subscription in place.
- func (r *SubscriptionsService) Update(id string, subscription *Subscription) *SubscriptionsUpdateCall {
- c := &SubscriptionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- c.subscription = subscription
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsUpdateCall) Fields(s ...googleapi.Field) *SubscriptionsUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsUpdateCall) Context(ctx context.Context) *SubscriptionsUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.subscriptions.update" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsUpdateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates an existing subscription in place.",
- // "httpMethod": "PUT",
- // "id": "mirror.subscriptions.update",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the subscription.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "subscriptions/{id}",
- // "request": {
- // "$ref": "Subscription"
- // },
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.timeline.delete":
- type TimelineDeleteCall struct {
- s *Service
- id string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes a timeline item.
- func (r *TimelineService) Delete(id string) *TimelineDeleteCall {
- c := &TimelineDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineDeleteCall) Fields(s ...googleapi.Field) *TimelineDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TimelineDeleteCall) Context(ctx context.Context) *TimelineDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.delete" call.
- func (c *TimelineDeleteCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "description": "Deletes a timeline item.",
- // "httpMethod": "DELETE",
- // "id": "mirror.timeline.delete",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the timeline item.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{id}",
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.timeline.get":
- type TimelineGetCall struct {
- s *Service
- id string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a single timeline item by ID.
- func (r *TimelineService) Get(id string) *TimelineGetCall {
- c := &TimelineGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineGetCall) Fields(s ...googleapi.Field) *TimelineGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TimelineGetCall) IfNoneMatch(entityTag string) *TimelineGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TimelineGetCall) Context(ctx context.Context) *TimelineGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.get" call.
- // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *TimelineItem.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TimelineGetCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TimelineItem{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a single timeline item by ID.",
- // "httpMethod": "GET",
- // "id": "mirror.timeline.get",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the timeline item.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{id}",
- // "response": {
- // "$ref": "TimelineItem"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.timeline.insert":
- type TimelineInsertCall struct {
- s *Service
- timelineitem *TimelineItem
- urlParams_ gensupport.URLParams
- media_ io.Reader
- resumableBuffer_ *gensupport.ResumableBuffer
- mediaType_ string
- mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
- progressUpdater_ googleapi.ProgressUpdater
- ctx_ context.Context
- }
- // Insert: Inserts a new item into the timeline.
- func (r *TimelineService) Insert(timelineitem *TimelineItem) *TimelineInsertCall {
- c := &TimelineInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.timelineitem = timelineitem
- return c
- }
- // Media specifies the media to upload in one or more chunks. The chunk
- // size may be controlled by supplying a MediaOption generated by
- // googleapi.ChunkSize. The chunk size defaults to
- // googleapi.DefaultUploadChunkSize.
- // At most one of Media and ResumableMedia may be set.
- func (c *TimelineInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *TimelineInsertCall {
- opts := googleapi.ProcessMediaOptions(options)
- chunkSize := opts.ChunkSize
- r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
- c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
- return c
- }
- // ResumableMedia specifies the media to upload in chunks and can be
- // canceled with ctx.
- //
- // Deprecated: use Media instead.
- //
- // At most one of Media and ResumableMedia may be set. mediaType
- // identifies the MIME media type of the upload, such as "image/png". If
- // mediaType is "", it will be auto-detected. The provided ctx will
- // supersede any context previously provided to the Context method.
- func (c *TimelineInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TimelineInsertCall {
- c.ctx_ = ctx
- rdr := gensupport.ReaderAtToReader(r, size)
- rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
- c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
- c.media_ = nil
- c.mediaSize_ = size
- return c
- }
- // ProgressUpdater provides a callback function that will be called
- // after every chunk. It should be a low-latency function in order to
- // not slow down the upload operation. This should only be called when
- // using ResumableMedia (as opposed to Media).
- func (c *TimelineInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TimelineInsertCall {
- c.progressUpdater_ = pu
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineInsertCall) Fields(s ...googleapi.Field) *TimelineInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- // This context will supersede any context previously provided to the
- // ResumableMedia method.
- func (c *TimelineInsertCall) Context(ctx context.Context) *TimelineInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline")
- if c.media_ != nil || c.resumableBuffer_ != nil {
- urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
- protocol := "multipart"
- if c.resumableBuffer_ != nil {
- protocol = "resumable"
- }
- c.urlParams_.Set("uploadType", protocol)
- }
- urls += "?" + c.urlParams_.Encode()
- if c.media_ != nil {
- var combined io.ReadCloser
- combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
- defer combined.Close()
- body = combined
- }
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.SetOpaque(req.URL)
- if c.resumableBuffer_ != nil {
- req.Header.Set("X-Upload-Content-Type", c.mediaType_)
- }
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.insert" call.
- // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *TimelineItem.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TimelineInsertCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
- return c.doRequest("json")
- }, gensupport.DefaultBackoffStrategy())
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- if c.resumableBuffer_ != nil {
- loc := res.Header.Get("Location")
- rx := &gensupport.ResumableUpload{
- Client: c.s.client,
- UserAgent: c.s.userAgent(),
- URI: loc,
- Media: c.resumableBuffer_,
- MediaType: c.mediaType_,
- Callback: func(curr int64) {
- if c.progressUpdater_ != nil {
- c.progressUpdater_(curr, c.mediaSize_)
- }
- },
- }
- ctx := c.ctx_
- if ctx == nil {
- ctx = context.TODO()
- }
- res, err = rx.Upload(ctx)
- if err != nil {
- return nil, err
- }
- defer res.Body.Close()
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- }
- ret := &TimelineItem{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Inserts a new item into the timeline.",
- // "httpMethod": "POST",
- // "id": "mirror.timeline.insert",
- // "mediaUpload": {
- // "accept": [
- // "audio/*",
- // "image/*",
- // "video/*"
- // ],
- // "maxSize": "10MB",
- // "protocols": {
- // "resumable": {
- // "multipart": true,
- // "path": "/resumable/upload/mirror/v1/timeline"
- // },
- // "simple": {
- // "multipart": true,
- // "path": "/upload/mirror/v1/timeline"
- // }
- // }
- // },
- // "path": "timeline",
- // "request": {
- // "$ref": "TimelineItem"
- // },
- // "response": {
- // "$ref": "TimelineItem"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ],
- // "supportsMediaUpload": true
- // }
- }
- // method id "mirror.timeline.list":
- type TimelineListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Retrieves a list of timeline items for the authenticated user.
- func (r *TimelineService) List() *TimelineListCall {
- c := &TimelineListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
- // BundleId sets the optional parameter "bundleId": If provided, only
- // items with the given bundleId will be returned.
- func (c *TimelineListCall) BundleId(bundleId string) *TimelineListCall {
- c.urlParams_.Set("bundleId", bundleId)
- return c
- }
- // IncludeDeleted sets the optional parameter "includeDeleted": If true,
- // tombstone records for deleted items will be returned.
- func (c *TimelineListCall) IncludeDeleted(includeDeleted bool) *TimelineListCall {
- c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
- return c
- }
- // MaxResults sets the optional parameter "maxResults": The maximum
- // number of items to include in the response, used for paging.
- func (c *TimelineListCall) MaxResults(maxResults int64) *TimelineListCall {
- c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
- return c
- }
- // OrderBy sets the optional parameter "orderBy": Controls the order in
- // which timeline items are returned.
- //
- // Possible values:
- // "displayTime" - Results will be ordered by displayTime (default).
- // This is the same ordering as is used in the timeline on the device.
- // "writeTime" - Results will be ordered by the time at which they
- // were last written to the data store.
- func (c *TimelineListCall) OrderBy(orderBy string) *TimelineListCall {
- c.urlParams_.Set("orderBy", orderBy)
- return c
- }
- // PageToken sets the optional parameter "pageToken": Token for the page
- // of results to return.
- func (c *TimelineListCall) PageToken(pageToken string) *TimelineListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // PinnedOnly sets the optional parameter "pinnedOnly": If true, only
- // pinned items will be returned.
- func (c *TimelineListCall) PinnedOnly(pinnedOnly bool) *TimelineListCall {
- c.urlParams_.Set("pinnedOnly", fmt.Sprint(pinnedOnly))
- return c
- }
- // SourceItemId sets the optional parameter "sourceItemId": If provided,
- // only items with the given sourceItemId will be returned.
- func (c *TimelineListCall) SourceItemId(sourceItemId string) *TimelineListCall {
- c.urlParams_.Set("sourceItemId", sourceItemId)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineListCall) Fields(s ...googleapi.Field) *TimelineListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TimelineListCall) IfNoneMatch(entityTag string) *TimelineListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TimelineListCall) Context(ctx context.Context) *TimelineListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.list" call.
- // Exactly one of *TimelineListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *TimelineListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *TimelineListCall) Do(opts ...googleapi.CallOption) (*TimelineListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TimelineListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves a list of timeline items for the authenticated user.",
- // "httpMethod": "GET",
- // "id": "mirror.timeline.list",
- // "parameters": {
- // "bundleId": {
- // "description": "If provided, only items with the given bundleId will be returned.",
- // "location": "query",
- // "type": "string"
- // },
- // "includeDeleted": {
- // "description": "If true, tombstone records for deleted items will be returned.",
- // "location": "query",
- // "type": "boolean"
- // },
- // "maxResults": {
- // "description": "The maximum number of items to include in the response, used for paging.",
- // "format": "uint32",
- // "location": "query",
- // "type": "integer"
- // },
- // "orderBy": {
- // "description": "Controls the order in which timeline items are returned.",
- // "enum": [
- // "displayTime",
- // "writeTime"
- // ],
- // "enumDescriptions": [
- // "Results will be ordered by displayTime (default). This is the same ordering as is used in the timeline on the device.",
- // "Results will be ordered by the time at which they were last written to the data store."
- // ],
- // "location": "query",
- // "type": "string"
- // },
- // "pageToken": {
- // "description": "Token for the page of results to return.",
- // "location": "query",
- // "type": "string"
- // },
- // "pinnedOnly": {
- // "description": "If true, only pinned items will be returned.",
- // "location": "query",
- // "type": "boolean"
- // },
- // "sourceItemId": {
- // "description": "If provided, only items with the given sourceItemId will be returned.",
- // "location": "query",
- // "type": "string"
- // }
- // },
- // "path": "timeline",
- // "response": {
- // "$ref": "TimelineListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *TimelineListCall) Pages(ctx context.Context, f func(*TimelineListResponse) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "mirror.timeline.patch":
- type TimelinePatchCall struct {
- s *Service
- id string
- timelineitem *TimelineItem
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Patch: Updates a timeline item in place. This method supports patch
- // semantics.
- func (r *TimelineService) Patch(id string, timelineitem *TimelineItem) *TimelinePatchCall {
- c := &TimelinePatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- c.timelineitem = timelineitem
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelinePatchCall) Fields(s ...googleapi.Field) *TimelinePatchCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TimelinePatchCall) Context(ctx context.Context) *TimelinePatchCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelinePatchCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PATCH", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.patch" call.
- // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *TimelineItem.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TimelinePatchCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &TimelineItem{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates a timeline item in place. This method supports patch semantics.",
- // "httpMethod": "PATCH",
- // "id": "mirror.timeline.patch",
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the timeline item.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{id}",
- // "request": {
- // "$ref": "TimelineItem"
- // },
- // "response": {
- // "$ref": "TimelineItem"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.timeline.update":
- type TimelineUpdateCall struct {
- s *Service
- id string
- timelineitem *TimelineItem
- urlParams_ gensupport.URLParams
- media_ io.Reader
- resumableBuffer_ *gensupport.ResumableBuffer
- mediaType_ string
- mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
- progressUpdater_ googleapi.ProgressUpdater
- ctx_ context.Context
- }
- // Update: Updates a timeline item in place.
- func (r *TimelineService) Update(id string, timelineitem *TimelineItem) *TimelineUpdateCall {
- c := &TimelineUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.id = id
- c.timelineitem = timelineitem
- return c
- }
- // Media specifies the media to upload in one or more chunks. The chunk
- // size may be controlled by supplying a MediaOption generated by
- // googleapi.ChunkSize. The chunk size defaults to
- // googleapi.DefaultUploadChunkSize.
- // At most one of Media and ResumableMedia may be set.
- func (c *TimelineUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *TimelineUpdateCall {
- opts := googleapi.ProcessMediaOptions(options)
- chunkSize := opts.ChunkSize
- r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
- c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
- return c
- }
- // ResumableMedia specifies the media to upload in chunks and can be
- // canceled with ctx.
- //
- // Deprecated: use Media instead.
- //
- // At most one of Media and ResumableMedia may be set. mediaType
- // identifies the MIME media type of the upload, such as "image/png". If
- // mediaType is "", it will be auto-detected. The provided ctx will
- // supersede any context previously provided to the Context method.
- func (c *TimelineUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TimelineUpdateCall {
- c.ctx_ = ctx
- rdr := gensupport.ReaderAtToReader(r, size)
- rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
- c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
- c.media_ = nil
- c.mediaSize_ = size
- return c
- }
- // ProgressUpdater provides a callback function that will be called
- // after every chunk. It should be a low-latency function in order to
- // not slow down the upload operation. This should only be called when
- // using ResumableMedia (as opposed to Media).
- func (c *TimelineUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TimelineUpdateCall {
- c.progressUpdater_ = pu
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineUpdateCall) Fields(s ...googleapi.Field) *TimelineUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- // This context will supersede any context previously provided to the
- // ResumableMedia method.
- func (c *TimelineUpdateCall) Context(ctx context.Context) *TimelineUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.timelineitem)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{id}")
- if c.media_ != nil || c.resumableBuffer_ != nil {
- urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
- protocol := "multipart"
- if c.resumableBuffer_ != nil {
- protocol = "resumable"
- }
- c.urlParams_.Set("uploadType", protocol)
- }
- urls += "?" + c.urlParams_.Encode()
- if c.media_ != nil {
- var combined io.ReadCloser
- combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
- defer combined.Close()
- body = combined
- }
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "id": c.id,
- })
- if c.resumableBuffer_ != nil {
- req.Header.Set("X-Upload-Content-Type", c.mediaType_)
- }
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.update" call.
- // Exactly one of *TimelineItem or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *TimelineItem.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TimelineUpdateCall) Do(opts ...googleapi.CallOption) (*TimelineItem, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
- return c.doRequest("json")
- }, gensupport.DefaultBackoffStrategy())
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- if c.resumableBuffer_ != nil {
- loc := res.Header.Get("Location")
- rx := &gensupport.ResumableUpload{
- Client: c.s.client,
- UserAgent: c.s.userAgent(),
- URI: loc,
- Media: c.resumableBuffer_,
- MediaType: c.mediaType_,
- Callback: func(curr int64) {
- if c.progressUpdater_ != nil {
- c.progressUpdater_(curr, c.mediaSize_)
- }
- },
- }
- ctx := c.ctx_
- if ctx == nil {
- ctx = context.TODO()
- }
- res, err = rx.Upload(ctx)
- if err != nil {
- return nil, err
- }
- defer res.Body.Close()
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- }
- ret := &TimelineItem{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Updates a timeline item in place.",
- // "httpMethod": "PUT",
- // "id": "mirror.timeline.update",
- // "mediaUpload": {
- // "accept": [
- // "audio/*",
- // "image/*",
- // "video/*"
- // ],
- // "maxSize": "10MB",
- // "protocols": {
- // "resumable": {
- // "multipart": true,
- // "path": "/resumable/upload/mirror/v1/timeline/{id}"
- // },
- // "simple": {
- // "multipart": true,
- // "path": "/upload/mirror/v1/timeline/{id}"
- // }
- // }
- // },
- // "parameterOrder": [
- // "id"
- // ],
- // "parameters": {
- // "id": {
- // "description": "The ID of the timeline item.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{id}",
- // "request": {
- // "$ref": "TimelineItem"
- // },
- // "response": {
- // "$ref": "TimelineItem"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.location",
- // "https://www.googleapis.com/auth/glass.timeline"
- // ],
- // "supportsMediaUpload": true
- // }
- }
- // method id "mirror.timeline.attachments.delete":
- type TimelineAttachmentsDeleteCall struct {
- s *Service
- itemId string
- attachmentId string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Deletes an attachment from a timeline item.
- func (r *TimelineAttachmentsService) Delete(itemId string, attachmentId string) *TimelineAttachmentsDeleteCall {
- c := &TimelineAttachmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.itemId = itemId
- c.attachmentId = attachmentId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineAttachmentsDeleteCall) Fields(s ...googleapi.Field) *TimelineAttachmentsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TimelineAttachmentsDeleteCall) Context(ctx context.Context) *TimelineAttachmentsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineAttachmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments/{attachmentId}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "itemId": c.itemId,
- "attachmentId": c.attachmentId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.attachments.delete" call.
- func (c *TimelineAttachmentsDeleteCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "description": "Deletes an attachment from a timeline item.",
- // "httpMethod": "DELETE",
- // "id": "mirror.timeline.attachments.delete",
- // "parameterOrder": [
- // "itemId",
- // "attachmentId"
- // ],
- // "parameters": {
- // "attachmentId": {
- // "description": "The ID of the attachment.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "itemId": {
- // "description": "The ID of the timeline item the attachment belongs to.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{itemId}/attachments/{attachmentId}",
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
- // method id "mirror.timeline.attachments.get":
- type TimelineAttachmentsGetCall struct {
- s *Service
- itemId string
- attachmentId string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Retrieves an attachment on a timeline item by item ID and
- // attachment ID.
- func (r *TimelineAttachmentsService) Get(itemId string, attachmentId string) *TimelineAttachmentsGetCall {
- c := &TimelineAttachmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.itemId = itemId
- c.attachmentId = attachmentId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineAttachmentsGetCall) Fields(s ...googleapi.Field) *TimelineAttachmentsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TimelineAttachmentsGetCall) IfNoneMatch(entityTag string) *TimelineAttachmentsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do and Download
- // methods. Any pending HTTP request will be aborted if the provided
- // context is canceled.
- func (c *TimelineAttachmentsGetCall) Context(ctx context.Context) *TimelineAttachmentsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineAttachmentsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments/{attachmentId}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "itemId": c.itemId,
- "attachmentId": c.attachmentId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Download fetches the API endpoint's "media" value, instead of the normal
- // API response value. If the returned error is nil, the Response is guaranteed to
- // have a 2xx status code. Callers must close the Response.Body as usual.
- func (c *TimelineAttachmentsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("media")
- if err != nil {
- return nil, err
- }
- if err := googleapi.CheckMediaResponse(res); err != nil {
- res.Body.Close()
- return nil, err
- }
- return res, nil
- }
- // Do executes the "mirror.timeline.attachments.get" call.
- // Exactly one of *Attachment or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Attachment.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TimelineAttachmentsGetCall) Do(opts ...googleapi.CallOption) (*Attachment, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Attachment{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Retrieves an attachment on a timeline item by item ID and attachment ID.",
- // "httpMethod": "GET",
- // "id": "mirror.timeline.attachments.get",
- // "parameterOrder": [
- // "itemId",
- // "attachmentId"
- // ],
- // "parameters": {
- // "attachmentId": {
- // "description": "The ID of the attachment.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "itemId": {
- // "description": "The ID of the timeline item the attachment belongs to.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{itemId}/attachments/{attachmentId}",
- // "response": {
- // "$ref": "Attachment"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ],
- // "supportsMediaDownload": true
- // }
- }
- // method id "mirror.timeline.attachments.insert":
- type TimelineAttachmentsInsertCall struct {
- s *Service
- itemId string
- urlParams_ gensupport.URLParams
- media_ io.Reader
- resumableBuffer_ *gensupport.ResumableBuffer
- mediaType_ string
- mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_.
- progressUpdater_ googleapi.ProgressUpdater
- ctx_ context.Context
- }
- // Insert: Adds a new attachment to a timeline item.
- func (r *TimelineAttachmentsService) Insert(itemId string) *TimelineAttachmentsInsertCall {
- c := &TimelineAttachmentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.itemId = itemId
- return c
- }
- // Media specifies the media to upload in one or more chunks. The chunk
- // size may be controlled by supplying a MediaOption generated by
- // googleapi.ChunkSize. The chunk size defaults to
- // googleapi.DefaultUploadChunkSize.
- // At most one of Media and ResumableMedia may be set.
- func (c *TimelineAttachmentsInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *TimelineAttachmentsInsertCall {
- opts := googleapi.ProcessMediaOptions(options)
- chunkSize := opts.ChunkSize
- r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType)
- c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize)
- return c
- }
- // ResumableMedia specifies the media to upload in chunks and can be
- // canceled with ctx.
- //
- // Deprecated: use Media instead.
- //
- // At most one of Media and ResumableMedia may be set. mediaType
- // identifies the MIME media type of the upload, such as "image/png". If
- // mediaType is "", it will be auto-detected. The provided ctx will
- // supersede any context previously provided to the Context method.
- func (c *TimelineAttachmentsInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *TimelineAttachmentsInsertCall {
- c.ctx_ = ctx
- rdr := gensupport.ReaderAtToReader(r, size)
- rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType)
- c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize)
- c.media_ = nil
- c.mediaSize_ = size
- return c
- }
- // ProgressUpdater provides a callback function that will be called
- // after every chunk. It should be a low-latency function in order to
- // not slow down the upload operation. This should only be called when
- // using ResumableMedia (as opposed to Media).
- func (c *TimelineAttachmentsInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *TimelineAttachmentsInsertCall {
- c.progressUpdater_ = pu
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineAttachmentsInsertCall) Fields(s ...googleapi.Field) *TimelineAttachmentsInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- // This context will supersede any context previously provided to the
- // ResumableMedia method.
- func (c *TimelineAttachmentsInsertCall) Context(ctx context.Context) *TimelineAttachmentsInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineAttachmentsInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments")
- if c.media_ != nil || c.resumableBuffer_ != nil {
- urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
- protocol := "multipart"
- if c.resumableBuffer_ != nil {
- protocol = "resumable"
- }
- c.urlParams_.Set("uploadType", protocol)
- }
- urls += "?" + c.urlParams_.Encode()
- body = new(bytes.Buffer)
- ctype := "application/json"
- if c.media_ != nil {
- var combined io.ReadCloser
- combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_)
- defer combined.Close()
- body = combined
- }
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "itemId": c.itemId,
- })
- if c.resumableBuffer_ != nil {
- req.Header.Set("X-Upload-Content-Type", c.mediaType_)
- }
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.attachments.insert" call.
- // Exactly one of *Attachment or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Attachment.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *TimelineAttachmentsInsertCall) Do(opts ...googleapi.CallOption) (*Attachment, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := gensupport.Retry(c.ctx_, func() (*http.Response, error) {
- return c.doRequest("json")
- }, gensupport.DefaultBackoffStrategy())
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- if c.resumableBuffer_ != nil {
- loc := res.Header.Get("Location")
- rx := &gensupport.ResumableUpload{
- Client: c.s.client,
- UserAgent: c.s.userAgent(),
- URI: loc,
- Media: c.resumableBuffer_,
- MediaType: c.mediaType_,
- Callback: func(curr int64) {
- if c.progressUpdater_ != nil {
- c.progressUpdater_(curr, c.mediaSize_)
- }
- },
- }
- ctx := c.ctx_
- if ctx == nil {
- ctx = context.TODO()
- }
- res, err = rx.Upload(ctx)
- if err != nil {
- return nil, err
- }
- defer res.Body.Close()
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- }
- ret := &Attachment{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Adds a new attachment to a timeline item.",
- // "httpMethod": "POST",
- // "id": "mirror.timeline.attachments.insert",
- // "mediaUpload": {
- // "accept": [
- // "audio/*",
- // "image/*",
- // "video/*"
- // ],
- // "maxSize": "10MB",
- // "protocols": {
- // "resumable": {
- // "multipart": true,
- // "path": "/resumable/upload/mirror/v1/timeline/{itemId}/attachments"
- // },
- // "simple": {
- // "multipart": true,
- // "path": "/upload/mirror/v1/timeline/{itemId}/attachments"
- // }
- // }
- // },
- // "parameterOrder": [
- // "itemId"
- // ],
- // "parameters": {
- // "itemId": {
- // "description": "The ID of the timeline item the attachment belongs to.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{itemId}/attachments",
- // "response": {
- // "$ref": "Attachment"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ],
- // "supportsMediaUpload": true
- // }
- }
- // method id "mirror.timeline.attachments.list":
- type TimelineAttachmentsListCall struct {
- s *Service
- itemId string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Returns a list of attachments for a timeline item.
- func (r *TimelineAttachmentsService) List(itemId string) *TimelineAttachmentsListCall {
- c := &TimelineAttachmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.itemId = itemId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *TimelineAttachmentsListCall) Fields(s ...googleapi.Field) *TimelineAttachmentsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *TimelineAttachmentsListCall) IfNoneMatch(entityTag string) *TimelineAttachmentsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *TimelineAttachmentsListCall) Context(ctx context.Context) *TimelineAttachmentsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *TimelineAttachmentsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "timeline/{itemId}/attachments")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "itemId": c.itemId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "mirror.timeline.attachments.list" call.
- // Exactly one of *AttachmentsListResponse or error will be non-nil. Any
- // non-2xx status code is an error. Response headers are in either
- // *AttachmentsListResponse.ServerResponse.Header or (if a response was
- // returned at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *TimelineAttachmentsListCall) Do(opts ...googleapi.CallOption) (*AttachmentsListResponse, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &AttachmentsListResponse{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Returns a list of attachments for a timeline item.",
- // "httpMethod": "GET",
- // "id": "mirror.timeline.attachments.list",
- // "parameterOrder": [
- // "itemId"
- // ],
- // "parameters": {
- // "itemId": {
- // "description": "The ID of the timeline item whose attachments should be listed.",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "timeline/{itemId}/attachments",
- // "response": {
- // "$ref": "AttachmentsListResponse"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/glass.timeline"
- // ]
- // }
- }
|